Skip to content

Commit

Permalink
allow setting matchConditions for the injector webhook
Browse files Browse the repository at this point in the history
  • Loading branch information
BojanZelic committed Dec 11, 2024
1 parent 272d04e commit ba97e72
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions templates/injector-mutating-webhook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,9 @@ webhooks:
namespaceSelector:
{{ toYaml (((.Values.injector.webhook)).namespaceSelector | default .Values.injector.namespaceSelector) | indent 6}}
{{ end }}
{{- if (((.Values.injector.webhook)).matchConditions) }}
matchConditions:
{{ toYaml ((.Values.injector.webhook)).matchConditions | indent 6}}
{{ end }}
{{- template "injector.objectSelector" . -}}
{{ end }}
6 changes: 6 additions & 0 deletions values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,12 @@
"failurePolicy": {
"type": "string"
},
"matchConditions": {
"type": "array",
"items": {
"type": "object"
}
},
"matchPolicy": {
"type": "string"
},
Expand Down
9 changes: 9 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,15 @@ injector:
#
timeoutSeconds: 30

# matchConditions is the selector for restricting the webhook fine-grained request filtering.
# See https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#matching-requests-matchconditions
# for more details.
# Example:
# matchConditions:
# - name: include-vault-pods
# expression: "has(object.metadata.annotations) && 'vault.hashicorp.com/agent-inject' in object.metadata.annotations"
matchConditions: []

# namespaceSelector is the selector for restricting the webhook to only
# specific namespaces.
# See https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#matching-requests-namespaceselector
Expand Down

0 comments on commit ba97e72

Please sign in to comment.