From 923ef40a39520979c98f354ea23963ee54f54433 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: Wed, 12 Apr 2023 19:30:47 +0200 Subject: [PATCH] feat: Release common version 1.4.0 (#130) * fix(common):: Fix Integer style image tags (fixes #128) * feat(common): Reload pod on secret change (#129) * feat(common): Update code-server to v4.11.0 * fix(common): quote command and args strings (#124) * feat(common): Update gluetun to v3.33.0 --------- Signed-off-by: angelnu Signed-off-by: Maurits van Mastrigt Co-authored-by: Angel Nunez Mencias Co-authored-by: Maurits <75321636+maurits-funda@users.noreply.github.com> --- .ci/ct/ct.yaml | 2 +- .editorconfig | 15 ++ .github/workflows/charts-lint.yaml | 6 +- .github/workflows/charts-release-ghpages.yaml | 4 +- .github/workflows/charts-release-oci.yaml | 2 +- .github/workflows/charts-release.yaml | 2 +- .github/workflows/charts-test.yaml | 6 +- .ci/ct/lintconf.yaml => .yamllint.yml | 8 +- charts/library/common/Chart.yaml | 15 +- .../lib/container/_containerImage.tpl | 15 ++ .../lib/controller/_mainContainer.tpl | 6 +- .../lib/metadata/_podAnnotations.tpl | 10 ++ charts/library/common/values.yaml | 131 ++++++++++-------- charts/other/app-template/Chart.yaml | 6 +- .../tests/configmap/metadata_test.yaml | 6 +- .../tests/container/args_test.yaml | 32 +++++ .../tests/container/command_test.yaml | 32 ++++- .../tests/container/image_test.yaml | 31 +++++ .../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/secret/pod_metadata_test.yaml | 25 ++++ .../tests/service/metadata_test.yaml | 6 +- .../serviceMonitor/servicemonitor_test.yaml | 2 +- 29 files changed, 297 insertions(+), 115 deletions(-) create mode 100644 .editorconfig rename .ci/ct/lintconf.yaml => .yamllint.yml (75%) create mode 100644 charts/library/common/templates/lib/container/_containerImage.tpl create mode 100644 charts/other/app-template/tests/container/image_test.yaml create mode 100644 charts/other/app-template/tests/secret/pod_metadata_test.yaml diff --git a/.ci/ct/ct.yaml b/.ci/ct/ct.yaml index 2bb20b85..d8e624ce 100644 --- a/.ci/ct/ct.yaml +++ b/.ci/ct/ct.yaml @@ -1,5 +1,5 @@ chart-yaml-schema: .ci/ct/chart_schema.yaml -lint-conf: .ci/ct/lintconf.yaml +lint-conf: .yamllint.yml remote: origin target-branch: main diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..32cf1e72 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +root = true + +[*] +charset = utf-8 +indent_size = 2 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[*.{sh,json}] +indent_size = 4 + +[*.md] +max_line_length = off +trim_trailing_whitespace = true diff --git a/.github/workflows/charts-lint.yaml b/.github/workflows/charts-lint.yaml index 1ed9fa0f..92c2cf68 100644 --- a/.github/workflows/charts-lint.yaml +++ b/.github/workflows/charts-lint.yaml @@ -8,7 +8,7 @@ on: type: string isRenovatePR: required: true - default: 'false' + default: "false" type: string chartsToLint: description: > @@ -20,10 +20,10 @@ on: A JSON encoded array of dependencies to override before linting type: string required: false - default: '[]' + default: "[]" env: - HELM_VERSION: 3.9.2 + HELM_VERSION: 3.11.2 jobs: lint-chart: diff --git a/.github/workflows/charts-release-ghpages.yaml b/.github/workflows/charts-release-ghpages.yaml index b40b7b01..2854c83e 100644 --- a/.github/workflows/charts-release-ghpages.yaml +++ b/.github/workflows/charts-release-ghpages.yaml @@ -17,7 +17,7 @@ on: required: true env: - HELM_VERSION: 3.11.1 + HELM_VERSION: 3.11.2 jobs: release-charts: @@ -83,7 +83,7 @@ jobs: commit_user_name: "bjw-s-bot[bot]" commit_user_email: 87358111+bjw-s-bot[bot]@users.noreply.github.com commit_author: bjw-s-bot[bot] <87358111+bjw-s-bot[bot]@users.noreply.github.com> - file_pattern: 'index.yaml **/*.tgz' + file_pattern: "index.yaml **/*.tgz" disable_globbing: true - name: Wait for deploy diff --git a/.github/workflows/charts-release-oci.yaml b/.github/workflows/charts-release-oci.yaml index 35ec0416..c391952a 100644 --- a/.github/workflows/charts-release-oci.yaml +++ b/.github/workflows/charts-release-oci.yaml @@ -17,7 +17,7 @@ on: required: true env: - HELM_VERSION: 3.11.1 + HELM_VERSION: 3.11.2 CHARTS_SRC_DIR: "charts" TARGET_REGISTRY: ghcr.io diff --git a/.github/workflows/charts-release.yaml b/.github/workflows/charts-release.yaml index 9e960771..2a51a4db 100644 --- a/.github/workflows/charts-release.yaml +++ b/.github/workflows/charts-release.yaml @@ -19,7 +19,7 @@ on: - "charts/**" env: - HELM_VERSION: 3.11.1 + HELM_VERSION: 3.11.2 jobs: prepare: diff --git a/.github/workflows/charts-test.yaml b/.github/workflows/charts-test.yaml index dc21add9..ad383c47 100644 --- a/.github/workflows/charts-test.yaml +++ b/.github/workflows/charts-test.yaml @@ -16,10 +16,10 @@ on: A JSON encoded array of dependencies to override before testing type: string required: false - default: '[]' + default: "[]" env: - HELM_VERSION: 3.9.2 + HELM_VERSION: 3.11.2 jobs: install-chart: @@ -49,7 +49,7 @@ jobs: - uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: "3.11" - name: Set up chart-testing uses: helm/chart-testing-action@v2.4.0 diff --git a/.ci/ct/lintconf.yaml b/.yamllint.yml similarity index 75% rename from .ci/ct/lintconf.yaml rename to .yamllint.yml index 90f48c88..dbefbcc6 100644 --- a/.ci/ct/lintconf.yaml +++ b/.yamllint.yml @@ -19,9 +19,9 @@ rules: max-spaces-after: 1 comments: require-starting-space: true - min-spaces-from-content: 2 + min-spaces-from-content: 1 document-end: disable - document-start: disable # No --- to start a file + document-start: disable # No --- to start a file empty-lines: max: 2 max-start: 0 @@ -30,10 +30,10 @@ rules: max-spaces-after: 1 indentation: spaces: consistent - indent-sequences: whatever # - list indentation will handle both indentation and without + indent-sequences: whatever # - list indentation will handle both indentation and without check-multi-line-strings: false key-duplicates: enable - line-length: disable # Lines can be any length + line-length: disable # Lines can be any length new-line-at-end-of-file: enable new-lines: type: unix diff --git a/charts/library/common/Chart.yaml b/charts/library/common/Chart.yaml index e5192676..51309838 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.2 +version: 1.4.0 kubeVersion: ">=1.22.0-0" keywords: - common @@ -14,9 +14,16 @@ maintainers: email: me@bjw-s.dev annotations: artifacthub.io/changes: |- + - kind: added + description: Reload Pod when secrets change - kind: changed - description: Updated code-server image tag to v4.10.0 + description: Quoting command and args strings to support multiline arguments - kind: changed - description: Updated netshoot image tag to v0.9 + description: Updated code-server image tag to v4.11.0 + - kind: changed + description: Updated gluetun image tag to v3.33.0 - kind: fixed - description: Pod annotations were not indented enough when controller type was cronjob + description: Integer style image tags now render correctly + links: + - name: GitHub Issue + url: https://github.com/bjw-s/helm-charts/issues/128 diff --git a/charts/library/common/templates/lib/container/_containerImage.tpl b/charts/library/common/templates/lib/container/_containerImage.tpl new file mode 100644 index 00000000..dd134634 --- /dev/null +++ b/charts/library/common/templates/lib/container/_containerImage.tpl @@ -0,0 +1,15 @@ +{{/* +Image used by the main container. +*/}} +{{- define "bjw-s.common.lib.container.image" -}} + {{- $imageRepo := .Values.image.repository -}} + {{- $imageTag := default .Chart.AppVersion .Values.image.tag -}} + + {{- if kindIs "float64" .Values.image.tag -}} + {{- $imageTag = .Values.image.tag | toString -}} + {{- end -}} + + {{- if and $imageRepo $imageTag -}} + {{- printf "%s:%s" $imageRepo $imageTag -}} + {{- end -}} +{{- end -}} diff --git a/charts/library/common/templates/lib/controller/_mainContainer.tpl b/charts/library/common/templates/lib/controller/_mainContainer.tpl index 37f48d4a..567ee609 100644 --- a/charts/library/common/templates/lib/controller/_mainContainer.tpl +++ b/charts/library/common/templates/lib/controller/_mainContainer.tpl @@ -1,12 +1,12 @@ {{- /* The main container included in the controller */ -}} {{- define "bjw-s.common.lib.controller.mainContainer" -}} - name: {{ include "bjw-s.common.lib.chart.names.fullname" . }} - image: {{ printf "%s:%s" .Values.image.repository (default .Chart.AppVersion .Values.image.tag) | quote }} + image: {{ include "bjw-s.common.lib.container.image" . }} imagePullPolicy: {{ .Values.image.pullPolicy }} {{- with .Values.command }} command: {{- if kindIs "string" . }} - - {{ . }} + - {{ . | quote }} {{- else }} {{ toYaml . | nindent 4 }} {{- end }} @@ -14,7 +14,7 @@ {{- with .Values.args }} args: {{- if kindIs "string" . }} - - {{ . }} + - {{ . | quote }} {{- else }} {{ toYaml . | nindent 4 }} {{- end }} diff --git a/charts/library/common/templates/lib/metadata/_podAnnotations.tpl b/charts/library/common/templates/lib/metadata/_podAnnotations.tpl index 0a26d7f6..a456c5cc 100644 --- a/charts/library/common/templates/lib/metadata/_podAnnotations.tpl +++ b/charts/library/common/templates/lib/metadata/_podAnnotations.tpl @@ -13,4 +13,14 @@ {{- if $configMapsFound -}} {{- printf "checksum/config: %v" (toYaml $configMapsFound | sha256sum) | nindent 0 -}} {{- end -}} + + {{- $secretsFound := dict -}} + {{- range $name, $secret := .Values.secrets -}} + {{- if $secret.enabled -}} + {{- $_ := set $secretsFound $name (toYaml $secret.data | sha256sum) -}} + {{- end -}} + {{- end -}} + {{- if $secretsFound -}} + {{- printf "checksum/secrets: %v" (toYaml $secretsFound | sha256sum) | nindent 0 -}} + {{- end -}} {{- end -}} diff --git a/charts/library/common/values.yaml b/charts/library/common/values.yaml index cf720605..49d297c6 100644 --- a/charts/library/common/values.yaml +++ b/charts/library/common/values.yaml @@ -1,3 +1,4 @@ +--- global: # -- Set an override for the prefix of the fullname nameOverride: @@ -42,7 +43,8 @@ controller: # -- CronJob configuration. Required only when using `controller.type: cronjob`. # @default -- See below cronjob: - # -- Specifies how to treat concurrent executions of a job that is created by this cron job, valid values are Allow, Forbid or Replace + # -- Specifies how to treat concurrent executions of a job that is created by this cron job + # valid values are Allow, Forbid or Replace concurrencyPolicy: Forbid # -- Sets the CronJob time when to execute your jobs schedule: "*/20 * * * *" @@ -52,7 +54,8 @@ controller: successfulJobsHistory: 1 # -- The number of failed Jobs to keep failedJobsHistory: 1 - # -- If this field is set, ttlSecondsAfterFinished after the Job finishes, it is eligible to be automatically deleted. + # -- If this field is set, ttlSecondsAfterFinished after the Job finishes, it is eligible to + # be automatically deleted. ttlSecondsAfterFinished: image: @@ -105,7 +108,8 @@ secrets: # -- Annotations to add to the Secret annotations: {} # -- Secret stringData content. Helm template enabled. - stringData: {} + stringData: + {} # foo: bar # -- Configure configMaps for the chart here. @@ -120,7 +124,8 @@ configMaps: # -- Annotations to add to the configMap annotations: {} # -- configMap data content. Helm template enabled. - data: {} + data: + {} # foo: bar # -- Main environment variables. Template enabled. @@ -152,13 +157,13 @@ envFrom: [] # name: secret-name # -- Custom priority class for different treatment by the scheduler -priorityClassName: # system-node-critical +priorityClassName: # system-node-critical # -- Allow specifying a runtimeClassName other than the default one (ie: nvidia) -runtimeClassName: # nvidia +runtimeClassName: # nvidia # -- Allows specifying a custom scheduler name -schedulerName: # awkward-dangerous-scheduler +schedulerName: # awkward-dangerous-scheduler # -- Allows specifying explicit hostname setting hostname: @@ -166,10 +171,11 @@ hostname: # -- When using hostNetwork make sure you set dnsPolicy to `ClusterFirstWithHostNet` hostNetwork: false -# -- Defaults to "ClusterFirst" if hostNetwork is false and "ClusterFirstWithHostNet" if hostNetwork is true. -dnsPolicy: # ClusterFirst +# -- Defaults to "ClusterFirst" if hostNetwork is false +# and "ClusterFirstWithHostNet" if hostNetwork is true. +dnsPolicy: # ClusterFirst -# -- Optional DNS settings, configuring the ndots option may resolve nslookup issues on some Kubernetes setups. +# -- Configuring the ndots option may resolve nslookup issues on some Kubernetes setups. dnsConfig: {} # options: # - name: ndots @@ -188,11 +194,13 @@ securityContext: {} # -- Configure the lifecycle for the main container lifecycle: {} -# -- Specify any initContainers here as dictionary items. Each initContainer should have its own key. -# The dictionary item key will determine the order. Helm templates can be used. +# -- Specify any initContainers here as dictionary items. +# Each initContainer should have its own key. The dictionary item key will determine the order. +# Helm templates can be used. initContainers: {} -# -- Specify any sidecar containers here as dictionary items. Each sidecar container should have its own key. +# -- Specify any sidecar containers here as dictionary items. +# Each sidecar container should have its own key. The dictionary item key will determine the order. # Helm templates can be used. sidecars: {} @@ -387,7 +395,8 @@ ingress: nameOverride: # -- Provide additional annotations which may be required. - annotations: {} + annotations: + {} # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" @@ -395,15 +404,15 @@ ingress: labels: {} # -- Set the ingressClass that is used for this ingress. - ingressClassName: # "nginx" + ingressClassName: # "nginx" ## Configure the hosts for the ingress hosts: - - # -- Host address. Helm template can be passed. + - # -- Host address. Helm template can be passed. host: chart-example.local ## Configure the paths for the host paths: - - # -- Path. Helm template can be passed. + - # -- Path. Helm template can be passed. path: / pathType: Prefix service: @@ -442,30 +451,30 @@ route: # -- Configure the resource the route attaches to. parentRefs: - - # Group of the referent resource. - group: gateway.networking.k8s.io - # Kind of the referent resource. - kind: Gateway - # Name of the referent resource - name: - # Namespace of the referent resource - namespace: - # Name of the section within the target resource. - sectionName: + - # Group of the referent resource. + group: gateway.networking.k8s.io + # Kind of the referent resource. + kind: Gateway + # Name of the referent resource + name: + # Namespace of the referent resource + namespace: + # Name of the section within the target resource. + sectionName: # -- Host addresses hostnames: [] # -- Configure rules for routing. Defaults to the primary service. rules: - - # -- Configure backends where matching requests should be sent. + - # -- Configure backends where matching requests should be sent. backendRefs: - - group: "" - kind: Service - name: - namespace: - port: - weight: 1 + - group: "" + kind: Service + name: + namespace: + port: + weight: 1 ## Configure conditions used for matching incoming requests. Only for HTTPRoutes matches: - path: @@ -490,7 +499,7 @@ persistence: # -- Where to mount the volume in the main container. # Defaults to `/`, # setting to '-' creates the volume but disables the volumeMount. - mountPath: # /config + mountPath: # /config # -- Specify if the volume should be mounted read-only. readOnly: false # -- Override the name suffix that is used for this volume. @@ -500,13 +509,13 @@ persistence: # If set to `-`, dynamic provisioning is disabled. # If set to something else, the given storageClass is used. # If undefined (the default) or set to null, no storageClassName spec is set, choosing the default provisioner. - storageClass: # "-" + storageClass: # "-" # -- If you want to reuse an existing claim, the name of the existing PVC can be passed here. - existingClaim: # your-claim + existingClaim: # your-claim # -- Used in conjunction with `existingClaim`. Specifies a sub-path inside the referenced volume instead of its root - subPath: # some-subpath + subPath: # some-subpath # -- AccessMode for the persistent volume. # Make sure to select an access mode that is supported by your storage provider! @@ -529,11 +538,11 @@ persistence: # -- Set the medium to "Memory" to mount a tmpfs (RAM-backed filesystem) instead # of the storage medium that backs the node. - medium: # Memory + medium: # Memory # -- If the `SizeMemoryBackedVolumes` feature gate is enabled, you can # specify a size for memory backed volumes. - sizeLimit: # 1Gi + sizeLimit: # 1Gi # -- Used in conjunction with `controller.type: statefulset` to create individual disks for each instance. volumeClaimTemplates: [] @@ -581,7 +590,8 @@ hostAliases: [] # - "www.example.com" # -- Set the resource requests / limits for the main container. -resources: {} +resources: + {} ## We usually recommend not to specify default resources and to leave this as a conscious ## choice for the user. This also increases chances charts run on environments with little ## resources, such as Minikube. If you do want to specify resources, uncomment the following @@ -596,7 +606,6 @@ resources: {} # -- The common chart supports several add-ons. These can be configured under this key. # @default -- See below addons: - # -- The common chart supports adding a VPN add-on. It can be configured under this key. # @default -- See values.yaml vpn: @@ -607,14 +616,15 @@ addons: type: gluetun # -- Gluetun specific configuration - # -- Make sure to read the [documentation](https://github.com/qdm12/gluetun/wiki) to see how to configure this addon! + # -- Make sure to read the [documentation](https://github.com/qdm12/gluetun/wiki) + # to see how to configure this addon! # @default -- See below gluetun: image: # -- Specify the Gluetun image repository: docker.io/qmcgaw/gluetun # -- Specify the Gluetun image tag - tag: v3.32.0 + tag: v3.33.0 # -- Specify the Gluetun image pull policy pullPolicy: IfNotPresent @@ -628,14 +638,16 @@ addons: # -- All variables specified here will be added to the vpn sidecar container # See the documentation of the VPN image for all config values - env: {} + env: + {} # TZ: UTC # -- Override the args for the vpn sidecar container args: [] # -- Provide a customized vpn configuration file to be used by the VPN. - configFile: # |- + configFile: + # |- # Some Example Config # remote greatvpnhost.com 8888 # auth-user-pass @@ -649,12 +661,14 @@ addons: # @default -- See values.yaml scripts: # @default -- See below - up: # |- - # #!/bin/bash - # echo "connected" > /shared/vpnstatus + up: + # |- + # !/bin/bash + # echo "connected" > /shared/vpnstatus # @default -- See below - down: # |- + down: + # |- # #!/bin/bash # echo "disconnected" > /shared/vpnstatus @@ -662,7 +676,8 @@ addons: # -- Optionally specify a livenessProbe, e.g. to check if the connection is still # being protected by the VPN - livenessProbe: {} + livenessProbe: + {} # exec: # command: # - sh @@ -701,7 +716,6 @@ addons: # protocol: TCP # -- The common library supports adding a code-server add-on to access files. It can be configured under this key. - # For more info, check out [our docs](https://bjw-s.github.io/helm-charts/docs/common-library/common-library-add-ons/##code-server) # @default -- See values.yaml codeserver: # -- Enable running a code-server container in the pod @@ -711,12 +725,13 @@ addons: # -- Specify the code-server image repository: ghcr.io/coder/code-server # -- Specify the code-server image tag - tag: 4.10.0 + tag: 4.11.0 # -- Specify the code-server image pull policy pullPolicy: IfNotPresent # -- Set any environment variables for code-server here - env: {} + env: + {} # TZ: UTC # -- Set codeserver command line arguments. @@ -770,14 +785,15 @@ addons: # -- Enable an ingress for the code-server add-on. enabled: false - annotations: {} + annotations: + {} # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" labels: {} # -- Set the ingressClass that is used for this ingress. - ingressClassName: # "nginx" + ingressClassName: # "nginx" hosts: - host: code.chart-example.local @@ -792,7 +808,8 @@ addons: securityContext: runAsUser: 0 - # -- The common library supports adding a netshoot add-on to troubleshoot network issues within a Pod. It can be configured under this key. + # -- The common library supports adding a netshoot add-on to troubleshoot network issues within a Pod. + # It can be configured under this key. # @default -- See values.yaml netshoot: # -- Enable running a netshoot container in the pod diff --git a/charts/other/app-template/Chart.yaml b/charts/other/app-template/Chart.yaml index 2f619b24..3fc1ea1b 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.2 +version: 1.4.0 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.2 + version: 1.4.0 annotations: artifacthub.io/changes: |- - kind: changed description: | - Updated library version to 1.3.2. + Updated library version to 1.4.0. 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 5d4545b9..de053216 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.2 + helm.sh/chart: app-template-1.4.0 - 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.2 + helm.sh/chart: app-template-1.4.0 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.2 + helm.sh/chart: app-template-1.4.0 test_label: test diff --git a/charts/other/app-template/tests/container/args_test.yaml b/charts/other/app-template/tests/container/args_test.yaml index b17ddedb..4a5470cd 100644 --- a/charts/other/app-template/tests/container/args_test.yaml +++ b/charts/other/app-template/tests/container/args_test.yaml @@ -24,11 +24,42 @@ tests: value: - sleep infinity + - it: multiline string should pass + set: + args: | + echo hello + echo world + asserts: + - documentIndex: 0 + isKind: + of: Deployment + - documentIndex: 0 + equal: + path: spec.template.spec.containers[0].args + value: + - | + echo hello + echo world + + - it: single quoted string should pass + set: + args: "sleep infinity" + asserts: + - documentIndex: 0 + isKind: + of: Deployment + - documentIndex: 0 + equal: + path: spec.template.spec.containers[0].args + value: + - sleep infinity + - it: list of strings should pass set: args: - sleep - infinity + - "test" asserts: - documentIndex: 0 isKind: @@ -39,3 +70,4 @@ tests: value: - sleep - infinity + - test diff --git a/charts/other/app-template/tests/container/command_test.yaml b/charts/other/app-template/tests/container/command_test.yaml index 78c272b7..f0be880e 100644 --- a/charts/other/app-template/tests/container/command_test.yaml +++ b/charts/other/app-template/tests/container/command_test.yaml @@ -24,11 +24,41 @@ tests: value: - /bin/sh + - it: multiline string should pass + set: + command: | + /bin/sh + -c + asserts: + - documentIndex: 0 + isKind: + of: Deployment + - documentIndex: 0 + equal: + path: spec.template.spec.containers[0].command + value: + - | + /bin/sh + -c + + - it: single quoted string should pass + set: + command: "/bin/sh" + asserts: + - documentIndex: 0 + isKind: + of: Deployment + - documentIndex: 0 + equal: + path: spec.template.spec.containers[0].command + value: + - /bin/sh + - it: list of strings should pass set: command: - /bin/sh - - -c + - "-c" asserts: - documentIndex: 0 isKind: diff --git a/charts/other/app-template/tests/container/image_test.yaml b/charts/other/app-template/tests/container/image_test.yaml new file mode 100644 index 00000000..b14d86f5 --- /dev/null +++ b/charts/other/app-template/tests/container/image_test.yaml @@ -0,0 +1,31 @@ +suite: container image tag +templates: + - common.yaml +tests: + - it: string tag should pass + set: + image: + repository: b4bz/homer + tag: latest + asserts: + - documentIndex: 0 + isKind: + of: Deployment + - documentIndex: 0 + equal: + path: spec.template.spec.containers[0].image + value: b4bz/homer:latest + + - it: integer tag should pass + set: + image: + repository: b4bz/homer + tag: 1.23 + asserts: + - documentIndex: 0 + isKind: + of: Deployment + - documentIndex: 0 + equal: + path: spec.template.spec.containers[0].image + value: b4bz/homer:1.23 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 38b579ac..6bb6664e 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.2 + helm.sh/chart: app-template-1.4.0 - 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.2 + helm.sh/chart: app-template-1.4.0 test_label: test - it: custom metadata with global metadata should pass @@ -79,7 +79,7 @@ tests: app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: RELEASE-NAME global_label: test - helm.sh/chart: app-template-1.3.2 + helm.sh/chart: app-template-1.4.0 test_label: test - it: jobTemplate metadata should pass 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 ca5992d4..eaf9a252 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.2 + helm.sh/chart: app-template-1.4.0 - 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.2 + helm.sh/chart: app-template-1.4.0 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.2 + helm.sh/chart: app-template-1.4.0 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 456904d6..1c02b0c7 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.2 + helm.sh/chart: app-template-1.4.0 - 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.2 + helm.sh/chart: app-template-1.4.0 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.2 + helm.sh/chart: app-template-1.4.0 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 6fdc8649..c37682c6 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.2 + helm.sh/chart: app-template-1.4.0 - 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.2 + helm.sh/chart: app-template-1.4.0 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.2 + helm.sh/chart: app-template-1.4.0 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 eaab09de..58abba1c 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.2 + helm.sh/chart: app-template-1.4.0 - 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.2 + helm.sh/chart: app-template-1.4.0 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.2 + helm.sh/chart: app-template-1.4.0 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 47ba83a0..d42e32cb 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.2 + helm.sh/chart: app-template-1.4.0 - 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.2 + helm.sh/chart: app-template-1.4.0 - 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.2 + helm.sh/chart: app-template-1.4.0 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.2 + helm.sh/chart: app-template-1.4.0 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 e34dd48a..cb61f43b 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.2 + helm.sh/chart: app-template-1.4.0 - 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.2 + helm.sh/chart: app-template-1.4.0 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.2 + helm.sh/chart: app-template-1.4.0 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 da65056e..03884e16 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.2 + helm.sh/chart: app-template-1.4.0 - 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.2 + helm.sh/chart: app-template-1.4.0 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.2 + helm.sh/chart: app-template-1.4.0 test_label: test - it: custom secret type should pass diff --git a/charts/other/app-template/tests/secret/pod_metadata_test.yaml b/charts/other/app-template/tests/secret/pod_metadata_test.yaml new file mode 100644 index 00000000..d69c81b7 --- /dev/null +++ b/charts/other/app-template/tests/secret/pod_metadata_test.yaml @@ -0,0 +1,25 @@ +suite: secret Pod metadata +templates: + - common.yaml +tests: + - it: default metadata should pass + set: + secrets: + secret_1: + enabled: true + data: + test: value 1 + secret_2: + enabled: true + data: + test_1: value 1 + test_2: value 2 + asserts: + - documentIndex: &ControllerDoc 0 + isKind: + of: Deployment + - documentIndex: *ControllerDoc + equal: + path: spec.template.metadata.annotations + value: + checksum/secrets: cd4e5076088172611ca1c43c659a275232d9eeb887acc20575ac141038b9aacb diff --git a/charts/other/app-template/tests/service/metadata_test.yaml b/charts/other/app-template/tests/service/metadata_test.yaml index 6e567380..352492c8 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.2 + helm.sh/chart: app-template-1.4.0 - 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.2 + helm.sh/chart: app-template-1.4.0 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.2 + helm.sh/chart: app-template-1.4.0 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 44710260..efb7c63f 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.2 + helm.sh/chart: app-template-1.4.0 test.label: testvalue - it: a serviceMonitor is created with nameOverride