-
Notifications
You must be signed in to change notification settings - Fork 21
feat(config): add webhook as kustomize component #122
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,5 @@ | ||
| apiVersion: kustomize.config.k8s.io/v1alpha1 | ||
| kind: Component | ||
| resources: | ||
| - monitor.yaml | ||
AvineshTripathi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - metrics_service.yaml | ||
|
|
||
| patches: | ||
| # Bind metrics to port 8080 for HTTP. | ||
| # This matches the Service and ServiceMonitor configuration in this directory. | ||
| # - path: manager_prometheus_metrics.yaml | ||
| # target: | ||
| # kind: Deployment | ||
| # name: controller-manager | ||
|
|
||
| # By default, metrics are disabled in the manager (default : "0"). | ||
| # This component adds the Service and ServiceMonitor for Prometheus, | ||
| # and applies the patch to bind the manager to port :8080(it is done in Makefile for now). | ||
|
|
||
| # Patches for TLS are in the 'tls' component which will: | ||
| # 1. Overlay the HTTPS args (:8443) and security flags | ||
| # 2. Add ServiceMonitor TLS config | ||
| # 3. Mount CertManager secrets | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| apiVersion: cert-manager.io/v1 | ||
| kind: Certificate | ||
| metadata: | ||
| name: metrics-certs | ||
| namespace: system | ||
| spec: | ||
| commonName: metrics | ||
AvineshTripathi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| dnsNames: | ||
| - nrr-controller-manager-metrics-service.nrr-system.svc | ||
| - nrr-controller-manager-metrics-service.nrr-system.svc.cluster.local | ||
AvineshTripathi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| issuerRef: | ||
| kind: Issuer | ||
| name: selfsigned-issuer | ||
| secretName: metrics-server-cert | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| apiVersion: cert-manager.io/v1 | ||
| kind: Certificate | ||
| metadata: | ||
| name: serving-cert | ||
| namespace: system | ||
| spec: | ||
| dnsNames: | ||
| - nrr-webhook-service.nrr-system.svc | ||
| - nrr-webhook-service.nrr-system.svc.cluster.local | ||
| issuerRef: | ||
| kind: Issuer | ||
| name: selfsigned-issuer | ||
| secretName: webhook-server-certs |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,22 @@ | ||
| apiVersion: kustomize.config.k8s.io/v1alpha1 | ||
| kind: Component | ||
|
|
||
| resources: | ||
| - manifests.yaml | ||
| - service.yaml | ||
| - certificate.yaml | ||
|
|
||
| configurations: | ||
| - kustomizeconfig.yaml | ||
|
|
||
| patchesStrategicMerge: | ||
| - webhook_patch.yaml | ||
| patches: | ||
| - path: webhook_patch.yaml | ||
| target: | ||
| kind: ValidatingWebhookConfiguration | ||
| - path: manager_webhook_patch.yaml | ||
| target: | ||
| group: apps | ||
| version: v1 | ||
| kind: Deployment | ||
| name: controller-manager | ||
| namespace: system |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # Enable webhook | ||
| - op: add | ||
| path: /spec/template/spec/containers/0/args/- | ||
| value: --enable-webhook=true | ||
|
|
||
| # Add webhook port | ||
| - op: add | ||
| path: /spec/template/spec/containers/0/ports/- | ||
| value: | ||
| containerPort: 9443 | ||
| name: webhook-server | ||
| protocol: TCP | ||
|
|
||
| # Add volume mount | ||
| - op: add | ||
| path: /spec/template/spec/containers/0/volumeMounts/- | ||
| value: | ||
| mountPath: /tmp/k8s-webhook-server/serving-certs | ||
| name: cert | ||
| readOnly: true | ||
|
|
||
| # Add volume | ||
| - op: add | ||
| path: /spec/template/spec/volumes/- | ||
| value: | ||
| name: cert | ||
| secret: | ||
| defaultMode: 420 | ||
| secretName: webhook-server-certs |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,11 +3,11 @@ kind: ValidatingWebhookConfiguration | |
| metadata: | ||
| name: validating-webhook-configuration | ||
| annotations: | ||
| cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) | ||
| cert-manager.io/inject-ca-from: nrr-system/nrr-serving-cert | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a reason these values are hardcoded here: they were previously populated using vars. However, vars is now deprecated (kubernetes-sigs/kustomize#5046 If we switch to replacements, we run into a dependency issue. Both the webhook and metrics services need these replacements, but they are individual components and may or may not be deployed together. Because of this, we cannot keep the replacements in So I thought a better solution would be to hardcode it. Open for suggestions Other places: |
||
| webhooks: | ||
| - name: vnodereadinessrule.kb.io | ||
| clientConfig: | ||
| service: | ||
| name: webhook-service | ||
| namespace: system | ||
| path: /validate-nodereadiness-io-v1alpha1-nodereadinessrule | ||
| path: /validate-readiness-node-x-k8s-io-v1alpha1-nodereadinessrule | ||
AvineshTripathi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
Uh oh!
There was an error while loading. Please reload this page.