Skip to content

Commit c66e9e2

Browse files
authored
Merge pull request #543 from jetstack/custom-volumes-for-ca-bundles
VC-34488: Add `volumes` and `volumeMounts` for using custom CA bundles in the Venafi Kubernetes Agent
2 parents 0ed607c + 6a8878e commit c66e9e2

File tree

4 files changed

+77
-0
lines changed

4 files changed

+77
-0
lines changed

deploy/charts/venafi-kubernetes-agent/templates/deployment.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ spec:
7474
- name: credentials
7575
mountPath: "/etc/venafi/agent/key"
7676
readOnly: true
77+
{{- with .Values.volumeMounts }}
78+
{{- toYaml . | nindent 12 }}
79+
{{- end }}
7780
{{- with .Values.nodeSelector }}
7881
nodeSelector:
7982
{{- toYaml . | nindent 8 }}
@@ -95,3 +98,6 @@ spec:
9598
secret:
9699
secretName: {{ default "agent-credentials" .Values.authentication.secretName }}
97100
optional: false
101+
{{- with .Values.volumes }}
102+
{{- toYaml . | nindent 8 }}
103+
{{- end }}

deploy/charts/venafi-kubernetes-agent/tests/deployment_test.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,31 @@ tests:
7474
- contains:
7575
path: spec.template.spec.containers[0].command
7676
content: notpreflight
77+
78+
# Check the volumes and volumeMounts works correctly
79+
- it: Volumes and VolumeMounts added correctly
80+
set:
81+
config.organisation: test_org
82+
config.cluster: test_cluster
83+
values:
84+
- ./values/custom-volumes.yaml
85+
asserts:
86+
- isKind:
87+
of: Deployment
88+
- equal:
89+
# In template this comes after credentials and agent config volumeMounts
90+
path: spec.template.spec.containers[0].volumeMounts[?(@.name == "cabundle")]
91+
value:
92+
name: cabundle
93+
mountPath: /etc/ssl/certs/ca-certificates.crt
94+
subPath: ca-certificates.crt
95+
readOnly: true
96+
- equal:
97+
path: spec.template.spec.volumes[?(@.name == "cabundle")].configMap
98+
value:
99+
name: cabundle
100+
optional: false
101+
defaultMode: 0644
102+
items:
103+
- key: cabundle
104+
path: ca-certificates.crt
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
volumes:
2+
- name: cabundle
3+
configMap:
4+
name: cabundle
5+
optional: false
6+
defaultMode: 0644
7+
items:
8+
- key: cabundle
9+
path: ca-certificates.crt
10+
11+
volumeMounts:
12+
- name: cabundle
13+
mountPath: /etc/ssl/certs/ca-certificates.crt
14+
subPath: ca-certificates.crt
15+
readOnly: true

deploy/charts/venafi-kubernetes-agent/values.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,34 @@ command: []
9090
# For example `["--strict", "--oneshot"]`
9191
extraArgs: []
9292

93+
# -- Additional volumes to add to the Venafi Kubernetes Agent container. This is
94+
# useful for mounting a custom CA bundle. For example:
95+
#
96+
# volumes:
97+
# - name: cabundle
98+
# configMap:
99+
# name: cabundle
100+
# optional: false
101+
# defaultMode: 0644
102+
#
103+
# In order to create the ConfigMap, you can use the following command:
104+
#
105+
# kubectl create configmap cabundle \
106+
# --from-file=cabundle=./your/custom/ca/bundle.pem
107+
volumes: []
108+
109+
# -- Additional volume mounts to add to the Venafi Kubernetes Agent container.
110+
# This is useful for mounting a custom CA bundle. Any PEM certificate mounted
111+
# under /etc/ssl/certs will be loaded by the Venafi Kubernetes Agent. For
112+
# example:
113+
#
114+
# volumeMounts:
115+
# - name: cabundle
116+
# mountPath: /etc/ssl/certs/cabundle
117+
# subPath: cabundle
118+
# readOnly: true
119+
volumeMounts: []
120+
93121
# -- Authentication details for the Venafi Kubernetes Agent
94122
authentication:
95123
# -- Name of the secret containing the private key

0 commit comments

Comments
 (0)