forked from kubernetes-sigs/kubebuilder
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add webhook CertWatcher and flags for custom certificate config…
…uration - Introduced CertWatcher for webhook server to dynamically reload certificates. - Added CLI flags (--webhook-cert-path, --webhook-cert-name, --webhook-cert-key) to allow users to provide custom certificate paths. - Updated manager to integrate CertWatcher into webhook TLS options. - Ensured backward compatibility with default self-signed certificates if no custom certs are provided.
- Loading branch information
1 parent
d240946
commit 1421b14
Showing
27 changed files
with
512 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 32 additions & 26 deletions
58
docs/book/src/cronjob-tutorial/testdata/project/config/default/manager_webhook_patch.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,32 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: controller-manager | ||
namespace: system | ||
labels: | ||
app.kubernetes.io/name: project | ||
app.kubernetes.io/managed-by: kustomize | ||
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 | ||
# This patch ensures the webhook certificates are properly mounted in the manager container. | ||
# It configures the necessary volume, volume mounts, and container ports. | ||
- op: add | ||
path: /spec/template/spec/containers/0/args/- | ||
value: --webhook-cert-path=/tmp/k8s-webhook-server/serving-certs | ||
- op: add | ||
path: /spec/template/spec/containers/0/volumeMounts | ||
value: [] | ||
- op: add | ||
path: /spec/template/spec/containers/0/volumeMounts/- | ||
value: | ||
mountPath: /tmp/k8s-webhook-server/serving-certs | ||
name: webhook-certs | ||
readOnly: true | ||
- op: add | ||
path: /spec/template/spec/containers/0/ports | ||
value: [] | ||
- op: add | ||
path: /spec/template/spec/containers/0/ports/- | ||
value: | ||
containerPort: 9443 | ||
name: webhook-server | ||
protocol: TCP | ||
- op: add | ||
path: /spec/template/spec/volumes | ||
value: [] | ||
- op: add | ||
path: /spec/template/spec/volumes/- | ||
value: | ||
name: webhook-certs | ||
secret: | ||
secretName: webhook-server-cert |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.