Skip to content

Commit 0ed607c

Browse files
authored
feat: enable volumes and volumeMounts to be passed to the jetstack-agent deployment (#540)
* feat: enable volumes and volumeMounts to be passed to the jetstack-agent deployment * docs: Finish doc string and correct typo --------- Signed-off-by: Peter <[email protected]>
1 parent be5fdba commit 0ed607c

File tree

5 files changed

+59
-5
lines changed

5 files changed

+59
-5
lines changed

deploy/charts/jetstack-agent/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,13 @@ kubectl logs -n jetstack-secure $(kubectl get pod -n jetstack-secure -l app.kube
133133
| Key | Type | Default | Description |
134134
|-----|------|---------|-------------|
135135
| affinity | object | `{}` | |
136+
| authentication | object | `{"createSecret":false,"secretKey":"credentials.json","secretName":"agent-credentials","secretValue":"","type":"file"}` | Authentication section for the agent |
136137
| authentication.createSecret | bool | `false` | Reccomend that you do not use this and instead creat the credential secret outside of helm |
137138
| authentication.secretKey | string | `"credentials.json"` | Key name in secret |
138139
| authentication.secretName | string | `"agent-credentials"` | Name of the secret containing agent credentials.json |
139140
| authentication.secretValue | string | `""` | Base64 encoded value from Jetstack Secure Dashboard - only required when createSecret is true |
140141
| authentication.type | string | `"file"` | Type can be "file"/"token" determining how the agent should authenticate the to the backend |
141-
| command | list | `[]` | |
142+
| command | list | `[]` | Override the jetstack-agent entrypoint with specified command. |
142143
| config | object | `{"cluster":"","dataGatherers":{"custom":[],"default":true},"organisation":"","override":{"config":null,"configmap":{"key":null,"name":null},"enabled":false},"period":"0h1m0s","server":"https://platform.jetstack.io"}` | Configuration section for the Jetstack Agent itself |
143144
| config.cluster | string | `""` | REQUIRED - Your Jetstack Secure Cluster Name |
144145
| config.dataGatherers | object | `{"custom":[],"default":true}` | Configure data that is gathered from your cluster, for full details see https://platform.jetstack.io/documentation/configuration/jetstack-agent/configuration |
@@ -151,7 +152,7 @@ kubectl logs -n jetstack-secure $(kubectl get pod -n jetstack-secure -l app.kube
151152
| config.override.enabled | bool | `false` | Override disabled by default |
152153
| config.period | string | `"0h1m0s"` | Send data back to the platform every minute unless changed |
153154
| config.server | string | `"https://platform.jetstack.io"` | Overrides the server if using a proxy between agent and Jetstack Secure |
154-
| extraArgs | list | `[]` | |
155+
| extraArgs | list | `[]` | Add additional arguments to the default `agent` command. |
155156
| fullnameOverride | string | `""` | Helm default setting, use this to shorten install name |
156157
| image.pullPolicy | string | `"IfNotPresent"` | Defaults to only pull if not already present |
157158
| image.repository | string | `"quay.io/jetstack/preflight"` | Default to Open Source image repository |
@@ -174,4 +175,6 @@ kubectl logs -n jetstack-secure $(kubectl get pod -n jetstack-secure -l app.kube
174175
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created @default true |
175176
| serviceAccount.name | string | `""` | |
176177
| tolerations | list | `[]` | |
178+
| volumeMounts | list | `[]` | Additional volume mounts to add to the jetstack-agent container. |
179+
| volumes | list | `[]` | Additional volumes to add to the jetstack-agent pod. |
177180

deploy/charts/jetstack-agent/templates/deployment.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ spec:
7575
mountPath: "/etc/jetstack-secure/agent/credentials"
7676
readOnly: true
7777
{{- end }}
78+
{{- with .Values.volumeMounts }}
79+
{{- toYaml . | nindent 12 }}
80+
{{- end }}
7881
{{- with .Values.nodeSelector }}
7982
nodeSelector:
8083
{{- toYaml . | nindent 8 }}
@@ -103,3 +106,6 @@ spec:
103106
secret:
104107
secretName: {{ default "agent-credentials" .Values.authentication.secretName }}
105108
optional: false
109+
{{- with .Values.volumes }}
110+
{{- toYaml . | nindent 8 }}
111+
{{- end }}

deploy/charts/jetstack-agent/tests/deployment_test.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,27 @@ tests:
9090
- contains:
9191
path: spec.template.spec.containers[0].command
9292
content: notpreflight
93+
94+
# Check the volumes and volumeMounts works correctly
95+
- it: Volumes and VolumeMounts added correctly
96+
set:
97+
config.organisation: test_org
98+
config.cluster: test_cluster
99+
values:
100+
- ./values/custom-volumes.yaml
101+
asserts:
102+
- isKind:
103+
of: Deployment
104+
- equal:
105+
# In template this comes after credentials and agent config volumeMounts
106+
path: spec.template.spec.containers[0].volumeMounts[?(@.name == "cabundle")]
107+
value:
108+
mountPath: /etc/ssl/certs/
109+
name: cabundle
110+
readOnly: true
111+
- equal:
112+
path: spec.template.spec.volumes[?(@.name == "cabundle")].configmap
113+
value:
114+
defaultMode: 420
115+
name: cabundle
116+
optional: true
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
volumes:
2+
- name: cabundle
3+
configmap:
4+
name: cabundle
5+
optional: true
6+
defaultMode: 0644
7+
8+
volumeMounts:
9+
- name: cabundle
10+
readOnly: true
11+
mountPath: /etc/ssl/certs/

deploy/charts/jetstack-agent/values.yaml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,19 @@ tolerations: []
6262

6363
affinity: {}
6464

65+
# -- Additional volumes to add to the jetstack-agent pod.
66+
volumes: []
67+
68+
# -- Additional volume mounts to add to the jetstack-agent container.
69+
volumeMounts: []
70+
71+
# -- Override the jetstack-agent entrypoint with specified command.
72+
command: []
73+
74+
# -- Add additional arguments to the default `agent` command.
75+
extraArgs: []
76+
77+
# -- Authentication section for the agent
6578
authentication:
6679
# -- Reccomend that you do not use this and instead creat the credential secret outside of helm
6780
createSecret: false
@@ -74,9 +87,6 @@ authentication:
7487
# -- Base64 encoded value from Jetstack Secure Dashboard - only required when createSecret is true
7588
secretValue: ""
7689

77-
command: []
78-
extraArgs: []
79-
8090
# -- Configuration section for the Jetstack Agent itself
8191
config:
8292
# -- Overrides the server if using a proxy between agent and Jetstack Secure

0 commit comments

Comments
 (0)