mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-04 17:07:04 +02:00
feat(common): Release common-3.0.2
This commit is contained in:
parent
1e00c7f252
commit
e20623adf9
16 changed files with 127 additions and 22 deletions
|
@ -87,3 +87,21 @@ tests:
|
||||||
equal:
|
equal:
|
||||||
path: metadata.name
|
path: metadata.name
|
||||||
value: RELEASE-NAME-http
|
value: RELEASE-NAME-http
|
||||||
|
|
||||||
|
- it: with templated nameOverride should pass
|
||||||
|
set:
|
||||||
|
configMaps:
|
||||||
|
config:
|
||||||
|
data:
|
||||||
|
test: test
|
||||||
|
nameOverride: "{{ .Release.Name }}"
|
||||||
|
asserts:
|
||||||
|
- hasDocuments:
|
||||||
|
count: 2
|
||||||
|
- documentIndex: &ConfigmapDocument 1
|
||||||
|
isKind:
|
||||||
|
of: ConfigMap
|
||||||
|
- documentIndex: *ConfigmapDocument
|
||||||
|
equal:
|
||||||
|
path: metadata.name
|
||||||
|
value: RELEASE-NAME
|
||||||
|
|
|
@ -56,6 +56,8 @@ tests:
|
||||||
- it: additional controllers with nameOverride should pass
|
- it: additional controllers with nameOverride should pass
|
||||||
set:
|
set:
|
||||||
controllers:
|
controllers:
|
||||||
|
main:
|
||||||
|
nameOverride: "{{ .Release.Name }}"
|
||||||
second:
|
second:
|
||||||
nameOverride: testOverride
|
nameOverride: testOverride
|
||||||
containers:
|
containers:
|
||||||
|
@ -72,7 +74,7 @@ tests:
|
||||||
- documentIndex: *firstDeploymentDoc
|
- documentIndex: *firstDeploymentDoc
|
||||||
equal:
|
equal:
|
||||||
path: metadata.name
|
path: metadata.name
|
||||||
value: RELEASE-NAME-main
|
value: RELEASE-NAME
|
||||||
- documentIndex: *firstDeploymentDoc
|
- documentIndex: *firstDeploymentDoc
|
||||||
equal:
|
equal:
|
||||||
path: metadata.labels['app.kubernetes.io/component']
|
path: metadata.labels['app.kubernetes.io/component']
|
||||||
|
|
|
@ -23,6 +23,32 @@ tests:
|
||||||
path: spec.rules[0].http.paths[0].path
|
path: spec.rules[0].http.paths[0].path
|
||||||
value: "/"
|
value: "/"
|
||||||
|
|
||||||
|
- it: nameOverride should pass
|
||||||
|
set:
|
||||||
|
ingress.main:
|
||||||
|
nameOverride: test
|
||||||
|
asserts:
|
||||||
|
- documentIndex: &IngressDocument 2
|
||||||
|
isKind:
|
||||||
|
of: Ingress
|
||||||
|
- documentIndex: *IngressDocument
|
||||||
|
equal:
|
||||||
|
path: metadata.name
|
||||||
|
value: RELEASE-NAME-test
|
||||||
|
|
||||||
|
- it: nameOverride with template should pass
|
||||||
|
set:
|
||||||
|
ingress.main:
|
||||||
|
nameOverride: "{{ .Release.Name }}"
|
||||||
|
asserts:
|
||||||
|
- documentIndex: &IngressDocument 2
|
||||||
|
isKind:
|
||||||
|
of: Ingress
|
||||||
|
- documentIndex: *IngressDocument
|
||||||
|
equal:
|
||||||
|
path: metadata.name
|
||||||
|
value: RELEASE-NAME
|
||||||
|
|
||||||
- it: custom host and path should pass
|
- it: custom host and path should pass
|
||||||
set:
|
set:
|
||||||
ingress.main:
|
ingress.main:
|
||||||
|
|
|
@ -32,6 +32,20 @@ tests:
|
||||||
path: metadata.name
|
path: metadata.name
|
||||||
value: RELEASE-NAME-http
|
value: RELEASE-NAME-http
|
||||||
|
|
||||||
|
- it: custom name suffix with template should pass
|
||||||
|
values:
|
||||||
|
- ../_values/service_main_default.yaml
|
||||||
|
set:
|
||||||
|
service.main.nameOverride: "{{ .Release.Name }}"
|
||||||
|
asserts:
|
||||||
|
- documentIndex: &ServiceDocument 1
|
||||||
|
isKind:
|
||||||
|
of: Service
|
||||||
|
- documentIndex: *ServiceDocument
|
||||||
|
equal:
|
||||||
|
path: metadata.name
|
||||||
|
value: RELEASE-NAME
|
||||||
|
|
||||||
- it: multiple should pass
|
- it: multiple should pass
|
||||||
values:
|
values:
|
||||||
- ../_values/service_main_default.yaml
|
- ../_values/service_main_default.yaml
|
||||||
|
|
|
@ -3,7 +3,7 @@ apiVersion: v2
|
||||||
name: common
|
name: common
|
||||||
description: Function library for Helm charts
|
description: Function library for Helm charts
|
||||||
type: library
|
type: library
|
||||||
version: 3.0.1
|
version: 3.0.2
|
||||||
kubeVersion: ">=1.22.0-0"
|
kubeVersion: ">=1.22.0-0"
|
||||||
keywords:
|
keywords:
|
||||||
- common
|
- common
|
||||||
|
@ -14,6 +14,9 @@ maintainers:
|
||||||
email: me@bjw-s.dev
|
email: me@bjw-s.dev
|
||||||
annotations:
|
annotations:
|
||||||
artifacthub.io/changes: |-
|
artifacthub.io/changes: |-
|
||||||
|
- kind: fixed
|
||||||
|
description: |-
|
||||||
|
Fixed nameOverride logic to prevent duplicated name
|
||||||
- kind: changed
|
- kind: changed
|
||||||
description: |-
|
description: |-
|
||||||
BREAKING: Default objects (they used to be called main) have been commented out and will therefore no longer provide any (both expected and unexpected) default values.
|
BREAKING: Default objects (they used to be called main) have been commented out and will therefore no longer provide any (both expected and unexpected) default values.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# common
|
# common
|
||||||
|
|
||||||
 
|
 
|
||||||
|
|
||||||
Function library for Helm charts
|
Function library for Helm charts
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ Include this chart as a dependency in your `Chart.yaml` e.g.
|
||||||
# Chart.yaml
|
# Chart.yaml
|
||||||
dependencies:
|
dependencies:
|
||||||
- name: common
|
- name: common
|
||||||
version: 3.0.1
|
version: 3.0.2
|
||||||
repository: https://bjw-s.github.io/helm-charts/
|
repository: https://bjw-s.github.io/helm-charts/
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -10,10 +10,15 @@ Convert configMap values to an object
|
||||||
{{- $objectName := (include "bjw-s.common.lib.chart.names.fullname" $rootContext) -}}
|
{{- $objectName := (include "bjw-s.common.lib.chart.names.fullname" $rootContext) -}}
|
||||||
|
|
||||||
{{- if $objectValues.nameOverride -}}
|
{{- if $objectValues.nameOverride -}}
|
||||||
{{- $objectName = printf "%s-%s" $objectName $objectValues.nameOverride -}}
|
{{- $override := tpl $objectValues.nameOverride $rootContext -}}
|
||||||
|
{{- if not (eq $objectName $override) -}}
|
||||||
|
{{- $objectName = printf "%s-%s" $objectName $override -}}
|
||||||
|
{{- end -}}
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
|
{{- if not (eq $objectName $identifier) -}}
|
||||||
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
{{- $_ := set $objectValues "name" $objectName -}}
|
{{- $_ := set $objectValues "name" $objectName -}}
|
||||||
{{- $_ := set $objectValues "identifier" $identifier -}}
|
{{- $_ := set $objectValues "identifier" $identifier -}}
|
||||||
|
|
||||||
|
|
|
@ -15,13 +15,18 @@ Convert controller values to an object
|
||||||
{{- $objectName := (include "bjw-s.common.lib.chart.names.fullname" $rootContext) -}}
|
{{- $objectName := (include "bjw-s.common.lib.chart.names.fullname" $rootContext) -}}
|
||||||
|
|
||||||
{{- if $objectValues.nameOverride -}}
|
{{- if $objectValues.nameOverride -}}
|
||||||
{{- $objectName = printf "%s-%s" $objectName $objectValues.nameOverride -}}
|
{{- $override := tpl $objectValues.nameOverride $rootContext -}}
|
||||||
|
{{- if not (eq $objectName $override) -}}
|
||||||
|
{{- $objectName = printf "%s-%s" $objectName $override -}}
|
||||||
|
{{- end -}}
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
{{- $enabledControllers := (include "bjw-s.common.lib.controller.enabledControllers" (dict "rootContext" $rootContext) | fromYaml ) }}
|
{{- $enabledControllers := (include "bjw-s.common.lib.controller.enabledControllers" (dict "rootContext" $rootContext) | fromYaml ) }}
|
||||||
{{- if gt (len $enabledControllers) 1 -}}
|
{{- if gt (len $enabledControllers) 1 -}}
|
||||||
|
{{- if not (eq $objectName $identifier) -}}
|
||||||
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
{{- $_ := set $objectValues "name" $objectName -}}
|
{{- $_ := set $objectValues "name" $objectName -}}
|
||||||
{{- $_ := set $objectValues "identifier" $identifier -}}
|
{{- $_ := set $objectValues "identifier" $identifier -}}
|
||||||
|
|
||||||
|
|
|
@ -10,13 +10,18 @@ Convert ingress values to an object
|
||||||
{{- $objectName := (include "bjw-s.common.lib.chart.names.fullname" $rootContext) -}}
|
{{- $objectName := (include "bjw-s.common.lib.chart.names.fullname" $rootContext) -}}
|
||||||
|
|
||||||
{{- if $objectValues.nameOverride -}}
|
{{- if $objectValues.nameOverride -}}
|
||||||
{{- $objectName = printf "%s-%s" $objectName $objectValues.nameOverride -}}
|
{{- $override := tpl $objectValues.nameOverride $rootContext -}}
|
||||||
|
{{- if not (eq $objectName $override) -}}
|
||||||
|
{{- $objectName = printf "%s-%s" $objectName $override -}}
|
||||||
|
{{- end -}}
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
{{- $enabledIngresses := (include "bjw-s.common.lib.ingress.enabledIngresses" (dict "rootContext" $rootContext) | fromYaml ) }}
|
{{- $enabledIngresses := (include "bjw-s.common.lib.ingress.enabledIngresses" (dict "rootContext" $rootContext) | fromYaml ) }}
|
||||||
{{- if gt (len $enabledIngresses) 1 -}}
|
{{- if gt (len $enabledIngresses) 1 -}}
|
||||||
|
{{- if not (eq $objectName $identifier) -}}
|
||||||
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
{{- $_ := set $objectValues "name" $objectName -}}
|
{{- $_ := set $objectValues "name" $objectName -}}
|
||||||
{{- $_ := set $objectValues "identifier" $identifier -}}
|
{{- $_ := set $objectValues "identifier" $identifier -}}
|
||||||
|
|
||||||
|
|
|
@ -10,13 +10,18 @@ Convert networkPolicy values to an object
|
||||||
{{- $objectName := (include "bjw-s.common.lib.chart.names.fullname" $rootContext) -}}
|
{{- $objectName := (include "bjw-s.common.lib.chart.names.fullname" $rootContext) -}}
|
||||||
|
|
||||||
{{- if $objectValues.nameOverride -}}
|
{{- if $objectValues.nameOverride -}}
|
||||||
{{- $objectName = printf "%s-%s" $objectName $objectValues.nameOverride -}}
|
{{- $override := tpl $objectValues.nameOverride $rootContext -}}
|
||||||
|
{{- if not (eq $objectName $override) -}}
|
||||||
|
{{- $objectName = printf "%s-%s" $objectName $override -}}
|
||||||
|
{{- end -}}
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
{{- $enabledNetworkPolicies := (include "bjw-s.common.lib.networkPolicy.enabledNetworkPolicies" (dict "rootContext" $rootContext) | fromYaml ) }}
|
{{- $enabledNetworkPolicies := (include "bjw-s.common.lib.networkPolicy.enabledNetworkPolicies" (dict "rootContext" $rootContext) | fromYaml ) }}
|
||||||
{{- if gt (len $enabledNetworkPolicies) 1 -}}
|
{{- if gt (len $enabledNetworkPolicies) 1 -}}
|
||||||
|
{{- if not (eq $objectName $identifier) -}}
|
||||||
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
{{- $_ := set $objectValues "name" $objectName -}}
|
{{- $_ := set $objectValues "name" $objectName -}}
|
||||||
{{- $_ := set $objectValues "identifier" $identifier -}}
|
{{- $_ := set $objectValues "identifier" $identifier -}}
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,10 @@ Convert PVC values to an object
|
||||||
{{- $objectName = printf "%s-%s" $objectName $objectValues.nameOverride -}}
|
{{- $objectName = printf "%s-%s" $objectName $objectValues.nameOverride -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
|
{{- if not (eq $objectName $identifier) -}}
|
||||||
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
{{- $_ := set $objectValues "name" $objectName -}}
|
{{- $_ := set $objectValues "name" $objectName -}}
|
||||||
{{- $_ := set $objectValues "identifier" $identifier -}}
|
{{- $_ := set $objectValues "identifier" $identifier -}}
|
||||||
|
|
||||||
|
|
|
@ -10,12 +10,17 @@ Convert Route values to an object
|
||||||
{{- $objectName := (include "bjw-s.common.lib.chart.names.fullname" $rootContext) -}}
|
{{- $objectName := (include "bjw-s.common.lib.chart.names.fullname" $rootContext) -}}
|
||||||
|
|
||||||
{{- if $objectValues.nameOverride -}}
|
{{- if $objectValues.nameOverride -}}
|
||||||
{{- $objectName = printf "%s-%s" $objectName $objectValues.nameOverride -}}
|
{{- $override := tpl $objectValues.nameOverride $rootContext -}}
|
||||||
|
{{- if not (eq $objectName $override) -}}
|
||||||
|
{{- $objectName = printf "%s-%s" $objectName $override -}}
|
||||||
|
{{- end -}}
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
{{- if ne $identifier (include "bjw-s.common.lib.route.primary" $rootContext) -}}
|
{{- if ne $identifier (include "bjw-s.common.lib.route.primary" $rootContext) -}}
|
||||||
|
{{- if not (eq $objectName $identifier) -}}
|
||||||
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
{{- $_ := set $objectValues "name" $objectName -}}
|
{{- $_ := set $objectValues "name" $objectName -}}
|
||||||
{{- $_ := set $objectValues "identifier" $identifier -}}
|
{{- $_ := set $objectValues "identifier" $identifier -}}
|
||||||
|
|
||||||
|
|
|
@ -10,10 +10,15 @@ Convert Secret values to an object
|
||||||
{{- $objectName := (include "bjw-s.common.lib.chart.names.fullname" $rootContext) -}}
|
{{- $objectName := (include "bjw-s.common.lib.chart.names.fullname" $rootContext) -}}
|
||||||
|
|
||||||
{{- if $objectValues.nameOverride -}}
|
{{- if $objectValues.nameOverride -}}
|
||||||
{{- $objectName = printf "%s-%s" $objectName $objectValues.nameOverride -}}
|
{{- $override := tpl $objectValues.nameOverride $rootContext -}}
|
||||||
|
{{- if not (eq $objectName $override) -}}
|
||||||
|
{{- $objectName = printf "%s-%s" $objectName $override -}}
|
||||||
|
{{- end -}}
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
|
{{- if not (eq $objectName $identifier) -}}
|
||||||
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
{{- $_ := set $objectValues "name" $objectName -}}
|
{{- $_ := set $objectValues "name" $objectName -}}
|
||||||
{{- $_ := set $objectValues "identifier" $identifier -}}
|
{{- $_ := set $objectValues "identifier" $identifier -}}
|
||||||
|
|
||||||
|
|
|
@ -10,13 +10,18 @@ Convert Service values to an object
|
||||||
{{- $objectName := (include "bjw-s.common.lib.chart.names.fullname" $rootContext) -}}
|
{{- $objectName := (include "bjw-s.common.lib.chart.names.fullname" $rootContext) -}}
|
||||||
|
|
||||||
{{- if $objectValues.nameOverride -}}
|
{{- if $objectValues.nameOverride -}}
|
||||||
{{- $objectName = printf "%s-%s" $objectName $objectValues.nameOverride -}}
|
{{- $override := tpl $objectValues.nameOverride $rootContext -}}
|
||||||
|
{{- if not (eq $objectName $override) -}}
|
||||||
|
{{- $objectName = printf "%s-%s" $objectName $override -}}
|
||||||
|
{{- end -}}
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
{{- $enabledServices := (include "bjw-s.common.lib.service.enabledServices" (dict "rootContext" $rootContext) | fromYaml ) }}
|
{{- $enabledServices := (include "bjw-s.common.lib.service.enabledServices" (dict "rootContext" $rootContext) | fromYaml ) }}
|
||||||
{{- if and (not $objectValues.primary) (gt (len $enabledServices) 1) -}}
|
{{- if and (not $objectValues.primary) (gt (len $enabledServices) 1) -}}
|
||||||
|
{{- if not (eq $objectName $identifier) -}}
|
||||||
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
{{- $_ := set $objectValues "name" $objectName -}}
|
{{- $_ := set $objectValues "name" $objectName -}}
|
||||||
{{- $_ := set $objectValues "identifier" $identifier -}}
|
{{- $_ := set $objectValues "identifier" $identifier -}}
|
||||||
|
|
||||||
|
|
|
@ -10,13 +10,18 @@ Convert ServiceMonitor values to an object
|
||||||
{{- $objectName := (include "bjw-s.common.lib.chart.names.fullname" $rootContext) -}}
|
{{- $objectName := (include "bjw-s.common.lib.chart.names.fullname" $rootContext) -}}
|
||||||
|
|
||||||
{{- if $objectValues.nameOverride -}}
|
{{- if $objectValues.nameOverride -}}
|
||||||
{{- $objectName = printf "%s-%s" $objectName $objectValues.nameOverride -}}
|
{{- $override := tpl $objectValues.nameOverride $rootContext -}}
|
||||||
|
{{- if not (eq $objectName $override) -}}
|
||||||
|
{{- $objectName = printf "%s-%s" $objectName $override -}}
|
||||||
|
{{- end -}}
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
{{- $enabledServiceMonitors := (include "bjw-s.common.lib.serviceMonitor.enabledServiceMonitors" (dict "rootContext" $rootContext) | fromYaml ) }}
|
{{- $enabledServiceMonitors := (include "bjw-s.common.lib.serviceMonitor.enabledServiceMonitors" (dict "rootContext" $rootContext) | fromYaml ) }}
|
||||||
{{- if gt (len $enabledServiceMonitors) 1 -}}
|
{{- if gt (len $enabledServiceMonitors) 1 -}}
|
||||||
|
{{- if not (eq $objectName $identifier) -}}
|
||||||
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
{{- $_ := set $objectValues "name" $objectName -}}
|
{{- $_ := set $objectValues "name" $objectName -}}
|
||||||
{{- $_ := set $objectValues "identifier" $identifier -}}
|
{{- $_ := set $objectValues "identifier" $identifier -}}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"$schema": "http://json-schema.org/draft-07/schema",
|
"$schema": "http://json-schema.org/draft-07/schema",
|
||||||
"$id": "https://raw.githubusercontent.com/bjw-s/helm-charts/common-3.0.1/charts/library/common/values.schema.json",
|
"$id": "https://raw.githubusercontent.com/bjw-s/helm-charts/common-3.0.2/charts/library/common/values.schema.json",
|
||||||
|
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue