diff --git a/charts/library/common/Chart.yaml b/charts/library/common/Chart.yaml index 1168ee73..3539fab8 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.1.3 +version: 1.2.0 kubeVersion: ">=1.22.0-0" keywords: - common @@ -15,24 +15,12 @@ maintainers: annotations: artifacthub.io/changes: |- - kind: fixed - description: Fixed code-server add-on Service rendering + description: Fixed sectionName not being optional for gateway routes - kind: fixed - description: Fixed httpGet probe whitespace rendering + description: Fixed primary gateway route having incorrect name - kind: fixed - description: Fixed serviceAccount definition to be compatible with k8s 1.25 - links: - - name: Secret management for ServiceAccounts - url: https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/#manual-secret-management-for-serviceaccounts + description: Fixed invalid persistence type message - kind: added - description: Added support for Gateway API Routes - links: - - name: Gateway API docs - url: https://gateway-api.sigs.k8s.io - - kind: changed - description: Services and their ports are now assumed enabled by default - - kind: changed - description: Updated netshoot image to v0.8 - - kind: changed - description: Updated code-server image to v4.8.3 - - kind: removed - description: Removed promtail add-on + description: Added cronjob as controller.type + - kind: added + description: Allow setting container restartPolicy diff --git a/charts/library/common/README.md b/charts/library/common/README.md index 4645e6da..1b9a3078 100644 --- a/charts/library/common/README.md +++ b/charts/library/common/README.md @@ -1,6 +1,6 @@ # common -![Version: 1.1.1](https://img.shields.io/badge/Version-1.1.1-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square) +![Version: 1.2.0](https://img.shields.io/badge/Version-1.2.0-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.1.1 + version: 1.2.0 repository: https://bjw-s.github.io/helm-charts/ ``` @@ -101,17 +101,24 @@ N/A | configMaps.config.data | object | `{}` | configMap data content. Helm template enabled. | | configMaps.config.enabled | bool | `false` | Enables or disables the configMap | | configMaps.config.labels | object | `{}` | Labels to add to the configMap | -| controller.annotations | object | `{}` | Set annotations on the deployment/statefulset/daemonset | +| controller.annotations | object | `{}` | Set annotations on the deployment/statefulset/daemonset/cronjob | +| controller.cronjob | object | See below | CronJob configuration. Required only when using `controller.type: cronjob`. | +| controller.cronjob.concurrencyPolicy | string | `"Forbid"` | Specifies how to treat concurrent executions of a job that is created by this cron job, valid values are Allow, Forbid or Replace | +| controller.cronjob.failedJobsHistory | int | `1` | The number of failed Jobs to keep | +| controller.cronjob.schedule | string | `"*/20 * * * *"` | Sets the CronJob time when to execute your jobs | +| controller.cronjob.startingDeadlineSeconds | int | `30` | The deadline in seconds for starting the job if it misses its scheduled time for any reason | +| controller.cronjob.successfulJobsHistory | int | `1` | The number of succesful Jobs to keep | | controller.enabled | bool | `true` | enable the controller. | -| controller.labels | object | `{}` | Set labels on the deployment/statefulset/daemonset | +| controller.labels | object | `{}` | Set labels on the deployment/statefulset/daemonset/cronjob | | controller.podManagementPolicy | string | `nil` | Set statefulset podManagementPolicy, valid values are Parallel and OrderedReady (default). | | controller.replicas | int | `1` | Number of desired pods | +| controller.restartPolicy | string | `Always`. When `controller.type` is `cronjob` it defaults to `Never`. | Set Container restart policy. | | controller.revisionHistoryLimit | int | `3` | ReplicaSet revision history limit | | controller.rollingUpdate.partition | string | `nil` | Set statefulset RollingUpdate partition | | controller.rollingUpdate.surge | string | `nil` | Set deployment RollingUpdate max surge | | controller.rollingUpdate.unavailable | string | `nil` | Set deployment RollingUpdate max unavailable | -| controller.strategy | string | `nil` | Set the controller upgrade strategy For Deployments, valid values are Recreate (default) and RollingUpdate. For StatefulSets, valid values are OnDelete and RollingUpdate (default). DaemonSets ignore this. | -| controller.type | string | `"deployment"` | Set the controller type. Valid options are deployment, daemonset or statefulset | +| controller.strategy | string | `nil` | Set the controller upgrade strategy For Deployments, valid values are Recreate (default) and RollingUpdate. For StatefulSets, valid values are OnDelete and RollingUpdate (default). DaemonSets/CronJobs ignore this. | +| controller.type | string | `"deployment"` | Set the controller type. Valid options are deployment, daemonset, statefulset or cronjob | | dnsConfig | object | `{}` | Optional DNS settings, configuring the ndots option may resolve nslookup issues on some Kubernetes setups. | | dnsPolicy | string | `nil` | Defaults to "ClusterFirst" if hostNetwork is false and "ClusterFirstWithHostNet" if hostNetwork is true. | | enableServiceLinks | bool | `true` | Enable/disable the generation of environment variables for services. [[ref]](https://kubernetes.io/docs/concepts/services-networking/connect-applications-service/#accessing-the-service) | @@ -187,6 +194,7 @@ N/A | route.main.kind | string | `"HTTPRoute"` | Set the route kind Valid options are GRPCRoute, HTTPRoute, TCPRoute, TLSRoute, UDPRoute | | route.main.labels | object | `{}` | Provide additional labels which may be required. | | route.main.nameOverride | string | `nil` | Override the name suffix that is used for this route. | +| route.main.parentRefs | list | `[{"group":"gateway.networking.k8s.io","kind":"Gateway","name":null,"namespace":null,"sectionName":null}]` | Configure the resource the route attaches to. | | route.main.rules | list | `[{"backendRefs":[{"group":"","kind":"Service","name":null,"namespace":null,"port":null,"weight":1}],"matches":[{"path":{"type":"PathPrefix","value":"/"}}]}]` | Configure rules for routing. Defaults to the primary service. | | route.main.rules[0].backendRefs | list | `[{"group":"","kind":"Service","name":null,"namespace":null,"port":null,"weight":1}]` | Configure backends where matching requests should be sent. | | runtimeClassName | string | `nil` | Allow specifying a runtimeClassName other than the default one (ie: nvidia) | diff --git a/charts/library/common/templates/classes/_cronjob.tpl b/charts/library/common/templates/classes/_cronjob.tpl new file mode 100644 index 00000000..b73b0e28 --- /dev/null +++ b/charts/library/common/templates/classes/_cronjob.tpl @@ -0,0 +1,43 @@ +{{/* +This template serves as a blueprint for Cronjob objects that are created +using the common library. +*/}} +{{- define "bjw-s.common.class.cronjob" -}} + {{- $restartPolicy := default "Never" .Values.controller.restartPolicy -}} + {{- if and (ne $restartPolicy "Never") (ne $restartPolicy "OnFailure") -}} + {{- fail (printf "Not a valid restartPolicy for CronJob (%s)" $restartPolicy) -}} + {{- end -}} + {{- $_ := set .Values.controller "restartPolicy" $restartPolicy -}} +--- +apiVersion: batch/v1 +kind: CronJob +metadata: + name: {{ include "bjw-s.common.lib.chart.names.fullname" . }} + {{- with include "bjw-s.common.lib.controller.metadata.labels" . }} + labels: {{- . | nindent 4 }} + {{- end }} + {{- with include "bjw-s.common.lib.controller.metadata.annotations" . }} + annotations: {{- . | nindent 4 }} + {{- end }} +spec: + concurrencyPolicy: "{{ .Values.controller.cronjob.concurrencyPolicy }}" + startingDeadlineSeconds: {{ .Values.controller.cronjob.startingDeadlineSeconds }} + schedule: "{{ .Values.controller.cronjob.schedule }}" + successfulJobsHistoryLimit: {{ .Values.controller.cronjob.successfulJobsHistory }} + failedJobsHistoryLimit: {{ .Values.controller.cronjob.failedJobsHistory }} + jobTemplate: + spec: + template: + metadata: + {{- with include ("bjw-s.common.lib.metadata.podAnnotations") . }} + annotations: + {{- . | nindent 8 }} + {{- end }} + labels: + {{- include "bjw-s.common.lib.metadata.selectorLabels" . | nindent 12 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 12 }} + {{- end }} + spec: + {{- include "bjw-s.common.lib.controller.pod" . | nindent 10 }} +{{- end -}} diff --git a/charts/library/common/templates/classes/_route.tpl b/charts/library/common/templates/classes/_route.tpl index 2c9298e0..b5c0a8a8 100644 --- a/charts/library/common/templates/classes/_route.tpl +++ b/charts/library/common/templates/classes/_route.tpl @@ -42,7 +42,9 @@ spec: kind: {{ default "Gateway" .kind }} name: {{ required (printf "parentRef name is required for %v %v" $routeKind $fullName) .name }} namespace: {{ required (printf "parentRef namespace is required for %v %v" $routeKind $fullName) .namespace }} - sectionName: {{ default "" .sectionName | quote}} + {{- if .sectionName }} + sectionName: {{ .sectionName | quote }} + {{- end }} {{- end }} {{- if and (ne $routeKind "TCPRoute") (ne $routeKind "UDPRoute") $values.hostnames }} hostnames: diff --git a/charts/library/common/templates/lib/controller/_pod.tpl b/charts/library/common/templates/lib/controller/_pod.tpl index f822ac6c..060ab48b 100644 --- a/charts/library/common/templates/lib/controller/_pod.tpl +++ b/charts/library/common/templates/lib/controller/_pod.tpl @@ -102,4 +102,7 @@ topologySpreadConstraints: tolerations: {{- toYaml . | nindent 2 }} {{- end }} + {{- with .Values.controller.restartPolicy }} +restartPolicy: {{ . }} + {{- end }} {{- end -}} diff --git a/charts/library/common/templates/lib/controller/_volumes.tpl b/charts/library/common/templates/lib/controller/_volumes.tpl index d9bb858b..fa985cdd 100644 --- a/charts/library/common/templates/lib/controller/_volumes.tpl +++ b/charts/library/common/templates/lib/controller/_volumes.tpl @@ -61,7 +61,7 @@ Volumes included by the controller. {{- else if eq $persistence.type "custom" }} {{- toYaml $persistence.volumeSpec | nindent 2 }} {{- else }} - {{- fail (printf "Not a valid persistence.type (%s)" .Values.persistence.type) }} + {{- fail (printf "Not a valid persistence.type (%s)" $persistence.type) }} {{- end }} {{- end }} {{- end }} diff --git a/charts/library/common/templates/lib/routes/_primary.tpl b/charts/library/common/templates/lib/routes/_primary.tpl new file mode 100644 index 00000000..ba6cd1a4 --- /dev/null +++ b/charts/library/common/templates/lib/routes/_primary.tpl @@ -0,0 +1,21 @@ +{{/* Return the name of the primary route object */}} +{{- define "bjw-s.common.lib.route.primary" -}} + {{- $enabledRoutes := dict -}} + {{- range $name, $route := .Values.route -}} + {{- if $route.enabled -}} + {{- $_ := set $enabledRoutes $name . -}} + {{- end -}} + {{- end -}} + + {{- $result := "" -}} + {{- range $name, $route := $enabledRoutes -}} + {{- if and (hasKey $route "primary") $route.primary -}} + {{- $result = $name -}} + {{- end -}} + {{- end -}} + + {{- if not $result -}} + {{- $result = keys $enabledRoutes | first -}} + {{- end -}} + {{- $result -}} +{{- end -}} diff --git a/charts/library/common/templates/render/_controller.tpl b/charts/library/common/templates/render/_controller.tpl index 1d6bf137..ff8513ff 100644 --- a/charts/library/common/templates/render/_controller.tpl +++ b/charts/library/common/templates/render/_controller.tpl @@ -5,6 +5,8 @@ Renders the controller object required by the chart. {{- if .Values.controller.enabled -}} {{- if eq .Values.controller.type "deployment" -}} {{- include "bjw-s.common.class.deployment" . | nindent 0 -}} + {{- else if eq .Values.controller.type "cronjob" -}} + {{- include "bjw-s.common.class.cronjob" . | nindent 0 -}} {{ else if eq .Values.controller.type "daemonset" -}} {{- include "bjw-s.common.class.daemonset" . | nindent 0 -}} {{ else if eq .Values.controller.type "statefulset" -}} diff --git a/charts/library/common/templates/render/_routes.tpl b/charts/library/common/templates/render/_routes.tpl index d84e431e..cb388ebd 100644 --- a/charts/library/common/templates/render/_routes.tpl +++ b/charts/library/common/templates/render/_routes.tpl @@ -6,7 +6,7 @@ {{- $routeValues := $route -}} {{/* set defaults */}} - {{- if not $routeValues.nameOverride -}} + {{- if and (not $routeValues.nameOverride) (ne $name (include "bjw-s.common.lib.route.primary" $)) -}} {{- $_ := set $routeValues "nameOverride" $name -}} {{- end -}} diff --git a/charts/library/common/values.yaml b/charts/library/common/values.yaml index b6ccc47a..487edd44 100644 --- a/charts/library/common/values.yaml +++ b/charts/library/common/values.yaml @@ -12,18 +12,18 @@ controller: # -- enable the controller. enabled: true # -- Set the controller type. - # Valid options are deployment, daemonset or statefulset + # Valid options are deployment, daemonset, statefulset or cronjob type: deployment - # -- Set annotations on the deployment/statefulset/daemonset + # -- Set annotations on the deployment/statefulset/daemonset/cronjob annotations: {} - # -- Set labels on the deployment/statefulset/daemonset + # -- Set labels on the deployment/statefulset/daemonset/cronjob labels: {} # -- Number of desired pods replicas: 1 # -- Set the controller upgrade strategy # For Deployments, valid values are Recreate (default) and RollingUpdate. # For StatefulSets, valid values are OnDelete and RollingUpdate (default). - # DaemonSets ignore this. + # DaemonSets/CronJobs ignore this. strategy: rollingUpdate: # -- Set deployment RollingUpdate max unavailable @@ -36,6 +36,22 @@ controller: revisionHistoryLimit: 3 # -- Set statefulset podManagementPolicy, valid values are Parallel and OrderedReady (default). podManagementPolicy: + # -- Set Container restart policy. + # @default -- `Always`. When `controller.type` is `cronjob` it defaults to `Never`. + restartPolicy: + # -- 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 + concurrencyPolicy: Forbid + # -- Sets the CronJob time when to execute your jobs + schedule: "*/20 * * * *" + # -- The deadline in seconds for starting the job if it misses its scheduled time for any reason + startingDeadlineSeconds: 30 + # -- The number of succesful Jobs to keep + successfulJobsHistory: 1 + # -- The number of failed Jobs to keep + failedJobsHistory: 1 image: # -- image repository @@ -422,7 +438,7 @@ route: # -- Provide additional labels which may be required. labels: {} - ## -- Configure the resource the route attaches to. + # -- Configure the resource the route attaches to. parentRefs: - # Group of the referent resource. group: gateway.networking.k8s.io @@ -433,7 +449,7 @@ route: # Namespace of the referent resource namespace: # Name of the section within the target resource. - sectionName: "" + sectionName: # -- Host addresses hostnames: [] diff --git a/charts/other/app-template/Chart.yaml b/charts/other/app-template/Chart.yaml index f7d97541..2aa988b3 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.1.3 +version: 1.2.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.1.3 + version: 1.2.0 annotations: artifacthub.io/changes: |- - kind: changed description: | - Updated library version to 1.1.3. + Updated library version to 1.2.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/ci/cronjob-values.yaml b/charts/other/app-template/ci/cronjob-values.yaml new file mode 100644 index 00000000..b93f3ed7 --- /dev/null +++ b/charts/other/app-template/ci/cronjob-values.yaml @@ -0,0 +1,11 @@ +controller: + type: cronjob + +image: + repository: b4bz/homer + tag: latest + pullPolicy: IfNotPresent + +service: + main: + enabled: false diff --git a/charts/other/app-template/tests/configmap/metadata_test.yaml b/charts/other/app-template/tests/configmap/metadata_test.yaml index d0115272..549533e3 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.1.3 + helm.sh/chart: app-template-1.2.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.1.3 + helm.sh/chart: app-template-1.2.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.1.3 + helm.sh/chart: app-template-1.2.0 test_label: test diff --git a/charts/other/app-template/tests/controller/cronjob_test.yaml b/charts/other/app-template/tests/controller/cronjob_test.yaml new file mode 100644 index 00000000..374422bd --- /dev/null +++ b/charts/other/app-template/tests/controller/cronjob_test.yaml @@ -0,0 +1,67 @@ +suite: cronjob configuration +templates: + - common.yaml +tests: + - it: default cronjob configuration should pass + set: + controller: + type: cronjob + asserts: + - documentIndex: &ControllerDoc 0 + isKind: + of: CronJob + - documentIndex: *ControllerDoc + equal: + path: spec.schedule + value: "*/20 * * * *" + - documentIndex: *ControllerDoc + equal: + path: spec.concurrencyPolicy + value: Forbid + - documentIndex: *ControllerDoc + equal: + path: spec.successfulJobsHistoryLimit + value: 1 + - documentIndex: *ControllerDoc + equal: + path: spec.failedJobsHistoryLimit + value: 1 + - documentIndex: *ControllerDoc + equal: + path: spec.jobTemplate.spec.template.spec.restartPolicy + value: Never + + - it: custom cronjob configuration should pass + set: + controller: + type: cronjob + restartPolicy: OnFailure + cronjob: + schedule: &CronJobSchedule "0 3 * * *" + concurrencyPolicy: &CronJobConcurrencyPolicy "Test" + failedJobsHistory: &CronJobFailedJobsHistory 2 + successfulJobsHistory: &CronJobSuccessfulJobsHistory 3 + asserts: + - documentIndex: &ControllerDoc 0 + isKind: + of: CronJob + - documentIndex: *ControllerDoc + equal: + path: spec.schedule + value: *CronJobSchedule + - documentIndex: *ControllerDoc + equal: + path: spec.concurrencyPolicy + value: *CronJobConcurrencyPolicy + - documentIndex: *ControllerDoc + equal: + path: spec.successfulJobsHistoryLimit + value: *CronJobSuccessfulJobsHistory + - documentIndex: *ControllerDoc + equal: + path: spec.failedJobsHistoryLimit + value: *CronJobFailedJobsHistory + - documentIndex: *ControllerDoc + equal: + path: spec.jobTemplate.spec.template.spec.restartPolicy + value: OnFailure diff --git a/charts/other/app-template/tests/controller/metadata_cronjob_test.yaml b/charts/other/app-template/tests/controller/metadata_cronjob_test.yaml new file mode 100644 index 00000000..8d97d101 --- /dev/null +++ b/charts/other/app-template/tests/controller/metadata_cronjob_test.yaml @@ -0,0 +1,83 @@ +suite: controller metadata cronjob +templates: + - common.yaml +tests: + - it: default metadata should pass + set: + controller.type: cronjob + asserts: + - documentIndex: &ControllerDoc 0 + isKind: + of: CronJob + - documentIndex: *ControllerDoc + isNull: + path: metadata.annotations + - documentIndex: *ControllerDoc + equal: + path: metadata.labels + value: + app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: RELEASE-NAME + helm.sh/chart: app-template-1.2.0 + + - it: custom metadata should pass + set: + controller: + type: cronjob + annotations: + test_annotation: test + labels: + test_label: test + asserts: + - documentIndex: &ControllerDoc 0 + isKind: + of: CronJob + - documentIndex: *ControllerDoc + equal: + path: metadata.annotations + value: + test_annotation: test + - documentIndex: *ControllerDoc + equal: + path: metadata.labels + value: + app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: RELEASE-NAME + helm.sh/chart: app-template-1.2.0 + test_label: test + + - it: custom metadata with global metadata should pass + set: + global: + labels: + global_label: test + annotations: + global_annotation: test + controller: + type: cronjob + annotations: + test_annotation: test + labels: + test_label: test + asserts: + - documentIndex: &ControllerDoc 0 + isKind: + of: CronJob + - documentIndex: *ControllerDoc + equal: + path: metadata.annotations + value: + global_annotation: test + test_annotation: test + - documentIndex: *ControllerDoc + equal: + path: metadata.labels + value: + app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: RELEASE-NAME + global_label: test + helm.sh/chart: app-template-1.2.0 + 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 6ced5b92..5b57eb4d 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.1.3 + helm.sh/chart: app-template-1.2.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.1.3 + helm.sh/chart: app-template-1.2.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.1.3 + helm.sh/chart: app-template-1.2.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 1b47f355..50993a38 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.1.3 + helm.sh/chart: app-template-1.2.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.1.3 + helm.sh/chart: app-template-1.2.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.1.3 + helm.sh/chart: app-template-1.2.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 edbe2108..733480d0 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.1.3 + helm.sh/chart: app-template-1.2.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.1.3 + helm.sh/chart: app-template-1.2.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.1.3 + helm.sh/chart: app-template-1.2.0 test_label: test diff --git a/charts/other/app-template/tests/controller/type_test.yaml b/charts/other/app-template/tests/controller/type_test.yaml index 6dbad3f0..ec00667c 100644 --- a/charts/other/app-template/tests/controller/type_test.yaml +++ b/charts/other/app-template/tests/controller/type_test.yaml @@ -36,6 +36,18 @@ tests: path: metadata.name value: RELEASE-NAME + - it: cronjob should pass + set: + controller.type: cronjob + asserts: + - documentIndex: &ControllerDoc 0 + isKind: + of: CronJob + - documentIndex: *ControllerDoc + equal: + path: metadata.name + value: RELEASE-NAME + - it: disabled should pass set: controller.enabled: false diff --git a/charts/other/app-template/tests/ingress/metadata_test.yaml b/charts/other/app-template/tests/ingress/metadata_test.yaml index 82638c51..f870c84a 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.1.3 + helm.sh/chart: app-template-1.2.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.1.3 + helm.sh/chart: app-template-1.2.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.1.3 + helm.sh/chart: app-template-1.2.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 041064e3..79e11009 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.1.3 + helm.sh/chart: app-template-1.2.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.1.3 + helm.sh/chart: app-template-1.2.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.1.3 + helm.sh/chart: app-template-1.2.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.1.3 + helm.sh/chart: app-template-1.2.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 09c4878b..11b30b58 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.1.3 + helm.sh/chart: app-template-1.2.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.1.3 + helm.sh/chart: app-template-1.2.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.1.3 + helm.sh/chart: app-template-1.2.0 test_label: test diff --git a/charts/other/app-template/tests/route/service_reference_test.yaml b/charts/other/app-template/tests/route/service_reference_test.yaml index a3c74589..a08be3b9 100644 --- a/charts/other/app-template/tests/route/service_reference_test.yaml +++ b/charts/other/app-template/tests/route/service_reference_test.yaml @@ -19,7 +19,7 @@ tests: value: group: "" kind: Service - name: RELEASE-NAME-main + name: RELEASE-NAME namespace: NAMESPACE port: null weight: 1 diff --git a/charts/other/app-template/tests/route/values_test.yaml b/charts/other/app-template/tests/route/values_test.yaml index 1a655545..8953b819 100644 --- a/charts/other/app-template/tests/route/values_test.yaml +++ b/charts/other/app-template/tests/route/values_test.yaml @@ -181,3 +181,32 @@ tests: - documentIndex: &HTTPRouteDocument 3 isNull: path: spec.hostnames + + - it: sectionName in parentRefs should be optional + set: + route: + main: + enabled: true + parentRefs: + - name: parentName + namespace: parentNamespace + second: + enabled: true + parentRefs: + - name: parentName + namespace: parentNamespace + sectionName: parentSection + asserts: + - documentIndex: &HTTPRouteDocument 2 + isKind: + of: HTTPRoute + - documentIndex: &HTTPRouteDocument 2 + isNull: + path: spec.parentRefs[0].sectionName + - documentIndex: &HTTPRouteDocument 3 + isKind: + of: HTTPRoute + - documentIndex: &HTTPRouteDocument 3 + equal: + path: spec.parentRefs[0].sectionName + value: parentSection diff --git a/charts/other/app-template/tests/secret/metadata_test.yaml b/charts/other/app-template/tests/secret/metadata_test.yaml index 3a6b76af..59f5a15e 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.1.3 + helm.sh/chart: app-template-1.2.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.1.3 + helm.sh/chart: app-template-1.2.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.1.3 + helm.sh/chart: app-template-1.2.0 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 1c76dd94..9141275d 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.1.3 + helm.sh/chart: app-template-1.2.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.1.3 + helm.sh/chart: app-template-1.2.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.1.3 + helm.sh/chart: app-template-1.2.0 test_label: test