mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-04 00:47: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:
|
||||
path: metadata.name
|
||||
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
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
nameOverride: "{{ .Release.Name }}"
|
||||
second:
|
||||
nameOverride: testOverride
|
||||
containers:
|
||||
|
@ -72,7 +74,7 @@ tests:
|
|||
- documentIndex: *firstDeploymentDoc
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-main
|
||||
value: RELEASE-NAME
|
||||
- documentIndex: *firstDeploymentDoc
|
||||
equal:
|
||||
path: metadata.labels['app.kubernetes.io/component']
|
||||
|
|
|
@ -23,6 +23,32 @@ tests:
|
|||
path: spec.rules[0].http.paths[0].path
|
||||
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
|
||||
set:
|
||||
ingress.main:
|
||||
|
|
|
@ -32,6 +32,20 @@ tests:
|
|||
path: metadata.name
|
||||
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
|
||||
values:
|
||||
- ../_values/service_main_default.yaml
|
||||
|
|
|
@ -3,7 +3,7 @@ apiVersion: v2
|
|||
name: common
|
||||
description: Function library for Helm charts
|
||||
type: library
|
||||
version: 3.0.1
|
||||
version: 3.0.2
|
||||
kubeVersion: ">=1.22.0-0"
|
||||
keywords:
|
||||
- common
|
||||
|
@ -14,6 +14,9 @@ maintainers:
|
|||
email: me@bjw-s.dev
|
||||
annotations:
|
||||
artifacthub.io/changes: |-
|
||||
- kind: fixed
|
||||
description: |-
|
||||
Fixed nameOverride logic to prevent duplicated name
|
||||
- kind: changed
|
||||
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.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# common
|
||||
|
||||
 
|
||||
 
|
||||
|
||||
Function library for Helm charts
|
||||
|
||||
|
@ -27,7 +27,7 @@ Include this chart as a dependency in your `Chart.yaml` e.g.
|
|||
# Chart.yaml
|
||||
dependencies:
|
||||
- name: common
|
||||
version: 3.0.1
|
||||
version: 3.0.2
|
||||
repository: https://bjw-s.github.io/helm-charts/
|
||||
```
|
||||
|
||||
|
|
|
@ -10,9 +10,14 @@ Convert configMap values to an object
|
|||
{{- $objectName := (include "bjw-s.common.lib.chart.names.fullname" $rootContext) -}}
|
||||
|
||||
{{- 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 -}}
|
||||
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
||||
{{- if not (eq $objectName $identifier) -}}
|
||||
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $_ := set $objectValues "name" $objectName -}}
|
||||
{{- $_ := set $objectValues "identifier" $identifier -}}
|
||||
|
|
|
@ -15,11 +15,16 @@ Convert controller values to an object
|
|||
{{- $objectName := (include "bjw-s.common.lib.chart.names.fullname" $rootContext) -}}
|
||||
|
||||
{{- 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 -}}
|
||||
{{- $enabledControllers := (include "bjw-s.common.lib.controller.enabledControllers" (dict "rootContext" $rootContext) | fromYaml ) }}
|
||||
{{- if gt (len $enabledControllers) 1 -}}
|
||||
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
||||
{{- if not (eq $objectName $identifier) -}}
|
||||
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $_ := set $objectValues "name" $objectName -}}
|
||||
|
|
|
@ -10,11 +10,16 @@ Convert ingress values to an object
|
|||
{{- $objectName := (include "bjw-s.common.lib.chart.names.fullname" $rootContext) -}}
|
||||
|
||||
{{- 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 -}}
|
||||
{{- $enabledIngresses := (include "bjw-s.common.lib.ingress.enabledIngresses" (dict "rootContext" $rootContext) | fromYaml ) }}
|
||||
{{- if gt (len $enabledIngresses) 1 -}}
|
||||
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
||||
{{- if not (eq $objectName $identifier) -}}
|
||||
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $_ := set $objectValues "name" $objectName -}}
|
||||
|
|
|
@ -10,11 +10,16 @@ Convert networkPolicy values to an object
|
|||
{{- $objectName := (include "bjw-s.common.lib.chart.names.fullname" $rootContext) -}}
|
||||
|
||||
{{- 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 -}}
|
||||
{{- $enabledNetworkPolicies := (include "bjw-s.common.lib.networkPolicy.enabledNetworkPolicies" (dict "rootContext" $rootContext) | fromYaml ) }}
|
||||
{{- if gt (len $enabledNetworkPolicies) 1 -}}
|
||||
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
||||
{{- if not (eq $objectName $identifier) -}}
|
||||
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $_ := set $objectValues "name" $objectName -}}
|
||||
|
|
|
@ -14,7 +14,9 @@ Convert PVC values to an object
|
|||
{{- $objectName = printf "%s-%s" $objectName $objectValues.nameOverride -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
||||
{{- if not (eq $objectName $identifier) -}}
|
||||
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $_ := set $objectValues "name" $objectName -}}
|
||||
{{- $_ := set $objectValues "identifier" $identifier -}}
|
||||
|
|
|
@ -10,10 +10,15 @@ Convert Route values to an object
|
|||
{{- $objectName := (include "bjw-s.common.lib.chart.names.fullname" $rootContext) -}}
|
||||
|
||||
{{- 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 -}}
|
||||
{{- if ne $identifier (include "bjw-s.common.lib.route.primary" $rootContext) -}}
|
||||
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
||||
{{- if not (eq $objectName $identifier) -}}
|
||||
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $_ := set $objectValues "name" $objectName -}}
|
||||
|
|
|
@ -10,9 +10,14 @@ Convert Secret values to an object
|
|||
{{- $objectName := (include "bjw-s.common.lib.chart.names.fullname" $rootContext) -}}
|
||||
|
||||
{{- 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 -}}
|
||||
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
||||
{{- if not (eq $objectName $identifier) -}}
|
||||
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $_ := set $objectValues "name" $objectName -}}
|
||||
{{- $_ := set $objectValues "identifier" $identifier -}}
|
||||
|
|
|
@ -10,11 +10,16 @@ Convert Service values to an object
|
|||
{{- $objectName := (include "bjw-s.common.lib.chart.names.fullname" $rootContext) -}}
|
||||
|
||||
{{- 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 -}}
|
||||
{{- $enabledServices := (include "bjw-s.common.lib.service.enabledServices" (dict "rootContext" $rootContext) | fromYaml ) }}
|
||||
{{- if and (not $objectValues.primary) (gt (len $enabledServices) 1) -}}
|
||||
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
||||
{{- if not (eq $objectName $identifier) -}}
|
||||
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $_ := set $objectValues "name" $objectName -}}
|
||||
|
|
|
@ -10,11 +10,16 @@ Convert ServiceMonitor values to an object
|
|||
{{- $objectName := (include "bjw-s.common.lib.chart.names.fullname" $rootContext) -}}
|
||||
|
||||
{{- 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 -}}
|
||||
{{- $enabledServiceMonitors := (include "bjw-s.common.lib.serviceMonitor.enabledServiceMonitors" (dict "rootContext" $rootContext) | fromYaml ) }}
|
||||
{{- if gt (len $enabledServiceMonitors) 1 -}}
|
||||
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
||||
{{- if not (eq $objectName $identifier) -}}
|
||||
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $_ := set $objectValues "name" $objectName -}}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"$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",
|
||||
"properties": {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue