Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(kustomize-mutating-webhook): Deploy #3572

Merged
merged 4 commits into from
Jan 20, 2025

Conversation

joryirving
Copy link
Owner

No description provided.

@smurf-bot smurf-bot bot added area/kubernetes Changes made in the kubernetes directory cluster/main cluster/utility labels Jan 20, 2025
@smurf-bot
Copy link
Contributor

smurf-bot bot commented Jan 20, 2025

--- kubernetes/main/flux/settings Kustomization: flux-system/cluster-settings MutatingAdmissionPolicyBinding: flux-system/flux-ks-no-postbuild

+++ kubernetes/main/flux/settings Kustomization: flux-system/cluster-settings MutatingAdmissionPolicyBinding: flux-system/flux-ks-no-postbuild

@@ -1,12 +0,0 @@

----
-apiVersion: admissionregistration.k8s.io/v1alpha1
-kind: MutatingAdmissionPolicyBinding
-metadata:
-  labels:
-    kustomize.toolkit.fluxcd.io/name: cluster-settings
-    kustomize.toolkit.fluxcd.io/namespace: flux-system
-  name: flux-ks-no-postbuild
-  namespace: flux-system
-spec:
-  policyName: flux-ks-no-postbuild
-
--- kubernetes/main/flux/settings Kustomization: flux-system/cluster-settings MutatingAdmissionPolicyBinding: flux-system/flux-ks-no-substitutefrom

+++ kubernetes/main/flux/settings Kustomization: flux-system/cluster-settings MutatingAdmissionPolicyBinding: flux-system/flux-ks-no-substitutefrom

@@ -1,12 +0,0 @@

----
-apiVersion: admissionregistration.k8s.io/v1alpha1
-kind: MutatingAdmissionPolicyBinding
-metadata:
-  labels:
-    kustomize.toolkit.fluxcd.io/name: cluster-settings
-    kustomize.toolkit.fluxcd.io/namespace: flux-system
-  name: flux-ks-no-substitutefrom
-  namespace: flux-system
-spec:
-  policyName: flux-ks-no-substitutefrom
-
--- kubernetes/main/flux/settings Kustomization: flux-system/cluster-settings MutatingAdmissionPolicyBinding: flux-system/flux-ks-add-cluster-settings

+++ kubernetes/main/flux/settings Kustomization: flux-system/cluster-settings MutatingAdmissionPolicyBinding: flux-system/flux-ks-add-cluster-settings

@@ -1,12 +0,0 @@

----
-apiVersion: admissionregistration.k8s.io/v1alpha1
-kind: MutatingAdmissionPolicyBinding
-metadata:
-  labels:
-    kustomize.toolkit.fluxcd.io/name: cluster-settings
-    kustomize.toolkit.fluxcd.io/namespace: flux-system
-  name: flux-ks-add-cluster-settings
-  namespace: flux-system
-spec:
-  policyName: flux-ks-add-cluster-settings
-
--- kubernetes/main/flux/settings Kustomization: flux-system/cluster-settings MutatingAdmissionPolicy: flux-system/flux-ks-no-postbuild

+++ kubernetes/main/flux/settings Kustomization: flux-system/cluster-settings MutatingAdmissionPolicy: flux-system/flux-ks-no-postbuild

@@ -1,54 +0,0 @@

----
-apiVersion: admissionregistration.k8s.io/v1alpha1
-kind: MutatingAdmissionPolicy
-metadata:
-  labels:
-    kustomize.toolkit.fluxcd.io/name: cluster-settings
-    kustomize.toolkit.fluxcd.io/namespace: flux-system
-  name: flux-ks-no-postbuild
-  namespace: flux-system
-spec:
-  failurePolicy: Fail
-  matchConditions:
-  - expression: |
-      !(object.metadata.name == "flux-system")
-    name: name-is-not-flux-system
-  - expression: |
-      !has(object.spec.postBuild)
-    name: postbuild-field-does-not-exist
-  matchConstraints:
-    resourceRules:
-    - apiGroups:
-      - kustomize.toolkit.fluxcd.io
-      apiVersions:
-      - v1
-      operations:
-      - CREATE
-      - UPDATE
-      resources:
-      - kustomizations
-  mutations:
-  - jsonPatch:
-      expression: |
-        [
-
-          JSONPatch{
-            op: "add", path: "/spec/postBuild",
-            value: {}
-          },
-          JSONPatch{
-            op: "add", path: "/spec/postBuild/substituteFrom",
-            value: []
-          },
-          JSONPatch{
-            op: "add", path: "/spec/postBuild/substituteFrom/-",
-            value: Object.spec.postBuild.substituteFrom{
-              name: "cluster-settings",
-              kind: "ConfigMap",
-              optional: true
-            }
-          }
-        ]
-    patchType: JSONPatch
-  reinvocationPolicy: IfNeeded
-
--- kubernetes/main/flux/settings Kustomization: flux-system/cluster-settings MutatingAdmissionPolicy: flux-system/flux-ks-no-substitutefrom

+++ kubernetes/main/flux/settings Kustomization: flux-system/cluster-settings MutatingAdmissionPolicy: flux-system/flux-ks-no-substitutefrom

@@ -1,53 +0,0 @@

----
-apiVersion: admissionregistration.k8s.io/v1alpha1
-kind: MutatingAdmissionPolicy
-metadata:
-  labels:
-    kustomize.toolkit.fluxcd.io/name: cluster-settings
-    kustomize.toolkit.fluxcd.io/namespace: flux-system
-  name: flux-ks-no-substitutefrom
-  namespace: flux-system
-spec:
-  failurePolicy: Fail
-  matchConditions:
-  - expression: |
-      !(object.metadata.name == "flux-system")
-    name: name-is-not-flux-system
-  - expression: |
-      has(object.spec.postBuild)
-    name: has-postbuild-field
-  - expression: |
-      !has(object.spec.postBuild.substituteFrom)
-    name: substitutefrom-field-does-not-exist
-  matchConstraints:
-    resourceRules:
-    - apiGroups:
-      - kustomize.toolkit.fluxcd.io
-      apiVersions:
-      - v1
-      operations:
-      - CREATE
-      - UPDATE
-      resources:
-      - kustomizations
-  mutations:
-  - jsonPatch:
-      expression: |
-        [
-
-          JSONPatch{
-            op: "add", path: "/spec/postBuild/substituteFrom",
-            value: []
-          },
-          JSONPatch{
-            op: "add", path: "/spec/postBuild/substituteFrom/-",
-            value: Object.spec.postBuild.substituteFrom{
-              name: "cluster-settings",
-              kind: "ConfigMap",
-              optional: true
-            }
-          }
-        ]
-    patchType: JSONPatch
-  reinvocationPolicy: IfNeeded
-
--- kubernetes/main/flux/settings Kustomization: flux-system/cluster-settings MutatingAdmissionPolicy: flux-system/flux-ks-add-cluster-settings

+++ kubernetes/main/flux/settings Kustomization: flux-system/cluster-settings MutatingAdmissionPolicy: flux-system/flux-ks-add-cluster-settings

@@ -1,49 +0,0 @@

----
-apiVersion: admissionregistration.k8s.io/v1alpha1
-kind: MutatingAdmissionPolicy
-metadata:
-  labels:
-    kustomize.toolkit.fluxcd.io/name: cluster-settings
-    kustomize.toolkit.fluxcd.io/namespace: flux-system
-  name: flux-ks-add-cluster-settings
-  namespace: flux-system
-spec:
-  failurePolicy: Fail
-  matchConditions:
-  - expression: |
-      !(object.metadata.name == "flux-system")
-    name: name-is-not-flux-system
-  - expression: |
-      (has(object.spec.postBuild) && has(object.spec.postBuild.substituteFrom))
-    name: has-substitutefrom-field
-  - expression: |
-      !object.spec.postBuild.substituteFrom.exists(item, item.name == "cluster-settings")
-    name: cluster-settings-configmap-not-present
-  matchConstraints:
-    resourceRules:
-    - apiGroups:
-      - kustomize.toolkit.fluxcd.io
-      apiVersions:
-      - v1
-      operations:
-      - CREATE
-      - UPDATE
-      resources:
-      - kustomizations
-  mutations:
-  - jsonPatch:
-      expression: |
-        [
-
-          JSONPatch{
-            op: "add", path: "/spec/postBuild/substituteFrom/-",
-            value: Object.spec.postBuild.substituteFrom{
-              name: "cluster-settings",
-              kind: "ConfigMap",
-              optional: true
-            }
-          }
-        ]
-    patchType: JSONPatch
-  reinvocationPolicy: IfNeeded
-
--- kubernetes/shared Kustomization: flux-system/cluster-shared HelmRepository: flux-system/fluxcd-kustomize-mutating-webhook

+++ kubernetes/shared Kustomization: flux-system/cluster-shared HelmRepository: flux-system/fluxcd-kustomize-mutating-webhook

@@ -0,0 +1,13 @@

+---
+apiVersion: source.toolkit.fluxcd.io/v1
+kind: HelmRepository
+metadata:
+  labels:
+    kustomize.toolkit.fluxcd.io/name: cluster-shared
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: fluxcd-kustomize-mutating-webhook
+  namespace: flux-system
+spec:
+  interval: 30m
+  url: https://xunholy.github.io/fluxcd-kustomize-mutating-webhook
+
--- kubernetes/main/apps Kustomization: flux-system/cluster-apps Kustomization: flux-system/kustomize-mutating-webhook

+++ kubernetes/main/apps Kustomization: flux-system/cluster-apps Kustomization: flux-system/kustomize-mutating-webhook

@@ -0,0 +1,26 @@

+---
+apiVersion: kustomize.toolkit.fluxcd.io/v1
+kind: Kustomization
+metadata:
+  labels:
+    kustomize.toolkit.fluxcd.io/name: cluster-apps
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: kustomize-mutating-webhook
+  namespace: flux-system
+spec:
+  commonMetadata:
+    labels:
+      app.kubernetes.io/name: kustomize-mutating-webhook
+  dependsOn:
+  - name: cert-manager
+  interval: 30m
+  path: ./kubernetes/main/apps/flux-system/kustomize-mutating-webhook/app
+  prune: true
+  sourceRef:
+    kind: GitRepository
+    name: flux-system
+    namespace: flux-system
+  targetNamespace: flux-system
+  timeout: 5m
+  wait: false
+
--- kubernetes/main/apps/flux-system/kustomize-mutating-webhook/app Kustomization: flux-system/kustomize-mutating-webhook HelmRelease: flux-system/kustomize-mutating-webhook

+++ kubernetes/main/apps/flux-system/kustomize-mutating-webhook/app Kustomization: flux-system/kustomize-mutating-webhook HelmRelease: flux-system/kustomize-mutating-webhook

@@ -0,0 +1,39 @@

+---
+apiVersion: helm.toolkit.fluxcd.io/v2
+kind: HelmRelease
+metadata:
+  labels:
+    app.kubernetes.io/name: kustomize-mutating-webhook
+    kustomize.toolkit.fluxcd.io/name: kustomize-mutating-webhook
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: kustomize-mutating-webhook
+  namespace: flux-system
+spec:
+  chart:
+    spec:
+      chart: kustomize-mutating-webhook
+      interval: 30m
+      sourceRef:
+        kind: HelmRepository
+        name: fluxcd-kustomize-mutating-webhook
+        namespace: flux-system
+      version: 0.2.4
+  install:
+    remediation:
+      retries: 3
+  interval: 30m
+  upgrade:
+    cleanupOnFail: true
+    remediation:
+      retries: 3
+      strategy: rollback
+  values:
+    certManager:
+      enabled: true
+    configMaps:
+    - create: true
+      data:
+        CLUSTER_NAME: main
+      name: cluster-settings
+    secrets: []
+

@smurf-bot
Copy link
Contributor

smurf-bot bot commented Jan 20, 2025

--- kubernetes/utility/flux/settings Kustomization: flux-system/cluster-settings MutatingAdmissionPolicyBinding: flux-system/flux-ks-no-postbuild

+++ kubernetes/utility/flux/settings Kustomization: flux-system/cluster-settings MutatingAdmissionPolicyBinding: flux-system/flux-ks-no-postbuild

@@ -1,12 +0,0 @@

----
-apiVersion: admissionregistration.k8s.io/v1alpha1
-kind: MutatingAdmissionPolicyBinding
-metadata:
-  labels:
-    kustomize.toolkit.fluxcd.io/name: cluster-settings
-    kustomize.toolkit.fluxcd.io/namespace: flux-system
-  name: flux-ks-no-postbuild
-  namespace: flux-system
-spec:
-  policyName: flux-ks-no-postbuild
-
--- kubernetes/utility/flux/settings Kustomization: flux-system/cluster-settings MutatingAdmissionPolicyBinding: flux-system/flux-ks-no-substitutefrom

+++ kubernetes/utility/flux/settings Kustomization: flux-system/cluster-settings MutatingAdmissionPolicyBinding: flux-system/flux-ks-no-substitutefrom

@@ -1,12 +0,0 @@

----
-apiVersion: admissionregistration.k8s.io/v1alpha1
-kind: MutatingAdmissionPolicyBinding
-metadata:
-  labels:
-    kustomize.toolkit.fluxcd.io/name: cluster-settings
-    kustomize.toolkit.fluxcd.io/namespace: flux-system
-  name: flux-ks-no-substitutefrom
-  namespace: flux-system
-spec:
-  policyName: flux-ks-no-substitutefrom
-
--- kubernetes/utility/flux/settings Kustomization: flux-system/cluster-settings MutatingAdmissionPolicyBinding: flux-system/flux-ks-add-cluster-settings

+++ kubernetes/utility/flux/settings Kustomization: flux-system/cluster-settings MutatingAdmissionPolicyBinding: flux-system/flux-ks-add-cluster-settings

@@ -1,12 +0,0 @@

----
-apiVersion: admissionregistration.k8s.io/v1alpha1
-kind: MutatingAdmissionPolicyBinding
-metadata:
-  labels:
-    kustomize.toolkit.fluxcd.io/name: cluster-settings
-    kustomize.toolkit.fluxcd.io/namespace: flux-system
-  name: flux-ks-add-cluster-settings
-  namespace: flux-system
-spec:
-  policyName: flux-ks-add-cluster-settings
-
--- kubernetes/utility/flux/settings Kustomization: flux-system/cluster-settings MutatingAdmissionPolicy: flux-system/flux-ks-no-postbuild

+++ kubernetes/utility/flux/settings Kustomization: flux-system/cluster-settings MutatingAdmissionPolicy: flux-system/flux-ks-no-postbuild

@@ -1,54 +0,0 @@

----
-apiVersion: admissionregistration.k8s.io/v1alpha1
-kind: MutatingAdmissionPolicy
-metadata:
-  labels:
-    kustomize.toolkit.fluxcd.io/name: cluster-settings
-    kustomize.toolkit.fluxcd.io/namespace: flux-system
-  name: flux-ks-no-postbuild
-  namespace: flux-system
-spec:
-  failurePolicy: Fail
-  matchConditions:
-  - expression: |
-      !(object.metadata.name == "flux-system")
-    name: name-is-not-flux-system
-  - expression: |
-      !has(object.spec.postBuild)
-    name: postbuild-field-does-not-exist
-  matchConstraints:
-    resourceRules:
-    - apiGroups:
-      - kustomize.toolkit.fluxcd.io
-      apiVersions:
-      - v1
-      operations:
-      - CREATE
-      - UPDATE
-      resources:
-      - kustomizations
-  mutations:
-  - jsonPatch:
-      expression: |
-        [
-
-          JSONPatch{
-            op: "add", path: "/spec/postBuild",
-            value: {}
-          },
-          JSONPatch{
-            op: "add", path: "/spec/postBuild/substituteFrom",
-            value: []
-          },
-          JSONPatch{
-            op: "add", path: "/spec/postBuild/substituteFrom/-",
-            value: Object.spec.postBuild.substituteFrom{
-              name: "cluster-settings",
-              kind: "ConfigMap",
-              optional: true
-            }
-          }
-        ]
-    patchType: JSONPatch
-  reinvocationPolicy: IfNeeded
-
--- kubernetes/utility/flux/settings Kustomization: flux-system/cluster-settings MutatingAdmissionPolicy: flux-system/flux-ks-no-substitutefrom

+++ kubernetes/utility/flux/settings Kustomization: flux-system/cluster-settings MutatingAdmissionPolicy: flux-system/flux-ks-no-substitutefrom

@@ -1,53 +0,0 @@

----
-apiVersion: admissionregistration.k8s.io/v1alpha1
-kind: MutatingAdmissionPolicy
-metadata:
-  labels:
-    kustomize.toolkit.fluxcd.io/name: cluster-settings
-    kustomize.toolkit.fluxcd.io/namespace: flux-system
-  name: flux-ks-no-substitutefrom
-  namespace: flux-system
-spec:
-  failurePolicy: Fail
-  matchConditions:
-  - expression: |
-      !(object.metadata.name == "flux-system")
-    name: name-is-not-flux-system
-  - expression: |
-      has(object.spec.postBuild)
-    name: has-postbuild-field
-  - expression: |
-      !has(object.spec.postBuild.substituteFrom)
-    name: substitutefrom-field-does-not-exist
-  matchConstraints:
-    resourceRules:
-    - apiGroups:
-      - kustomize.toolkit.fluxcd.io
-      apiVersions:
-      - v1
-      operations:
-      - CREATE
-      - UPDATE
-      resources:
-      - kustomizations
-  mutations:
-  - jsonPatch:
-      expression: |
-        [
-
-          JSONPatch{
-            op: "add", path: "/spec/postBuild/substituteFrom",
-            value: []
-          },
-          JSONPatch{
-            op: "add", path: "/spec/postBuild/substituteFrom/-",
-            value: Object.spec.postBuild.substituteFrom{
-              name: "cluster-settings",
-              kind: "ConfigMap",
-              optional: true
-            }
-          }
-        ]
-    patchType: JSONPatch
-  reinvocationPolicy: IfNeeded
-
--- kubernetes/utility/flux/settings Kustomization: flux-system/cluster-settings MutatingAdmissionPolicy: flux-system/flux-ks-add-cluster-settings

+++ kubernetes/utility/flux/settings Kustomization: flux-system/cluster-settings MutatingAdmissionPolicy: flux-system/flux-ks-add-cluster-settings

@@ -1,49 +0,0 @@

----
-apiVersion: admissionregistration.k8s.io/v1alpha1
-kind: MutatingAdmissionPolicy
-metadata:
-  labels:
-    kustomize.toolkit.fluxcd.io/name: cluster-settings
-    kustomize.toolkit.fluxcd.io/namespace: flux-system
-  name: flux-ks-add-cluster-settings
-  namespace: flux-system
-spec:
-  failurePolicy: Fail
-  matchConditions:
-  - expression: |
-      !(object.metadata.name == "flux-system")
-    name: name-is-not-flux-system
-  - expression: |
-      (has(object.spec.postBuild) && has(object.spec.postBuild.substituteFrom))
-    name: has-substitutefrom-field
-  - expression: |
-      !object.spec.postBuild.substituteFrom.exists(item, item.name == "cluster-settings")
-    name: cluster-settings-configmap-not-present
-  matchConstraints:
-    resourceRules:
-    - apiGroups:
-      - kustomize.toolkit.fluxcd.io
-      apiVersions:
-      - v1
-      operations:
-      - CREATE
-      - UPDATE
-      resources:
-      - kustomizations
-  mutations:
-  - jsonPatch:
-      expression: |
-        [
-
-          JSONPatch{
-            op: "add", path: "/spec/postBuild/substituteFrom/-",
-            value: Object.spec.postBuild.substituteFrom{
-              name: "cluster-settings",
-              kind: "ConfigMap",
-              optional: true
-            }
-          }
-        ]
-    patchType: JSONPatch
-  reinvocationPolicy: IfNeeded
-
--- kubernetes/shared Kustomization: flux-system/cluster-shared HelmRepository: flux-system/fluxcd-kustomize-mutating-webhook

+++ kubernetes/shared Kustomization: flux-system/cluster-shared HelmRepository: flux-system/fluxcd-kustomize-mutating-webhook

@@ -0,0 +1,13 @@

+---
+apiVersion: source.toolkit.fluxcd.io/v1
+kind: HelmRepository
+metadata:
+  labels:
+    kustomize.toolkit.fluxcd.io/name: cluster-shared
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: fluxcd-kustomize-mutating-webhook
+  namespace: flux-system
+spec:
+  interval: 30m
+  url: https://xunholy.github.io/fluxcd-kustomize-mutating-webhook
+
--- kubernetes/utility/apps Kustomization: flux-system/cluster-apps Kustomization: flux-system/kustomize-mutating-webhook

+++ kubernetes/utility/apps Kustomization: flux-system/cluster-apps Kustomization: flux-system/kustomize-mutating-webhook

@@ -0,0 +1,26 @@

+---
+apiVersion: kustomize.toolkit.fluxcd.io/v1
+kind: Kustomization
+metadata:
+  labels:
+    kustomize.toolkit.fluxcd.io/name: cluster-apps
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: kustomize-mutating-webhook
+  namespace: flux-system
+spec:
+  commonMetadata:
+    labels:
+      app.kubernetes.io/name: kustomize-mutating-webhook
+  dependsOn:
+  - name: cert-manager
+  interval: 30m
+  path: ./kubernetes/utility/apps/flux-system/kustomize-mutating-webhook/app
+  prune: true
+  sourceRef:
+    kind: GitRepository
+    name: flux-system
+    namespace: flux-system
+  targetNamespace: flux-system
+  timeout: 5m
+  wait: false
+
--- kubernetes/utility/apps/flux-system/kustomize-mutating-webhook/app Kustomization: flux-system/kustomize-mutating-webhook HelmRelease: flux-system/kustomize-mutating-webhook

+++ kubernetes/utility/apps/flux-system/kustomize-mutating-webhook/app Kustomization: flux-system/kustomize-mutating-webhook HelmRelease: flux-system/kustomize-mutating-webhook

@@ -0,0 +1,39 @@

+---
+apiVersion: helm.toolkit.fluxcd.io/v2
+kind: HelmRelease
+metadata:
+  labels:
+    app.kubernetes.io/name: kustomize-mutating-webhook
+    kustomize.toolkit.fluxcd.io/name: kustomize-mutating-webhook
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: kustomize-mutating-webhook
+  namespace: flux-system
+spec:
+  chart:
+    spec:
+      chart: kustomize-mutating-webhook
+      interval: 30m
+      sourceRef:
+        kind: HelmRepository
+        name: fluxcd-kustomize-mutating-webhook
+        namespace: flux-system
+      version: 0.2.4
+  install:
+    remediation:
+      retries: 3
+  interval: 30m
+  upgrade:
+    cleanupOnFail: true
+    remediation:
+      retries: 3
+      strategy: rollback
+  values:
+    certManager:
+      enabled: true
+    configMaps:
+    - create: true
+      data:
+        CLUSTER_NAME: main
+      name: cluster-settings
+    secrets: []
+

@smurf-bot
Copy link
Contributor

smurf-bot bot commented Jan 20, 2025

--- HelmRelease: flux-system/kustomize-mutating-webhook PodDisruptionBudget: flux-system/kustomize-mutating-webhook-pdb

+++ HelmRelease: flux-system/kustomize-mutating-webhook PodDisruptionBudget: flux-system/kustomize-mutating-webhook-pdb

@@ -0,0 +1,16 @@

+---
+apiVersion: policy/v1
+kind: PodDisruptionBudget
+metadata:
+  name: kustomize-mutating-webhook-pdb
+  labels:
+    app.kubernetes.io/name: kustomize-mutating-webhook
+    app.kubernetes.io/instance: kustomize-mutating-webhook
+    app.kubernetes.io/managed-by: Helm
+spec:
+  minAvailable: 2
+  selector:
+    matchLabels:
+      app.kubernetes.io/name: kustomize-mutating-webhook
+      app.kubernetes.io/instance: kustomize-mutating-webhook
+
--- HelmRelease: flux-system/kustomize-mutating-webhook ServiceAccount: flux-system/kustomize-mutating-webhook

+++ HelmRelease: flux-system/kustomize-mutating-webhook ServiceAccount: flux-system/kustomize-mutating-webhook

@@ -0,0 +1,11 @@

+---
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+  name: kustomize-mutating-webhook
+  labels:
+    app.kubernetes.io/name: kustomize-mutating-webhook
+    app.kubernetes.io/instance: kustomize-mutating-webhook
+    app.kubernetes.io/managed-by: Helm
+automountServiceAccountToken: false
+
--- HelmRelease: flux-system/kustomize-mutating-webhook ConfigMap: flux-system/cluster-settings

+++ HelmRelease: flux-system/kustomize-mutating-webhook ConfigMap: flux-system/cluster-settings

@@ -0,0 +1,12 @@

+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: cluster-settings
+  labels:
+    app.kubernetes.io/name: kustomize-mutating-webhook
+    app.kubernetes.io/instance: kustomize-mutating-webhook
+    app.kubernetes.io/managed-by: Helm
+data:
+  CLUSTER_NAME: main
+
--- HelmRelease: flux-system/kustomize-mutating-webhook Service: flux-system/kustomize-mutating-webhook

+++ HelmRelease: flux-system/kustomize-mutating-webhook Service: flux-system/kustomize-mutating-webhook

@@ -0,0 +1,20 @@

+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: kustomize-mutating-webhook
+  labels:
+    app.kubernetes.io/name: kustomize-mutating-webhook
+    app.kubernetes.io/instance: kustomize-mutating-webhook
+    app.kubernetes.io/managed-by: Helm
+spec:
+  type: ClusterIP
+  ports:
+  - port: 8443
+    targetPort: https
+    protocol: TCP
+    name: https
+  selector:
+    app.kubernetes.io/name: kustomize-mutating-webhook
+    app.kubernetes.io/instance: kustomize-mutating-webhook
+
--- HelmRelease: flux-system/kustomize-mutating-webhook Deployment: flux-system/kustomize-mutating-webhook

+++ HelmRelease: flux-system/kustomize-mutating-webhook Deployment: flux-system/kustomize-mutating-webhook

@@ -0,0 +1,86 @@

+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: kustomize-mutating-webhook
+  labels:
+    app.kubernetes.io/name: kustomize-mutating-webhook
+    app.kubernetes.io/instance: kustomize-mutating-webhook
+    app.kubernetes.io/managed-by: Helm
+spec:
+  replicas: 3
+  selector:
+    matchLabels:
+      app.kubernetes.io/name: kustomize-mutating-webhook
+      app.kubernetes.io/instance: kustomize-mutating-webhook
+  strategy:
+    type: RollingUpdate
+    rollingUpdate:
+      maxUnavailable: 1
+      maxSurge: 1
+  template:
+    metadata:
+      labels:
+        app.kubernetes.io/name: kustomize-mutating-webhook
+        app.kubernetes.io/instance: kustomize-mutating-webhook
+    spec:
+      serviceAccountName: kustomize-mutating-webhook
+      securityContext:
+        runAsGroup: 1000
+        runAsNonRoot: true
+        runAsUser: 1000
+      containers:
+      - name: kustomize-mutating-webhook
+        securityContext:
+          allowPrivilegeEscalation: false
+          capabilities:
+            drop:
+            - ALL
+          readOnlyRootFilesystem: true
+        image: ghcr.io/xunholy/kustomize-mutating-webhook:latest
+        imagePullPolicy: Always
+        env:
+        - name: LOG_LEVEL
+          value: info
+        - name: RATE_LIMIT
+          value: '100'
+        ports:
+        - name: https
+          containerPort: 8443
+          protocol: TCP
+        livenessProbe:
+          httpGet:
+            path: /health
+            port: https
+            scheme: HTTPS
+          initialDelaySeconds: 15
+          periodSeconds: 20
+        readinessProbe:
+          httpGet:
+            path: /ready
+            port: https
+            scheme: HTTPS
+          initialDelaySeconds: 5
+          periodSeconds: 10
+        resources:
+          limits:
+            cpu: 500m
+            memory: 256Mi
+          requests:
+            cpu: 100m
+            memory: 128Mi
+        volumeMounts:
+        - name: webhook-certs
+          mountPath: /etc/webhook/certs
+          readOnly: true
+        - name: cluster-settings
+          mountPath: /etc/config/cluster_settings
+          readOnly: true
+      volumes:
+      - name: webhook-certs
+        secret:
+          secretName: kustomize-mutating-webhook-tls
+      - name: cluster-settings
+        configMap:
+          name: cluster-settings
+
--- HelmRelease: flux-system/kustomize-mutating-webhook Certificate: flux-system/kustomize-mutating-webhook-ca

+++ HelmRelease: flux-system/kustomize-mutating-webhook Certificate: flux-system/kustomize-mutating-webhook-ca

@@ -0,0 +1,18 @@

+---
+apiVersion: cert-manager.io/v1
+kind: Certificate
+metadata:
+  name: kustomize-mutating-webhook-ca
+  labels:
+    app.kubernetes.io/name: kustomize-mutating-webhook
+    app.kubernetes.io/instance: kustomize-mutating-webhook
+    app.kubernetes.io/managed-by: Helm
+spec:
+  secretName: kustomize-mutating-webhook-ca
+  duration: 43800h
+  issuerRef:
+    name: kustomize-mutating-webhook-ca
+    kind: Issuer
+  commonName: ca.kustomize-mutating-webhook.cert-manager
+  isCA: true
+
--- HelmRelease: flux-system/kustomize-mutating-webhook Certificate: flux-system/kustomize-mutating-webhook

+++ HelmRelease: flux-system/kustomize-mutating-webhook Certificate: flux-system/kustomize-mutating-webhook

@@ -0,0 +1,20 @@

+---
+apiVersion: cert-manager.io/v1
+kind: Certificate
+metadata:
+  name: kustomize-mutating-webhook
+  labels:
+    app.kubernetes.io/name: kustomize-mutating-webhook
+    app.kubernetes.io/instance: kustomize-mutating-webhook
+    app.kubernetes.io/managed-by: Helm
+spec:
+  dnsNames:
+  - kustomize-mutating-webhook.flux-system.svc
+  - kustomize-mutating-webhook.flux-system.svc.cluster.local
+  issuerRef:
+    name: kustomize-mutating-webhook
+    kind: Issuer
+  secretName: kustomize-mutating-webhook-tls
+  duration: 2160h
+  renewBefore: 360h
+
--- HelmRelease: flux-system/kustomize-mutating-webhook Issuer: flux-system/kustomize-mutating-webhook-ca

+++ HelmRelease: flux-system/kustomize-mutating-webhook Issuer: flux-system/kustomize-mutating-webhook-ca

@@ -0,0 +1,12 @@

+---
+apiVersion: cert-manager.io/v1
+kind: Issuer
+metadata:
+  name: kustomize-mutating-webhook-ca
+  labels:
+    app.kubernetes.io/name: kustomize-mutating-webhook
+    app.kubernetes.io/instance: kustomize-mutating-webhook
+    app.kubernetes.io/managed-by: Helm
+spec:
+  selfSigned: {}
+
--- HelmRelease: flux-system/kustomize-mutating-webhook Issuer: flux-system/kustomize-mutating-webhook

+++ HelmRelease: flux-system/kustomize-mutating-webhook Issuer: flux-system/kustomize-mutating-webhook

@@ -0,0 +1,13 @@

+---
+apiVersion: cert-manager.io/v1
+kind: Issuer
+metadata:
+  name: kustomize-mutating-webhook
+  labels:
+    app.kubernetes.io/name: kustomize-mutating-webhook
+    app.kubernetes.io/instance: kustomize-mutating-webhook
+    app.kubernetes.io/managed-by: Helm
+spec:
+  ca:
+    secretName: kustomize-mutating-webhook-ca
+
--- HelmRelease: flux-system/kustomize-mutating-webhook MutatingWebhookConfiguration: flux-system/kustomize-mutating-webhook.xunholy.com

+++ HelmRelease: flux-system/kustomize-mutating-webhook MutatingWebhookConfiguration: flux-system/kustomize-mutating-webhook.xunholy.com

@@ -0,0 +1,45 @@

+---
+apiVersion: admissionregistration.k8s.io/v1
+kind: MutatingWebhookConfiguration
+metadata:
+  name: kustomize-mutating-webhook.xunholy.com
+  labels:
+    app.kubernetes.io/name: kustomize-mutating-webhook
+    app.kubernetes.io/instance: kustomize-mutating-webhook
+    app.kubernetes.io/managed-by: Helm
+  annotations:
+    cert-manager.io/inject-ca-from: flux-system/kustomize-mutating-webhook
+webhooks:
+- name: kustomize-mutating-webhook.xunholy.com
+  admissionReviewVersions:
+  - v1
+  failurePolicy: Fail
+  matchPolicy: Equivalent
+  namespaceSelector:
+    matchExpressions:
+    - key: kubernetes.io/metadata.name
+      operator: NotIn
+      values:
+      - flux-system
+  objectSelector: {}
+  reinvocationPolicy: Never
+  clientConfig:
+    service:
+      name: kustomize-mutating-webhook
+      namespace: flux-system
+      path: /mutate
+      port: 8443
+  rules:
+  - apiGroups:
+    - kustomize.toolkit.fluxcd.io
+    apiVersions:
+    - v1
+    operations:
+    - CREATE
+    - UPDATE
+    resources:
+    - kustomizations
+    scope: '*'
+  sideEffects: None
+  timeoutSeconds: 30
+

@smurf-bot
Copy link
Contributor

smurf-bot bot commented Jan 20, 2025

--- HelmRelease: flux-system/kustomize-mutating-webhook PodDisruptionBudget: flux-system/kustomize-mutating-webhook-pdb

+++ HelmRelease: flux-system/kustomize-mutating-webhook PodDisruptionBudget: flux-system/kustomize-mutating-webhook-pdb

@@ -0,0 +1,16 @@

+---
+apiVersion: policy/v1
+kind: PodDisruptionBudget
+metadata:
+  name: kustomize-mutating-webhook-pdb
+  labels:
+    app.kubernetes.io/name: kustomize-mutating-webhook
+    app.kubernetes.io/instance: kustomize-mutating-webhook
+    app.kubernetes.io/managed-by: Helm
+spec:
+  minAvailable: 2
+  selector:
+    matchLabels:
+      app.kubernetes.io/name: kustomize-mutating-webhook
+      app.kubernetes.io/instance: kustomize-mutating-webhook
+
--- HelmRelease: flux-system/kustomize-mutating-webhook ServiceAccount: flux-system/kustomize-mutating-webhook

+++ HelmRelease: flux-system/kustomize-mutating-webhook ServiceAccount: flux-system/kustomize-mutating-webhook

@@ -0,0 +1,11 @@

+---
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+  name: kustomize-mutating-webhook
+  labels:
+    app.kubernetes.io/name: kustomize-mutating-webhook
+    app.kubernetes.io/instance: kustomize-mutating-webhook
+    app.kubernetes.io/managed-by: Helm
+automountServiceAccountToken: false
+
--- HelmRelease: flux-system/kustomize-mutating-webhook ConfigMap: flux-system/cluster-settings

+++ HelmRelease: flux-system/kustomize-mutating-webhook ConfigMap: flux-system/cluster-settings

@@ -0,0 +1,12 @@

+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: cluster-settings
+  labels:
+    app.kubernetes.io/name: kustomize-mutating-webhook
+    app.kubernetes.io/instance: kustomize-mutating-webhook
+    app.kubernetes.io/managed-by: Helm
+data:
+  CLUSTER_NAME: main
+
--- HelmRelease: flux-system/kustomize-mutating-webhook Service: flux-system/kustomize-mutating-webhook

+++ HelmRelease: flux-system/kustomize-mutating-webhook Service: flux-system/kustomize-mutating-webhook

@@ -0,0 +1,20 @@

+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: kustomize-mutating-webhook
+  labels:
+    app.kubernetes.io/name: kustomize-mutating-webhook
+    app.kubernetes.io/instance: kustomize-mutating-webhook
+    app.kubernetes.io/managed-by: Helm
+spec:
+  type: ClusterIP
+  ports:
+  - port: 8443
+    targetPort: https
+    protocol: TCP
+    name: https
+  selector:
+    app.kubernetes.io/name: kustomize-mutating-webhook
+    app.kubernetes.io/instance: kustomize-mutating-webhook
+
--- HelmRelease: flux-system/kustomize-mutating-webhook Deployment: flux-system/kustomize-mutating-webhook

+++ HelmRelease: flux-system/kustomize-mutating-webhook Deployment: flux-system/kustomize-mutating-webhook

@@ -0,0 +1,86 @@

+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: kustomize-mutating-webhook
+  labels:
+    app.kubernetes.io/name: kustomize-mutating-webhook
+    app.kubernetes.io/instance: kustomize-mutating-webhook
+    app.kubernetes.io/managed-by: Helm
+spec:
+  replicas: 3
+  selector:
+    matchLabels:
+      app.kubernetes.io/name: kustomize-mutating-webhook
+      app.kubernetes.io/instance: kustomize-mutating-webhook
+  strategy:
+    type: RollingUpdate
+    rollingUpdate:
+      maxUnavailable: 1
+      maxSurge: 1
+  template:
+    metadata:
+      labels:
+        app.kubernetes.io/name: kustomize-mutating-webhook
+        app.kubernetes.io/instance: kustomize-mutating-webhook
+    spec:
+      serviceAccountName: kustomize-mutating-webhook
+      securityContext:
+        runAsGroup: 1000
+        runAsNonRoot: true
+        runAsUser: 1000
+      containers:
+      - name: kustomize-mutating-webhook
+        securityContext:
+          allowPrivilegeEscalation: false
+          capabilities:
+            drop:
+            - ALL
+          readOnlyRootFilesystem: true
+        image: ghcr.io/xunholy/kustomize-mutating-webhook:latest
+        imagePullPolicy: Always
+        env:
+        - name: LOG_LEVEL
+          value: info
+        - name: RATE_LIMIT
+          value: '100'
+        ports:
+        - name: https
+          containerPort: 8443
+          protocol: TCP
+        livenessProbe:
+          httpGet:
+            path: /health
+            port: https
+            scheme: HTTPS
+          initialDelaySeconds: 15
+          periodSeconds: 20
+        readinessProbe:
+          httpGet:
+            path: /ready
+            port: https
+            scheme: HTTPS
+          initialDelaySeconds: 5
+          periodSeconds: 10
+        resources:
+          limits:
+            cpu: 500m
+            memory: 256Mi
+          requests:
+            cpu: 100m
+            memory: 128Mi
+        volumeMounts:
+        - name: webhook-certs
+          mountPath: /etc/webhook/certs
+          readOnly: true
+        - name: cluster-settings
+          mountPath: /etc/config/cluster_settings
+          readOnly: true
+      volumes:
+      - name: webhook-certs
+        secret:
+          secretName: kustomize-mutating-webhook-tls
+      - name: cluster-settings
+        configMap:
+          name: cluster-settings
+
--- HelmRelease: flux-system/kustomize-mutating-webhook Certificate: flux-system/kustomize-mutating-webhook-ca

+++ HelmRelease: flux-system/kustomize-mutating-webhook Certificate: flux-system/kustomize-mutating-webhook-ca

@@ -0,0 +1,18 @@

+---
+apiVersion: cert-manager.io/v1
+kind: Certificate
+metadata:
+  name: kustomize-mutating-webhook-ca
+  labels:
+    app.kubernetes.io/name: kustomize-mutating-webhook
+    app.kubernetes.io/instance: kustomize-mutating-webhook
+    app.kubernetes.io/managed-by: Helm
+spec:
+  secretName: kustomize-mutating-webhook-ca
+  duration: 43800h
+  issuerRef:
+    name: kustomize-mutating-webhook-ca
+    kind: Issuer
+  commonName: ca.kustomize-mutating-webhook.cert-manager
+  isCA: true
+
--- HelmRelease: flux-system/kustomize-mutating-webhook Certificate: flux-system/kustomize-mutating-webhook

+++ HelmRelease: flux-system/kustomize-mutating-webhook Certificate: flux-system/kustomize-mutating-webhook

@@ -0,0 +1,20 @@

+---
+apiVersion: cert-manager.io/v1
+kind: Certificate
+metadata:
+  name: kustomize-mutating-webhook
+  labels:
+    app.kubernetes.io/name: kustomize-mutating-webhook
+    app.kubernetes.io/instance: kustomize-mutating-webhook
+    app.kubernetes.io/managed-by: Helm
+spec:
+  dnsNames:
+  - kustomize-mutating-webhook.flux-system.svc
+  - kustomize-mutating-webhook.flux-system.svc.cluster.local
+  issuerRef:
+    name: kustomize-mutating-webhook
+    kind: Issuer
+  secretName: kustomize-mutating-webhook-tls
+  duration: 2160h
+  renewBefore: 360h
+
--- HelmRelease: flux-system/kustomize-mutating-webhook Issuer: flux-system/kustomize-mutating-webhook-ca

+++ HelmRelease: flux-system/kustomize-mutating-webhook Issuer: flux-system/kustomize-mutating-webhook-ca

@@ -0,0 +1,12 @@

+---
+apiVersion: cert-manager.io/v1
+kind: Issuer
+metadata:
+  name: kustomize-mutating-webhook-ca
+  labels:
+    app.kubernetes.io/name: kustomize-mutating-webhook
+    app.kubernetes.io/instance: kustomize-mutating-webhook
+    app.kubernetes.io/managed-by: Helm
+spec:
+  selfSigned: {}
+
--- HelmRelease: flux-system/kustomize-mutating-webhook Issuer: flux-system/kustomize-mutating-webhook

+++ HelmRelease: flux-system/kustomize-mutating-webhook Issuer: flux-system/kustomize-mutating-webhook

@@ -0,0 +1,13 @@

+---
+apiVersion: cert-manager.io/v1
+kind: Issuer
+metadata:
+  name: kustomize-mutating-webhook
+  labels:
+    app.kubernetes.io/name: kustomize-mutating-webhook
+    app.kubernetes.io/instance: kustomize-mutating-webhook
+    app.kubernetes.io/managed-by: Helm
+spec:
+  ca:
+    secretName: kustomize-mutating-webhook-ca
+
--- HelmRelease: flux-system/kustomize-mutating-webhook MutatingWebhookConfiguration: flux-system/kustomize-mutating-webhook.xunholy.com

+++ HelmRelease: flux-system/kustomize-mutating-webhook MutatingWebhookConfiguration: flux-system/kustomize-mutating-webhook.xunholy.com

@@ -0,0 +1,45 @@

+---
+apiVersion: admissionregistration.k8s.io/v1
+kind: MutatingWebhookConfiguration
+metadata:
+  name: kustomize-mutating-webhook.xunholy.com
+  labels:
+    app.kubernetes.io/name: kustomize-mutating-webhook
+    app.kubernetes.io/instance: kustomize-mutating-webhook
+    app.kubernetes.io/managed-by: Helm
+  annotations:
+    cert-manager.io/inject-ca-from: flux-system/kustomize-mutating-webhook
+webhooks:
+- name: kustomize-mutating-webhook.xunholy.com
+  admissionReviewVersions:
+  - v1
+  failurePolicy: Fail
+  matchPolicy: Equivalent
+  namespaceSelector:
+    matchExpressions:
+    - key: kubernetes.io/metadata.name
+      operator: NotIn
+      values:
+      - flux-system
+  objectSelector: {}
+  reinvocationPolicy: Never
+  clientConfig:
+    service:
+      name: kustomize-mutating-webhook
+      namespace: flux-system
+      path: /mutate
+      port: 8443
+  rules:
+  - apiGroups:
+    - kustomize.toolkit.fluxcd.io
+    apiVersions:
+    - v1
+    operations:
+    - CREATE
+    - UPDATE
+    resources:
+    - kustomizations
+    scope: '*'
+  sideEffects: None
+  timeoutSeconds: 30
+

@joryirving joryirving merged commit aea33c7 into main Jan 20, 2025
17 checks passed
@joryirving joryirving deleted the feat/kustomize-mutating-webhook branch January 20, 2025 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kubernetes Changes made in the kubernetes directory cluster/main cluster/utility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant