Files
charts/bitnami/neo4j/templates/_helpers.tpl
T
e74b9ca8c8 [bitnami/neo4j] Add chart (#27616)
* [bitnami/neo4j] Add chart

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

* Add support for readOnlyRootFilesystem, use development image

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

* Remove serviceMonitor

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

* Add VIB tests and image improvements

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

* Add neo4j host

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

* Update chart

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

* Fix values metadata

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

* Update CHANGELOG.md

Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>

* Update README.md with readme-generator-for-helm

Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>

* Fix test inputs

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

* Add TLS support

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

* Change readiness

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

* Update README metadata

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

* Update README.md with readme-generator-for-helm

Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>

* Update test service ports

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

* Add goss https test

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

* Fix goss vars file

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

* Update dev image

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

* Update CHANGELOG.md

Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>

* Increase timeout

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

* Change bolt port

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

* Use bitnami/neo4j:5.20.0-debian-12-r2

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

* Modify TLS secrets

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

* Update CHANGELOG.md

Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>

* Add ingress-tls-secret.yaml

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

---------

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>
Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>
Co-authored-by: Bitnami Containers <bitnami-bot@vmware.com>
2024-07-04 13:49:18 +02:00

165 lines
5.2 KiB
Smarty

{{/*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{/*
Return the proper neo4j image name
*/}}
{{- define "neo4j.image" -}}
{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }}
{{- end -}}
{{/*
Return the proper image name (for the init container volume-permissions image)
*/}}
{{- define "neo4j.volumePermissions.image" -}}
{{- include "common.images.image" ( dict "imageRoot" .Values.volumePermissions.image "global" .Values.global ) -}}
{{- end -}}
{{/*
Return the proper Docker Image Registry Secret Names
*/}}
{{- define "neo4j.imagePullSecrets" -}}
{{- include "common.images.renderPullSecrets" (dict "images" (list .Values.image .Values.volumePermissions.image) "context" $) -}}
{{- end -}}
{{/*
Create the name of the service account to use
*/}}
{{- define "neo4j.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "common.names.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}
{{/*
Get the secret name
*/}}
{{- define "neo4j.secretName" -}}
{{- if .Values.auth.existingSecret -}}
{{- printf "%s" .Values.auth.existingSecret -}}
{{- else -}}
{{- printf "%s" (include "common.names.fullname" .) -}}
{{- end -}}
{{- end -}}
{{/*
Return true if cert-manager required annotations for TLS signed certificates are set in the Ingress annotations
Ref: https://cert-manager.io/docs/usage/ingress/#supported-annotations
*/}}
{{- define "neo4j.ingress.certManagerRequest" -}}
{{ if or (hasKey . "cert-manager.io/cluster-issuer") (hasKey . "cert-manager.io/issuer") }}
{{- true -}}
{{- end -}}
{{- end -}}
{{/*
Get the user defined LoadBalancerIP for this release.
Note, returns 127.0.0.1 if using ClusterIP.
*/}}
{{- define "neo4j.serviceIP" -}}
{{- if eq .Values.service.type "ClusterIP" -}}
127.0.0.1
{{- else -}}
{{- .Values.service.loadBalancerIP | default "" -}}
{{- end -}}
{{- end -}}
{{/*
Gets the host to be used for this application.
If not using ClusterIP, or if a host or LoadBalancerIP is not defined, the value will be empty.
When using Ingress, it will be set to the Ingress hostname.
*/}}
{{- define "neo4j.host" -}}
{{- if and .Values.ingress.enabled .Values.ingress.hostname }}
{{- print .Values.ingress.hostname -}}
{{- else if .Values.advertisedHost -}}
{{- print .Values.advertisedHost -}}
{{- else -}}
{{- print (include "neo4j.serviceIP" .) -}}
{{- end -}}
{{- end -}}
{{/*
Return the Neo4j configuration configmap.
*/}}
{{- define "neo4j.configMapName" -}}
{{- if .Values.existingConfigmap -}}
{{- print (tpl .Values.existingConfigmap $) -}}
{{- else -}}
{{- print (include "common.names.fullname" .) -}}
{{- end -}}
{{- end -}}
{{/*
Returns true if Neo4j Bolt TLS is enabled.
*/}}
{{- define "neo4j.tls.bolt.enabled" -}}
{{- if or (eq (upper .Values.tls.bolt.level) "REQUIRED") (eq (upper .Values.tls.bolt.level) "OPTIONAL") -}}
{{- true -}}
{{- end -}}
{{- end -}}
{{/*
Neo4j HTTPS TLS secret name.
*/}}
{{- define "neo4j.tls.https.secretName" -}}
{{- coalesce .Values.tls.https.existingSecret (printf "%s-https-certs" (include "common.names.fullname" .)) -}}
{{- end -}}
{{/*
Neo4j Bolt TLS secret name.
*/}}
{{- define "neo4j.tls.bolt.secretName" -}}
{{- coalesce .Values.tls.bolt.existingSecret (printf "%s-bolt-certs" (include "common.names.fullname" .)) -}}
{{- end -}}
{{/*
Validates the value provided for Bolt TLS level.
*/}}
{{- define "neo4j.validateValues.tls.bolt.level" -}}
{{- if not (or (eq (upper .Values.tls.bolt.level) "REQUIRED") (eq (upper .Values.tls.bolt.level) "OPTIONAL") (eq (upper .Values.tls.bolt.level) "DISABLED")) -}}
neo4j: tls.bolt.level
The value tls.bolt.level must be either 'REQUIRED', 'OPTIONAL' or 'DISABLED'
{{- end -}}
{{- end -}}
{{/*
Validate Bolt certificates have been provided if TLS enabled.
*/}}
{{- define "neo4j.validateValues.tls.bolt.enabled" -}}
{{- if and (include "neo4j.tls.bolt.enabled" .) (not .Values.tls.bolt.autoGenerated) (not .Values.tls.bolt.existingSecret) -}}
neo4j: tls.https.enabled
The value tls.bolt.level has been set to 'REQUIRED' or 'OPTIONAL', but neither 'tls.bolt.existingSecret' or 'tls.bolt.autoGenerated' have been provided
{{- end -}}
{{- end -}}
{{/*
Validate HTTPS certificates have been provided if enabled.
*/}}
{{- define "neo4j.validateValues.tls.https.enabled" -}}
{{- if and .Values.tls.https.enabled (not .Values.tls.https.autoGenerated) (not .Values.tls.https.existingSecret) -}}
neo4j: tls.https.enabled
The value tls.https.enabled has been set to 'true', but neither 'tls.https.existingSecret' or 'tls.https.autoGenerated' have been provided
{{- end -}}
{{- end -}}
{{/*
Compile all warnings into a single message.
*/}}
{{- define "neo4j.validateValues" -}}
{{- $messages := list -}}
{{- $messages := without $messages "" -}}
{{- $messages := append $messages (include "neo4j.validateValues.tls.bolt.level" .) -}}
{{- $messages := append $messages (include "neo4j.validateValues.tls.bolt.enabled" .) -}}
{{- $messages := append $messages (include "neo4j.validateValues.tls.https.enabled" .) -}}
{{- $message := join "\n" $messages -}}
{{- if $message -}}
{{- printf "\nVALUES VALIDATION:\n%s" $message -}}
{{- end -}}
{{- end -}}