Skip to content

Commit da9689b

Browse files
committed
Fix webhook/cert namespace
1 parent bf986f3 commit da9689b

File tree

2 files changed

+41
-10
lines changed

2 files changed

+41
-10
lines changed

deploy/helm/templates/static-resources.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ metadata:
1717
namespace: '{{ .Release.Namespace }}'
1818
spec:
1919
dnsNames:
20-
- webhook-service.security-profiles-operator.svc
21-
- webhook-service.security-profiles-operator.svc.cluster.local
20+
- webhook-service.{{.Release.Namespace}}.svc
21+
- webhook-service.{{.Release.Namespace}}.svc.cluster.local
2222
issuerRef:
2323
kind: Issuer
2424
name: selfsigned-issuer
@@ -121,9 +121,9 @@ metadata:
121121
namespace: '{{ .Release.Namespace }}'
122122
spec:
123123
dnsNames:
124-
- metrics.security-profiles-operator
125-
- metrics.security-profiles-operator.svc
126-
- metrics.security-profiles-operator.svc.cluster.local
124+
- metrics.{{.Release.Namespace}}
125+
- metrics.{{.Release.Namespace}}.svc
126+
- metrics.{{.Release.Namespace}}.svc.cluster.local
127127
issuerRef:
128128
kind: Issuer
129129
name: selfsigned-issuer
@@ -3039,7 +3039,7 @@ apiVersion: admissionregistration.k8s.io/v1
30393039
kind: MutatingWebhookConfiguration
30403040
metadata:
30413041
annotations:
3042-
cert-manager.io/inject-ca-from: security-profiles-operator/webhook-cert
3042+
cert-manager.io/inject-ca-from: '{{.Release.Namespace}}/webhook-cert'
30433043
labels:
30443044
app: '{{.Release.Name}}'
30453045
name: spo-mutating-webhook-configuration
@@ -3064,8 +3064,8 @@ webhooks:
30643064
- key: name
30653065
operator: NotIn
30663066
values:
3067-
- security-profiles-operator
3068-
- security-profiles-operator-webhook
3067+
- '{{ include "security-profiles-operator.name" . }}'
3068+
- '{{ include "security-profiles-operator.name" . }}-webhook'
30693069
rules:
30703070
- apiGroups:
30713071
- '*'
@@ -3099,8 +3099,8 @@ webhooks:
30993099
- key: name
31003100
operator: NotIn
31013101
values:
3102-
- security-profiles-operator
3103-
- security-profiles-operator-webhook
3102+
- '{{ include "security-profiles-operator.name" . }}'
3103+
- '{{ include "security-profiles-operator.name" . }}-webhook'
31043104
rules:
31053105
- apiGroups:
31063106
- '*'

deploy/overlays/helm/kustomization.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,36 @@ patches:
6767
path: /spec/selector/name
6868
value: '{{ include "security-profiles-operator.name" . }}-webhook'
6969
70+
# Fix webhook/cert namespaces
71+
- target: { name: webhook-cert }
72+
patch: |
73+
- op: replace
74+
path: /spec/dnsNames
75+
value:
76+
- webhook-service.{{.Release.Namespace}}.svc
77+
- webhook-service.{{.Release.Namespace}}.svc.cluster.local
78+
- target: { name: metrics-cert }
79+
patch: |
80+
- op: replace
81+
path: /spec/dnsNames
82+
value:
83+
- metrics.{{.Release.Namespace}}
84+
- metrics.{{.Release.Namespace}}.svc
85+
- metrics.{{.Release.Namespace}}.svc.cluster.local
86+
- target: { name: spo-mutating-webhook-configuration }
87+
patch: |
88+
- op: replace
89+
path: /metadata/annotations/cert-manager.io~1inject-ca-from
90+
value: "{{.Release.Namespace}}/webhook-cert"
91+
- op: replace
92+
path: /webhooks/0/objectSelector/matchExpressions/0/values
93+
value: &val
94+
- '{{ include "security-profiles-operator.name" . }}'
95+
- '{{ include "security-profiles-operator.name" . }}-webhook'
96+
- op: replace
97+
path: /webhooks/1/objectSelector/matchExpressions/0/values
98+
value: *val
99+
100+
70101
# Remove the namespace resource.
71102
- path: delete-ns.yaml

0 commit comments

Comments
 (0)