Skip to content

Commit c4a5838

Browse files
authored
Merge pull request #4135 from heliapb/fix/rollout_op
[rollout-operator] change: `namespaceSelector` in webooks
2 parents 4f9e507 + b108273 commit c4a5838

File tree

7 files changed

+63
-8
lines changed

7 files changed

+63
-8
lines changed

charts/rollout-operator/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: rollout-operator
33
description: "Grafana rollout-operator"
44
type: application
5-
version: 0.43.0
5+
version: 0.44.0
66
appVersion: v0.35.0
77
home: https://github.com/grafana/rollout-operator
88
kubeVersion: ^1.10.0-0

charts/rollout-operator/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Helm chart for deploying [Grafana rollout-operator](https://github.com/grafana/r
44

55
# rollout-operator
66

7-
![Version: 0.43.0](https://img.shields.io/badge/Version-0.43.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.35.0](https://img.shields.io/badge/AppVersion-v0.35.0-informational?style=flat-square)
7+
![Version: 0.44.0](https://img.shields.io/badge/Version-0.44.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.35.0](https://img.shields.io/badge/AppVersion-v0.35.0-informational?style=flat-square)
88

99
Grafana rollout-operator
1010

@@ -62,7 +62,7 @@ Manually applying these CRDs is only required if upgrading from a chart <= v0.32
6262
| imagePullSecrets | list | `[]` | |
6363
| minReadySeconds | int | `10` | |
6464
| nameOverride | string | `""` | |
65-
| namespaceSelector.matchExpressions | list | `[]` | Namespace selector to filter which namespaces the webhooks apply to. See https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#matching-requests-namespaceselector Example: matchExpressions: - key: team operator: NotIn values: - team-a |
65+
| namespaceSelector | object | `{"matchExpressions":[]}` | Namespace selector applied to all webhooks. Defaults to restricting to the release namespace. See https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#matching-requests-namespaceselector |
6666
| nodeSelector | object | `{}` | |
6767
| podAnnotations | object | `{}` | Pod Annotations |
6868
| podLabels | object | `{}` | Pod (extra) Labels |

charts/rollout-operator/templates/no-downscale-webhook.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,24 @@ webhooks:
2828
scope: Namespaced
2929
admissionReviewVersions:
3030
- v1
31+
{{- if not (kindIs "invalid" .Values.namespaceSelector) }}
3132
namespaceSelector:
33+
{{- if .Values.namespaceSelector.matchLabels }}
34+
matchLabels:
35+
{{- toYaml .Values.namespaceSelector.matchLabels | nindent 8 }}
36+
{{- with .Values.namespaceSelector.matchExpressions }}
37+
matchExpressions:
38+
{{- toYaml . | nindent 8 }}
39+
{{- end }}
40+
{{- else }}
3241
matchLabels:
3342
kubernetes.io/metadata.name: {{ .Release.Namespace | quote }}
3443
{{- with .Values.namespaceSelector.matchExpressions }}
3544
matchExpressions:
3645
{{- toYaml . | nindent 8 }}
3746
{{- end }}
47+
{{- end }}
48+
{{- end }}
3849
{{- with .Values.webhooks.objectSelector }}
3950
objectSelector:
4051
{{- toYaml . | nindent 6 }}

charts/rollout-operator/templates/pod-eviction-webhook.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,20 @@ webhooks:
2727
scope: Namespaced
2828
admissionReviewVersions:
2929
- v1
30+
{{- if not (kindIs "invalid" .Values.namespaceSelector) }}
3031
namespaceSelector:
32+
{{- if .Values.namespaceSelector.matchLabels }}
33+
matchLabels:
34+
{{- toYaml .Values.namespaceSelector.matchLabels | nindent 8 }}
35+
{{- else }}
3136
matchLabels:
3237
kubernetes.io/metadata.name: {{ .Release.Namespace | quote }}
38+
{{- end }}
3339
{{- with .Values.namespaceSelector.matchExpressions }}
3440
matchExpressions:
3541
{{- toYaml . | nindent 8 }}
3642
{{- end }}
43+
{{- end }}
3744
{{- with .Values.webhooks.objectSelector }}
3845
objectSelector:
3946
{{- toYaml . | nindent 6 }}

charts/rollout-operator/templates/prepare-downscale-webhook.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,20 @@ webhooks:
2828
scope: Namespaced
2929
admissionReviewVersions:
3030
- v1
31+
{{- if not (kindIs "invalid" .Values.namespaceSelector) }}
3132
namespaceSelector:
33+
{{- if .Values.namespaceSelector.matchLabels }}
34+
matchLabels:
35+
{{- toYaml .Values.namespaceSelector.matchLabels | nindent 8 }}
36+
{{- else }}
3237
matchLabels:
3338
kubernetes.io/metadata.name: {{ .Release.Namespace | quote }}
39+
{{- end }}
3440
{{- with .Values.namespaceSelector.matchExpressions }}
3541
matchExpressions:
3642
{{- toYaml . | nindent 8 }}
3743
{{- end }}
44+
{{- end }}
3845
{{- with .Values.webhooks.objectSelector }}
3946
objectSelector:
4047
{{- toYaml . | nindent 6 }}

charts/rollout-operator/templates/zone-aware-pod-disruption-budget-validating-webhook.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,20 @@ webhooks:
2727
- zoneawarepoddisruptionbudgets
2828
scope: Namespaced
2929
admissionReviewVersions: ["v1"]
30+
{{- if not (kindIs "invalid" .Values.namespaceSelector) }}
3031
namespaceSelector:
32+
{{- if .Values.namespaceSelector.matchLabels }}
33+
matchLabels:
34+
{{- toYaml .Values.namespaceSelector.matchLabels | nindent 8 }}
35+
{{- else }}
3136
matchLabels:
3237
kubernetes.io/metadata.name: {{ .Release.Namespace | quote }}
38+
{{- end }}
3339
{{- with .Values.namespaceSelector.matchExpressions }}
3440
matchExpressions:
3541
{{- toYaml . | nindent 8 }}
3642
{{- end }}
43+
{{- end }}
3744
{{- with .Values.webhooks.objectSelector }}
3845
objectSelector:
3946
{{- toYaml . | nindent 6 }}

charts/rollout-operator/values.yaml

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,36 @@ webhooks:
125125
# values:
126126
# - production
127127

128+
# -- Namespace selector applied to all webhooks. Defaults to restricting to the release namespace.
129+
# See https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#matching-requests-namespaceselector
128130
namespaceSelector:
129-
# -- Namespace selector to filter which namespaces the webhooks apply to.
130-
# See https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#matching-requests-namespaceselector
131-
# Example:
131+
# Example 1 - matchExpressions only: merged with the default release namespace matchLabels.
132+
# values.yaml:
132133
# matchExpressions:
133134
# - key: team
134135
# operator: NotIn
135-
# values:
136-
# - team-a
136+
# values: [team-a]
137+
# renders:
138+
# namespaceSelector:
139+
# matchLabels:
140+
# kubernetes.io/metadata.name: <release-namespace>
141+
# matchExpressions:
142+
# - key: team
143+
# operator: NotIn
144+
# values: [team-a]
145+
#
146+
# Example 2 - matchLabels set: full selector is user-controlled (matchExpressions also supported).
147+
# values.yaml:
148+
# matchLabels:
149+
# kubernetes.io/metadata.name: logging
150+
# renders:
151+
# namespaceSelector:
152+
# matchLabels:
153+
# kubernetes.io/metadata.name: logging
154+
#
155+
# Example 3 - set to null: omits namespaceSelector entirely (e.g. when objectSelector alone is sufficient).
156+
# values.yaml:
157+
# namespaceSelector: null
158+
# renders:
159+
# (nothing)
137160
matchExpressions: []

0 commit comments

Comments
 (0)