Skip to content

Commit

Permalink
add new fields
Browse files Browse the repository at this point in the history
  • Loading branch information
juri committed Apr 2, 2024
1 parent 340d1c2 commit 0e3ce4e
Show file tree
Hide file tree
Showing 16 changed files with 81 additions and 24 deletions.
2 changes: 1 addition & 1 deletion charts/app/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: app
description: A Helm chart for Kubernetes Deployment
type: application

version: 0.13.11
version: 0.14.0

keywords:
- deployment
Expand Down
25 changes: 24 additions & 1 deletion charts/app/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ securityContext: {}
# runAsNonRoot: true
# runAsUser: 1000

## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/
# priorityClassName: name
# priority: 0
# preemptionPolicy: PreemptLowerPriority

## ref: https://cloud.google.com/kubernetes-engine/docs/how-to/container-native-load-balancing
# terminationGracePeriodSeconds: 180
# minReadySeconds: 10
Expand Down Expand Up @@ -144,6 +149,9 @@ resources: {}
# timeoutSeconds: 5
# failureThreshold: 3

## ref: https://kubernetes.io/docs/tutorials/services/connect-applications-service/
# enableServiceLinks: false

## specify service account
# serviceAccountName: sa-name

Expand Down Expand Up @@ -219,7 +227,22 @@ podAntiAffinity:
- weight: 50
topologyKey: "kubernetes.io/hostname"
- weight: 100
topologyKey: "failure-domain.beta.kubernetes.io/zone"
topologyKey: "topology.kubernetes.io/zone"

## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/
topologySpreadConstraintsDefault:
enabled: false
maxSkew: 1
topologyKey: "topology.kubernetes.io/zone"
whenUnsatisfiable: ScheduleAnyway

# topologySpreadConstraints:
# - labelSelector:
# matchLabels:
# app.kubernetes.io/component: app
# maxSkew: 1
# topologyKey: topology.kubernetes.io/zone
# whenUnsatisfiable: ScheduleAnyway

lifecycle: {}

Expand Down
2 changes: 1 addition & 1 deletion charts/argo-applications/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: argo-applications
description: A Helm chart for Kubernetes argo applications
type: application

version: 0.13.11
version: 0.14.0

keywords:
- argocd
Expand Down
2 changes: 1 addition & 1 deletion charts/base/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: base
description: A Helm chart for Kubernetes with helm named templates
type: library

version: 0.13.11
version: 0.14.0

keywords:
- deployment
Expand Down
1 change: 0 additions & 1 deletion charts/base/templates/_cronjob.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ spec:
{{- with include "base.volumes" $deploymentValues }}
{{- . | trim | nindent 10 }}
{{- end }}
restartPolicy: {{ $deploymentValues.Values.restartPolicy }}
{{- with $deploymentValues.Values.podFailurePolicy }}
podFailurePolicy:
{{- toYaml . | nindent 8 }}
Expand Down
3 changes: 0 additions & 3 deletions charts/base/templates/_deployment.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@ spec:
{{- . | trim | nindent 10 }}
{{- end }}
{{- end }}
{{- if $deploymentValues.Values.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ $deploymentValues.Values.terminationGracePeriodSeconds }}
{{- end }}
{{- with include "base.volumes" $deploymentValues }}
{{- . | trim | nindent 6 }}
{{- end }}
Expand Down
45 changes: 42 additions & 3 deletions charts/base/templates/_deploymentSpec.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,18 @@ imagePullSecrets:
{{- end }}

{{/*
define container priorityClassName
define pod priority and priorityClass
*/}}
{{- define "base.priorityClassName" -}}
{{- define "base.podPriority" -}}
{{- if .priorityClassName }}
priorityClassName: {{ .priorityClassName }}
{{- end }}
{{- if .priority }}
priority: {{ .priority }}
{{- end }}
{{- if .preemptionPolicy }}
preemptionPolicy: {{ .preemptionPolicy }}
{{- end }}
{{- end }}

{{/*
Expand Down Expand Up @@ -254,6 +260,9 @@ args:
define pod command and args
*/}}
{{- define "base.hostAliases" -}}
{{- if .dnsPolicy }}
dnsPolicy: {{ .dnsPolicy }}
{{- end }}
{{- if .hostNetwork }}
hostNetwork: {{ .hostNetwork }}
{{- end }}
Expand All @@ -273,6 +282,28 @@ automountServiceAccountToken: {{ .automountServiceAccountToken }}
serviceAccountName: {{ .serviceAccountName | default "default" }}
{{- end }}

{{/*
define topologySpreadConstraints
*/}}
{{- define "base.topologySpreadConstraints" -}}
{{- if or (and (index .Values "topologySpreadConstraintsDefault") (index .Values.topologySpreadConstraintsDefault "enabled")) .Values.topologySpreadConstraints }}
topologySpreadConstraints:
{{- with .Values.topologySpreadConstraints }}
{{ toYaml . | indent 2 }}
{{- end }}
{{- if .Values.topologySpreadConstraintsDefault.enabled }}
- labelSelector:
matchLabels:
{{- range $key, $value := include "base.selectorLabels" . | trim | toString | fromYaml }}
{{ $key }}: {{ $value }}
{{- end }}
maxSkew: {{ .Values.topologySpreadConstraintsDefault.maxSkew }}
topologyKey: {{ .Values.topologySpreadConstraintsDefault.topologyKey }}
whenUnsatisfiable: {{ .Values.topologySpreadConstraintsDefault.whenUnsatisfiable }}
{{- end }}
{{- end }}
{{- end }}

{{/*
define default pod properties
*/}}
Expand All @@ -295,5 +326,13 @@ define default container properties
{{- include "base.NodeScheduling" . }}
{{- include "base.serviceAccount" .Values }}
{{- include "base.hostAliases" .Values }}
{{- include "base.priorityClassName" .Values }}
{{- include "base.podPriority" .Values }}
{{- include "base.topologySpreadConstraints" . }}
enableServiceLinks: {{ hasKey .Values "enableServiceLinks" | ternary .Values.enableServiceLinks true }}
{{- if .Values.restartPolicy }}
restartPolicy: {{ .Values.restartPolicy }}
{{- end }}
{{- if .Values.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
{{- end }}
{{- end }}
9 changes: 4 additions & 5 deletions charts/base/templates/_job.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ spec:
parallelism: {{ $deploymentValues.Values.parallelism }}
{{- end }}
backoffLimit: {{ $deploymentValues.Values.backoffLimit | toString }}
{{- with $deploymentValues.Values.podFailurePolicy }}
podFailurePolicy:
{{- toYaml . | nindent 4 }}
{{- end }}
template:
{{- if or $deploymentValues.Values.podAnnotations $deploymentValues.Values.podLabels }}
metadata:
Expand All @@ -38,7 +42,6 @@ spec:
{{- end }}
{{- end }}
spec:
restartPolicy: {{ $deploymentValues.Values.restartPolicy }}
{{- if $deploymentValues.Values.podActiveDeadlineSeconds }}
activeDeadlineSeconds: {{ $deploymentValues.Values.podActiveDeadlineSeconds }}
{{- end }}
Expand Down Expand Up @@ -71,8 +74,4 @@ spec:
{{- with include "base.volumes" $deploymentValues }}
{{- . | trim | nindent 6 }}
{{- end }}
{{- with $deploymentValues.Values.podFailurePolicy }}
podFailurePolicy:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion charts/base/templates/_storageClasses.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ parameters:
provisioner: {{ .provisioner }}
{{- end }}
reclaimPolicy: {{ .reclaimPolicy | default "Retain" }}
allowVolumeExpansion: {{ .allowVolumeExpansion | default true }}
allowVolumeExpansion: {{ hasKey . "allowVolumeExpansion" | ternary .allowVolumeExpansion true }}
volumeBindingMode: {{ .volumeBindingMode | default "Immediate" }}
{{- end }}
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion charts/cronjob/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: cronjob
description: A Helm chart for Kubernetes cronjob
type: application

version: 0.13.11
version: 0.14.0

keywords:
- cronjob
Expand Down
2 changes: 1 addition & 1 deletion charts/default-base/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: default-base
description: A Helm chart for Kubernetes - default-base for namespaces

version: 0.13.11
version: 0.14.0

keywords:
- BackendConfig
Expand Down
2 changes: 1 addition & 1 deletion charts/ingress/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: ingress
description: A Helm chart for Kubernetes ingress
type: application

version: 0.13.11
version: 0.14.0

keywords:
- ingress
Expand Down
2 changes: 1 addition & 1 deletion charts/job/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: job
description: A Helm chart for Kubernetes job
type: application

version: 0.13.11
version: 0.14.0

keywords:
- job
Expand Down
2 changes: 1 addition & 1 deletion charts/prometheus-rules/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: prometheus-rules
description: A Helm chart for Prometheus Rules
type: application

version: 0.13.11
version: 0.14.0

keywords:
- job
Expand Down
2 changes: 1 addition & 1 deletion charts/rbac/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: rbac
description: A Helm chart for Kubernetes rbac
type: application

version: 0.13.11
version: 0.14.0

keywords:
- rbac
Expand Down
2 changes: 1 addition & 1 deletion charts/service/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: service
description: A Helm chart for Kubernetes service
type: application

version: 0.13.11
version: 0.14.0

keywords:
- service
Expand Down

0 comments on commit 0e3ce4e

Please sign in to comment.