Skip to content

Commit d278b8d

Browse files
committed
helm: venafi agent: add volumes and volumeMounts for custom CA bundles
1 parent 0ed607c commit d278b8d

File tree

4 files changed

+81
-2
lines changed

4 files changed

+81
-2
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: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ serviceAccount:
3636
podAnnotations: {}
3737

3838
# -- Optional Pod (all containers) `SecurityContext` options, see https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod.
39-
podSecurityContext: {}
39+
podSecurityContext:
40+
{}
4041
# runAsUser: 1000
4142
# runAsGroup: 3000
4243
# fsGroup: 2000
@@ -60,7 +61,7 @@ podSecurityContext: {}
6061
securityContext:
6162
capabilities:
6263
drop:
63-
- ALL
64+
- ALL
6465
readOnlyRootFilesystem: true
6566
runAsNonRoot: true
6667
runAsUser: 1000
@@ -90,6 +91,35 @@ command: []
9091
# For example `["--strict", "--oneshot"]`
9192
extraArgs: []
9293

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

0 commit comments

Comments
 (0)