Skip to content

Commit

Permalink
feat: add default namespace selector to ignore webhook namespace (#4)
Browse files Browse the repository at this point in the history
* feat: add default namespace selector to ignore webhook namespace

Signed-off-by: James Petersen <[email protected]>

* chore: update chart docs

Signed-off-by: James Petersen <[email protected]>

* chore: use standard namespace label

Signed-off-by: James Petersen <[email protected]>

---------

Signed-off-by: James Petersen <[email protected]>
  • Loading branch information
found-it authored Dec 11, 2024
1 parent e06ae7a commit d254323
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "protect-webhook"
version = "0.1.0"
version = "0.1.1"
edition = "2021"

[dependencies]
Expand Down
4 changes: 2 additions & 2 deletions charts/protect-webhook/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v2
name: protect-webhook
description: A Helm chart for the Edera Protect Mutating Webhook
type: application
version: 0.1.1
appVersion: "0.1.0"
version: 0.1.2
appVersion: "0.1.1"
maintainers:
- name: "Edera"
url: "https://github.com/edera-dev"
5 changes: 2 additions & 3 deletions charts/protect-webhook/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# protect-webhook

![Version: 0.1.1](https://img.shields.io/badge/Version-0.1.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.1.0](https://img.shields.io/badge/AppVersion-0.1.0-informational?style=flat-square)
![Version: 0.1.2](https://img.shields.io/badge/Version-0.1.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.1.1](https://img.shields.io/badge/AppVersion-0.1.1-informational?style=flat-square)

A Helm chart for the Edera Protect Mutating Webhook

Expand Down Expand Up @@ -35,8 +35,7 @@ A Helm chart for the Edera Protect Mutating Webhook
| tolerations | list | `[]` | Webhook server tolerations |
| volumeMounts | list | `[]` | Webhook server additional volume mounts |
| volumes | list | `[]` | Webhook server additional volumes |
| webhook | object | `{"objectSelector":{"matchLabels":{"dev.edera/inject-runtime":"true"}}}` | Mutating webhook configuration |
| webhook.objectSelector | object | `{"matchLabels":{"dev.edera/inject-runtime":"true"}}` | This object selector lets you customize which labels you would like to filter on to inject the edera runtime class |
| webhook | object | `{}` | Mutating webhook configuration |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2)
3 changes: 3 additions & 0 deletions charts/protect-webhook/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ spec:
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- if .Values.runtimeClassName }}
runtimeClassName: {{ .Values.runtimeClassName }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
securityContext:
Expand Down
6 changes: 6 additions & 0 deletions charts/protect-webhook/templates/webhook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ webhooks:
name: {{ include "protect-webhook.fullname" . }}
namespace: {{ .Values.webhook.serviceNamespace | default .Release.Namespace }}
path: /mutate
# Automatically exclude Edera resources
namespaceSelector:
matchExpressions:
- key: kubernetes.io/metadata.name
operator: NotIn
values: [{{ .Release.Namespace }}]
{{- if .Values.webhook }}
{{- if .Values.webhook.objectSelector }}
objectSelector:
Expand Down
13 changes: 8 additions & 5 deletions charts/protect-webhook/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

# -- Webhook server runtime class
# runtimeClassName: edera

# -- Webhook server pod annotations
podAnnotations: {}

Expand Down Expand Up @@ -65,8 +68,8 @@ tolerations: []
affinity: {}

# -- Mutating webhook configuration
webhook:
# -- This object selector lets you customize which labels you would like to filter on to inject the edera runtime class
objectSelector:
matchLabels:
dev.edera/inject-runtime: "true"
webhook: {}
# This object selector lets you customize which labels you would like to filter on to inject the edera runtime class
# objectSelector:
# matchLabels:
# dev.edera/inject-runtime: "true"

0 comments on commit d254323

Please sign in to comment.