Skip to content

Commit edddb61

Browse files
authored
Merge pull request #8524 from zalando-incubator/kube-janitor-config
make kube-janitor opt-in for production clusters
2 parents fa229df + 60eb9d8 commit edddb61

File tree

6 files changed

+40
-5
lines changed

6 files changed

+40
-5
lines changed

cluster/config-defaults.yaml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,24 @@ control_plane_load_balancer_internal: "none"
11701170
# fs.inotify.max_user_watches = 100000
11711171
sysctl_settings: ""
11721172

1173-
1173+
# kube-janitor configuration
1174+
{{if eq .Cluster.Environment "production"}}
1175+
# This makes kube-janitor opt-in for production clusters
1176+
1177+
# IMPORTANT:
1178+
# Please note that before enabling kube-janitor for a production cluster, you
1179+
# must ensure that no existing resources should be annotated with a TTL.
1180+
# This can happen in the case where a test deployment is deployed to production
1181+
# as is. Currently, it's a no-op since kube-janitor doesn't run in production.
1182+
#
1183+
# This is needed until we can implement namespace prefix matching to reduce
1184+
# the scope of kube-janitor to a set of namespace names that aren't known
1185+
# at the time of enaling kube-janitor. Once the feature is in place, it would
1186+
# be easier to limit the scope.
1187+
kube_janitor_enabled: "false"
1188+
{{else}}
1189+
kube_janitor_enabled: "true"
1190+
{{end}}
11741191

11751192
# scheduling_controls
11761193
teapot_admission_controller_scheduling_controls_enabled: "false"

cluster/manifests/deletions.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,3 +330,21 @@ post_apply:
330330
kind: ServiceAccount
331331
namespace: kube-system
332332
{{- end }}
333+
{{- if ne .Cluster.ConfigItems.kube_janitor_enabled "true" }}
334+
- name: kube-janitor
335+
kind: Deployment
336+
namespace: kube-system
337+
- name: kube-janitor
338+
kind: ConfigMap
339+
namespace: kube-system
340+
- name: kube-janitor
341+
kind: VerticalPodAutoscaler
342+
namespace: kube-system
343+
- name: kube-janitor
344+
kind: ServiceAccount
345+
namespace: kube-system
346+
- name: kube-janitor
347+
kind: ClusterRole
348+
- name: kube-janitor
349+
kind: ClusterRoleBinding
350+
{{- end }}

cluster/manifests/kube-janitor/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# {{ if ne .Cluster.Environment "production" }}
1+
# {{ if eq .Cluster.ConfigItems.kube_janitor_enabled "true" }}
22
# {{ $image := "container-registry.zalando.net/teapot/kube-janitor:23.7.0-main-2" }}
33
# {{ $version := index (split (index (split $image ":") 1) "-") 0 }}
44
apiVersion: apps/v1

cluster/manifests/kube-janitor/rbac.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{ if ne .Cluster.Environment "production" }}
1+
{{ if eq .Cluster.ConfigItems.kube_janitor_enabled "true" }}
22
apiVersion: v1
33
kind: ServiceAccount
44
metadata:

cluster/manifests/kube-janitor/rules-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# {{ if ne .Cluster.Environment "production" }}
1+
# {{ if eq .Cluster.ConfigItems.kube_janitor_enabled "true" }}
22
apiVersion: v1
33
kind: ConfigMap
44
metadata:

cluster/manifests/kube-janitor/vpa.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{ if ne .Cluster.Environment "production" }}
1+
{{ if eq .Cluster.ConfigItems.kube_janitor_enabled "true" }}
22
apiVersion: autoscaling.k8s.io/v1
33
kind: VerticalPodAutoscaler
44
metadata:

0 commit comments

Comments
 (0)