diff --git a/library/common-test/tests/defaults/defaults-test.yaml b/library/common-test/tests/defaults/defaults-test.yaml new file mode 100644 index 00000000..0258630f --- /dev/null +++ b/library/common-test/tests/defaults/defaults-test.yaml @@ -0,0 +1,81 @@ +suite: default test +templates: + - common.yaml +tests: + - it: should pass with defaults + set: + service: + main: + enabled: true + ports: + main: + enabled: true + port: 1025 + workload: + main: + enabled: true + podSpec: + containers: + main: + enabled: true + asserts: + - hasDocuments: + count: 2 + - documentIndex: &deploymentDoc 0 + isKind: + of: Deployment + - documentIndex: &serviceDoc 1 + isKind: + of: Service + - documentIndex: *serviceDoc + isAPIVersion: + of: v1 + - documentIndex: *deploymentDoc + isAPIVersion: + of: apps/v1 + - documentIndex: *deploymentDoc + isSubset: + path: spec + content: + replicas: 1 + revisionHistoryLimit: 3 + strategy: + type: Recreate + - documentIndex: *deploymentDoc + isSubset: + path: spec.template.spec + content: + serviceAccountName: default + automountServiceAccountToken: false + runtimeClassName: + hostNetwork: false + enableServiceLinks: false + restartPolicy: Always + dnsPolicy: ClusterFirst + dnsConfig: + options: + - name: ndots + value: "2" + terminationGracePeriodSeconds: 60 + securityContext: + fsGroup: 568 + fsGroupChangePolicy: OnRootMismatch + supplementalGroups: [] + sysctls: [] + - documentIndex: *deploymentDoc + isSubset: + path: spec.template.spec + content: + volumes: + - name: devshm + emptyDir: + medium: Memory + - name: shared + emptyDir: {} + - name: tmp + emptyDir: {} + - name: varlogs + emptyDir: {} + - name: varrun + emptyDir: + medium: Memory diff --git a/library/common/Chart.yaml b/library/common/Chart.yaml index 02097483..b4cd638a 100644 --- a/library/common/Chart.yaml +++ b/library/common/Chart.yaml @@ -15,4 +15,4 @@ maintainers: name: common sources: null type: library -version: 12.4.21 +version: 12.4.22 diff --git a/library/common/templates/class/_cronjob.tpl b/library/common/templates/class/_cronjob.tpl index 43ad579f..f0a5197a 100644 --- a/library/common/templates/class/_cronjob.tpl +++ b/library/common/templates/class/_cronjob.tpl @@ -27,7 +27,7 @@ metadata: {{- . | nindent 4 }} {{- end }} spec: - {{- include "tc.v1.common.lib.workload.cronjobSpec" (dict "rootCtx" $rootCtx "objectData" $objectData) | nindent 2 }} + {{- include "tc.v1.common.lib.workload.cronjobSpec" (dict "rootCtx" $rootCtx "objectData" $objectData) | indent 2 }} template: metadata: {{- $labels := (mustMerge ($objectData.podSpec.labels | default dict) diff --git a/library/common/templates/class/_daemonset.tpl b/library/common/templates/class/_daemonset.tpl index 79e5d0f6..645cdd54 100644 --- a/library/common/templates/class/_daemonset.tpl +++ b/library/common/templates/class/_daemonset.tpl @@ -27,7 +27,7 @@ metadata: {{- . | nindent 4 }} {{- end }} spec: - {{- include "tc.v1.common.lib.workload.daemonsetSpec" (dict "rootCtx" $rootCtx "objectData" $objectData) | nindent 2 }} + {{- include "tc.v1.common.lib.workload.daemonsetSpec" (dict "rootCtx" $rootCtx "objectData" $objectData) | indent 2 }} selector: matchLabels: {{- include "tc.v1.common.lib.metadata.selectorLabels" (dict "rootCtx" $rootCtx "objectType" "pod" "objectName" $objectData.shortName) | trim | nindent 6 }} diff --git a/library/common/templates/class/_deployment.tpl b/library/common/templates/class/_deployment.tpl index e3c4d7b1..73163218 100644 --- a/library/common/templates/class/_deployment.tpl +++ b/library/common/templates/class/_deployment.tpl @@ -27,7 +27,7 @@ metadata: {{- . | nindent 4 }} {{- end }} spec: - {{- include "tc.v1.common.lib.workload.deploymentSpec" (dict "rootCtx" $rootCtx "objectData" $objectData) | nindent 2 }} + {{- include "tc.v1.common.lib.workload.deploymentSpec" (dict "rootCtx" $rootCtx "objectData" $objectData) | indent 2 }} selector: matchLabels: {{- include "tc.v1.common.lib.metadata.selectorLabels" (dict "rootCtx" $rootCtx "objectType" "pod" "objectName" $objectData.shortName) | trim | nindent 6 }} diff --git a/library/common/templates/class/_job.tpl b/library/common/templates/class/_job.tpl index 6b2f82cc..c94f193d 100644 --- a/library/common/templates/class/_job.tpl +++ b/library/common/templates/class/_job.tpl @@ -27,7 +27,7 @@ metadata: {{- . | nindent 4 }} {{- end }} spec: - {{- include "tc.v1.common.lib.workload.jobSpec" (dict "rootCtx" $rootCtx "objectData" $objectData) | nindent 2 }} + {{- include "tc.v1.common.lib.workload.jobSpec" (dict "rootCtx" $rootCtx "objectData" $objectData) | indent 2 }} template: metadata: {{- $labels := (mustMerge ($objectData.podSpec.labels | default dict) diff --git a/library/common/templates/class/_statefulset.tpl b/library/common/templates/class/_statefulset.tpl index 1afd5913..cb098421 100644 --- a/library/common/templates/class/_statefulset.tpl +++ b/library/common/templates/class/_statefulset.tpl @@ -27,7 +27,7 @@ metadata: {{- . | nindent 4 }} {{- end }} spec: - {{- include "tc.v1.common.lib.workload.statefulsetSpec" (dict "rootCtx" $rootCtx "objectData" $objectData) | nindent 2 }} + {{- include "tc.v1.common.lib.workload.statefulsetSpec" (dict "rootCtx" $rootCtx "objectData" $objectData) | indent 2 }} selector: matchLabels: {{- include "tc.v1.common.lib.metadata.selectorLabels" (dict "rootCtx" $rootCtx "objectType" "pod" "objectName" $objectData.shortName) | trim | nindent 6 }} diff --git a/library/common/templates/lib/metadata/_selectorLabels.tpl b/library/common/templates/lib/metadata/_selectorLabels.tpl index 77c30db5..aaf09beb 100644 --- a/library/common/templates/lib/metadata/_selectorLabels.tpl +++ b/library/common/templates/lib/metadata/_selectorLabels.tpl @@ -8,9 +8,9 @@ podName is the "shortName" of the pod. The one you define in the .Values.workloa {{- $objectType := .objectType -}} {{- $objectName := .objectName }} -{{ if $objectType }} +{{- if and $objectType $objectName }} {{ printf "%s.name" $objectType }}: {{ $objectName }} -{{ end }} +{{- end }} app.kubernetes.io/name: {{ include "tc.v1.common.lib.chart.names.name" $rootCtx }} app.kubernetes.io/instance: {{ $rootCtx.Release.Name }} {{- end -}} diff --git a/library/common/templates/lib/workload/_cronjobSpec.tpl b/library/common/templates/lib/workload/_cronjobSpec.tpl index 9f4f4e9f..bae128e9 100644 --- a/library/common/templates/lib/workload/_cronjobSpec.tpl +++ b/library/common/templates/lib/workload/_cronjobSpec.tpl @@ -13,7 +13,7 @@ objectData: */}} {{- define "tc.v1.common.lib.workload.cronjobSpec" -}} {{- $objectData := .objectData -}} - {{- $rootCtx := .rootCtx -}} + {{- $rootCtx := .rootCtx }} timeZone: {{ (tpl ($objectData.timezone | default $rootCtx.Values.TZ) $rootCtx) | quote }} schedule: {{ (tpl $objectData.schedule $rootCtx) | quote }} concurrencyPolicy: {{ $objectData.concurrencyPolicy | default "Forbid" }} @@ -22,5 +22,5 @@ successfulJobsHistoryLimit: {{ $objectData.successfulJobsHistoryLimit | default startingDeadlineSeconds: {{ $objectData.startingDeadlineSeconds | default 600 }} jobTemplate: spec: - {{- include "tc.v1.common.lib.workload.jobSpec" (dict "rootCtx" $rootCtx "objectData" $objectData) | nindent 4 }} + {{- include "tc.v1.common.lib.workload.jobSpec" (dict "rootCtx" $rootCtx "objectData" $objectData) | indent 4 }} {{- end -}} diff --git a/library/common/templates/lib/workload/_jobSpec.tpl b/library/common/templates/lib/workload/_jobSpec.tpl index 7cfd5f2f..8eb5e89f 100644 --- a/library/common/templates/lib/workload/_jobSpec.tpl +++ b/library/common/templates/lib/workload/_jobSpec.tpl @@ -12,7 +12,7 @@ objectData: */}} {{- define "tc.v1.common.lib.workload.jobSpec" -}} {{- $objectData := .objectData -}} - {{- $rootCtx := .rootCtx -}} + {{- $rootCtx := .rootCtx }} backoffLimit: {{ $objectData.backoffLimit | default 5 }} completionMode: {{ $objectData.completionMode | default "NonIndexed" }} completions: {{ $objectData.completions | default nil }} diff --git a/library/common/values.yaml b/library/common/values.yaml index 48f49ed8..1e579aef 100644 --- a/library/common/values.yaml +++ b/library/common/values.yaml @@ -134,7 +134,7 @@ podOptions: priorityClassName: "" runtimeClassName: "" automountServiceAccountToken: false - terminationGracePeriodSeconds: 120 + terminationGracePeriodSeconds: 60 # -- (docs/workload/README.md) workload: @@ -195,7 +195,7 @@ persistence: enabled: true type: emptyDir mountPath: /var/run - mediume: Memory + medium: Memory targetSelectAll: true tmp: enabled: true @@ -206,6 +206,7 @@ persistence: enabled: true type: emptyDir mountPath: /dev/shm + medium: Memory targetSelectAll: true persistenceList: []