Skip to content
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

[Pod-Cleanup] Update to kubectl 1.27 and make pod field-selector customizable #68

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions chart-tests/pod-cleanup/ci/test-values-phase.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
podFieldSelector: status.phase=!Running
2 changes: 1 addition & 1 deletion charts/pod-cleanup/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ type: application
maintainers:
- name: MediaMarktSaturn
url: https://github.com/MediaMarktSaturn
version: 1.0.0
version: 1.1.0
2 changes: 1 addition & 1 deletion charts/pod-cleanup/templates/cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
command:
- /bin/sh
- -c
- kubectl delete pods -A --field-selector=status.phase=Failed
- kubectl delete pods -A --field-selector={{ $.Values.podFieldSelector }}
resources:
{{- toYaml $.Values.resources | nindent 16 }}
imagePullPolicy: IfNotPresent
Expand Down
5 changes: 4 additions & 1 deletion charts/pod-cleanup/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ image:
# A different image can be used as long as it contains the "kubectl" tool
repository: bitnami/kubectl
# Tag can be set to any Kubernetes version, to avoid unexpected compability issues it is recommended to use the same version configured for the K8s cluster
tag: "1.25"
tag: "1.27"

# CronJob schedule https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/#cron-schedule-syntax
# Defaults to once every Monday on 07:00 AM (once per week)
Expand All @@ -25,3 +25,6 @@ resources:
limits:
cpu: 100m
memory: 100Mi

# --field-selector value to identify pods to be cleaned up
podFieldSelector: status.phase=Failed