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.
Follow up of: kubernetes-sigs#4243 - Ensure that production configura…
…tion to protect metrics server is configurable via flags
- Loading branch information
1 parent
781e93f
commit 5e02482
Showing
36 changed files
with
425 additions
and
212 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
56 changes: 35 additions & 21 deletions
56
...c/cronjob-tutorial/testdata/project/config/default/certmanager_metrics_manager_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,21 +1,35 @@ | ||
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 | ||
volumeMounts: | ||
- mountPath: /tmp/k8s-metrics-server/metrics-certs | ||
name: metrics-certs | ||
readOnly: true | ||
volumes: | ||
- name: metrics-certs | ||
secret: | ||
secretName: metrics-server-cert | ||
# This patch adds the args and volumes to allow the manager to use the metrics-server certs | ||
# Ensure the volumeMounts field exists by creating it if missing | ||
- op: add | ||
path: /spec/template/spec/containers/0/volumeMounts | ||
value: [] | ||
# Add the volume mount for the serving certificates | ||
- op: add | ||
path: /spec/template/spec/containers/0/volumeMounts/- | ||
value: | ||
mountPath: /tmp/k8s-metrics-server/metrics-certs | ||
name: metrics-certs | ||
readOnly: true | ||
# Add the cert-dir argument | ||
- op: add | ||
path: /spec/template/spec/containers/0/args/- | ||
value: --cert-dir=/tmp/k8s-metrics-server/metrics-certs | ||
# Add the cert-name argument | ||
- op: add | ||
path: /spec/template/spec/containers/0/args/- | ||
value: --cert-name=/tmp/k8s-metrics-server/metrics-certs/tls.cert | ||
# Add the cert-key argument | ||
- op: add | ||
path: /spec/template/spec/containers/0/args/- | ||
value: --cert-key=/tmp/k8s-metrics-server/metrics-certs/tls.key | ||
# Ensure the volumes field exists by creating it if missing | ||
- op: add | ||
path: /spec/template/spec/volumes | ||
value: [] | ||
# Add the volume for the serving certificates | ||
- op: add | ||
path: /spec/template/spec/volumes/- | ||
value: | ||
name: metrics-certs | ||
secret: | ||
secretName: metrics-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
56 changes: 35 additions & 21 deletions
56
...rc/getting-started/testdata/project/config/default/certmanager_metrics_manager_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,21 +1,35 @@ | ||
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 | ||
volumeMounts: | ||
- mountPath: /tmp/k8s-metrics-server/metrics-certs | ||
name: metrics-certs | ||
readOnly: true | ||
volumes: | ||
- name: metrics-certs | ||
secret: | ||
secretName: metrics-server-cert | ||
# This patch adds the args and volumes to allow the manager to use the metrics-server certs | ||
# Ensure the volumeMounts field exists by creating it if missing | ||
- op: add | ||
path: /spec/template/spec/containers/0/volumeMounts | ||
value: [] | ||
# Add the volume mount for the serving certificates | ||
- op: add | ||
path: /spec/template/spec/containers/0/volumeMounts/- | ||
value: | ||
mountPath: /tmp/k8s-metrics-server/metrics-certs | ||
name: metrics-certs | ||
readOnly: true | ||
# Add the cert-dir argument | ||
- op: add | ||
path: /spec/template/spec/containers/0/args/- | ||
value: --cert-dir=/tmp/k8s-metrics-server/metrics-certs | ||
# Add the cert-name argument | ||
- op: add | ||
path: /spec/template/spec/containers/0/args/- | ||
value: --cert-name=/tmp/k8s-metrics-server/metrics-certs/tls.cert | ||
# Add the cert-key argument | ||
- op: add | ||
path: /spec/template/spec/containers/0/args/- | ||
value: --cert-key=/tmp/k8s-metrics-server/metrics-certs/tls.key | ||
# Ensure the volumes field exists by creating it if missing | ||
- op: add | ||
path: /spec/template/spec/volumes | ||
value: [] | ||
# Add the volume for the serving certificates | ||
- op: add | ||
path: /spec/template/spec/volumes/- | ||
value: | ||
name: metrics-certs | ||
secret: | ||
secretName: metrics-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
56 changes: 35 additions & 21 deletions
56
...tiversion-tutorial/testdata/project/config/default/certmanager_metrics_manager_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,21 +1,35 @@ | ||
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 | ||
volumeMounts: | ||
- mountPath: /tmp/k8s-metrics-server/metrics-certs | ||
name: metrics-certs | ||
readOnly: true | ||
volumes: | ||
- name: metrics-certs | ||
secret: | ||
secretName: metrics-server-cert | ||
# This patch adds the args and volumes to allow the manager to use the metrics-server certs | ||
# Ensure the volumeMounts field exists by creating it if missing | ||
- op: add | ||
path: /spec/template/spec/containers/0/volumeMounts | ||
value: [] | ||
# Add the volume mount for the serving certificates | ||
- op: add | ||
path: /spec/template/spec/containers/0/volumeMounts/- | ||
value: | ||
mountPath: /tmp/k8s-metrics-server/metrics-certs | ||
name: metrics-certs | ||
readOnly: true | ||
# Add the cert-dir argument | ||
- op: add | ||
path: /spec/template/spec/containers/0/args/- | ||
value: --cert-dir=/tmp/k8s-metrics-server/metrics-certs | ||
# Add the cert-name argument | ||
- op: add | ||
path: /spec/template/spec/containers/0/args/- | ||
value: --cert-name=/tmp/k8s-metrics-server/metrics-certs/tls.cert | ||
# Add the cert-key argument | ||
- op: add | ||
path: /spec/template/spec/containers/0/args/- | ||
value: --cert-key=/tmp/k8s-metrics-server/metrics-certs/tls.key | ||
# Ensure the volumes field exists by creating it if missing | ||
- op: add | ||
path: /spec/template/spec/volumes | ||
value: [] | ||
# Add the volume for the serving certificates | ||
- op: add | ||
path: /spec/template/spec/volumes/- | ||
value: | ||
name: metrics-certs | ||
secret: | ||
secretName: metrics-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
Oops, something went wrong.