mirror of
https://github.com/clastix/kamaji.git
synced 2026-02-14 18:10:03 +00:00
chore(kustomize): support for cert-manager and webhooks
This commit is contained in:
9
PROJECT
9
PROJECT
@@ -16,12 +16,19 @@ resources:
|
|||||||
kind: TenantControlPlane
|
kind: TenantControlPlane
|
||||||
path: github.com/clastix/kamaji/api/v1alpha1
|
path: github.com/clastix/kamaji/api/v1alpha1
|
||||||
version: v1alpha1
|
version: v1alpha1
|
||||||
|
webhooks:
|
||||||
|
defaulting: true
|
||||||
|
validation: true
|
||||||
|
webhookVersion: v1
|
||||||
- api:
|
- api:
|
||||||
crdVersion: v1
|
crdVersion: v1
|
||||||
namespaced: false
|
|
||||||
domain: clastix.io
|
domain: clastix.io
|
||||||
group: kamaji
|
group: kamaji
|
||||||
kind: DataStore
|
kind: DataStore
|
||||||
path: github.com/clastix/kamaji/api/v1alpha1
|
path: github.com/clastix/kamaji/api/v1alpha1
|
||||||
version: v1alpha1
|
version: v1alpha1
|
||||||
|
webhooks:
|
||||||
|
defaulting: true
|
||||||
|
validation: true
|
||||||
|
webhookVersion: v1
|
||||||
version: "3"
|
version: "3"
|
||||||
|
|||||||
39
config/certmanager/certificate.yaml
Normal file
39
config/certmanager/certificate.yaml
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
# The following manifests contain a self-signed issuer CR and a certificate CR.
|
||||||
|
# More document can be found at https://docs.cert-manager.io
|
||||||
|
# WARNING: Targets CertManager v1.0. Check https://cert-manager.io/docs/installation/upgrading/ for breaking changes.
|
||||||
|
apiVersion: cert-manager.io/v1
|
||||||
|
kind: Issuer
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: issuer
|
||||||
|
app.kubernetes.io/instance: selfsigned-issuer
|
||||||
|
app.kubernetes.io/component: certificate
|
||||||
|
app.kubernetes.io/created-by: operator
|
||||||
|
app.kubernetes.io/part-of: operator
|
||||||
|
app.kubernetes.io/managed-by: kustomize
|
||||||
|
name: selfsigned-issuer
|
||||||
|
namespace: system
|
||||||
|
spec:
|
||||||
|
selfSigned: {}
|
||||||
|
---
|
||||||
|
apiVersion: cert-manager.io/v1
|
||||||
|
kind: Certificate
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: certificate
|
||||||
|
app.kubernetes.io/instance: serving-cert
|
||||||
|
app.kubernetes.io/component: certificate
|
||||||
|
app.kubernetes.io/created-by: operator
|
||||||
|
app.kubernetes.io/part-of: operator
|
||||||
|
app.kubernetes.io/managed-by: kustomize
|
||||||
|
name: serving-cert # this name should match the one appeared in kustomizeconfig.yaml
|
||||||
|
namespace: system
|
||||||
|
spec:
|
||||||
|
# $(SERVICE_NAME) and $(SERVICE_NAMESPACE) will be substituted by kustomize
|
||||||
|
dnsNames:
|
||||||
|
- $(SERVICE_NAME).$(SERVICE_NAMESPACE).svc
|
||||||
|
- $(SERVICE_NAME).$(SERVICE_NAMESPACE).svc.cluster.local
|
||||||
|
issuerRef:
|
||||||
|
kind: Issuer
|
||||||
|
name: selfsigned-issuer
|
||||||
|
secretName: webhook-server-cert # this secret will not be prefixed, since it's not managed by kustomize
|
||||||
5
config/certmanager/kustomization.yaml
Normal file
5
config/certmanager/kustomization.yaml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
resources:
|
||||||
|
- certificate.yaml
|
||||||
|
|
||||||
|
configurations:
|
||||||
|
- kustomizeconfig.yaml
|
||||||
16
config/certmanager/kustomizeconfig.yaml
Normal file
16
config/certmanager/kustomizeconfig.yaml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# This configuration is for teaching kustomize how to update name ref and var substitution
|
||||||
|
nameReference:
|
||||||
|
- kind: Issuer
|
||||||
|
group: cert-manager.io
|
||||||
|
fieldSpecs:
|
||||||
|
- kind: Certificate
|
||||||
|
group: cert-manager.io
|
||||||
|
path: spec/issuerRef/name
|
||||||
|
|
||||||
|
varReference:
|
||||||
|
- kind: Certificate
|
||||||
|
group: cert-manager.io
|
||||||
|
path: spec/commonName
|
||||||
|
- kind: Certificate
|
||||||
|
group: cert-manager.io
|
||||||
|
path: spec/dnsNames
|
||||||
@@ -7,14 +7,11 @@ resources:
|
|||||||
#+kubebuilder:scaffold:crdkustomizeresource
|
#+kubebuilder:scaffold:crdkustomizeresource
|
||||||
|
|
||||||
patchesStrategicMerge:
|
patchesStrategicMerge:
|
||||||
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
|
- patches/webhook_in_clusters.yaml
|
||||||
# patches here are for enabling the conversion webhook for each CRD
|
|
||||||
#- patches/webhook_in_clusters.yaml
|
|
||||||
#+kubebuilder:scaffold:crdkustomizewebhookpatch
|
#+kubebuilder:scaffold:crdkustomizewebhookpatch
|
||||||
|
|
||||||
# [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix.
|
- patches/cainjection_in_clusters.yaml
|
||||||
# patches here are for enabling the CA injection for each CRD
|
- patches/cainjection_in_datastores.yaml
|
||||||
#- patches/cainjection_in_clusters.yaml
|
|
||||||
#+kubebuilder:scaffold:crdkustomizecainjectionpatch
|
#+kubebuilder:scaffold:crdkustomizecainjectionpatch
|
||||||
|
|
||||||
# the following config is for teaching kustomize how to do kustomization for CRDs.
|
# the following config is for teaching kustomize how to do kustomization for CRDs.
|
||||||
|
|||||||
@@ -17,11 +17,8 @@ bases:
|
|||||||
- ../rbac
|
- ../rbac
|
||||||
- ../manager
|
- ../manager
|
||||||
- ../samples
|
- ../samples
|
||||||
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
|
- ../webhook
|
||||||
# crd/kustomization.yaml
|
- ../certmanager
|
||||||
#- ../webhook
|
|
||||||
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. 'WEBHOOK' components are required.
|
|
||||||
#- ../certmanager
|
|
||||||
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
|
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
|
||||||
#- ../prometheus
|
#- ../prometheus
|
||||||
|
|
||||||
@@ -35,41 +32,34 @@ patchesStrategicMerge:
|
|||||||
# through a ComponentConfig type
|
# through a ComponentConfig type
|
||||||
#- manager_config_patch.yaml
|
#- manager_config_patch.yaml
|
||||||
|
|
||||||
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
|
- manager_webhook_patch.yaml
|
||||||
# crd/kustomization.yaml
|
- webhookcainjection_patch.yaml
|
||||||
#- manager_webhook_patch.yaml
|
|
||||||
|
|
||||||
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'.
|
|
||||||
# Uncomment 'CERTMANAGER' sections in crd/kustomization.yaml to enable the CA injection in the admission webhooks.
|
|
||||||
# 'CERTMANAGER' needs to be enabled to use ca injection
|
|
||||||
#- webhookcainjection_patch.yaml
|
|
||||||
|
|
||||||
# the following config is for teaching kustomize how to do var substitution
|
# the following config is for teaching kustomize how to do var substitution
|
||||||
vars:
|
vars:
|
||||||
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER' prefix.
|
- name: CERTIFICATE_NAMESPACE # namespace of the certificate CR
|
||||||
#- name: CERTIFICATE_NAMESPACE # namespace of the certificate CR
|
objref:
|
||||||
# objref:
|
kind: Certificate
|
||||||
# kind: Certificate
|
group: cert-manager.io
|
||||||
# group: cert-manager.io
|
version: v1
|
||||||
# version: v1
|
name: serving-cert # this name should match the one in certificate.yaml
|
||||||
# name: serving-cert # this name should match the one in certificate.yaml
|
fieldref:
|
||||||
# fieldref:
|
fieldpath: metadata.namespace
|
||||||
# fieldpath: metadata.namespace
|
- name: CERTIFICATE_NAME
|
||||||
#- name: CERTIFICATE_NAME
|
objref:
|
||||||
# objref:
|
kind: Certificate
|
||||||
# kind: Certificate
|
group: cert-manager.io
|
||||||
# group: cert-manager.io
|
version: v1
|
||||||
# version: v1
|
name: serving-cert # this name should match the one in certificate.yaml
|
||||||
# name: serving-cert # this name should match the one in certificate.yaml
|
- name: SERVICE_NAMESPACE # namespace of the service
|
||||||
#- name: SERVICE_NAMESPACE # namespace of the service
|
objref:
|
||||||
# objref:
|
kind: Service
|
||||||
# kind: Service
|
version: v1
|
||||||
# version: v1
|
name: webhook-service
|
||||||
# name: webhook-service
|
fieldref:
|
||||||
# fieldref:
|
fieldpath: metadata.namespace
|
||||||
# fieldpath: metadata.namespace
|
- name: SERVICE_NAME
|
||||||
#- name: SERVICE_NAME
|
objref:
|
||||||
# objref:
|
kind: Service
|
||||||
# kind: Service
|
version: v1
|
||||||
# version: v1
|
name: webhook-service
|
||||||
# name: webhook-service
|
|
||||||
|
|||||||
23
config/default/manager_webhook_patch.yaml
Normal file
23
config/default/manager_webhook_patch.yaml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: controller-manager
|
||||||
|
namespace: system
|
||||||
|
spec:
|
||||||
|
template:
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: manager
|
||||||
|
ports:
|
||||||
|
- containerPort: 9443
|
||||||
|
name: webhook-server
|
||||||
|
protocol: TCP
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /tmp/k8s-webhook-server/serving-certs
|
||||||
|
name: cert
|
||||||
|
readOnly: true
|
||||||
|
volumes:
|
||||||
|
- name: cert
|
||||||
|
secret:
|
||||||
|
defaultMode: 420
|
||||||
|
secretName: webhook-server-cert
|
||||||
29
config/default/webhookcainjection_patch.yaml
Normal file
29
config/default/webhookcainjection_patch.yaml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# This patch add annotation to admission webhook config and
|
||||||
|
# the variables $(CERTIFICATE_NAMESPACE) and $(CERTIFICATE_NAME) will be substituted by kustomize.
|
||||||
|
apiVersion: admissionregistration.k8s.io/v1
|
||||||
|
kind: MutatingWebhookConfiguration
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: mutatingwebhookconfiguration
|
||||||
|
app.kubernetes.io/instance: mutating-webhook-configuration
|
||||||
|
app.kubernetes.io/component: webhook
|
||||||
|
app.kubernetes.io/created-by: operator
|
||||||
|
app.kubernetes.io/part-of: operator
|
||||||
|
app.kubernetes.io/managed-by: kustomize
|
||||||
|
name: mutating-webhook-configuration
|
||||||
|
annotations:
|
||||||
|
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
|
||||||
|
---
|
||||||
|
apiVersion: admissionregistration.k8s.io/v1
|
||||||
|
kind: ValidatingWebhookConfiguration
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: validatingwebhookconfiguration
|
||||||
|
app.kubernetes.io/instance: validating-webhook-configuration
|
||||||
|
app.kubernetes.io/component: webhook
|
||||||
|
app.kubernetes.io/created-by: operator
|
||||||
|
app.kubernetes.io/part-of: operator
|
||||||
|
app.kubernetes.io/managed-by: kustomize
|
||||||
|
name: validating-webhook-configuration
|
||||||
|
annotations:
|
||||||
|
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
|
||||||
@@ -9,8 +9,8 @@ apiVersion: apiextensions.k8s.io/v1
|
|||||||
kind: CustomResourceDefinition
|
kind: CustomResourceDefinition
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
|
cert-manager.io/inject-ca-from: kamaji-system/kamaji-serving-cert
|
||||||
controller-gen.kubebuilder.io/version: v0.9.2
|
controller-gen.kubebuilder.io/version: v0.9.2
|
||||||
creationTimestamp: null
|
|
||||||
name: datastores.kamaji.clastix.io
|
name: datastores.kamaji.clastix.io
|
||||||
spec:
|
spec:
|
||||||
group: kamaji.clastix.io
|
group: kamaji.clastix.io
|
||||||
@@ -237,10 +237,20 @@ apiVersion: apiextensions.k8s.io/v1
|
|||||||
kind: CustomResourceDefinition
|
kind: CustomResourceDefinition
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
|
cert-manager.io/inject-ca-from: kamaji-system/kamaji-serving-cert
|
||||||
controller-gen.kubebuilder.io/version: v0.9.2
|
controller-gen.kubebuilder.io/version: v0.9.2
|
||||||
creationTimestamp: null
|
|
||||||
name: tenantcontrolplanes.kamaji.clastix.io
|
name: tenantcontrolplanes.kamaji.clastix.io
|
||||||
spec:
|
spec:
|
||||||
|
conversion:
|
||||||
|
strategy: Webhook
|
||||||
|
webhook:
|
||||||
|
clientConfig:
|
||||||
|
service:
|
||||||
|
name: kamaji-webhook-service
|
||||||
|
namespace: kamaji-system
|
||||||
|
path: /convert
|
||||||
|
conversionReviewVersions:
|
||||||
|
- v1
|
||||||
group: kamaji.clastix.io
|
group: kamaji.clastix.io
|
||||||
names:
|
names:
|
||||||
kind: TenantControlPlane
|
kind: TenantControlPlane
|
||||||
@@ -2170,6 +2180,26 @@ spec:
|
|||||||
selector:
|
selector:
|
||||||
control-plane: controller-manager
|
control-plane: controller-manager
|
||||||
---
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/component: webhook
|
||||||
|
app.kubernetes.io/created-by: operator
|
||||||
|
app.kubernetes.io/instance: webhook-service
|
||||||
|
app.kubernetes.io/managed-by: kustomize
|
||||||
|
app.kubernetes.io/name: service
|
||||||
|
app.kubernetes.io/part-of: operator
|
||||||
|
name: kamaji-webhook-service
|
||||||
|
namespace: kamaji-system
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- port: 443
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: 9443
|
||||||
|
selector:
|
||||||
|
control-plane: controller-manager
|
||||||
|
---
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
@@ -2215,6 +2245,10 @@ spec:
|
|||||||
initialDelaySeconds: 15
|
initialDelaySeconds: 15
|
||||||
periodSeconds: 20
|
periodSeconds: 20
|
||||||
name: manager
|
name: manager
|
||||||
|
ports:
|
||||||
|
- containerPort: 9443
|
||||||
|
name: webhook-server
|
||||||
|
protocol: TCP
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
httpGet:
|
httpGet:
|
||||||
path: /readyz
|
path: /readyz
|
||||||
@@ -2230,10 +2264,55 @@ spec:
|
|||||||
memory: 20Mi
|
memory: 20Mi
|
||||||
securityContext:
|
securityContext:
|
||||||
allowPrivilegeEscalation: false
|
allowPrivilegeEscalation: false
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /tmp/k8s-webhook-server/serving-certs
|
||||||
|
name: cert
|
||||||
|
readOnly: true
|
||||||
securityContext:
|
securityContext:
|
||||||
runAsNonRoot: true
|
runAsNonRoot: true
|
||||||
serviceAccountName: kamaji-controller-manager
|
serviceAccountName: kamaji-controller-manager
|
||||||
terminationGracePeriodSeconds: 10
|
terminationGracePeriodSeconds: 10
|
||||||
|
volumes:
|
||||||
|
- name: cert
|
||||||
|
secret:
|
||||||
|
defaultMode: 420
|
||||||
|
secretName: webhook-server-cert
|
||||||
|
---
|
||||||
|
apiVersion: cert-manager.io/v1
|
||||||
|
kind: Certificate
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/component: certificate
|
||||||
|
app.kubernetes.io/created-by: operator
|
||||||
|
app.kubernetes.io/instance: serving-cert
|
||||||
|
app.kubernetes.io/managed-by: kustomize
|
||||||
|
app.kubernetes.io/name: certificate
|
||||||
|
app.kubernetes.io/part-of: operator
|
||||||
|
name: kamaji-serving-cert
|
||||||
|
namespace: kamaji-system
|
||||||
|
spec:
|
||||||
|
dnsNames:
|
||||||
|
- kamaji-webhook-service.kamaji-system.svc
|
||||||
|
- kamaji-webhook-service.kamaji-system.svc.cluster.local
|
||||||
|
issuerRef:
|
||||||
|
kind: Issuer
|
||||||
|
name: kamaji-selfsigned-issuer
|
||||||
|
secretName: webhook-server-cert
|
||||||
|
---
|
||||||
|
apiVersion: cert-manager.io/v1
|
||||||
|
kind: Issuer
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/component: certificate
|
||||||
|
app.kubernetes.io/created-by: operator
|
||||||
|
app.kubernetes.io/instance: selfsigned-issuer
|
||||||
|
app.kubernetes.io/managed-by: kustomize
|
||||||
|
app.kubernetes.io/name: issuer
|
||||||
|
app.kubernetes.io/part-of: operator
|
||||||
|
name: kamaji-selfsigned-issuer
|
||||||
|
namespace: kamaji-system
|
||||||
|
spec:
|
||||||
|
selfSigned: {}
|
||||||
---
|
---
|
||||||
apiVersion: kamaji.clastix.io/v1alpha1
|
apiVersion: kamaji.clastix.io/v1alpha1
|
||||||
kind: DataStore
|
kind: DataStore
|
||||||
@@ -2270,3 +2349,113 @@ spec:
|
|||||||
keyPath: tls.key
|
keyPath: tls.key
|
||||||
name: root-client-certs
|
name: root-client-certs
|
||||||
namespace: kamaji-system
|
namespace: kamaji-system
|
||||||
|
---
|
||||||
|
apiVersion: admissionregistration.k8s.io/v1
|
||||||
|
kind: MutatingWebhookConfiguration
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
cert-manager.io/inject-ca-from: kamaji-system/kamaji-serving-cert
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/component: webhook
|
||||||
|
app.kubernetes.io/created-by: operator
|
||||||
|
app.kubernetes.io/instance: mutating-webhook-configuration
|
||||||
|
app.kubernetes.io/managed-by: kustomize
|
||||||
|
app.kubernetes.io/name: mutatingwebhookconfiguration
|
||||||
|
app.kubernetes.io/part-of: operator
|
||||||
|
name: kamaji-mutating-webhook-configuration
|
||||||
|
webhooks:
|
||||||
|
- admissionReviewVersions:
|
||||||
|
- v1
|
||||||
|
clientConfig:
|
||||||
|
service:
|
||||||
|
name: kamaji-webhook-service
|
||||||
|
namespace: kamaji-system
|
||||||
|
path: /mutate-kamaji-clastix-io-v1alpha1-datastore
|
||||||
|
failurePolicy: Fail
|
||||||
|
name: mdatastore.kb.io
|
||||||
|
rules:
|
||||||
|
- apiGroups:
|
||||||
|
- kamaji.clastix.io
|
||||||
|
apiVersions:
|
||||||
|
- v1alpha1
|
||||||
|
operations:
|
||||||
|
- CREATE
|
||||||
|
- UPDATE
|
||||||
|
resources:
|
||||||
|
- datastores
|
||||||
|
sideEffects: None
|
||||||
|
- admissionReviewVersions:
|
||||||
|
- v1
|
||||||
|
clientConfig:
|
||||||
|
service:
|
||||||
|
name: kamaji-webhook-service
|
||||||
|
namespace: kamaji-system
|
||||||
|
path: /mutate-kamaji-clastix-io-v1alpha1-tenantcontrolplane
|
||||||
|
failurePolicy: Fail
|
||||||
|
name: mtenantcontrolplane.kb.io
|
||||||
|
rules:
|
||||||
|
- apiGroups:
|
||||||
|
- kamaji.clastix.io
|
||||||
|
apiVersions:
|
||||||
|
- v1alpha1
|
||||||
|
operations:
|
||||||
|
- CREATE
|
||||||
|
- UPDATE
|
||||||
|
resources:
|
||||||
|
- tenantcontrolplanes
|
||||||
|
sideEffects: None
|
||||||
|
---
|
||||||
|
apiVersion: admissionregistration.k8s.io/v1
|
||||||
|
kind: ValidatingWebhookConfiguration
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
cert-manager.io/inject-ca-from: kamaji-system/kamaji-serving-cert
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/component: webhook
|
||||||
|
app.kubernetes.io/created-by: operator
|
||||||
|
app.kubernetes.io/instance: validating-webhook-configuration
|
||||||
|
app.kubernetes.io/managed-by: kustomize
|
||||||
|
app.kubernetes.io/name: validatingwebhookconfiguration
|
||||||
|
app.kubernetes.io/part-of: operator
|
||||||
|
name: kamaji-validating-webhook-configuration
|
||||||
|
webhooks:
|
||||||
|
- admissionReviewVersions:
|
||||||
|
- v1
|
||||||
|
clientConfig:
|
||||||
|
service:
|
||||||
|
name: kamaji-webhook-service
|
||||||
|
namespace: kamaji-system
|
||||||
|
path: /validate-kamaji-clastix-io-v1alpha1-datastore
|
||||||
|
failurePolicy: Fail
|
||||||
|
name: vdatastore.kb.io
|
||||||
|
rules:
|
||||||
|
- apiGroups:
|
||||||
|
- kamaji.clastix.io
|
||||||
|
apiVersions:
|
||||||
|
- v1alpha1
|
||||||
|
operations:
|
||||||
|
- CREATE
|
||||||
|
- UPDATE
|
||||||
|
resources:
|
||||||
|
- datastores
|
||||||
|
sideEffects: None
|
||||||
|
- admissionReviewVersions:
|
||||||
|
- v1
|
||||||
|
clientConfig:
|
||||||
|
service:
|
||||||
|
name: kamaji-webhook-service
|
||||||
|
namespace: kamaji-system
|
||||||
|
path: /validate-kamaji-clastix-io-v1alpha1-tenantcontrolplane
|
||||||
|
failurePolicy: Fail
|
||||||
|
name: vtenantcontrolplane.kb.io
|
||||||
|
rules:
|
||||||
|
- apiGroups:
|
||||||
|
- kamaji.clastix.io
|
||||||
|
apiVersions:
|
||||||
|
- v1alpha1
|
||||||
|
operations:
|
||||||
|
- CREATE
|
||||||
|
- UPDATE
|
||||||
|
resources:
|
||||||
|
- tenantcontrolplanes
|
||||||
|
sideEffects: None
|
||||||
|
|||||||
6
config/webhook/kustomization.yaml
Normal file
6
config/webhook/kustomization.yaml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
resources:
|
||||||
|
- manifests.yaml
|
||||||
|
- service.yaml
|
||||||
|
|
||||||
|
configurations:
|
||||||
|
- kustomizeconfig.yaml
|
||||||
25
config/webhook/kustomizeconfig.yaml
Normal file
25
config/webhook/kustomizeconfig.yaml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# the following config is for teaching kustomize where to look at when substituting vars.
|
||||||
|
# It requires kustomize v2.1.0 or newer to work properly.
|
||||||
|
nameReference:
|
||||||
|
- kind: Service
|
||||||
|
version: v1
|
||||||
|
fieldSpecs:
|
||||||
|
- kind: MutatingWebhookConfiguration
|
||||||
|
group: admissionregistration.k8s.io
|
||||||
|
path: webhooks/clientConfig/service/name
|
||||||
|
- kind: ValidatingWebhookConfiguration
|
||||||
|
group: admissionregistration.k8s.io
|
||||||
|
path: webhooks/clientConfig/service/name
|
||||||
|
|
||||||
|
namespace:
|
||||||
|
- kind: MutatingWebhookConfiguration
|
||||||
|
group: admissionregistration.k8s.io
|
||||||
|
path: webhooks/clientConfig/service/namespace
|
||||||
|
create: true
|
||||||
|
- kind: ValidatingWebhookConfiguration
|
||||||
|
group: admissionregistration.k8s.io
|
||||||
|
path: webhooks/clientConfig/service/namespace
|
||||||
|
create: true
|
||||||
|
|
||||||
|
varReference:
|
||||||
|
- path: metadata/annotations
|
||||||
94
config/webhook/manifests.yaml
Normal file
94
config/webhook/manifests.yaml
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
---
|
||||||
|
apiVersion: admissionregistration.k8s.io/v1
|
||||||
|
kind: MutatingWebhookConfiguration
|
||||||
|
metadata:
|
||||||
|
creationTimestamp: null
|
||||||
|
name: mutating-webhook-configuration
|
||||||
|
webhooks:
|
||||||
|
- admissionReviewVersions:
|
||||||
|
- v1
|
||||||
|
clientConfig:
|
||||||
|
service:
|
||||||
|
name: webhook-service
|
||||||
|
namespace: system
|
||||||
|
path: /mutate-kamaji-clastix-io-v1alpha1-datastore
|
||||||
|
failurePolicy: Fail
|
||||||
|
name: mdatastore.kb.io
|
||||||
|
rules:
|
||||||
|
- apiGroups:
|
||||||
|
- kamaji.clastix.io
|
||||||
|
apiVersions:
|
||||||
|
- v1alpha1
|
||||||
|
operations:
|
||||||
|
- CREATE
|
||||||
|
- UPDATE
|
||||||
|
resources:
|
||||||
|
- datastores
|
||||||
|
sideEffects: None
|
||||||
|
- admissionReviewVersions:
|
||||||
|
- v1
|
||||||
|
clientConfig:
|
||||||
|
service:
|
||||||
|
name: webhook-service
|
||||||
|
namespace: system
|
||||||
|
path: /mutate-kamaji-clastix-io-v1alpha1-tenantcontrolplane
|
||||||
|
failurePolicy: Fail
|
||||||
|
name: mtenantcontrolplane.kb.io
|
||||||
|
rules:
|
||||||
|
- apiGroups:
|
||||||
|
- kamaji.clastix.io
|
||||||
|
apiVersions:
|
||||||
|
- v1alpha1
|
||||||
|
operations:
|
||||||
|
- CREATE
|
||||||
|
- UPDATE
|
||||||
|
resources:
|
||||||
|
- tenantcontrolplanes
|
||||||
|
sideEffects: None
|
||||||
|
---
|
||||||
|
apiVersion: admissionregistration.k8s.io/v1
|
||||||
|
kind: ValidatingWebhookConfiguration
|
||||||
|
metadata:
|
||||||
|
creationTimestamp: null
|
||||||
|
name: validating-webhook-configuration
|
||||||
|
webhooks:
|
||||||
|
- admissionReviewVersions:
|
||||||
|
- v1
|
||||||
|
clientConfig:
|
||||||
|
service:
|
||||||
|
name: webhook-service
|
||||||
|
namespace: system
|
||||||
|
path: /validate-kamaji-clastix-io-v1alpha1-datastore
|
||||||
|
failurePolicy: Fail
|
||||||
|
name: vdatastore.kb.io
|
||||||
|
rules:
|
||||||
|
- apiGroups:
|
||||||
|
- kamaji.clastix.io
|
||||||
|
apiVersions:
|
||||||
|
- v1alpha1
|
||||||
|
operations:
|
||||||
|
- CREATE
|
||||||
|
- UPDATE
|
||||||
|
resources:
|
||||||
|
- datastores
|
||||||
|
sideEffects: None
|
||||||
|
- admissionReviewVersions:
|
||||||
|
- v1
|
||||||
|
clientConfig:
|
||||||
|
service:
|
||||||
|
name: webhook-service
|
||||||
|
namespace: system
|
||||||
|
path: /validate-kamaji-clastix-io-v1alpha1-tenantcontrolplane
|
||||||
|
failurePolicy: Fail
|
||||||
|
name: vtenantcontrolplane.kb.io
|
||||||
|
rules:
|
||||||
|
- apiGroups:
|
||||||
|
- kamaji.clastix.io
|
||||||
|
apiVersions:
|
||||||
|
- v1alpha1
|
||||||
|
operations:
|
||||||
|
- CREATE
|
||||||
|
- UPDATE
|
||||||
|
resources:
|
||||||
|
- tenantcontrolplanes
|
||||||
|
sideEffects: None
|
||||||
20
config/webhook/service.yaml
Normal file
20
config/webhook/service.yaml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: service
|
||||||
|
app.kubernetes.io/instance: webhook-service
|
||||||
|
app.kubernetes.io/component: webhook
|
||||||
|
app.kubernetes.io/created-by: operator
|
||||||
|
app.kubernetes.io/part-of: operator
|
||||||
|
app.kubernetes.io/managed-by: kustomize
|
||||||
|
name: webhook-service
|
||||||
|
namespace: system
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- port: 443
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: 9443
|
||||||
|
selector:
|
||||||
|
control-plane: controller-manager
|
||||||
Reference in New Issue
Block a user