Skip to content

Commit e336e44

Browse files
committed
Ability to skip container mutation (for example for istio)
Signed-off-by: Maksim Kiselev <maksim.kiselev@flant.com>
1 parent ffb1fd8 commit e336e44

File tree

9 files changed

+29
-8
lines changed

9 files changed

+29
-8
lines changed

images/env-injector/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ require (
6262
go.uber.org/multierr v1.11.0 // indirect
6363
golang.org/x/crypto v0.31.0 // indirect
6464
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect
65-
golang.org/x/net v0.26.0 // indirect
65+
golang.org/x/net v0.33.0 // indirect
6666
golang.org/x/oauth2 v0.20.0 // indirect
6767
golang.org/x/sync v0.10.0 // indirect
6868
golang.org/x/sys v0.28.0 // indirect

images/env-injector/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn
203203
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
204204
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
205205
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
206-
golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ=
207-
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
206+
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
207+
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
208208
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
209209
golang.org/x/oauth2 v0.20.0 h1:4mQdhULixXKP1rwYBW0vAijoXnkTG0BLCDRzfe1idMo=
210210
golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=

images/vault-secrets-webhook/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ require (
142142
go.uber.org/zap v1.27.0 // indirect
143143
golang.org/x/crypto v0.31.0 // indirect
144144
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
145-
golang.org/x/net v0.30.0 // indirect
145+
golang.org/x/net v0.33.0 // indirect
146146
golang.org/x/oauth2 v0.22.0 // indirect
147147
golang.org/x/sync v0.10.0 // indirect
148148
golang.org/x/sys v0.28.0 // indirect

images/vault-secrets-webhook/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v
424424
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
425425
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
426426
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
427-
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4=
428-
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU=
427+
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
428+
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
429429
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
430430
golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA=
431431
golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=

images/vault-secrets-webhook/pkg/webhook/config.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ type VaultConfig struct {
6666
ObjectNamespace string
6767
MutateProbes bool
6868
Token string
69+
SkipMutateContainers []string
6970
}
7071

7172
func parseVaultConfig(obj metav1.Object, ar *model.AdmissionReview) VaultConfig {
@@ -142,6 +143,8 @@ func parseVaultConfig(obj metav1.Object, ar *model.AdmissionReview) VaultConfig
142143

143144
vaultConfig.EnvLogServer = viper.GetString("VAULT_ENV_LOG_SERVER")
144145

146+
vaultConfig.SkipMutateContainers = viper.GetStringSlice("skip_mutate_containers")
147+
145148
if val, ok := annotations[common.VaultNamespaceAnnotation]; ok {
146149
vaultConfig.VaultNamespace = val
147150
} else {
@@ -180,6 +183,7 @@ func SetConfigDefaults() {
180183
viper.SetDefault("env_injector_pull_policy", string(corev1.PullIfNotPresent))
181184
viper.SetDefault("addr", "https://stronghold.d8-stronghold:8200")
182185
viper.SetDefault("tls_skip_verify", "false")
186+
viper.SetDefault("skip_mutate_containers", "")
183187
viper.SetDefault("auth_path", "kubernetes_local")
184188
viper.SetDefault("auth_method", "jwt")
185189
viper.SetDefault("role", "")

images/vault-secrets-webhook/pkg/webhook/pod.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,17 @@ func (mw *MutatingWebhook) mutateContainers(ctx context.Context, containers []co
156156
continue
157157
}
158158

159+
if func() bool {
160+
for _, skipContainerName := range vaultConfig.SkipMutateContainers {
161+
if container.Name == skipContainerName {
162+
return true
163+
}
164+
}
165+
return false
166+
}() {
167+
continue
168+
}
169+
159170
mutated = true
160171

161172
args := container.Command

lib/python/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
deckhouse==0.4.9
22
dotmap==1.3.30
33
PyYAML==6.0.1
4-
cryptography==43.0.1
4+
cryptography==44.0.1

templates/registry-secret.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ data:
1212
.dockerconfigjson: {{ . }}
1313
{{- end }}
1414
{{- else }}
15+
{{- if .Values.global.registry }}
16+
{{- with .Values.global.registry.dockercfg }}
1517
---
1618
apiVersion: v1
1719
kind: Secret
@@ -21,5 +23,7 @@ metadata:
2123
{{- include "helm_lib_module_labels" (list $ (dict "app" $.Chart.Name )) | nindent 2 }}
2224
type: kubernetes.io/dockerconfigjson
2325
data:
24-
.dockerconfigjson: {{ .Values.global.registry.dockercfg }}
26+
.dockerconfigjson: {{ . }}
27+
{{- end }}
28+
{{- end }}
2529
{{- end }}

templates/vault-secrets-webhook/deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ spec:
6969
value: "true"
7070
- name: TELEMETRY_LISTEN_ADDRESS
7171
value: "127.0.0.1:8000"
72+
- name: SKIP_MUTATE_CONTAINERS
73+
value: "check-linux-kernel,istio-validation,istio-proxy"
7274
{{- if eq .Values.secretsStoreIntegration.connectionConfiguration "Manual" }}
7375
- name: ADDR
7476
value: {{ .Values.secretsStoreIntegration.connection.url }}

0 commit comments

Comments
 (0)