Skip to content

Commit 8a321b5

Browse files
Simon Emmsroboquat
Simon Emms
authored andcommitted
[kots]: add configuration for using a custom CA certificate
1 parent 66ba0b1 commit 8a321b5

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright (c) 2022 Gitpod GmbH. All rights reserved.
2+
# Licensed under the MIT License. See License-MIT.txt in the project root for license information.
3+
4+
apiVersion: v1
5+
kind: Secret
6+
metadata:
7+
name: ca-certificate
8+
labels:
9+
app: gitpod
10+
component: gitpod-installer
11+
annotations:
12+
kots.io/when: '{{repl and (ConfigOptionEquals "cert_manager_enabled" "0") (ConfigOptionNotEquals "tls_ca_crt" "") }}'
13+
data:
14+
ca.crt: '{{repl ConfigOption "tls_ca_crt" }}'

install/kots/manifests/gitpod-installer-job.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,18 @@ spec:
194194
yq e -i '.sshGatewayHostKey.name = "ssh-gateway-host-key"' "${CONFIG_FILE}"
195195
fi
196196
197+
if [ '{{repl ConfigOptionEquals "tls_self_signed_enabled" "1" }}' = "true" ];
198+
then
199+
echo "Gitpod: Generating a self-signed certificate with the internal CA"
200+
yq e -i '.customCACert.kind = "secret"' "${CONFIG_FILE}"
201+
yq e -i '.customCACert.name = "ca-issuer-ca"' "${CONFIG_FILE}"
202+
elif [ '{{repl and (ConfigOptionEquals "tls_self_signed_enabled" "0") (ConfigOptionEquals "cert_manager_enabled" "0") (ConfigOptionNotEquals "tls_ca_crt" "") }}' = "true" ];
203+
then
204+
echo "Gitpod: Setting CA to be used for certificate"
205+
yq e -i '.customCACert.kind = "secret"' "${CONFIG_FILE}"
206+
yq e -i '.customCACert.name = "ca-certificate"' "${CONFIG_FILE}"
207+
fi
208+
197209
echo "Gitpod: Patch Gitpod config"
198210
base64 -d "${CONFIG_PATCH_FILE}" > /tmp/patch.yaml
199211
config_patch=$(cat /tmp/patch.yaml)

install/kots/manifests/kots-config.yaml

+14-1
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,14 @@ spec:
258258
title: Use a self-signed TLS certificate
259259
type: bool
260260
default: "0"
261-
help_text: A self-signed certficate should only be used if applying TLS termination to your load balancer or other proxy.
261+
help_text: |
262+
A self-signed certficate should only be used if applying TLS termination to your load balancer or other proxy.
263+
264+
If you are terminating your TLS connection with this certificate, you will need to download the [CA](https://en.wikipedia.org/wiki/Certificate_authority)
265+
certificate and install it to your browser.
266+
267+
To download the certificate, run
268+
`kubectl get secrets -n {{repl Namespace }} ca-issuer-ca -o jsonpath='{.data.ca\.crt}' | base64 -d > ~/ca.crt`
262269
263270
- name: cert_manager_enabled
264271
title: Use cert-manager
@@ -302,6 +309,12 @@ spec:
302309
when: '{{repl and (ConfigOptionEquals "tls_self_signed_enabled" "0") (ConfigOptionEquals "cert_manager_enabled" "0") }}'
303310
help_text: A file containing the TLS private key.
304311

312+
- name: tls_ca_crt
313+
title: CA certificate
314+
type: file
315+
when: '{{repl and (ConfigOptionEquals "tls_self_signed_enabled" "0") (ConfigOptionEquals "cert_manager_enabled" "0") }}'
316+
help_text: A file containing the Certificate Authority certificate. To be used if your certificate is signed by a non-public CA.
317+
305318
- name: features
306319
title: Additional features
307320
items:

0 commit comments

Comments
 (0)