Skip to content

Commit

Permalink
Add commonLabels to Deployments
Browse files Browse the repository at this point in the history
Signed-off-by: Wyatt Fry <wyattfry@gmail.com>
  • Loading branch information
wyattfry committed Nov 7, 2024
1 parent bcca9a4 commit 42611e7
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 70 deletions.
146 changes: 76 additions & 70 deletions cmd/build/helmify/kustomize-for-helm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ kind: Deployment
metadata:
name: gatekeeper-controller-manager
namespace: gatekeeper-system
labels:
HELMSUBST_DEPLOYMENT_LABELS: ""
# app.kubernetes.io/name: HELMSUBST_DEPLOYMENT_LABELS_NAME
# app.kubernetes.io/version: HELMSUBST_DEPLOYMENT_LABELS_VERSION
spec:
replicas: HELMSUBST_DEPLOYMENT_REPLICAS
revisionHistoryLimit: HELMSUBST_DEPLOYMENT_REVISION_HISTORY_LIMIT
Expand Down Expand Up @@ -110,15 +114,15 @@ spec:
imagePullPolicy: "{{ .Values.image.pullPolicy }}"
HELMSUBST_AUDIT_CONTROLLER_MANAGER_DEPLOYMENT_IMAGE_RELEASE: ""
ports:
- containerPort: HELMSUBST_DEPLOYMENT_CONTROLLER_MANAGER_PORT
name: webhook-server
protocol: TCP
- containerPort: HELMSUBST_DEPLOYMENT_CONTROLLER_MANAGER_METRICS_PORT
name: metrics
protocol: TCP
- containerPort: HELMSUBST_DEPLOYMENT_CONTROLLER_MANAGER_HEALTH_PORT
name: healthz
protocol: TCP
- containerPort: HELMSUBST_DEPLOYMENT_CONTROLLER_MANAGER_PORT
name: webhook-server
protocol: TCP
- containerPort: HELMSUBST_DEPLOYMENT_CONTROLLER_MANAGER_METRICS_PORT
name: metrics
protocol: TCP
- containerPort: HELMSUBST_DEPLOYMENT_CONTROLLER_MANAGER_HEALTH_PORT
name: healthz
protocol: TCP
readinessProbe:
httpGet:
path: /readyz
Expand Down Expand Up @@ -154,6 +158,8 @@ kind: Deployment
metadata:
name: gatekeeper-audit
namespace: gatekeeper-system
labels:
HELMSUBST_DEPLOYMENT_LABELS: ""
spec:
revisionHistoryLimit: HELMSUBST_DEPLOYMENT_REVISION_HISTORY_LIMIT
template:
Expand Down Expand Up @@ -195,12 +201,12 @@ spec:
imagePullPolicy: "{{ .Values.image.pullPolicy }}"
HELMSUBST_AUDIT_CONTROLLER_MANAGER_DEPLOYMENT_IMAGE_RELEASE: ""
ports:
- containerPort: HELMSUBST_DEPLOYMENT_AUDIT_METRICS_PORT
name: metrics
protocol: TCP
- containerPort: HELMSUBST_DEPLOYMENT_AUDIT_HEALTH_PORT
name: healthz
protocol: TCP
- containerPort: HELMSUBST_DEPLOYMENT_AUDIT_METRICS_PORT
name: metrics
protocol: TCP
- containerPort: HELMSUBST_DEPLOYMENT_AUDIT_HEALTH_PORT
name: healthz
protocol: TCP
readinessProbe:
httpGet:
path: /readyz
Expand Down Expand Up @@ -244,27 +250,27 @@ metadata:
name: gatekeeper-mutating-webhook-configuration
annotations: HELMSUBST_MUTATING_WEBHOOK_ANNOTATIONS
webhooks:
- clientConfig:
service:
name: gatekeeper-webhook-service
namespace: gatekeeper-system
path: /v1/mutate
failurePolicy: HELMSUBST_MUTATING_WEBHOOK_FAILURE_POLICY
reinvocationPolicy: HELMSUBST_MUTATING_WEBHOOK_REINVOCATION_POLICY
rules:
- HELMSUBST_MUTATING_WEBHOOK_OPERATION_RULES
matchPolicy: Exact
name: mutation.gatekeeper.sh
namespaceSelector:
matchExpressions:
- key: admission.gatekeeper.sh/ignore
operator: DoesNotExist
- HELMSUBST_MUTATING_WEBHOOK_MATCHEXPRESSION_METADATANAME
- HELMSUBST_MUTATING_WEBHOOK_EXEMPT_NAMESPACE_LABELS
objectSelector: HELMSUBST_MUTATING_WEBHOOK_OBJECT_SELECTOR
sideEffects: None
timeoutSeconds: HELMSUBST_MUTATING_WEBHOOK_TIMEOUT
matchConditions: HELMSUBST_MUTATING_WEBHOOK_MATCH_CONDITIONS
- clientConfig:
service:
name: gatekeeper-webhook-service
namespace: gatekeeper-system
path: /v1/mutate
failurePolicy: HELMSUBST_MUTATING_WEBHOOK_FAILURE_POLICY
reinvocationPolicy: HELMSUBST_MUTATING_WEBHOOK_REINVOCATION_POLICY
rules:
- HELMSUBST_MUTATING_WEBHOOK_OPERATION_RULES
matchPolicy: Exact
name: mutation.gatekeeper.sh
namespaceSelector:
matchExpressions:
- key: admission.gatekeeper.sh/ignore
operator: DoesNotExist
- HELMSUBST_MUTATING_WEBHOOK_MATCHEXPRESSION_METADATANAME
- HELMSUBST_MUTATING_WEBHOOK_EXEMPT_NAMESPACE_LABELS
objectSelector: HELMSUBST_MUTATING_WEBHOOK_OBJECT_SELECTOR
sideEffects: None
timeoutSeconds: HELMSUBST_MUTATING_WEBHOOK_TIMEOUT
matchConditions: HELMSUBST_MUTATING_WEBHOOK_MATCH_CONDITIONS
---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
Expand All @@ -274,35 +280,35 @@ metadata:
name: gatekeeper-validating-webhook-configuration
annotations: HELMSUBST_VALIDATING_WEBHOOK_ANNOTATIONS
webhooks:
- clientConfig:
service:
name: gatekeeper-webhook-service
namespace: gatekeeper-system
path: /v1/admit
name: validation.gatekeeper.sh
namespaceSelector:
matchExpressions:
- key: admission.gatekeeper.sh/ignore
operator: DoesNotExist
- HELMSUBST_VALIDATING_WEBHOOK_MATCHEXPRESSION_METADATANAME
- HELMSUBST_VALIDATING_WEBHOOK_EXEMPT_NAMESPACE_LABELS
objectSelector: HELMSUBST_VALIDATING_WEBHOOK_OBJECT_SELECTOR
timeoutSeconds: HELMSUBST_VALIDATING_WEBHOOK_TIMEOUT
failurePolicy: HELMSUBST_VALIDATING_WEBHOOK_FAILURE_POLICY
rules:
- HELMSUBST_VALIDATING_WEBHOOK_OPERATION_RULES
matchConditions: HELMSUBST_VALIDATING_WEBHOOK_MATCH_CONDITIONS
- clientConfig:
service:
name: gatekeeper-webhook-service
namespace: gatekeeper-system
path: /v1/admitlabel
name: check-ignore-label.gatekeeper.sh
namespaceSelector:
matchExpressions:
- HELMSUBST_VALIDATING_WEBHOOK_MATCHEXPRESSION_METADATANAME
timeoutSeconds: HELMSUBST_VALIDATING_WEBHOOK_TIMEOUT
failurePolicy: HELMSUBST_VALIDATING_WEBHOOK_CHECK_IGNORE_FAILURE_POLICY
- clientConfig:
service:
name: gatekeeper-webhook-service
namespace: gatekeeper-system
path: /v1/admit
name: validation.gatekeeper.sh
namespaceSelector:
matchExpressions:
- key: admission.gatekeeper.sh/ignore
operator: DoesNotExist
- HELMSUBST_VALIDATING_WEBHOOK_MATCHEXPRESSION_METADATANAME
- HELMSUBST_VALIDATING_WEBHOOK_EXEMPT_NAMESPACE_LABELS
objectSelector: HELMSUBST_VALIDATING_WEBHOOK_OBJECT_SELECTOR
timeoutSeconds: HELMSUBST_VALIDATING_WEBHOOK_TIMEOUT
failurePolicy: HELMSUBST_VALIDATING_WEBHOOK_FAILURE_POLICY
rules:
- HELMSUBST_VALIDATING_WEBHOOK_OPERATION_RULES
matchConditions: HELMSUBST_VALIDATING_WEBHOOK_MATCH_CONDITIONS
- clientConfig:
service:
name: gatekeeper-webhook-service
namespace: gatekeeper-system
path: /v1/admitlabel
name: check-ignore-label.gatekeeper.sh
namespaceSelector:
matchExpressions:
- HELMSUBST_VALIDATING_WEBHOOK_MATCHEXPRESSION_METADATANAME
timeoutSeconds: HELMSUBST_VALIDATING_WEBHOOK_TIMEOUT
failurePolicy: HELMSUBST_VALIDATING_WEBHOOK_CHECK_IGNORE_FAILURE_POLICY
---
apiVersion: policy/v1
kind: PodDisruptionBudget
Expand All @@ -327,8 +333,8 @@ spec:
pods: HELMSUBST_RESOURCEQUOTA_POD_LIMIT
scopeSelector:
matchExpressions:
- operator: In
scopeName: PriorityClass
values:
- HELMSUBST_DEPLOYMENT_CONTROLLER_MANAGER_PRIORITY_CLASS_NAME
- HELMSUBST_DEPLOYMENT_AUDIT_PRIORITY_CLASS_NAME
- operator: In
scopeName: PriorityClass
values:
- HELMSUBST_DEPLOYMENT_CONTROLLER_MANAGER_PRIORITY_CLASS_NAME
- HELMSUBST_DEPLOYMENT_AUDIT_PRIORITY_CLASS_NAME
6 changes: 6 additions & 0 deletions cmd/build/helmify/replacements.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ var replacements = map[string]string{
"HELMSUBST_DEPLOYMENT_CONTROLLER_MANAGER_PRIORITY_CLASS_NAME": `{{ .Values.controllerManager.priorityClassName }}`,

"HELMSUBST_DEPLOYMENT_REPLICAS": `{{ .Values.replicas }}`,

`HELMSUBST_DEPLOYMENT_LABELS: ""`: `{{- include "gatekeeper.commonLabels" . | nindent 4 }}`,

"HELMSUBST_DEPLOYMENT_LABELS_NAME": `{{ .Chart.Name }}`,

"HELMSUBST_DEPLOYMENT_LABELS_VERSION": `{{ .Chart.AppVersion }}`,

"HELMSUBST_DEPLOYMENT_REVISION_HISTORY_LIMIT": `{{ .Values.revisionHistoryLimit }}`,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
labels:
{{- include "gatekeeper.commonLabels" . | nindent 4 }}
app: '{{ template "gatekeeper.name" . }}'
chart: '{{ template "gatekeeper.name" . }}'
control-plane: audit-controller
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
labels:
{{- include "gatekeeper.commonLabels" . | nindent 4 }}
app: '{{ template "gatekeeper.name" . }}'
chart: '{{ template "gatekeeper.name" . }}'
control-plane: controller-manager
Expand Down

0 comments on commit 42611e7

Please sign in to comment.