Skip to content

Commit 279d118

Browse files
authored
[SDO-2806] Support proxy on CH Agent (#113)
* Add Truststore support * Make secret optional * Update chart minor version * Better Name for initContainer * Make Truststore password same as cert
1 parent efc9d51 commit 279d118

File tree

4 files changed

+40
-1
lines changed

4 files changed

+40
-1
lines changed

charts/cloudhealth-collector/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ apiVersion: v2
55
name: cloudhealth-collector
66
description: A Helm chart for CloudHealth's Kubernetes Collector Agent
77
type: application
8-
version: 4.4.1
8+
version: 4.5.0
99
appVersion: "5.2.0"
1010
home: https://cloudhealth.vmware.com/
1111
icon: https://d1fto35gcfffzn.cloudfront.net/images/Tanzu-Logomark.svg

charts/cloudhealth-collector/templates/deployment.yaml

+28
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,26 @@ spec:
3232
securityContext: {{- toYaml . | nindent 8 }}
3333
{{- end }}
3434
priorityClassName: {{ .Values.priorityClassName }}
35+
{{- if .Values.proxy.sslCert }}
36+
initContainers:
37+
- name: "{{ .Chart.Name }}-pem-to-truststore"
38+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
39+
env:
40+
- name: ca_bundle
41+
value: {{ .Values.proxy.caBundlePath }}
42+
- name: truststore_jks
43+
value: {{ .Values.proxy.truststorePath }}
44+
- name: truststore_pwd
45+
valueFrom:
46+
secretKeyRef:
47+
name: {{ include "cloudhealth-collector.secretName" . }}
48+
key: certPassword
49+
command: ['/bin/bash']
50+
args: ['-c', "csplit -z -f crt- $ca_bundle '/-----BEGIN CERTIFICATE-----/' '{*}' && for file in crt-*; do keytool -import -noprompt -keystore $truststore_jks -file $file -storepass $truststore_pwd -alias service-$file; done"]
51+
volumeMounts:
52+
- name: truststore-volume
53+
mountPath: /etc/ssl/certs
54+
{{- end }}
3555
containers:
3656
- name: {{ .Chart.Name }}
3757
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
@@ -69,6 +89,10 @@ spec:
6989
value: {{ .Values.collectionIntervalSecs | quote }}
7090
- name: CHT_JVM_MEM
7191
value: {{ .Values.jvmMemory }}
92+
{{- if .Values.proxy.sslCert }}
93+
- name: JAVA_OPTS
94+
value: {{ .Values.proxy.params }}
95+
{{- end }}
7296
{{- range .Values.customEnvVars}}
7397
- name: {{ .name }}
7498
value: {{ .value }}
@@ -101,4 +125,8 @@ spec:
101125
volumes:
102126
- name: tmpfs
103127
emptyDir: {}
128+
{{- if .Values.proxy.sslCert }}
129+
- name: truststore-volume
130+
emptyDir: {}
131+
{{- end }}
104132
{{- end }}

charts/cloudhealth-collector/templates/secrets.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,7 @@ metadata:
1313
type: Opaque
1414
data:
1515
apiToken: {{ .Values.apiToken | b64enc | quote }}
16+
{{- if .Values.proxy.sslCert }}
17+
certPassword: {{ .Values.proxy.certPassword | quote }}
18+
{{- end }}
1619
{{- end }}

charts/cloudhealth-collector/values.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ containerSecurityContext: {
6565
capabilities: {drop: [all]}
6666
}
6767

68+
proxy:
69+
sslCert: false
70+
#-Dhttps.proxyHost=$PROXY_SERVER -Dhttps.proxyPort=$PROXY_PORT -Dhttps.nonProxyHosts=kubernetes.default.svc -Djavax.net.ssl.trustStore=/etc/ssl/certs/truststore.jks -Djavax.net.ssl.trustStorePassword=changeit
71+
params: ""
72+
certPassword: ""
73+
caBundlePath: "/etc/ssl/certs/bundle.pem"
74+
truststorePath: "/etc/ssl/certs/truststore.jks"
75+
6876
resources:
6977
limits:
7078
cpu: 1000m

0 commit comments

Comments
 (0)