From 5f8d19b9dc1e36606efab330f09c2d055f9ddc8d Mon Sep 17 00:00:00 2001 From: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Date: Sat, 22 Apr 2023 13:27:25 +0300 Subject: [PATCH] fix(varrun, devshm): medium -> Memory (#398) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** ⚒️ Fixes https://github.com/truecharts/charts/issues/8098 **⚙️ Type of change** - [ ] ⚙️ Feature/App addition - [x] 🪛 Bugfix - [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] 🔃 Refactor of current code **🧪 How Has This Been Tested?** **📃 Notes:** **✔️ Checklist:** - [x] ⚖️ My code follows the style guidelines of this project - [x] 👀 I have performed a self-review of my own code - [ ] #️⃣ I have commented my code, particularly in hard-to-understand areas - [ ] 📄 I have made corresponding changes to the documentation - [ ] ⚠️ My changes generate no new warnings - [ ] 🧪 I have added tests to this description that prove my fix is effective or that my feature works - [x] ⬆️ I increased versions for any altered app according to semantic versioning **➕ App addition** If this PR is an app addition please make sure you have done the following. - [ ] 🪞 I have opened a PR on [truecharts/containers](https://github.com/truecharts/containers) adding the container to TrueCharts mirror repo. - [ ] 🖼️ I have added an icon in the Chart's root directory called `icon.png` --- _Please don't blindly check all the boxes. Read them and only check those that apply. Those checkboxes are there for the reviewer to see what is this all about and the status of this PR with a quick glance._ --- .../tests/defaults/defaults-test.yaml | 81 +++++++++++++++++++ library/common/Chart.yaml | 2 +- library/common/templates/class/_cronjob.tpl | 2 +- library/common/templates/class/_daemonset.tpl | 2 +- .../common/templates/class/_deployment.tpl | 2 +- library/common/templates/class/_job.tpl | 2 +- .../common/templates/class/_statefulset.tpl | 2 +- .../lib/metadata/_selectorLabels.tpl | 4 +- .../templates/lib/workload/_cronjobSpec.tpl | 4 +- .../templates/lib/workload/_jobSpec.tpl | 2 +- library/common/values.yaml | 5 +- 11 files changed, 95 insertions(+), 13 deletions(-) create mode 100644 library/common-test/tests/defaults/defaults-test.yaml 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: []