add valkey for clusterwide session/cache
This commit is contained in:
parent
7956524b1e
commit
825844cac8
@ -1,3 +1,6 @@
|
||||
longhorn is the default storage provider in this cluster. By default, its
|
||||
replicates storage 3 times which is redundant as the postgresql does
|
||||
application level replication
|
||||
application level replication.
|
||||
|
||||
cnpg will create secrets containing login passwords in the same namespace it
|
||||
was deployed
|
||||
|
25
manifests/valkey/.helmignore
Normal file
25
manifests/valkey/.helmignore
Normal file
@ -0,0 +1,25 @@
|
||||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
# Common VCS dirs
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
# Common backup files
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
||||
# img folder
|
||||
img/
|
||||
# Changelog
|
||||
CHANGELOG.md
|
6
manifests/valkey/Chart.lock
Normal file
6
manifests/valkey/Chart.lock
Normal file
@ -0,0 +1,6 @@
|
||||
dependencies:
|
||||
- name: common
|
||||
repository: oci://registry-1.docker.io/bitnamicharts
|
||||
version: 2.31.0
|
||||
digest: sha256:c4c9af4e0ca23cf2c549e403b2a2bba2c53a3557cee23da09fa4cdf710044c2c
|
||||
generated: "2025-05-06T11:10:52.127470134+02:00"
|
39
manifests/valkey/Chart.yaml
Normal file
39
manifests/valkey/Chart.yaml
Normal file
@ -0,0 +1,39 @@
|
||||
annotations:
|
||||
category: Database
|
||||
images: |
|
||||
- name: kubectl
|
||||
image: docker.io/bitnami/kubectl:1.33.1-debian-12-r2
|
||||
- name: os-shell
|
||||
image: docker.io/bitnami/os-shell:12-debian-12-r45
|
||||
- name: redis-exporter
|
||||
image: docker.io/bitnami/redis-exporter:1.73.0-debian-12-r0
|
||||
- name: valkey
|
||||
image: docker.io/bitnami/valkey:8.1.1-debian-12-r1
|
||||
- name: valkey-sentinel
|
||||
image: docker.io/bitnami/valkey-sentinel:8.1.1-debian-12-r1
|
||||
licenses: Apache-2.0
|
||||
tanzuCategory: service
|
||||
apiVersion: v2
|
||||
appVersion: 8.1.1
|
||||
dependencies:
|
||||
- name: common
|
||||
repository: oci://registry-1.docker.io/bitnamicharts
|
||||
tags:
|
||||
- bitnami-common
|
||||
version: 2.x.x
|
||||
description: Valkey is an open source (BSD) high-performance key/value datastore that
|
||||
supports a variety workloads such as caching, message queues, and can act as a primary
|
||||
database.
|
||||
home: https://bitnami.com
|
||||
icon: https://dyltqmyl993wv.cloudfront.net/assets/stacks/valkey/img/valkey-stack-220x234.png
|
||||
keywords:
|
||||
- valkey
|
||||
- keyvalue
|
||||
- database
|
||||
maintainers:
|
||||
- name: Broadcom, Inc. All Rights Reserved.
|
||||
url: https://github.com/bitnami/charts
|
||||
name: valkey
|
||||
sources:
|
||||
- https://github.com/bitnami/charts/tree/main/bitnami/valkey
|
||||
version: 3.0.9
|
1081
manifests/valkey/README.md
Normal file
1081
manifests/valkey/README.md
Normal file
File diff suppressed because it is too large
Load Diff
26
manifests/valkey/charts/common/.helmignore
Normal file
26
manifests/valkey/charts/common/.helmignore
Normal file
@ -0,0 +1,26 @@
|
||||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
# Common VCS dirs
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
# Common backup files
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
||||
.vscode/
|
||||
# img folder
|
||||
img/
|
||||
# Changelog
|
||||
CHANGELOG.md
|
23
manifests/valkey/charts/common/Chart.yaml
Normal file
23
manifests/valkey/charts/common/Chart.yaml
Normal file
@ -0,0 +1,23 @@
|
||||
annotations:
|
||||
category: Infrastructure
|
||||
licenses: Apache-2.0
|
||||
apiVersion: v2
|
||||
appVersion: 2.31.0
|
||||
description: A Library Helm Chart for grouping common logic between bitnami charts.
|
||||
This chart is not deployable by itself.
|
||||
home: https://bitnami.com
|
||||
icon: https://dyltqmyl993wv.cloudfront.net/downloads/logos/bitnami-mark.png
|
||||
keywords:
|
||||
- common
|
||||
- helper
|
||||
- template
|
||||
- function
|
||||
- bitnami
|
||||
maintainers:
|
||||
- name: Broadcom, Inc. All Rights Reserved.
|
||||
url: https://github.com/bitnami/charts
|
||||
name: common
|
||||
sources:
|
||||
- https://github.com/bitnami/charts/tree/main/bitnami/common
|
||||
type: library
|
||||
version: 2.31.0
|
381
manifests/valkey/charts/common/README.md
Normal file
381
manifests/valkey/charts/common/README.md
Normal file
@ -0,0 +1,381 @@
|
||||
# Bitnami Common Library Chart
|
||||
|
||||
A [Helm Library Chart](https://helm.sh/docs/topics/library_charts/#helm) for grouping common logic between Bitnami charts.
|
||||
|
||||
## TL;DR
|
||||
|
||||
```yaml
|
||||
dependencies:
|
||||
- name: common
|
||||
version: 2.x.x
|
||||
repository: oci://registry-1.docker.io/bitnamicharts
|
||||
```
|
||||
|
||||
```console
|
||||
helm dependency update
|
||||
```
|
||||
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "common.names.fullname" . }}
|
||||
data:
|
||||
myvalue: "Hello World"
|
||||
```
|
||||
|
||||
Looking to use our applications in production? Try [VMware Tanzu Application Catalog](https://bitnami.com/enterprise), the commercial edition of the Bitnami catalog.
|
||||
|
||||
## Introduction
|
||||
|
||||
This chart provides a common template helpers which can be used to develop new charts using [Helm](https://helm.sh) package manager.
|
||||
|
||||
Bitnami charts can be used with [Kubeapps](https://kubeapps.dev/) for deployment and management of Helm Charts in clusters.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Kubernetes 1.23+
|
||||
- Helm 3.8.0+
|
||||
|
||||
## Parameters
|
||||
|
||||
The following table lists the helpers available in the library which are scoped in different sections.
|
||||
|
||||
### Affinities
|
||||
|
||||
| Helper identifier | Description | Expected Input |
|
||||
| ------------------------------- | ---------------------------------------------------- | ------------------------------------------------------------ |
|
||||
| `common.affinities.nodes.soft` | Return a soft nodeAffinity definition | `dict "key" "FOO" "values" (list "BAR" "BAZ")` |
|
||||
| `common.affinities.nodes.hard` | Return a hard nodeAffinity definition | `dict "key" "FOO" "values" (list "BAR" "BAZ")` |
|
||||
| `common.affinities.nodes` | Return a nodeAffinity definition | `dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")` |
|
||||
| `common.affinities.topologyKey` | Return a topologyKey definition | `dict "topologyKey" "FOO"` |
|
||||
| `common.affinities.pods.soft` | Return a soft podAffinity/podAntiAffinity definition | `dict "component" "FOO" "context" $` |
|
||||
| `common.affinities.pods.hard` | Return a hard podAffinity/podAntiAffinity definition | `dict "component" "FOO" "context" $` |
|
||||
| `common.affinities.pods` | Return a podAffinity/podAntiAffinity definition | `dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")` |
|
||||
|
||||
### Capabilities
|
||||
|
||||
| Helper identifier | Description | Expected Input |
|
||||
| --------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | --------------------------------------- |
|
||||
| `common.capabilities.kubeVersion` | Return the target Kubernetes version (using client default if .Values.kubeVersion is not set). | `.` Chart context |
|
||||
| `common.capabilities.apiVersions.has` | Return true if the apiVersion is supported | `dict "version" "batch/v1" "context" $` |
|
||||
| `common.capabilities.job.apiVersion` | Return the appropriate apiVersion for job. | `.` Chart context |
|
||||
| `common.capabilities.cronjob.apiVersion` | Return the appropriate apiVersion for cronjob. | `.` Chart context |
|
||||
| `common.capabilities.daemonset.apiVersion` | Return the appropriate apiVersion for daemonset. | `.` Chart context |
|
||||
| `common.capabilities.cronjob.apiVersion` | Return the appropriate apiVersion for cronjob. | `.` Chart context |
|
||||
| `common.capabilities.deployment.apiVersion` | Return the appropriate apiVersion for deployment. | `.` Chart context |
|
||||
| `common.capabilities.statefulset.apiVersion` | Return the appropriate apiVersion for statefulset. | `.` Chart context |
|
||||
| `common.capabilities.ingress.apiVersion` | Return the appropriate apiVersion for ingress. | `.` Chart context |
|
||||
| `common.capabilities.rbac.apiVersion` | Return the appropriate apiVersion for RBAC resources. | `.` Chart context |
|
||||
| `common.capabilities.crd.apiVersion` | Return the appropriate apiVersion for CRDs. | `.` Chart context |
|
||||
| `common.capabilities.policy.apiVersion` | Return the appropriate apiVersion for podsecuritypolicy. | `.` Chart context |
|
||||
| `common.capabilities.networkPolicy.apiVersion` | Return the appropriate apiVersion for networkpolicy. | `.` Chart context |
|
||||
| `common.capabilities.apiService.apiVersion` | Return the appropriate apiVersion for APIService. | `.` Chart context |
|
||||
| `common.capabilities.hpa.apiVersion` | Return the appropriate apiVersion for Horizontal Pod Autoscaler | `.` Chart context |
|
||||
| `common.capabilities.vpa.apiVersion` | Return the appropriate apiVersion for Vertical Pod Autoscaler. | `.` Chart context |
|
||||
| `common.capabilities.psp.supported` | Returns true if PodSecurityPolicy is supported | `.` Chart context |
|
||||
| `common.capabilities.supportsHelmVersion` | Returns true if the used Helm version is 3.3+ | `.` Chart context |
|
||||
| `common.capabilities.admissionConfiguration.supported` | Returns true if AdmissionConfiguration is supported | `.` Chart context |
|
||||
| `common.capabilities.admissionConfiguration.apiVersion` | Return the appropriate apiVersion for AdmissionConfiguration. | `.` Chart context |
|
||||
| `common.capabilities.podSecurityConfiguration.apiVersion` | Return the appropriate apiVersion for PodSecurityConfiguration. | `.` Chart context |
|
||||
|
||||
### Compatibility
|
||||
|
||||
| Helper identifier | Description | Expected Input |
|
||||
| -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- |
|
||||
| `common.compatibility.isOpenshift` | Return true if the detected platform is Openshift | `.` Chart context |
|
||||
| `common.compatibility.renderSecurityContext` | Render a compatible securityContext depending on the platform. By default it is maintained as it is. In other platforms like Openshift we remove default user/group values that do not work out of the box with the restricted-v1 SCC | `dict "secContext" .Values.containerSecurityContext "context" $` |
|
||||
|
||||
### Errors
|
||||
|
||||
| Helper identifier | Description | Expected Input |
|
||||
| --------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
|
||||
| `common.errors.upgrade.passwords.empty` | It will ensure required passwords are given when we are upgrading a chart. If `validationErrors` is not empty it will throw an error and will stop the upgrade action. | `dict "validationErrors" (list $validationError00 $validationError01) "context" $` |
|
||||
| `common.errors.insecureImages` | Throw error when original container images are replaced. The error can be bypassed by setting the `global.security.allowInsecureImages` to true. | `dict "images" (list .Values.path.to.the.imageRoot) "context" $` |
|
||||
|
||||
### Images
|
||||
|
||||
| Helper identifier | Description | Expected Input |
|
||||
| --------------------------------- | -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
|
||||
| `common.images.image` | Return the proper and full image name | `dict "imageRoot" .Values.path.to.the.image "global" $`, see [ImageRoot](#imageroot) for the structure. |
|
||||
| `common.images.pullSecrets` | Return the proper Docker Image Registry Secret Names (deprecated: use common.images.renderPullSecrets instead) | `dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "global" .Values.global` |
|
||||
| `common.images.renderPullSecrets` | Return the proper Docker Image Registry Secret Names (evaluates values as templates) | `dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "context" $` |
|
||||
| `common.images.version` | Return the proper image version | `dict "imageRoot" .Values.path.to.the.image "chart" .Chart` , see [ImageRoot](#imageroot) for the structure. |
|
||||
|
||||
### Ingress
|
||||
|
||||
| Helper identifier | Description | Expected Input |
|
||||
| ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `common.ingress.backend` | Generate a proper Ingress backend entry depending on the API version | `dict "serviceName" "foo" "servicePort" "bar"`, see the [Ingress deprecation notice](https://kubernetes.io/blog/2019/07/18/api-deprecations-in-1-16/) for the syntax differences |
|
||||
| `common.ingress.supportsPathType` | Prints "true" if the pathType field is supported | `.` Chart context |
|
||||
| `common.ingress.supportsIngressClassname` | Prints "true" if the ingressClassname field is supported | `.` Chart context |
|
||||
| `common.ingress.certManagerRequest` | Prints "true" if required cert-manager annotations for TLS signed certificates are set in the Ingress annotations | `dict "annotations" .Values.path.to.the.ingress.annotations` |
|
||||
|
||||
### Labels
|
||||
|
||||
| Helper identifier | Description | Expected Input |
|
||||
| --------------------------- | --------------------------------------------------------------------------- | ----------------- |
|
||||
| `common.labels.standard` | Return Kubernetes standard labels | `.` Chart context |
|
||||
| `common.labels.matchLabels` | Labels to use on `deploy.spec.selector.matchLabels` and `svc.spec.selector` | `.` Chart context |
|
||||
|
||||
### Names
|
||||
|
||||
| Helper identifier | Description | Expected Input |
|
||||
| ---------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
|
||||
| `common.names.name` | Expand the name of the chart or use `.Values.nameOverride` | `.` Chart context |
|
||||
| `common.names.fullname` | Create a default fully qualified app name. | `.` Chart context |
|
||||
| `common.names.namespace` | Allow the release namespace to be overridden | `.` Chart context |
|
||||
| `common.names.fullname.namespace` | Create a fully qualified app name adding the installation's namespace | `.` Chart context |
|
||||
| `common.names.chart` | Chart name plus version | `.` Chart context |
|
||||
| `common.names.dependency.fullname` | Create a default fully qualified dependency name. | `dict "chartName" "dependency-chart-name" "chartValues" .Values.dependency-chart "context" $` |
|
||||
|
||||
### Resources
|
||||
|
||||
| Helper identifier | Description | Expected Input |
|
||||
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- |
|
||||
| `common.resources.preset` | Return a resource request/limit object based on a given preset. These presets are for basic testing and not meant to be used in production. | `dict "type" "nano"` |
|
||||
|
||||
### Secrets
|
||||
|
||||
| Helper identifier | Description | Expected Input |
|
||||
| --------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `common.secrets.name` | Generate the name of the secret. | `dict "existingSecret" .Values.path.to.the.existingSecret "defaultNameSuffix" "mySuffix" "context" $` see [ExistingSecret](#existingsecret) for the structure. |
|
||||
| `common.secrets.key` | Generate secret key. | `dict "existingSecret" .Values.path.to.the.existingSecret "key" "keyName"` see [ExistingSecret](#existingsecret) for the structure. |
|
||||
| `common.secrets.passwords.manage` | Generate secret password or retrieve one if already created. | `dict "secret" "secret-name" "key" "keyName" "providedValues" (list "path.to.password1" "path.to.password2") "length" 10 "strong" false "chartName" "chartName" "honorProvidedValues" false "context" $`, length, strong, honorProvidedValues and chartName fields are optional. |
|
||||
| `common.secrets.exists` | Returns whether a previous generated secret already exists. | `dict "secret" "secret-name" "context" $` |
|
||||
| `common.secrets.lookup` | Reuses the value from an existing secret, otherwise sets its value to a default value. | `dict "secret" "secret-name" "key" "keyName" "defaultValue" .Values.myValue "context" $` |
|
||||
|
||||
### Storage
|
||||
|
||||
| Helper identifier | Description | Expected Input |
|
||||
| ---------------------- | -------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
|
||||
| `common.storage.class` | Return the proper Storage Class | `dict "persistence" .Values.path.to.the.persistence "global" $`, see [Persistence](#persistence) for the structure. |
|
||||
|
||||
### TplValues
|
||||
|
||||
| Helper identifier | Description | Expected Input |
|
||||
| ---------------------------------- | ------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `common.tplvalues.render` | Renders a value that contains template | `dict "value" .Values.path.to.the.Value "context" $`, value is the value should rendered as template, context frequently is the chart context `$` or `.` |
|
||||
| `common.tplvalues.merge` | Merge a list of values that contains template after rendering them. | `dict "values" (list .Values.path.to.the.Value1 .Values.path.to.the.Value2) "context" $` |
|
||||
| `common.tplvalues.merge-overwrite` | Merge a list of values that contains template after rendering them. | `dict "values" (list .Values.path.to.the.Value1 .Values.path.to.the.Value2) "context" $` |
|
||||
|
||||
### Utils
|
||||
|
||||
| Helper identifier | Description | Expected Input |
|
||||
| ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
|
||||
| `common.utils.fieldToEnvVar` | Build environment variable name given a field. | `dict "field" "my-password"` |
|
||||
| `common.utils.secret.getvalue` | Print instructions to get a secret value. | `dict "secret" "secret-name" "field" "secret-value-field" "context" $` |
|
||||
| `common.utils.getValueFromKey` | Gets a value from `.Values` object given its key path | `dict "key" "path.to.key" "context" $` |
|
||||
| `common.utils.getKeyFromList` | Returns first `.Values` key with a defined value or first of the list if all non-defined | `dict "keys" (list "path.to.key1" "path.to.key2") "context" $` |
|
||||
| `common.utils.checksumTemplate` | Checksum a template at "path" containing a *single* resource (ConfigMap,Secret) for use in pod annotations, excluding the metadata (see #18376) | `dict "path" "/configmap.yaml" "context" $` |
|
||||
|
||||
### Validations
|
||||
|
||||
| Helper identifier | Description | Expected Input |
|
||||
| --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `common.validations.values.single.empty` | Validate a value must not be empty. | `dict "valueKey" "path.to.value" "secret" "secret.name" "field" "my-password" "subchart" "subchart" "context" $` secret, field and subchart are optional. In case they are given, the helper will generate a how to get instruction. See [ValidateValue](#validatevalue) |
|
||||
| `common.validations.values.multiple.empty` | Validate a multiple values must not be empty. It returns a shared error for all the values. | `dict "required" (list $validateValueConf00 $validateValueConf01) "context" $`. See [ValidateValue](#validatevalue) |
|
||||
| `common.validations.values.mariadb.passwords` | This helper will ensure required password for MariaDB are not empty. It returns a shared error for all the values. | `dict "secret" "mariadb-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use mariadb chart and the helper. |
|
||||
|
||||
### Warnings
|
||||
|
||||
| Helper identifier | Description | Expected Input |
|
||||
| -------------------------------- | ----------------------------------------------------------------- | ---------------------------------------------------------- |
|
||||
| `common.warnings.rollingTag` | Warning about using rolling tag. | `ImageRoot` see [ImageRoot](#imageroot) for the structure. |
|
||||
| `common.warnings.modifiedImages` | Warning about replaced images from the original. | `ImageRoot` see [ImageRoot](#imageroot) for the structure. |
|
||||
| `common.warnings.resources` | Warning about not setting the resource object in all deployments. | `dict "sections" (list "path1" "path2") context $` |
|
||||
|
||||
## Special input schemas
|
||||
|
||||
### ImageRoot
|
||||
|
||||
```yaml
|
||||
registry:
|
||||
type: string
|
||||
description: Docker registry where the image is located
|
||||
example: docker.io
|
||||
|
||||
repository:
|
||||
type: string
|
||||
description: Repository and image name
|
||||
example: bitnami/nginx
|
||||
|
||||
tag:
|
||||
type: string
|
||||
description: image tag
|
||||
example: 1.16.1-debian-10-r63
|
||||
|
||||
pullPolicy:
|
||||
type: string
|
||||
description: Specify a imagePullPolicy.'
|
||||
|
||||
pullSecrets:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
description: Optionally specify an array of imagePullSecrets (evaluated as templates).
|
||||
|
||||
debug:
|
||||
type: boolean
|
||||
description: Set to true if you would like to see extra information on logs
|
||||
example: false
|
||||
|
||||
## An instance would be:
|
||||
# registry: docker.io
|
||||
# repository: bitnami/nginx
|
||||
# tag: 1.16.1-debian-10-r63
|
||||
# pullPolicy: IfNotPresent
|
||||
# debug: false
|
||||
```
|
||||
|
||||
### Persistence
|
||||
|
||||
```yaml
|
||||
enabled:
|
||||
type: boolean
|
||||
description: Whether enable persistence.
|
||||
example: true
|
||||
|
||||
storageClass:
|
||||
type: string
|
||||
description: Ghost data Persistent Volume Storage Class, If set to "-", storageClassName: "" which disables dynamic provisioning.
|
||||
example: "-"
|
||||
|
||||
accessMode:
|
||||
type: string
|
||||
description: Access mode for the Persistent Volume Storage.
|
||||
example: ReadWriteOnce
|
||||
|
||||
size:
|
||||
type: string
|
||||
description: Size the Persistent Volume Storage.
|
||||
example: 8Gi
|
||||
|
||||
path:
|
||||
type: string
|
||||
description: Path to be persisted.
|
||||
example: /bitnami
|
||||
|
||||
## An instance would be:
|
||||
# enabled: true
|
||||
# storageClass: "-"
|
||||
# accessMode: ReadWriteOnce
|
||||
# size: 8Gi
|
||||
# path: /bitnami
|
||||
```
|
||||
|
||||
### ExistingSecret
|
||||
|
||||
```yaml
|
||||
name:
|
||||
type: string
|
||||
description: Name of the existing secret.
|
||||
example: mySecret
|
||||
keyMapping:
|
||||
description: Mapping between the expected key name and the name of the key in the existing secret.
|
||||
type: object
|
||||
|
||||
## An instance would be:
|
||||
# name: mySecret
|
||||
# keyMapping:
|
||||
# password: myPasswordKey
|
||||
```
|
||||
|
||||
#### Example of use
|
||||
|
||||
When we store sensitive data for a deployment in a secret, some times we want to give to users the possibility of using theirs existing secrets.
|
||||
|
||||
```yaml
|
||||
# templates/secret.yaml
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ include "common.names.fullname" . }}
|
||||
labels:
|
||||
app: {{ include "common.names.fullname" . }}
|
||||
type: Opaque
|
||||
data:
|
||||
password: {{ .Values.password | b64enc | quote }}
|
||||
|
||||
# templates/dpl.yaml
|
||||
---
|
||||
...
|
||||
env:
|
||||
- name: PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "common.secrets.name" (dict "existingSecret" .Values.existingSecret "context" $) }}
|
||||
key: {{ include "common.secrets.key" (dict "existingSecret" .Values.existingSecret "key" "password") }}
|
||||
...
|
||||
|
||||
# values.yaml
|
||||
---
|
||||
name: mySecret
|
||||
keyMapping:
|
||||
password: myPasswordKey
|
||||
```
|
||||
|
||||
### ValidateValue
|
||||
|
||||
#### NOTES.txt
|
||||
|
||||
```console
|
||||
{{- $validateValueConf00 := (dict "valueKey" "path.to.value00" "secret" "secretName" "field" "password-00") -}}
|
||||
{{- $validateValueConf01 := (dict "valueKey" "path.to.value01" "secret" "secretName" "field" "password-01") -}}
|
||||
|
||||
{{ include "common.validations.values.multiple.empty" (dict "required" (list $validateValueConf00 $validateValueConf01) "context" $) }}
|
||||
```
|
||||
|
||||
If we force those values to be empty we will see some alerts
|
||||
|
||||
```console
|
||||
helm install test mychart --set path.to.value00="",path.to.value01=""
|
||||
'path.to.value00' must not be empty, please add '--set path.to.value00=$PASSWORD_00' to the command. To get the current value:
|
||||
|
||||
export PASSWORD_00=$(kubectl get secret --namespace default secretName -o jsonpath="{.data.password-00}" | base64 -d)
|
||||
|
||||
'path.to.value01' must not be empty, please add '--set path.to.value01=$PASSWORD_01' to the command. To get the current value:
|
||||
|
||||
export PASSWORD_01=$(kubectl get secret --namespace default secretName -o jsonpath="{.data.password-01}" | base64 -d)
|
||||
```
|
||||
|
||||
## Upgrading
|
||||
|
||||
### To 1.0.0
|
||||
|
||||
[On November 13, 2020, Helm v2 support was formally finished](https://github.com/helm/charts#status-of-the-project), this major version is the result of the required changes applied to the Helm Chart to be able to incorporate the different features added in Helm v3 and to be consistent with the Helm project itself regarding the Helm v2 EOL.
|
||||
|
||||
#### What changes were introduced in this major version?
|
||||
|
||||
- Previous versions of this Helm Chart use `apiVersion: v1` (installable by both Helm 2 and 3), this Helm Chart was updated to `apiVersion: v2` (installable by Helm 3 only). [Here](https://helm.sh/docs/topics/charts/#the-apiversion-field) you can find more information about the `apiVersion` field.
|
||||
- Use `type: library`. [Here](https://v3.helm.sh/docs/faq/#library-chart-support) you can find more information.
|
||||
- The different fields present in the *Chart.yaml* file has been ordered alphabetically in a homogeneous way for all the Bitnami Helm Charts
|
||||
|
||||
#### Considerations when upgrading to this version
|
||||
|
||||
- If you want to upgrade to this version from a previous one installed with Helm v3, you shouldn't face any issues
|
||||
- If you want to upgrade to this version using Helm v2, this scenario is not supported as this version doesn't support Helm v2 anymore
|
||||
- If you installed the previous version with Helm v2 and wants to upgrade to this version with Helm v3, please refer to the [official Helm documentation](https://helm.sh/docs/topics/v2_v3_migration/#migration-use-cases) about migrating from Helm v2 to v3
|
||||
|
||||
#### Useful links
|
||||
|
||||
- <https://techdocs.broadcom.com/us/en/vmware-tanzu/application-catalog/tanzu-application-catalog/services/tac-doc/apps-tutorials-resolve-helm2-helm3-post-migration-issues-index.html>
|
||||
- <https://helm.sh/docs/topics/v2_v3_migration/>
|
||||
- <https://helm.sh/blog/migrate-from-helm-v2-to-helm-v3/>
|
||||
|
||||
## License
|
||||
|
||||
Copyright © 2025 Broadcom. The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
<http://www.apache.org/licenses/LICENSE-2.0>
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
169
manifests/valkey/charts/common/templates/_affinities.tpl
Normal file
169
manifests/valkey/charts/common/templates/_affinities.tpl
Normal file
@ -0,0 +1,169 @@
|
||||
{{/*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
|
||||
{{/*
|
||||
Return a soft nodeAffinity definition
|
||||
{{ include "common.affinities.nodes.soft" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}}
|
||||
*/}}
|
||||
{{- define "common.affinities.nodes.soft" -}}
|
||||
preferredDuringSchedulingIgnoredDuringExecution:
|
||||
- preference:
|
||||
matchExpressions:
|
||||
- key: {{ .key }}
|
||||
operator: In
|
||||
values:
|
||||
{{- range .values }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
weight: 1
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return a hard nodeAffinity definition
|
||||
{{ include "common.affinities.nodes.hard" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}}
|
||||
*/}}
|
||||
{{- define "common.affinities.nodes.hard" -}}
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: {{ .key }}
|
||||
operator: In
|
||||
values:
|
||||
{{- range .values }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return a nodeAffinity definition
|
||||
{{ include "common.affinities.nodes" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}}
|
||||
*/}}
|
||||
{{- define "common.affinities.nodes" -}}
|
||||
{{- if eq .type "soft" }}
|
||||
{{- include "common.affinities.nodes.soft" . -}}
|
||||
{{- else if eq .type "hard" }}
|
||||
{{- include "common.affinities.nodes.hard" . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return a topologyKey definition
|
||||
{{ include "common.affinities.topologyKey" (dict "topologyKey" "BAR") -}}
|
||||
*/}}
|
||||
{{- define "common.affinities.topologyKey" -}}
|
||||
{{ .topologyKey | default "kubernetes.io/hostname" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return a soft podAffinity/podAntiAffinity definition
|
||||
{{ include "common.affinities.pods.soft" (dict "component" "FOO" "customLabels" .Values.podLabels "extraMatchLabels" .Values.extraMatchLabels "topologyKey" "BAR" "extraPodAffinityTerms" .Values.extraPodAffinityTerms "extraNamespaces" (list "namespace1" "namespace2") "context" $) -}}
|
||||
*/}}
|
||||
{{- define "common.affinities.pods.soft" -}}
|
||||
{{- $component := default "" .component -}}
|
||||
{{- $customLabels := default (dict) .customLabels -}}
|
||||
{{- $extraMatchLabels := default (dict) .extraMatchLabels -}}
|
||||
{{- $extraPodAffinityTerms := default (list) .extraPodAffinityTerms -}}
|
||||
{{- $extraNamespaces := default (list) .extraNamespaces -}}
|
||||
preferredDuringSchedulingIgnoredDuringExecution:
|
||||
- podAffinityTerm:
|
||||
labelSelector:
|
||||
matchLabels: {{- (include "common.labels.matchLabels" ( dict "customLabels" $customLabels "context" .context )) | nindent 10 }}
|
||||
{{- if not (empty $component) }}
|
||||
{{ printf "app.kubernetes.io/component: %s" $component }}
|
||||
{{- end }}
|
||||
{{- range $key, $value := $extraMatchLabels }}
|
||||
{{ $key }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
{{- if $extraNamespaces }}
|
||||
namespaces:
|
||||
- {{ .context.Release.Namespace }}
|
||||
{{- with $extraNamespaces }}
|
||||
{{- include "common.tplvalues.render" (dict "value" . "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
topologyKey: {{ include "common.affinities.topologyKey" (dict "topologyKey" .topologyKey) }}
|
||||
weight: 1
|
||||
{{- range $extraPodAffinityTerms }}
|
||||
- podAffinityTerm:
|
||||
labelSelector:
|
||||
matchLabels: {{- (include "common.labels.matchLabels" ( dict "customLabels" $customLabels "context" $.context )) | nindent 10 }}
|
||||
{{- if not (empty $component) }}
|
||||
{{ printf "app.kubernetes.io/component: %s" $component }}
|
||||
{{- end }}
|
||||
{{- range $key, $value := .extraMatchLabels }}
|
||||
{{ $key }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
{{- if .namespaces }}
|
||||
namespaces:
|
||||
- {{ $.context.Release.Namespace }}
|
||||
{{- with .namespaces }}
|
||||
{{- include "common.tplvalues.render" (dict "value" . "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
topologyKey: {{ include "common.affinities.topologyKey" (dict "topologyKey" .topologyKey) }}
|
||||
weight: {{ .weight | default 1 -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return a hard podAffinity/podAntiAffinity definition
|
||||
{{ include "common.affinities.pods.hard" (dict "component" "FOO" "customLabels" .Values.podLabels "extraMatchLabels" .Values.extraMatchLabels "topologyKey" "BAR" "extraPodAffinityTerms" .Values.extraPodAffinityTerms "extraNamespaces" (list "namespace1" "namespace2") "context" $) -}}
|
||||
*/}}
|
||||
{{- define "common.affinities.pods.hard" -}}
|
||||
{{- $component := default "" .component -}}
|
||||
{{- $customLabels := default (dict) .customLabels -}}
|
||||
{{- $extraMatchLabels := default (dict) .extraMatchLabels -}}
|
||||
{{- $extraPodAffinityTerms := default (list) .extraPodAffinityTerms -}}
|
||||
{{- $extraNamespaces := default (list) .extraNamespaces -}}
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
- labelSelector:
|
||||
matchLabels: {{- (include "common.labels.matchLabels" ( dict "customLabels" $customLabels "context" .context )) | nindent 8 }}
|
||||
{{- if not (empty $component) }}
|
||||
{{ printf "app.kubernetes.io/component: %s" $component }}
|
||||
{{- end }}
|
||||
{{- range $key, $value := $extraMatchLabels }}
|
||||
{{ $key }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
{{- if $extraNamespaces }}
|
||||
namespaces:
|
||||
- {{ .context.Release.Namespace }}
|
||||
{{- with $extraNamespaces }}
|
||||
{{- include "common.tplvalues.render" (dict "value" . "context" $) | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
topologyKey: {{ include "common.affinities.topologyKey" (dict "topologyKey" .topologyKey) }}
|
||||
{{- range $extraPodAffinityTerms }}
|
||||
- labelSelector:
|
||||
matchLabels: {{- (include "common.labels.matchLabels" ( dict "customLabels" $customLabels "context" $.context )) | nindent 8 }}
|
||||
{{- if not (empty $component) }}
|
||||
{{ printf "app.kubernetes.io/component: %s" $component }}
|
||||
{{- end }}
|
||||
{{- range $key, $value := .extraMatchLabels }}
|
||||
{{ $key }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
{{- if .namespaces }}
|
||||
namespaces:
|
||||
- {{ $.context.Release.Namespace }}
|
||||
{{- with .namespaces }}
|
||||
{{- include "common.tplvalues.render" (dict "value" . "context" $) | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
topologyKey: {{ include "common.affinities.topologyKey" (dict "topologyKey" .topologyKey) }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return a podAffinity/podAntiAffinity definition
|
||||
{{ include "common.affinities.pods" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}}
|
||||
*/}}
|
||||
{{- define "common.affinities.pods" -}}
|
||||
{{- if eq .type "soft" }}
|
||||
{{- include "common.affinities.pods.soft" . -}}
|
||||
{{- else if eq .type "hard" }}
|
||||
{{- include "common.affinities.pods.hard" . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
178
manifests/valkey/charts/common/templates/_capabilities.tpl
Normal file
178
manifests/valkey/charts/common/templates/_capabilities.tpl
Normal file
@ -0,0 +1,178 @@
|
||||
{{/*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
|
||||
{{/*
|
||||
Return the target Kubernetes version
|
||||
*/}}
|
||||
{{- define "common.capabilities.kubeVersion" -}}
|
||||
{{- default (default .Capabilities.KubeVersion.Version .Values.kubeVersion) ((.Values.global).kubeVersion) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return true if the apiVersion is supported
|
||||
Usage:
|
||||
{{ include "common.capabilities.apiVersions.has" (dict "version" "batch/v1" "context" $) }}
|
||||
*/}}
|
||||
{{- define "common.capabilities.apiVersions.has" -}}
|
||||
{{- $providedAPIVersions := default .context.Values.apiVersions ((.context.Values.global).apiVersions) -}}
|
||||
{{- if and (empty $providedAPIVersions) (.context.Capabilities.APIVersions.Has .version) -}}
|
||||
{{- true -}}
|
||||
{{- else if has .version $providedAPIVersions -}}
|
||||
{{- true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the appropriate apiVersion for poddisruptionbudget.
|
||||
*/}}
|
||||
{{- define "common.capabilities.policy.apiVersion" -}}
|
||||
{{- print "policy/v1" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the appropriate apiVersion for networkpolicy.
|
||||
*/}}
|
||||
{{- define "common.capabilities.networkPolicy.apiVersion" -}}
|
||||
{{- print "networking.k8s.io/v1" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the appropriate apiVersion for job.
|
||||
*/}}
|
||||
{{- define "common.capabilities.job.apiVersion" -}}
|
||||
{{- print "batch/v1" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the appropriate apiVersion for cronjob.
|
||||
*/}}
|
||||
{{- define "common.capabilities.cronjob.apiVersion" -}}
|
||||
{{- print "batch/v1" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the appropriate apiVersion for daemonset.
|
||||
*/}}
|
||||
{{- define "common.capabilities.daemonset.apiVersion" -}}
|
||||
{{- print "apps/v1" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the appropriate apiVersion for deployment.
|
||||
*/}}
|
||||
{{- define "common.capabilities.deployment.apiVersion" -}}
|
||||
{{- print "apps/v1" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the appropriate apiVersion for statefulset.
|
||||
*/}}
|
||||
{{- define "common.capabilities.statefulset.apiVersion" -}}
|
||||
{{- print "apps/v1" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the appropriate apiVersion for ingress.
|
||||
*/}}
|
||||
{{- define "common.capabilities.ingress.apiVersion" -}}
|
||||
{{- print "networking.k8s.io/v1" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the appropriate apiVersion for RBAC resources.
|
||||
*/}}
|
||||
{{- define "common.capabilities.rbac.apiVersion" -}}
|
||||
{{- print "rbac.authorization.k8s.io/v1" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the appropriate apiVersion for CRDs.
|
||||
*/}}
|
||||
{{- define "common.capabilities.crd.apiVersion" -}}
|
||||
{{- print "apiextensions.k8s.io/v1" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the appropriate apiVersion for APIService.
|
||||
*/}}
|
||||
{{- define "common.capabilities.apiService.apiVersion" -}}
|
||||
{{- print "apiregistration.k8s.io/v1" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the appropriate apiVersion for Horizontal Pod Autoscaler.
|
||||
*/}}
|
||||
{{- define "common.capabilities.hpa.apiVersion" -}}
|
||||
{{- $kubeVersion := include "common.capabilities.kubeVersion" .context -}}
|
||||
{{- print "autoscaling/v2" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the appropriate apiVersion for Vertical Pod Autoscaler.
|
||||
*/}}
|
||||
{{- define "common.capabilities.vpa.apiVersion" -}}
|
||||
{{- $kubeVersion := include "common.capabilities.kubeVersion" .context -}}
|
||||
{{- if and (not (empty $kubeVersion)) (semverCompare "<1.25-0" $kubeVersion) -}}
|
||||
{{- print "autoscaling/v1beta2" -}}
|
||||
{{- else -}}
|
||||
{{- print "autoscaling/v1" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Returns true if PodSecurityPolicy is supported
|
||||
*/}}
|
||||
{{- define "common.capabilities.psp.supported" -}}
|
||||
{{- $kubeVersion := include "common.capabilities.kubeVersion" . -}}
|
||||
{{- if or (empty $kubeVersion) (semverCompare "<1.25-0" $kubeVersion) -}}
|
||||
{{- true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Returns true if AdmissionConfiguration is supported
|
||||
*/}}
|
||||
{{- define "common.capabilities.admissionConfiguration.supported" -}}
|
||||
{{- $kubeVersion := include "common.capabilities.kubeVersion" . -}}
|
||||
{{- true -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the appropriate apiVersion for AdmissionConfiguration.
|
||||
*/}}
|
||||
{{- define "common.capabilities.admissionConfiguration.apiVersion" -}}
|
||||
{{- $kubeVersion := include "common.capabilities.kubeVersion" . -}}
|
||||
{{- if and (not (empty $kubeVersion)) (semverCompare "<1.25-0" $kubeVersion) -}}
|
||||
{{- print "apiserver.config.k8s.io/v1beta1" -}}
|
||||
{{- else -}}
|
||||
{{- print "apiserver.config.k8s.io/v1" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the appropriate apiVersion for PodSecurityConfiguration.
|
||||
*/}}
|
||||
{{- define "common.capabilities.podSecurityConfiguration.apiVersion" -}}
|
||||
{{- $kubeVersion := include "common.capabilities.kubeVersion" . -}}
|
||||
{{- if and (not (empty $kubeVersion)) (semverCompare "<1.25-0" $kubeVersion) -}}
|
||||
{{- print "pod-security.admission.config.k8s.io/v1beta1" -}}
|
||||
{{- else -}}
|
||||
{{- print "pod-security.admission.config.k8s.io/v1" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Returns true if the used Helm version is 3.3+.
|
||||
A way to check the used Helm version was not introduced until version 3.3.0 with .Capabilities.HelmVersion, which contains an additional "{}}" structure.
|
||||
This check is introduced as a regexMatch instead of {{ if .Capabilities.HelmVersion }} because checking for the key HelmVersion in <3.3 results in a "interface not found" error.
|
||||
**To be removed when the catalog's minimun Helm version is 3.3**
|
||||
*/}}
|
||||
{{- define "common.capabilities.supportsHelmVersion" -}}
|
||||
{{- if regexMatch "{(v[0-9])*[^}]*}}$" (.Capabilities | toString ) }}
|
||||
{{- true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
46
manifests/valkey/charts/common/templates/_compatibility.tpl
Normal file
46
manifests/valkey/charts/common/templates/_compatibility.tpl
Normal file
@ -0,0 +1,46 @@
|
||||
{{/*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
|
||||
{{/*
|
||||
Return true if the detected platform is Openshift
|
||||
Usage:
|
||||
{{- include "common.compatibility.isOpenshift" . -}}
|
||||
*/}}
|
||||
{{- define "common.compatibility.isOpenshift" -}}
|
||||
{{- if .Capabilities.APIVersions.Has "security.openshift.io/v1" -}}
|
||||
{{- true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Render a compatible securityContext depending on the platform. By default it is maintained as it is. In other platforms like Openshift we remove default user/group values that do not work out of the box with the restricted-v1 SCC
|
||||
Usage:
|
||||
{{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.containerSecurityContext "context" $) -}}
|
||||
*/}}
|
||||
{{- define "common.compatibility.renderSecurityContext" -}}
|
||||
{{- $adaptedContext := .secContext -}}
|
||||
|
||||
{{- if (((.context.Values.global).compatibility).openshift) -}}
|
||||
{{- if or (eq .context.Values.global.compatibility.openshift.adaptSecurityContext "force") (and (eq .context.Values.global.compatibility.openshift.adaptSecurityContext "auto") (include "common.compatibility.isOpenshift" .context)) -}}
|
||||
{{/* Remove incompatible user/group values that do not work in Openshift out of the box */}}
|
||||
{{- $adaptedContext = omit $adaptedContext "fsGroup" "runAsUser" "runAsGroup" -}}
|
||||
{{- if not .secContext.seLinuxOptions -}}
|
||||
{{/* If it is an empty object, we remove it from the resulting context because it causes validation issues */}}
|
||||
{{- $adaptedContext = omit $adaptedContext "seLinuxOptions" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{/* Remove empty seLinuxOptions object if global.compatibility.omitEmptySeLinuxOptions is set to true */}}
|
||||
{{- if and (((.context.Values.global).compatibility).omitEmptySeLinuxOptions) (not .secContext.seLinuxOptions) -}}
|
||||
{{- $adaptedContext = omit $adaptedContext "seLinuxOptions" -}}
|
||||
{{- end -}}
|
||||
{{/* Remove fields that are disregarded when running the container in privileged mode */}}
|
||||
{{- if $adaptedContext.privileged -}}
|
||||
{{- $adaptedContext = omit $adaptedContext "capabilities" -}}
|
||||
{{- end -}}
|
||||
{{- omit $adaptedContext "enabled" | toYaml -}}
|
||||
{{- end -}}
|
85
manifests/valkey/charts/common/templates/_errors.tpl
Normal file
85
manifests/valkey/charts/common/templates/_errors.tpl
Normal file
@ -0,0 +1,85 @@
|
||||
{{/*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Throw error when upgrading using empty passwords values that must not be empty.
|
||||
|
||||
Usage:
|
||||
{{- $validationError00 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password00" "secret" "secretName" "field" "password-00") -}}
|
||||
{{- $validationError01 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password01" "secret" "secretName" "field" "password-01") -}}
|
||||
{{ include "common.errors.upgrade.passwords.empty" (dict "validationErrors" (list $validationError00 $validationError01) "context" $) }}
|
||||
|
||||
Required password params:
|
||||
- validationErrors - String - Required. List of validation strings to be return, if it is empty it won't throw error.
|
||||
- context - Context - Required. Parent context.
|
||||
*/}}
|
||||
{{- define "common.errors.upgrade.passwords.empty" -}}
|
||||
{{- $validationErrors := join "" .validationErrors -}}
|
||||
{{- if and $validationErrors .context.Release.IsUpgrade -}}
|
||||
{{- $errorString := "\nPASSWORDS ERROR: You must provide your current passwords when upgrading the release." -}}
|
||||
{{- $errorString = print $errorString "\n Note that even after reinstallation, old credentials may be needed as they may be kept in persistent volume claims." -}}
|
||||
{{- $errorString = print $errorString "\n Further information can be obtained at https://docs.bitnami.com/general/how-to/troubleshoot-helm-chart-issues/#credential-errors-while-upgrading-chart-releases" -}}
|
||||
{{- $errorString = print $errorString "\n%s" -}}
|
||||
{{- printf $errorString $validationErrors | fail -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Throw error when original container images are replaced.
|
||||
The error can be bypassed by setting the "global.security.allowInsecureImages" to true. In this case,
|
||||
a warning message will be shown instead.
|
||||
|
||||
Usage:
|
||||
{{ include "common.errors.insecureImages" (dict "images" (list .Values.path.to.the.imageRoot) "context" $) }}
|
||||
*/}}
|
||||
{{- define "common.errors.insecureImages" -}}
|
||||
{{- $relocatedImages := list -}}
|
||||
{{- $replacedImages := list -}}
|
||||
{{- $retaggedImages := list -}}
|
||||
{{- $globalRegistry := ((.context.Values.global).imageRegistry) -}}
|
||||
{{- $originalImages := .context.Chart.Annotations.images -}}
|
||||
{{- range .images -}}
|
||||
{{- $registryName := default .registry $globalRegistry -}}
|
||||
{{- $fullImageNameNoTag := printf "%s/%s" $registryName .repository -}}
|
||||
{{- $fullImageName := printf "%s:%s" $fullImageNameNoTag .tag -}}
|
||||
{{- if not (contains $fullImageNameNoTag $originalImages) -}}
|
||||
{{- if not (contains $registryName $originalImages) -}}
|
||||
{{- $relocatedImages = append $relocatedImages $fullImageName -}}
|
||||
{{- else if not (contains .repository $originalImages) -}}
|
||||
{{- $replacedImages = append $replacedImages $fullImageName -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if not (contains (printf "%s:%s" .repository .tag) $originalImages) -}}
|
||||
{{- $retaggedImages = append $retaggedImages $fullImageName -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if and (or (gt (len $relocatedImages) 0) (gt (len $replacedImages) 0)) (((.context.Values.global).security).allowInsecureImages) -}}
|
||||
{{- print "\n\n⚠ SECURITY WARNING: Verifying original container images was skipped. Please note this Helm chart was designed, tested, and validated on multiple platforms using a specific set of Bitnami and Tanzu Application Catalog containers. Substituting other containers is likely to cause degraded security and performance, broken chart features, and missing environment variables.\n" -}}
|
||||
{{- else if (or (gt (len $relocatedImages) 0) (gt (len $replacedImages) 0)) -}}
|
||||
{{- $errorString := "Original containers have been substituted for unrecognized ones. Deploying this chart with non-standard containers is likely to cause degraded security and performance, broken chart features, and missing environment variables." -}}
|
||||
{{- $errorString = print $errorString "\n\nUnrecognized images:" -}}
|
||||
{{- range (concat $relocatedImages $replacedImages) -}}
|
||||
{{- $errorString = print $errorString "\n - " . -}}
|
||||
{{- end -}}
|
||||
{{- if or (contains "docker.io/bitnami/" $originalImages) (contains "docker.io/bitnamiprem/" $originalImages) -}}
|
||||
{{- $errorString = print "\n\n⚠ ERROR: " $errorString -}}
|
||||
{{- $errorString = print $errorString "\n\nIf you are sure you want to proceed with non-standard containers, you can skip container image verification by setting the global parameter 'global.security.allowInsecureImages' to true." -}}
|
||||
{{- $errorString = print $errorString "\nFurther information can be obtained at https://github.com/bitnami/charts/issues/30850" -}}
|
||||
{{- print $errorString | fail -}}
|
||||
{{- else if gt (len $replacedImages) 0 -}}
|
||||
{{- $errorString = print "\n\n⚠ WARNING: " $errorString -}}
|
||||
{{- print $errorString -}}
|
||||
{{- end -}}
|
||||
{{- else if gt (len $retaggedImages) 0 -}}
|
||||
{{- $warnString := "\n\n⚠ WARNING: Original containers have been retagged. Please note this Helm chart was tested, and validated on multiple platforms using a specific set of Tanzu Application Catalog containers. Substituting original image tags could cause unexpected behavior." -}}
|
||||
{{- $warnString = print $warnString "\n\nRetagged images:" -}}
|
||||
{{- range $retaggedImages -}}
|
||||
{{- $warnString = print $warnString "\n - " . -}}
|
||||
{{- end -}}
|
||||
{{- print $warnString -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
115
manifests/valkey/charts/common/templates/_images.tpl
Normal file
115
manifests/valkey/charts/common/templates/_images.tpl
Normal file
@ -0,0 +1,115 @@
|
||||
{{/*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Return the proper image name.
|
||||
If image tag and digest are not defined, termination fallbacks to chart appVersion.
|
||||
{{ include "common.images.image" ( dict "imageRoot" .Values.path.to.the.image "global" .Values.global "chart" .Chart ) }}
|
||||
*/}}
|
||||
{{- define "common.images.image" -}}
|
||||
{{- $registryName := default .imageRoot.registry ((.global).imageRegistry) -}}
|
||||
{{- $repositoryName := .imageRoot.repository -}}
|
||||
{{- $separator := ":" -}}
|
||||
{{- $termination := .imageRoot.tag | toString -}}
|
||||
|
||||
{{- if not .imageRoot.tag }}
|
||||
{{- if .chart }}
|
||||
{{- $termination = .chart.AppVersion | toString -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if .imageRoot.digest }}
|
||||
{{- $separator = "@" -}}
|
||||
{{- $termination = .imageRoot.digest | toString -}}
|
||||
{{- end -}}
|
||||
{{- if $registryName }}
|
||||
{{- printf "%s/%s%s%s" $registryName $repositoryName $separator $termination -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s%s%s" $repositoryName $separator $termination -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper Docker Image Registry Secret Names (deprecated: use common.images.renderPullSecrets instead)
|
||||
{{ include "common.images.pullSecrets" ( dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "global" .Values.global) }}
|
||||
*/}}
|
||||
{{- define "common.images.pullSecrets" -}}
|
||||
{{- $pullSecrets := list }}
|
||||
|
||||
{{- range ((.global).imagePullSecrets) -}}
|
||||
{{- if kindIs "map" . -}}
|
||||
{{- $pullSecrets = append $pullSecrets .name -}}
|
||||
{{- else -}}
|
||||
{{- $pullSecrets = append $pullSecrets . -}}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{- range .images -}}
|
||||
{{- range .pullSecrets -}}
|
||||
{{- if kindIs "map" . -}}
|
||||
{{- $pullSecrets = append $pullSecrets .name -}}
|
||||
{{- else -}}
|
||||
{{- $pullSecrets = append $pullSecrets . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if (not (empty $pullSecrets)) -}}
|
||||
imagePullSecrets:
|
||||
{{- range $pullSecrets | uniq }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper Docker Image Registry Secret Names evaluating values as templates
|
||||
{{ include "common.images.renderPullSecrets" ( dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "context" $) }}
|
||||
*/}}
|
||||
{{- define "common.images.renderPullSecrets" -}}
|
||||
{{- $pullSecrets := list }}
|
||||
{{- $context := .context }}
|
||||
|
||||
{{- range (($context.Values.global).imagePullSecrets) -}}
|
||||
{{- if kindIs "map" . -}}
|
||||
{{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" .name "context" $context)) -}}
|
||||
{{- else -}}
|
||||
{{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" . "context" $context)) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- range .images -}}
|
||||
{{- range .pullSecrets -}}
|
||||
{{- if kindIs "map" . -}}
|
||||
{{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" .name "context" $context)) -}}
|
||||
{{- else -}}
|
||||
{{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" . "context" $context)) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if (not (empty $pullSecrets)) -}}
|
||||
imagePullSecrets:
|
||||
{{- range $pullSecrets | uniq }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper image version (ingores image revision/prerelease info & fallbacks to chart appVersion)
|
||||
{{ include "common.images.version" ( dict "imageRoot" .Values.path.to.the.image "chart" .Chart ) }}
|
||||
*/}}
|
||||
{{- define "common.images.version" -}}
|
||||
{{- $imageTag := .imageRoot.tag | toString -}}
|
||||
{{/* regexp from https://github.com/Masterminds/semver/blob/23f51de38a0866c5ef0bfc42b3f735c73107b700/version.go#L41-L44 */}}
|
||||
{{- if regexMatch `^([0-9]+)(\.[0-9]+)?(\.[0-9]+)?(-([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?(\+([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?$` $imageTag -}}
|
||||
{{- $version := semver $imageTag -}}
|
||||
{{- printf "%d.%d.%d" $version.Major $version.Minor $version.Patch -}}
|
||||
{{- else -}}
|
||||
{{- print .chart.AppVersion -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
61
manifests/valkey/charts/common/templates/_ingress.tpl
Normal file
61
manifests/valkey/charts/common/templates/_ingress.tpl
Normal file
@ -0,0 +1,61 @@
|
||||
{{/*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
|
||||
{{/*
|
||||
Generate backend entry that is compatible with all Kubernetes API versions.
|
||||
|
||||
Usage:
|
||||
{{ include "common.ingress.backend" (dict "serviceName" "backendName" "servicePort" "backendPort" "context" $) }}
|
||||
|
||||
Params:
|
||||
- serviceName - String. Name of an existing service backend
|
||||
- servicePort - String/Int. Port name (or number) of the service. It will be translated to different yaml depending if it is a string or an integer.
|
||||
- context - Dict - Required. The context for the template evaluation.
|
||||
*/}}
|
||||
{{- define "common.ingress.backend" -}}
|
||||
service:
|
||||
name: {{ .serviceName }}
|
||||
port:
|
||||
{{- if typeIs "string" .servicePort }}
|
||||
name: {{ .servicePort }}
|
||||
{{- else if or (typeIs "int" .servicePort) (typeIs "float64" .servicePort) }}
|
||||
number: {{ .servicePort | int }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
TODO: Remove as soon it is removed from the rest of the charts
|
||||
Print "true" if the API pathType field is supported
|
||||
Usage:
|
||||
{{ include "common.ingress.supportsPathType" . }}
|
||||
*/}}
|
||||
{{- define "common.ingress.supportsPathType" -}}
|
||||
{{- print "true" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
TODO: Remove as soon it is removed from the rest of the charts
|
||||
Returns true if the ingressClassname field is supported
|
||||
Usage:
|
||||
{{ include "common.ingress.supportsIngressClassname" . }}
|
||||
*/}}
|
||||
{{- define "common.ingress.supportsIngressClassname" -}}
|
||||
{{- print "true" -}}
|
||||
{{- 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
|
||||
Usage:
|
||||
{{ include "common.ingress.certManagerRequest" ( dict "annotations" .Values.path.to.the.ingress.annotations ) }}
|
||||
*/}}
|
||||
{{- define "common.ingress.certManagerRequest" -}}
|
||||
{{ if or (hasKey .annotations "cert-manager.io/cluster-issuer") (hasKey .annotations "cert-manager.io/issuer") (hasKey .annotations "kubernetes.io/tls-acme") }}
|
||||
{{- true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
46
manifests/valkey/charts/common/templates/_labels.tpl
Normal file
46
manifests/valkey/charts/common/templates/_labels.tpl
Normal file
@ -0,0 +1,46 @@
|
||||
{{/*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
|
||||
{{/*
|
||||
Kubernetes standard labels
|
||||
{{ include "common.labels.standard" (dict "customLabels" .Values.commonLabels "context" $) -}}
|
||||
*/}}
|
||||
{{- define "common.labels.standard" -}}
|
||||
{{- if and (hasKey . "customLabels") (hasKey . "context") -}}
|
||||
{{- $default := dict "app.kubernetes.io/name" (include "common.names.name" .context) "helm.sh/chart" (include "common.names.chart" .context) "app.kubernetes.io/instance" .context.Release.Name "app.kubernetes.io/managed-by" .context.Release.Service -}}
|
||||
{{- with .context.Chart.AppVersion -}}
|
||||
{{- $_ := set $default "app.kubernetes.io/version" . -}}
|
||||
{{- end -}}
|
||||
{{ template "common.tplvalues.merge" (dict "values" (list .customLabels $default) "context" .context) }}
|
||||
{{- else -}}
|
||||
app.kubernetes.io/name: {{ include "common.names.name" . }}
|
||||
helm.sh/chart: {{ include "common.names.chart" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- with .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ . | quote }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Labels used on immutable fields such as deploy.spec.selector.matchLabels or svc.spec.selector
|
||||
{{ include "common.labels.matchLabels" (dict "customLabels" .Values.podLabels "context" $) -}}
|
||||
|
||||
We don't want to loop over custom labels appending them to the selector
|
||||
since it's very likely that it will break deployments, services, etc.
|
||||
However, it's important to overwrite the standard labels if the user
|
||||
overwrote them on metadata.labels fields.
|
||||
*/}}
|
||||
{{- define "common.labels.matchLabels" -}}
|
||||
{{- if and (hasKey . "customLabels") (hasKey . "context") -}}
|
||||
{{ merge (pick (include "common.tplvalues.render" (dict "value" .customLabels "context" .context) | fromYaml) "app.kubernetes.io/name" "app.kubernetes.io/instance") (dict "app.kubernetes.io/name" (include "common.names.name" .context) "app.kubernetes.io/instance" .context.Release.Name ) | toYaml }}
|
||||
{{- else -}}
|
||||
app.kubernetes.io/name: {{ include "common.names.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
71
manifests/valkey/charts/common/templates/_names.tpl
Normal file
71
manifests/valkey/charts/common/templates/_names.tpl
Normal file
@ -0,0 +1,71 @@
|
||||
{{/*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "common.names.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "common.names.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "common.names.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{- if contains $name .Release.Name -}}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified dependency name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
Usage:
|
||||
{{ include "common.names.dependency.fullname" (dict "chartName" "dependency-chart-name" "chartValues" .Values.dependency-chart "context" $) }}
|
||||
*/}}
|
||||
{{- define "common.names.dependency.fullname" -}}
|
||||
{{- if .chartValues.fullnameOverride -}}
|
||||
{{- .chartValues.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- $name := default .chartName .chartValues.nameOverride -}}
|
||||
{{- if contains $name .context.Release.Name -}}
|
||||
{{- .context.Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-%s" .context.Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Allow the release namespace to be overridden for multi-namespace deployments in combined charts.
|
||||
*/}}
|
||||
{{- define "common.names.namespace" -}}
|
||||
{{- default .Release.Namespace .Values.namespaceOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a fully qualified app name adding the installation's namespace.
|
||||
*/}}
|
||||
{{- define "common.names.fullname.namespace" -}}
|
||||
{{- printf "%s-%s" (include "common.names.fullname" .) (include "common.names.namespace" .) | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
50
manifests/valkey/charts/common/templates/_resources.tpl
Normal file
50
manifests/valkey/charts/common/templates/_resources.tpl
Normal file
@ -0,0 +1,50 @@
|
||||
{{/*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
|
||||
{{/*
|
||||
Return a resource request/limit object based on a given preset.
|
||||
These presets are for basic testing and not meant to be used in production
|
||||
{{ include "common.resources.preset" (dict "type" "nano") -}}
|
||||
*/}}
|
||||
{{- define "common.resources.preset" -}}
|
||||
{{/* The limits are the requests increased by 50% (except ephemeral-storage and xlarge/2xlarge sizes)*/}}
|
||||
{{- $presets := dict
|
||||
"nano" (dict
|
||||
"requests" (dict "cpu" "100m" "memory" "128Mi" "ephemeral-storage" "50Mi")
|
||||
"limits" (dict "cpu" "150m" "memory" "192Mi" "ephemeral-storage" "2Gi")
|
||||
)
|
||||
"micro" (dict
|
||||
"requests" (dict "cpu" "250m" "memory" "256Mi" "ephemeral-storage" "50Mi")
|
||||
"limits" (dict "cpu" "375m" "memory" "384Mi" "ephemeral-storage" "2Gi")
|
||||
)
|
||||
"small" (dict
|
||||
"requests" (dict "cpu" "500m" "memory" "512Mi" "ephemeral-storage" "50Mi")
|
||||
"limits" (dict "cpu" "750m" "memory" "768Mi" "ephemeral-storage" "2Gi")
|
||||
)
|
||||
"medium" (dict
|
||||
"requests" (dict "cpu" "500m" "memory" "1024Mi" "ephemeral-storage" "50Mi")
|
||||
"limits" (dict "cpu" "750m" "memory" "1536Mi" "ephemeral-storage" "2Gi")
|
||||
)
|
||||
"large" (dict
|
||||
"requests" (dict "cpu" "1.0" "memory" "2048Mi" "ephemeral-storage" "50Mi")
|
||||
"limits" (dict "cpu" "1.5" "memory" "3072Mi" "ephemeral-storage" "2Gi")
|
||||
)
|
||||
"xlarge" (dict
|
||||
"requests" (dict "cpu" "1.0" "memory" "3072Mi" "ephemeral-storage" "50Mi")
|
||||
"limits" (dict "cpu" "3.0" "memory" "6144Mi" "ephemeral-storage" "2Gi")
|
||||
)
|
||||
"2xlarge" (dict
|
||||
"requests" (dict "cpu" "1.0" "memory" "3072Mi" "ephemeral-storage" "50Mi")
|
||||
"limits" (dict "cpu" "6.0" "memory" "12288Mi" "ephemeral-storage" "2Gi")
|
||||
)
|
||||
}}
|
||||
{{- if hasKey $presets .type -}}
|
||||
{{- index $presets .type | toYaml -}}
|
||||
{{- else -}}
|
||||
{{- printf "ERROR: Preset key '%s' invalid. Allowed values are %s" .type (join "," (keys $presets)) | fail -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
192
manifests/valkey/charts/common/templates/_secrets.tpl
Normal file
192
manifests/valkey/charts/common/templates/_secrets.tpl
Normal file
@ -0,0 +1,192 @@
|
||||
{{/*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Generate secret name.
|
||||
|
||||
Usage:
|
||||
{{ include "common.secrets.name" (dict "existingSecret" .Values.path.to.the.existingSecret "defaultNameSuffix" "mySuffix" "context" $) }}
|
||||
|
||||
Params:
|
||||
- existingSecret - ExistingSecret/String - Optional. The path to the existing secrets in the values.yaml given by the user
|
||||
to be used instead of the default one. Allows for it to be of type String (just the secret name) for backwards compatibility.
|
||||
+info: https://github.com/bitnami/charts/tree/main/bitnami/common#existingsecret
|
||||
- defaultNameSuffix - String - Optional. It is used only if we have several secrets in the same deployment.
|
||||
- context - Dict - Required. The context for the template evaluation.
|
||||
*/}}
|
||||
{{- define "common.secrets.name" -}}
|
||||
{{- $name := (include "common.names.fullname" .context) -}}
|
||||
|
||||
{{- if .defaultNameSuffix -}}
|
||||
{{- $name = printf "%s-%s" $name .defaultNameSuffix | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with .existingSecret -}}
|
||||
{{- if not (typeIs "string" .) -}}
|
||||
{{- with .name -}}
|
||||
{{- $name = . -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- $name = . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- printf "%s" $name -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Generate secret key.
|
||||
|
||||
Usage:
|
||||
{{ include "common.secrets.key" (dict "existingSecret" .Values.path.to.the.existingSecret "key" "keyName") }}
|
||||
|
||||
Params:
|
||||
- existingSecret - ExistingSecret/String - Optional. The path to the existing secrets in the values.yaml given by the user
|
||||
to be used instead of the default one. Allows for it to be of type String (just the secret name) for backwards compatibility.
|
||||
+info: https://github.com/bitnami/charts/tree/main/bitnami/common#existingsecret
|
||||
- key - String - Required. Name of the key in the secret.
|
||||
*/}}
|
||||
{{- define "common.secrets.key" -}}
|
||||
{{- $key := .key -}}
|
||||
|
||||
{{- if .existingSecret -}}
|
||||
{{- if not (typeIs "string" .existingSecret) -}}
|
||||
{{- if .existingSecret.keyMapping -}}
|
||||
{{- $key = index .existingSecret.keyMapping $.key -}}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{- printf "%s" $key -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Generate secret password or retrieve one if already created.
|
||||
|
||||
Usage:
|
||||
{{ include "common.secrets.passwords.manage" (dict "secret" "secret-name" "key" "keyName" "providedValues" (list "path.to.password1" "path.to.password2") "length" 10 "strong" false "chartName" "chartName" "honorProvidedValues" false "context" $) }}
|
||||
|
||||
Params:
|
||||
- secret - String - Required - Name of the 'Secret' resource where the password is stored.
|
||||
- key - String - Required - Name of the key in the secret.
|
||||
- providedValues - List<String> - Required - The path to the validating value in the values.yaml, e.g: "mysql.password". Will pick first parameter with a defined value.
|
||||
- length - int - Optional - Length of the generated random password.
|
||||
- strong - Boolean - Optional - Whether to add symbols to the generated random password.
|
||||
- chartName - String - Optional - Name of the chart used when said chart is deployed as a subchart.
|
||||
- context - Context - Required - Parent context.
|
||||
- failOnNew - Boolean - Optional - Default to true. If set to false, skip errors adding new keys to existing secrets.
|
||||
- skipB64enc - Boolean - Optional - Default to false. If set to true, no the secret will not be base64 encrypted.
|
||||
- skipQuote - Boolean - Optional - Default to false. If set to true, no quotes will be added around the secret.
|
||||
- honorProvidedValues - Boolean - Optional - Default to false. If set to true, the values in providedValues have higher priority than an existing secret
|
||||
The order in which this function returns a secret password:
|
||||
1. Password provided via the values.yaml if honorProvidedValues = true
|
||||
(If one of the keys passed to the 'providedValues' parameter to this function is a valid path to a key in the values.yaml and has a value, the value of the first key with a value will be returned)
|
||||
2. Already existing 'Secret' resource
|
||||
(If a 'Secret' resource is found under the name provided to the 'secret' parameter to this function and that 'Secret' resource contains a key with the name passed as the 'key' parameter to this function then the value of this existing secret password will be returned)
|
||||
3. Password provided via the values.yaml if honorProvidedValues = false
|
||||
(If one of the keys passed to the 'providedValues' parameter to this function is a valid path to a key in the values.yaml and has a value, the value of the first key with a value will be returned)
|
||||
4. Randomly generated secret password
|
||||
(A new random secret password with the length specified in the 'length' parameter will be generated and returned)
|
||||
|
||||
*/}}
|
||||
{{- define "common.secrets.passwords.manage" -}}
|
||||
|
||||
{{- $password := "" }}
|
||||
{{- $subchart := "" }}
|
||||
{{- $chartName := default "" .chartName }}
|
||||
{{- $passwordLength := default 10 .length }}
|
||||
{{- $providedPasswordKey := include "common.utils.getKeyFromList" (dict "keys" .providedValues "context" $.context) }}
|
||||
{{- $providedPasswordValue := include "common.utils.getValueFromKey" (dict "key" $providedPasswordKey "context" $.context) }}
|
||||
{{- $secretData := (lookup "v1" "Secret" (include "common.names.namespace" .context) .secret).data }}
|
||||
{{- if $secretData }}
|
||||
{{- if hasKey $secretData .key }}
|
||||
{{- $password = index $secretData .key | b64dec }}
|
||||
{{- else if not (eq .failOnNew false) }}
|
||||
{{- printf "\nPASSWORDS ERROR: The secret \"%s\" does not contain the key \"%s\"\n" .secret .key | fail -}}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
|
||||
{{- if and $providedPasswordValue .honorProvidedValues }}
|
||||
{{- $password = tpl ($providedPasswordValue | toString) .context }}
|
||||
{{- end }}
|
||||
|
||||
{{- if not $password }}
|
||||
{{- if $providedPasswordValue }}
|
||||
{{- $password = tpl ($providedPasswordValue | toString) .context }}
|
||||
{{- else }}
|
||||
{{- if .context.Values.enabled }}
|
||||
{{- $subchart = $chartName }}
|
||||
{{- end -}}
|
||||
|
||||
{{- if not (eq .failOnNew false) }}
|
||||
{{- $requiredPassword := dict "valueKey" $providedPasswordKey "secret" .secret "field" .key "subchart" $subchart "context" $.context -}}
|
||||
{{- $requiredPasswordError := include "common.validations.values.single.empty" $requiredPassword -}}
|
||||
{{- $passwordValidationErrors := list $requiredPasswordError -}}
|
||||
{{- include "common.errors.upgrade.passwords.empty" (dict "validationErrors" $passwordValidationErrors "context" $.context) -}}
|
||||
{{- end }}
|
||||
|
||||
{{- if .strong }}
|
||||
{{- $subStr := list (lower (randAlpha 1)) (randNumeric 1) (upper (randAlpha 1)) | join "_" }}
|
||||
{{- $password = randAscii $passwordLength }}
|
||||
{{- $password = regexReplaceAllLiteral "\\W" $password "@" | substr 5 $passwordLength }}
|
||||
{{- $password = printf "%s%s" $subStr $password | toString | shuffle }}
|
||||
{{- else }}
|
||||
{{- $password = randAlphaNum $passwordLength }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if not .skipB64enc }}
|
||||
{{- $password = $password | b64enc }}
|
||||
{{- end -}}
|
||||
{{- if .skipQuote -}}
|
||||
{{- printf "%s" $password -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s" $password | quote -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Reuses the value from an existing secret, otherwise sets its value to a default value.
|
||||
|
||||
Usage:
|
||||
{{ include "common.secrets.lookup" (dict "secret" "secret-name" "key" "keyName" "defaultValue" .Values.myValue "context" $) }}
|
||||
|
||||
Params:
|
||||
- secret - String - Required - Name of the 'Secret' resource where the password is stored.
|
||||
- key - String - Required - Name of the key in the secret.
|
||||
- defaultValue - String - Required - The path to the validating value in the values.yaml, e.g: "mysql.password". Will pick first parameter with a defined value.
|
||||
- context - Context - Required - Parent context.
|
||||
|
||||
*/}}
|
||||
{{- define "common.secrets.lookup" -}}
|
||||
{{- $value := "" -}}
|
||||
{{- $secretData := (lookup "v1" "Secret" (include "common.names.namespace" .context) .secret).data -}}
|
||||
{{- if and $secretData (hasKey $secretData .key) -}}
|
||||
{{- $value = index $secretData .key -}}
|
||||
{{- else if .defaultValue -}}
|
||||
{{- $value = .defaultValue | toString | b64enc -}}
|
||||
{{- end -}}
|
||||
{{- if $value -}}
|
||||
{{- printf "%s" $value -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Returns whether a previous generated secret already exists
|
||||
|
||||
Usage:
|
||||
{{ include "common.secrets.exists" (dict "secret" "secret-name" "context" $) }}
|
||||
|
||||
Params:
|
||||
- secret - String - Required - Name of the 'Secret' resource where the password is stored.
|
||||
- context - Context - Required - Parent context.
|
||||
*/}}
|
||||
{{- define "common.secrets.exists" -}}
|
||||
{{- $secret := (lookup "v1" "Secret" (include "common.names.namespace" .context) .secret) }}
|
||||
{{- if $secret }}
|
||||
{{- true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
21
manifests/valkey/charts/common/templates/_storage.tpl
Normal file
21
manifests/valkey/charts/common/templates/_storage.tpl
Normal file
@ -0,0 +1,21 @@
|
||||
{{/*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
|
||||
{{/*
|
||||
Return the proper Storage Class
|
||||
{{ include "common.storage.class" ( dict "persistence" .Values.path.to.the.persistence "global" $) }}
|
||||
*/}}
|
||||
{{- define "common.storage.class" -}}
|
||||
{{- $storageClass := (.global).storageClass | default .persistence.storageClass | default (.global).defaultStorageClass | default "" -}}
|
||||
{{- if $storageClass -}}
|
||||
{{- if (eq "-" $storageClass) -}}
|
||||
{{- printf "storageClassName: \"\"" -}}
|
||||
{{- else -}}
|
||||
{{- printf "storageClassName: %s" $storageClass -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
52
manifests/valkey/charts/common/templates/_tplvalues.tpl
Normal file
52
manifests/valkey/charts/common/templates/_tplvalues.tpl
Normal file
@ -0,0 +1,52 @@
|
||||
{{/*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Renders a value that contains template perhaps with scope if the scope is present.
|
||||
Usage:
|
||||
{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $ ) }}
|
||||
{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $ "scope" $app ) }}
|
||||
*/}}
|
||||
{{- define "common.tplvalues.render" -}}
|
||||
{{- $value := typeIs "string" .value | ternary .value (.value | toYaml) }}
|
||||
{{- if contains "{{" (toJson .value) }}
|
||||
{{- if .scope }}
|
||||
{{- tpl (cat "{{- with $.RelativeScope -}}" $value "{{- end }}") (merge (dict "RelativeScope" .scope) .context) }}
|
||||
{{- else }}
|
||||
{{- tpl $value .context }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- $value }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Merge a list of values that contains template after rendering them.
|
||||
Merge precedence is consistent with http://masterminds.github.io/sprig/dicts.html#merge-mustmerge
|
||||
Usage:
|
||||
{{ include "common.tplvalues.merge" ( dict "values" (list .Values.path.to.the.Value1 .Values.path.to.the.Value2) "context" $ ) }}
|
||||
*/}}
|
||||
{{- define "common.tplvalues.merge" -}}
|
||||
{{- $dst := dict -}}
|
||||
{{- range .values -}}
|
||||
{{- $dst = include "common.tplvalues.render" (dict "value" . "context" $.context "scope" $.scope) | fromYaml | merge $dst -}}
|
||||
{{- end -}}
|
||||
{{ $dst | toYaml }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Merge a list of values that contains template after rendering them.
|
||||
Merge precedence is consistent with https://masterminds.github.io/sprig/dicts.html#mergeoverwrite-mustmergeoverwrite
|
||||
Usage:
|
||||
{{ include "common.tplvalues.merge-overwrite" ( dict "values" (list .Values.path.to.the.Value1 .Values.path.to.the.Value2) "context" $ ) }}
|
||||
*/}}
|
||||
{{- define "common.tplvalues.merge-overwrite" -}}
|
||||
{{- $dst := dict -}}
|
||||
{{- range .values -}}
|
||||
{{- $dst = include "common.tplvalues.render" (dict "value" . "context" $.context "scope" $.scope) | fromYaml | mergeOverwrite $dst -}}
|
||||
{{- end -}}
|
||||
{{ $dst | toYaml }}
|
||||
{{- end -}}
|
77
manifests/valkey/charts/common/templates/_utils.tpl
Normal file
77
manifests/valkey/charts/common/templates/_utils.tpl
Normal file
@ -0,0 +1,77 @@
|
||||
{{/*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Print instructions to get a secret value.
|
||||
Usage:
|
||||
{{ include "common.utils.secret.getvalue" (dict "secret" "secret-name" "field" "secret-value-field" "context" $) }}
|
||||
*/}}
|
||||
{{- define "common.utils.secret.getvalue" -}}
|
||||
{{- $varname := include "common.utils.fieldToEnvVar" . -}}
|
||||
export {{ $varname }}=$(kubectl get secret --namespace {{ include "common.names.namespace" .context | quote }} {{ .secret }} -o jsonpath="{.data.{{ .field }}}" | base64 -d)
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Build env var name given a field
|
||||
Usage:
|
||||
{{ include "common.utils.fieldToEnvVar" dict "field" "my-password" }}
|
||||
*/}}
|
||||
{{- define "common.utils.fieldToEnvVar" -}}
|
||||
{{- $fieldNameSplit := splitList "-" .field -}}
|
||||
{{- $upperCaseFieldNameSplit := list -}}
|
||||
|
||||
{{- range $fieldNameSplit -}}
|
||||
{{- $upperCaseFieldNameSplit = append $upperCaseFieldNameSplit ( upper . ) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{ join "_" $upperCaseFieldNameSplit }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Gets a value from .Values given
|
||||
Usage:
|
||||
{{ include "common.utils.getValueFromKey" (dict "key" "path.to.key" "context" $) }}
|
||||
*/}}
|
||||
{{- define "common.utils.getValueFromKey" -}}
|
||||
{{- $splitKey := splitList "." .key -}}
|
||||
{{- $value := "" -}}
|
||||
{{- $latestObj := $.context.Values -}}
|
||||
{{- range $splitKey -}}
|
||||
{{- if not $latestObj -}}
|
||||
{{- printf "please review the entire path of '%s' exists in values" $.key | fail -}}
|
||||
{{- end -}}
|
||||
{{- $value = ( index $latestObj . ) -}}
|
||||
{{- $latestObj = $value -}}
|
||||
{{- end -}}
|
||||
{{- printf "%v" (default "" $value) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Returns first .Values key with a defined value or first of the list if all non-defined
|
||||
Usage:
|
||||
{{ include "common.utils.getKeyFromList" (dict "keys" (list "path.to.key1" "path.to.key2") "context" $) }}
|
||||
*/}}
|
||||
{{- define "common.utils.getKeyFromList" -}}
|
||||
{{- $key := first .keys -}}
|
||||
{{- $reverseKeys := reverse .keys }}
|
||||
{{- range $reverseKeys }}
|
||||
{{- $value := include "common.utils.getValueFromKey" (dict "key" . "context" $.context ) }}
|
||||
{{- if $value -}}
|
||||
{{- $key = . }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- printf "%s" $key -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Checksum a template at "path" containing a *single* resource (ConfigMap,Secret) for use in pod annotations, excluding the metadata (see #18376).
|
||||
Usage:
|
||||
{{ include "common.utils.checksumTemplate" (dict "path" "/configmap.yaml" "context" $) }}
|
||||
*/}}
|
||||
{{- define "common.utils.checksumTemplate" -}}
|
||||
{{- $obj := include (print .context.Template.BasePath .path) .context | fromYaml -}}
|
||||
{{ omit $obj "apiVersion" "kind" "metadata" | toYaml | sha256sum }}
|
||||
{{- end -}}
|
109
manifests/valkey/charts/common/templates/_warnings.tpl
Normal file
109
manifests/valkey/charts/common/templates/_warnings.tpl
Normal file
@ -0,0 +1,109 @@
|
||||
{{/*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Warning about using rolling tag.
|
||||
Usage:
|
||||
{{ include "common.warnings.rollingTag" .Values.path.to.the.imageRoot }}
|
||||
*/}}
|
||||
{{- define "common.warnings.rollingTag" -}}
|
||||
|
||||
{{- if and (contains "bitnami/" .repository) (not (.tag | toString | regexFind "-r\\d+$|sha256:")) }}
|
||||
WARNING: Rolling tag detected ({{ .repository }}:{{ .tag }}), please note that it is strongly recommended to avoid using rolling tags in a production environment.
|
||||
+info https://techdocs.broadcom.com/us/en/vmware-tanzu/application-catalog/tanzu-application-catalog/services/tac-doc/apps-tutorials-understand-rolling-tags-containers-index.html
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Warning about replaced images from the original.
|
||||
Usage:
|
||||
{{ include "common.warnings.modifiedImages" (dict "images" (list .Values.path.to.the.imageRoot) "context" $) }}
|
||||
*/}}
|
||||
{{- define "common.warnings.modifiedImages" -}}
|
||||
{{- $affectedImages := list -}}
|
||||
{{- $printMessage := false -}}
|
||||
{{- $originalImages := .context.Chart.Annotations.images -}}
|
||||
{{- range .images -}}
|
||||
{{- $fullImageName := printf (printf "%s/%s:%s" .registry .repository .tag) -}}
|
||||
{{- if not (contains $fullImageName $originalImages) }}
|
||||
{{- $affectedImages = append $affectedImages (printf "%s/%s:%s" .registry .repository .tag) -}}
|
||||
{{- $printMessage = true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if $printMessage }}
|
||||
|
||||
⚠ SECURITY WARNING: Original containers have been substituted. This Helm chart was designed, tested, and validated on multiple platforms using a specific set of Bitnami and Tanzu Application Catalog containers. Substituting other containers is likely to cause degraded security and performance, broken chart features, and missing environment variables.
|
||||
|
||||
Substituted images detected:
|
||||
{{- range $affectedImages }}
|
||||
- {{ . }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Warning about not setting the resource object in all deployments.
|
||||
Usage:
|
||||
{{ include "common.warnings.resources" (dict "sections" (list "path1" "path2") context $) }}
|
||||
Example:
|
||||
{{- include "common.warnings.resources" (dict "sections" (list "csiProvider.provider" "server" "volumePermissions" "") "context" $) }}
|
||||
The list in the example assumes that the following values exist:
|
||||
- csiProvider.provider.resources
|
||||
- server.resources
|
||||
- volumePermissions.resources
|
||||
- resources
|
||||
*/}}
|
||||
{{- define "common.warnings.resources" -}}
|
||||
{{- $values := .context.Values -}}
|
||||
{{- $printMessage := false -}}
|
||||
{{ $affectedSections := list -}}
|
||||
{{- range .sections -}}
|
||||
{{- if eq . "" -}}
|
||||
{{/* Case where the resources section is at the root (one main deployment in the chart) */}}
|
||||
{{- if not (index $values "resources") -}}
|
||||
{{- $affectedSections = append $affectedSections "resources" -}}
|
||||
{{- $printMessage = true -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{/* Case where the are multiple resources sections (more than one main deployment in the chart) */}}
|
||||
{{- $keys := split "." . -}}
|
||||
{{/* We iterate through the different levels until arriving to the resource section. Example: a.b.c.resources */}}
|
||||
{{- $section := $values -}}
|
||||
{{- range $keys -}}
|
||||
{{- $section = index $section . -}}
|
||||
{{- end -}}
|
||||
{{- if not (index $section "resources") -}}
|
||||
{{/* If the section has enabled=false or replicaCount=0, do not include it */}}
|
||||
{{- if and (hasKey $section "enabled") -}}
|
||||
{{- if index $section "enabled" -}}
|
||||
{{/* enabled=true */}}
|
||||
{{- $affectedSections = append $affectedSections (printf "%s.resources" .) -}}
|
||||
{{- $printMessage = true -}}
|
||||
{{- end -}}
|
||||
{{- else if and (hasKey $section "replicaCount") -}}
|
||||
{{/* We need a casting to int because number 0 is not treated as an int by default */}}
|
||||
{{- if (gt (index $section "replicaCount" | int) 0) -}}
|
||||
{{/* replicaCount > 0 */}}
|
||||
{{- $affectedSections = append $affectedSections (printf "%s.resources" .) -}}
|
||||
{{- $printMessage = true -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{/* Default case, add it to the affected sections */}}
|
||||
{{- $affectedSections = append $affectedSections (printf "%s.resources" .) -}}
|
||||
{{- $printMessage = true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if $printMessage }}
|
||||
|
||||
WARNING: There are "resources" sections in the chart not set. Using "resourcesPreset" is not recommended for production. For production installations, please set the following values according to your workload needs:
|
||||
{{- range $affectedSections }}
|
||||
- {{ . }}
|
||||
{{- end }}
|
||||
+info https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
|
||||
{{- end -}}
|
||||
{{- end -}}
|
@ -0,0 +1,51 @@
|
||||
{{/*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Auxiliary function to get the right value for existingSecret.
|
||||
|
||||
Usage:
|
||||
{{ include "common.cassandra.values.existingSecret" (dict "context" $) }}
|
||||
Params:
|
||||
- subchart - Boolean - Optional. Whether Cassandra is used as subchart or not. Default: false
|
||||
*/}}
|
||||
{{- define "common.cassandra.values.existingSecret" -}}
|
||||
{{- if .subchart -}}
|
||||
{{- .context.Values.cassandra.dbUser.existingSecret | quote -}}
|
||||
{{- else -}}
|
||||
{{- .context.Values.dbUser.existingSecret | quote -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Auxiliary function to get the right value for enabled cassandra.
|
||||
|
||||
Usage:
|
||||
{{ include "common.cassandra.values.enabled" (dict "context" $) }}
|
||||
*/}}
|
||||
{{- define "common.cassandra.values.enabled" -}}
|
||||
{{- if .subchart -}}
|
||||
{{- printf "%v" .context.Values.cassandra.enabled -}}
|
||||
{{- else -}}
|
||||
{{- printf "%v" (not .context.Values.enabled) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Auxiliary function to get the right value for the key dbUser
|
||||
|
||||
Usage:
|
||||
{{ include "common.cassandra.values.key.dbUser" (dict "subchart" "true" "context" $) }}
|
||||
Params:
|
||||
- subchart - Boolean - Optional. Whether Cassandra is used as subchart or not. Default: false
|
||||
*/}}
|
||||
{{- define "common.cassandra.values.key.dbUser" -}}
|
||||
{{- if .subchart -}}
|
||||
cassandra.dbUser
|
||||
{{- else -}}
|
||||
dbUser
|
||||
{{- end -}}
|
||||
{{- end -}}
|
@ -0,0 +1,108 @@
|
||||
{{/*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Validate MariaDB required passwords are not empty.
|
||||
|
||||
Usage:
|
||||
{{ include "common.validations.values.mariadb.passwords" (dict "secret" "secretName" "subchart" false "context" $) }}
|
||||
Params:
|
||||
- secret - String - Required. Name of the secret where MariaDB values are stored, e.g: "mysql-passwords-secret"
|
||||
- subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false
|
||||
*/}}
|
||||
{{- define "common.validations.values.mariadb.passwords" -}}
|
||||
{{- $existingSecret := include "common.mariadb.values.auth.existingSecret" . -}}
|
||||
{{- $enabled := include "common.mariadb.values.enabled" . -}}
|
||||
{{- $architecture := include "common.mariadb.values.architecture" . -}}
|
||||
{{- $authPrefix := include "common.mariadb.values.key.auth" . -}}
|
||||
{{- $valueKeyRootPassword := printf "%s.rootPassword" $authPrefix -}}
|
||||
{{- $valueKeyUsername := printf "%s.username" $authPrefix -}}
|
||||
{{- $valueKeyPassword := printf "%s.password" $authPrefix -}}
|
||||
{{- $valueKeyReplicationPassword := printf "%s.replicationPassword" $authPrefix -}}
|
||||
|
||||
{{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}}
|
||||
{{- $requiredPasswords := list -}}
|
||||
|
||||
{{- $requiredRootPassword := dict "valueKey" $valueKeyRootPassword "secret" .secret "field" "mariadb-root-password" -}}
|
||||
{{- $requiredPasswords = append $requiredPasswords $requiredRootPassword -}}
|
||||
|
||||
{{- $valueUsername := include "common.utils.getValueFromKey" (dict "key" $valueKeyUsername "context" .context) }}
|
||||
{{- if not (empty $valueUsername) -}}
|
||||
{{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "mariadb-password" -}}
|
||||
{{- $requiredPasswords = append $requiredPasswords $requiredPassword -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if (eq $architecture "replication") -}}
|
||||
{{- $requiredReplicationPassword := dict "valueKey" $valueKeyReplicationPassword "secret" .secret "field" "mariadb-replication-password" -}}
|
||||
{{- $requiredPasswords = append $requiredPasswords $requiredReplicationPassword -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}}
|
||||
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Auxiliary function to get the right value for existingSecret.
|
||||
|
||||
Usage:
|
||||
{{ include "common.mariadb.values.auth.existingSecret" (dict "context" $) }}
|
||||
Params:
|
||||
- subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false
|
||||
*/}}
|
||||
{{- define "common.mariadb.values.auth.existingSecret" -}}
|
||||
{{- if .subchart -}}
|
||||
{{- .context.Values.mariadb.auth.existingSecret | quote -}}
|
||||
{{- else -}}
|
||||
{{- .context.Values.auth.existingSecret | quote -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Auxiliary function to get the right value for enabled mariadb.
|
||||
|
||||
Usage:
|
||||
{{ include "common.mariadb.values.enabled" (dict "context" $) }}
|
||||
*/}}
|
||||
{{- define "common.mariadb.values.enabled" -}}
|
||||
{{- if .subchart -}}
|
||||
{{- printf "%v" .context.Values.mariadb.enabled -}}
|
||||
{{- else -}}
|
||||
{{- printf "%v" (not .context.Values.enabled) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Auxiliary function to get the right value for architecture
|
||||
|
||||
Usage:
|
||||
{{ include "common.mariadb.values.architecture" (dict "subchart" "true" "context" $) }}
|
||||
Params:
|
||||
- subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false
|
||||
*/}}
|
||||
{{- define "common.mariadb.values.architecture" -}}
|
||||
{{- if .subchart -}}
|
||||
{{- .context.Values.mariadb.architecture -}}
|
||||
{{- else -}}
|
||||
{{- .context.Values.architecture -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Auxiliary function to get the right value for the key auth
|
||||
|
||||
Usage:
|
||||
{{ include "common.mariadb.values.key.auth" (dict "subchart" "true" "context" $) }}
|
||||
Params:
|
||||
- subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false
|
||||
*/}}
|
||||
{{- define "common.mariadb.values.key.auth" -}}
|
||||
{{- if .subchart -}}
|
||||
mariadb.auth
|
||||
{{- else -}}
|
||||
auth
|
||||
{{- end -}}
|
||||
{{- end -}}
|
@ -0,0 +1,67 @@
|
||||
{{/*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Auxiliary function to get the right value for existingSecret.
|
||||
|
||||
Usage:
|
||||
{{ include "common.mongodb.values.auth.existingSecret" (dict "context" $) }}
|
||||
Params:
|
||||
- subchart - Boolean - Optional. Whether MongoDb is used as subchart or not. Default: false
|
||||
*/}}
|
||||
{{- define "common.mongodb.values.auth.existingSecret" -}}
|
||||
{{- if .subchart -}}
|
||||
{{- .context.Values.mongodb.auth.existingSecret | quote -}}
|
||||
{{- else -}}
|
||||
{{- .context.Values.auth.existingSecret | quote -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Auxiliary function to get the right value for enabled mongodb.
|
||||
|
||||
Usage:
|
||||
{{ include "common.mongodb.values.enabled" (dict "context" $) }}
|
||||
*/}}
|
||||
{{- define "common.mongodb.values.enabled" -}}
|
||||
{{- if .subchart -}}
|
||||
{{- printf "%v" .context.Values.mongodb.enabled -}}
|
||||
{{- else -}}
|
||||
{{- printf "%v" (not .context.Values.enabled) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Auxiliary function to get the right value for the key auth
|
||||
|
||||
Usage:
|
||||
{{ include "common.mongodb.values.key.auth" (dict "subchart" "true" "context" $) }}
|
||||
Params:
|
||||
- subchart - Boolean - Optional. Whether MongoDB® is used as subchart or not. Default: false
|
||||
*/}}
|
||||
{{- define "common.mongodb.values.key.auth" -}}
|
||||
{{- if .subchart -}}
|
||||
mongodb.auth
|
||||
{{- else -}}
|
||||
auth
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Auxiliary function to get the right value for architecture
|
||||
|
||||
Usage:
|
||||
{{ include "common.mongodb.values.architecture" (dict "subchart" "true" "context" $) }}
|
||||
Params:
|
||||
- subchart - Boolean - Optional. Whether MongoDB® is used as subchart or not. Default: false
|
||||
*/}}
|
||||
{{- define "common.mongodb.values.architecture" -}}
|
||||
{{- if .subchart -}}
|
||||
{{- .context.Values.mongodb.architecture -}}
|
||||
{{- else -}}
|
||||
{{- .context.Values.architecture -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
@ -0,0 +1,67 @@
|
||||
{{/*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Auxiliary function to get the right value for existingSecret.
|
||||
|
||||
Usage:
|
||||
{{ include "common.mysql.values.auth.existingSecret" (dict "context" $) }}
|
||||
Params:
|
||||
- subchart - Boolean - Optional. Whether MySQL is used as subchart or not. Default: false
|
||||
*/}}
|
||||
{{- define "common.mysql.values.auth.existingSecret" -}}
|
||||
{{- if .subchart -}}
|
||||
{{- .context.Values.mysql.auth.existingSecret | quote -}}
|
||||
{{- else -}}
|
||||
{{- .context.Values.auth.existingSecret | quote -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Auxiliary function to get the right value for enabled mysql.
|
||||
|
||||
Usage:
|
||||
{{ include "common.mysql.values.enabled" (dict "context" $) }}
|
||||
*/}}
|
||||
{{- define "common.mysql.values.enabled" -}}
|
||||
{{- if .subchart -}}
|
||||
{{- printf "%v" .context.Values.mysql.enabled -}}
|
||||
{{- else -}}
|
||||
{{- printf "%v" (not .context.Values.enabled) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Auxiliary function to get the right value for architecture
|
||||
|
||||
Usage:
|
||||
{{ include "common.mysql.values.architecture" (dict "subchart" "true" "context" $) }}
|
||||
Params:
|
||||
- subchart - Boolean - Optional. Whether MySQL is used as subchart or not. Default: false
|
||||
*/}}
|
||||
{{- define "common.mysql.values.architecture" -}}
|
||||
{{- if .subchart -}}
|
||||
{{- .context.Values.mysql.architecture -}}
|
||||
{{- else -}}
|
||||
{{- .context.Values.architecture -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Auxiliary function to get the right value for the key auth
|
||||
|
||||
Usage:
|
||||
{{ include "common.mysql.values.key.auth" (dict "subchart" "true" "context" $) }}
|
||||
Params:
|
||||
- subchart - Boolean - Optional. Whether MySQL is used as subchart or not. Default: false
|
||||
*/}}
|
||||
{{- define "common.mysql.values.key.auth" -}}
|
||||
{{- if .subchart -}}
|
||||
mysql.auth
|
||||
{{- else -}}
|
||||
auth
|
||||
{{- end -}}
|
||||
{{- end -}}
|
@ -0,0 +1,105 @@
|
||||
{{/*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Auxiliary function to decide whether evaluate global values.
|
||||
|
||||
Usage:
|
||||
{{ include "common.postgresql.values.use.global" (dict "key" "key-of-global" "context" $) }}
|
||||
Params:
|
||||
- key - String - Required. Field to be evaluated within global, e.g: "existingSecret"
|
||||
*/}}
|
||||
{{- define "common.postgresql.values.use.global" -}}
|
||||
{{- if .context.Values.global -}}
|
||||
{{- if .context.Values.global.postgresql -}}
|
||||
{{- index .context.Values.global.postgresql .key | quote -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Auxiliary function to get the right value for existingSecret.
|
||||
|
||||
Usage:
|
||||
{{ include "common.postgresql.values.existingSecret" (dict "context" $) }}
|
||||
*/}}
|
||||
{{- define "common.postgresql.values.existingSecret" -}}
|
||||
{{- $globalValue := include "common.postgresql.values.use.global" (dict "key" "existingSecret" "context" .context) -}}
|
||||
|
||||
{{- if .subchart -}}
|
||||
{{- default (.context.Values.postgresql.existingSecret | quote) $globalValue -}}
|
||||
{{- else -}}
|
||||
{{- default (.context.Values.existingSecret | quote) $globalValue -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Auxiliary function to get the right value for enabled postgresql.
|
||||
|
||||
Usage:
|
||||
{{ include "common.postgresql.values.enabled" (dict "context" $) }}
|
||||
*/}}
|
||||
{{- define "common.postgresql.values.enabled" -}}
|
||||
{{- if .subchart -}}
|
||||
{{- printf "%v" .context.Values.postgresql.enabled -}}
|
||||
{{- else -}}
|
||||
{{- printf "%v" (not .context.Values.enabled) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Auxiliary function to get the right value for the key postgressPassword.
|
||||
|
||||
Usage:
|
||||
{{ include "common.postgresql.values.key.postgressPassword" (dict "subchart" "true" "context" $) }}
|
||||
Params:
|
||||
- subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false
|
||||
*/}}
|
||||
{{- define "common.postgresql.values.key.postgressPassword" -}}
|
||||
{{- $globalValue := include "common.postgresql.values.use.global" (dict "key" "postgresqlUsername" "context" .context) -}}
|
||||
|
||||
{{- if not $globalValue -}}
|
||||
{{- if .subchart -}}
|
||||
postgresql.postgresqlPassword
|
||||
{{- else -}}
|
||||
postgresqlPassword
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
global.postgresql.postgresqlPassword
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Auxiliary function to get the right value for enabled.replication.
|
||||
|
||||
Usage:
|
||||
{{ include "common.postgresql.values.enabled.replication" (dict "subchart" "true" "context" $) }}
|
||||
Params:
|
||||
- subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false
|
||||
*/}}
|
||||
{{- define "common.postgresql.values.enabled.replication" -}}
|
||||
{{- if .subchart -}}
|
||||
{{- printf "%v" .context.Values.postgresql.replication.enabled -}}
|
||||
{{- else -}}
|
||||
{{- printf "%v" .context.Values.replication.enabled -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Auxiliary function to get the right value for the key replication.password.
|
||||
|
||||
Usage:
|
||||
{{ include "common.postgresql.values.key.replicationPassword" (dict "subchart" "true" "context" $) }}
|
||||
Params:
|
||||
- subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false
|
||||
*/}}
|
||||
{{- define "common.postgresql.values.key.replicationPassword" -}}
|
||||
{{- if .subchart -}}
|
||||
postgresql.replication.password
|
||||
{{- else -}}
|
||||
replication.password
|
||||
{{- end -}}
|
||||
{{- end -}}
|
@ -0,0 +1,48 @@
|
||||
{{/*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Auxiliary function to get the right value for enabled redis.
|
||||
|
||||
Usage:
|
||||
{{ include "common.redis.values.enabled" (dict "context" $) }}
|
||||
*/}}
|
||||
{{- define "common.redis.values.enabled" -}}
|
||||
{{- if .subchart -}}
|
||||
{{- printf "%v" .context.Values.redis.enabled -}}
|
||||
{{- else -}}
|
||||
{{- printf "%v" (not .context.Values.enabled) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Auxiliary function to get the right prefix path for the values
|
||||
|
||||
Usage:
|
||||
{{ include "common.redis.values.key.prefix" (dict "subchart" "true" "context" $) }}
|
||||
Params:
|
||||
- subchart - Boolean - Optional. Whether redis is used as subchart or not. Default: false
|
||||
*/}}
|
||||
{{- define "common.redis.values.keys.prefix" -}}
|
||||
{{- if .subchart -}}redis.{{- else -}}{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Checks whether the redis chart's includes the standarizations (version >= 14)
|
||||
|
||||
Usage:
|
||||
{{ include "common.redis.values.standarized.version" (dict "context" $) }}
|
||||
*/}}
|
||||
{{- define "common.redis.values.standarized.version" -}}
|
||||
|
||||
{{- $standarizedAuth := printf "%s%s" (include "common.redis.values.keys.prefix" .) "auth" -}}
|
||||
{{- $standarizedAuthValues := include "common.utils.getValueFromKey" (dict "key" $standarizedAuth "context" .context) }}
|
||||
|
||||
{{- if $standarizedAuthValues -}}
|
||||
{{- true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
@ -0,0 +1,51 @@
|
||||
{{/*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Validate values must not be empty.
|
||||
|
||||
Usage:
|
||||
{{- $validateValueConf00 := (dict "valueKey" "path.to.value" "secret" "secretName" "field" "password-00") -}}
|
||||
{{- $validateValueConf01 := (dict "valueKey" "path.to.value" "secret" "secretName" "field" "password-01") -}}
|
||||
{{ include "common.validations.values.empty" (dict "required" (list $validateValueConf00 $validateValueConf01) "context" $) }}
|
||||
|
||||
Validate value params:
|
||||
- valueKey - String - Required. The path to the validating value in the values.yaml, e.g: "mysql.password"
|
||||
- secret - String - Optional. Name of the secret where the validating value is generated/stored, e.g: "mysql-passwords-secret"
|
||||
- field - String - Optional. Name of the field in the secret data, e.g: "mysql-password"
|
||||
*/}}
|
||||
{{- define "common.validations.values.multiple.empty" -}}
|
||||
{{- range .required -}}
|
||||
{{- include "common.validations.values.single.empty" (dict "valueKey" .valueKey "secret" .secret "field" .field "context" $.context) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Validate a value must not be empty.
|
||||
|
||||
Usage:
|
||||
{{ include "common.validations.value.empty" (dict "valueKey" "mariadb.password" "secret" "secretName" "field" "my-password" "subchart" "subchart" "context" $) }}
|
||||
|
||||
Validate value params:
|
||||
- valueKey - String - Required. The path to the validating value in the values.yaml, e.g: "mysql.password"
|
||||
- secret - String - Optional. Name of the secret where the validating value is generated/stored, e.g: "mysql-passwords-secret"
|
||||
- field - String - Optional. Name of the field in the secret data, e.g: "mysql-password"
|
||||
- subchart - String - Optional - Name of the subchart that the validated password is part of.
|
||||
*/}}
|
||||
{{- define "common.validations.values.single.empty" -}}
|
||||
{{- $value := include "common.utils.getValueFromKey" (dict "key" .valueKey "context" .context) }}
|
||||
{{- $subchart := ternary "" (printf "%s." .subchart) (empty .subchart) }}
|
||||
|
||||
{{- if not $value -}}
|
||||
{{- $varname := "my-value" -}}
|
||||
{{- $getCurrentValue := "" -}}
|
||||
{{- if and .secret .field -}}
|
||||
{{- $varname = include "common.utils.fieldToEnvVar" . -}}
|
||||
{{- $getCurrentValue = printf " To get the current value:\n\n %s\n" (include "common.utils.secret.getvalue" .) -}}
|
||||
{{- end -}}
|
||||
{{- printf "\n '%s' must not be empty, please add '--set %s%s=$%s' to the command.%s" .valueKey $subchart .valueKey $varname $getCurrentValue -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
8
manifests/valkey/charts/common/values.yaml
Normal file
8
manifests/valkey/charts/common/values.yaml
Normal file
@ -0,0 +1,8 @@
|
||||
# Copyright Broadcom, Inc. All Rights Reserved.
|
||||
# SPDX-License-Identifier: APACHE-2.0
|
||||
|
||||
## bitnami/common
|
||||
## It is required by CI/CD tools and processes.
|
||||
## @skip exampleValue
|
||||
##
|
||||
exampleValue: common-chart
|
214
manifests/valkey/templates/NOTES.txt
Normal file
214
manifests/valkey/templates/NOTES.txt
Normal file
@ -0,0 +1,214 @@
|
||||
CHART NAME: {{ .Chart.Name }}
|
||||
CHART VERSION: {{ .Chart.Version }}
|
||||
APP VERSION: {{ .Chart.AppVersion }}
|
||||
|
||||
Did you know there are enterprise versions of the Bitnami catalog? For enhanced secure software supply chain features, unlimited pulls from Docker, LTS support, or application customization, see Bitnami Premium or Tanzu Application Catalog. See https://www.arrow.com/globalecs/na/vendors/bitnami for more information.
|
||||
|
||||
** Please be patient while the chart is being deployed **
|
||||
|
||||
{{- if .Values.diagnosticMode.enabled }}
|
||||
The chart has been deployed in diagnostic mode. All probes have been disabled and the command has been overwritten with:
|
||||
|
||||
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 4 }}
|
||||
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 4 }}
|
||||
|
||||
Get the list of pods by executing:
|
||||
|
||||
kubectl get pods --namespace {{ include "common.names.namespace" . }} -l app.kubernetes.io/instance={{ .Release.Name }}
|
||||
|
||||
Access the pod you want to debug by executing
|
||||
|
||||
kubectl exec --namespace {{ include "common.names.namespace" . }} -ti <NAME OF THE POD> -- bash
|
||||
|
||||
In order to replicate the container startup scripts execute this command:
|
||||
|
||||
For Valkey:
|
||||
|
||||
/opt/bitnami/scripts/valkey/entrypoint.sh /opt/bitnami/scripts/valkey/run.sh
|
||||
|
||||
{{- if .Values.sentinel.enabled }}
|
||||
|
||||
For Valkey Sentinel:
|
||||
|
||||
/opt/bitnami/scripts/valkey-sentinel/entrypoint.sh /opt/bitnami/scripts/valkey-sentinel/run.sh
|
||||
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
|
||||
{{- if contains .Values.primary.service.type "LoadBalancer" }}
|
||||
{{- if not .Values.auth.enabled }}
|
||||
{{ if and (not .Values.networkPolicy.enabled) (.Values.networkPolicy.allowExternal) }}
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
WARNING
|
||||
|
||||
By specifying "primary.service.type=LoadBalancer" and "auth.enabled=false" you have
|
||||
most likely exposed the Valkey service externally without any authentication
|
||||
mechanism.
|
||||
|
||||
For security reasons, we strongly suggest that you switch to "ClusterIP" or
|
||||
"NodePort". As alternative, you can also switch to "auth.enabled=true"
|
||||
providing a valid password on "password" parameter.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if and .Values.auth.usePasswordFiles (not .Values.auth.usePasswordFileFromSecret) (or (empty .Values.primary.initContainers) (empty .Values.replica.initContainers)) }}
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
WARNING
|
||||
|
||||
By specifying ".Values.auth.usePasswordFiles=true" and ".Values.auth.usePasswordFileFromSecret=false"
|
||||
Valkey is expecting that the password is mounted as a file in each pod
|
||||
(by default in /opt/bitnami/valkey/secrets/valkey-password)
|
||||
|
||||
Ensure that you specify the respective initContainers in
|
||||
both .Values.primary.initContainers and .Values.replica.initContainers
|
||||
in order to populate the contents of this file.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
{{- end }}
|
||||
|
||||
{{- if eq .Values.architecture "replication" }}
|
||||
{{- if .Values.sentinel.enabled }}
|
||||
|
||||
Valkey can be accessed via port {{ .Values.sentinel.service.ports.valkey }} on the following DNS name from within your cluster:
|
||||
|
||||
{{ template "common.names.fullname" . }}.{{ include "common.names.namespace" . }}.svc.{{ .Values.clusterDomain }} for read only operations
|
||||
|
||||
For read/write operations, first access the Valkey Sentinel cluster, which is available in port {{ .Values.sentinel.service.ports.sentinel }} using the same domain name above.
|
||||
|
||||
{{- else }}
|
||||
|
||||
Valkey can be accessed on the following DNS names from within your cluster:
|
||||
|
||||
{{ printf "%s-primary.%s.svc.%s" (include "common.names.fullname" .) (include "common.names.namespace" . ) .Values.clusterDomain }} for read/write operations (port {{ .Values.primary.service.ports.valkey }})
|
||||
{{ printf "%s-replicas.%s.svc.%s" (include "common.names.fullname" .) (include "common.names.namespace" . ) .Values.clusterDomain }} for read-only operations (port {{ .Values.replica.service.ports.valkey }})
|
||||
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
|
||||
Valkey can be accessed via port {{ .Values.primary.service.ports.valkey }} on the following DNS name from within your cluster:
|
||||
|
||||
{{ template "common.names.fullname" . }}-primary.{{ include "common.names.namespace" . }}.svc.{{ .Values.clusterDomain }}
|
||||
|
||||
{{- end }}
|
||||
|
||||
{{ if .Values.auth.enabled }}
|
||||
|
||||
To get your password run:
|
||||
|
||||
export VALKEY_PASSWORD=$(kubectl get secret --namespace {{ include "common.names.namespace" . }} {{ include "valkey.secretName" . }} -o jsonpath="{.data.{{ include "valkey.secretPasswordKey" . }}}" | base64 -d)
|
||||
|
||||
{{- end }}
|
||||
|
||||
To connect to your Valkey server:
|
||||
|
||||
1. Run a Valkey pod that you can use as a client:
|
||||
|
||||
kubectl run --namespace {{ include "common.names.namespace" . }} valkey-client --restart='Never' {{ if .Values.auth.enabled }} --env VALKEY_PASSWORD=$VALKEY_PASSWORD {{ end }} --image {{ template "valkey.image" . }} --command -- sleep infinity
|
||||
|
||||
{{- if .Values.tls.enabled }}
|
||||
|
||||
Copy your TLS certificates to the pod:
|
||||
|
||||
kubectl cp --namespace {{ include "common.names.namespace" . }} /path/to/client.cert valkey-client:/tmp/client.cert
|
||||
kubectl cp --namespace {{ include "common.names.namespace" . }} /path/to/client.key valkey-client:/tmp/client.key
|
||||
kubectl cp --namespace {{ include "common.names.namespace" . }} /path/to/CA.cert valkey-client:/tmp/CA.cert
|
||||
|
||||
{{- end }}
|
||||
|
||||
Use the following command to attach to the pod:
|
||||
|
||||
kubectl exec --tty -i valkey-client \
|
||||
{{- if and (.Values.networkPolicy.enabled) (not .Values.networkPolicy.allowExternal) }}--labels="{{ template "common.names.fullname" . }}-client=true" \{{- end }}
|
||||
--namespace {{ include "common.names.namespace" . }} -- bash
|
||||
|
||||
2. Connect using the Valkey CLI:
|
||||
|
||||
{{- if eq .Values.architecture "replication" }}
|
||||
{{- if .Values.sentinel.enabled }}
|
||||
{{ if .Values.auth.enabled }}REDISCLI_AUTH="$VALKEY_PASSWORD" {{ end }}valkey-cli -h {{ template "common.names.fullname" . }} -p {{ .Values.sentinel.service.ports.valkey }}{{ if .Values.tls.enabled }} --tls --cert /tmp/client.cert --key /tmp/client.key --cacert /tmp/CA.cert{{ end }} # Read only operations
|
||||
{{ if .Values.auth.enabled }}REDISCLI_AUTH="$VALKEY_PASSWORD" {{ end }}valkey-cli -h {{ template "common.names.fullname" . }} -p {{ .Values.sentinel.service.ports.sentinel }}{{ if .Values.tls.enabled }} --tls --cert /tmp/client.cert --key /tmp/client.key --cacert /tmp/CA.cert{{ end }} # Sentinel access
|
||||
{{- else }}
|
||||
{{ if .Values.auth.enabled }}REDISCLI_AUTH="$VALKEY_PASSWORD" {{ end }}valkey-cli -h {{ printf "%s-primary" (include "common.names.fullname" .) }}{{ if .Values.tls.enabled }} --tls --cert /tmp/client.cert --key /tmp/client.key --cacert /tmp/CA.cert{{ end }}
|
||||
{{ if .Values.auth.enabled }}REDISCLI_AUTH="$VALKEY_PASSWORD" {{ end }}valkey-cli -h {{ printf "%s-replicas" (include "common.names.fullname" .) }}{{ if .Values.tls.enabled }} --tls --cert /tmp/client.cert --key /tmp/client.key --cacert /tmp/CA.cert{{ end }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{ if .Values.auth.enabled }}REDISCLI_AUTH="$VALKEY_PASSWORD" {{ end }}valkey-cli -h {{ template "common.names.fullname" . }}-primary{{ if .Values.tls.enabled }} --tls --cert /tmp/client.cert --key /tmp/client.key --cacert /tmp/CA.cert{{ end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if and (.Values.networkPolicy.enabled) (not .Values.networkPolicy.allowExternal) }}
|
||||
|
||||
Note: Since NetworkPolicy is enabled, only pods with label {{ template "common.names.fullname" . }}-client=true" will be able to connect to valkey.
|
||||
|
||||
{{- else }}
|
||||
|
||||
To connect to your database from outside the cluster execute the following commands:
|
||||
|
||||
{{- if and (eq .Values.architecture "replication") .Values.sentinel.enabled }}
|
||||
{{- if contains "NodePort" .Values.sentinel.service.type }}
|
||||
|
||||
export NODE_IP=$(kubectl get nodes --namespace {{ include "common.names.namespace" . }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||
export NODE_PORT=$(kubectl get --namespace {{ include "common.names.namespace" . }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "common.names.fullname" . }})
|
||||
{{ if .Values.auth.enabled }}REDISCLI_AUTH="$VALKEY_PASSWORD" {{ end }}valkey-cli -h $NODE_IP -p $NODE_PORT {{- if .Values.tls.enabled }} --tls --cert /tmp/client.cert --key /tmp/client.key --cacert /tmp/CA.cert{{ end }}
|
||||
|
||||
{{- else if contains "LoadBalancer" .Values.sentinel.service.type }}
|
||||
|
||||
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
||||
Watch the status with: 'kubectl get svc --namespace {{ include "common.names.namespace" . }} -w {{ template "common.names.fullname" . }}'
|
||||
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ include "common.names.namespace" . }} {{ template "common.names.fullname" . }} --template "{{ "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}" }}")
|
||||
{{ if .Values.auth.enabled }}REDISCLI_AUTH="$VALKEY_PASSWORD" {{ end }}valkey-cli -h $SERVICE_IP -p {{ .Values.sentinel.service.ports.valkey }} {{- if .Values.tls.enabled }} --tls --cert /tmp/client.cert --key /tmp/client.key --cacert /tmp/CA.cert{{ end }}
|
||||
|
||||
{{- else if contains "ClusterIP" .Values.sentinel.service.type }}
|
||||
|
||||
kubectl port-forward --namespace {{ include "common.names.namespace" . }} svc/{{ template "common.names.fullname" . }} {{ .Values.sentinel.service.ports.valkey }}:{{ .Values.sentinel.service.ports.valkey }} &
|
||||
{{ if .Values.auth.enabled }}REDISCLI_AUTH="$VALKEY_PASSWORD" {{ end }}valkey-cli -h 127.0.0.1 -p {{ .Values.sentinel.service.ports.valkey }} {{- if .Values.tls.enabled }} --tls --cert /tmp/client.cert --key /tmp/client.key --cacert /tmp/CA.cert{{ end }}
|
||||
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- if contains "NodePort" .Values.primary.service.type }}
|
||||
|
||||
export NODE_IP=$(kubectl get nodes --namespace {{ include "common.names.namespace" . }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||
export NODE_PORT=$(kubectl get --namespace {{ include "common.names.namespace" . }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ printf "%s-primary" (include "common.names.fullname" .) }})
|
||||
{{ if .Values.auth.enabled }}REDISCLI_AUTH="$VALKEY_PASSWORD" {{ end }}valkey-cli -h $NODE_IP -p $NODE_PORT {{- if .Values.tls.enabled }} --tls --cert /tmp/client.cert --key /tmp/client.key --cacert /tmp/CA.cert{{ end }}
|
||||
|
||||
{{- else if contains "LoadBalancer" .Values.primary.service.type }}
|
||||
|
||||
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
||||
Watch the status with: 'kubectl get svc --namespace {{ include "common.names.namespace" . }} -w {{ template "common.names.fullname" . }}'
|
||||
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ include "common.names.namespace" . }} {{ printf "%s-primary" (include "common.names.fullname" .) }} --template "{{ "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}" }}")
|
||||
{{ if .Values.auth.enabled }}REDISCLI_AUTH="$VALKEY_PASSWORD" {{ end }}valkey-cli -h $SERVICE_IP -p {{ .Values.primary.service.ports.valkey }} {{- if .Values.tls.enabled }} --tls --cert /tmp/client.cert --key /tmp/client.key --cacert /tmp/CA.cert{{ end }}
|
||||
|
||||
{{- else if contains "ClusterIP" .Values.primary.service.type }}
|
||||
|
||||
kubectl port-forward --namespace {{ include "common.names.namespace" . }} svc/{{ printf "%s-primary" (include "common.names.fullname" .) }} {{ .Values.primary.service.ports.valkey }}:{{ .Values.primary.service.ports.valkey }} &
|
||||
{{ if .Values.auth.enabled }}REDISCLI_AUTH="$VALKEY_PASSWORD" {{ end }}valkey-cli -h 127.0.0.1 -p {{ .Values.primary.service.ports.valkey }} {{- if .Values.tls.enabled }} --tls --cert /tmp/client.cert --key /tmp/client.key --cacert /tmp/CA.cert{{ end }}
|
||||
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- include "valkey.checkRollingTags" . }}
|
||||
{{- include "valkey.validateValues" . }}
|
||||
|
||||
{{- if and (eq .Values.architecture "replication") .Values.sentinel.enabled (eq .Values.sentinel.service.type "NodePort") (not .Release.IsUpgrade ) }}
|
||||
{{- if $.Values.sentinel.service.nodePorts.sentinel }}
|
||||
No need to upgrade, ports and nodeports have been set from values
|
||||
{{- else }}
|
||||
#!#!#!#!#!#!#!# IMPORTANT #!#!#!#!#!#!#!#
|
||||
YOU NEED TO PERFORM AN UPGRADE FOR THE SERVICES AND WORKLOAD TO BE CREATED
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $resourceSections := list "metrics" "replica" "sentinel" "volumePermissions" }}
|
||||
{{- if not (and (eq .Values.architecture "replication") .Values.sentinel.enabled) }}
|
||||
{{- $resourceSections = append $resourceSections "primary" -}}
|
||||
{{- end }}
|
||||
{{- include "common.warnings.resources" (dict "sections" $resourceSections "context" $) }}
|
||||
{{- include "common.warnings.modifiedImages" (dict "images" (list .Values.image .Values.sentinel.image .Values.metrics.image .Values.volumePermissions.image .Values.kubectl.image) "context" $) }}
|
||||
{{- include "common.errors.insecureImages" (dict "images" (list .Values.image .Values.sentinel.image .Values.metrics.image .Values.volumePermissions.image .Values.kubectl.image) "context" $) }}
|
277
manifests/valkey/templates/_helpers.tpl
Normal file
277
manifests/valkey/templates/_helpers.tpl
Normal file
@ -0,0 +1,277 @@
|
||||
{{/*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
|
||||
{{/*
|
||||
Return the proper Valkey image name
|
||||
*/}}
|
||||
{{- define "valkey.image" -}}
|
||||
{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper Valkey Sentinel image name
|
||||
*/}}
|
||||
{{- define "valkey.sentinel.image" -}}
|
||||
{{ include "common.images.image" (dict "imageRoot" .Values.sentinel.image "global" .Values.global) }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper image name (for the metrics image)
|
||||
*/}}
|
||||
{{- define "valkey.metrics.image" -}}
|
||||
{{ include "common.images.image" (dict "imageRoot" .Values.metrics.image "global" .Values.global) }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper image name (for the init container volume-permissions image)
|
||||
*/}}
|
||||
{{- define "valkey.volumePermissions.image" -}}
|
||||
{{ include "common.images.image" (dict "imageRoot" .Values.volumePermissions.image "global" .Values.global) }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return kubectl image
|
||||
*/}}
|
||||
{{- define "valkey.kubectl.image" -}}
|
||||
{{ include "common.images.image" (dict "imageRoot" .Values.kubectl.image "global" .Values.global) }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper Docker Image Registry Secret Names
|
||||
*/}}
|
||||
{{- define "valkey.imagePullSecrets" -}}
|
||||
{{- include "common.images.renderPullSecrets" (dict "images" (list .Values.image .Values.sentinel.image .Values.metrics.image .Values.volumePermissions.image) "context" $) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return true if a TLS secret object should be created
|
||||
*/}}
|
||||
{{- define "valkey.createTlsSecret" -}}
|
||||
{{- if and .Values.tls.enabled .Values.tls.autoGenerated (not .Values.tls.existingSecret) }}
|
||||
{{- true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the secret containing Valkey TLS certificates
|
||||
*/}}
|
||||
{{- define "valkey.tlsSecretName" -}}
|
||||
{{- if .Values.tls.existingSecret -}}
|
||||
{{- printf "%s" (tpl .Values.tls.existingSecret $) -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-crt" (include "common.names.fullname" .) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the path to the cert file.
|
||||
*/}}
|
||||
{{- define "valkey.tlsCert" -}}
|
||||
{{- if (include "valkey.createTlsSecret" . ) -}}
|
||||
{{- printf "/opt/bitnami/valkey/certs/%s" "tls.crt" -}}
|
||||
{{- else -}}
|
||||
{{- required "Certificate filename is required when TLS in enabled" .Values.tls.certFilename | printf "/opt/bitnami/valkey/certs/%s" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the path to the cert key file.
|
||||
*/}}
|
||||
{{- define "valkey.tlsCertKey" -}}
|
||||
{{- if (include "valkey.createTlsSecret" . ) -}}
|
||||
{{- printf "/opt/bitnami/valkey/certs/%s" "tls.key" -}}
|
||||
{{- else -}}
|
||||
{{- required "Certificate Key filename is required when TLS in enabled" .Values.tls.certKeyFilename | printf "/opt/bitnami/valkey/certs/%s" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the path to the CA cert file.
|
||||
*/}}
|
||||
{{- define "valkey.tlsCACert" -}}
|
||||
{{- if (include "valkey.createTlsSecret" . ) -}}
|
||||
{{- printf "/opt/bitnami/valkey/certs/%s" "ca.crt" -}}
|
||||
{{- else -}}
|
||||
{{- required "Certificate CA filename is required when TLS in enabled" .Values.tls.certCAFilename | printf "/opt/bitnami/valkey/certs/%s" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the path to the DH params file.
|
||||
*/}}
|
||||
{{- define "valkey.tlsDHParams" -}}
|
||||
{{- if .Values.tls.dhParamsFilename -}}
|
||||
{{- printf "/opt/bitnami/valkey/certs/%s" .Values.tls.dhParamsFilename -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create the name of the shared service account to use
|
||||
*/}}
|
||||
{{- define "valkey.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
{{ default (include "common.names.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else -}}
|
||||
{{ default "default" .Values.serviceAccount.name }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create the name of the primary service account to use
|
||||
*/}}
|
||||
{{- define "valkey.primaryServiceAccountName" -}}
|
||||
{{- if .Values.primary.serviceAccount.create -}}
|
||||
{{ default (printf "%s-primary" (include "common.names.fullname" .)) .Values.primary.serviceAccount.name }}
|
||||
{{- else -}}
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
{{ template "valkey.serviceAccountName" . }}
|
||||
{{- else -}}
|
||||
{{ default "default" .Values.primary.serviceAccount.name }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create the name of the replicas service account to use
|
||||
*/}}
|
||||
{{- define "valkey.replicaServiceAccountName" -}}
|
||||
{{- if .Values.replica.serviceAccount.create -}}
|
||||
{{ default (printf "%s-replica" (include "common.names.fullname" .)) .Values.replica.serviceAccount.name }}
|
||||
{{- else -}}
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
{{ template "valkey.serviceAccountName" . }}
|
||||
{{- else -}}
|
||||
{{ default "default" .Values.replica.serviceAccount.name }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the configuration configmap name
|
||||
*/}}
|
||||
{{- define "valkey.configmapName" -}}
|
||||
{{- if .Values.existingConfigmap -}}
|
||||
{{- print (tpl .Values.existingConfigmap $) -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-configuration" (include "common.names.fullname" .) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return true if a configmap object should be created
|
||||
*/}}
|
||||
{{- define "valkey.createConfigmap" -}}
|
||||
{{- if empty .Values.existingConfigmap }}
|
||||
{{- true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Get the password secret.
|
||||
*/}}
|
||||
{{- define "valkey.secretName" -}}
|
||||
{{- if .Values.auth.existingSecret -}}
|
||||
{{- print (tpl .Values.auth.existingSecret $) -}}
|
||||
{{- else -}}
|
||||
{{- print (include "common.names.fullname" .) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Get the password key to be retrieved from Valkey secret.
|
||||
*/}}
|
||||
{{- define "valkey.secretPasswordKey" -}}
|
||||
{{- if and .Values.auth.existingSecret .Values.auth.existingSecretPasswordKey -}}
|
||||
{{- print (tpl .Values.auth.existingSecretPasswordKey $) -}}
|
||||
{{- else -}}
|
||||
{{- print "valkey-password" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Check if there are rolling tags in the images */}}
|
||||
{{- define "valkey.checkRollingTags" -}}
|
||||
{{- include "common.warnings.rollingTag" .Values.image }}
|
||||
{{- include "common.warnings.rollingTag" .Values.sentinel.image }}
|
||||
{{- include "common.warnings.rollingTag" .Values.metrics.image }}
|
||||
{{- include "common.warnings.rollingTag" .Values.volumePermissions.image }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Compile all warnings into a single message, and call fail.
|
||||
*/}}
|
||||
{{- define "valkey.validateValues" -}}
|
||||
{{- $messages := list -}}
|
||||
{{- $messages := append $messages (include "valkey.validateValues.architecture" .) -}}
|
||||
{{- $messages := append $messages (include "valkey.validateValues.podSecurityPolicy.create" .) -}}
|
||||
{{- $messages := append $messages (include "valkey.validateValues.tls" .) -}}
|
||||
{{- $messages := append $messages (include "valkey.validateValues.createPrimary" .) -}}
|
||||
{{- $messages := without $messages "" -}}
|
||||
{{- $message := join "\n" $messages -}}
|
||||
|
||||
{{- if $message -}}
|
||||
{{- printf "\nVALUES VALIDATION:\n%s" $message | fail -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Validate values of Valkey - must provide a valid architecture */}}
|
||||
{{- define "valkey.validateValues.architecture" -}}
|
||||
{{- if and (ne .Values.architecture "standalone") (ne .Values.architecture "replication") -}}
|
||||
valkey: architecture
|
||||
Invalid architecture selected. Valid values are "standalone" and
|
||||
"replication". Please set a valid architecture (--set architecture="xxxx")
|
||||
{{- end -}}
|
||||
{{- if and .Values.sentinel.enabled (not (eq .Values.architecture "replication")) }}
|
||||
valkey: architecture
|
||||
Using valkey sentinel on standalone mode is not supported.
|
||||
To deploy valkey sentinel, please select the "replication" mode
|
||||
(--set "architecture=replication,sentinel.enabled=true")
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Validate values of Valkey - PodSecurityPolicy create */}}
|
||||
{{- define "valkey.validateValues.podSecurityPolicy.create" -}}
|
||||
{{- if and .Values.podSecurityPolicy.create (not .Values.podSecurityPolicy.enabled) }}
|
||||
valkey: podSecurityPolicy.create
|
||||
In order to create PodSecurityPolicy, you also need to enable
|
||||
podSecurityPolicy.enabled field
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Validate values of Valkey - TLS enabled */}}
|
||||
{{- define "valkey.validateValues.tls" -}}
|
||||
{{- if and .Values.tls.enabled (not .Values.tls.autoGenerated) (not .Values.tls.existingSecret) }}
|
||||
valkey: tls.enabled
|
||||
In order to enable TLS, you also need to provide
|
||||
an existing secret containing the TLS certificates or
|
||||
enable auto-generated certificates.
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Validate values of Valkey - primary service enabled */}}
|
||||
{{- define "valkey.validateValues.createPrimary" -}}
|
||||
{{- if and .Values.sentinel.service.createPrimary (or (not .Values.rbac.create) (not .Values.replica.automountServiceAccountToken) (not .Values.serviceAccount.create)) }}
|
||||
valkey: sentinel.service.createPrimary
|
||||
In order to redirect requests only to the primary pod via the service, you also need to
|
||||
create rbac and serviceAccount. In addition, you need to enable
|
||||
replica.automountServiceAccountToken.
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Define the suffix utilized for external-dns */}}
|
||||
{{- define "valkey.externalDNS.suffix" -}}
|
||||
{{ printf "%s.%s" (include "common.names.fullname" .) .Values.useExternalDNS.suffix }}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Compile all annotations utilized for external-dns */}}
|
||||
{{- define "valkey.externalDNS.annotations" -}}
|
||||
{{- if and .Values.useExternalDNS.enabled .Values.useExternalDNS.annotationKey }}
|
||||
{{ .Values.useExternalDNS.annotationKey }}hostname: {{ include "valkey.externalDNS.suffix" . }}
|
||||
{{- range $key, $val := .Values.useExternalDNS.additionalAnnotations }}
|
||||
{{ $.Values.useExternalDNS.annotationKey }}{{ $key }}: {{ $val | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
65
manifests/valkey/templates/configmap.yaml
Normal file
65
manifests/valkey/templates/configmap.yaml
Normal file
@ -0,0 +1,65 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{- if (include "valkey.createConfigmap" .) }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ printf "%s-configuration" (include "common.names.fullname" .) }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/part-of: valkey
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
data:
|
||||
valkey.conf: |-
|
||||
# User-supplied common configuration:
|
||||
{{- if .Values.commonConfiguration }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.commonConfiguration "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
# End of common configuration
|
||||
primary.conf: |-
|
||||
dir {{ .Values.primary.persistence.path }}
|
||||
# User-supplied primary configuration:
|
||||
{{- if .Values.primary.configuration }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.primary.configuration "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.primary.disableCommands }}
|
||||
{{- range .Values.primary.disableCommands }}
|
||||
rename-command {{ . }} ""
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
# End of primary configuration
|
||||
replica.conf: |-
|
||||
dir {{ .Values.replica.persistence.path }}
|
||||
# User-supplied replica configuration:
|
||||
{{- if .Values.replica.configuration }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.replica.configuration "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.disableCommands }}
|
||||
{{- range .Values.replica.disableCommands }}
|
||||
rename-command {{ . }} ""
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
# End of replica configuration
|
||||
{{- if .Values.sentinel.enabled }}
|
||||
sentinel.conf: |-
|
||||
dir "/tmp"
|
||||
port {{ .Values.sentinel.containerPorts.sentinel }}
|
||||
sentinel monitor {{ .Values.sentinel.primarySet }} {{ template "common.names.fullname" . }}-node-0.{{ template "common.names.fullname" . }}-headless.{{ include "common.names.namespace" . }}.svc.{{ .Values.clusterDomain }} {{ .Values.sentinel.service.ports.valkey }} {{ .Values.sentinel.quorum }}
|
||||
sentinel down-after-milliseconds {{ .Values.sentinel.primarySet }} {{ .Values.sentinel.downAfterMilliseconds }}
|
||||
sentinel failover-timeout {{ .Values.sentinel.primarySet }} {{ .Values.sentinel.failoverTimeout }}
|
||||
sentinel parallel-syncs {{ .Values.sentinel.primarySet }} {{ .Values.sentinel.parallelSyncs }}
|
||||
{{- if .Values.sentinel.service.createPrimary}}
|
||||
sentinel client-reconfig-script {{ .Values.sentinel.primarySet }} /opt/bitnami/scripts/start-scripts/push-primary-label.sh
|
||||
{{- end }}
|
||||
# User-supplied sentinel configuration:
|
||||
{{- if .Values.sentinel.configuration }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.sentinel.configuration "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
# End of sentinel configuration
|
||||
{{- end }}
|
||||
{{- end }}
|
9
manifests/valkey/templates/extra-list.yaml
Normal file
9
manifests/valkey/templates/extra-list.yaml
Normal file
@ -0,0 +1,9 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{- range .Values.extraDeploy }}
|
||||
---
|
||||
{{ include "common.tplvalues.render" (dict "value" . "context" $) }}
|
||||
{{- end }}
|
36
manifests/valkey/templates/headless-svc.yaml
Normal file
36
manifests/valkey/templates/headless-svc.yaml
Normal file
@ -0,0 +1,36 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ printf "%s-headless" (include "common.names.fullname" .) }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/part-of: valkey
|
||||
{{- if or .Values.sentinel.service.headless.annotations .Values.commonAnnotations (include "valkey.externalDNS.annotations" .) }}
|
||||
annotations:
|
||||
{{- if or .Values.sentinel.service.headless.annotations .Values.commonAnnotations }}
|
||||
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.sentinel.service.headless.annotations .Values.commonAnnotations ) "context" . ) }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- include "valkey.externalDNS.annotations" . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
type: ClusterIP
|
||||
clusterIP: None
|
||||
{{- if .Values.sentinel.enabled }}
|
||||
publishNotReadyAddresses: true
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: tcp-redis
|
||||
port: {{ if .Values.sentinel.enabled }}{{ .Values.replica.containerPorts.valkey }}{{ else }} {{ .Values.primary.containerPorts.valkey }}{{ end }}
|
||||
targetPort: redis
|
||||
{{- if .Values.sentinel.enabled }}
|
||||
- name: tcp-sentinel
|
||||
port: {{ .Values.sentinel.containerPorts.sentinel }}
|
||||
targetPort: valkey-sentinel
|
||||
{{- end }}
|
||||
selector: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
194
manifests/valkey/templates/health-configmap.yaml
Normal file
194
manifests/valkey/templates/health-configmap.yaml
Normal file
@ -0,0 +1,194 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ printf "%s-health" (include "common.names.fullname" .) }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
data:
|
||||
ping_readiness_local.sh: |-
|
||||
#!/bin/bash
|
||||
|
||||
[[ -f $VALKEY_PASSWORD_FILE ]] && export VALKEY_PASSWORD="$(< "${VALKEY_PASSWORD_FILE}")"
|
||||
[[ -n "$VALKEY_PASSWORD" ]] && export REDISCLI_AUTH="$VALKEY_PASSWORD"
|
||||
response=$(
|
||||
timeout -s 15 $1 \
|
||||
valkey-cli \
|
||||
-h localhost \
|
||||
{{- if .Values.tls.enabled }}
|
||||
-p $VALKEY_TLS_PORT \
|
||||
--tls \
|
||||
--cacert {{ template "valkey.tlsCACert" . }} \
|
||||
{{- if .Values.tls.authClients }}
|
||||
--cert {{ template "valkey.tlsCert" . }} \
|
||||
--key {{ template "valkey.tlsCertKey" . }} \
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
-p $VALKEY_PORT \
|
||||
{{- end }}
|
||||
ping
|
||||
)
|
||||
if [ "$?" -eq "124" ]; then
|
||||
echo "Timed out"
|
||||
exit 1
|
||||
fi
|
||||
if [ "$response" != "PONG" ]; then
|
||||
echo "$response"
|
||||
exit 1
|
||||
fi
|
||||
ping_liveness_local.sh: |-
|
||||
#!/bin/bash
|
||||
|
||||
[[ -f $VALKEY_PASSWORD_FILE ]] && export VALKEY_PASSWORD="$(< "${VALKEY_PASSWORD_FILE}")"
|
||||
[[ -n "$VALKEY_PASSWORD" ]] && export REDISCLI_AUTH="$VALKEY_PASSWORD"
|
||||
response=$(
|
||||
timeout -s 15 $1 \
|
||||
valkey-cli \
|
||||
-h localhost \
|
||||
{{- if .Values.tls.enabled }}
|
||||
-p $VALKEY_TLS_PORT \
|
||||
--tls \
|
||||
--cacert {{ template "valkey.tlsCACert" . }} \
|
||||
{{- if .Values.tls.authClients }}
|
||||
--cert {{ template "valkey.tlsCert" . }} \
|
||||
--key {{ template "valkey.tlsCertKey" . }} \
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
-p $VALKEY_PORT \
|
||||
{{- end }}
|
||||
ping
|
||||
)
|
||||
if [ "$?" -eq "124" ]; then
|
||||
echo "Timed out"
|
||||
exit 1
|
||||
fi
|
||||
responseFirstWord=$(echo $response | head -n1 | awk '{print $1;}')
|
||||
if [ "$response" != "PONG" ] && [ "$responseFirstWord" != "LOADING" ] && [ "$responseFirstWord" != "MASTERDOWN" ]; then
|
||||
echo "$response"
|
||||
exit 1
|
||||
fi
|
||||
{{- if .Values.sentinel.enabled }}
|
||||
ping_sentinel.sh: |-
|
||||
#!/bin/bash
|
||||
|
||||
{{- if .Values.auth.sentinel }}
|
||||
[[ -f $VALKEY_PASSWORD_FILE ]] && export VALKEY_PASSWORD="$(< "${VALKEY_PASSWORD_FILE}")"
|
||||
[[ -n "$VALKEY_PASSWORD" ]] && export REDISCLI_AUTH="$VALKEY_PASSWORD"
|
||||
{{- end }}
|
||||
response=$(
|
||||
timeout -s 15 $1 \
|
||||
valkey-cli \
|
||||
-h localhost \
|
||||
{{- if .Values.tls.enabled }}
|
||||
-p $VALKEY_SENTINEL_TLS_PORT_NUMBER \
|
||||
--tls \
|
||||
--cacert "$VALKEY_SENTINEL_TLS_CA_FILE" \
|
||||
{{- if .Values.tls.authClients }}
|
||||
--cert "$VALKEY_SENTINEL_TLS_CERT_FILE" \
|
||||
--key "$VALKEY_SENTINEL_TLS_KEY_FILE" \
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
-p $VALKEY_SENTINEL_PORT \
|
||||
{{- end }}
|
||||
ping
|
||||
)
|
||||
if [ "$?" -eq "124" ]; then
|
||||
echo "Timed out"
|
||||
exit 1
|
||||
fi
|
||||
if [ "$response" != "PONG" ]; then
|
||||
echo "$response"
|
||||
exit 1
|
||||
fi
|
||||
parse_sentinels.awk: |-
|
||||
/ip/ {FOUND_IP=1}
|
||||
/port/ {FOUND_PORT=1}
|
||||
/runid/ {FOUND_RUNID=1}
|
||||
!/ip|port|runid/ {
|
||||
if (FOUND_IP==1) {
|
||||
IP=$1; FOUND_IP=0;
|
||||
}
|
||||
else if (FOUND_PORT==1) {
|
||||
PORT=$1;
|
||||
FOUND_PORT=0;
|
||||
} else if (FOUND_RUNID==1) {
|
||||
printf "\nsentinel known-sentinel {{ .Values.sentinel.primarySet }} %s %s %s", IP, PORT, $0; FOUND_RUNID=0;
|
||||
}
|
||||
}
|
||||
{{- end }}
|
||||
ping_readiness_primary.sh: |-
|
||||
#!/bin/bash
|
||||
|
||||
[[ -f $VALKEY_PRIMARY_PASSWORD_FILE ]] && export VALKEY_PRIMARY_PASSWORD="$(< "${VALKEY_PRIMARY_PASSWORD_FILE}")"
|
||||
[[ -n "$VALKEY_PRIMARY_PASSWORD" ]] && export REDISCLI_AUTH="$VALKEY_PRIMARY_PASSWORD"
|
||||
response=$(
|
||||
timeout -s 15 $1 \
|
||||
valkey-cli \
|
||||
-h $VALKEY_PRIMARY_HOST \
|
||||
-p $VALKEY_PRIMARY_PORT_NUMBER \
|
||||
{{- if .Values.tls.enabled }}
|
||||
--tls \
|
||||
--cacert {{ template "valkey.tlsCACert" . }} \
|
||||
{{- if .Values.tls.authClients }}
|
||||
--cert {{ template "valkey.tlsCert" . }} \
|
||||
--key {{ template "valkey.tlsCertKey" . }} \
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
ping
|
||||
)
|
||||
if [ "$?" -eq "124" ]; then
|
||||
echo "Timed out"
|
||||
exit 1
|
||||
fi
|
||||
if [ "$response" != "PONG" ]; then
|
||||
echo "$response"
|
||||
exit 1
|
||||
fi
|
||||
ping_liveness_primary.sh: |-
|
||||
#!/bin/bash
|
||||
|
||||
[[ -f $VALKEY_PRIMARY_PASSWORD_FILE ]] && export VALKEY_PRIMARY_PASSWORD="$(< "${VALKEY_PRIMARY_PASSWORD_FILE}")"
|
||||
[[ -n "$VALKEY_PRIMARY_PASSWORD" ]] && export REDISCLI_AUTH="$VALKEY_PRIMARY_PASSWORD"
|
||||
response=$(
|
||||
timeout -s 15 $1 \
|
||||
valkey-cli \
|
||||
-h $VALKEY_PRIMARY_HOST \
|
||||
-p $VALKEY_PRIMARY_PORT_NUMBER \
|
||||
{{- if .Values.tls.enabled }}
|
||||
--tls \
|
||||
--cacert {{ template "valkey.tlsCACert" . }} \
|
||||
{{- if .Values.tls.authClients }}
|
||||
--cert {{ template "valkey.tlsCert" . }} \
|
||||
--key {{ template "valkey.tlsCertKey" . }} \
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
ping
|
||||
)
|
||||
if [ "$?" -eq "124" ]; then
|
||||
echo "Timed out"
|
||||
exit 1
|
||||
fi
|
||||
responseFirstWord=$(echo $response | head -n1 | awk '{print $1;}')
|
||||
if [ "$response" != "PONG" ] && [ "$responseFirstWord" != "LOADING" ]; then
|
||||
echo "$response"
|
||||
exit 1
|
||||
fi
|
||||
ping_readiness_local_and_primary.sh: |-
|
||||
script_dir="$(dirname "$0")"
|
||||
exit_status=0
|
||||
"$script_dir/ping_readiness_local.sh" $1 || exit_status=$?
|
||||
"$script_dir/ping_readiness_primary.sh" $1 || exit_status=$?
|
||||
exit $exit_status
|
||||
ping_liveness_local_and_primary.sh: |-
|
||||
script_dir="$(dirname "$0")"
|
||||
exit_status=0
|
||||
"$script_dir/ping_liveness_local.sh" $1 || exit_status=$?
|
||||
"$script_dir/ping_liveness_primary.sh" $1 || exit_status=$?
|
||||
exit $exit_status
|
45
manifests/valkey/templates/metrics-svc.yaml
Normal file
45
manifests/valkey/templates/metrics-svc.yaml
Normal file
@ -0,0 +1,45 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{- if and .Values.metrics.enabled .Values.metrics.service.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ printf "%s-metrics" (include "common.names.fullname" .) }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/component: metrics
|
||||
app.kubernetes.io/part-of: valkey
|
||||
{{- if or .Values.metrics.service.annotations .Values.commonAnnotations }}
|
||||
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.metrics.service.annotations .Values.commonAnnotations ) "context" . ) }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
type: {{ .Values.metrics.service.type }}
|
||||
{{- if and .Values.metrics.service.clusterIP (eq .Values.metrics.service.type "ClusterIP") }}
|
||||
clusterIP: {{ .Values.metrics.service.clusterIP }}
|
||||
{{- end }}
|
||||
{{- if eq .Values.metrics.service.type "LoadBalancer" }}
|
||||
externalTrafficPolicy: {{ .Values.metrics.service.externalTrafficPolicy }}
|
||||
{{- end }}
|
||||
{{- if and (eq .Values.metrics.service.type "LoadBalancer") .Values.metrics.service.loadBalancerIP }}
|
||||
loadBalancerIP: {{ .Values.metrics.service.loadBalancerIP }}
|
||||
{{- end }}
|
||||
{{- if and (eq .Values.metrics.service.type "LoadBalancer") .Values.metrics.service.loadBalancerClass }}
|
||||
loadBalancerClass: {{ .Values.metrics.service.loadBalancerClass }}
|
||||
{{- end }}
|
||||
{{- if and (eq .Values.metrics.service.type "LoadBalancer") .Values.metrics.service.loadBalancerSourceRanges }}
|
||||
loadBalancerSourceRanges: {{- toYaml .Values.metrics.service.loadBalancerSourceRanges | nindent 4 }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: http-metrics
|
||||
port: {{ .Values.metrics.service.ports.http }}
|
||||
protocol: TCP
|
||||
targetPort: metrics
|
||||
{{- if .Values.metrics.service.extraPorts }}
|
||||
{{- include "common.tplvalues.render" (dict "value" .Values.metrics.service.extraPorts "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
selector: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
109
manifests/valkey/templates/networkpolicy.yaml
Normal file
109
manifests/valkey/templates/networkpolicy.yaml
Normal file
@ -0,0 +1,109 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{- if .Values.networkPolicy.enabled }}
|
||||
kind: NetworkPolicy
|
||||
apiVersion: {{ include "common.capabilities.networkPolicy.apiVersion" . }}
|
||||
metadata:
|
||||
name: {{ template "common.names.fullname" . }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/part-of: valkey
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
podSelector:
|
||||
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 6 }}
|
||||
policyTypes:
|
||||
- Ingress
|
||||
- Egress
|
||||
{{- if .Values.networkPolicy.allowExternalEgress }}
|
||||
egress:
|
||||
- {}
|
||||
{{- else }}
|
||||
egress:
|
||||
{{- if eq .Values.architecture "replication" }}
|
||||
# Allow dns resolution
|
||||
- ports:
|
||||
- port: 53
|
||||
protocol: UDP
|
||||
# Allow outbound connections to other cluster pods
|
||||
- ports:
|
||||
- port: {{ .Values.primary.containerPorts.valkey }}
|
||||
{{- if .Values.sentinel.enabled }}
|
||||
- port: {{ .Values.sentinel.containerPorts.sentinel }}
|
||||
{{- end }}
|
||||
to:
|
||||
- podSelector:
|
||||
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 14 }}
|
||||
{{- end }}
|
||||
{{- if .Values.networkPolicy.extraEgress }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.networkPolicy.extraEgress "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
ingress:
|
||||
# Allow inbound connections
|
||||
- ports:
|
||||
- port: {{ .Values.primary.containerPorts.valkey }}
|
||||
{{- if .Values.sentinel.enabled }}
|
||||
- port: {{ .Values.sentinel.containerPorts.sentinel }}
|
||||
{{- end }}
|
||||
{{- if not .Values.networkPolicy.allowExternal }}
|
||||
from:
|
||||
- podSelector:
|
||||
matchLabels:
|
||||
{{ template "common.names.fullname" . }}-client: "true"
|
||||
- podSelector:
|
||||
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 14 }}
|
||||
{{- if or .Values.networkPolicy.ingressNSMatchLabels .Values.networkPolicy.ingressNSPodMatchLabels }}
|
||||
- namespaceSelector:
|
||||
matchLabels:
|
||||
{{- if .Values.networkPolicy.ingressNSMatchLabels }}
|
||||
{{- range $key, $value := .Values.networkPolicy.ingressNSMatchLabels }}
|
||||
{{ $key | quote }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
{{ else }}
|
||||
{}
|
||||
{{- end }}
|
||||
{{- if .Values.networkPolicy.ingressNSPodMatchLabels }}
|
||||
podSelector:
|
||||
matchLabels:
|
||||
{{- range $key, $value := .Values.networkPolicy.ingressNSPodMatchLabels }}
|
||||
{{ $key | quote }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.enabled }}
|
||||
# Allow prometheus scrapes for metrics
|
||||
- ports:
|
||||
- port: {{ .Values.metrics.containerPorts.http }}
|
||||
{{- if not .Values.networkPolicy.metrics.allowExternal }}
|
||||
from:
|
||||
{{- if or .Values.networkPolicy.metrics.ingressNSMatchLabels .Values.networkPolicy.metrics.ingressNSPodMatchLabels }}
|
||||
- namespaceSelector:
|
||||
matchLabels:
|
||||
{{- if .Values.networkPolicy.metrics.ingressNSMatchLabels }}
|
||||
{{- range $key, $value := .Values.networkPolicy.metrics.ingressNSMatchLabels }}
|
||||
{{ $key | quote }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
{{ else }}
|
||||
{}
|
||||
{{- end }}
|
||||
{{- if .Values.networkPolicy.metrics.ingressNSPodMatchLabels }}
|
||||
podSelector:
|
||||
matchLabels:
|
||||
{{- range $key, $value := .Values.networkPolicy.metrics.ingressNSPodMatchLabels }}
|
||||
{{ $key | quote }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.networkPolicy.extraIngress }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.networkPolicy.extraIngress "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
82
manifests/valkey/templates/podmonitor.yaml
Normal file
82
manifests/valkey/templates/podmonitor.yaml
Normal file
@ -0,0 +1,82 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{- if and .Values.metrics.enabled .Values.metrics.podMonitor.enabled }}
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: PodMonitor
|
||||
metadata:
|
||||
name: {{ template "common.names.fullname" . }}
|
||||
namespace: {{ default (include "common.names.namespace" .) .Values.metrics.podMonitor.namespace | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/part-of: valkey
|
||||
{{- if .Values.metrics.podMonitor.additionalLabels }}
|
||||
{{- include "common.tplvalues.render" (dict "value" .Values.metrics.podMonitor.additionalLabels "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
podMetricsEndpoints:
|
||||
- port: {{ .Values.metrics.podMonitor.port }}
|
||||
{{- if .Values.metrics.podMonitor.interval }}
|
||||
interval: {{ .Values.metrics.podMonitor.interval }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.podMonitor.scrapeTimeout }}
|
||||
scrapeTimeout: {{ .Values.metrics.podMonitor.scrapeTimeout }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.podMonitor.honorLabels }}
|
||||
honorLabels: {{ .Values.metrics.podMonitor.honorLabels }}
|
||||
{{- end }}
|
||||
{{- with .Values.metrics.podMonitor.relabelings }}
|
||||
relabelings: {{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.podMonitor.metricRelabelings }}
|
||||
metricRelabelings: {{- toYaml .Values.metrics.podMonitor.metricRelabelings | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- range .Values.metrics.podMonitor.additionalEndpoints }}
|
||||
- port: {{ .port }}
|
||||
{{- if .interval }}
|
||||
interval: {{ .interval }}
|
||||
{{- end }}
|
||||
{{- if .path }}
|
||||
path: {{ .path }}
|
||||
{{- end }}
|
||||
{{- if .honorLabels }}
|
||||
honorLabels: {{ .honorLabels }}
|
||||
{{- end }}
|
||||
{{- with .relabelings }}
|
||||
relabelings: {{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- if .metricRelabelings }}
|
||||
metricRelabelings: {{- toYaml .metricRelabelings | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- if .scrapeTimeout }}
|
||||
scrapeTimeout: {{ .scrapeTimeout }}
|
||||
{{- end }}
|
||||
{{- if .params }}
|
||||
params:
|
||||
{{- range $key, $value := .params }}
|
||||
{{ $key }}:
|
||||
{{- range $value }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.serviceMonitor.podTargetLabels }}
|
||||
podTargetLabels: {{- toYaml .Values.metrics.podMonitor.podTargetLabels | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.metrics.podMonitor.sampleLimit -}}
|
||||
sampleLimit: {{ . }}
|
||||
{{- end }}
|
||||
{{- with .Values.metrics.podMonitor.targetLimit -}}
|
||||
targetLimit: {{ . }}
|
||||
{{- end }}
|
||||
namespaceSelector:
|
||||
matchNames:
|
||||
- {{ include "common.names.namespace" . | quote }}
|
||||
selector:
|
||||
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 6 }}
|
||||
{{- end }}
|
520
manifests/valkey/templates/primary/application.yaml
Normal file
520
manifests/valkey/templates/primary/application.yaml
Normal file
@ -0,0 +1,520 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{- if or (eq .Values.primary.kind "DaemonSet") (gt (int64 .Values.primary.replicaCount) 0) -}}
|
||||
{{- if or (not (eq .Values.architecture "replication")) (not .Values.sentinel.enabled) }}
|
||||
apiVersion: {{ include "common.capabilities.statefulset.apiVersion" . }}
|
||||
kind: {{ .Values.primary.kind }}
|
||||
metadata:
|
||||
name: {{ printf "%s-primary" (include "common.names.fullname" .) }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/component: primary
|
||||
app.kubernetes.io/part-of: valkey
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if not (eq .Values.primary.kind "DaemonSet") }}
|
||||
replicas: {{ .Values.primary.replicaCount }}
|
||||
{{- end }}
|
||||
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.primary.podLabels .Values.commonLabels ) "context" . ) }}
|
||||
selector:
|
||||
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
|
||||
app.kubernetes.io/component: primary
|
||||
{{- if (eq .Values.primary.kind "StatefulSet") }}
|
||||
serviceName: {{ printf "%s-headless" (include "common.names.fullname" .) }}
|
||||
{{- end }}
|
||||
{{- if .Values.primary.updateStrategy }}
|
||||
{{- if (eq .Values.primary.kind "Deployment") }}
|
||||
strategy: {{- toYaml .Values.primary.updateStrategy | nindent 4 }}
|
||||
{{- else }}
|
||||
updateStrategy: {{- toYaml .Values.primary.updateStrategy | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.primary.minReadySeconds }}
|
||||
minReadySeconds: {{ .Values.primary.minReadySeconds }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
template:
|
||||
metadata:
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" $podLabels "context" $ ) | nindent 8 }}
|
||||
app.kubernetes.io/component: primary
|
||||
{{- if and .Values.metrics.enabled .Values.metrics.podLabels }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.podLabels "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
annotations:
|
||||
{{- if (include "valkey.createConfigmap" .) }}
|
||||
checksum/configmap: {{ pick ( include (print $.Template.BasePath "/configmap.yaml") . | fromYaml ) "data" | toYaml | sha256sum }}
|
||||
{{- end }}
|
||||
checksum/health: {{ pick ( include (print $.Template.BasePath "/health-configmap.yaml") . | fromYaml ) "data" | toYaml | sha256sum }}
|
||||
checksum/scripts: {{ pick ( include (print $.Template.BasePath "/scripts-configmap.yaml") . | fromYaml ) "data" | toYaml | sha256sum }}
|
||||
checksum/secret: {{ pick ( include (print $.Template.BasePath "/secret.yaml") . | fromYaml ) "data" | toYaml | sha256sum }}
|
||||
{{- if .Values.primary.podAnnotations }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.primary.podAnnotations "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if and .Values.metrics.enabled .Values.metrics.podAnnotations }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.podAnnotations "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- include "valkey.imagePullSecrets" . | nindent 6 }}
|
||||
{{- if .Values.primary.hostAliases }}
|
||||
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.primary.hostAliases "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.primary.podSecurityContext.enabled }}
|
||||
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.primary.podSecurityContext "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ template "valkey.primaryServiceAccountName" . }}
|
||||
automountServiceAccountToken: {{ .Values.primary.automountServiceAccountToken }}
|
||||
{{- if .Values.primary.priorityClassName }}
|
||||
priorityClassName: {{ .Values.primary.priorityClassName | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.primary.affinity }}
|
||||
affinity: {{- include "common.tplvalues.render" (dict "value" .Values.primary.affinity "context" $) | nindent 8 }}
|
||||
{{- else }}
|
||||
affinity:
|
||||
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.primary.podAffinityPreset "component" "primary" "customLabels" $podLabels "context" $) | nindent 10 }}
|
||||
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.primary.podAntiAffinityPreset "component" "primary" "customLabels" $podLabels "context" $) | nindent 10 }}
|
||||
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.primary.nodeAffinityPreset.type "key" .Values.primary.nodeAffinityPreset.key "values" .Values.primary.nodeAffinityPreset.values) | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- if .Values.primary.nodeSelector }}
|
||||
nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.primary.nodeSelector "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.primary.tolerations }}
|
||||
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.primary.tolerations "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.primary.topologySpreadConstraints }}
|
||||
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.primary.topologySpreadConstraints "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.primary.shareProcessNamespace }}
|
||||
shareProcessNamespace: {{ .Values.primary.shareProcessNamespace }}
|
||||
{{- end }}
|
||||
{{- if .Values.primary.schedulerName }}
|
||||
schedulerName: {{ .Values.primary.schedulerName | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.primary.dnsPolicy }}
|
||||
dnsPolicy: {{ .Values.primary.dnsPolicy }}
|
||||
{{- end }}
|
||||
{{- if .Values.primary.dnsConfig }}
|
||||
dnsConfig: {{- include "common.tplvalues.render" (dict "value" .Values.primary.dnsConfig "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
enableServiceLinks: {{ .Values.primary.enableServiceLinks }}
|
||||
terminationGracePeriodSeconds: {{ .Values.primary.terminationGracePeriodSeconds }}
|
||||
{{- $needsVolumePermissions := and .Values.volumePermissions.enabled .Values.primary.persistence.enabled .Values.primary.podSecurityContext.enabled .Values.primary.containerSecurityContext.enabled }}
|
||||
{{- if or .Values.primary.initContainers $needsVolumePermissions }}
|
||||
initContainers:
|
||||
{{- if .Values.primary.initContainers }}
|
||||
{{- include "common.tplvalues.render" (dict "value" .Values.primary.initContainers "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if $needsVolumePermissions }}
|
||||
- name: volume-permissions
|
||||
image: {{ include "valkey.volumePermissions.image" . }}
|
||||
imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }}
|
||||
command:
|
||||
- /bin/bash
|
||||
- -ec
|
||||
- |
|
||||
{{- if eq ( toString ( .Values.volumePermissions.containerSecurityContext.runAsUser )) "auto" }}
|
||||
chown -R `id -u`:`id -G | cut -d " " -f2` {{ .Values.primary.persistence.path }}
|
||||
{{- else }}
|
||||
chown -R {{ .Values.primary.containerSecurityContext.runAsUser }}:{{ .Values.primary.podSecurityContext.fsGroup }} {{ .Values.primary.persistence.path }}
|
||||
{{- end }}
|
||||
{{- if eq ( toString ( .Values.volumePermissions.containerSecurityContext.runAsUser )) "auto" }}
|
||||
securityContext: {{- omit .Values.volumePermissions.containerSecurityContext "runAsUser" | toYaml | nindent 12 }}
|
||||
{{- else }}
|
||||
securityContext: {{- .Values.volumePermissions.containerSecurityContext | toYaml | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.volumePermissions.resources }}
|
||||
resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }}
|
||||
{{- else if ne .Values.volumePermissions.resourcesPreset "none" }}
|
||||
resources: {{- include "common.resources.preset" (dict "type" .Values.volumePermissions.resourcesPreset) | nindent 12 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: empty-dir
|
||||
mountPath: /tmp
|
||||
subPath: tmp-dir
|
||||
- name: valkey-data
|
||||
mountPath: {{ .Values.primary.persistence.path }}
|
||||
{{- if .Values.primary.persistence.subPath }}
|
||||
subPath: {{ .Values.primary.persistence.subPath }}
|
||||
{{- else if .Values.primary.persistence.subPathExpr }}
|
||||
subPathExpr: {{ .Values.primary.persistence.subPathExpr }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: valkey
|
||||
image: {{ template "valkey.image" . }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
|
||||
{{- if .Values.primary.lifecycleHooks }}
|
||||
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.primary.lifecycleHooks "context" $) | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.primary.containerSecurityContext.enabled }}
|
||||
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.primary.containerSecurityContext "context" $) | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.diagnosticMode.enabled }}
|
||||
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
|
||||
{{- else if .Values.primary.command }}
|
||||
command: {{- include "common.tplvalues.render" (dict "value" .Values.primary.command "context" $) | nindent 12 }}
|
||||
{{- else }}
|
||||
command:
|
||||
- /bin/bash
|
||||
{{- end }}
|
||||
{{- if .Values.diagnosticMode.enabled }}
|
||||
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
|
||||
{{- else if .Values.primary.args }}
|
||||
args: {{- include "common.tplvalues.render" (dict "value" .Values.primary.args "context" $) | nindent 12 }}
|
||||
{{- else }}
|
||||
args:
|
||||
- -c
|
||||
- /opt/bitnami/scripts/start-scripts/start-primary.sh
|
||||
{{- end }}
|
||||
env:
|
||||
- name: BITNAMI_DEBUG
|
||||
value: {{ ternary "true" "false" (or .Values.image.debug .Values.diagnosticMode.enabled) | quote }}
|
||||
- name: VALKEY_REPLICATION_MODE
|
||||
value: primary
|
||||
- name: ALLOW_EMPTY_PASSWORD
|
||||
value: {{ ternary "no" "yes" .Values.auth.enabled | quote }}
|
||||
{{- if .Values.auth.enabled }}
|
||||
{{- if .Values.auth.usePasswordFiles }}
|
||||
- name: VALKEY_PASSWORD_FILE
|
||||
value: "/opt/bitnami/valkey/secrets/valkey-password"
|
||||
{{- else }}
|
||||
- name: VALKEY_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "valkey.secretName" . }}
|
||||
key: {{ template "valkey.secretPasswordKey" . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
- name: VALKEY_TLS_ENABLED
|
||||
value: {{ ternary "yes" "no" .Values.tls.enabled | quote }}
|
||||
{{- if .Values.tls.enabled }}
|
||||
- name: VALKEY_TLS_PORT
|
||||
value: {{ .Values.primary.containerPorts.valkey | quote }}
|
||||
- name: VALKEY_TLS_AUTH_CLIENTS
|
||||
value: {{ ternary "yes" "no" .Values.tls.authClients | quote }}
|
||||
- name: VALKEY_TLS_CERT_FILE
|
||||
value: {{ template "valkey.tlsCert" . }}
|
||||
- name: VALKEY_TLS_KEY_FILE
|
||||
value: {{ template "valkey.tlsCertKey" . }}
|
||||
- name: VALKEY_TLS_CA_FILE
|
||||
value: {{ template "valkey.tlsCACert" . }}
|
||||
{{- if .Values.tls.dhParamsFilename }}
|
||||
- name: VALKEY_TLS_DH_PARAMS_FILE
|
||||
value: {{ template "valkey.tlsDHParams" . }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
- name: VALKEY_PORT
|
||||
value: {{ .Values.primary.containerPorts.valkey | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.primary.extraEnvVars }}
|
||||
{{- include "common.tplvalues.render" (dict "value" .Values.primary.extraEnvVars "context" $) | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if or .Values.primary.extraEnvVarsCM .Values.primary.extraEnvVarsSecret }}
|
||||
envFrom:
|
||||
{{- if .Values.primary.extraEnvVarsCM }}
|
||||
- configMapRef:
|
||||
name: {{ .Values.primary.extraEnvVarsCM }}
|
||||
{{- end }}
|
||||
{{- if .Values.primary.extraEnvVarsSecret }}
|
||||
- secretRef:
|
||||
name: {{ .Values.primary.extraEnvVarsSecret }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: redis
|
||||
containerPort: {{ .Values.primary.containerPorts.valkey }}
|
||||
{{- if not .Values.diagnosticMode.enabled }}
|
||||
{{- if .Values.primary.customStartupProbe }}
|
||||
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.primary.customStartupProbe "context" $) | nindent 12 }}
|
||||
{{- else if .Values.primary.startupProbe.enabled }}
|
||||
startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.primary.startupProbe "enabled") "context" $) | nindent 12 }}
|
||||
tcpSocket:
|
||||
port: redis
|
||||
{{- end }}
|
||||
{{- if .Values.primary.customLivenessProbe }}
|
||||
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.primary.customLivenessProbe "context" $) | nindent 12 }}
|
||||
{{- else if .Values.primary.livenessProbe.enabled }}
|
||||
livenessProbe:
|
||||
initialDelaySeconds: {{ .Values.primary.livenessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.primary.livenessProbe.periodSeconds }}
|
||||
# One second longer than command timeout should prevent generation of zombie processes.
|
||||
timeoutSeconds: {{ add1 .Values.primary.livenessProbe.timeoutSeconds }}
|
||||
successThreshold: {{ .Values.primary.livenessProbe.successThreshold }}
|
||||
failureThreshold: {{ .Values.primary.livenessProbe.failureThreshold }}
|
||||
exec:
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- /health/ping_liveness_local.sh {{ .Values.primary.livenessProbe.timeoutSeconds }}
|
||||
{{- end }}
|
||||
{{- if .Values.primary.customReadinessProbe }}
|
||||
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.primary.customReadinessProbe "context" $) | nindent 12 }}
|
||||
{{- else if .Values.primary.readinessProbe.enabled }}
|
||||
readinessProbe:
|
||||
initialDelaySeconds: {{ .Values.primary.readinessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.primary.readinessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ add1 .Values.primary.readinessProbe.timeoutSeconds }}
|
||||
successThreshold: {{ .Values.primary.readinessProbe.successThreshold }}
|
||||
failureThreshold: {{ .Values.primary.readinessProbe.failureThreshold }}
|
||||
exec:
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- /health/ping_readiness_local.sh {{ .Values.primary.readinessProbe.timeoutSeconds }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.primary.resources }}
|
||||
resources: {{- toYaml .Values.primary.resources | nindent 12 }}
|
||||
{{- else if ne .Values.primary.resourcesPreset "none" }}
|
||||
resources: {{- include "common.resources.preset" (dict "type" .Values.primary.resourcesPreset) | nindent 12 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: start-scripts
|
||||
mountPath: /opt/bitnami/scripts/start-scripts
|
||||
- name: health
|
||||
mountPath: /health
|
||||
{{- if and .Values.auth.enabled .Values.auth.usePasswordFiles }}
|
||||
- name: valkey-password
|
||||
mountPath: /opt/bitnami/valkey/secrets/
|
||||
{{- end }}
|
||||
- name: valkey-data
|
||||
mountPath: {{ .Values.primary.persistence.path }}
|
||||
{{- if .Values.primary.persistence.subPath }}
|
||||
subPath: {{ .Values.primary.persistence.subPath }}
|
||||
{{- else if .Values.primary.persistence.subPathExpr }}
|
||||
subPathExpr: {{ .Values.primary.persistence.subPathExpr }}
|
||||
{{- end }}
|
||||
- name: config
|
||||
mountPath: /opt/bitnami/valkey/mounted-etc
|
||||
- name: empty-dir
|
||||
mountPath: /opt/bitnami/valkey/etc/
|
||||
subPath: app-conf-dir
|
||||
- name: empty-dir
|
||||
mountPath: /tmp
|
||||
subPath: tmp-dir
|
||||
{{- if .Values.tls.enabled }}
|
||||
- name: valkey-certificates
|
||||
mountPath: /opt/bitnami/valkey/certs
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- if .Values.primary.extraVolumeMounts }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.primary.extraVolumeMounts "context" $ ) | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.enabled }}
|
||||
- name: metrics
|
||||
image: {{ include "valkey.metrics.image" . }}
|
||||
imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }}
|
||||
{{- if .Values.metrics.containerSecurityContext.enabled }}
|
||||
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.metrics.containerSecurityContext "context" $) | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.diagnosticMode.enabled }}
|
||||
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
|
||||
{{- else if .Values.metrics.command }}
|
||||
command: {{- include "common.tplvalues.render" (dict "value" .Values.metrics.command "context" $) | nindent 12 }}
|
||||
{{- else }}
|
||||
command:
|
||||
- /bin/bash
|
||||
- -c
|
||||
- |
|
||||
{{- if and .Values.auth.enabled .Values.auth.usePasswordFiles }}
|
||||
export REDIS_PASSWORD="$(< $REDIS_PASSWORD_FILE)"
|
||||
{{- end }}
|
||||
redis_exporter{{- range $key, $value := .Values.metrics.extraArgs }} --{{ $key }}={{ $value }}{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.diagnosticMode.enabled }}
|
||||
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
|
||||
{{- end }}
|
||||
env:
|
||||
- name: REDIS_ALIAS
|
||||
value: {{ template "common.names.fullname" . }}
|
||||
- name: REDIS_EXPORTER_WEB_LISTEN_ADDRESS
|
||||
value: {{ printf ":%v" .Values.metrics.containerPorts.http }}
|
||||
{{- if .Values.auth.enabled }}
|
||||
- name: REDIS_USER
|
||||
value: default
|
||||
{{- if .Values.auth.usePasswordFiles }}
|
||||
- name: REDIS_PASSWORD_FILE
|
||||
value: "/secrets/valkey-password"
|
||||
{{- else }}
|
||||
- name: REDIS_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "valkey.secretName" . }}
|
||||
key: {{ template "valkey.secretPasswordKey" . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.tls.enabled }}
|
||||
- name: REDIS_ADDR
|
||||
value: valkeys://{{ .Values.metrics.valkeyTargetHost }}:{{ .Values.primary.containerPorts.valkey }}
|
||||
{{- if .Values.tls.authClients }}
|
||||
- name: REDIS_EXPORTER_TLS_CLIENT_KEY_FILE
|
||||
value: {{ template "valkey.tlsCertKey" . }}
|
||||
- name: REDIS_EXPORTER_TLS_CLIENT_CERT_FILE
|
||||
value: {{ template "valkey.tlsCert" . }}
|
||||
{{- end }}
|
||||
- name: REDIS_EXPORTER_TLS_CA_CERT_FILE
|
||||
value: {{ template "valkey.tlsCACert" . }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.extraEnvVars }}
|
||||
{{- include "common.tplvalues.render" (dict "value" .Values.metrics.extraEnvVars "context" $) | nindent 12 }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: metrics
|
||||
containerPort: {{ .Values.metrics.containerPorts.http }}
|
||||
{{- if not .Values.diagnosticMode.enabled }}
|
||||
{{- if .Values.metrics.customStartupProbe }}
|
||||
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.metrics.customStartupProbe "context" $) | nindent 12 }}
|
||||
{{- else if .Values.metrics.startupProbe.enabled }}
|
||||
startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.metrics.startupProbe "enabled") "context" $) | nindent 12 }}
|
||||
tcpSocket:
|
||||
port: metrics
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.customLivenessProbe }}
|
||||
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.metrics.customLivenessProbe "context" $) | nindent 12 }}
|
||||
{{- else if .Values.metrics.livenessProbe.enabled }}
|
||||
livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.metrics.livenessProbe "enabled") "context" $) | nindent 12 }}
|
||||
tcpSocket:
|
||||
port: metrics
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.customReadinessProbe }}
|
||||
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.metrics.customReadinessProbe "context" $) | nindent 12 }}
|
||||
{{- else if .Values.metrics.readinessProbe.enabled }}
|
||||
readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.metrics.readinessProbe "enabled") "context" $) | nindent 12 }}
|
||||
httpGet:
|
||||
path: /
|
||||
port: metrics
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.resources }}
|
||||
resources: {{- toYaml .Values.metrics.resources | nindent 12 }}
|
||||
{{- else if ne .Values.metrics.resourcesPreset "none" }}
|
||||
resources: {{- include "common.resources.preset" (dict "type" .Values.metrics.resourcesPreset) | nindent 12 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: empty-dir
|
||||
mountPath: /tmp
|
||||
subPath: app-tmp-dir
|
||||
{{- if and .Values.auth.enabled .Values.auth.usePasswordFiles }}
|
||||
- name: valkey-password
|
||||
mountPath: /secrets/
|
||||
{{- end }}
|
||||
{{- if .Values.tls.enabled }}
|
||||
- name: valkey-certificates
|
||||
mountPath: /opt/bitnami/valkey/certs
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.extraVolumeMounts }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.extraVolumeMounts "context" $ ) | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.primary.sidecars }}
|
||||
{{- include "common.tplvalues.render" (dict "value" .Values.primary.sidecars "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: start-scripts
|
||||
configMap:
|
||||
name: {{ printf "%s-scripts" (include "common.names.fullname" .) }}
|
||||
defaultMode: 0755
|
||||
- name: health
|
||||
configMap:
|
||||
name: {{ printf "%s-health" (include "common.names.fullname" .) }}
|
||||
defaultMode: 0755
|
||||
{{- if and .Values.auth.enabled .Values.auth.usePasswordFiles }}
|
||||
- name: valkey-password
|
||||
{{ if .Values.auth.usePasswordFileFromSecret }}
|
||||
secret:
|
||||
secretName: {{ template "valkey.secretName" . }}
|
||||
items:
|
||||
- key: {{ template "valkey.secretPasswordKey" . }}
|
||||
path: valkey-password
|
||||
{{- else }}
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
- name: config
|
||||
configMap:
|
||||
name: {{ include "valkey.configmapName" . }}
|
||||
- name: empty-dir
|
||||
{{- if or .Values.primary.persistence.medium .Values.primary.persistence.sizeLimit }}
|
||||
emptyDir:
|
||||
{{- if .Values.primary.persistence.medium }}
|
||||
medium: {{ .Values.primary.persistence.medium | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.primary.persistence.sizeLimit }}
|
||||
sizeLimit: {{ .Values.primary.persistence.sizeLimit | quote }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
{{- if .Values.tls.enabled }}
|
||||
- name: valkey-certificates
|
||||
secret:
|
||||
secretName: {{ include "valkey.tlsSecretName" . }}
|
||||
defaultMode: 256
|
||||
{{- end }}
|
||||
{{- if .Values.primary.extraVolumes }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.primary.extraVolumes "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.extraVolumes }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.extraVolumes "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if or (not .Values.primary.persistence.enabled) (eq .Values.primary.kind "DaemonSet") }}
|
||||
- name: valkey-data
|
||||
{{- if or .Values.primary.persistence.medium .Values.primary.persistence.sizeLimit }}
|
||||
emptyDir:
|
||||
{{- if .Values.primary.persistence.medium }}
|
||||
medium: {{ .Values.primary.persistence.medium | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.primary.persistence.sizeLimit }}
|
||||
sizeLimit: {{ .Values.primary.persistence.sizeLimit | quote }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
{{- else if .Values.primary.persistence.existingClaim }}
|
||||
- name: valkey-data
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ printf "%s" (tpl .Values.primary.persistence.existingClaim .) }}
|
||||
{{- else if (eq .Values.primary.kind "Deployment") }}
|
||||
- name: valkey-data
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ printf "valkey-data-%s-primary" (include "common.names.fullname" .) }}
|
||||
{{- else }}
|
||||
{{- if .Values.primary.persistentVolumeClaimRetentionPolicy.enabled }}
|
||||
persistentVolumeClaimRetentionPolicy:
|
||||
whenDeleted: {{ .Values.primary.persistentVolumeClaimRetentionPolicy.whenDeleted }}
|
||||
whenScaled: {{ .Values.primary.persistentVolumeClaimRetentionPolicy.whenScaled }}
|
||||
{{- end }}
|
||||
volumeClaimTemplates:
|
||||
- apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: valkey-data
|
||||
{{- $claimLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.primary.persistence.labels .Values.commonLabels ) "context" . ) }}
|
||||
labels: {{- include "common.labels.matchLabels" ( dict "customLabels" $claimLabels "context" $ ) | nindent 10 }}
|
||||
app.kubernetes.io/component: primary
|
||||
{{- if .Values.primary.persistence.annotations }}
|
||||
annotations: {{- toYaml .Values.primary.persistence.annotations | nindent 10 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
accessModes:
|
||||
{{- range .Values.primary.persistence.accessModes }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.primary.persistence.size | quote }}
|
||||
{{- if .Values.primary.persistence.selector }}
|
||||
selector: {{- include "common.tplvalues.render" (dict "value" .Values.primary.persistence.selector "context" $) | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- if .Values.primary.persistence.dataSource }}
|
||||
dataSource: {{- include "common.tplvalues.render" (dict "value" .Values.primary.persistence.dataSource "context" $) | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- include "common.storage.class" (dict "persistence" .Values.primary.persistence "global" .Values.global) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
28
manifests/valkey/templates/primary/pdb.yaml
Normal file
28
manifests/valkey/templates/primary/pdb.yaml
Normal file
@ -0,0 +1,28 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{- $pdb := coalesce .Values.pdb .Values.primary.pdb }}
|
||||
{{- if and $pdb.create (gt (int64 .Values.primary.count) 0) (or (not (eq .Values.architecture "replication")) (not .Values.sentinel.enabled)) }}
|
||||
apiVersion: {{ include "common.capabilities.policy.apiVersion" . }}
|
||||
kind: PodDisruptionBudget
|
||||
metadata:
|
||||
name: {{ printf "%s-primary" (include "common.names.fullname" .) }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/component: primary
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if $pdb.minAvailable }}
|
||||
minAvailable: {{ $pdb.minAvailable }}
|
||||
{{- end }}
|
||||
{{- if or $pdb.maxUnavailable (not $pdb.minAvailable)}}
|
||||
maxUnavailable: {{ $pdb.maxUnavailable | default 1 }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 6 }}
|
||||
app.kubernetes.io/component: primary
|
||||
{{- end }}
|
48
manifests/valkey/templates/primary/psp.yaml
Normal file
48
manifests/valkey/templates/primary/psp.yaml
Normal file
@ -0,0 +1,48 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{- if and (include "common.capabilities.psp.supported" .) .Values.podSecurityPolicy.create }}
|
||||
apiVersion: policy/v1beta1
|
||||
kind: PodSecurityPolicy
|
||||
metadata:
|
||||
name: {{ printf "%s-primary" (include "common.names.fullname" .) }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/part-of: valkey
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
allowPrivilegeEscalation: false
|
||||
fsGroup:
|
||||
rule: 'MustRunAs'
|
||||
ranges:
|
||||
- min: {{ .Values.primary.podSecurityContext.fsGroup }}
|
||||
max: {{ .Values.primary.podSecurityContext.fsGroup }}
|
||||
hostIPC: false
|
||||
hostNetwork: false
|
||||
hostPID: false
|
||||
privileged: false
|
||||
readOnlyRootFilesystem: false
|
||||
requiredDropCapabilities:
|
||||
- ALL
|
||||
runAsUser:
|
||||
rule: 'MustRunAs'
|
||||
ranges:
|
||||
- min: {{ .Values.primary.containerSecurityContext.runAsUser }}
|
||||
max: {{ .Values.primary.containerSecurityContext.runAsUser }}
|
||||
seLinux:
|
||||
rule: 'RunAsAny'
|
||||
supplementalGroups:
|
||||
rule: 'MustRunAs'
|
||||
ranges:
|
||||
- min: {{ .Values.primary.containerSecurityContext.runAsUser }}
|
||||
max: {{ .Values.primary.containerSecurityContext.runAsUser }}
|
||||
volumes:
|
||||
- 'configMap'
|
||||
- 'secret'
|
||||
- 'emptyDir'
|
||||
- 'persistentVolumeClaim'
|
||||
{{- end }}
|
34
manifests/valkey/templates/primary/pvc.yaml
Normal file
34
manifests/valkey/templates/primary/pvc.yaml
Normal file
@ -0,0 +1,34 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{- if and (eq .Values.architecture "standalone") (eq .Values.primary.kind "Deployment") (.Values.primary.persistence.enabled) (not .Values.primary.persistence.existingClaim) }}
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: {{ printf "valkey-data-%s-primary" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
{{- $labels := include "common.tplvalues.merge" ( dict "values" ( list .Values.primary.persistence.labels .Values.commonLabels ) "context" . ) }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/component: primary
|
||||
app.kubernetes.io/part-of: valkey
|
||||
{{- if .Values.primary.persistence.annotations }}
|
||||
annotations: {{- toYaml .Values.primary.persistence.annotations | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
accessModes:
|
||||
{{- range .Values.primary.persistence.accessModes }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.primary.persistence.size | quote }}
|
||||
{{- if .Values.primary.persistence.selector }}
|
||||
selector: {{- include "common.tplvalues.render" (dict "value" .Values.primary.persistence.selector "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.primary.persistence.dataSource }}
|
||||
dataSource: {{- include "common.tplvalues.render" (dict "value" .Values.primary.persistence.dataSource "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- include "common.storage.class" (dict "persistence" .Values.primary.persistence "global" .Values.global) | nindent 2 }}
|
||||
{{- end }}
|
61
manifests/valkey/templates/primary/service.yaml
Normal file
61
manifests/valkey/templates/primary/service.yaml
Normal file
@ -0,0 +1,61 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{- if and (not .Values.sentinel.enabled) (gt (int64 .Values.primary.replicaCount) 0) }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ printf "%s-primary" (include "common.names.fullname" .) }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/component: primary
|
||||
app.kubernetes.io/part-of: valkey
|
||||
{{- if or .Values.primary.service.annotations .Values.commonAnnotations }}
|
||||
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.primary.service.annotations .Values.commonAnnotations ) "context" . ) }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
type: {{ .Values.primary.service.type }}
|
||||
{{- if or (eq .Values.primary.service.type "LoadBalancer") (eq .Values.primary.service.type "NodePort") }}
|
||||
externalTrafficPolicy: {{ .Values.primary.service.externalTrafficPolicy | quote }}
|
||||
{{- end }}
|
||||
internalTrafficPolicy: {{ .Values.primary.service.internalTrafficPolicy }}
|
||||
{{- if and (eq .Values.primary.service.type "LoadBalancer") (not (empty .Values.primary.service.loadBalancerIP)) }}
|
||||
loadBalancerIP: {{ .Values.primary.service.loadBalancerIP }}
|
||||
{{- end }}
|
||||
{{- if and (eq .Values.primary.service.type "LoadBalancer") .Values.primary.service.loadBalancerClass }}
|
||||
loadBalancerClass: {{ .Values.primary.service.loadBalancerClass }}
|
||||
{{- end }}
|
||||
{{- if and (eq .Values.primary.service.type "LoadBalancer") (not (empty .Values.primary.service.loadBalancerSourceRanges)) }}
|
||||
loadBalancerSourceRanges: {{ toYaml .Values.primary.service.loadBalancerSourceRanges | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if and .Values.primary.service.clusterIP (eq .Values.primary.service.type "ClusterIP") }}
|
||||
clusterIP: {{ .Values.primary.service.clusterIP }}
|
||||
{{- end }}
|
||||
{{- if .Values.primary.service.sessionAffinity }}
|
||||
sessionAffinity: {{ .Values.primary.service.sessionAffinity }}
|
||||
{{- end }}
|
||||
{{- if .Values.primary.service.sessionAffinityConfig }}
|
||||
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.primary.service.sessionAffinityConfig "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.primary.service.externalIPs }}
|
||||
externalIPs: {{- include "common.tplvalues.render" (dict "value" .Values.primary.service.externalIPs "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: tcp-redis
|
||||
port: {{ .Values.primary.service.ports.valkey }}
|
||||
targetPort: redis
|
||||
{{- if and (or (eq .Values.primary.service.type "NodePort") (eq .Values.primary.service.type "LoadBalancer")) .Values.primary.service.nodePorts.valkey}}
|
||||
nodePort: {{ .Values.primary.service.nodePorts.valkey}}
|
||||
{{- else if eq .Values.primary.service.type "ClusterIP" }}
|
||||
nodePort: null
|
||||
{{- end }}
|
||||
{{- if .Values.primary.service.extraPorts }}
|
||||
{{- include "common.tplvalues.render" (dict "value" .Values.primary.service.extraPorts "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.primary.podLabels .Values.commonLabels ) "context" . ) }}
|
||||
selector: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/component: primary
|
||||
{{- end }}
|
19
manifests/valkey/templates/primary/serviceaccount.yaml
Normal file
19
manifests/valkey/templates/primary/serviceaccount.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{- if and .Values.primary.serviceAccount.create (or (not (eq .Values.architecture "replication")) (not .Values.sentinel.enabled)) }}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
automountServiceAccountToken: {{ .Values.primary.serviceAccount.automountServiceAccountToken }}
|
||||
metadata:
|
||||
name: {{ template "valkey.primaryServiceAccountName" . }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/part-of: valkey
|
||||
{{- if or .Values.primary.serviceAccount.annotations .Values.commonAnnotations }}
|
||||
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.primary.serviceAccount.annotations .Values.commonAnnotations ) "context" . ) }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
24
manifests/valkey/templates/prometheusrule.yaml
Normal file
24
manifests/valkey/templates/prometheusrule.yaml
Normal file
@ -0,0 +1,24 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{- if and .Values.metrics.enabled .Values.metrics.prometheusRule.enabled }}
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: PrometheusRule
|
||||
metadata:
|
||||
name: {{ template "common.names.fullname" . }}
|
||||
namespace: {{ default (include "common.names.namespace" .) .Values.metrics.prometheusRule.namespace | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/part-of: valkey
|
||||
{{- if .Values.metrics.prometheusRule.additionalLabels }}
|
||||
{{- include "common.tplvalues.render" (dict "value" .Values.metrics.prometheusRule.additionalLabels "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
groups:
|
||||
- name: {{ include "common.names.fullname" . }}
|
||||
rules: {{- include "common.tplvalues.render" ( dict "value" .Values.metrics.prometheusRule.rules "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
535
manifests/valkey/templates/replicas/application.yaml
Normal file
535
manifests/valkey/templates/replicas/application.yaml
Normal file
@ -0,0 +1,535 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{- if and (eq .Values.architecture "replication") (not .Values.sentinel.enabled) }}
|
||||
apiVersion: {{ include "common.capabilities.statefulset.apiVersion" . }}
|
||||
kind: {{ .Values.replica.kind }}
|
||||
metadata:
|
||||
name: {{ printf "%s-replicas" (include "common.names.fullname" .) }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/component: replica
|
||||
app.kubernetes.io/part-of: valkey
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if and (not (eq .Values.replica.kind "DaemonSet")) (not .Values.replica.autoscaling.enabled) }}
|
||||
replicas: {{ .Values.replica.replicaCount }}
|
||||
{{- end }}
|
||||
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.replica.podLabels .Values.commonLabels ) "context" . ) }}
|
||||
selector:
|
||||
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
|
||||
app.kubernetes.io/component: replica
|
||||
{{- if (eq .Values.replica.kind "StatefulSet") }}
|
||||
serviceName: {{ printf "%s-headless" (include "common.names.fullname" .) }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.updateStrategy }}
|
||||
updateStrategy: {{- toYaml .Values.replica.updateStrategy | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.minReadySeconds }}
|
||||
minReadySeconds: {{ .Values.replica.minReadySeconds }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.podManagementPolicy }}
|
||||
podManagementPolicy: {{ .Values.replica.podManagementPolicy | quote }}
|
||||
{{- end }}
|
||||
template:
|
||||
metadata:
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" $podLabels "context" $ ) | nindent 8 }}
|
||||
app.kubernetes.io/component: replica
|
||||
{{- if and .Values.metrics.enabled .Values.metrics.podLabels }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.podLabels "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
annotations:
|
||||
{{- if (include "valkey.createConfigmap" .) }}
|
||||
checksum/configmap: {{ pick ( include (print $.Template.BasePath "/configmap.yaml") . | fromYaml ) "data" | toYaml | sha256sum }}
|
||||
{{- end }}
|
||||
checksum/health: {{ pick ( include (print $.Template.BasePath "/health-configmap.yaml") . | fromYaml ) "data" | toYaml | sha256sum }}
|
||||
checksum/scripts: {{ pick ( include (print $.Template.BasePath "/scripts-configmap.yaml") . | fromYaml ) "data" | toYaml | sha256sum }}
|
||||
checksum/secret: {{ pick ( include (print $.Template.BasePath "/secret.yaml") . | fromYaml ) "data" | toYaml | sha256sum }}
|
||||
{{- if .Values.replica.podAnnotations }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.replica.podAnnotations "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if and .Values.metrics.enabled .Values.metrics.podAnnotations }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.podAnnotations "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- include "valkey.imagePullSecrets" . | nindent 6 }}
|
||||
{{- if .Values.replica.hostAliases }}
|
||||
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.replica.hostAliases "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.podSecurityContext.enabled }}
|
||||
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.replica.podSecurityContext "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ template "valkey.replicaServiceAccountName" . }}
|
||||
automountServiceAccountToken: {{ .Values.replica.automountServiceAccountToken }}
|
||||
{{- if .Values.replica.priorityClassName }}
|
||||
priorityClassName: {{ .Values.replica.priorityClassName | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.affinity }}
|
||||
affinity: {{- include "common.tplvalues.render" (dict "value" .Values.replica.affinity "context" $) | nindent 8 }}
|
||||
{{- else }}
|
||||
affinity:
|
||||
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.replica.podAffinityPreset "component" "replica" "customLabels" $podLabels "context" $) | nindent 10 }}
|
||||
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.replica.podAntiAffinityPreset "component" "replica" "customLabels" $podLabels "context" $) | nindent 10 }}
|
||||
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.replica.nodeAffinityPreset.type "key" .Values.replica.nodeAffinityPreset.key "values" .Values.replica.nodeAffinityPreset.values) | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.nodeSelector }}
|
||||
nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.replica.nodeSelector "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.tolerations }}
|
||||
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.replica.tolerations "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.topologySpreadConstraints }}
|
||||
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.replica.topologySpreadConstraints "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.shareProcessNamespace }}
|
||||
shareProcessNamespace: {{ .Values.replica.shareProcessNamespace }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.schedulerName }}
|
||||
schedulerName: {{ .Values.replica.schedulerName | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.dnsPolicy }}
|
||||
dnsPolicy: {{ .Values.replica.dnsPolicy }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.dnsConfig }}
|
||||
dnsConfig: {{- include "common.tplvalues.render" (dict "value" .Values.replica.dnsConfig "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
enableServiceLinks: {{ .Values.replica.enableServiceLinks }}
|
||||
terminationGracePeriodSeconds: {{ .Values.replica.terminationGracePeriodSeconds }}
|
||||
{{- $needsVolumePermissions := and .Values.volumePermissions.enabled .Values.replica.persistence.enabled .Values.replica.podSecurityContext.enabled .Values.replica.containerSecurityContext.enabled }}
|
||||
{{- if or .Values.replica.initContainers $needsVolumePermissions }}
|
||||
initContainers:
|
||||
{{- if .Values.replica.initContainers }}
|
||||
{{- include "common.tplvalues.render" (dict "value" .Values.replica.initContainers "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if $needsVolumePermissions }}
|
||||
- name: volume-permissions
|
||||
image: {{ include "valkey.volumePermissions.image" . }}
|
||||
imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }}
|
||||
command:
|
||||
- /bin/bash
|
||||
- -ec
|
||||
- |
|
||||
{{- if eq ( toString ( .Values.volumePermissions.containerSecurityContext.runAsUser )) "auto" }}
|
||||
chown -R `id -u`:`id -G | cut -d " " -f2` {{ .Values.replica.persistence.path }}
|
||||
{{- else }}
|
||||
chown -R {{ .Values.replica.containerSecurityContext.runAsUser }}:{{ .Values.replica.podSecurityContext.fsGroup }} {{ .Values.replica.persistence.path }}
|
||||
{{- end }}
|
||||
{{- if eq ( toString ( .Values.volumePermissions.containerSecurityContext.runAsUser )) "auto" }}
|
||||
securityContext: {{- omit .Values.volumePermissions.containerSecurityContext "runAsUser" | toYaml | nindent 12 }}
|
||||
{{- else }}
|
||||
securityContext: {{- .Values.volumePermissions.containerSecurityContext | toYaml | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.volumePermissions.resources }}
|
||||
resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }}
|
||||
{{- else if ne .Values.volumePermissions.resourcesPreset "none" }}
|
||||
resources: {{- include "common.resources.preset" (dict "type" .Values.volumePermissions.resourcesPreset) | nindent 12 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: empty-dir
|
||||
mountPath: /tmp
|
||||
subPath: tmp-dir
|
||||
- name: valkey-data
|
||||
mountPath: {{ .Values.replica.persistence.path }}
|
||||
{{- if .Values.replica.persistence.subPath }}
|
||||
subPath: {{ .Values.replica.persistence.subPath }}
|
||||
{{- else if .Values.replica.persistence.subPathExpr }}
|
||||
subPathExpr: {{ .Values.replica.persistence.subPathExpr }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: valkey
|
||||
image: {{ template "valkey.image" . }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
|
||||
{{- if not .Values.diagnosticMode.enabled }}
|
||||
{{- if .Values.replica.lifecycleHooks }}
|
||||
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.replica.lifecycleHooks "context" $) | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.containerSecurityContext.enabled }}
|
||||
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.replica.containerSecurityContext "context" $) | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.diagnosticMode.enabled }}
|
||||
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
|
||||
{{- else if .Values.replica.command }}
|
||||
command: {{- include "common.tplvalues.render" (dict "value" .Values.replica.command "context" $) | nindent 12 }}
|
||||
{{- else }}
|
||||
command:
|
||||
- /bin/bash
|
||||
{{- end }}
|
||||
{{- if .Values.diagnosticMode.enabled }}
|
||||
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
|
||||
{{- else if .Values.replica.args }}
|
||||
args: {{- include "common.tplvalues.render" (dict "value" .Values.replica.args "context" $) | nindent 12 }}
|
||||
{{- else }}
|
||||
args:
|
||||
- -c
|
||||
- /opt/bitnami/scripts/start-scripts/start-replica.sh
|
||||
{{- end }}
|
||||
env:
|
||||
- name: BITNAMI_DEBUG
|
||||
value: {{ ternary "true" "false" (or .Values.image.debug .Values.diagnosticMode.enabled) | quote }}
|
||||
- name: VALKEY_REPLICATION_MODE
|
||||
value: replica
|
||||
- name: VALKEY_PRIMARY_HOST
|
||||
{{- if .Values.replica.externalPrimary.enabled }}
|
||||
value: {{ .Values.replica.externalPrimary.host | quote }}
|
||||
{{- else if and (eq (int64 .Values.primary.replicaCount) 1) (eq .Values.primary.kind "StatefulSet") }}
|
||||
value: {{ template "common.names.fullname" . }}-primary-0.{{ template "common.names.fullname" . }}-headless.{{ include "common.names.namespace" . }}.svc.{{ .Values.clusterDomain }}
|
||||
{{- else }}
|
||||
value: {{ template "common.names.fullname" . }}-primary.{{ include "common.names.namespace" . }}.svc.{{ .Values.clusterDomain }}
|
||||
{{- end }}
|
||||
- name: VALKEY_PRIMARY_PORT_NUMBER
|
||||
{{- if .Values.replica.externalPrimary.enabled }}
|
||||
value: {{ .Values.replica.externalPrimary.port | quote }}
|
||||
{{- else }}
|
||||
value: {{ .Values.primary.containerPorts.valkey | quote }}
|
||||
{{- end }}
|
||||
- name: ALLOW_EMPTY_PASSWORD
|
||||
value: {{ ternary "no" "yes" .Values.auth.enabled | quote }}
|
||||
{{- if .Values.auth.enabled }}
|
||||
{{- if .Values.auth.usePasswordFiles }}
|
||||
- name: VALKEY_PASSWORD_FILE
|
||||
value: "/opt/bitnami/valkey/secrets/valkey-password"
|
||||
- name: VALKEY_PRIMARY_PASSWORD_FILE
|
||||
value: "/opt/bitnami/valkey/secrets/valkey-password"
|
||||
{{- else }}
|
||||
- name: VALKEY_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "valkey.secretName" . }}
|
||||
key: {{ template "valkey.secretPasswordKey" . }}
|
||||
- name: VALKEY_PRIMARY_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "valkey.secretName" . }}
|
||||
key: {{ template "valkey.secretPasswordKey" . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
- name: VALKEY_TLS_ENABLED
|
||||
value: {{ ternary "yes" "no" .Values.tls.enabled | quote }}
|
||||
{{- if .Values.tls.enabled }}
|
||||
- name: VALKEY_TLS_PORT
|
||||
value: {{ .Values.replica.containerPorts.valkey | quote }}
|
||||
- name: VALKEY_TLS_AUTH_CLIENTS
|
||||
value: {{ ternary "yes" "no" .Values.tls.authClients | quote }}
|
||||
- name: VALKEY_TLS_CERT_FILE
|
||||
value: {{ template "valkey.tlsCert" . }}
|
||||
- name: VALKEY_TLS_KEY_FILE
|
||||
value: {{ template "valkey.tlsCertKey" . }}
|
||||
- name: VALKEY_TLS_CA_FILE
|
||||
value: {{ template "valkey.tlsCACert" . }}
|
||||
{{- if .Values.tls.dhParamsFilename }}
|
||||
- name: VALKEY_TLS_DH_PARAMS_FILE
|
||||
value: {{ template "valkey.tlsDHParams" . }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
- name: VALKEY_PORT
|
||||
value: {{ .Values.replica.containerPorts.valkey | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.extraEnvVars }}
|
||||
{{- include "common.tplvalues.render" (dict "value" .Values.replica.extraEnvVars "context" $) | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if or .Values.replica.extraEnvVarsCM .Values.replica.extraEnvVarsSecret }}
|
||||
envFrom:
|
||||
{{- if .Values.replica.extraEnvVarsCM }}
|
||||
- configMapRef:
|
||||
name: {{ .Values.replica.extraEnvVarsCM }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.extraEnvVarsSecret }}
|
||||
- secretRef:
|
||||
name: {{ .Values.replica.extraEnvVarsSecret }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: redis
|
||||
containerPort: {{ .Values.replica.containerPorts.valkey }}
|
||||
{{- if not .Values.diagnosticMode.enabled }}
|
||||
{{- if .Values.replica.customStartupProbe }}
|
||||
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.replica.customStartupProbe "context" $) | nindent 12 }}
|
||||
{{- else if .Values.replica.startupProbe.enabled }}
|
||||
startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.replica.startupProbe "enabled") "context" $) | nindent 12 }}
|
||||
tcpSocket:
|
||||
port: redis
|
||||
{{- end }}
|
||||
{{- if .Values.replica.customLivenessProbe }}
|
||||
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.replica.customLivenessProbe "context" $) | nindent 12 }}
|
||||
{{- else if .Values.replica.livenessProbe.enabled }}
|
||||
livenessProbe:
|
||||
initialDelaySeconds: {{ .Values.replica.livenessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.replica.livenessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ add1 .Values.replica.livenessProbe.timeoutSeconds }}
|
||||
successThreshold: {{ .Values.replica.livenessProbe.successThreshold }}
|
||||
failureThreshold: {{ .Values.replica.livenessProbe.failureThreshold }}
|
||||
exec:
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- /health/ping_liveness_local_and_primary.sh {{ .Values.replica.livenessProbe.timeoutSeconds }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.customReadinessProbe }}
|
||||
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.replica.customReadinessProbe "context" $) | nindent 12 }}
|
||||
{{- else if .Values.replica.readinessProbe.enabled }}
|
||||
readinessProbe:
|
||||
initialDelaySeconds: {{ .Values.replica.readinessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.replica.readinessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ add1 .Values.replica.readinessProbe.timeoutSeconds }}
|
||||
successThreshold: {{ .Values.replica.readinessProbe.successThreshold }}
|
||||
failureThreshold: {{ .Values.replica.readinessProbe.failureThreshold }}
|
||||
exec:
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- /health/ping_readiness_local_and_primary.sh {{ .Values.replica.readinessProbe.timeoutSeconds }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.resources }}
|
||||
resources: {{- toYaml .Values.replica.resources | nindent 12 }}
|
||||
{{- else if ne .Values.replica.resourcesPreset "none" }}
|
||||
resources: {{- include "common.resources.preset" (dict "type" .Values.replica.resourcesPreset) | nindent 12 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: start-scripts
|
||||
mountPath: /opt/bitnami/scripts/start-scripts
|
||||
- name: health
|
||||
mountPath: /health
|
||||
{{- if and .Values.auth.enabled .Values.auth.usePasswordFiles }}
|
||||
- name: valkey-password
|
||||
mountPath: /opt/bitnami/valkey/secrets/
|
||||
{{- end }}
|
||||
- name: valkey-data
|
||||
mountPath: /data
|
||||
{{- if .Values.replica.persistence.subPath }}
|
||||
subPath: {{ .Values.replica.persistence.subPath }}
|
||||
{{- else if .Values.replica.persistence.subPathExpr }}
|
||||
subPathExpr: {{ .Values.replica.persistence.subPathExpr }}
|
||||
{{- end }}
|
||||
- name: config
|
||||
mountPath: /opt/bitnami/valkey/mounted-etc
|
||||
- name: empty-dir
|
||||
mountPath: /opt/bitnami/valkey/etc
|
||||
subPath: app-conf-dir
|
||||
- name: empty-dir
|
||||
mountPath: /tmp
|
||||
subPath: tmp-dir
|
||||
{{- if .Values.tls.enabled }}
|
||||
- name: valkey-certificates
|
||||
mountPath: /opt/bitnami/valkey/certs
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- if .Values.replica.extraVolumeMounts }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.replica.extraVolumeMounts "context" $ ) | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.enabled }}
|
||||
- name: metrics
|
||||
image: {{ include "valkey.metrics.image" . }}
|
||||
imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }}
|
||||
{{- if .Values.metrics.containerSecurityContext.enabled }}
|
||||
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.metrics.containerSecurityContext "context" $) | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.diagnosticMode.enabled }}
|
||||
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
|
||||
{{- else if .Values.metrics.command }}
|
||||
command: {{- include "common.tplvalues.render" (dict "value" .Values.metrics.command "context" $) | nindent 12 }}
|
||||
{{- else }}
|
||||
command:
|
||||
- /bin/bash
|
||||
- -c
|
||||
- |
|
||||
{{- if and .Values.auth.enabled .Values.auth.usePasswordFiles }}
|
||||
export REDIS_PASSWORD="$(< $REDIS_PASSWORD_FILE)"
|
||||
{{- end }}
|
||||
redis_exporter{{- range $key, $value := .Values.metrics.extraArgs }} --{{ $key }}={{ $value }}{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.diagnosticMode.enabled }}
|
||||
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
|
||||
{{- end }}
|
||||
env:
|
||||
- name: REDIS_ALIAS
|
||||
value: {{ template "common.names.fullname" . }}
|
||||
- name: REDIS_EXPORTER_WEB_LISTEN_ADDRESS
|
||||
value: {{ printf ":%v" .Values.metrics.containerPorts.http }}
|
||||
{{- if .Values.auth.enabled }}
|
||||
- name: REDIS_USER
|
||||
value: default
|
||||
{{- if .Values.auth.usePasswordFiles }}
|
||||
- name: REDIS_PASSWORD_FILE
|
||||
value: "/secrets/valkey-password"
|
||||
{{- else }}
|
||||
- name: REDIS_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "valkey.secretName" . }}
|
||||
key: {{ template "valkey.secretPasswordKey" . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.tls.enabled }}
|
||||
- name: REDIS_ADDR
|
||||
value: valkeys://{{ .Values.metrics.valkeyTargetHost }}:{{ .Values.replica.containerPorts.valkey }}
|
||||
{{- if .Values.tls.authClients }}
|
||||
- name: REDIS_EXPORTER_TLS_CLIENT_KEY_FILE
|
||||
value: {{ template "valkey.tlsCertKey" . }}
|
||||
- name: REDIS_EXPORTER_TLS_CLIENT_CERT_FILE
|
||||
value: {{ template "valkey.tlsCert" . }}
|
||||
{{- end }}
|
||||
- name: REDIS_EXPORTER_TLS_CA_CERT_FILE
|
||||
value: {{ template "valkey.tlsCACert" . }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.extraEnvVars }}
|
||||
{{- include "common.tplvalues.render" (dict "value" .Values.metrics.extraEnvVars "context" $) | nindent 12 }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: metrics
|
||||
containerPort: {{ .Values.metrics.containerPorts.http }}
|
||||
{{- if not .Values.diagnosticMode.enabled }}
|
||||
{{- if .Values.metrics.customStartupProbe }}
|
||||
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.metrics.customStartupProbe "context" $) | nindent 12 }}
|
||||
{{- else if .Values.metrics.startupProbe.enabled }}
|
||||
startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.metrics.startupProbe "enabled") "context" $) | nindent 12 }}
|
||||
tcpSocket:
|
||||
port: metrics
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.customLivenessProbe }}
|
||||
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.metrics.customLivenessProbe "context" $) | nindent 12 }}
|
||||
{{- else if .Values.metrics.livenessProbe.enabled }}
|
||||
livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.metrics.livenessProbe "enabled") "context" $) | nindent 12 }}
|
||||
tcpSocket:
|
||||
port: metrics
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.customReadinessProbe }}
|
||||
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.metrics.customReadinessProbe "context" $) | nindent 12 }}
|
||||
{{- else if .Values.metrics.readinessProbe.enabled }}
|
||||
readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.metrics.readinessProbe "enabled") "context" $) | nindent 12 }}
|
||||
httpGet:
|
||||
path: /
|
||||
port: metrics
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.resources }}
|
||||
resources: {{- toYaml .Values.metrics.resources | nindent 12 }}
|
||||
{{- else if ne .Values.metrics.resourcesPreset "none" }}
|
||||
resources: {{- include "common.resources.preset" (dict "type" .Values.metrics.resourcesPreset) | nindent 12 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: empty-dir
|
||||
mountPath: /tmp
|
||||
subPath: tmp-dir
|
||||
{{- if and .Values.auth.enabled .Values.auth.usePasswordFiles }}
|
||||
- name: valkey-password
|
||||
mountPath: /secrets/
|
||||
{{- end }}
|
||||
{{- if .Values.tls.enabled }}
|
||||
- name: valkey-certificates
|
||||
mountPath: /opt/bitnami/valkey/certs
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.extraVolumeMounts }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.extraVolumeMounts "context" $ ) | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.sidecars }}
|
||||
{{- include "common.tplvalues.render" (dict "value" .Values.replica.sidecars "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: start-scripts
|
||||
configMap:
|
||||
name: {{ printf "%s-scripts" (include "common.names.fullname" .) }}
|
||||
defaultMode: 0755
|
||||
- name: health
|
||||
configMap:
|
||||
name: {{ printf "%s-health" (include "common.names.fullname" .) }}
|
||||
defaultMode: 0755
|
||||
{{- if and .Values.auth.enabled .Values.auth.usePasswordFiles }}
|
||||
- name: valkey-password
|
||||
{{ if .Values.auth.usePasswordFileFromSecret }}
|
||||
secret:
|
||||
secretName: {{ template "valkey.secretName" . }}
|
||||
items:
|
||||
- key: {{ template "valkey.secretPasswordKey" . }}
|
||||
path: valkey-password
|
||||
{{- else }}
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
- name: config
|
||||
configMap:
|
||||
name: {{ include "valkey.configmapName" . }}
|
||||
- name: empty-dir
|
||||
{{- if or .Values.replica.persistence.medium .Values.replica.persistence.sizeLimit }}
|
||||
emptyDir:
|
||||
{{- if .Values.replica.persistence.medium }}
|
||||
medium: {{ .Values.replica.persistence.medium | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.persistence.sizeLimit }}
|
||||
sizeLimit: {{ .Values.replica.persistence.sizeLimit | quote }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
{{- if .Values.tls.enabled }}
|
||||
- name: valkey-certificates
|
||||
secret:
|
||||
secretName: {{ include "valkey.tlsSecretName" . }}
|
||||
defaultMode: 256
|
||||
{{- end }}
|
||||
{{- if .Values.replica.extraVolumes }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.replica.extraVolumes "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.extraVolumes }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.extraVolumes "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if or (not .Values.replica.persistence.enabled) (not (eq .Values.replica.kind "StatefulSet")) }}
|
||||
- name: valkey-data
|
||||
{{- if or .Values.replica.persistence.medium .Values.replica.persistence.sizeLimit }}
|
||||
emptyDir:
|
||||
{{- if .Values.replica.persistence.medium }}
|
||||
medium: {{ .Values.replica.persistence.medium | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.persistence.sizeLimit }}
|
||||
sizeLimit: {{ .Values.replica.persistence.sizeLimit | quote }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
{{- else if .Values.replica.persistence.existingClaim }}
|
||||
- name: valkey-data
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ printf "%s" (tpl .Values.replica.persistence.existingClaim .) }}
|
||||
{{- else }}
|
||||
{{- if .Values.replica.persistentVolumeClaimRetentionPolicy.enabled }}
|
||||
persistentVolumeClaimRetentionPolicy:
|
||||
whenDeleted: {{ .Values.replica.persistentVolumeClaimRetentionPolicy.whenDeleted }}
|
||||
whenScaled: {{ .Values.replica.persistentVolumeClaimRetentionPolicy.whenScaled }}
|
||||
{{- end }}
|
||||
volumeClaimTemplates:
|
||||
- apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: valkey-data
|
||||
{{- $claimLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.primary.persistence.labels .Values.commonLabels ) "context" . ) }}
|
||||
labels: {{- include "common.labels.matchLabels" ( dict "customLabels" $claimLabels "context" $ ) | nindent 10 }}
|
||||
app.kubernetes.io/component: replica
|
||||
{{- if .Values.replica.persistence.annotations }}
|
||||
annotations: {{- toYaml .Values.replica.persistence.annotations | nindent 10 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
accessModes:
|
||||
{{- range .Values.replica.persistence.accessModes }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.replica.persistence.size | quote }}
|
||||
{{- if .Values.replica.persistence.selector }}
|
||||
selector: {{- include "common.tplvalues.render" (dict "value" .Values.replica.persistence.selector "context" $) | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.persistence.dataSource }}
|
||||
dataSource: {{- include "common.tplvalues.render" (dict "value" .Values.replica.persistence.dataSource "context" $) | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- include "common.storage.class" (dict "persistence" .Values.replica.persistence "global" .Values.global) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
42
manifests/valkey/templates/replicas/hpa.yaml
Normal file
42
manifests/valkey/templates/replicas/hpa.yaml
Normal file
@ -0,0 +1,42 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{- if and .Values.replica.autoscaling.hpa.enabled (not .Values.sentinel.enabled) }}
|
||||
apiVersion: {{ include "common.capabilities.hpa.apiVersion" ( dict "context" $ ) }}
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: {{ printf "%s-replicas" (include "common.names.fullname" .) }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/component: replica
|
||||
app.kubernetes.io/part-of: valkey
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
|
||||
kind: StatefulSet
|
||||
name: {{ printf "%s-replicas" (include "common.names.fullname" .) }}
|
||||
minReplicas: {{ .Values.replica.autoscaling.hpa.minReplicas }}
|
||||
maxReplicas: {{ .Values.replica.autoscaling.hpa.maxReplicas }}
|
||||
metrics:
|
||||
{{- if .Values.replica.autoscaling.hpa.targetCPU }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: {{ .Values.replica.autoscaling.hpa.targetCPU }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.autoscaling.hpa.targetMemory }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: memory
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: {{ .Values.replica.autoscaling.hpa.targetMemory }}
|
||||
{{- end }}
|
||||
{{- end }}
|
28
manifests/valkey/templates/replicas/pdb.yaml
Normal file
28
manifests/valkey/templates/replicas/pdb.yaml
Normal file
@ -0,0 +1,28 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{- $pdb := coalesce .Values.pdb .Values.replica.pdb }}
|
||||
{{- if and (eq .Values.architecture "replication") (not .Values.sentinel.enabled) $pdb.create }}
|
||||
apiVersion: {{ include "common.capabilities.policy.apiVersion" . }}
|
||||
kind: PodDisruptionBudget
|
||||
metadata:
|
||||
name: {{ printf "%s-replicas" (include "common.names.fullname" .) }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/component: replica
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if $pdb.minAvailable }}
|
||||
minAvailable: {{ $pdb.minAvailable }}
|
||||
{{- end }}
|
||||
{{- if or $pdb.maxUnavailable (not $pdb.minAvailable) }}
|
||||
maxUnavailable: {{ $pdb.maxUnavailable | default 1 }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 6 }}
|
||||
app.kubernetes.io/component: replica
|
||||
{{- end }}
|
58
manifests/valkey/templates/replicas/service.yaml
Normal file
58
manifests/valkey/templates/replicas/service.yaml
Normal file
@ -0,0 +1,58 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{- if and (eq .Values.architecture "replication") (not .Values.sentinel.enabled) }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ printf "%s-replicas" (include "common.names.fullname" .) }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/component: replica
|
||||
app.kubernetes.io/part-of: valkey
|
||||
{{- if or .Values.replica.service.annotations .Values.commonAnnotations }}
|
||||
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.replica.service.annotations .Values.commonAnnotations ) "context" . ) }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
type: {{ .Values.replica.service.type }}
|
||||
{{- if or (eq .Values.replica.service.type "LoadBalancer") (eq .Values.replica.service.type "NodePort") }}
|
||||
externalTrafficPolicy: {{ .Values.replica.service.externalTrafficPolicy | quote }}
|
||||
{{- end }}
|
||||
internalTrafficPolicy: {{ .Values.replica.service.internalTrafficPolicy }}
|
||||
{{- if and (eq .Values.replica.service.type "LoadBalancer") (not (empty .Values.replica.service.loadBalancerIP)) }}
|
||||
loadBalancerIP: {{ .Values.replica.service.loadBalancerIP }}
|
||||
{{- end }}
|
||||
{{- if and (eq .Values.replica.service.type "LoadBalancer") .Values.replica.service.loadBalancerClass }}
|
||||
loadBalancerClass: {{ .Values.replica.service.loadBalancerClass }}
|
||||
{{- end }}
|
||||
{{- if and (eq .Values.replica.service.type "LoadBalancer") (not (empty .Values.replica.service.loadBalancerSourceRanges)) }}
|
||||
loadBalancerSourceRanges: {{ toYaml .Values.replica.service.loadBalancerSourceRanges | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if and .Values.replica.service.clusterIP (eq .Values.replica.service.type "ClusterIP") }}
|
||||
clusterIP: {{ .Values.replica.service.clusterIP }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.service.sessionAffinity }}
|
||||
sessionAffinity: {{ .Values.replica.service.sessionAffinity }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.service.sessionAffinityConfig }}
|
||||
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.replica.service.sessionAffinityConfig "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: tcp-redis
|
||||
port: {{ .Values.replica.service.ports.valkey }}
|
||||
targetPort: redis
|
||||
{{- if and (or (eq .Values.replica.service.type "NodePort") (eq .Values.replica.service.type "LoadBalancer")) .Values.replica.service.nodePorts.valkey}}
|
||||
nodePort: {{ .Values.replica.service.nodePorts.valkey}}
|
||||
{{- else if eq .Values.replica.service.type "ClusterIP" }}
|
||||
nodePort: null
|
||||
{{- end }}
|
||||
{{- if .Values.replica.service.extraPorts }}
|
||||
{{- include "common.tplvalues.render" (dict "value" .Values.replica.service.extraPorts "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.replica.podLabels .Values.commonLabels ) "context" . ) }}
|
||||
selector: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/component: replica
|
||||
{{- end }}
|
19
manifests/valkey/templates/replicas/serviceaccount.yaml
Normal file
19
manifests/valkey/templates/replicas/serviceaccount.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{- if and .Values.replica.serviceAccount.create (eq .Values.architecture "replication") (not .Values.sentinel.enabled) }}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
automountServiceAccountToken: {{ .Values.replica.serviceAccount.automountServiceAccountToken }}
|
||||
metadata:
|
||||
name: {{ template "valkey.replicaServiceAccountName" . }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/part-of: valkey
|
||||
{{- if or .Values.replica.serviceAccount.annotations .Values.commonAnnotations }}
|
||||
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.replica.serviceAccount.annotations .Values.commonAnnotations ) "context" . ) }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
45
manifests/valkey/templates/replicas/vpa.yaml
Normal file
45
manifests/valkey/templates/replicas/vpa.yaml
Normal file
@ -0,0 +1,45 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{- if and (include "common.capabilities.apiVersions.has" ( dict "version" "autoscaling.k8s.io/v1/VerticalPodAutoscaler" "context" . )) .Values.replica.autoscaling.vpa.enabled (not .Values.sentinel.enabled) }}
|
||||
apiVersion: autoscaling.k8s.io/v1
|
||||
kind: VerticalPodAutoscaler
|
||||
metadata:
|
||||
name: {{ include "common.names.fullname" . }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/component: replica
|
||||
app.kubernetes.io/part-of: valkey
|
||||
{{- if or .Values.replica.autoscaling.vpa.annotations .Values.commonAnnotations }}
|
||||
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.replica.autoscaling.vpa.annotations .Values.commonAnnotations ) "context" . ) }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
resourcePolicy:
|
||||
containerPolicies:
|
||||
- containerName: valkey
|
||||
{{- with .Values.replica.autoscaling.vpa.controlledResources }}
|
||||
controlledResources:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.replica.autoscaling.vpa.maxAllowed }}
|
||||
maxAllowed:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.replica.autoscaling.vpa.minAllowed }}
|
||||
minAllowed:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
targetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: {{ .Values.replica.kind }}
|
||||
name: {{ printf "%s-replicas" (include "common.names.fullname" .) }}
|
||||
{{- if .Values.replica.autoscaling.vpa.updatePolicy }}
|
||||
updatePolicy:
|
||||
{{- with .Values.replica.autoscaling.vpa.updatePolicy.updateMode }}
|
||||
updateMode: {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
35
manifests/valkey/templates/role.yaml
Normal file
35
manifests/valkey/templates/role.yaml
Normal file
@ -0,0 +1,35 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{- if .Values.rbac.create }}
|
||||
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
|
||||
kind: Role
|
||||
metadata:
|
||||
name: {{ template "common.names.fullname" . }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/part-of: valkey
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- if and (include "common.capabilities.psp.supported" .) .Values.podSecurityPolicy.enabled }}
|
||||
- apiGroups:
|
||||
- 'policy'
|
||||
resources:
|
||||
- 'podsecuritypolicies'
|
||||
verbs:
|
||||
- 'use'
|
||||
resourceNames: [{{ printf "%s-primary" (include "common.names.fullname" .) }}]
|
||||
{{- end }}
|
||||
{{- if and .Values.sentinel.enabled .Values.sentinel.service.createPrimary}}
|
||||
- apiGroups: [""]
|
||||
resources: ["pods"]
|
||||
verbs: ["list", "patch"]
|
||||
{{- end -}}
|
||||
{{- if .Values.rbac.rules }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.rbac.rules "context" $ ) | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
24
manifests/valkey/templates/rolebinding.yaml
Normal file
24
manifests/valkey/templates/rolebinding.yaml
Normal file
@ -0,0 +1,24 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{- if .Values.rbac.create }}
|
||||
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: {{ template "common.names.fullname" . }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/part-of: valkey
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: {{ template "common.names.fullname" . }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ template "valkey.serviceAccountName" . }}
|
||||
{{- end }}
|
792
manifests/valkey/templates/scripts-configmap.yaml
Normal file
792
manifests/valkey/templates/scripts-configmap.yaml
Normal file
@ -0,0 +1,792 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ printf "%s-scripts" (include "common.names.fullname" .) }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/part-of: valkey
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
data:
|
||||
{{- if and (eq .Values.architecture "replication") .Values.sentinel.enabled }}
|
||||
start-node.sh: |
|
||||
#!/bin/bash
|
||||
|
||||
. /opt/bitnami/scripts/libos.sh
|
||||
. /opt/bitnami/scripts/liblog.sh
|
||||
. /opt/bitnami/scripts/libvalidations.sh
|
||||
|
||||
get_port() {
|
||||
hostname="$1"
|
||||
type="$2"
|
||||
|
||||
port_var=$(echo "${hostname^^}_SERVICE_PORT_$type" | sed "s/-/_/g")
|
||||
port=${!port_var}
|
||||
|
||||
if [ -z "$port" ]; then
|
||||
case $type in
|
||||
"SENTINEL")
|
||||
echo {{ .Values.sentinel.containerPorts.sentinel }}
|
||||
;;
|
||||
"VALKEY")
|
||||
echo {{ .Values.primary.containerPorts.valkey }}
|
||||
;;
|
||||
esac
|
||||
else
|
||||
echo $port
|
||||
fi
|
||||
}
|
||||
|
||||
get_full_hostname() {
|
||||
hostname="$1"
|
||||
|
||||
{{- if .Values.useExternalDNS.enabled }}
|
||||
full_hostname="${hostname}.{{- include "valkey.externalDNS.suffix" . }}"
|
||||
{{- else if eq .Values.sentinel.service.type "NodePort" }}
|
||||
full_hostname="${hostname}.{{- include "common.names.namespace" . }}"
|
||||
{{- else }}
|
||||
full_hostname="${hostname}.${HEADLESS_SERVICE}"
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.useHostnames }}
|
||||
echo "${full_hostname}"
|
||||
{{- else }}
|
||||
retry_count=0
|
||||
until getent hosts "${full_hostname}" | awk '{ print $1; exit }' | grep .; do
|
||||
if [[ $retry_count -lt {{ .Values.nameResolutionThreshold }} ]]; then
|
||||
sleep {{ .Values.nameResolutionTimeout }}
|
||||
else
|
||||
error "IP address for ${full_hostname} not found"
|
||||
exit 1
|
||||
fi
|
||||
((retry_count++))
|
||||
done
|
||||
{{- end }}
|
||||
}
|
||||
|
||||
VALKEYPORT=$(get_port "$HOSTNAME" "VALKEY")
|
||||
|
||||
HEADLESS_SERVICE="{{ template "common.names.fullname" . }}-headless.{{ include "common.names.namespace" . }}.svc.{{ .Values.clusterDomain }}"
|
||||
|
||||
if [ -n "$VALKEY_EXTERNAL_PRIMARY_HOST" ]; then
|
||||
VALKEY_SERVICE="$VALKEY_EXTERNAL_PRIMARY_HOST"
|
||||
else
|
||||
VALKEY_SERVICE="{{ template "common.names.fullname" . }}.{{ include "common.names.namespace" . }}.svc.{{ .Values.clusterDomain }}"
|
||||
fi
|
||||
|
||||
SENTINEL_SERVICE_PORT=$(get_port "{{ include "common.names.fullname" . }}" "SENTINEL")
|
||||
validate_quorum() {
|
||||
if is_boolean_yes "$VALKEY_TLS_ENABLED"; then
|
||||
quorum_info_command="{{- if and .Values.auth.enabled .Values.auth.sentinel }}REDISCLI_AUTH="\$VALKEY_PASSWORD" {{ end }}valkey-cli -h $VALKEY_SERVICE -p $SENTINEL_SERVICE_PORT --tls --cert ${VALKEY_TLS_CERT_FILE} --key ${VALKEY_TLS_KEY_FILE} --cacert ${VALKEY_TLS_CA_FILE} sentinel primary {{ .Values.sentinel.primarySet }}"
|
||||
else
|
||||
quorum_info_command="{{- if and .Values.auth.enabled .Values.auth.sentinel }}REDISCLI_AUTH="\$VALKEY_PASSWORD" {{ end }}valkey-cli -h $VALKEY_SERVICE -p $SENTINEL_SERVICE_PORT sentinel primary {{ .Values.sentinel.primarySet }}"
|
||||
fi
|
||||
info "about to run the command: $quorum_info_command"
|
||||
eval $quorum_info_command | grep -Fq "s_down"
|
||||
}
|
||||
|
||||
trigger_manual_failover() {
|
||||
if is_boolean_yes "$VALKEY_TLS_ENABLED"; then
|
||||
failover_command="{{- if and .Values.auth.enabled .Values.auth.sentinel }}REDISCLI_AUTH="\$VALKEY_PASSWORD" {{ end }}valkey-cli -h $VALKEY_SERVICE -p $SENTINEL_SERVICE_PORT --tls --cert ${VALKEY_TLS_CERT_FILE} --key ${VALKEY_TLS_KEY_FILE} --cacert ${VALKEY_TLS_CA_FILE} sentinel failover {{ .Values.sentinel.primarySet }}"
|
||||
else
|
||||
failover_command="{{- if and .Values.auth.enabled .Values.auth.sentinel }}REDISCLI_AUTH="\$VALKEY_PASSWORD" {{ end }}valkey-cli -h $VALKEY_SERVICE -p $SENTINEL_SERVICE_PORT sentinel failover {{ .Values.sentinel.primarySet }}"
|
||||
fi
|
||||
|
||||
info "about to run the command: $failover_command"
|
||||
eval $failover_command
|
||||
}
|
||||
|
||||
get_sentinel_primary_info() {
|
||||
if is_boolean_yes "$VALKEY_TLS_ENABLED"; then
|
||||
sentinel_info_command="{{- if and .Values.auth.enabled .Values.auth.sentinel }}REDISCLI_AUTH="\$VALKEY_PASSWORD" {{ end }}timeout {{ .Values.sentinel.getPrimaryTimeout }} valkey-cli -h $VALKEY_SERVICE -p $SENTINEL_SERVICE_PORT --tls --cert ${VALKEY_TLS_CERT_FILE} --key ${VALKEY_TLS_KEY_FILE} --cacert ${VALKEY_TLS_CA_FILE} sentinel get-primary-addr-by-name {{ .Values.sentinel.primarySet }}"
|
||||
else
|
||||
sentinel_info_command="{{- if and .Values.auth.enabled .Values.auth.sentinel }}REDISCLI_AUTH="\$VALKEY_PASSWORD" {{ end }}timeout {{ .Values.sentinel.getPrimaryTimeout }} valkey-cli -h $VALKEY_SERVICE -p $SENTINEL_SERVICE_PORT sentinel get-primary-addr-by-name {{ .Values.sentinel.primarySet }}"
|
||||
fi
|
||||
|
||||
info "about to run the command: $sentinel_info_command"
|
||||
retry_while "eval $sentinel_info_command" 2 5
|
||||
}
|
||||
|
||||
{{- if and .Values.replica.containerSecurityContext.runAsUser (eq (.Values.replica.containerSecurityContext.runAsUser | int) 0) }}
|
||||
useradd valkey
|
||||
chown -R valkey {{ .Values.replica.persistence.path }}
|
||||
{{- end }}
|
||||
|
||||
[[ -f $VALKEY_PASSWORD_FILE ]] && export VALKEY_PASSWORD="$(< "${VALKEY_PASSWORD_FILE}")"
|
||||
[[ -f $VALKEY_PRIMARY_PASSWORD_FILE ]] && export VALKEY_PRIMARY_PASSWORD="$(< "${VALKEY_PRIMARY_PASSWORD_FILE}")"
|
||||
|
||||
# check if there is a primary
|
||||
primary_in_persisted_conf="$(get_full_hostname "$HOSTNAME")"
|
||||
primary_port_in_persisted_conf="$VALKEY_PRIMARY_PORT_NUMBER"
|
||||
primary_in_sentinel="$(get_sentinel_primary_info)"
|
||||
valkeyRetVal=$?
|
||||
|
||||
if [[ -f /opt/bitnami/valkey-sentinel/etc/sentinel.conf ]]; then
|
||||
primary_in_persisted_conf="$(awk '/monitor/ {print $4}' /opt/bitnami/valkey-sentinel/etc/sentinel.conf)"
|
||||
primary_port_in_persisted_conf="$(awk '/monitor/ {print $5}' /opt/bitnami/valkey-sentinel/etc/sentinel.conf)"
|
||||
info "Found previous primary ${primary_in_persisted_conf}:${primary_port_in_persisted_conf} in /opt/bitnami/valkey-sentinel/etc/sentinel.conf"
|
||||
debug "$(cat /opt/bitnami/valkey-sentinel/etc/sentinel.conf | grep monitor)"
|
||||
fi
|
||||
|
||||
if [[ $valkeyRetVal -ne 0 ]]; then
|
||||
if [[ "$primary_in_persisted_conf" == "$(get_full_hostname "$HOSTNAME")" ]]; then
|
||||
# Case 1: No active sentinel and in previous sentinel.conf we were the primary --> PRIMARY
|
||||
info "Configuring the node as primary"
|
||||
export VALKEY_REPLICATION_MODE="primary"
|
||||
else
|
||||
# Case 2: No active sentinel and in previous sentinel.conf we were not primary --> REPLICA
|
||||
info "Configuring the node as replica"
|
||||
export VALKEY_REPLICATION_MODE="replica"
|
||||
VALKEY_PRIMARY_HOST=${primary_in_persisted_conf}
|
||||
VALKEY_PRIMARY_PORT_NUMBER=${primary_port_in_persisted_conf}
|
||||
fi
|
||||
else
|
||||
# Fetches current primary's host and port
|
||||
VALKEY_SENTINEL_INFO=($(get_sentinel_primary_info))
|
||||
info "Current primary: VALKEY_SENTINEL_INFO=(${VALKEY_SENTINEL_INFO[0]},${VALKEY_SENTINEL_INFO[1]})"
|
||||
VALKEY_PRIMARY_HOST=${VALKEY_SENTINEL_INFO[0]}
|
||||
VALKEY_PRIMARY_PORT_NUMBER=${VALKEY_SENTINEL_INFO[1]}
|
||||
|
||||
if [[ "$VALKEY_PRIMARY_HOST" == "$(get_full_hostname "$HOSTNAME")" ]]; then
|
||||
# Case 3: Active sentinel and primary it is this node --> PRIMARY
|
||||
info "Configuring the node as primary"
|
||||
export VALKEY_REPLICATION_MODE="primary"
|
||||
else
|
||||
# Case 4: Active sentinel and primary is not this node --> REPLICA
|
||||
info "Configuring the node as replica"
|
||||
export VALKEY_REPLICATION_MODE="replica"
|
||||
|
||||
{{- if and .Values.sentinel.automateClusterRecovery (le (int .Values.sentinel.downAfterMilliseconds) 2000) }}
|
||||
retry_count=1
|
||||
while validate_quorum
|
||||
do
|
||||
info "sleeping, waiting for Valkey primary to come up"
|
||||
sleep 1s
|
||||
if ! ((retry_count % 11)); then
|
||||
info "Trying to manually failover"
|
||||
failover_result=$(trigger_manual_failover)
|
||||
|
||||
debug "Failover result: $failover_result"
|
||||
fi
|
||||
|
||||
((retry_count+=1))
|
||||
done
|
||||
info "Valkey primary is up now"
|
||||
{{- end }}
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -n "$VALKEY_EXTERNAL_PRIMARY_HOST" ]]; then
|
||||
VALKEY_PRIMARY_HOST="$VALKEY_EXTERNAL_PRIMARY_HOST"
|
||||
VALKEY_PRIMARY_PORT_NUMBER="${VALKEY_EXTERNAL_PRIMARY_PORT}"
|
||||
fi
|
||||
|
||||
if [[ -f /opt/bitnami/valkey/mounted-etc/replica.conf ]];then
|
||||
cp /opt/bitnami/valkey/mounted-etc/replica.conf /opt/bitnami/valkey/etc/replica.conf
|
||||
fi
|
||||
|
||||
if [[ -f /opt/bitnami/valkey/mounted-etc/valkey.conf ]];then
|
||||
cp /opt/bitnami/valkey/mounted-etc/valkey.conf /opt/bitnami/valkey/etc/valkey.conf
|
||||
fi
|
||||
|
||||
echo "" >> /opt/bitnami/valkey/etc/replica.conf
|
||||
echo "replica-announce-port $VALKEYPORT" >> /opt/bitnami/valkey/etc/replica.conf
|
||||
echo "replica-announce-ip $(get_full_hostname "$HOSTNAME")" >> /opt/bitnami/valkey/etc/replica.conf
|
||||
|
||||
{{- if .Values.tls.enabled }}
|
||||
ARGS=("--port" "0")
|
||||
ARGS+=("--tls-port" "${VALKEY_TLS_PORT}")
|
||||
ARGS+=("--tls-cert-file" "${VALKEY_TLS_CERT_FILE}")
|
||||
ARGS+=("--tls-key-file" "${VALKEY_TLS_KEY_FILE}")
|
||||
ARGS+=("--tls-ca-cert-file" "${VALKEY_TLS_CA_FILE}")
|
||||
ARGS+=("--tls-auth-clients" "${VALKEY_TLS_AUTH_CLIENTS}")
|
||||
ARGS+=("--tls-replication" "yes")
|
||||
{{- if .Values.tls.dhParamsFilename }}
|
||||
ARGS+=("--tls-dh-params-file" "${VALKEY_TLS_DH_PARAMS_FILE}")
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
ARGS=("--port" "${VALKEY_PORT}")
|
||||
{{- end }}
|
||||
|
||||
if [[ "$VALKEY_REPLICATION_MODE" = "replica" ]]; then
|
||||
ARGS+=("--replicaof" "${VALKEY_PRIMARY_HOST}" "${VALKEY_PRIMARY_PORT_NUMBER}")
|
||||
fi
|
||||
|
||||
{{- if .Values.auth.enabled }}
|
||||
ARGS+=("--requirepass" "${VALKEY_PASSWORD}")
|
||||
ARGS+=("--primaryauth" "${VALKEY_PRIMARY_PASSWORD}")
|
||||
{{- else }}
|
||||
ARGS+=("--protected-mode" "no")
|
||||
{{- end }}
|
||||
ARGS+=("--include" "/opt/bitnami/valkey/etc/replica.conf")
|
||||
ARGS+=("--include" "/opt/bitnami/valkey/etc/valkey.conf")
|
||||
{{- if .Values.replica.extraFlags }}
|
||||
{{- range .Values.replica.extraFlags }}
|
||||
ARGS+=({{ . | quote }})
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.replica.preExecCmds }}
|
||||
{{- .Values.replica.preExecCmds | nindent 4 }}
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.replica.command }}
|
||||
exec {{ .Values.replica.command }} "${ARGS[@]}"
|
||||
{{- else }}
|
||||
exec valkey-server "${ARGS[@]}"
|
||||
{{- end }}
|
||||
|
||||
start-sentinel.sh: |
|
||||
#!/bin/bash
|
||||
|
||||
. /opt/bitnami/scripts/libos.sh
|
||||
. /opt/bitnami/scripts/libvalidations.sh
|
||||
. /opt/bitnami/scripts/libfile.sh
|
||||
|
||||
HEADLESS_SERVICE="{{ template "common.names.fullname" . }}-headless.{{ include "common.names.namespace" . }}.svc.{{ .Values.clusterDomain }}"
|
||||
VALKEY_SERVICE="{{ template "common.names.fullname" . }}.{{ include "common.names.namespace" . }}.svc.{{ .Values.clusterDomain }}"
|
||||
|
||||
get_port() {
|
||||
hostname="$1"
|
||||
type="$2"
|
||||
|
||||
port_var=$(echo "${hostname^^}_SERVICE_PORT_$type" | sed "s/-/_/g")
|
||||
port=${!port_var}
|
||||
|
||||
if [ -z "$port" ]; then
|
||||
case $type in
|
||||
"SENTINEL")
|
||||
echo {{ .Values.sentinel.containerPorts.sentinel }}
|
||||
;;
|
||||
"VALKEY")
|
||||
echo {{ .Values.primary.containerPorts.valkey }}
|
||||
;;
|
||||
esac
|
||||
else
|
||||
echo $port
|
||||
fi
|
||||
}
|
||||
|
||||
get_full_hostname() {
|
||||
hostname="$1"
|
||||
|
||||
{{- if .Values.useExternalDNS.enabled }}
|
||||
full_hostname="${hostname}.{{- include "valkey.externalDNS.suffix" . }}"
|
||||
{{- else if eq .Values.sentinel.service.type "NodePort" }}
|
||||
full_hostname="${hostname}.{{- include "common.names.namespace" . }}"
|
||||
{{- else }}
|
||||
full_hostname="${hostname}.${HEADLESS_SERVICE}"
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.useHostnames }}
|
||||
echo "${full_hostname}"
|
||||
{{- else }}
|
||||
retry_count=0
|
||||
until getent hosts "${full_hostname}" | awk '{ print $1; exit }' | grep .; do
|
||||
if [[ $retry_count -lt {{ .Values.nameResolutionThreshold }} ]]; then
|
||||
sleep {{ .Values.nameResolutionTimeout }}
|
||||
else
|
||||
error "IP address for ${full_hostname} not found"
|
||||
exit 1
|
||||
fi
|
||||
((retry_count++))
|
||||
done
|
||||
{{- end }}
|
||||
}
|
||||
|
||||
SERVPORT=$(get_port "$HOSTNAME" "SENTINEL")
|
||||
VALKEYPORT=$(get_port "$HOSTNAME" "VALKEY")
|
||||
SENTINEL_SERVICE_PORT=$(get_port "{{ include "common.names.fullname" . }}" "SENTINEL")
|
||||
|
||||
sentinel_conf_set() {
|
||||
local -r key="${1:?missing key}"
|
||||
local value="${2:-}"
|
||||
|
||||
# Sanitize inputs
|
||||
value="${value//\\/\\\\}"
|
||||
value="${value//&/\\&}"
|
||||
value="${value//\?/\\?}"
|
||||
[[ "$value" = "" ]] && value="\"$value\""
|
||||
|
||||
replace_in_file "/opt/bitnami/valkey-sentinel/etc/prepare-sentinel.conf" "^#*\s*${key} .*" "${key} ${value}" false
|
||||
}
|
||||
sentinel_conf_add() {
|
||||
echo $'\n'"$@" >> "/opt/bitnami/valkey-sentinel/etc/prepare-sentinel.conf"
|
||||
}
|
||||
host_id() {
|
||||
echo "$1" | openssl sha1 | awk '{print $2}'
|
||||
}
|
||||
get_sentinel_primary_info() {
|
||||
if is_boolean_yes "$VALKEY_SENTINEL_TLS_ENABLED"; then
|
||||
sentinel_info_command="{{- if and .Values.auth.enabled .Values.auth.sentinel }}REDISCLI_AUTH="\$VALKEY_PASSWORD" {{ end }}timeout {{ .Values.sentinel.getPrimaryTimeout }} valkey-cli -h $VALKEY_SERVICE -p $SENTINEL_SERVICE_PORT --tls --cert ${VALKEY_SENTINEL_TLS_CERT_FILE} --key ${VALKEY_SENTINEL_TLS_KEY_FILE} --cacert ${VALKEY_SENTINEL_TLS_CA_FILE} sentinel get-primary-addr-by-name {{ .Values.sentinel.primarySet }}"
|
||||
else
|
||||
sentinel_info_command="{{- if and .Values.auth.enabled .Values.auth.sentinel }}REDISCLI_AUTH="\$VALKEY_PASSWORD" {{ end }}timeout {{ .Values.sentinel.getPrimaryTimeout }} valkey-cli -h $VALKEY_SERVICE -p $SENTINEL_SERVICE_PORT sentinel get-primary-addr-by-name {{ .Values.sentinel.primarySet }}"
|
||||
fi
|
||||
info "about to run the command: $sentinel_info_command"
|
||||
retry_while "eval $sentinel_info_command" 2 5
|
||||
}
|
||||
|
||||
[[ -f $VALKEY_PASSWORD_FILE ]] && export VALKEY_PASSWORD="$(< "${VALKEY_PASSWORD_FILE}")"
|
||||
|
||||
primary_in_persisted_conf="$(get_full_hostname "$HOSTNAME")"
|
||||
|
||||
if [[ -f /opt/bitnami/valkey-sentinel/etc/sentinel.conf ]]; then
|
||||
primary_in_persisted_conf="$(awk '/monitor/ {print $4}' /opt/bitnami/valkey-sentinel/etc/sentinel.conf)"
|
||||
info "Found previous primary $primary_in_persisted_conf in /opt/bitnami/valkey-sentinel/etc/sentinel.conf"
|
||||
debug "$(cat /opt/bitnami/valkey-sentinel/etc/sentinel.conf | grep monitor)"
|
||||
fi
|
||||
VALKEY_SENTINEL_INFO=($(get_sentinel_primary_info))
|
||||
if [ "$?" -eq "0" ]; then
|
||||
# current primary's host and port obtained from other Sentinel
|
||||
info "printing VALKEY_SENTINEL_INFO=(${VALKEY_SENTINEL_INFO[0]},${VALKEY_SENTINEL_INFO[1]})"
|
||||
VALKEY_PRIMARY_HOST=${VALKEY_SENTINEL_INFO[0]}
|
||||
VALKEY_PRIMARY_PORT_NUMBER=${VALKEY_SENTINEL_INFO[1]}
|
||||
else
|
||||
VALKEY_PRIMARY_HOST="$primary_in_persisted_conf"
|
||||
VALKEY_PRIMARY_PORT_NUMBER="$VALKEYPORT"
|
||||
fi
|
||||
if [[ "$VALKEY_PRIMARY_HOST" == "$(get_full_hostname "$HOSTNAME")" ]]; then
|
||||
export VALKEY_REPLICATION_MODE="primary"
|
||||
else
|
||||
export VALKEY_REPLICATION_MODE="replica"
|
||||
fi
|
||||
|
||||
{{- if .Values.sentinel.service.createPrimary }}
|
||||
if [[ "${VALKEY_REPLICATION_MODE}" == "primary" ]]; then
|
||||
# Add isPrimary label to primary node for primary service
|
||||
echo "${VALKEY_PRIMARY_HOST/.*}" > /etc/shared/current
|
||||
fi
|
||||
{{- end }}
|
||||
|
||||
if [[ -n "$VALKEY_EXTERNAL_PRIMARY_HOST" ]]; then
|
||||
VALKEY_PRIMARY_HOST="$VALKEY_EXTERNAL_PRIMARY_HOST"
|
||||
VALKEY_PRIMARY_PORT_NUMBER="${VALKEY_EXTERNAL_PRIMARY_PORT}"
|
||||
fi
|
||||
|
||||
# To prevent incomplete configuration and as the valkey container accesses /opt/bitnami/valkey-sentinel/etc/sentinel.conf
|
||||
# as well, prepare the new config in `prepare-sentinel.conf` and move it atomically to the ultimate destination when it is complete.
|
||||
cp /opt/bitnami/valkey-sentinel/mounted-etc/sentinel.conf /opt/bitnami/valkey-sentinel/etc/prepare-sentinel.conf
|
||||
{{- if .Values.auth.enabled }}
|
||||
printf "\nsentinel auth-pass %s %s" "{{ .Values.sentinel.primarySet }}" "$VALKEY_PASSWORD" >> /opt/bitnami/valkey-sentinel/etc/prepare-sentinel.conf
|
||||
{{- if and .Values.auth.enabled .Values.auth.sentinel }}
|
||||
printf "\nrequirepass %s" "$VALKEY_PASSWORD" >> /opt/bitnami/valkey-sentinel/etc/prepare-sentinel.conf
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
printf "\nsentinel myid %s" "$(host_id "$HOSTNAME")" >> /opt/bitnami/valkey-sentinel/etc/prepare-sentinel.conf
|
||||
|
||||
if [[ -z "$VALKEY_PRIMARY_HOST" ]] || [[ -z "$VALKEY_PRIMARY_PORT_NUMBER" ]]
|
||||
then
|
||||
# Prevent incorrect configuration to be written to sentinel.conf
|
||||
error "Valkey primary host is configured incorrectly (host: $VALKEY_PRIMARY_HOST, port: $VALKEY_PRIMARY_PORT_NUMBER)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sentinel_conf_set "sentinel monitor" "{{ .Values.sentinel.primarySet }} "$VALKEY_PRIMARY_HOST" "$VALKEY_PRIMARY_PORT_NUMBER" {{ .Values.sentinel.quorum }}"
|
||||
|
||||
add_known_sentinel() {
|
||||
hostname="$1"
|
||||
ip="$2"
|
||||
|
||||
if [[ -n "$hostname" && -n "$ip" && "$hostname" != "$HOSTNAME" ]]; then
|
||||
sentinel_conf_add "sentinel known-sentinel {{ .Values.sentinel.primarySet }} $(get_full_hostname "$hostname") $(get_port "$hostname" "SENTINEL") $(host_id "$hostname")"
|
||||
fi
|
||||
}
|
||||
add_known_replica() {
|
||||
hostname="$1"
|
||||
ip="$2"
|
||||
|
||||
if [[ -n "$ip" && "$(get_full_hostname "$hostname")" != "$VALKEY_PRIMARY_HOST" ]]; then
|
||||
sentinel_conf_add "sentinel known-replica {{ .Values.sentinel.primarySet }} $(get_full_hostname "$hostname") $(get_port "$hostname" "VALKEY")"
|
||||
fi
|
||||
}
|
||||
|
||||
# Add available hosts on the network as known replicas & sentinels
|
||||
for node in $(seq 0 $(({{ .Values.replica.replicaCount }}-1))); do
|
||||
hostname="{{ template "common.names.fullname" . }}-node-$node"
|
||||
ip="$(getent hosts "$hostname.$HEADLESS_SERVICE" | awk '{ print $1 }')"
|
||||
add_known_sentinel "$hostname" "$ip"
|
||||
add_known_replica "$hostname" "$ip"
|
||||
done
|
||||
|
||||
echo "" >> /opt/bitnami/valkey-sentinel/etc/prepare-sentinel.conf
|
||||
{{- if not (contains "sentinel announce-hostnames" .Values.sentinel.configuration) }}
|
||||
echo "sentinel announce-hostnames yes" >> /opt/bitnami/valkey-sentinel/etc/prepare-sentinel.conf
|
||||
{{- end }}
|
||||
{{- if not (contains "sentinel resolve-hostnames" .Values.sentinel.configuration) }}
|
||||
echo "sentinel resolve-hostnames yes" >> /opt/bitnami/valkey-sentinel/etc/prepare-sentinel.conf
|
||||
{{- end }}
|
||||
{{- if not (contains "sentinel announce-port" .Values.sentinel.configuration) }}
|
||||
echo "sentinel announce-port $SERVPORT" >> /opt/bitnami/valkey-sentinel/etc/prepare-sentinel.conf
|
||||
{{- end }}
|
||||
{{- if not (contains "sentinel announce-ip" .Values.sentinel.configuration) }}
|
||||
echo "sentinel announce-ip $(get_full_hostname "$HOSTNAME")" >> /opt/bitnami/valkey-sentinel/etc/prepare-sentinel.conf
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.tls.enabled }}
|
||||
ARGS=("--port" "0")
|
||||
ARGS+=("--tls-port" "${VALKEY_SENTINEL_TLS_PORT_NUMBER}")
|
||||
ARGS+=("--tls-cert-file" "${VALKEY_SENTINEL_TLS_CERT_FILE}")
|
||||
ARGS+=("--tls-key-file" "${VALKEY_SENTINEL_TLS_KEY_FILE}")
|
||||
ARGS+=("--tls-ca-cert-file" "${VALKEY_SENTINEL_TLS_CA_FILE}")
|
||||
ARGS+=("--tls-replication" "yes")
|
||||
ARGS+=("--tls-auth-clients" "${VALKEY_SENTINEL_TLS_AUTH_CLIENTS}")
|
||||
{{- if .Values.tls.dhParamsFilename }}
|
||||
ARGS+=("--tls-dh-params-file" "${VALKEY_SENTINEL_TLS_DH_PARAMS_FILE}")
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.sentinel.preExecCmds }}
|
||||
{{ .Values.sentinel.preExecCmds | nindent 4 }}
|
||||
{{- end }}
|
||||
mv /opt/bitnami/valkey-sentinel/etc/prepare-sentinel.conf /opt/bitnami/valkey-sentinel/etc/sentinel.conf
|
||||
exec valkey-server /opt/bitnami/valkey-sentinel/etc/sentinel.conf {{- if .Values.tls.enabled }} "${ARGS[@]}" {{- end }} --sentinel
|
||||
prestop-sentinel.sh: |
|
||||
#!/bin/bash
|
||||
|
||||
. /opt/bitnami/scripts/libvalidations.sh
|
||||
. /opt/bitnami/scripts/libos.sh
|
||||
|
||||
HEADLESS_SERVICE="{{ template "common.names.fullname" . }}-headless.{{ include "common.names.namespace" . }}.svc.{{ .Values.clusterDomain }}"
|
||||
|
||||
get_full_hostname() {
|
||||
hostname="$1"
|
||||
|
||||
{{- if .Values.useExternalDNS.enabled }}
|
||||
full_hostname="${hostname}.{{- include "valkey.externalDNS.suffix" . }}"
|
||||
{{- else if eq .Values.sentinel.service.type "NodePort" }}
|
||||
full_hostname="${hostname}.{{- include "common.names.namespace" . }}"
|
||||
{{- else }}
|
||||
full_hostname="${hostname}.${HEADLESS_SERVICE}"
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.useHostnames }}
|
||||
echo "${full_hostname}"
|
||||
{{- else }}
|
||||
retry_count=0
|
||||
until getent hosts "${full_hostname}" | awk '{ print $1; exit }' | grep .; do
|
||||
if [[ $retry_count -lt {{ .Values.nameResolutionThreshold }} ]]; then
|
||||
sleep {{ .Values.nameResolutionTimeout }}
|
||||
else
|
||||
error "IP address for ${full_hostname} not found"
|
||||
exit 1
|
||||
fi
|
||||
((retry_count++))
|
||||
done
|
||||
{{- end }}
|
||||
}
|
||||
|
||||
run_sentinel_command() {
|
||||
if is_boolean_yes "$VALKEY_SENTINEL_TLS_ENABLED"; then
|
||||
valkey-cli -h "$VALKEY_SERVICE" -p "$VALKEY_SENTINEL_TLS_PORT_NUMBER" --tls --cert "$VALKEY_SENTINEL_TLS_CERT_FILE" --key "$VALKEY_SENTINEL_TLS_KEY_FILE" --cacert "$VALKEY_SENTINEL_TLS_CA_FILE" sentinel "$@"
|
||||
else
|
||||
valkey-cli -h "$VALKEY_SERVICE" -p "$VALKEY_SENTINEL_PORT" sentinel "$@"
|
||||
fi
|
||||
}
|
||||
sentinel_failover_finished() {
|
||||
VALKEY_SENTINEL_INFO=($(run_sentinel_command get-primary-addr-by-name "{{ .Values.sentinel.primarySet }}"))
|
||||
VALKEY_PRIMARY_HOST="${VALKEY_SENTINEL_INFO[0]}"
|
||||
[[ "$VALKEY_PRIMARY_HOST" != "$(get_full_hostname $HOSTNAME)" ]]
|
||||
}
|
||||
|
||||
VALKEY_SERVICE="{{ include "common.names.fullname" . }}.{{ include "common.names.namespace" . }}.svc.{{ .Values.clusterDomain }}"
|
||||
|
||||
{{ if .Values.auth.sentinel -}}
|
||||
# valkey-cli automatically consumes credentials from the REDISCLI_AUTH variable
|
||||
[[ -n "$VALKEY_PASSWORD" ]] && export REDISCLI_AUTH="$VALKEY_PASSWORD"
|
||||
[[ -f "$VALKEY_PASSWORD_FILE" ]] && export REDISCLI_AUTH="$(< "${VALKEY_PASSWORD_FILE}")"
|
||||
{{- end }}
|
||||
|
||||
if ! sentinel_failover_finished; then
|
||||
echo "I am the primary pod and you are stopping me. Starting sentinel failover"
|
||||
if retry_while "sentinel_failover_finished" "{{ sub .Values.sentinel.terminationGracePeriodSeconds 10 }}" 1; then
|
||||
echo "Primary has been successfuly failed over to a different pod."
|
||||
exit 0
|
||||
else
|
||||
echo "Primary failover failed"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
prestop-valkey.sh: |
|
||||
#!/bin/bash
|
||||
|
||||
. /opt/bitnami/scripts/libvalidations.sh
|
||||
. /opt/bitnami/scripts/libos.sh
|
||||
|
||||
run_valkey_command() {
|
||||
if is_boolean_yes "$VALKEY_TLS_ENABLED"; then
|
||||
valkey-cli -h 127.0.0.1 -p "$VALKEY_TLS_PORT" --tls --cert "$VALKEY_TLS_CERT_FILE" --key "$VALKEY_TLS_KEY_FILE" --cacert "$VALKEY_TLS_CA_FILE" "$@"
|
||||
else
|
||||
valkey-cli -h 127.0.0.1 -p "$VALKEY_PORT" "$@"
|
||||
fi
|
||||
}
|
||||
is_primary() {
|
||||
VALKEY_ROLE=$(run_valkey_command role | head -1)
|
||||
[[ "$VALKEY_ROLE" == "master" ]]
|
||||
}
|
||||
|
||||
HEADLESS_SERVICE="{{ template "common.names.fullname" . }}-headless.{{- include "common.names.namespace" . }}.svc.{{ .Values.clusterDomain }}"
|
||||
|
||||
get_full_hostname() {
|
||||
hostname="$1"
|
||||
|
||||
{{- if .Values.useExternalDNS.enabled }}
|
||||
full_hostname="${hostname}.{{- include "valkey.externalDNS.suffix" . }}"
|
||||
{{- else if eq .Values.sentinel.service.type "NodePort" }}
|
||||
full_hostname="${hostname}.{{- include "common.names.namespace" . }}"
|
||||
{{- else }}
|
||||
full_hostname="${hostname}.${HEADLESS_SERVICE}"
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.useHostnames }}
|
||||
echo "${full_hostname}"
|
||||
{{- else }}
|
||||
retry_count=0
|
||||
until getent hosts "${full_hostname}" | awk '{ print $1; exit }' | grep .; do
|
||||
if [[ $retry_count -lt {{ .Values.nameResolutionThreshold }} ]]; then
|
||||
sleep {{ .Values.nameResolutionTimeout }}
|
||||
else
|
||||
error "IP address for ${full_hostname} not found"
|
||||
exit 1
|
||||
fi
|
||||
((retry_count++))
|
||||
done
|
||||
{{- end }}
|
||||
}
|
||||
|
||||
run_sentinel_command() {
|
||||
if is_boolean_yes "$VALKEY_SENTINEL_TLS_ENABLED"; then
|
||||
{{ .Values.auth.sentinel | ternary "" "env -u REDISCLI_AUTH " -}} valkey-cli -h "$VALKEY_SERVICE" -p "$VALKEY_SENTINEL_TLS_PORT_NUMBER" --tls --cert "$VALKEY_SENTINEL_TLS_CERT_FILE" --key "$VALKEY_SENTINEL_TLS_KEY_FILE" --cacert "$VALKEY_SENTINEL_TLS_CA_FILE" sentinel "$@"
|
||||
else
|
||||
{{ .Values.auth.sentinel | ternary "" "env -u REDISCLI_AUTH " -}} valkey-cli -h "$VALKEY_SERVICE" -p "$VALKEY_SENTINEL_PORT" sentinel "$@"
|
||||
fi
|
||||
}
|
||||
sentinel_failover_finished() {
|
||||
VALKEY_SENTINEL_INFO=($(run_sentinel_command get-primary-addr-by-name "{{ .Values.sentinel.primarySet }}"))
|
||||
VALKEY_PRIMARY_HOST="${VALKEY_SENTINEL_INFO[0]}"
|
||||
[[ "$VALKEY_PRIMARY_HOST" != "$(get_full_hostname $HOSTNAME)" ]]
|
||||
}
|
||||
|
||||
VALKEY_SERVICE="{{ include "common.names.fullname" . }}.{{ include "common.names.namespace" . }}.svc.{{ .Values.clusterDomain }}"
|
||||
|
||||
# valkey-cli automatically consumes credentials from the REDISCLI_AUTH variable
|
||||
[[ -n "$VALKEY_PASSWORD" ]] && export REDISCLI_AUTH="$VALKEY_PASSWORD"
|
||||
[[ -f "$VALKEY_PASSWORD_FILE" ]] && export REDISCLI_AUTH="$(< "${VALKEY_PASSWORD_FILE}")"
|
||||
|
||||
|
||||
if is_primary && ! sentinel_failover_finished; then
|
||||
echo "I am the primary pod and you are stopping me. Pausing client connections."
|
||||
# Pausing client write connections to avoid data loss
|
||||
run_valkey_command CLIENT PAUSE "{{ mul (add 2 (sub .Values.sentinel.terminationGracePeriodSeconds 10)) 1000 }}" WRITE
|
||||
|
||||
echo "Issuing failover"
|
||||
# if I am the primary, issue a command to failover once
|
||||
run_sentinel_command failover "{{ .Values.sentinel.primarySet }}"
|
||||
|
||||
{{- if .Values.sentinel.valkeyShutdownWaitFailover }}
|
||||
echo "Waiting for sentinel to complete failover for up to {{ sub .Values.sentinel.terminationGracePeriodSeconds 10 }}s"
|
||||
retry_while "sentinel_failover_finished" "{{ sub .Values.sentinel.terminationGracePeriodSeconds 10 }}" 1
|
||||
{{- end }}
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
|
||||
{{- if .Values.sentinel.service.createPrimary}}
|
||||
push-primary-label.sh: |
|
||||
#!/bin/bash
|
||||
# https://download.valkey.io/valkey-stable/sentinel.conf
|
||||
|
||||
echo "${6/.*}" > /etc/shared/current
|
||||
echo "${4/.*}" > /etc/shared/previous
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
start-primary.sh: |
|
||||
#!/bin/bash
|
||||
|
||||
[[ -f $VALKEY_PASSWORD_FILE ]] && export VALKEY_PASSWORD="$(< "${VALKEY_PASSWORD_FILE}")"
|
||||
{{- if and .Values.primary.containerSecurityContext.runAsUser (eq (.Values.primary.containerSecurityContext.runAsUser | int) 0) }}
|
||||
useradd valkey
|
||||
chown -R valkey {{ .Values.primary.persistence.path }}
|
||||
{{- end }}
|
||||
if [[ -f /opt/bitnami/valkey/mounted-etc/primary.conf ]];then
|
||||
cp /opt/bitnami/valkey/mounted-etc/primary.conf /opt/bitnami/valkey/etc/primary.conf
|
||||
fi
|
||||
if [[ -f /opt/bitnami/valkey/mounted-etc/valkey.conf ]];then
|
||||
cp /opt/bitnami/valkey/mounted-etc/valkey.conf /opt/bitnami/valkey/etc/valkey.conf
|
||||
fi
|
||||
{{- if .Values.tls.enabled }}
|
||||
ARGS=("--port" "0")
|
||||
ARGS+=("--tls-port" "${VALKEY_TLS_PORT}")
|
||||
ARGS+=("--tls-cert-file" "${VALKEY_TLS_CERT_FILE}")
|
||||
ARGS+=("--tls-key-file" "${VALKEY_TLS_KEY_FILE}")
|
||||
ARGS+=("--tls-ca-cert-file" "${VALKEY_TLS_CA_FILE}")
|
||||
ARGS+=("--tls-auth-clients" "${VALKEY_TLS_AUTH_CLIENTS}")
|
||||
{{- if .Values.tls.dhParamsFilename }}
|
||||
ARGS+=("--tls-dh-params-file" "${VALKEY_TLS_DH_PARAMS_FILE}")
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
ARGS=("--port" "${VALKEY_PORT}")
|
||||
{{- end }}
|
||||
{{- if .Values.auth.enabled }}
|
||||
ARGS+=("--requirepass" "${VALKEY_PASSWORD}")
|
||||
ARGS+=("--primaryauth" "${VALKEY_PASSWORD}")
|
||||
{{- else }}
|
||||
ARGS+=("--protected-mode" "no")
|
||||
{{- end }}
|
||||
ARGS+=("--include" "/opt/bitnami/valkey/etc/valkey.conf")
|
||||
ARGS+=("--include" "/opt/bitnami/valkey/etc/primary.conf")
|
||||
{{- if .Values.primary.extraFlags }}
|
||||
{{- range .Values.primary.extraFlags }}
|
||||
ARGS+=({{ . | quote }})
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.primary.preExecCmds }}
|
||||
{{ .Values.primary.preExecCmds | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.primary.command }}
|
||||
exec {{ .Values.primary.command }} "${ARGS[@]}"
|
||||
{{- else }}
|
||||
exec valkey-server "${ARGS[@]}"
|
||||
{{- end }}
|
||||
{{- if eq .Values.architecture "replication" }}
|
||||
start-replica.sh: |
|
||||
#!/bin/bash
|
||||
|
||||
get_port() {
|
||||
hostname="$1"
|
||||
type="$2"
|
||||
|
||||
port_var=$(echo "${hostname^^}_SERVICE_PORT_$type" | sed "s/-/_/g")
|
||||
port=${!port_var}
|
||||
|
||||
if [ -z "$port" ]; then
|
||||
case $type in
|
||||
"SENTINEL")
|
||||
echo {{ .Values.sentinel.containerPorts.sentinel }}
|
||||
;;
|
||||
"VALKEY")
|
||||
echo {{ .Values.primary.containerPorts.valkey }}
|
||||
;;
|
||||
esac
|
||||
else
|
||||
echo $port
|
||||
fi
|
||||
}
|
||||
|
||||
get_full_hostname() {
|
||||
hostname="$1"
|
||||
|
||||
{{- if .Values.useExternalDNS.enabled }}
|
||||
full_hostname="${hostname}.{{- include "valkey.externalDNS.suffix" . }}"
|
||||
{{- else if eq .Values.sentinel.service.type "NodePort" }}
|
||||
full_hostname="${hostname}.{{- include "common.names.namespace" . }}"
|
||||
{{- else }}
|
||||
full_hostname="${hostname}.${HEADLESS_SERVICE}"
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.useHostnames }}
|
||||
echo "${full_hostname}"
|
||||
{{- else }}
|
||||
retry_count=0
|
||||
until getent hosts "${full_hostname}" | awk '{ print $1; exit }' | grep .; do
|
||||
if [[ $retry_count -lt {{ .Values.nameResolutionThreshold }} ]]; then
|
||||
sleep {{ .Values.nameResolutionTimeout }}
|
||||
else
|
||||
error "IP address for ${full_hostname} not found"
|
||||
exit 1
|
||||
fi
|
||||
((retry_count++))
|
||||
done
|
||||
{{- end }}
|
||||
}
|
||||
|
||||
VALKEYPORT=$(get_port "$HOSTNAME" "VALKEY")
|
||||
HEADLESS_SERVICE="{{ template "common.names.fullname" . }}-headless.{{ include "common.names.namespace" . }}.svc.{{ .Values.clusterDomain }}"
|
||||
|
||||
[[ -f $VALKEY_PASSWORD_FILE ]] && export VALKEY_PASSWORD="$(< "${VALKEY_PASSWORD_FILE}")"
|
||||
[[ -f $VALKEY_PRIMARY_PASSWORD_FILE ]] && export VALKEY_PRIMARY_PASSWORD="$(< "${VALKEY_PRIMARY_PASSWORD_FILE}")"
|
||||
{{- if and .Values.replica.containerSecurityContext.runAsUser (eq (.Values.replica.containerSecurityContext.runAsUser | int) 0) }}
|
||||
useradd valkey
|
||||
chown -R valkey {{ .Values.replica.persistence.path }}
|
||||
{{- end }}
|
||||
if [[ -f /opt/bitnami/valkey/mounted-etc/replica.conf ]];then
|
||||
cp /opt/bitnami/valkey/mounted-etc/replica.conf /opt/bitnami/valkey/etc/replica.conf
|
||||
fi
|
||||
if [[ -f /opt/bitnami/valkey/mounted-etc/valkey.conf ]];then
|
||||
cp /opt/bitnami/valkey/mounted-etc/valkey.conf /opt/bitnami/valkey/etc/valkey.conf
|
||||
fi
|
||||
|
||||
echo "" >> /opt/bitnami/valkey/etc/replica.conf
|
||||
echo "replica-announce-port $VALKEYPORT" >> /opt/bitnami/valkey/etc/replica.conf
|
||||
echo "replica-announce-ip $(get_full_hostname "$HOSTNAME")" >> /opt/bitnami/valkey/etc/replica.conf
|
||||
|
||||
{{- if .Values.tls.enabled }}
|
||||
ARGS=("--port" "0")
|
||||
ARGS+=("--tls-port" "${VALKEY_TLS_PORT}")
|
||||
ARGS+=("--tls-cert-file" "${VALKEY_TLS_CERT_FILE}")
|
||||
ARGS+=("--tls-key-file" "${VALKEY_TLS_KEY_FILE}")
|
||||
ARGS+=("--tls-ca-cert-file" "${VALKEY_TLS_CA_FILE}")
|
||||
ARGS+=("--tls-auth-clients" "${VALKEY_TLS_AUTH_CLIENTS}")
|
||||
ARGS+=("--tls-replication" "yes")
|
||||
{{- if .Values.tls.dhParamsFilename }}
|
||||
ARGS+=("--tls-dh-params-file" "${VALKEY_TLS_DH_PARAMS_FILE}")
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
ARGS=("--port" "${VALKEY_PORT}")
|
||||
{{- end }}
|
||||
ARGS+=("--replicaof" "${VALKEY_PRIMARY_HOST}" "${VALKEY_PRIMARY_PORT_NUMBER}")
|
||||
{{- if .Values.auth.enabled }}
|
||||
ARGS+=("--requirepass" "${VALKEY_PASSWORD}")
|
||||
ARGS+=("--primaryauth" "${VALKEY_PRIMARY_PASSWORD}")
|
||||
{{- else }}
|
||||
ARGS+=("--protected-mode" "no")
|
||||
{{- end }}
|
||||
ARGS+=("--include" "/opt/bitnami/valkey/etc/valkey.conf")
|
||||
ARGS+=("--include" "/opt/bitnami/valkey/etc/replica.conf")
|
||||
{{- if .Values.replica.extraFlags }}
|
||||
{{- range .Values.replica.extraFlags }}
|
||||
ARGS+=({{ . | quote }})
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.preExecCmds }}
|
||||
{{ .Values.replica.preExecCmds | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.command }}
|
||||
exec {{ .Values.replica.command }} "${ARGS[@]}"
|
||||
{{- else }}
|
||||
exec valkey-server "${ARGS[@]}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
---
|
||||
{{- if .Values.sentinel.service.createPrimary}}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ printf "%s-kubectl-scripts" (include "common.names.fullname" .) }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
data:
|
||||
update-primary-label.sh: |
|
||||
#!/bin/bash
|
||||
while true; do
|
||||
while [ ! -f "/etc/shared/current" ]; do
|
||||
sleep 1
|
||||
done
|
||||
echo "new primary elected, updating label(s)..."
|
||||
kubectl label pod --field-selector metadata.name="$(< "/etc/shared/current")" isPrimary="true" --overwrite
|
||||
if [ -f /etc/shared/previous ]; then
|
||||
kubectl label pod --field-selector metadata.name="$(< "/etc/shared/previous")" isPrimary="false" --overwrite
|
||||
fi
|
||||
rm "/etc/shared/current" "/etc/shared/previous"
|
||||
done
|
||||
{{- end }}
|
38
manifests/valkey/templates/secret-svcbind.yaml
Normal file
38
manifests/valkey/templates/secret-svcbind.yaml
Normal file
@ -0,0 +1,38 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{- if .Values.serviceBindings.enabled }}
|
||||
{{- $host := include "common.names.fullname" . }}
|
||||
{{- if not .Values.sentinel.enabled }}
|
||||
{{- $host = printf "%s-primary" (include "common.names.fullname" .) }}
|
||||
{{- end }}
|
||||
{{- $port := print .Values.primary.service.ports.valkey }}
|
||||
{{- if .Values.sentinel.enabled }}
|
||||
{{- $port = print .Values.sentinel.service.ports.valkey }}
|
||||
{{- end }}
|
||||
{{- $password := include "valkey.password" . }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ include "common.names.fullname" . }}-svcbind
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/part-of: valkey
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
type: servicebinding.io/valkey
|
||||
data:
|
||||
provider: {{ print "bitnami" | b64enc | quote }}
|
||||
type: {{ print "valkey" | b64enc | quote }}
|
||||
host: {{ print $host | b64enc | quote }}
|
||||
port: {{ print $port | b64enc | quote }}
|
||||
password: {{ print $password | b64enc | quote }}
|
||||
{{- if $password }}
|
||||
uri: {{ printf "valkey://:%s@%s:%s" $password $host $port | b64enc | quote }}
|
||||
{{- else }}
|
||||
uri: {{ printf "valkey://%s:%s" $host $port | b64enc | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
26
manifests/valkey/templates/secret.yaml
Normal file
26
manifests/valkey/templates/secret.yaml
Normal file
@ -0,0 +1,26 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{- if and .Values.auth.enabled (not .Values.auth.existingSecret) (or .Values.auth.usePasswordFileFromSecret (not .Values.auth.usePasswordFiles)) -}}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ template "common.names.fullname" . }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/part-of: valkey
|
||||
{{- if or .Values.secretAnnotations .Values.commonAnnotations }}
|
||||
annotations:
|
||||
{{- if .Values.secretAnnotations }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.secretAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.commonAnnotations }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
type: Opaque
|
||||
data:
|
||||
valkey-password: {{ include "common.secrets.passwords.manage" (dict "secret" (include "common.names.fullname" .) "key" "valkey-password" "providedValues" (list "global.valkey.password" "auth.password") "length" 10 "honorProvidedValues" true "context" $) }}
|
||||
{{- end -}}
|
42
manifests/valkey/templates/sentinel/hpa.yaml
Normal file
42
manifests/valkey/templates/sentinel/hpa.yaml
Normal file
@ -0,0 +1,42 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{- if and .Values.replica.autoscaling.hpa.enabled .Values.sentinel.enabled }}
|
||||
apiVersion: {{ include "common.capabilities.hpa.apiVersion" ( dict "context" $ ) }}
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: {{ printf "%s-node" (include "common.names.fullname" .) }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/component: replica
|
||||
app.kubernetes.io/part-of: valkey
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
|
||||
kind: StatefulSet
|
||||
name: {{ printf "%s-node" (include "common.names.fullname" .) }}
|
||||
minReplicas: {{ .Values.replica.autoscaling.hpa.minReplicas }}
|
||||
maxReplicas: {{ .Values.replica.autoscaling.hpa.maxReplicas }}
|
||||
metrics:
|
||||
{{- if .Values.replica.autoscaling.hpa.targetMemory }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: memory
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: {{ .Values.replica.autoscaling.hpa.targetMemory }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.autoscaling.hpa.targetCPU }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: {{ .Values.replica.autoscaling.hpa.targetCPU }}
|
||||
{{- end }}
|
||||
{{- end }}
|
68
manifests/valkey/templates/sentinel/node-services.yaml
Normal file
68
manifests/valkey/templates/sentinel/node-services.yaml
Normal file
@ -0,0 +1,68 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{- if and (eq .Values.architecture "replication") .Values.sentinel.enabled (eq .Values.sentinel.service.type "NodePort") (or .Release.IsUpgrade .Values.sentinel.service.nodePorts.valkey ) }}
|
||||
|
||||
{{- range $i := until (int .Values.replica.replicaCount) }}
|
||||
|
||||
{{ $portsmap := (lookup "v1" "ConfigMap" (include "common.names.namespace" $) (printf "%s-%s" ( include "common.names.fullname" $ ) "ports-configmap")).data }}
|
||||
|
||||
{{ $sentinelport := 0}}
|
||||
{{ $valkeyport := 0}}
|
||||
{{- if $portsmap }}
|
||||
{{ $sentinelport = index $portsmap (printf "%s-node-%s-%s" (include "common.names.fullname" $) (toString $i) "sentinel") }}
|
||||
{{ $valkeyport = index $portsmap (printf "%s-node-%s-%s" (include "common.names.fullname" $) (toString $i) "valkey") }}
|
||||
{{- else }}
|
||||
{{- end }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "common.names.fullname" $ }}-node-{{ $i }}
|
||||
namespace: {{ include "common.names.namespace" $ | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" $.Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/component: node
|
||||
app.kubernetes.io/part-of: valkey
|
||||
{{- if or $.Values.commonAnnotations $.Values.sentinel.service.annotations }}
|
||||
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list $.Values.sentinel.service.annotations $.Values.commonAnnotations ) "context" $ ) }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
type: NodePort
|
||||
ports:
|
||||
- name: sentinel
|
||||
{{- if $.Values.sentinel.service.nodePorts.sentinel }}
|
||||
nodePort: {{ (add $.Values.sentinel.service.nodePorts.sentinel $i 1) }}
|
||||
port: {{ (add $.Values.sentinel.service.nodePorts.sentinel $i 1) }}
|
||||
{{- else }}
|
||||
nodePort: {{ $sentinelport }}
|
||||
port: {{ $sentinelport }}
|
||||
{{- end }}
|
||||
protocol: TCP
|
||||
targetPort: {{ $.Values.sentinel.containerPorts.sentinel }}
|
||||
- name: valkey
|
||||
{{- if $.Values.sentinel.service.nodePorts.valkey }}
|
||||
nodePort: {{ (add $.Values.sentinel.service.nodePorts.valkey $i 1) }}
|
||||
port: {{ (add $.Values.sentinel.service.nodePorts.valkey $i 1) }}
|
||||
{{- else }}
|
||||
nodePort: {{ $valkeyport }}
|
||||
port: {{ $valkeyport }}
|
||||
{{- end }}
|
||||
protocol: TCP
|
||||
targetPort: {{ $.Values.replica.containerPorts.valkey }}
|
||||
- name: sentinel-internal
|
||||
nodePort: null
|
||||
port: {{ $.Values.sentinel.containerPorts.sentinel }}
|
||||
protocol: TCP
|
||||
targetPort: {{ $.Values.sentinel.containerPorts.sentinel }}
|
||||
- name: valkey-internal
|
||||
nodePort: null
|
||||
port: {{ $.Values.replica.containerPorts.valkey }}
|
||||
protocol: TCP
|
||||
targetPort: {{ $.Values.replica.containerPorts.valkey }}
|
||||
selector:
|
||||
statefulset.kubernetes.io/pod-name: {{ template "common.names.fullname" $ }}-node-{{ $i }}
|
||||
---
|
||||
{{- end }}
|
||||
{{- end }}
|
27
manifests/valkey/templates/sentinel/pdb.yaml
Normal file
27
manifests/valkey/templates/sentinel/pdb.yaml
Normal file
@ -0,0 +1,27 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
{{- $pdb := coalesce .Values.pdb .Values.replica.pdb }}
|
||||
{{- if and (eq .Values.architecture "replication") .Values.sentinel.enabled $pdb.create }}
|
||||
apiVersion: {{ include "common.capabilities.policy.apiVersion" . }}
|
||||
kind: PodDisruptionBudget
|
||||
metadata:
|
||||
name: {{ printf "%s-node" (include "common.names.fullname" .) }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/component: node
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if $pdb.minAvailable }}
|
||||
minAvailable: {{ $pdb.minAvailable }}
|
||||
{{- end }}
|
||||
{{- if or $pdb.maxUnavailable (not $pdb.minAvailable) }}
|
||||
maxUnavailable: {{ $pdb.maxUnavailable | default 1 }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 6 }}
|
||||
app.kubernetes.io/component: node
|
||||
{{- end }}
|
103
manifests/valkey/templates/sentinel/ports-configmap.yaml
Normal file
103
manifests/valkey/templates/sentinel/ports-configmap.yaml
Normal file
@ -0,0 +1,103 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{- if and (eq .Values.architecture "replication") .Values.sentinel.enabled (eq .Values.sentinel.service.type "NodePort") (not .Values.sentinel.service.nodePorts.valkey ) }}
|
||||
{{- /* create a list to keep track of ports we choose to use */}}
|
||||
{{ $chosenports := (list ) }}
|
||||
|
||||
{{- /* Get list of all used nodeports */}}
|
||||
{{ $usedports := (list ) }}
|
||||
{{- range $index, $service := (lookup "v1" "Service" "" "").items }}
|
||||
{{- range.spec.ports }}
|
||||
{{- if .nodePort }}
|
||||
{{- $usedports = (append $usedports .nodePort) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- /*
|
||||
comments that start with # are rendered in the output when you debug, so you can less and search for them
|
||||
Vars in the comment will be rendered out, so you can check their value this way.
|
||||
https://helm.sh/docs/chart_best_practices/templates/#comments-yaml-comments-vs-template-comments
|
||||
|
||||
remove the template comments and leave the yaml comments to help debug
|
||||
*/}}
|
||||
|
||||
{{- /* Sort the list */}}
|
||||
{{ $usedports = $usedports | sortAlpha }}
|
||||
#usedports {{ $usedports }}
|
||||
|
||||
{{- /* How many nodeports per service do we want to create, except for the main service which is always two */}}
|
||||
{{ $numberofPortsPerNodeService := 2 }}
|
||||
|
||||
{{- /* for every nodeport we want, loop though the used ports to get an unused port */}}
|
||||
{{- range $j := until (int (add (mul (int .Values.replica.replicaCount) $numberofPortsPerNodeService) 2)) }}
|
||||
{{- /* #j={{ $j }} */}}
|
||||
{{- $nodeport := (add $j 30000) }}
|
||||
{{- $nodeportfound := false }}
|
||||
{{- range $i := $usedports }}
|
||||
{{- /* #i={{ $i }}
|
||||
#nodeport={{ $nodeport }}
|
||||
#usedports={{ $usedports }} */}}
|
||||
{{- if and (has (toString $nodeport) $usedports) (eq $nodeportfound false) }}
|
||||
{{- /* nodeport conflicts with in use */}}
|
||||
{{- $nodeport = (add $nodeport 1) }}
|
||||
{{- else if and ( has $nodeport $chosenports) (eq $nodeportfound false) }}
|
||||
{{- /* nodeport already chosen, try another */}}
|
||||
{{- $nodeport = (add $nodeport 1) }}
|
||||
{{- else if (eq $nodeportfound false) }}
|
||||
{{- /* nodeport free to use: not already claimed and not in use */}}
|
||||
{{- /* select nodeport, and place into usedports */}}
|
||||
{{- $chosenports = (append $chosenports $nodeport) }}
|
||||
{{- $nodeportfound = true }}
|
||||
{{- else }}
|
||||
{{- /* nodeport has already been chosen and locked in, just work through the rest of the list to get to the next nodeport selection */}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if (eq $nodeportfound false) }}
|
||||
{{- $chosenports = (append $chosenports $nodeport) }}
|
||||
{{- end }}
|
||||
|
||||
{{- end }}
|
||||
|
||||
{{- /* print the usedports and chosenports for debugging */}}
|
||||
#usedports {{ $usedports }}
|
||||
#chosenports {{ $chosenports }}}}
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ template "common.names.fullname" . }}-ports-configmap
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/part-of: valkey
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations:
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
data:
|
||||
{{ $portsmap := (lookup "v1" "ConfigMap" (include "common.names.namespace" .) (printf "%s-%s" ( include "common.names.fullname" . ) "ports-configmap")).data }}
|
||||
{{- if $portsmap }}
|
||||
{{- /* configmap already exists, do not install again */ -}}
|
||||
{{- range $name, $value := $portsmap }}
|
||||
"{{ $name }}": "{{ $value }}"
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- /* configmap being set for first time */ -}}
|
||||
{{- range $index, $port := $chosenports }}
|
||||
{{- $nodenumber := (floor (div $index 2)) }}
|
||||
{{- if (eq $index 0) }}
|
||||
"{{ template "common.names.fullname" $ }}-sentinel": "{{ $port }}"
|
||||
{{- else if (eq $index 1) }}
|
||||
"{{ template "common.names.fullname" $ }}-valkey": "{{ $port }}"
|
||||
{{- else if (eq (mod $index 2) 0) }}
|
||||
"{{ template "common.names.fullname" $ }}-node-{{ (sub $nodenumber 1) }}-sentinel": "{{ $port }}"
|
||||
{{- else if (eq (mod $index 2) 1) }}
|
||||
"{{ template "common.names.fullname" $ }}-node-{{ (sub $nodenumber 1) }}-valkey": "{{ $port }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
162
manifests/valkey/templates/sentinel/service.yaml
Normal file
162
manifests/valkey/templates/sentinel/service.yaml
Normal file
@ -0,0 +1,162 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{- if or .Release.IsUpgrade (ne .Values.sentinel.service.type "NodePort") .Values.sentinel.service.nodePorts.valkey -}}
|
||||
{{- if and (eq .Values.architecture "replication") .Values.sentinel.enabled }}
|
||||
{{ $portsmap := (lookup "v1" "ConfigMap" (include "common.names.namespace" .) (printf "%s-%s" ( include "common.names.fullname" . ) "ports-configmap")).data }}
|
||||
|
||||
{{ $sentinelport := 0}}
|
||||
{{ $valkeyport := 0}}
|
||||
{{- if $portsmap }}
|
||||
{{ $sentinelport = index $portsmap (printf "%s-%s" (include "common.names.fullname" $) "sentinel") }}
|
||||
{{ $valkeyport = index $portsmap (printf "%s-%s" (include "common.names.fullname" $) "valkey") }}
|
||||
{{- else }}
|
||||
{{- end }}
|
||||
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "common.names.fullname" . }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/component: node
|
||||
app.kubernetes.io/part-of: valkey
|
||||
{{- if or .Values.sentinel.service.annotations .Values.commonAnnotations }}
|
||||
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.sentinel.service.annotations .Values.commonAnnotations ) "context" . ) }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
type: {{ .Values.sentinel.service.type }}
|
||||
{{- if or (eq .Values.sentinel.service.type "LoadBalancer") (eq .Values.sentinel.service.type "NodePort") }}
|
||||
externalTrafficPolicy: {{ .Values.sentinel.service.externalTrafficPolicy | quote }}
|
||||
{{- end }}
|
||||
{{- if and (eq .Values.sentinel.service.type "LoadBalancer") (not (empty .Values.sentinel.service.loadBalancerIP)) }}
|
||||
loadBalancerIP: {{ .Values.sentinel.service.loadBalancerIP }}
|
||||
{{- end }}
|
||||
{{- if and (eq .Values.sentinel.service.type "LoadBalancer") .Values.sentinel.service.loadBalancerClass }}
|
||||
loadBalancerClass: {{ .Values.sentinel.service.loadBalancerClass }}
|
||||
{{- end }}
|
||||
{{- if and (eq .Values.sentinel.service.type "LoadBalancer") (not (empty .Values.sentinel.service.loadBalancerSourceRanges)) }}
|
||||
loadBalancerSourceRanges: {{ toYaml .Values.sentinel.service.loadBalancerSourceRanges | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if and .Values.sentinel.service.clusterIP (eq .Values.sentinel.service.type "ClusterIP") }}
|
||||
clusterIP: {{ .Values.sentinel.service.clusterIP }}
|
||||
{{- end }}
|
||||
{{- if .Values.sentinel.service.sessionAffinity }}
|
||||
sessionAffinity: {{ .Values.sentinel.service.sessionAffinity }}
|
||||
{{- end }}
|
||||
{{- if .Values.sentinel.service.sessionAffinityConfig }}
|
||||
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.sentinel.service.sessionAffinityConfig "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: tcp-redis
|
||||
{{- if and (or (eq .Values.sentinel.service.type "NodePort") (eq .Values.sentinel.service.type "LoadBalancer")) .Values.sentinel.service.nodePorts.valkey }}
|
||||
port: {{ .Values.sentinel.service.nodePorts.valkey }}
|
||||
{{- else if eq .Values.sentinel.service.type "NodePort" }}
|
||||
port: {{ $valkeyport }}
|
||||
{{- else}}
|
||||
port: {{ .Values.sentinel.service.ports.valkey }}
|
||||
{{- end }}
|
||||
targetPort: {{ .Values.replica.containerPorts.valkey }}
|
||||
{{- if and (or (eq .Values.sentinel.service.type "NodePort") (eq .Values.sentinel.service.type "LoadBalancer")) .Values.sentinel.service.nodePorts.valkey }}
|
||||
nodePort: {{ .Values.sentinel.service.nodePorts.valkey }}
|
||||
{{- else if eq .Values.sentinel.service.type "ClusterIP" }}
|
||||
nodePort: null
|
||||
{{- else if eq .Values.sentinel.service.type "NodePort" }}
|
||||
nodePort: {{ $valkeyport }}
|
||||
{{- end }}
|
||||
- name: tcp-sentinel
|
||||
{{- if and (or (eq .Values.sentinel.service.type "NodePort") (eq .Values.sentinel.service.type "LoadBalancer")) .Values.sentinel.service.nodePorts.sentinel }}
|
||||
port: {{ .Values.sentinel.service.nodePorts.sentinel }}
|
||||
{{- else if eq .Values.sentinel.service.type "NodePort" }}
|
||||
port: {{ $sentinelport }}
|
||||
{{- else }}
|
||||
port: {{ .Values.sentinel.service.ports.sentinel }}
|
||||
{{- end }}
|
||||
targetPort: {{ .Values.sentinel.containerPorts.sentinel }}
|
||||
{{- if and (or (eq .Values.sentinel.service.type "NodePort") (eq .Values.sentinel.service.type "LoadBalancer")) .Values.sentinel.service.nodePorts.sentinel }}
|
||||
nodePort: {{ .Values.sentinel.service.nodePorts.sentinel }}
|
||||
{{- else if eq .Values.sentinel.service.type "ClusterIP" }}
|
||||
nodePort: null
|
||||
{{- else if eq .Values.sentinel.service.type "NodePort" }}
|
||||
nodePort: {{ $sentinelport }}
|
||||
{{- end }}
|
||||
{{- if eq .Values.sentinel.service.type "NodePort" }}
|
||||
- name: sentinel-internal
|
||||
nodePort: null
|
||||
port: {{ .Values.sentinel.containerPorts.sentinel }}
|
||||
protocol: TCP
|
||||
targetPort: {{ .Values.sentinel.containerPorts.sentinel }}
|
||||
- name: valkey-internal
|
||||
nodePort: null
|
||||
port: {{ .Values.replica.containerPorts.valkey }}
|
||||
protocol: TCP
|
||||
targetPort: {{ .Values.replica.containerPorts.valkey }}
|
||||
{{- end }}
|
||||
{{- if .Values.sentinel.service.extraPorts }}
|
||||
{{- include "common.tplvalues.render" (dict "value" .Values.sentinel.service.extraPorts "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.replica.podLabels .Values.commonLabels ) "context" . ) }}
|
||||
selector: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/component: node
|
||||
|
||||
{{- if and .Values.sentinel.enabled .Values.sentinel.service.createPrimary}}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: "{{ template "common.names.fullname" . }}-primary"
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/component: node
|
||||
{{- if or .Values.sentinel.service.annotations .Values.commonAnnotations }}
|
||||
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.sentinel.service.annotations .Values.commonAnnotations ) "context" . ) }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
type: {{ .Values.sentinel.service.type }}
|
||||
{{- if or (eq .Values.sentinel.service.type "LoadBalancer") (eq .Values.sentinel.service.type "NodePort") }}
|
||||
externalTrafficPolicy: {{ .Values.sentinel.service.externalTrafficPolicy | quote }}
|
||||
{{- end }}
|
||||
{{- if and (eq .Values.sentinel.service.type "LoadBalancer") (not (empty .Values.sentinel.service.loadBalancerIP)) }}
|
||||
loadBalancerIP: {{ .Values.sentinel.service.loadBalancerIP }}
|
||||
{{- end }}
|
||||
{{- if and (eq .Values.sentinel.service.type "LoadBalancer") .Values.sentinel.service.loadBalancerClass }}
|
||||
loadBalancerClass: {{ .Values.sentinel.service.loadBalancerClass }}
|
||||
{{- end }}
|
||||
{{- if and (eq .Values.sentinel.service.type "LoadBalancer") (not (empty .Values.sentinel.service.loadBalancerSourceRanges)) }}
|
||||
loadBalancerSourceRanges: {{ toYaml .Values.sentinel.service.loadBalancerSourceRanges | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if and .Values.sentinel.service.clusterIP (eq .Values.sentinel.service.type "ClusterIP") }}
|
||||
clusterIP: {{ .Values.sentinel.service.clusterIP }}
|
||||
{{- end }}
|
||||
{{- if .Values.sentinel.service.sessionAffinity }}
|
||||
sessionAffinity: {{ .Values.sentinel.service.sessionAffinity }}
|
||||
{{- end }}
|
||||
{{- if .Values.sentinel.service.sessionAffinityConfig }}
|
||||
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.sentinel.service.sessionAffinityConfig "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: tcp-redis
|
||||
{{- if and (or (eq .Values.sentinel.service.type "NodePort") (eq .Values.sentinel.service.type "LoadBalancer")) .Values.sentinel.service.nodePorts.valkey }}
|
||||
port: {{ .Values.sentinel.service.nodePorts.valkey }}
|
||||
{{- else if eq .Values.sentinel.service.type "NodePort" }}
|
||||
port: {{ $valkeyport }}
|
||||
{{- else}}
|
||||
port: {{ .Values.sentinel.service.ports.valkey }}
|
||||
{{- end }}
|
||||
targetPort: {{ .Values.replica.containerPorts.valkey }}
|
||||
{{- if and (or (eq .Values.sentinel.service.type "NodePort") (eq .Values.sentinel.service.type "LoadBalancer")) .Values.sentinel.service.nodePorts.valkey }}
|
||||
nodePort: {{ .Values.sentinel.service.nodePorts.valkey }}
|
||||
{{- else if eq .Values.sentinel.service.type "ClusterIP" }}
|
||||
nodePort: null
|
||||
{{- else if eq .Values.sentinel.service.type "NodePort" }}
|
||||
nodePort: {{ $valkeyport }}
|
||||
{{- end }}
|
||||
selector: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 4 }}
|
||||
isPrimary: "true"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
807
manifests/valkey/templates/sentinel/statefulset.yaml
Normal file
807
manifests/valkey/templates/sentinel/statefulset.yaml
Normal file
@ -0,0 +1,807 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{- if or .Release.IsUpgrade (ne .Values.sentinel.service.type "NodePort") .Values.sentinel.service.nodePorts.valkey -}}
|
||||
{{- if and (eq .Values.architecture "replication") .Values.sentinel.enabled }}
|
||||
apiVersion: {{ include "common.capabilities.statefulset.apiVersion" . }}
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: {{ printf "%s-node" (include "common.names.fullname" .) }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/component: node
|
||||
app.kubernetes.io/part-of: valkey
|
||||
{{- if or .Values.commonAnnotations .Values.sentinel.annotations }}
|
||||
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.sentinel.annotations .Values.commonAnnotations ) "context" . ) }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
replicas: {{ .Values.replica.replicaCount }}
|
||||
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.replica.podLabels .Values.commonLabels ) "context" . ) }}
|
||||
selector:
|
||||
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
|
||||
app.kubernetes.io/component: node
|
||||
serviceName: {{ printf "%s-headless" (include "common.names.fullname" .) }}
|
||||
{{- if .Values.replica.updateStrategy }}
|
||||
updateStrategy: {{- toYaml .Values.replica.updateStrategy | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.minReadySeconds }}
|
||||
minReadySeconds: {{ .Values.replica.minReadySeconds }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.podManagementPolicy }}
|
||||
podManagementPolicy: {{ .Values.replica.podManagementPolicy | quote }}
|
||||
{{- end }}
|
||||
template:
|
||||
metadata:
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" $podLabels "context" $ ) | nindent 8 }}
|
||||
app.kubernetes.io/component: node
|
||||
{{- if and .Values.metrics.enabled .Values.metrics.podLabels }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.podLabels "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
annotations:
|
||||
{{- if (include "valkey.createConfigmap" .) }}
|
||||
checksum/configmap: {{ pick ( include (print $.Template.BasePath "/configmap.yaml") . | fromYaml ) "data" | toYaml | sha256sum }}
|
||||
{{- end }}
|
||||
checksum/health: {{ pick ( include (print $.Template.BasePath "/health-configmap.yaml") . | fromYaml ) "data" | toYaml | sha256sum }}
|
||||
checksum/scripts: {{ pick ( include (print $.Template.BasePath "/scripts-configmap.yaml") . | fromYaml ) "data" | toYaml | sha256sum }}
|
||||
checksum/secret: {{ pick ( include (print $.Template.BasePath "/secret.yaml") . | fromYaml ) "data" | toYaml | sha256sum }}
|
||||
{{- if .Values.replica.podAnnotations }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.replica.podAnnotations "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if and .Values.metrics.enabled .Values.metrics.podAnnotations }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.podAnnotations "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- include "valkey.imagePullSecrets" . | nindent 6 }}
|
||||
automountServiceAccountToken: {{ .Values.replica.automountServiceAccountToken }}
|
||||
{{- if .Values.replica.hostAliases }}
|
||||
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.replica.hostAliases "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.podSecurityContext.enabled }}
|
||||
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.replica.podSecurityContext "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ template "valkey.serviceAccountName" . }}
|
||||
{{- if .Values.replica.priorityClassName }}
|
||||
priorityClassName: {{ .Values.replica.priorityClassName | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.affinity }}
|
||||
affinity: {{- include "common.tplvalues.render" (dict "value" .Values.replica.affinity "context" $) | nindent 8 }}
|
||||
{{- else }}
|
||||
affinity:
|
||||
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.replica.podAffinityPreset "component" "node" "customLabels" $podLabels "context" $) | nindent 10 }}
|
||||
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.replica.podAntiAffinityPreset "component" "node" "customLabels" $podLabels "context" $) | nindent 10 }}
|
||||
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.replica.nodeAffinityPreset.type "key" .Values.replica.nodeAffinityPreset.key "values" .Values.replica.nodeAffinityPreset.values) | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.nodeSelector }}
|
||||
nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.replica.nodeSelector "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.tolerations }}
|
||||
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.replica.tolerations "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.topologySpreadConstraints }}
|
||||
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.replica.topologySpreadConstraints "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.shareProcessNamespace }}
|
||||
shareProcessNamespace: {{ .Values.replica.shareProcessNamespace }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.schedulerName }}
|
||||
schedulerName: {{ .Values.replica.schedulerName | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.dnsPolicy }}
|
||||
dnsPolicy: {{ .Values.replica.dnsPolicy }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.dnsConfig }}
|
||||
dnsConfig: {{- include "common.tplvalues.render" (dict "value" .Values.replica.dnsConfig "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
enableServiceLinks: {{ .Values.sentinel.enableServiceLinks }}
|
||||
terminationGracePeriodSeconds: {{ .Values.sentinel.terminationGracePeriodSeconds }}
|
||||
{{- $needsVolumePermissions := and .Values.volumePermissions.enabled .Values.replica.persistence.enabled .Values.replica.podSecurityContext.enabled .Values.replica.containerSecurityContext.enabled }}
|
||||
{{- if or .Values.replica.initContainers $needsVolumePermissions }}
|
||||
initContainers:
|
||||
{{- if .Values.replica.initContainers }}
|
||||
{{- include "common.tplvalues.render" (dict "value" .Values.replica.initContainers "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if $needsVolumePermissions }}
|
||||
- name: volume-permissions
|
||||
image: {{ include "valkey.volumePermissions.image" . }}
|
||||
imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }}
|
||||
command:
|
||||
- /bin/bash
|
||||
- -ec
|
||||
- |
|
||||
{{- if eq ( toString ( .Values.volumePermissions.containerSecurityContext.runAsUser )) "auto" }}
|
||||
chown -R `id -u`:`id -G | cut -d " " -f2` {{ .Values.replica.persistence.path }}
|
||||
{{- else }}
|
||||
chown -R {{ .Values.replica.containerSecurityContext.runAsUser }}:{{ .Values.replica.podSecurityContext.fsGroup }} {{ .Values.replica.persistence.path }}
|
||||
{{- end }}
|
||||
{{- if eq ( toString ( .Values.volumePermissions.containerSecurityContext.runAsUser )) "auto" }}
|
||||
securityContext: {{- omit .Values.volumePermissions.containerSecurityContext "runAsUser" | toYaml | nindent 12 }}
|
||||
{{- else }}
|
||||
securityContext: {{- .Values.volumePermissions.containerSecurityContext | toYaml | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.volumePermissions.resources }}
|
||||
resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }}
|
||||
{{- else if ne .Values.volumePermissions.resourcesPreset "none" }}
|
||||
resources: {{- include "common.resources.preset" (dict "type" .Values.volumePermissions.resourcesPreset) | nindent 12 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: empty-dir
|
||||
mountPath: /tmp
|
||||
subPath: tmp-dir
|
||||
- name: valkey-data
|
||||
mountPath: {{ .Values.replica.persistence.path }}
|
||||
{{- if .Values.replica.persistence.subPath }}
|
||||
subPath: {{ .Values.replica.persistence.subPath }}
|
||||
{{- else if .Values.replica.persistence.subPathExpr }}
|
||||
subPathExpr: {{ .Values.replica.persistence.subPathExpr }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: valkey
|
||||
image: {{ template "valkey.image" . }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
|
||||
{{- if not .Values.diagnosticMode.enabled }}
|
||||
{{- if .Values.replica.lifecycleHooks }}
|
||||
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.replica.lifecycleHooks "context" $) | nindent 12 }}
|
||||
{{- else }}
|
||||
lifecycle:
|
||||
preStop:
|
||||
exec:
|
||||
command:
|
||||
- /bin/bash
|
||||
- -c
|
||||
- /opt/bitnami/scripts/start-scripts/prestop-valkey.sh
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.containerSecurityContext.enabled }}
|
||||
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.replica.containerSecurityContext "context" $) | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.diagnosticMode.enabled }}
|
||||
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
|
||||
{{- else if .Values.replica.command }}
|
||||
command: {{- include "common.tplvalues.render" (dict "value" .Values.replica.command "context" $) | nindent 12 }}
|
||||
{{- else }}
|
||||
command:
|
||||
- /bin/bash
|
||||
{{- end }}
|
||||
{{- if .Values.diagnosticMode.enabled }}
|
||||
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
|
||||
{{- else if .Values.replica.args }}
|
||||
args: {{- include "common.tplvalues.render" (dict "value" .Values.replica.args "context" $) | nindent 12 }}
|
||||
{{- else }}
|
||||
args:
|
||||
- -c
|
||||
- /opt/bitnami/scripts/start-scripts/start-node.sh
|
||||
{{- end }}
|
||||
env:
|
||||
- name: BITNAMI_DEBUG
|
||||
value: {{ ternary "true" "false" (or .Values.image.debug .Values.diagnosticMode.enabled) | quote }}
|
||||
- name: VALKEY_PRIMARY_PORT_NUMBER
|
||||
value: {{ .Values.replica.containerPorts.valkey | quote }}
|
||||
- name: ALLOW_EMPTY_PASSWORD
|
||||
value: {{ ternary "no" "yes" .Values.auth.enabled | quote }}
|
||||
{{- if .Values.auth.enabled }}
|
||||
{{- if .Values.auth.usePasswordFiles }}
|
||||
- name: VALKEY_PASSWORD_FILE
|
||||
value: "/opt/bitnami/valkey/secrets/valkey-password"
|
||||
- name: VALKEY_PRIMARY_PASSWORD_FILE
|
||||
value: "/opt/bitnami/valkey/secrets/valkey-password"
|
||||
{{- else }}
|
||||
- name: VALKEY_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "valkey.secretName" . }}
|
||||
key: {{ template "valkey.secretPasswordKey" . }}
|
||||
- name: VALKEY_PRIMARY_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "valkey.secretName" . }}
|
||||
key: {{ template "valkey.secretPasswordKey" . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
- name: VALKEY_TLS_ENABLED
|
||||
value: {{ ternary "yes" "no" .Values.tls.enabled | quote }}
|
||||
{{- if .Values.tls.enabled }}
|
||||
- name: VALKEY_TLS_PORT
|
||||
value: {{ .Values.replica.containerPorts.valkey | quote }}
|
||||
- name: VALKEY_TLS_AUTH_CLIENTS
|
||||
value: {{ ternary "yes" "no" .Values.tls.authClients | quote }}
|
||||
- name: VALKEY_TLS_CERT_FILE
|
||||
value: {{ template "valkey.tlsCert" . }}
|
||||
- name: VALKEY_TLS_KEY_FILE
|
||||
value: {{ template "valkey.tlsCertKey" . }}
|
||||
- name: VALKEY_TLS_CA_FILE
|
||||
value: {{ template "valkey.tlsCACert" . }}
|
||||
{{- if .Values.tls.dhParamsFilename }}
|
||||
- name: VALKEY_TLS_DH_PARAMS_FILE
|
||||
value: {{ template "valkey.tlsDHParams" . }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
- name: VALKEY_PORT
|
||||
value: {{ .Values.replica.containerPorts.valkey | quote }}
|
||||
{{- end }}
|
||||
- name: VALKEY_SENTINEL_TLS_ENABLED
|
||||
value: {{ ternary "yes" "no" .Values.tls.enabled | quote }}
|
||||
{{- if .Values.tls.enabled }}
|
||||
- name: VALKEY_SENTINEL_TLS_PORT_NUMBER
|
||||
value: {{ .Values.sentinel.containerPorts.sentinel | quote }}
|
||||
- name: VALKEY_SENTINEL_TLS_AUTH_CLIENTS
|
||||
value: {{ ternary "yes" "no" .Values.tls.authClients | quote }}
|
||||
- name: VALKEY_SENTINEL_TLS_CERT_FILE
|
||||
value: {{ template "valkey.tlsCert" . }}
|
||||
- name: VALKEY_SENTINEL_TLS_KEY_FILE
|
||||
value: {{ template "valkey.tlsCertKey" . }}
|
||||
- name: VALKEY_SENTINEL_TLS_CA_FILE
|
||||
value: {{ template "valkey.tlsCACert" . }}
|
||||
{{- if .Values.tls.dhParamsFilename }}
|
||||
- name: VALKEY_SENTINEL_TLS_DH_PARAMS_FILE
|
||||
value: {{ template "valkey.tlsDHParams" . }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
- name: VALKEY_SENTINEL_PORT
|
||||
value: {{ .Values.sentinel.containerPorts.sentinel | quote }}
|
||||
{{- end }}
|
||||
- name: VALKEY_DATA_DIR
|
||||
value: {{ .Values.replica.persistence.path }}
|
||||
{{- if .Values.replica.externalPrimary.enabled }}
|
||||
- name: VALKEY_EXTERNAL_PRIMARY_HOST
|
||||
value: {{ .Values.replica.externalPrimary.host | quote }}
|
||||
- name: VALKEY_EXTERNAL_PRIMARY_PORT
|
||||
value: {{ .Values.replica.externalPrimary.port | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.extraEnvVars }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.replica.extraEnvVars "context" $ ) | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if or .Values.replica.extraEnvVarsCM .Values.replica.extraEnvVarsSecret }}
|
||||
envFrom:
|
||||
{{- if .Values.replica.extraEnvVarsCM }}
|
||||
- configMapRef:
|
||||
name: {{ .Values.replica.extraEnvVarsCM }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.extraEnvVarsSecret }}
|
||||
- secretRef:
|
||||
name: {{ .Values.replica.extraEnvVarsSecret }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: valkey
|
||||
containerPort: {{ .Values.replica.containerPorts.valkey }}
|
||||
{{- if not .Values.diagnosticMode.enabled }}
|
||||
{{- if .Values.replica.customStartupProbe }}
|
||||
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.replica.customStartupProbe "context" $) | nindent 12 }}
|
||||
{{- else if .Values.replica.startupProbe.enabled }}
|
||||
startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.replica.startupProbe "enabled") "context" $) | nindent 12 }}
|
||||
exec:
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- /health/ping_liveness_local.sh {{ .Values.replica.livenessProbe.timeoutSeconds }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.customLivenessProbe }}
|
||||
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.replica.customLivenessProbe "context" $) | nindent 12 }}
|
||||
{{- else if .Values.replica.livenessProbe.enabled }}
|
||||
livenessProbe:
|
||||
initialDelaySeconds: {{ .Values.replica.livenessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.replica.livenessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.replica.livenessProbe.timeoutSeconds }}
|
||||
successThreshold: {{ .Values.replica.livenessProbe.successThreshold }}
|
||||
failureThreshold: {{ .Values.replica.livenessProbe.failureThreshold }}
|
||||
exec:
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- /health/ping_liveness_local.sh {{ .Values.replica.livenessProbe.timeoutSeconds }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.customReadinessProbe }}
|
||||
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.replica.customReadinessProbe "context" $) | nindent 12 }}
|
||||
{{- else if .Values.replica.readinessProbe.enabled }}
|
||||
readinessProbe:
|
||||
initialDelaySeconds: {{ .Values.replica.readinessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.replica.readinessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.replica.readinessProbe.timeoutSeconds }}
|
||||
successThreshold: {{ .Values.replica.readinessProbe.successThreshold }}
|
||||
failureThreshold: {{ .Values.replica.readinessProbe.failureThreshold }}
|
||||
exec:
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- /health/ping_readiness_local.sh {{ .Values.replica.readinessProbe.timeoutSeconds }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.resources }}
|
||||
resources: {{- toYaml .Values.replica.resources | nindent 12 }}
|
||||
{{- else if ne .Values.replica.resourcesPreset "none" }}
|
||||
resources: {{- include "common.resources.preset" (dict "type" .Values.replica.resourcesPreset) | nindent 12 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: start-scripts
|
||||
mountPath: /opt/bitnami/scripts/start-scripts
|
||||
- name: health
|
||||
mountPath: /health
|
||||
- name: sentinel-data
|
||||
mountPath: /opt/bitnami/valkey-sentinel/etc
|
||||
{{- if and .Values.auth.enabled .Values.auth.usePasswordFiles }}
|
||||
- name: valkey-password
|
||||
mountPath: /opt/bitnami/valkey/secrets/
|
||||
{{- end }}
|
||||
- name: valkey-data
|
||||
mountPath: {{ .Values.replica.persistence.path }}
|
||||
{{- if .Values.replica.persistence.subPath }}
|
||||
subPath: {{ .Values.replica.persistence.subPath }}
|
||||
{{- else if .Values.replica.persistence.subPathExpr }}
|
||||
subPathExpr: {{ .Values.replica.persistence.subPathExpr }}
|
||||
{{- end }}
|
||||
- name: config
|
||||
mountPath: /opt/bitnami/valkey/mounted-etc
|
||||
- name: empty-dir
|
||||
mountPath: /opt/bitnami/valkey/etc
|
||||
subPath: app-conf-dir
|
||||
- name: empty-dir
|
||||
mountPath: /tmp
|
||||
subPath: tmp-dir
|
||||
{{- if .Values.tls.enabled }}
|
||||
- name: valkey-certificates
|
||||
mountPath: /opt/bitnami/valkey/certs
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- if .Values.replica.extraVolumeMounts }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.replica.extraVolumeMounts "context" $ ) | nindent 12 }}
|
||||
{{- end }}
|
||||
- name: sentinel
|
||||
image: {{ template "valkey.sentinel.image" . }}
|
||||
imagePullPolicy: {{ .Values.sentinel.image.pullPolicy | quote }}
|
||||
{{- if not .Values.diagnosticMode.enabled }}
|
||||
{{- if .Values.sentinel.lifecycleHooks }}
|
||||
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.sentinel.lifecycleHooks "context" $) | nindent 12 }}
|
||||
{{- else }}
|
||||
lifecycle:
|
||||
preStop:
|
||||
exec:
|
||||
command:
|
||||
- /bin/bash
|
||||
- -c
|
||||
- /opt/bitnami/scripts/start-scripts/prestop-sentinel.sh
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.sentinel.containerSecurityContext.enabled }}
|
||||
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.sentinel.containerSecurityContext "context" $) | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.diagnosticMode.enabled }}
|
||||
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
|
||||
{{- else if .Values.sentinel.command }}
|
||||
command: {{- include "common.tplvalues.render" (dict "value" .Values.sentinel.command "context" $) | nindent 12 }}
|
||||
{{- else }}
|
||||
command:
|
||||
- /bin/bash
|
||||
{{- end }}
|
||||
{{- if .Values.diagnosticMode.enabled }}
|
||||
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
|
||||
{{- else if .Values.sentinel.args }}
|
||||
args: {{- include "common.tplvalues.render" (dict "value" .Values.sentinel.args "context" $) | nindent 12 }}
|
||||
{{- else }}
|
||||
args:
|
||||
- -c
|
||||
- /opt/bitnami/scripts/start-scripts/start-sentinel.sh
|
||||
{{- end }}
|
||||
env:
|
||||
- name: BITNAMI_DEBUG
|
||||
value: {{ ternary "true" "false" (or .Values.sentinel.image.debug .Values.diagnosticMode.enabled) | quote }}
|
||||
{{- if .Values.auth.enabled }}
|
||||
{{- if .Values.auth.usePasswordFiles }}
|
||||
- name: VALKEY_PASSWORD_FILE
|
||||
value: "/opt/bitnami/valkey/secrets/valkey-password"
|
||||
{{- else }}
|
||||
- name: VALKEY_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "valkey.secretName" . }}
|
||||
key: {{ template "valkey.secretPasswordKey" . }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
- name: ALLOW_EMPTY_PASSWORD
|
||||
value: "yes"
|
||||
{{- end }}
|
||||
- name: VALKEY_SENTINEL_TLS_ENABLED
|
||||
value: {{ ternary "yes" "no" .Values.tls.enabled | quote }}
|
||||
{{- if .Values.tls.enabled }}
|
||||
- name: VALKEY_SENTINEL_TLS_PORT_NUMBER
|
||||
value: {{ .Values.sentinel.containerPorts.sentinel | quote }}
|
||||
- name: VALKEY_SENTINEL_TLS_AUTH_CLIENTS
|
||||
value: {{ ternary "yes" "no" .Values.tls.authClients | quote }}
|
||||
- name: VALKEY_SENTINEL_TLS_CERT_FILE
|
||||
value: {{ template "valkey.tlsCert" . }}
|
||||
- name: VALKEY_SENTINEL_TLS_KEY_FILE
|
||||
value: {{ template "valkey.tlsCertKey" . }}
|
||||
- name: VALKEY_SENTINEL_TLS_CA_FILE
|
||||
value: {{ template "valkey.tlsCACert" . }}
|
||||
{{- if .Values.tls.dhParamsFilename }}
|
||||
- name: VALKEY_SENTINEL_TLS_DH_PARAMS_FILE
|
||||
value: {{ template "valkey.tlsDHParams" . }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
- name: VALKEY_SENTINEL_PORT
|
||||
value: {{ .Values.sentinel.containerPorts.sentinel | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.sentinel.externalPrimary.enabled }}
|
||||
- name: VALKEY_EXTERNAL_PRIMARY_HOST
|
||||
value: {{ .Values.sentinel.externalPrimary.host | quote }}
|
||||
- name: VALKEY_EXTERNAL_PRIMARY_PORT
|
||||
value: {{ .Values.sentinel.externalPrimary.port | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.sentinel.extraEnvVars }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.sentinel.extraEnvVars "context" $ ) | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if or .Values.sentinel.extraEnvVarsCM .Values.sentinel.extraEnvVarsSecret }}
|
||||
envFrom:
|
||||
{{- if .Values.sentinel.extraEnvVarsCM }}
|
||||
- configMapRef:
|
||||
name: {{ .Values.sentinel.extraEnvVarsCM }}
|
||||
{{- end }}
|
||||
{{- if .Values.sentinel.extraEnvVarsSecret }}
|
||||
- secretRef:
|
||||
name: {{ .Values.sentinel.extraEnvVarsSecret }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: valkey-sentinel
|
||||
containerPort: {{ .Values.sentinel.containerPorts.sentinel }}
|
||||
{{- if not .Values.diagnosticMode.enabled }}
|
||||
{{- if .Values.sentinel.customStartupProbe }}
|
||||
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.sentinel.customStartupProbe "context" $) | nindent 12 }}
|
||||
{{- else if .Values.sentinel.startupProbe.enabled }}
|
||||
startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.sentinel.startupProbe "enabled") "context" $) | nindent 12 }}
|
||||
exec:
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- /health/ping_sentinel.sh {{ .Values.sentinel.livenessProbe.timeoutSeconds }}
|
||||
{{- end }}
|
||||
{{- if .Values.sentinel.customLivenessProbe }}
|
||||
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.sentinel.customLivenessProbe "context" $) | nindent 12 }}
|
||||
{{- else if .Values.sentinel.livenessProbe.enabled }}
|
||||
livenessProbe:
|
||||
initialDelaySeconds: {{ .Values.sentinel.livenessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.sentinel.livenessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.sentinel.livenessProbe.timeoutSeconds }}
|
||||
successThreshold: {{ .Values.sentinel.livenessProbe.successThreshold }}
|
||||
failureThreshold: {{ .Values.sentinel.livenessProbe.failureThreshold }}
|
||||
exec:
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- /health/ping_sentinel.sh {{ .Values.sentinel.livenessProbe.timeoutSeconds }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if not .Values.diagnosticMode.enabled }}
|
||||
{{- if .Values.sentinel.customReadinessProbe }}
|
||||
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.sentinel.customReadinessProbe "context" $) | nindent 12 }}
|
||||
{{- else if .Values.sentinel.readinessProbe.enabled }}
|
||||
readinessProbe:
|
||||
initialDelaySeconds: {{ .Values.sentinel.readinessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.sentinel.readinessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.sentinel.readinessProbe.timeoutSeconds }}
|
||||
successThreshold: {{ .Values.sentinel.readinessProbe.successThreshold }}
|
||||
failureThreshold: {{ .Values.sentinel.readinessProbe.failureThreshold }}
|
||||
exec:
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- /health/ping_sentinel.sh {{ .Values.sentinel.readinessProbe.timeoutSeconds }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.sentinel.resources }}
|
||||
resources: {{- toYaml .Values.sentinel.resources | nindent 12 }}
|
||||
{{- else if ne .Values.sentinel.resourcesPreset "none" }}
|
||||
resources: {{- include "common.resources.preset" (dict "type" .Values.sentinel.resourcesPreset) | nindent 12 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: empty-dir
|
||||
mountPath: /tmp
|
||||
subPath: tmp-dir
|
||||
- name: start-scripts
|
||||
mountPath: /opt/bitnami/scripts/start-scripts
|
||||
- name: health
|
||||
mountPath: /health
|
||||
{{- if .Values.sentinel.service.createPrimary}}
|
||||
- name: kubectl-shared
|
||||
mountPath: /etc/shared
|
||||
{{- end }}
|
||||
- name: sentinel-data
|
||||
mountPath: /opt/bitnami/valkey-sentinel/etc
|
||||
{{- if and .Values.auth.enabled .Values.auth.usePasswordFiles }}
|
||||
- name: valkey-password
|
||||
mountPath: /opt/bitnami/valkey/secrets/
|
||||
{{- end }}
|
||||
- name: valkey-data
|
||||
mountPath: {{ .Values.replica.persistence.path }}
|
||||
{{- if .Values.replica.persistence.subPath }}
|
||||
subPath: {{ .Values.replica.persistence.subPath }}
|
||||
{{- else if .Values.replica.persistence.subPathExpr }}
|
||||
subPathExpr: {{ .Values.replica.persistence.subPathExpr }}
|
||||
{{- end }}
|
||||
- name: config
|
||||
mountPath: /opt/bitnami/valkey-sentinel/mounted-etc
|
||||
{{- if .Values.tls.enabled }}
|
||||
- name: valkey-certificates
|
||||
mountPath: /opt/bitnami/valkey/certs
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- if .Values.sentinel.extraVolumeMounts }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.sentinel.extraVolumeMounts "context" $ ) | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.enabled }}
|
||||
- name: metrics
|
||||
image: {{ template "valkey.metrics.image" . }}
|
||||
imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }}
|
||||
{{- if .Values.metrics.containerSecurityContext.enabled }}
|
||||
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.metrics.containerSecurityContext "context" $) | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.diagnosticMode.enabled }}
|
||||
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
|
||||
{{- else }}
|
||||
command:
|
||||
- /bin/bash
|
||||
- -c
|
||||
- |
|
||||
{{- if and .Values.auth.enabled .Values.auth.usePasswordFiles }}
|
||||
export REDIS_PASSWORD="$(< $REDIS_PASSWORD_FILE)"
|
||||
{{- end }}
|
||||
redis_exporter{{- range $key, $value := .Values.metrics.extraArgs }} --{{ $key }}={{ $value }}{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.diagnosticMode.enabled }}
|
||||
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
|
||||
{{- end }}
|
||||
env:
|
||||
- name: REDIS_ALIAS
|
||||
value: {{ template "common.names.fullname" . }}
|
||||
- name: REDIS_EXPORTER_WEB_LISTEN_ADDRESS
|
||||
value: {{ printf ":%v" .Values.metrics.containerPorts.http }}
|
||||
{{- if .Values.auth.enabled }}
|
||||
- name: REDIS_USER
|
||||
value: default
|
||||
{{- if .Values.auth.usePasswordFiles }}
|
||||
- name: REDIS_PASSWORD_FILE
|
||||
value: "/secrets/valkey-password"
|
||||
{{- else }}
|
||||
- name: REDIS_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "valkey.secretName" . }}
|
||||
key: {{ template "valkey.secretPasswordKey" . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.tls.enabled }}
|
||||
- name: REDIS_ADDR
|
||||
value: valkeys://{{ .Values.metrics.valkeyTargetHost }}:{{ .Values.replica.containerPorts.valkey }}
|
||||
{{- if .Values.tls.authClients }}
|
||||
- name: REDIS_EXPORTER_TLS_CLIENT_KEY_FILE
|
||||
value: {{ template "valkey.tlsCertKey" . }}
|
||||
- name: REDIS_EXPORTER_TLS_CLIENT_CERT_FILE
|
||||
value: {{ template "valkey.tlsCert" . }}
|
||||
{{- end }}
|
||||
- name: REDIS_EXPORTER_TLS_CA_CERT_FILE
|
||||
value: {{ template "valkey.tlsCACert" . }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.extraEnvVars }}
|
||||
{{- include "common.tplvalues.render" (dict "value" .Values.metrics.extraEnvVars "context" $) | nindent 12 }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: metrics
|
||||
containerPort: {{ .Values.metrics.containerPorts.http }}
|
||||
{{- if not .Values.diagnosticMode.enabled }}
|
||||
{{- if .Values.metrics.customStartupProbe }}
|
||||
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.metrics.customStartupProbe "context" $) | nindent 12 }}
|
||||
{{- else if .Values.metrics.startupProbe.enabled }}
|
||||
startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.metrics.startupProbe "enabled") "context" $) | nindent 12 }}
|
||||
tcpSocket:
|
||||
port: metrics
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.customLivenessProbe }}
|
||||
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.metrics.customLivenessProbe "context" $) | nindent 12 }}
|
||||
{{- else if .Values.metrics.livenessProbe.enabled }}
|
||||
livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.metrics.livenessProbe "enabled") "context" $) | nindent 12 }}
|
||||
tcpSocket:
|
||||
port: metrics
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.customReadinessProbe }}
|
||||
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.metrics.customReadinessProbe "context" $) | nindent 12 }}
|
||||
{{- else if .Values.metrics.readinessProbe.enabled }}
|
||||
readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.metrics.readinessProbe "enabled") "context" $) | nindent 12 }}
|
||||
httpGet:
|
||||
path: /
|
||||
port: metrics
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.resources }}
|
||||
resources: {{- toYaml .Values.metrics.resources | nindent 12 }}
|
||||
{{- else if ne .Values.metrics.resourcesPreset "none" }}
|
||||
resources: {{- include "common.resources.preset" (dict "type" .Values.metrics.resourcesPreset) | nindent 12 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: empty-dir
|
||||
mountPath: /tmp
|
||||
subPath: tmp-dir
|
||||
{{- if and .Values.auth.enabled .Values.auth.usePasswordFiles }}
|
||||
- name: valkey-password
|
||||
mountPath: /secrets/
|
||||
{{- end }}
|
||||
{{- if .Values.tls.enabled }}
|
||||
- name: valkey-certificates
|
||||
mountPath: /opt/bitnami/valkey/certs
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.extraVolumeMounts }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.extraVolumeMounts "context" $ ) | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.sentinel.service.createPrimary }}
|
||||
- name: kubectl-shared
|
||||
image: {{ template "valkey.kubectl.image" . }}
|
||||
imagePullPolicy: {{ .Values.kubectl.image.pullPolicy | quote }}
|
||||
command: {{- toYaml .Values.kubectl.command | nindent 12 }}
|
||||
{{- if .Values.kubectl.containerSecurityContext.enabled }}
|
||||
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.kubectl.containerSecurityContext "context" $) | nindent 12 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: kubectl-shared
|
||||
mountPath: /etc/shared
|
||||
- name: kubectl-scripts
|
||||
mountPath: /opt/bitnami/scripts/kubectl-scripts
|
||||
{{- if .Values.kubectl.resources }}
|
||||
resources: {{- toYaml .Values.kubectl.resources | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.sidecars }}
|
||||
{{- include "common.tplvalues.render" (dict "value" .Values.replica.sidecars "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: start-scripts
|
||||
configMap:
|
||||
name: {{ printf "%s-scripts" (include "common.names.fullname" .) }}
|
||||
defaultMode: 0755
|
||||
- name: health
|
||||
configMap:
|
||||
name: {{ printf "%s-health" (include "common.names.fullname" .) }}
|
||||
defaultMode: 0755
|
||||
{{- if .Values.sentinel.service.createPrimary}}
|
||||
- name: kubectl-shared
|
||||
emptyDir: {}
|
||||
- name: kubectl-scripts
|
||||
configMap:
|
||||
name: {{ printf "%s-kubectl-scripts" (include "common.names.fullname" .) }}
|
||||
defaultMode: 0755
|
||||
{{- end }}
|
||||
{{- if and .Values.auth.enabled .Values.auth.usePasswordFiles }}
|
||||
- name: valkey-password
|
||||
{{ if .Values.auth.usePasswordFileFromSecret }}
|
||||
secret:
|
||||
secretName: {{ template "valkey.secretName" . }}
|
||||
items:
|
||||
- key: {{ template "valkey.secretPasswordKey" . }}
|
||||
path: valkey-password
|
||||
{{- else }}
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
- name: config
|
||||
configMap:
|
||||
name: {{ include "valkey.configmapName" . }}
|
||||
{{- if not .Values.sentinel.persistence.enabled }}
|
||||
- name: sentinel-data
|
||||
{{- if or .Values.sentinel.persistence.medium .Values.sentinel.persistence.sizeLimit }}
|
||||
emptyDir:
|
||||
{{- if .Values.sentinel.persistence.medium }}
|
||||
medium: {{ .Values.sentinel.persistence.medium | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.sentinel.persistence.sizeLimit }}
|
||||
sizeLimit: {{ .Values.sentinel.persistence.sizeLimit | quote }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
- name: empty-dir
|
||||
{{- if or .Values.sentinel.persistence.medium .Values.sentinel.persistence.sizeLimit }}
|
||||
emptyDir:
|
||||
{{- if .Values.sentinel.persistence.medium }}
|
||||
medium: {{ .Values.sentinel.persistence.medium | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.sentinel.persistence.sizeLimit }}
|
||||
sizeLimit: {{ .Values.sentinel.persistence.sizeLimit | quote }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.extraVolumes }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.replica.extraVolumes "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.extraVolumes }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.extraVolumes "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.sentinel.extraVolumes }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.sentinel.extraVolumes "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.tls.enabled }}
|
||||
- name: valkey-certificates
|
||||
secret:
|
||||
secretName: {{ include "valkey.tlsSecretName" . }}
|
||||
defaultMode: 256
|
||||
{{- end }}
|
||||
{{- if not .Values.replica.persistence.enabled }}
|
||||
- name: valkey-data
|
||||
{{- if or .Values.replica.persistence.medium .Values.replica.persistence.sizeLimit }}
|
||||
emptyDir:
|
||||
{{- if .Values.replica.persistence.medium }}
|
||||
medium: {{ .Values.replica.persistence.medium | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.persistence.sizeLimit }}
|
||||
sizeLimit: {{ .Values.replica.persistence.sizeLimit | quote }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
{{- else if .Values.replica.persistence.existingClaim }}
|
||||
- name: valkey-data
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ printf "%s" (tpl .Values.replica.persistence.existingClaim .) }}
|
||||
{{- else }}
|
||||
{{- if .Values.sentinel.persistentVolumeClaimRetentionPolicy.enabled }}
|
||||
persistentVolumeClaimRetentionPolicy:
|
||||
whenDeleted: {{ .Values.sentinel.persistentVolumeClaimRetentionPolicy.whenDeleted }}
|
||||
whenScaled: {{ .Values.sentinel.persistentVolumeClaimRetentionPolicy.whenScaled }}
|
||||
{{- end }}
|
||||
volumeClaimTemplates:
|
||||
- apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: valkey-data
|
||||
labels: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 10 }}
|
||||
app.kubernetes.io/component: node
|
||||
{{- if .Values.replica.persistence.annotations }}
|
||||
annotations: {{- toYaml .Values.replica.persistence.annotations | nindent 10 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
accessModes:
|
||||
{{- range .Values.replica.persistence.accessModes }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.replica.persistence.size | quote }}
|
||||
{{- if .Values.replica.persistence.selector }}
|
||||
selector: {{- include "common.tplvalues.render" ( dict "value" .Values.replica.persistence.selector "context" $) | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- include "common.storage.class" (dict "persistence" .Values.replica.persistence "global" .Values.global) | nindent 8 }}
|
||||
{{- if .Values.sentinel.persistence.enabled }}
|
||||
- apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: sentinel-data
|
||||
{{- $claimLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.sentinel.persistence.labels .Values.commonLabels ) "context" . ) }}
|
||||
labels: {{- include "common.labels.matchLabels" ( dict "customLabels" $claimLabels "context" $ ) | nindent 10 }}
|
||||
app.kubernetes.io/component: node
|
||||
{{- if .Values.sentinel.persistence.annotations }}
|
||||
annotations: {{- toYaml .Values.sentinel.persistence.annotations | nindent 10 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
accessModes:
|
||||
{{- range .Values.sentinel.persistence.accessModes }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.sentinel.persistence.size | quote }}
|
||||
{{- if .Values.sentinel.persistence.selector }}
|
||||
selector: {{- include "common.tplvalues.render" ( dict "value" .Values.sentinel.persistence.selector "context" $) | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- if .Values.sentinel.persistence.dataSource }}
|
||||
dataSource: {{- include "common.tplvalues.render" (dict "value" .Values.sentinel.persistence.dataSource "context" $) | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- include "common.storage.class" (dict "persistence" .Values.sentinel.persistence "global" .Values.global) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
58
manifests/valkey/templates/sentinel/vpa.yaml
Normal file
58
manifests/valkey/templates/sentinel/vpa.yaml
Normal file
@ -0,0 +1,58 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{- if and (include "common.capabilities.apiVersions.has" ( dict "version" "autoscaling.k8s.io/v1/VerticalPodAutoscaler" "context" . )) .Values.replica.autoscaling.vpa.enabled .Values.sentinel.enabled }}
|
||||
apiVersion: autoscaling.k8s.io/v1
|
||||
kind: VerticalPodAutoscaler
|
||||
metadata:
|
||||
name: {{ include "common.names.fullname" . }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/component: replica
|
||||
app.kubernetes.io/part-of: valkey
|
||||
{{- if or .Values.replica.autoscaling.vpa.annotations .Values.commonAnnotations }}
|
||||
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.replica.autoscaling.vpa.annotations .Values.commonAnnotations ) "context" . ) }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
resourcePolicy:
|
||||
containerPolicies:
|
||||
- containerName: valkey
|
||||
{{- with .Values.replica.autoscaling.vpa.controlledResources }}
|
||||
controlledResources:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.replica.autoscaling.vpa.maxAllowed }}
|
||||
maxAllowed:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.replica.autoscaling.vpa.minAllowed }}
|
||||
minAllowed:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
- containerName: sentinel
|
||||
{{- with .Values.replica.autoscaling.vpa.controlledResources }}
|
||||
controlledResources:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.replica.autoscaling.vpa.maxAllowed }}
|
||||
maxAllowed:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.replica.autoscaling.vpa.minAllowed }}
|
||||
minAllowed:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
targetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: "StatefulSet"
|
||||
name: {{ printf "%s-node" (include "common.names.fullname" .) }}
|
||||
{{- if .Values.replica.autoscaling.vpa.updatePolicy }}
|
||||
updatePolicy:
|
||||
{{- with .Values.replica.autoscaling.vpa.updatePolicy.updateMode }}
|
||||
updateMode: {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
19
manifests/valkey/templates/serviceaccount.yaml
Normal file
19
manifests/valkey/templates/serviceaccount.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{- if and .Values.serviceAccount.create .Values.sentinel.enabled }}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
|
||||
metadata:
|
||||
name: {{ template "valkey.serviceAccountName" . }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/part-of: valkey
|
||||
{{- if or .Values.commonAnnotations .Values.serviceAccount.annotations }}
|
||||
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.serviceAccount.annotations .Values.commonAnnotations ) "context" . ) }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
83
manifests/valkey/templates/servicemonitor.yaml
Normal file
83
manifests/valkey/templates/servicemonitor.yaml
Normal file
@ -0,0 +1,83 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }}
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
name: {{ template "common.names.fullname" . }}
|
||||
namespace: {{ default (include "common.names.namespace" .) .Values.metrics.serviceMonitor.namespace | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/part-of: valkey
|
||||
{{- if .Values.metrics.serviceMonitor.additionalLabels }}
|
||||
{{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.additionalLabels "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
endpoints:
|
||||
- port: {{ .Values.metrics.serviceMonitor.port }}
|
||||
{{- if .Values.metrics.serviceMonitor.interval }}
|
||||
interval: {{ .Values.metrics.serviceMonitor.interval }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.serviceMonitor.scrapeTimeout }}
|
||||
scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.serviceMonitor.honorLabels }}
|
||||
honorLabels: {{ .Values.metrics.serviceMonitor.honorLabels }}
|
||||
{{- end }}
|
||||
{{- with .Values.metrics.serviceMonitor.relabelings }}
|
||||
relabelings: {{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.serviceMonitor.metricRelabelings }}
|
||||
metricRelabelings: {{- toYaml .Values.metrics.serviceMonitor.metricRelabelings | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- range .Values.metrics.serviceMonitor.additionalEndpoints }}
|
||||
- port: {{ .port }}
|
||||
{{- if .interval }}
|
||||
interval: {{ .interval }}
|
||||
{{- end }}
|
||||
{{- if .scrapeTimeout }}
|
||||
scrapeTimeout: {{ .scrapeTimeout }}
|
||||
{{- end }}
|
||||
{{- if .honorLabels }}
|
||||
honorLabels: {{ .honorLabels }}
|
||||
{{- end }}
|
||||
{{- with $.Values.metrics.serviceMonitor.relabelings }}
|
||||
relabelings: {{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- if .metricRelabelings }}
|
||||
metricRelabelings: {{- toYaml .metricRelabelings | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- if .path }}
|
||||
path: {{ .path }}
|
||||
{{- end }}
|
||||
{{- if .params }}
|
||||
params:
|
||||
{{- range $key, $value := .params }}
|
||||
{{ $key }}:
|
||||
{{- range $value }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.serviceMonitor.podTargetLabels }}
|
||||
podTargetLabels: {{- toYaml .Values.metrics.serviceMonitor.podTargetLabels | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.metrics.serviceMonitor.sampleLimit }}
|
||||
sampleLimit: {{ . }}
|
||||
{{- end }}
|
||||
{{- with .Values.metrics.serviceMonitor.targetLimit }}
|
||||
targetLimit: {{ . }}
|
||||
{{- end }}
|
||||
namespaceSelector:
|
||||
matchNames:
|
||||
- {{ include "common.names.namespace" . | quote }}
|
||||
selector:
|
||||
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 6 }}
|
||||
app.kubernetes.io/component: metrics
|
||||
{{- end }}
|
32
manifests/valkey/templates/tls-secret.yaml
Normal file
32
manifests/valkey/templates/tls-secret.yaml
Normal file
@ -0,0 +1,32 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{- if (include "valkey.createTlsSecret" .) }}
|
||||
{{- $secretName := printf "%s-crt" (include "common.names.fullname" .) }}
|
||||
{{- $ca := genCA "valkey-ca" 365 }}
|
||||
{{- $releaseNamespace := (include "common.names.namespace" .) }}
|
||||
{{- $clusterDomain := .Values.clusterDomain }}
|
||||
{{- $fullname := include "common.names.fullname" . }}
|
||||
{{- $serviceName := include "common.names.fullname" . }}
|
||||
{{- $headlessServiceName := printf "%s-headless" (include "common.names.fullname" .) }}
|
||||
{{- $primaryServiceName := printf "%s-primary" (include "common.names.fullname" .) }}
|
||||
{{- $altNames := list (printf "*.%s.%s.svc.%s" $serviceName $releaseNamespace $clusterDomain) (printf "%s.%s.svc.%s" $primaryServiceName $releaseNamespace $clusterDomain) (printf "*.%s.%s.svc.%s" $primaryServiceName $releaseNamespace $clusterDomain) (printf "*.%s.%s.svc.%s" $headlessServiceName $releaseNamespace $clusterDomain) (printf "%s.%s.svc.%s" $headlessServiceName $releaseNamespace $clusterDomain) "127.0.0.1" "localhost" $fullname }}
|
||||
{{- $cert := genSignedCert $fullname nil $altNames 365 $ca }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ $secretName }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/part-of: valkey
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
type: kubernetes.io/tls
|
||||
data:
|
||||
tls.crt: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "tls.crt" "defaultValue" $cert.Cert "context" $) }}
|
||||
tls.key: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "tls.key" "defaultValue" $cert.Key "context" $) }}
|
||||
ca.crt: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "ca.crt" "defaultValue" $ca.Cert "context" $) }}
|
||||
{{- end }}
|
163
manifests/valkey/values.schema.json
Normal file
163
manifests/valkey/values.schema.json
Normal file
@ -0,0 +1,163 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/schema#",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"architecture": {
|
||||
"type": "string",
|
||||
"title": "Valkey architecture",
|
||||
"form": true,
|
||||
"description": "Allowed values: `standalone` or `replication`",
|
||||
"enum": ["standalone", "replication"]
|
||||
},
|
||||
"auth": {
|
||||
"type": "object",
|
||||
"title": "Authentication configuration",
|
||||
"form": true,
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean",
|
||||
"form": true,
|
||||
"title": "Use password authentication"
|
||||
},
|
||||
"password": {
|
||||
"type": "string",
|
||||
"title": "Valkey password",
|
||||
"form": true,
|
||||
"description": "Defaults to a random 10-character alphanumeric string if not set",
|
||||
"hidden": {
|
||||
"value": false,
|
||||
"path": "auth/enabled"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"primary": {
|
||||
"type": "object",
|
||||
"title": "Primary replicas settings",
|
||||
"form": true,
|
||||
"properties": {
|
||||
"kind": {
|
||||
"type": "string",
|
||||
"title": "Workload Kind",
|
||||
"form": true,
|
||||
"description": "Allowed values: `Deployment`, `StatefulSet` or `DaemonSet`",
|
||||
"enum": ["Deployment", "StatefulSet", "DaemonSet"]
|
||||
},
|
||||
"persistence": {
|
||||
"type": "object",
|
||||
"title": "Persistence for primary replicas",
|
||||
"form": true,
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean",
|
||||
"form": true,
|
||||
"title": "Enable persistence",
|
||||
"description": "Enable persistence using Persistent Volume Claims"
|
||||
},
|
||||
"size": {
|
||||
"type": "string",
|
||||
"title": "Persistent Volume Size",
|
||||
"form": true,
|
||||
"render": "slider",
|
||||
"sliderMin": 1,
|
||||
"sliderMax": 100,
|
||||
"sliderUnit": "Gi",
|
||||
"hidden": {
|
||||
"value": false,
|
||||
"path": "primary/persistence/enabled"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"replica": {
|
||||
"type": "object",
|
||||
"title": "Valkey replicas settings",
|
||||
"form": true,
|
||||
"hidden": {
|
||||
"value": "standalone",
|
||||
"path": "architecture"
|
||||
},
|
||||
"properties": {
|
||||
"kind": {
|
||||
"type": "string",
|
||||
"title": "Workload Kind",
|
||||
"form": true,
|
||||
"description": "Allowed values: `DaemonSet` or `StatefulSet`",
|
||||
"enum": ["DaemonSet", "StatefulSet"]
|
||||
},
|
||||
"replicaCount": {
|
||||
"type": "integer",
|
||||
"form": true,
|
||||
"title": "Number of Valkey replicas"
|
||||
},
|
||||
"persistence": {
|
||||
"type": "object",
|
||||
"title": "Persistence for Valkey replicas",
|
||||
"form": true,
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean",
|
||||
"form": true,
|
||||
"title": "Enable persistence",
|
||||
"description": "Enable persistence using Persistent Volume Claims"
|
||||
},
|
||||
"size": {
|
||||
"type": "string",
|
||||
"title": "Persistent Volume Size",
|
||||
"form": true,
|
||||
"render": "slider",
|
||||
"sliderMin": 1,
|
||||
"sliderMax": 100,
|
||||
"sliderUnit": "Gi",
|
||||
"hidden": {
|
||||
"value": false,
|
||||
"path": "replica/persistence/enabled"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"volumePermissions": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean",
|
||||
"form": true,
|
||||
"title": "Enable Init Containers",
|
||||
"description": "Use an init container to set required folder permissions on the data volume before mounting it in the final destination"
|
||||
}
|
||||
}
|
||||
},
|
||||
"metrics": {
|
||||
"type": "object",
|
||||
"form": true,
|
||||
"title": "Prometheus metrics details",
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean",
|
||||
"title": "Create Prometheus metrics exporter",
|
||||
"description": "Create a side-car container to expose Prometheus metrics",
|
||||
"form": true
|
||||
},
|
||||
"serviceMonitor": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean",
|
||||
"title": "Create Prometheus Operator ServiceMonitor",
|
||||
"description": "Create a ServiceMonitor to track metrics using Prometheus Operator",
|
||||
"form": true,
|
||||
"hidden": {
|
||||
"value": false,
|
||||
"path": "metrics/enabled"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
2137
manifests/valkey/values.yaml
Normal file
2137
manifests/valkey/values.yaml
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user