Skip to content

[kots]: add configuration for using a custom CA certificate #9566

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions install/kots/manifests/gitpod-ca-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright (c) 2022 Gitpod GmbH. All rights reserved.
# Licensed under the MIT License. See License-MIT.txt in the project root for license information.

apiVersion: v1
kind: Secret
metadata:
name: ca-certificate
labels:
app: gitpod
component: gitpod-installer
annotations:
kots.io/when: '{{repl and (ConfigOptionEquals "cert_manager_enabled" "0") (ConfigOptionNotEquals "tls_ca_crt" "") }}'
data:
ca.crt: '{{repl ConfigOption "tls_ca_crt" }}'
12 changes: 12 additions & 0 deletions install/kots/manifests/gitpod-installer-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,18 @@ spec:
yq e -i '.sshGatewayHostKey.name = "ssh-gateway-host-key"' "${CONFIG_FILE}"
fi

if [ '{{repl ConfigOptionEquals "tls_self_signed_enabled" "1" }}' = "true" ];
then
echo "Gitpod: Generating a self-signed certificate with the internal CA"
yq e -i '.customCACert.kind = "secret"' "${CONFIG_FILE}"
yq e -i '.customCACert.name = "ca-issuer-ca"' "${CONFIG_FILE}"
elif [ '{{repl and (ConfigOptionEquals "tls_self_signed_enabled" "0") (ConfigOptionEquals "cert_manager_enabled" "0") (ConfigOptionNotEquals "tls_ca_crt" "") }}' = "true" ];
then
echo "Gitpod: Setting CA to be used for certificate"
yq e -i '.customCACert.kind = "secret"' "${CONFIG_FILE}"
yq e -i '.customCACert.name = "ca-certificate"' "${CONFIG_FILE}"
fi

echo "Gitpod: Patch Gitpod config"
base64 -d "${CONFIG_PATCH_FILE}" > /tmp/patch.yaml
config_patch=$(cat /tmp/patch.yaml)
Expand Down
15 changes: 14 additions & 1 deletion install/kots/manifests/kots-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,14 @@ spec:
title: Use a self-signed TLS certificate
type: bool
default: "0"
help_text: A self-signed certficate should only be used if applying TLS termination to your load balancer or other proxy.
help_text: |
A self-signed certficate should only be used if applying TLS termination to your load balancer or other proxy.

If you are terminating your TLS connection with this certificate, you will need to download the [CA](https://en.wikipedia.org/wiki/Certificate_authority)
certificate and install it to your browser.

To download the certificate, run
`kubectl get secrets -n {{repl Namespace }} ca-issuer-ca -o jsonpath='{.data.ca\.crt}' | base64 -d > ~/ca.crt`

- name: cert_manager_enabled
title: Use cert-manager
Expand Down Expand Up @@ -302,6 +309,12 @@ spec:
when: '{{repl and (ConfigOptionEquals "tls_self_signed_enabled" "0") (ConfigOptionEquals "cert_manager_enabled" "0") }}'
help_text: A file containing the TLS private key.

- name: tls_ca_crt
title: CA certificate
type: file
when: '{{repl and (ConfigOptionEquals "tls_self_signed_enabled" "0") (ConfigOptionEquals "cert_manager_enabled" "0") }}'
help_text: A file containing the Certificate Authority certificate. To be used if your certificate is signed by a non-public CA.

- name: features
title: Additional features
items:
Expand Down