From 4942164b9ae95b344d6288513d3b87d28a19bbc8 Mon Sep 17 00:00:00 2001 From: Laszlo Fogas Date: Thu, 5 Aug 2021 10:40:02 +0200 Subject: [PATCH 1/6] Testing of common chart --- Makefile | 9 +++++++++ charts/common/.helmignore | 23 ++++++++++++++++++++++ charts/common/Chart.yaml | 24 +++++++++++++++++++++++ charts/common/templates/_configmap.yaml | 15 ++++++++++++++ charts/common/templates/_helpers.tpl | 10 ++++++++++ charts/cron-job/Chart.lock | 6 ++++++ charts/cron-job/Chart.yaml | 5 +++++ charts/cron-job/charts/common-0.1.0.tgz | Bin 0 -> 958 bytes charts/cron-job/templates/configmap.yaml | 14 +------------ charts/onechart/Chart.lock | 6 ++++++ charts/onechart/Chart.yaml | 5 +++++ charts/onechart/charts/common-0.1.0.tgz | Bin 0 -> 958 bytes charts/onechart/templates/configmap.yaml | 14 +------------ values-cron-job.yaml | 11 +++++++++++ values.yaml | 3 +++ 15 files changed, 119 insertions(+), 26 deletions(-) create mode 100644 charts/common/.helmignore create mode 100644 charts/common/Chart.yaml create mode 100644 charts/common/templates/_configmap.yaml create mode 100644 charts/common/templates/_helpers.tpl create mode 100644 charts/cron-job/Chart.lock create mode 100644 charts/cron-job/charts/common-0.1.0.tgz create mode 100644 charts/onechart/Chart.lock create mode 100644 charts/onechart/charts/common-0.1.0.tgz create mode 100644 values-cron-job.yaml diff --git a/Makefile b/Makefile index 0a0b1cf..5c32ed9 100644 --- a/Makefile +++ b/Makefile @@ -28,8 +28,12 @@ kubeval: find manifests/ -name '*.yaml' | xargs kubeval --ignore-missing-schemas -v 1.18.0 test: + helm dependency update charts/onechart helm unittest charts/onechart + + helm dependency update charts/cron-job helm unittest charts/cron-job + helm unittest charts/namespaces package: @@ -45,8 +49,13 @@ package: helm repo index docs --url https://chart.onechart.dev debug: + helm dependency update charts/onechart helm template charts/onechart/ -f values.yaml --debug +debug-cron-job: + helm dependency update charts/cron-job + helm template charts/cron-job/ -f values-cron-job.yaml --debug + debug-ui: #gimlet chart configure -s charts/onechart/values.schema.json -u charts/onechart/helm-ui.json onechart/onechart /home/laszlo/projects/gimlet-cli/build/gimlet chart configure -s charts/onechart/values.schema.json -u charts/onechart/helm-ui.json onechart/onechart diff --git a/charts/common/.helmignore b/charts/common/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/common/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/common/Chart.yaml b/charts/common/Chart.yaml new file mode 100644 index 0000000..73cecbd --- /dev/null +++ b/charts/common/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: common +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: library + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/charts/common/templates/_configmap.yaml b/charts/common/templates/_configmap.yaml new file mode 100644 index 0000000..babfd71 --- /dev/null +++ b/charts/common/templates/_configmap.yaml @@ -0,0 +1,15 @@ +{{- define "common.configmap.tpl" -}} +{{- if .Values.vars }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "common.robustName" .Release.Name }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "helm-chart.labels" . | nindent 4 }} +data: +{{- range $key, $val := .Values.vars }} + {{ $key }}: {{ $val | quote }} +{{- end }} +{{- end }} +{{- end -}} diff --git a/charts/common/templates/_helpers.tpl b/charts/common/templates/_helpers.tpl new file mode 100644 index 0000000..efc1177 --- /dev/null +++ b/charts/common/templates/_helpers.tpl @@ -0,0 +1,10 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* +Create robustName that can be used as Kubernetes resource name, and as subdomain as well +\w – Latin letters, digits, underscore '_' . +\W – all but \w . +*/}} +{{- define "common.robustName" -}} +{{ regexReplaceAll "[^0-9A-Za-z_\\.]+" . "-" | replace "_" "-" | lower | trunc 63 | trimSuffix "-" | trimPrefix "-" }} +{{- end }} diff --git a/charts/cron-job/Chart.lock b/charts/cron-job/Chart.lock new file mode 100644 index 0000000..7ebac7e --- /dev/null +++ b/charts/cron-job/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: file://../common + version: 0.1.0 +digest: sha256:636a65e9846bdff17cc4e65b0849061f783759a37aa51fb85ff6fd8ba5e68467 +generated: "2021-08-05T10:18:17.533366128+02:00" diff --git a/charts/cron-job/Chart.yaml b/charts/cron-job/Chart.yaml index ea92f9c..8b1b3c6 100644 --- a/charts/cron-job/Chart.yaml +++ b/charts/cron-job/Chart.yaml @@ -16,3 +16,8 @@ type: application # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) version: 0.1.2 + +dependencies: + - name: common + version: 0.1.0 + repository: file://../common diff --git a/charts/cron-job/charts/common-0.1.0.tgz b/charts/cron-job/charts/common-0.1.0.tgz new file mode 100644 index 0000000000000000000000000000000000000000..c0eadeed61e4ecb7f3696900563ec9ba05f81731 GIT binary patch literal 958 zcmV;v13~;BiwG0|00000|0w_~VMtOiV@ORlOnEsqVl!4SWK%V1T2nbTPgYhoO;>Dc zVQyr3R8em|NM&qo0PI)YZsRr+%{8Cme9i*<)s1P{NgUL`UIf_!E&8|E6e-ZA4Mx&f z;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h#OH<0)$3Q@vtjTnf zGkPWKYS6YT*>QT1ID=6pXA>}q?p==2&5&rbMs2hSFyF?)IE&@n(u!Ft{1)Dq9| zb7MoBP27l0{uk5uI-mN|ui>u#OV%|zA20ubV%)F)@ooJl(`2Ln$G~be>|>#-89WEf zmFD=%{j!R$B`bM`{&2k(BGSaZ<0#xK!6K9tkdZ;kXgud2f9;C^j=gPM#;u5VK&B=5 zCe3X{%EZNzwH8N9{Qm22_>zJ$&>R9gzk^&AD)=2VCTHg}>ln|EpF@hH?^-%(jkF0k zT0)98%|B^o*SkyC$>6x)_iwq@l<_OA(fi@2WbnzW!S^)yaC~$mfBZQ1h~A)wGq{e1 z-f{2TqV19$&JbK(f?y$8*eD;&3FWht^%+u*&uC{&Xp-pQ+7fHdnvZ@ZK)N{D;Y-#U zg|;aw3R$U4u>;4Nf?66-xZ?BZ+T}K7}={XG{q- zJ7{HC3iMPT0J(Br$U=o-J9g;{nSOA?cDyi@#V`&ROTRF~tBq31 zPMW&yeO~mXU)G{8Q#uiS8LBw9P8Fj6i`d2?Ib|D<&tHG)g{+-@$5{|k;4#Q+ol0L3%lI{*Lx literal 0 HcmV?d00001 diff --git a/charts/onechart/templates/configmap.yaml b/charts/onechart/templates/configmap.yaml index 0e4f554..3057866 100644 --- a/charts/onechart/templates/configmap.yaml +++ b/charts/onechart/templates/configmap.yaml @@ -1,13 +1 @@ -{{- if .Values.vars }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ template "robustName" .Release.Name }} - namespace: {{ .Release.Namespace }} - labels: - {{- include "helm-chart.labels" . | nindent 4 }} -data: -{{- range $key, $val := .Values.vars }} - {{ $key }}: {{ $val | quote }} -{{- end }} -{{- end }} +{{- include "common.configmap.tpl" . -}} diff --git a/values-cron-job.yaml b/values-cron-job.yaml new file mode 100644 index 0000000..8fa4ce4 --- /dev/null +++ b/values-cron-job.yaml @@ -0,0 +1,11 @@ +image: + repository: debian + tag: stable-slim + +schedule: "*/1 * * * *" +command: | + echo "I'm alive" +shell: "/bin/sh" + +vars: + MY_VAR: "value" diff --git a/values.yaml b/values.yaml index b59c72f..ab9c445 100644 --- a/values.yaml +++ b/values.yaml @@ -12,3 +12,6 @@ ingresses: gitRepository: github.com/laszlocph/demo-app gitSha: xyz + +vars: + MY_VAR: "value" From d91040c0a036a110cdd4ad65aebc0ef3590a89f3 Mon Sep 17 00:00:00 2001 From: Laszlo Fogas Date: Thu, 5 Aug 2021 10:56:29 +0200 Subject: [PATCH 2/6] Job constraints configurable --- charts/cron-job/charts/common-0.1.0.tgz | Bin 958 -> 959 bytes charts/cron-job/templates/cronJob.yaml | 7 +++---- .../tests/cronjob_costraints_test.yaml | 17 +++++++++++++++++ charts/cron-job/values.yaml | 6 ++++++ charts/onechart/charts/common-0.1.0.tgz | Bin 958 -> 957 bytes 5 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 charts/cron-job/tests/cronjob_costraints_test.yaml diff --git a/charts/cron-job/charts/common-0.1.0.tgz b/charts/cron-job/charts/common-0.1.0.tgz index c0eadeed61e4ecb7f3696900563ec9ba05f81731..7eb888ecbb4d542ca95a4c4a1e5350c418a256b0 100644 GIT binary patch delta 895 zcmV-_1AzR#2fqi9O@B_jsDZs$WDB(D-(pjwK$|ugNn?o{id0F;-mK%I@6b2wlN6Nl zpBA}jnzVq=1w{_daE9WXv7FhevSzqnk_+;bD!ujaNRlL(?(VkFBuQ>RlhJf2$J{jK;gu7h6dFfn4sO@qye{^0#B%KHPrd@L=;WO41vRE#dTZb>2l%3(gUKpx)hOVGQIIVdGtx`wsR4gv`Oyo!=;;9e4 z!6nZ1AGoSD1@^<^%$m6>Dyko>9o(n?y*v8f+nbCx`hN_pRs-ZbSBBB+YC&EVK&W*O zgY{ZOmYPEzl7DX4%LO@)^;+C$9wTw0Og_VY>;4thqT)a~1)2$`; z!`D=C5ArQ*CeJc1V}#Dp*OYbMHwdk{V`)lR`xppllQo%caz?LYT@BiHB|AwkP(|H*W+(f?y$wHo%ZP}K~c1LjI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WLCR=6=OBOWivW(jZCu8!h<8Ay zCHN-IZGT0|#Kn@e7Dr3`{_Ah}l7ceO90EJPgIpCV_#HGRXXi8P7|)NNLyDvCS~_Ws zvS2aqrxs?UEhN5L{z2OkcE9RUI_*xq5%jiGPMSjxP*18^KfG_)VPaU&cPE3S%8V ze2jbb|KiT~|8#G>(f?y$8*eD;&3FWht^%+u*&uC{&Xp-pQ+7fHdnvZ@ZK)N{D z;Y-#Ug|;aw3R$U4u>;4Nf?66-xZ?BZ+T}K7}={ zXMaoyH9Kf!SPJ?2;P@a|$6_1%ZOP(r{{XpiUdTd)VLNu|3z>d!!*;wdl*KR(7fZh| z!>f%_%1)ZP?R{SKrC-*fFH<@ZeHp4aw@wwJ|BKkhAvt9mkI!F!>V>SGeaBf4Qsqp; mj_&L`As0TgIS>D3Qr}>M4K}!eKLP*%{|Wy_`WVFk6aWCbsMK%( From 164bfec8b3bb000268441b5a955ae9be65716f0f Mon Sep 17 00:00:00 2001 From: Laszlo Fogas Date: Thu, 5 Aug 2021 11:25:41 +0200 Subject: [PATCH 3/6] Moved volume support to common --- charts/common/templates/_pvc.yaml | 18 +++++++++ charts/common/templates/_volumeMountsRef.yaml | 19 +++++++++ charts/common/templates/_volumesRef.yaml | 20 ++++++++++ charts/cron-job/charts/common-0.1.0.tgz | Bin 959 -> 1357 bytes charts/cron-job/templates/cronJob.yaml | 15 ++----- charts/cron-job/templates/pvc.yaml | 16 +------- charts/onechart/charts/common-0.1.0.tgz | Bin 957 -> 1357 bytes charts/onechart/templates/deployment.yaml | 37 +----------------- charts/onechart/templates/pvc.yaml | 17 +------- values-cron-job.yaml | 6 +++ values.yaml | 6 +++ 11 files changed, 76 insertions(+), 78 deletions(-) create mode 100644 charts/common/templates/_pvc.yaml create mode 100644 charts/common/templates/_volumeMountsRef.yaml create mode 100644 charts/common/templates/_volumesRef.yaml diff --git a/charts/common/templates/_pvc.yaml b/charts/common/templates/_pvc.yaml new file mode 100644 index 0000000..7ccd083 --- /dev/null +++ b/charts/common/templates/_pvc.yaml @@ -0,0 +1,18 @@ +{{- define "common.pvc.tpl" -}} +{{- range .Values.volumes }} +{{- $robustName := include "common.robustName" $.Release.Name }} +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ printf "%s-%s" $robustName .name }} + namespace: {{ $.Release.Namespace }} +spec: + accessModes: + - {{ .accessMode | default "ReadWriteOnce" }} + storageClassName: {{ .storageClass | default "local-path" }} + resources: + requests: + storage: {{ .size | default "1Gi" }} +{{- end }} +{{- end -}} diff --git a/charts/common/templates/_volumeMountsRef.yaml b/charts/common/templates/_volumeMountsRef.yaml new file mode 100644 index 0000000..5081d33 --- /dev/null +++ b/charts/common/templates/_volumeMountsRef.yaml @@ -0,0 +1,19 @@ +{{- define "common.volumeMountsRef.tpl" -}} +{{- if or (or (.Values.volumes) (.Values.sealedFileSecrets)) .Values.fileSecrets }} +volumeMounts: &volumeMounts +{{- range .Values.volumes }} + - name: {{ .name }} + mountPath: {{ .path }} +{{- end }} +{{- range .Values.sealedFileSecrets }} + - name: {{ .name }} + mountPath: {{ .path }} + readOnly: true +{{- end }} +{{- range .Values.fileSecrets }} + - name: {{ .name }} + mountPath: {{ .path }} + readOnly: true +{{- end }} +{{- end }} +{{- end }} diff --git a/charts/common/templates/_volumesRef.yaml b/charts/common/templates/_volumesRef.yaml new file mode 100644 index 0000000..cd027b4 --- /dev/null +++ b/charts/common/templates/_volumesRef.yaml @@ -0,0 +1,20 @@ +{{- define "common.volumesRef.tpl" -}} +{{- if or (or (.Values.volumes) (.Values.sealedFileSecrets)) .Values.fileSecrets }} +volumes: + {{- range .Values.volumes }} + - name: {{ .name }} + persistentVolumeClaim: + claimName: {{ printf "%s-%s" $.Release.Name .name }} + {{- end }} + {{- range .Values.sealedFileSecrets }} + - name: {{ .name }} + secret: + secretName: {{ printf "%s-%s" $.Release.Name .name }} + {{- end }} + {{- range .Values.fileSecrets }} + - name: {{ .name }} + secret: + secretName: {{ printf "%s-%s" $.Release.Name .name }} + {{- end }} +{{- end }} +{{- end -}} diff --git a/charts/cron-job/charts/common-0.1.0.tgz b/charts/cron-job/charts/common-0.1.0.tgz index 7eb888ecbb4d542ca95a4c4a1e5350c418a256b0..066f6843a1a5a1cdcf3342831a8ddeb96a845950 100644 GIT binary patch delta 1315 zcmV+;1>E|-2h9qQJAYYkZ`-yL&TD>(`zh(KO%~IVlh~Mnz9`cD!`3!Ph7{Pc1+;XQ z*ifWOQg+kC!@k45;XcVg%Kz;oTj#nR;0LHIUXQ$!bkD<+601B{vVNQ~ZRs`3#n$Q( zhGEz|JoLX|7|#EOQS)dkI*h_btI=vi2U}s(IBYhyAp8iqEPtRhmg%kVU&orixc>-P z!Ou|}u4Ef}4Z@0IJd9}6q#;Sr#F`h@+n&LGJjDN_1^yo$HI6p? zUk7e(YLH-;OMir*ss%bJ09%LvYJ&lBUc3wRoQV<*?J;d&Fd#GH5s@n{lQtat=`UD8 zaK`0F-z|2%f02+-d zb&Q_G`+vZscQ9oqQ90w%4f-eqx#+{6zyAS0Fv}$fv=+75hlHoxntdo`g4)DNBRsx* z43u2F_U=pw=#&;N`ap?KbBUNut4pP1pfSaFr&tIU<1-;3`1#kc_T{tMPptO-^5TO2 z@`clgpccR_=*kU(%V1~`s*f6O!Rk`R&^+*`JbyncyIuZn=;I708b^j%A^6l!d=`uR zFM9EcUj!cFf2$eJ@&EAPu(jd;I5MV7qQ+~O-4V^BpiR%w>Htc`g&N|a7pr&kavW};Rw zn+>OrbaNP871GEO{lxb=!3acz@LHM~}C7I`{nV z;{S@M@9_Ztqo}d){@)5W{9g<1$wD0#UzLUb_GQQ( zHT{C@(GI&Jd(`IcTxp(?z2C?-oHNZ;Y2dr(Ul~FRt=?d43FQg0dgZRw8yrG=CRPd7 ZH#)e%1{-|N_$vSa|Nq>89C-jD0027hjza(d delta 914 zcmV;D18w}x3cm-CJAYT*ZsRr+%{8Cme9i*<)s1P{PQ0jry;x)mwCLYrQ=~wfHW*1` zi5rSkNy^@=`rq4|j5qp! z46IfI24!t+``qN?H3D2xyZv znQn4MuVh^f+IA&7P7e}iFv{d?0(PT&mt%BuWD3T!6MsJ4!LtQv%wFC(bPUi^uwJ)0 zwZt?0+}O}&6E|X$|HU-E&ZoZgYq+cbl6B3_$IE}9829Ucd|Us?bh6R^V_>x!_OVda z44wn#N^|_>ep$uWl9fC|f4E)?5ou!IaTM;AU=d0R$jBgNG@f&izxG7{$KEzB<5t8w zAkz|jlYi#6B4y%Y$y$q}C4T?)H+)G!8E6iHo!>#O3Kjeg8k4j0nRSfk$Il_f(RVGK zv_{$l94#S5o93T1v+LcZ>tt|T@cXx1Ys&bQ*6984Q!@DE)!=&?d^kQjl0SYNdqi*0 z!x>yhL+`kEZqath4rd6iF&UKng_bN$QMCskpr zn{*}Q0>sBC~W2r)k|9vF!jnSvD zrhoN}DWPTutqe;cUmqMF1nXFAW4|p~9PS?=SI!Grs4#5DE`1@>4{q3w7lyJJ#^GY= z7iM_1QA*iKQ@6d(i@x;BTJ&W~C!#My73bEeLiB$T+c+erY~%6y>rcIqwX^Ry3qq=# oY1q-7eJA9?XEx{Izf9^IY_P!wH}FRQ01E*B|GiLBdH@sv0QFnWfB*mh diff --git a/charts/cron-job/templates/cronJob.yaml b/charts/cron-job/templates/cronJob.yaml index d999ed8..0528767 100644 --- a/charts/cron-job/templates/cronJob.yaml +++ b/charts/cron-job/templates/cronJob.yaml @@ -38,20 +38,11 @@ spec: - secretRef: name: {{ .Release.Name }} {{- end }} - volumeMounts: - {{- range .Values.volumes }} - - name: {{ .name }} - mountPath: {{ .path }} - {{- end }} + {{- include "common.volumeMountsRef.tpl" . | nindent 14 }} resources: {{- toYaml .Values.resources | nindent 16 }} - volumes: - {{- range .Values.volumes }} - - name: {{ .name }} - persistentVolumeClaim: - claimName: {{ printf "%s-%s" $.Release.Name .name }} - {{- end }} - {{ with .Values.nodeSelector }} + {{- include "common.volumesRef.tpl" . | nindent 10 }} + {{ with .Values.nodeSelector }} nodeSelector: {{ toYaml . | nindent 8 }} {{- end }} diff --git a/charts/cron-job/templates/pvc.yaml b/charts/cron-job/templates/pvc.yaml index 50a9e4b..b462fad 100644 --- a/charts/cron-job/templates/pvc.yaml +++ b/charts/cron-job/templates/pvc.yaml @@ -1,15 +1 @@ -{{- range .Values.volumes }} ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: {{ printf "%s-%s" $.Release.Name .name }} - namespace: {{ $.Release.Namespace }} -spec: - accessModes: - - {{ .accessMode | default "ReadWriteOnce" }} - storageClassName: {{ .storageClass | default "local-path" }} - resources: - requests: - storage: {{ .size | default "1Gi" }} -{{- end }} +{{- include "common.pvc.tpl" . -}} diff --git a/charts/onechart/charts/common-0.1.0.tgz b/charts/onechart/charts/common-0.1.0.tgz index 2f255ff54d95dccf80b8d8b669655b35c2467808..2a327022c31917ed9e2baa0c768b73290f0e9abb 100644 GIT binary patch delta 1315 zcmV+;1>E|*2h9qQJAYYkZ`-yL&TD>(`zh(KO%~IV<2aasz9`cD!`3!Ph7{Pc1+;XQ z*ifWOQg+kC!@k45;XcVg%Kz;oTj#nR;0LHIUXQ$!bkD<+601B{vVNQ~ZRs`3#n$Q( zhGE!hHvMlHhV#E+)H>XXno-y|Y8*A9Xe*2w%~rSt;YY}20e_{jOmBt%I@bKf{YStG zevaC3CEL(z5LOi9VML=A4M~C~*1WLZ_6)v7kwfgt1-eSZ_hkpQM2m(Lf+F_1 zz%~fp(M(^H-e}E`Ml>X!`l2@&W5|Dtc_ElZQ@@Or?D8~c#meO1A^smO@c;0zaj@b4 zI&gDSg9N)=B7X!`Ezn5;*g^zQ8w`l^;$5KUOq6J7k7)yg0htkxh+J`*wBguKf58fp zqh$%RtW5waak#mGQKgN;Y1Ju>eaUhRfS#g2W{|p}i%?B81&gcMGY;Ndc?s4*VO$^p zpR9~UnIHriioE9KidH@WP`CxjWrET|(@n2(bkj7GDSyJw6<+VdPLBy_KV7(J7r?u~ zVBmA|j<@i(RMuzX7DAcaaq4d8r+(;DSmb|(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}4Se_fD?@0Z)fnnC~~008K3p~CTxWyr_YF2(krQ^tRX(DbS`3M$%Z~ zh9XsxvN!9v=s)xi`y~aX+}$D%O_MI*^FWb-+ZgSRlI<7UJLBLv`0y=N+=G0>n#r?_%NU_^^fhIj_boze?pT^q);&wsY?Y(^TBmn(;k0a^-{%QmN$ zc#dBi8`^B*Mr`tbn8w%n)R%q(tNJfl*X(?}{0EA0zy7!H>OUEe*7|=8EEdB)W~!RN zbHG$-j=$V5tN2>7k|*d7mrEfcO&mCm!o3zOLP-G`8KjKHa}M%1z6jvh+s0+wig*iT zT7qxV+<#W2OkB)aYjHfspTGZsuPG=4%^|S!TgX+Rg5N@8a&|tmj`95DIixuLp{0}7 zNSlD;IizUQ{F`QWv%7Si42}za_l9dt8SiV2-cP?IgU|K{Khog+$?>uL`P0}VdV?O$ z;W`?6C%p@cwsUqkM{teFFy3jWsyb|@Q}ynG6Mqe_9bX!5H-e|W@!Po2zl?oS6~;P# z_!#%ciNtqCpTU~e zGk>OpnjN$Ywq$X1aEM$vFJz&@upPVfg-qYOVLM(L%3>IY%cY;0 z;q^u-Wv5Nu_C7EA($8zrmnof!z6@2ITc--q|4nS-h@7&G$Cs}@_d?drzU3?ksdA=a mM|bwEkTajzoQMB2sjsod8f)CbUjYCB{|Wz5OIq>(6aWCZ@zjt2 diff --git a/charts/onechart/templates/deployment.yaml b/charts/onechart/templates/deployment.yaml index 6ca51e3..c457ad2 100644 --- a/charts/onechart/templates/deployment.yaml +++ b/charts/onechart/templates/deployment.yaml @@ -102,23 +102,7 @@ spec: {{- toYaml . | nindent 12 }} {{- end }} {{- end }} - {{- if or (or (.Values.volumes) (.Values.sealedFileSecrets)) .Values.fileSecrets }} - volumeMounts: &volumeMounts - {{- range .Values.volumes }} - - name: {{ .name }} - mountPath: {{ .path }} - {{- end }} - {{- range .Values.sealedFileSecrets }} - - name: {{ .name }} - mountPath: {{ .path }} - readOnly: true - {{- end }} - {{- range .Values.fileSecrets }} - - name: {{ .name }} - mountPath: {{ .path }} - readOnly: true - {{- end }} - {{- end }} + {{- include "common.volumeMountsRef.tpl" . | nindent 10 }} resources: {{- toYaml .Values.resources | nindent 12 }} {{- if .Values.sidecar }} @@ -138,24 +122,7 @@ spec: volumeMounts: *volumeMounts {{- end }} {{- end }} - {{- if or (or (.Values.volumes) (.Values.sealedFileSecrets)) .Values.fileSecrets }} - volumes: - {{- range .Values.volumes }} - - name: {{ .name }} - persistentVolumeClaim: - claimName: {{ printf "%s-%s" $.Release.Name .name }} - {{- end }} - {{- range .Values.sealedFileSecrets }} - - name: {{ .name }} - secret: - secretName: {{ printf "%s-%s" $.Release.Name .name }} - {{- end }} - {{- range .Values.fileSecrets }} - - name: {{ .name }} - secret: - secretName: {{ printf "%s-%s" $.Release.Name .name }} - {{- end }} - {{- end }} + {{- include "common.volumesRef.tpl" . | nindent 6 }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/charts/onechart/templates/pvc.yaml b/charts/onechart/templates/pvc.yaml index 38758f7..b462fad 100644 --- a/charts/onechart/templates/pvc.yaml +++ b/charts/onechart/templates/pvc.yaml @@ -1,16 +1 @@ -{{- range .Values.volumes }} -{{- $robustName := include "robustName" $.Release.Name }} ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: {{ printf "%s-%s" $robustName .name }} - namespace: {{ $.Release.Namespace }} -spec: - accessModes: - - {{ .accessMode | default "ReadWriteOnce" }} - storageClassName: {{ .storageClass | default "local-path" }} - resources: - requests: - storage: {{ .size | default "1Gi" }} -{{- end }} +{{- include "common.pvc.tpl" . -}} diff --git a/values-cron-job.yaml b/values-cron-job.yaml index 8fa4ce4..faf33bb 100644 --- a/values-cron-job.yaml +++ b/values-cron-job.yaml @@ -9,3 +9,9 @@ shell: "/bin/sh" vars: MY_VAR: "value" + +volumes: + - name: data + path: /data + size: 10Gi + storageClass: default diff --git a/values.yaml b/values.yaml index ab9c445..6240a18 100644 --- a/values.yaml +++ b/values.yaml @@ -15,3 +15,9 @@ gitSha: xyz vars: MY_VAR: "value" + +volumes: + - name: data + path: /data + size: 10Gi + storageClass: default From 4352af0abcdf2fa7458720885653019e8b37bd60 Mon Sep 17 00:00:00 2001 From: Laszlo Fogas Date: Thu, 5 Aug 2021 11:48:05 +0200 Subject: [PATCH 4/6] Moved var and secret support to common --- charts/common/templates/_envFromRef.yaml | 21 ++++++++++++++++++ .../templates/_fileSecret.yaml} | 2 ++ .../templates/_sealedFileSecret.yaml} | 2 ++ .../templates/_sealedSecret.yaml} | 6 +++-- charts/cron-job/charts/common-0.1.0.tgz | Bin 1357 -> 1805 bytes charts/cron-job/templates/cronJob.yaml | 14 +++--------- charts/cron-job/templates/fileSecret.yaml | 1 + .../cron-job/templates/sealedFileSecret.yaml | 1 + charts/cron-job/templates/sealedSecret.yaml | 1 + .../tests/cronjob_configmap_test.yaml | 2 +- .../cron-job/tests/cronjob_secret_test.yaml | 6 ++--- charts/onechart/charts/common-0.1.0.tgz | Bin 1357 -> 1806 bytes charts/onechart/templates/deployment.yaml | 20 +---------------- charts/onechart/templates/fileSecret.yaml | 1 + .../onechart/templates/sealedFileSecret.yaml | 1 + charts/onechart/templates/sealedSecret.yaml | 1 + .../deployment_sealed_file_secrets2_test.yaml | 2 +- charts/onechart/tests/sealed_secret_test.yaml | 2 +- 18 files changed, 45 insertions(+), 38 deletions(-) create mode 100644 charts/common/templates/_envFromRef.yaml rename charts/{onechart/templates/file-secret.yaml => common/templates/_fileSecret.yaml} (84%) rename charts/{onechart/templates/sealed-file-secret.yaml => common/templates/_sealedFileSecret.yaml} (91%) rename charts/{onechart/templates/sealed-secret.yaml => common/templates/_sealedSecret.yaml} (84%) create mode 100644 charts/cron-job/templates/fileSecret.yaml create mode 100644 charts/cron-job/templates/sealedFileSecret.yaml create mode 100644 charts/cron-job/templates/sealedSecret.yaml create mode 100644 charts/onechart/templates/fileSecret.yaml create mode 100644 charts/onechart/templates/sealedFileSecret.yaml create mode 100644 charts/onechart/templates/sealedSecret.yaml diff --git a/charts/common/templates/_envFromRef.yaml b/charts/common/templates/_envFromRef.yaml new file mode 100644 index 0000000..a640001 --- /dev/null +++ b/charts/common/templates/_envFromRef.yaml @@ -0,0 +1,21 @@ +{{- define "common.envFromRef.tpl" -}} +{{- if or (or (or (.Values.vars) (.Values.secretEnabled)) .Values.sealedSecrets) .Values.secretName }} +envFrom: &envFrom +{{- if .Values.vars }} + - configMapRef: + name: {{ template "common.robustName" .Release.Name }} +{{- end }} +{{- if .Values.secretEnabled }} + - secretRef: + name: {{ include "common.robustName" $.Release.Name }} +{{- end }} +{{- if .Values.secretName }} + - secretRef: + name: {{ .Values.secretName }} +{{- end }} +{{- if .Values.sealedSecrets }} + - secretRef: + name: {{ template "common.robustName" .Release.Name }} +{{- end }} +{{- end }} +{{- end }} diff --git a/charts/onechart/templates/file-secret.yaml b/charts/common/templates/_fileSecret.yaml similarity index 84% rename from charts/onechart/templates/file-secret.yaml rename to charts/common/templates/_fileSecret.yaml index 2bbc0e3..b53db34 100644 --- a/charts/onechart/templates/file-secret.yaml +++ b/charts/common/templates/_fileSecret.yaml @@ -1,3 +1,4 @@ +{{- define "common.fileSecret.tpl" -}} {{- range .Values.fileSecrets }} --- kind: Secret @@ -11,3 +12,4 @@ data: {{ $key }}: {{ $val | b64enc }} {{- end }} {{- end }} +{{- end -}} diff --git a/charts/onechart/templates/sealed-file-secret.yaml b/charts/common/templates/_sealedFileSecret.yaml similarity index 91% rename from charts/onechart/templates/sealed-file-secret.yaml rename to charts/common/templates/_sealedFileSecret.yaml index 539d304..7a3a356 100644 --- a/charts/onechart/templates/sealed-file-secret.yaml +++ b/charts/common/templates/_sealedFileSecret.yaml @@ -1,3 +1,4 @@ +{{- define "common.sealedFileSecret.tpl" -}} {{- range .Values.sealedFileSecrets }} {{- $robustName := include "robustName" $.Release.Name }} --- @@ -22,3 +23,4 @@ spec: name: {{ printf "%s-%s" $.Release.Name .name }} namespace: {{ $.Release.Namespace }} {{- end }} +{{- end -}} diff --git a/charts/onechart/templates/sealed-secret.yaml b/charts/common/templates/_sealedSecret.yaml similarity index 84% rename from charts/onechart/templates/sealed-secret.yaml rename to charts/common/templates/_sealedSecret.yaml index c731f46..cea7611 100644 --- a/charts/onechart/templates/sealed-secret.yaml +++ b/charts/common/templates/_sealedSecret.yaml @@ -1,4 +1,5 @@ -{{- if .Values.sealedSecrets }} +{{- define "common.sealedSecret.tpl" -}} + {{- if .Values.sealedSecrets }} apiVersion: bitnami.com/v1alpha1 kind: SealedSecret metadata: @@ -17,4 +18,5 @@ spec: metadata: name: {{ template "robustName" .Release.Name }} namespace: {{ .Release.Namespace }} -{{- end }} \ No newline at end of file +{{- end }} +{{- end -}} diff --git a/charts/cron-job/charts/common-0.1.0.tgz b/charts/cron-job/charts/common-0.1.0.tgz index 066f6843a1a5a1cdcf3342831a8ddeb96a845950..7a1aa03202204b9dedd785d5bd53a6c9b0cb7e0c 100644 GIT binary patch delta 1766 zcmV$-lwpZ@QKq*;n=9 zz7V4^J4dCN6hoLDIy8>ww;u6);yNMfK(W}QZLi?Z$Rh~sc7d@}@YiI7N}xgQ2pZuK zvJK^!n;3_{*+@}!``V#Y8xS zlXUnS8aojh8d5`t4nRf@x3^I2w7EMaM~OCXX@nghr^u0NB=**N$Oh_|2HEJP4rz1N zi_;NuZ5;um!HR$zJDE_#b}2qDkcbfS9o&(do#*m z__FrU)(vElVA(1AH#!iGHeBjb9=X1aGlGX8#V)ng~(J78MMF1=C?|Hsg z#lL^pZ}GnkYrubL15^n>D)_eeSH{JQ#jVCbq4`eG5y$Yw3s|&Mj^SDQS6yzl4F%kD z*F*R^zkhm&c>uZ)6hw21;|%$~nr13EEje6zoWgU~*yMK3I}Kj<)^@vK!N+_yk9lnF z(wkU4{U@zt{qngtd}~Wq=l?O|m~D%XkAstvPz@LfzlB-ktrW5t9SL+2~q{eMc=*pi3`6yaX8BwV5Cbea8{_1wts zqX@n@LAR#W@jpc#qtf=>Z^*~${O_=ee|O-w_}_-z-uCuk#-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wcoP+KL7y#|NL_0 IMgTYf023RJeEE|L4$TUXJAYYkZ`-yL&TD>(`zh(KO%~IVlh~Mnz9`cD!`3!Ph7{Pc1+;XQ z*ifWOQg+kC!@k45;XcVg%Kz;oTj#nR;0LHIUXQ$!bkD<+601B{vVNQ~ZRs`3#n$Q( zhGEz|JoLX|7|#EOQS)dkI*h_btI=vi2U}s(IBYhyAp8iqEPtRhmg%kVU&orixc>-P z!Ou|}u4Ef}4Z@0IJd9}6q#;Sr#F`h@+n&LGJjDN_1^yo$HI6p? zUk7e(YLH-;OMir*ss%bJ09%LvYJ&lBUc3wRoQV<*?J;d&Fd#GH5s@n{lQtat=`UD8 zaK`0F-z|2%f02+-d zb&Q_G`+vZscQ9oqQ90w%4f-eqx#+{6zyAS0Fv}$fv=+75hlHoxntdo`g4)DNBRsx* z43u2F_U=pw=#&;N`ap?KbBUNut4pP1pfSaFr&tIU<1-;3`1#kc_T{tMPptO-^5TO2 z@`clgpccR_=*kU(%V1~`s*f6O!Rk`R&^+*`JbyncyIuZn=;I708b^j%A^6l!d=`uR zFM9EcUj!cFf2$eJ@&EAPu(jd;I5MV7qQ+~O-4V^BpiR%w>Htc`g&N|a7pr&kavW};Rw zn+>OrbaNP871GEO{lxb=!3acz@LHM~}C7I`{nV z;{S@M@9_Ztqo}d){@)5W{9g<1$wD0#UzLUb_GQQ( zHT{C@(GI&Jd(`IcTxp(?z2C?-oHNZ;Y2dr(Ul~FRt=?d43FQg0dgZRw8yrG=CRPd7 ZH#)e%1{-|N_$vSa|Nq>89C-jD003S2ju-#{ diff --git a/charts/cron-job/templates/cronJob.yaml b/charts/cron-job/templates/cronJob.yaml index 0528767..19174b6 100644 --- a/charts/cron-job/templates/cronJob.yaml +++ b/charts/cron-job/templates/cronJob.yaml @@ -7,8 +7,8 @@ metadata: {{- include "helm-chart.labels" . | nindent 4 }} spec: schedule: {{ .Values.schedule | quote }} - {{ with .Values.constraints }} - {{ toYaml . | nindent 2 }} + {{- with .Values.constraints }} + {{- toYaml . | nindent 2 }} {{- end }} jobTemplate: spec: @@ -29,15 +29,7 @@ spec: - {{ .Values.shell }} - -c - {{ .Values.command | quote }} - envFrom: - {{- if .Values.vars }} - - configMapRef: - name: {{ .Release.Name }} - {{- end }} - {{- if .Values.secret.enabled }} - - secretRef: - name: {{ .Release.Name }} - {{- end }} + {{- include "common.envFromRef.tpl" . | nindent 14 }} {{- include "common.volumeMountsRef.tpl" . | nindent 14 }} resources: {{- toYaml .Values.resources | nindent 16 }} diff --git a/charts/cron-job/templates/fileSecret.yaml b/charts/cron-job/templates/fileSecret.yaml new file mode 100644 index 0000000..1d061dc --- /dev/null +++ b/charts/cron-job/templates/fileSecret.yaml @@ -0,0 +1 @@ +{{- include "common.fileSecret.tpl" . -}} diff --git a/charts/cron-job/templates/sealedFileSecret.yaml b/charts/cron-job/templates/sealedFileSecret.yaml new file mode 100644 index 0000000..2e85b27 --- /dev/null +++ b/charts/cron-job/templates/sealedFileSecret.yaml @@ -0,0 +1 @@ +{{- include "common.sealedFileSecret.tpl" . -}} diff --git a/charts/cron-job/templates/sealedSecret.yaml b/charts/cron-job/templates/sealedSecret.yaml new file mode 100644 index 0000000..469a4c7 --- /dev/null +++ b/charts/cron-job/templates/sealedSecret.yaml @@ -0,0 +1 @@ +{{- include "common.sealedSecret.tpl" . -}} diff --git a/charts/cron-job/tests/cronjob_configmap_test.yaml b/charts/cron-job/tests/cronjob_configmap_test.yaml index 6a23403..7f41b51 100644 --- a/charts/cron-job/tests/cronjob_configmap_test.yaml +++ b/charts/cron-job/tests/cronjob_configmap_test.yaml @@ -13,7 +13,7 @@ tests: path: spec.jobTemplate.spec.template.spec.containers[0].envFrom content: configMapRef: - name: RELEASE-NAME + name: release-name - it: Should not reference configmap if vars are not set asserts: - isNull: diff --git a/charts/cron-job/tests/cronjob_secret_test.yaml b/charts/cron-job/tests/cronjob_secret_test.yaml index 4ce2f30..7727fe6 100644 --- a/charts/cron-job/tests/cronjob_secret_test.yaml +++ b/charts/cron-job/tests/cronjob_secret_test.yaml @@ -5,16 +5,16 @@ templates: tests: - it: Should reference secret if secret is enabled set: - secret.enabled: true + secretEnabled: true asserts: - contains: path: spec.jobTemplate.spec.template.spec.containers[0].envFrom content: secretRef: - name: RELEASE-NAME + name: release-name - it: Should not reference secret if secret is disabled set: - secret.enabled: false + secretEnabled: false asserts: - isNull: path: spec.jobTemplate.spec.template.spec.containers[0].envFrom diff --git a/charts/onechart/charts/common-0.1.0.tgz b/charts/onechart/charts/common-0.1.0.tgz index 2a327022c31917ed9e2baa0c768b73290f0e9abb..0e239d5ae2b05129c5df74b59262702b8c354bba 100644 GIT binary patch delta 1767 zcmVV?u~aP4hN>O^lYNyR z?h7#*volnhNil+X&!cg?xb2eekoaDRI#4V&uI&~48F>VO-7YYZ3jUgmQ3*7tJwYQJ zLAs$la~X+-0V(ZM?W4=VT{ z40?wR{yTt1Q*qc)h zqnDM3whmkuxVv*PxsJE+A(6&KV<$op-g9Y}^SNJo!K(O2G5=o4=maO5B7imc?{qRd$QXl3qItte#}F2 z7v9AB=|5>DtC!Ec;Tv1AD*sOy$8>XSiU0k9KdkV7zsdi$Vm16<*Z?d1pNgZLMV7rB zhqT-6O#h{gWo?+|gYRPcA;EfK7%L{s1X^F|_J3Ep!j?qbqX_rvCE*%Pr;F@Yujj_Y zK8oOr6Le3sD*k84V^rF{`wjV6pa1pB`1c3>2LIczo14x)%vm%7jRq{JEmB`bc3FZM zj$prYcjtMwn|G|x>VW0e$U2N1F;Gx`7$5u(z8R0!W(d;`Qg|H*ZyoWnRVaDD~E zb79tySy8N{LfuiAg7?T;7d=j5M%v^ip{-GW_ zA2j&ihSfmEZh!~A_~()*5$b$b?-l4^^zw-bkW~$}MWpw(MH>|6%(*+}ltquz4TX4~ zDjIZ*ft{NM0c!n5hM1L<+AhypHp8u5G@5V&trMi-Pl_3QCjxAx-n5a5PHog$zkgli zX~ov!3|t13w_|E%+3=hOY5mx&AvmYQF!sV>S4%Y=8&Ipxk#YEj*16#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XDFdla*=SELc!uImZG6#8-C2V0aF%*($;{OjtHoN<}% zgGRwD?;-duWnyPCA=@A^WtJ-mPk##kfdmuibDP2cb}6_v29)$OT}n>hL2!wb(C25D zXI5z>+i>hl7S4~)AmQ2&nsQtB$0~h7JMVSfA4i5Pt-Hf$XnL|fS*XL}tFrLlz6{x; zreBaf+F@5@kJ{XwE6r1~_Z!)UbEdf}4Se_fD?@0Z)fnnC~~000{Bp_>2z diff --git a/charts/onechart/templates/deployment.yaml b/charts/onechart/templates/deployment.yaml index c457ad2..b12912b 100644 --- a/charts/onechart/templates/deployment.yaml +++ b/charts/onechart/templates/deployment.yaml @@ -61,25 +61,7 @@ spec: - -c - {{ .Values.command | quote }} {{- end }} - {{- if or (or (or (.Values.vars) (.Values.secretEnabled)) .Values.sealedSecrets) .Values.secretName }} - envFrom: &envFrom - {{- if .Values.vars }} - - configMapRef: - name: {{ template "robustName" .Release.Name }} - {{- end }} - {{- if .Values.secretEnabled }} - - secretRef: - name: {{ include "robustName" $.Release.Name }} - {{- end }} - {{- if .Values.secretName }} - - secretRef: - name: {{ .Values.secretName }} - {{- end }} - {{- if .Values.sealedSecrets }} - - secretRef: - name: {{ template "robustName" .Release.Name }} - {{- end }} - {{- end }} + {{- include "common.envFromRef.tpl" . | nindent 10 }} ports: {{- if not .Values.ports }} - name: http diff --git a/charts/onechart/templates/fileSecret.yaml b/charts/onechart/templates/fileSecret.yaml new file mode 100644 index 0000000..1d061dc --- /dev/null +++ b/charts/onechart/templates/fileSecret.yaml @@ -0,0 +1 @@ +{{- include "common.fileSecret.tpl" . -}} diff --git a/charts/onechart/templates/sealedFileSecret.yaml b/charts/onechart/templates/sealedFileSecret.yaml new file mode 100644 index 0000000..2e85b27 --- /dev/null +++ b/charts/onechart/templates/sealedFileSecret.yaml @@ -0,0 +1 @@ +{{- include "common.sealedFileSecret.tpl" . -}} diff --git a/charts/onechart/templates/sealedSecret.yaml b/charts/onechart/templates/sealedSecret.yaml new file mode 100644 index 0000000..469a4c7 --- /dev/null +++ b/charts/onechart/templates/sealedSecret.yaml @@ -0,0 +1 @@ +{{- include "common.sealedSecret.tpl" . -}} diff --git a/charts/onechart/tests/deployment_sealed_file_secrets2_test.yaml b/charts/onechart/tests/deployment_sealed_file_secrets2_test.yaml index 4382b8e..2a7c90f 100644 --- a/charts/onechart/tests/deployment_sealed_file_secrets2_test.yaml +++ b/charts/onechart/tests/deployment_sealed_file_secrets2_test.yaml @@ -1,6 +1,6 @@ suite: test deployment templates: - - sealed-file-secret.yaml + - sealedFileSecret.yaml tests: - it: Should generate a sealed secret with the file set: &values diff --git a/charts/onechart/tests/sealed_secret_test.yaml b/charts/onechart/tests/sealed_secret_test.yaml index fdc5429..35bf9e2 100644 --- a/charts/onechart/tests/sealed_secret_test.yaml +++ b/charts/onechart/tests/sealed_secret_test.yaml @@ -1,6 +1,6 @@ suite: test deployment templates: - - sealed-secret.yaml + - sealedSecret.yaml tests: - it: Should put sealed secrets in SealedSecret set: From 922111d2de735d3a32b9c1f156da5e2159955026 Mon Sep 17 00:00:00 2001 From: Laszlo Fogas Date: Thu, 5 Aug 2021 11:52:28 +0200 Subject: [PATCH 5/6] Preparing for rc release --- charts/common/Chart.yaml | 6 ------ charts/cron-job/Chart.yaml | 2 +- charts/onechart/Chart.yaml | 2 +- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/charts/common/Chart.yaml b/charts/common/Chart.yaml index 73cecbd..eb40fb1 100644 --- a/charts/common/Chart.yaml +++ b/charts/common/Chart.yaml @@ -16,9 +16,3 @@ type: library # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) version: 0.1.0 - -# This is the version number of the application being deployed. This version number should be -# incremented each time you make changes to the application. Versions are not expected to -# follow Semantic Versioning. They should reflect the version the application is using. -# It is recommended to use it with quotes. -appVersion: "1.16.0" diff --git a/charts/cron-job/Chart.yaml b/charts/cron-job/Chart.yaml index 8b1b3c6..8191f7a 100644 --- a/charts/cron-job/Chart.yaml +++ b/charts/cron-job/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.2 +version: 0.2.0 dependencies: - name: common diff --git a/charts/onechart/Chart.yaml b/charts/onechart/Chart.yaml index 7883011..f45feec 100644 --- a/charts/onechart/Chart.yaml +++ b/charts/onechart/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.27.0 +version: 0.27.0-rc1 dependencies: - name: common From 5910080e1711c8ba7ce3f4192b68f10ab0b26b0d Mon Sep 17 00:00:00 2001 From: Laszlo Fogas Date: Thu, 5 Aug 2021 11:57:18 +0200 Subject: [PATCH 6/6] Fixing release script to not fail on dependency charts --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b0b4c70..29ddc0b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,7 +26,7 @@ jobs: - name: Extract chart version id: chart_version run: | - CHART_VERSION=$(cat charts/onechart/Chart.yaml | grep version:) + CHART_VERSION=$(cat charts/onechart/Chart.yaml | grep ^version:) CHART_VERSION=${CHART_VERSION#version: } echo $CHART_VERSION echo ::set-output name=chart_version::$CHART_VERSION