Skip to content

Commit 0678c6c

Browse files
author
felix.phipps
committed
initial commit
Signed-off-by: felix.phipps <felix.phipps@cyberark.com>
1 parent b7cf60b commit 0678c6c

12 files changed

Lines changed: 378 additions & 28 deletions

File tree

deploy/charts/disco-agent/README.md

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,54 @@ kubectl logs deployments/disco-agent --namespace "${NAMESPACE}" --follow
9191
> ```
9292
9393
This will set the replicaset count more information can be found here: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/
94+
#### **imageRegistry** ~ `string`
95+
> Default value:
96+
> ```yaml
97+
> ""
98+
> ```
99+
100+
The container registry used for disco-agent images by default. This can include path prefixes (e.g. "artifactory.example.com/docker").
101+
102+
#### **imageNamespace** ~ `string`
103+
> Default value:
104+
> ```yaml
105+
> ""
106+
> ```
107+
108+
The repository namespace used for disco-agent images by default.
109+
Examples:
110+
- jetstack
111+
- custom-namespace
112+
113+
#### **image.registry** ~ `string`
114+
115+
Deprecated: per-component registry prefix.
116+
117+
If set, this value is *prepended* to the image repository that the chart would otherwise render. This applies both when `image.repository` is set and when the repository is computed from
118+
`imageRegistry` + `imageNamespace` + `image.name`.
119+
120+
This can produce "double registry" style references such as
121+
`legacy.example.io/quay.io/jetstack/...`. Prefer using the global
122+
`imageRegistry`/`imageNamespace` values.
123+
94124
#### **image.repository** ~ `string`
95125
> Default value:
96126
> ```yaml
97127
> ""
98128
> ```
129+
130+
Full repository override (takes precedence over `imageRegistry`, `imageNamespace`, and `image.name`).
131+
Example: quay.io/jetstack/disco-agent
132+
133+
#### **image.name** ~ `string`
134+
> Default value:
135+
> ```yaml
136+
> disco-agent
137+
> ```
138+
139+
The image name for the Discovery Agent.
140+
This is used (together with `imageRegistry` and `imageNamespace`) to construct the full image reference.
141+
99142
#### **image.pullPolicy** ~ `string`
100143
> Default value:
101144
> ```yaml
@@ -109,14 +152,14 @@ This sets the pull policy for images.
109152
> ""
110153
> ```
111154
112-
Overrides the image tag whose default is the chart appVersion.
155+
Override the image tag to deploy by setting this variable. If no value is set, the chart's appVersion is used.
113156
#### **image.digest** ~ `string`
114157
> Default value:
115158
> ```yaml
116159
> ""
117160
> ```
118161
119-
The image digest
162+
Override the image digest to deploy by setting this variable. If set together with `image.tag`, the rendered image will include both tag and digest.
120163
#### **imagePullSecrets** ~ `array`
121164
> Default value:
122165
> ```yaml
@@ -406,3 +449,5 @@ endpointAdditionalProperties:
406449
targetLabel: instance
407450
```
408451
452+
<!-- /AUTO-GENERATED -->
453+

deploy/charts/disco-agent/templates/_helpers.tpl

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,61 @@ Create the name of the service account to use
6060
{{- default "default" .Values.serviceAccount.name }}
6161
{{- end }}
6262
{{- end }}
63+
64+
{{/*
65+
Util function for generating the image URL based on the provided options.
66+
IMPORTANT: This function is standardized across all charts in the cert-manager GH organization.
67+
Any changes to this function should also be made in cert-manager, trust-manager, approver-policy, ...
68+
See https://github.com/cert-manager/cert-manager/issues/6329 for a list of linked PRs.
69+
*/}}
70+
{{- define "image" -}}
71+
{{- /*
72+
Calling convention:
73+
- (tuple <imageValues> <imageRegistry> <imageNamespace> <defaultReference>)
74+
We intentionally pass imageRegistry/imageNamespace as explicit arguments rather than reading
75+
from `.Values` inside this helper, because `helm-tool lint` does not reliably track `.Values.*`
76+
usage through tuple/variable indirection.
77+
*/ -}}
78+
{{- if ne (len .) 4 -}}
79+
{{- fail (printf "ERROR: template \"image\" expects (tuple <imageValues> <imageRegistry> <imageNamespace> <defaultReference>), got %d arguments" (len .)) -}}
80+
{{- end -}}
81+
{{- $image := index . 0 -}}
82+
{{- $imageRegistry := index . 1 | default "" -}}
83+
{{- $imageNamespace := index . 2 | default "" -}}
84+
{{- $defaultReference := index . 3 -}}
85+
{{- $repository := "" -}}
86+
{{- if $image.repository -}}
87+
{{- $repository = $image.repository -}}
88+
{{- /*
89+
Backwards compatibility: if image.registry is set, additionally prefix the repository with this registry.
90+
*/ -}}
91+
{{- if $image.registry -}}
92+
{{- $repository = printf "%s/%s" $image.registry $repository -}}
93+
{{- end -}}
94+
{{- else -}}
95+
{{- $name := required "ERROR: image.name must be set when image.repository is empty" $image.name -}}
96+
{{- $repository = $name -}}
97+
{{- if $imageNamespace -}}
98+
{{- $repository = printf "%s/%s" $imageNamespace $repository -}}
99+
{{- end -}}
100+
{{- if $imageRegistry -}}
101+
{{- $repository = printf "%s/%s" $imageRegistry $repository -}}
102+
{{- end -}}
103+
{{- /*
104+
Backwards compatibility: if image.registry is set, additionally prefix the repository with this registry.
105+
*/ -}}
106+
{{- if $image.registry -}}
107+
{{- $repository = printf "%s/%s" $image.registry $repository -}}
108+
{{- end -}}
109+
{{- end -}}
110+
{{- $repository -}}
111+
{{- if and $image.tag $image.digest -}}
112+
{{- printf ":%s@%s" $image.tag $image.digest -}}
113+
{{- else if $image.tag -}}
114+
{{- printf ":%s" $image.tag -}}
115+
{{- else if $image.digest -}}
116+
{{- printf "@%s" $image.digest -}}
117+
{{- else -}}
118+
{{- printf "%s" $defaultReference -}}
119+
{{- end -}}
120+
{{- end }}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ spec:
3636
securityContext:
3737
{{- toYaml . | nindent 12 }}
3838
{{- end }}
39-
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}{{- with .Values.image.digest }}@{{ . }}{{- end }}"
39+
image: "{{ template "image" (tuple .Values.image .Values.imageRegistry .Values.imageNamespace (printf ":%s" .Chart.AppVersion)) }}"
4040
imagePullPolicy: {{ .Values.image.pullPolicy }}
4141
env:
4242
- name: POD_NAMESPACE

deploy/charts/disco-agent/values.schema.json

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,15 @@
3030
"image": {
3131
"$ref": "#/$defs/helm-values.image"
3232
},
33+
"imageNamespace": {
34+
"$ref": "#/$defs/helm-values.imageNamespace"
35+
},
3336
"imagePullSecrets": {
3437
"$ref": "#/$defs/helm-values.imagePullSecrets"
3538
},
39+
"imageRegistry": {
40+
"$ref": "#/$defs/helm-values.imageRegistry"
41+
},
3642
"metrics": {
3743
"$ref": "#/$defs/helm-values.metrics"
3844
},
@@ -183,9 +189,15 @@
183189
"digest": {
184190
"$ref": "#/$defs/helm-values.image.digest"
185191
},
192+
"name": {
193+
"$ref": "#/$defs/helm-values.image.name"
194+
},
186195
"pullPolicy": {
187196
"$ref": "#/$defs/helm-values.image.pullPolicy"
188197
},
198+
"registry": {
199+
"$ref": "#/$defs/helm-values.image.registry"
200+
},
189201
"repository": {
190202
"$ref": "#/$defs/helm-values.image.repository"
191203
},
@@ -197,21 +209,36 @@
197209
},
198210
"helm-values.image.digest": {
199211
"default": "",
200-
"description": "The image digest",
212+
"description": "Override the image digest to deploy by setting this variable. If set together with `image.tag`, the rendered image will include both tag and digest.",
213+
"type": "string"
214+
},
215+
"helm-values.image.name": {
216+
"default": "disco-agent",
217+
"description": "The image name for the Discovery Agent.\nThis is used (together with `imageRegistry` and `imageNamespace`) to construct the full image reference.",
201218
"type": "string"
202219
},
203220
"helm-values.image.pullPolicy": {
204221
"default": "IfNotPresent",
205222
"description": "This sets the pull policy for images.",
206223
"type": "string"
207224
},
225+
"helm-values.image.registry": {
226+
"description": "Deprecated: per-component registry prefix.\n\nIf set, this value is *prepended* to the image repository that the chart would otherwise render. This applies both when `image.repository` is set and when the repository is computed from\n`imageRegistry` + `imageNamespace` + `image.name`.\n\nThis can produce \"double registry\" style references such as\n`legacy.example.io/quay.io/jetstack/...`. Prefer using the global\n`imageRegistry`/`imageNamespace` values.",
227+
"type": "string"
228+
},
208229
"helm-values.image.repository": {
209230
"default": "",
231+
"description": "Full repository override (takes precedence over `imageRegistry`, `imageNamespace`, and `image.name`).\nExample: quay.io/jetstack/disco-agent",
210232
"type": "string"
211233
},
212234
"helm-values.image.tag": {
213235
"default": "",
214-
"description": "Overrides the image tag whose default is the chart appVersion.",
236+
"description": "Override the image tag to deploy by setting this variable. If no value is set, the chart's appVersion is used.",
237+
"type": "string"
238+
},
239+
"helm-values.imageNamespace": {
240+
"default": "",
241+
"description": "The repository namespace used for disco-agent images by default.\nExamples:\n- jetstack\n- custom-namespace",
215242
"type": "string"
216243
},
217244
"helm-values.imagePullSecrets": {
@@ -220,6 +247,11 @@
220247
"items": {},
221248
"type": "array"
222249
},
250+
"helm-values.imageRegistry": {
251+
"default": "",
252+
"description": "The container registry used for disco-agent images by default. This can include path prefixes (e.g. \"artifactory.example.com/docker\").",
253+
"type": "string"
254+
},
223255
"helm-values.metrics": {
224256
"additionalProperties": false,
225257
"properties": {

deploy/charts/disco-agent/values.yaml

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,53 @@
55
# This will set the replicaset count more information can be found here: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/
66
replicaCount: 1
77

8+
# The container registry used for disco-agent images by default.
9+
# This can include path prefixes (e.g. "artifactory.example.com/docker").
10+
# +docs:property
11+
imageRegistry: ""
12+
13+
# The repository namespace used for disco-agent images by default.
14+
# Examples:
15+
# - jetstack
16+
# - custom-namespace
17+
# +docs:property
18+
imageNamespace: ""
19+
820
# This sets the container image more information can be found here: https://kubernetes.io/docs/concepts/containers/images/
921
image:
22+
# Deprecated: per-component registry prefix.
23+
#
24+
# If set, this value is *prepended* to the image repository that the chart would otherwise render.
25+
# This applies both when `image.repository` is set and when the repository is computed from
26+
# `imageRegistry` + `imageNamespace` + `image.name`.
27+
#
28+
# This can produce "double registry" style references such as
29+
# `legacy.example.io/quay.io/jetstack/...`. Prefer using the global
30+
# `imageRegistry`/`imageNamespace` values.
31+
# +docs:property
32+
# registry: quay.io
33+
34+
# Full repository override (takes precedence over `imageRegistry`, `imageNamespace`,
35+
# and `image.name`).
36+
# Example: quay.io/jetstack/disco-agent
37+
# +docs:property
1038
repository: ""
39+
40+
# The image name for the Discovery Agent.
41+
# This is used (together with `imageRegistry` and `imageNamespace`) to construct the full
42+
# image reference.
43+
# +docs:property
44+
name: disco-agent
45+
1146
# This sets the pull policy for images.
1247
pullPolicy: IfNotPresent
13-
# Overrides the image tag whose default is the chart appVersion.
48+
49+
# Override the image tag to deploy by setting this variable.
50+
# If no value is set, the chart's appVersion is used.
1451
tag: ""
15-
# The image digest
52+
53+
# Override the image digest to deploy by setting this variable.
54+
# If set together with `image.tag`, the rendered image will include both tag and digest.
1655
digest: ""
1756

1857
# This is for the secrets for pulling an image from a private repository more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/

deploy/charts/venafi-kubernetes-agent/README.md

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,53 @@ endpointAdditionalProperties:
9999
> ```
100100
101101
default replicas, do not scale up
102+
#### **imageRegistry** ~ `string`
103+
> Default value:
104+
> ```yaml
105+
> registry.venafi.cloud
106+
> ```
107+
108+
The container registry used for venafi-kubernetes-agent images by default. This can include path prefixes (e.g. "artifactory.example.com/docker").
109+
110+
#### **imageNamespace** ~ `string`
111+
> Default value:
112+
> ```yaml
113+
> venafi-agent
114+
> ```
115+
116+
The repository namespace used for venafi-kubernetes-agent images by default.
117+
Examples:
118+
- venafi-agent
119+
- custom-namespace
120+
121+
#### **image.registry** ~ `string`
122+
123+
Deprecated: per-component registry prefix.
124+
125+
If set, this value is *prepended* to the image repository that the chart would otherwise render. This applies both when `image.repository` is set and when the repository is computed from
126+
`imageRegistry` + `imageNamespace` + `image.name`.
127+
128+
This can produce "double registry" style references such as
129+
`legacy.example.io/registry.venafi.cloud/venafi-agent/...`. Prefer using the global
130+
`imageRegistry`/`imageNamespace` values.
131+
102132
#### **image.repository** ~ `string`
103133
> Default value:
104134
> ```yaml
105-
> registry.venafi.cloud/venafi-agent/venafi-agent
135+
> ""
106136
> ```
107137
108-
The container image for the Discovery Agent.
138+
Full repository override (takes precedence over `imageRegistry`, `imageNamespace`, and `image.name`). Example: registry.venafi.cloud/venafi-agent/venafi-agent
139+
140+
#### **image.name** ~ `string`
141+
> Default value:
142+
> ```yaml
143+
> venafi-agent
144+
> ```
145+
146+
The image name for the Discovery Agent.
147+
This is used (together with `imageRegistry` and `imageNamespace`) to construct the full image reference.
148+
109149
#### **image.pullPolicy** ~ `string`
110150
> Default value:
111151
> ```yaml
@@ -116,10 +156,17 @@ Kubernetes imagePullPolicy on Deployment.
116156
#### **image.tag** ~ `string`
117157
> Default value:
118158
> ```yaml
119-
> v0.0.0
159+
> ""
160+
> ```
161+
162+
Override the image tag to deploy by setting this variable. If no value is set, the chart's appVersion is used.
163+
#### **image.digest** ~ `string`
164+
> Default value:
165+
> ```yaml
166+
> ""
120167
> ```
121168
122-
Overrides the image tag whose default is the chart appVersion.
169+
Override the image digest to deploy by setting this variable. If set together with `image.tag`, the rendered image will include both tag and digest.
123170
#### **imagePullSecrets** ~ `array`
124171
> Default value:
125172
> ```yaml

0 commit comments

Comments
 (0)