From 7bf5e13472d911a7fed9857c5f1a37f059755443 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=E1=B4=87=CA=80=C9=B4=E1=B4=85=20S=E1=B4=84=CA=9C?= =?UTF-8?q?=E1=B4=8F=CA=80=C9=A2=E1=B4=87=CA=80s?= Date: Sat, 4 Feb 2023 19:58:40 +0100 Subject: [PATCH] feat(common): Release version 1.3.1 --- charts/library/common/Chart.yaml | 9 +- charts/library/common/README.md | 4 +- .../common/templates/lib/chart/_notes.tpl | 4 +- .../templates/lib/container/_probes.tpl | 2 +- charts/other/app-template/Chart.yaml | 6 +- .../tests/configmap/metadata_test.yaml | 6 +- .../tests/container/probes_test.yaml | 155 ++++++++++++++++++ .../controller/metadata_cronjob_test.yaml | 6 +- .../controller/metadata_daemonset_test.yaml | 6 +- .../controller/metadata_deployment_test.yaml | 6 +- .../controller/metadata_statefulset_test.yaml | 6 +- .../tests/ingress/metadata_test.yaml | 6 +- .../app-template/tests/pvc/metadata_test.yaml | 8 +- .../tests/route/metadata_test.yaml | 6 +- .../tests/secret/metadata_test.yaml | 6 +- .../tests/service/metadata_test.yaml | 6 +- .../serviceMonitor/servicemonitor_test.yaml | 2 +- 17 files changed, 197 insertions(+), 47 deletions(-) diff --git a/charts/library/common/Chart.yaml b/charts/library/common/Chart.yaml index fc145efb..2a3e8384 100644 --- a/charts/library/common/Chart.yaml +++ b/charts/library/common/Chart.yaml @@ -3,7 +3,7 @@ apiVersion: v2 name: common description: Function library for Helm charts type: library -version: 1.3.0 +version: 1.3.1 kubeVersion: ">=1.22.0-0" keywords: - common @@ -15,9 +15,4 @@ maintainers: annotations: artifacthub.io/changes: |- - kind: fixed - description: Don't render ports/probes when not required - links: - - name: GitHub Issue - url: https://github.com/bjw-s/helm-charts/issues/111 - - kind: changed - description: Renamed `additionalContainers` to `sidecars`. The former will however still continue to work for the time being. + description: Probes were rendered incorrectly when primary service port was a string. diff --git a/charts/library/common/README.md b/charts/library/common/README.md index 03130902..2b4b5e15 100644 --- a/charts/library/common/README.md +++ b/charts/library/common/README.md @@ -1,6 +1,6 @@ # common -![Version: 1.3.0](https://img.shields.io/badge/Version-1.3.0-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square) +![Version: 1.3.1](https://img.shields.io/badge/Version-1.3.1-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square) Function library for Helm charts @@ -29,7 +29,7 @@ Include this chart as a dependency in your `Chart.yaml` e.g. # Chart.yaml dependencies: - name: common - version: 1.3.0 + version: 1.3.1 repository: https://bjw-s.github.io/helm-charts/ ``` diff --git a/charts/library/common/templates/lib/chart/_notes.tpl b/charts/library/common/templates/lib/chart/_notes.tpl index 5bfa54d6..ccd2d2c7 100644 --- a/charts/library/common/templates/lib/chart/_notes.tpl +++ b/charts/library/common/templates/lib/chart/_notes.tpl @@ -46,11 +46,11 @@ Default NOTES.txt content. NOTE: It may take a few minutes for the LoadBalancer IP to be available. You can watch the status of by running 'kubectl get svc -w {{ include "bjw-s.common.lib.chart.names.fullname" . }}' export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "bjw-s.common.lib.chart.names.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') - echo {{ $prefix }}://$SERVICE_IP:{{ $primaryPort.port }} + echo {{ $prefix }}://$SERVICE_IP:{{ $primaryPort.port | toString | atoi }} {{- else if contains "ClusterIP" $primaryService.type }} export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "bjw-s.common.lib.chart.names.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") echo "Visit {{ $prefix }}://127.0.0.1:8080 to use your application" - kubectl port-forward $POD_NAME 8080:{{ $primaryPort.port }} + kubectl port-forward $POD_NAME 8080:{{ $primaryPort.port | toString | atoi }} {{- end }} {{- end }} {{- end -}} diff --git a/charts/library/common/templates/lib/container/_probes.tpl b/charts/library/common/templates/lib/container/_probes.tpl index 60a8e6d1..5e5d9c6a 100644 --- a/charts/library/common/templates/lib/container/_probes.tpl +++ b/charts/library/common/templates/lib/container/_probes.tpl @@ -51,7 +51,7 @@ Probes selection logic. {{- else if $primaryPort.targetPort }} {{- $_ := set (index $probeDefinition $probeHeader) "port" $primaryPort.targetPort -}} {{- else }} - {{- $_ := set (index $probeDefinition $probeHeader) "port" $primaryPort.port -}} + {{- $_ := set (index $probeDefinition $probeHeader) "port" ($primaryPort.port | toString | atoi ) -}} {{- end }} {{- $probeOutput = $probeDefinition | toYaml | trim -}} diff --git a/charts/other/app-template/Chart.yaml b/charts/other/app-template/Chart.yaml index adcbb4f6..df726ee1 100644 --- a/charts/other/app-template/Chart.yaml +++ b/charts/other/app-template/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 description: A common powered chart template. This can be useful for small projects that don't have their own chart. name: app-template -version: 1.3.0 +version: 1.3.1 kubeVersion: ">=1.22.0-0" maintainers: - name: bjw-s @@ -10,12 +10,12 @@ maintainers: dependencies: - name: common repository: https://bjw-s.github.io/helm-charts - version: 1.3.0 + version: 1.3.1 annotations: artifacthub.io/changes: |- - kind: changed description: | - Updated library version to 1.3.0. + Updated library version to 1.3.1. links: - name: Common library chart definition url: https://github.com/bjw-s/helm-charts/blob/main/charts/library/common/Chart.yaml diff --git a/charts/other/app-template/tests/configmap/metadata_test.yaml b/charts/other/app-template/tests/configmap/metadata_test.yaml index 1ca09278..b9fcf0a8 100644 --- a/charts/other/app-template/tests/configmap/metadata_test.yaml +++ b/charts/other/app-template/tests/configmap/metadata_test.yaml @@ -23,7 +23,7 @@ tests: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: RELEASE-NAME - helm.sh/chart: app-template-1.3.0 + helm.sh/chart: app-template-1.3.1 - it: custom metadata should pass set: @@ -52,7 +52,7 @@ tests: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: RELEASE-NAME - helm.sh/chart: app-template-1.3.0 + helm.sh/chart: app-template-1.3.1 test_label: test - it: custom metadata with global metadata should pass @@ -89,5 +89,5 @@ tests: app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: RELEASE-NAME global_label: test - helm.sh/chart: app-template-1.3.0 + helm.sh/chart: app-template-1.3.1 test_label: test diff --git a/charts/other/app-template/tests/container/probes_test.yaml b/charts/other/app-template/tests/container/probes_test.yaml index 661f34ec..a24f509d 100644 --- a/charts/other/app-template/tests/container/probes_test.yaml +++ b/charts/other/app-template/tests/container/probes_test.yaml @@ -92,6 +92,49 @@ tests: port: *port timeoutSeconds: 1 + - it: default with string Service port should pass + set: + service: + main: + ports: + http: + enabled: true + port: "80" + asserts: + - documentIndex: 0 + isKind: + of: Deployment + - documentIndex: 0 + equal: + path: spec.template.spec.containers[0].livenessProbe + value: + failureThreshold: 3 + initialDelaySeconds: 0 + periodSeconds: 10 + tcpSocket: + port: 80 + timeoutSeconds: 1 + - documentIndex: 0 + equal: + path: spec.template.spec.containers[0].readinessProbe + value: + failureThreshold: 3 + initialDelaySeconds: 0 + periodSeconds: 10 + tcpSocket: + port: 80 + timeoutSeconds: 1 + - documentIndex: 0 + equal: + path: spec.template.spec.containers[0].startupProbe + value: + failureThreshold: 30 + initialDelaySeconds: 0 + periodSeconds: 5 + tcpSocket: + port: 80 + timeoutSeconds: 1 + - it: disabled service should pass set: service: @@ -311,3 +354,115 @@ tests: periodSeconds: 10 timeoutSeconds: 1 failureThreshold: 3 + + - it: User-defined liveness probe port should pass + set: + service: + main: + ports: + http: + port: &port 80 + + probes: + liveness: + enabled: true + port: &port http + + asserts: + - documentIndex: 0 + isKind: + of: Deployment + - documentIndex: 0 + equal: + path: spec.template.spec.containers[0].livenessProbe + value: + failureThreshold: 3 + initialDelaySeconds: 0 + periodSeconds: 10 + tcpSocket: + port: *port + timeoutSeconds: 1 + + - it: User-defined liveness probe port should pass + set: + service: + main: + ports: + http: + port: &port 80 + + probes: + liveness: + enabled: true + port: &port http + + asserts: + - documentIndex: 0 + isKind: + of: Deployment + - documentIndex: 0 + equal: + path: spec.template.spec.containers[0].livenessProbe + value: + failureThreshold: 3 + initialDelaySeconds: 0 + periodSeconds: 10 + tcpSocket: + port: *port + timeoutSeconds: 1 + + - it: User-defined readiness probe port should pass + set: + service: + main: + ports: + http: + port: &port 80 + + probes: + readiness: + enabled: true + port: &port http + + asserts: + - documentIndex: 0 + isKind: + of: Deployment + - documentIndex: 0 + equal: + path: spec.template.spec.containers[0].readinessProbe + value: + failureThreshold: 3 + initialDelaySeconds: 0 + periodSeconds: 10 + tcpSocket: + port: *port + timeoutSeconds: 1 + + - it: User-defined startup probe port should pass + set: + service: + main: + ports: + http: + port: &port 80 + + probes: + startup: + enabled: true + port: &port http + + asserts: + - documentIndex: 0 + isKind: + of: Deployment + - documentIndex: 0 + equal: + path: spec.template.spec.containers[0].startupProbe + value: + failureThreshold: 30 + initialDelaySeconds: 0 + periodSeconds: 5 + tcpSocket: + port: *port + timeoutSeconds: 1 diff --git a/charts/other/app-template/tests/controller/metadata_cronjob_test.yaml b/charts/other/app-template/tests/controller/metadata_cronjob_test.yaml index 023e58d9..142ee6c0 100644 --- a/charts/other/app-template/tests/controller/metadata_cronjob_test.yaml +++ b/charts/other/app-template/tests/controller/metadata_cronjob_test.yaml @@ -19,7 +19,7 @@ tests: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: RELEASE-NAME - helm.sh/chart: app-template-1.3.0 + helm.sh/chart: app-template-1.3.1 - it: custom metadata should pass set: @@ -45,7 +45,7 @@ tests: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: RELEASE-NAME - helm.sh/chart: app-template-1.3.0 + helm.sh/chart: app-template-1.3.1 test_label: test - it: custom metadata with global metadata should pass @@ -79,5 +79,5 @@ tests: app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: RELEASE-NAME global_label: test - helm.sh/chart: app-template-1.3.0 + helm.sh/chart: app-template-1.3.1 test_label: test diff --git a/charts/other/app-template/tests/controller/metadata_daemonset_test.yaml b/charts/other/app-template/tests/controller/metadata_daemonset_test.yaml index eace4945..5d1ba4d7 100644 --- a/charts/other/app-template/tests/controller/metadata_daemonset_test.yaml +++ b/charts/other/app-template/tests/controller/metadata_daemonset_test.yaml @@ -19,7 +19,7 @@ tests: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: RELEASE-NAME - helm.sh/chart: app-template-1.3.0 + helm.sh/chart: app-template-1.3.1 - it: custom metadata should pass set: @@ -45,7 +45,7 @@ tests: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: RELEASE-NAME - helm.sh/chart: app-template-1.3.0 + helm.sh/chart: app-template-1.3.1 test_label: test - it: custom metadata with global metadata should pass @@ -79,5 +79,5 @@ tests: app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: RELEASE-NAME global_label: test - helm.sh/chart: app-template-1.3.0 + helm.sh/chart: app-template-1.3.1 test_label: test diff --git a/charts/other/app-template/tests/controller/metadata_deployment_test.yaml b/charts/other/app-template/tests/controller/metadata_deployment_test.yaml index 46849525..661b881c 100644 --- a/charts/other/app-template/tests/controller/metadata_deployment_test.yaml +++ b/charts/other/app-template/tests/controller/metadata_deployment_test.yaml @@ -19,7 +19,7 @@ tests: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: RELEASE-NAME - helm.sh/chart: app-template-1.3.0 + helm.sh/chart: app-template-1.3.1 - it: custom metadata should pass set: @@ -45,7 +45,7 @@ tests: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: RELEASE-NAME - helm.sh/chart: app-template-1.3.0 + helm.sh/chart: app-template-1.3.1 test_label: test - it: custom metadata with global metadata should pass @@ -79,5 +79,5 @@ tests: app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: RELEASE-NAME global_label: test - helm.sh/chart: app-template-1.3.0 + helm.sh/chart: app-template-1.3.1 test_label: test diff --git a/charts/other/app-template/tests/controller/metadata_statefulset_test.yaml b/charts/other/app-template/tests/controller/metadata_statefulset_test.yaml index 5de6857c..f0662c04 100644 --- a/charts/other/app-template/tests/controller/metadata_statefulset_test.yaml +++ b/charts/other/app-template/tests/controller/metadata_statefulset_test.yaml @@ -19,7 +19,7 @@ tests: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: RELEASE-NAME - helm.sh/chart: app-template-1.3.0 + helm.sh/chart: app-template-1.3.1 - it: custom metadata should pass set: @@ -45,7 +45,7 @@ tests: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: RELEASE-NAME - helm.sh/chart: app-template-1.3.0 + helm.sh/chart: app-template-1.3.1 test_label: test - it: custom metadata with global metadata should pass @@ -79,5 +79,5 @@ tests: app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: RELEASE-NAME global_label: test - helm.sh/chart: app-template-1.3.0 + helm.sh/chart: app-template-1.3.1 test_label: test diff --git a/charts/other/app-template/tests/ingress/metadata_test.yaml b/charts/other/app-template/tests/ingress/metadata_test.yaml index cf6c2a04..09adabe3 100644 --- a/charts/other/app-template/tests/ingress/metadata_test.yaml +++ b/charts/other/app-template/tests/ingress/metadata_test.yaml @@ -19,7 +19,7 @@ tests: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: RELEASE-NAME - helm.sh/chart: app-template-1.3.0 + helm.sh/chart: app-template-1.3.1 - it: custom metadata should pass set: @@ -45,7 +45,7 @@ tests: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: RELEASE-NAME - helm.sh/chart: app-template-1.3.0 + helm.sh/chart: app-template-1.3.1 test_label: test - it: custom metadata with global metadata should pass @@ -79,5 +79,5 @@ tests: app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: RELEASE-NAME global_label: test - helm.sh/chart: app-template-1.3.0 + helm.sh/chart: app-template-1.3.1 test_label: test diff --git a/charts/other/app-template/tests/pvc/metadata_test.yaml b/charts/other/app-template/tests/pvc/metadata_test.yaml index 1bf1a365..7c5439e0 100644 --- a/charts/other/app-template/tests/pvc/metadata_test.yaml +++ b/charts/other/app-template/tests/pvc/metadata_test.yaml @@ -19,7 +19,7 @@ tests: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: RELEASE-NAME - helm.sh/chart: app-template-1.3.0 + helm.sh/chart: app-template-1.3.1 - it: retain enabled should pass set: @@ -42,7 +42,7 @@ tests: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: RELEASE-NAME - helm.sh/chart: app-template-1.3.0 + helm.sh/chart: app-template-1.3.1 - it: custom metadata should pass set: @@ -68,7 +68,7 @@ tests: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: RELEASE-NAME - helm.sh/chart: app-template-1.3.0 + helm.sh/chart: app-template-1.3.1 test_label: test - it: custom metadata with global metadata should pass @@ -102,5 +102,5 @@ tests: app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: RELEASE-NAME global_label: test - helm.sh/chart: app-template-1.3.0 + helm.sh/chart: app-template-1.3.1 test_label: test diff --git a/charts/other/app-template/tests/route/metadata_test.yaml b/charts/other/app-template/tests/route/metadata_test.yaml index 233ee377..f6166032 100644 --- a/charts/other/app-template/tests/route/metadata_test.yaml +++ b/charts/other/app-template/tests/route/metadata_test.yaml @@ -23,7 +23,7 @@ tests: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: RELEASE-NAME - helm.sh/chart: app-template-1.3.0 + helm.sh/chart: app-template-1.3.1 - it: custom metadata should pass set: @@ -52,7 +52,7 @@ tests: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: RELEASE-NAME - helm.sh/chart: app-template-1.3.0 + helm.sh/chart: app-template-1.3.1 test_label: test - it: custom metadata with global metadata should pass @@ -89,5 +89,5 @@ tests: app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: RELEASE-NAME global_label: test - helm.sh/chart: app-template-1.3.0 + helm.sh/chart: app-template-1.3.1 test_label: test diff --git a/charts/other/app-template/tests/secret/metadata_test.yaml b/charts/other/app-template/tests/secret/metadata_test.yaml index e3533f44..589bd3a8 100644 --- a/charts/other/app-template/tests/secret/metadata_test.yaml +++ b/charts/other/app-template/tests/secret/metadata_test.yaml @@ -23,7 +23,7 @@ tests: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: RELEASE-NAME - helm.sh/chart: app-template-1.3.0 + helm.sh/chart: app-template-1.3.1 - it: custom metadata should pass set: @@ -52,7 +52,7 @@ tests: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: RELEASE-NAME - helm.sh/chart: app-template-1.3.0 + helm.sh/chart: app-template-1.3.1 test_label: test - it: custom metadata with global metadata should pass @@ -89,7 +89,7 @@ tests: app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: RELEASE-NAME global_label: test - helm.sh/chart: app-template-1.3.0 + helm.sh/chart: app-template-1.3.1 test_label: test - it: custom secret type should pass diff --git a/charts/other/app-template/tests/service/metadata_test.yaml b/charts/other/app-template/tests/service/metadata_test.yaml index 35ac48b0..b0bdd6dd 100644 --- a/charts/other/app-template/tests/service/metadata_test.yaml +++ b/charts/other/app-template/tests/service/metadata_test.yaml @@ -18,7 +18,7 @@ tests: app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/service: RELEASE-NAME - helm.sh/chart: app-template-1.3.0 + helm.sh/chart: app-template-1.3.1 - it: custom metadata should pass set: @@ -45,7 +45,7 @@ tests: app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/service: RELEASE-NAME - helm.sh/chart: app-template-1.3.0 + helm.sh/chart: app-template-1.3.1 test_label: test - it: custom metadata with global metadata should pass @@ -80,5 +80,5 @@ tests: app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/service: RELEASE-NAME global_label: test - helm.sh/chart: app-template-1.3.0 + helm.sh/chart: app-template-1.3.1 test_label: test diff --git a/charts/other/app-template/tests/serviceMonitor/servicemonitor_test.yaml b/charts/other/app-template/tests/serviceMonitor/servicemonitor_test.yaml index 8f218d42..4dc84edd 100644 --- a/charts/other/app-template/tests/serviceMonitor/servicemonitor_test.yaml +++ b/charts/other/app-template/tests/serviceMonitor/servicemonitor_test.yaml @@ -74,7 +74,7 @@ tests: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: RELEASE-NAME - helm.sh/chart: app-template-1.3.0 + helm.sh/chart: app-template-1.3.1 test.label: testvalue - it: a serviceMonitor is created with nameOverride