Skip to content

Commit 18ca596

Browse files
author
Simon Emms
committed
[kots]: add configuration for using a custom CA certificate
1 parent db903d8 commit 18ca596

File tree

3 files changed

+42
-3
lines changed

3 files changed

+42
-3
lines changed
Lines changed: 14 additions & 0 deletions
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

Lines changed: 12 additions & 0 deletions
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 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

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ spec:
2828
- name: reg_incluster
2929
title: Use in-cluster container registry
3030
type: bool
31-
when: '{{repl eq HasLocalRegistry false }}'
31+
when: "{{repl eq HasLocalRegistry false }}"
3232
default: "1"
3333
help_text: You may either use an in-cluster container registry or configure your own external container registry for better performance. This container registry must be accessible from your Kubernetes cluster.
3434
recommended: false
@@ -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,14 +309,20 @@ 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:
308321
- name: ssh_gateway
309322
title: Allow login to your workspace via SSH
310323
type: bool
311324
default: "0"
312-
help_text: 'Enabling the SSH gateway allows use of additional desktop IDEs. IMPORTANT: This uses port 22 on your Kubernetes nodes. When enabled, this will prevent login to the cluster via SSH. If you wish to maintain SSH access to your cluster, please configure another SSH port on your nodes.'
325+
help_text: "Enabling the SSH gateway allows use of additional desktop IDEs. IMPORTANT: This uses port 22 on your Kubernetes nodes. When enabled, this will prevent login to the cluster via SSH. If you wish to maintain SSH access to your cluster, please configure another SSH port on your nodes."
313326

314327
- name: advanced
315328
title: Advanced customizations (Expert Mode)

0 commit comments

Comments
 (0)