Charts CI
``` Updated: argo/argo-cd: - 5.13.7 asserts/asserts: - 1.10.0 bitnami/airflow: - 14.0.3 bitnami/mariadb: - 11.3.5 bitnami/mysql: - 9.4.3 bitnami/postgresql: - 12.1.1 bitnami/redis: - 17.3.9 bitnami/spark: - 6.3.10 bitnami/wordpress: - 15.2.14 datadog/datadog: - 3.3.0 gitlab/gitlab: - 6.5.4 harbor/harbor: - 1.10.2 intel/intel-device-plugins-operator: - 0.25.0 kong/kong: - 2.13.1 kuma/kuma: - 2.0.0 nats/nats: - 0.18.2 ```pull/575/head
parent
c7bd4b6f50
commit
4caabb650f
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,4 @@
|
||||||
|
/*.tgz
|
||||||
|
output
|
||||||
|
ci/
|
||||||
|
*.gotmpl
|
|
@ -0,0 +1,6 @@
|
||||||
|
dependencies:
|
||||||
|
- name: redis-ha
|
||||||
|
repository: https://dandydeveloper.github.io/charts/
|
||||||
|
version: 4.22.3
|
||||||
|
digest: sha256:ef6269e4e073dad10c230ccfb069fc013608111c895c5e7568450bb3967cf195
|
||||||
|
generated: "2022-11-03T12:04:33.673857+09:00"
|
|
@ -0,0 +1,31 @@
|
||||||
|
annotations:
|
||||||
|
artifacthub.io/changes: |
|
||||||
|
- "[Fixed]: Use raw json format for cluster credentials for Vault plugin compatibility"
|
||||||
|
catalog.cattle.io/certified: partner
|
||||||
|
catalog.cattle.io/display-name: Argo CD
|
||||||
|
catalog.cattle.io/kube-version: '>=1.22.0-0'
|
||||||
|
catalog.cattle.io/release-name: argo-cd
|
||||||
|
apiVersion: v2
|
||||||
|
appVersion: v2.5.2
|
||||||
|
dependencies:
|
||||||
|
- condition: redis-ha.enabled
|
||||||
|
name: redis-ha
|
||||||
|
repository: file://./charts/redis-ha
|
||||||
|
version: 4.22.3
|
||||||
|
description: A Helm chart for Argo CD, a declarative, GitOps continuous delivery tool
|
||||||
|
for Kubernetes.
|
||||||
|
home: https://github.com/argoproj/argo-helm
|
||||||
|
icon: https://argo-cd.readthedocs.io/en/stable/assets/logo.png
|
||||||
|
keywords:
|
||||||
|
- argoproj
|
||||||
|
- argocd
|
||||||
|
- gitops
|
||||||
|
kubeVersion: '>=1.22.0-0'
|
||||||
|
maintainers:
|
||||||
|
- name: argoproj
|
||||||
|
url: https://argoproj.github.io/
|
||||||
|
name: argo-cd
|
||||||
|
sources:
|
||||||
|
- https://github.com/argoproj/argo-helm/tree/main/charts/argo-cd
|
||||||
|
- https://github.com/argoproj/argo-cd
|
||||||
|
version: 5.13.7
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,21 @@
|
||||||
|
apiVersion: v2
|
||||||
|
appVersion: 7.0.4
|
||||||
|
description: This Helm chart provides a highly available Redis implementation with
|
||||||
|
a master/slave configuration and uses Sentinel sidecars for failover management
|
||||||
|
home: http://redis.io/
|
||||||
|
icon: https://upload.wikimedia.org/wikipedia/en/thumb/6/6b/Redis_Logo.svg/1200px-Redis_Logo.svg.png
|
||||||
|
keywords:
|
||||||
|
- redis
|
||||||
|
- keyvalue
|
||||||
|
- database
|
||||||
|
maintainers:
|
||||||
|
- email: salimsalaues@gmail.com
|
||||||
|
name: ssalaues
|
||||||
|
- email: aaron.layfield@gmail.com
|
||||||
|
name: dandydeveloper
|
||||||
|
name: redis-ha
|
||||||
|
sources:
|
||||||
|
- https://redis.io/download
|
||||||
|
- https://github.com/DandyDeveloper/charts/blob/master/charts/redis-ha
|
||||||
|
- https://github.com/oliver006/redis_exporter
|
||||||
|
version: 4.22.3
|
|
@ -0,0 +1,396 @@
|
||||||
|
# Redis
|
||||||
|
|
||||||
|
[Redis](http://redis.io/) is an advanced key-value cache and store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets, sorted sets, bitmaps and hyperloglogs.
|
||||||
|
|
||||||
|
## TL;DR
|
||||||
|
|
||||||
|
```bash
|
||||||
|
helm repo add dandydev https://dandydeveloper.github.io/charts
|
||||||
|
helm install dandydev/redis-ha
|
||||||
|
```
|
||||||
|
|
||||||
|
By default this chart install 3 pods total:
|
||||||
|
|
||||||
|
* one pod containing a redis master and sentinel container (optional prometheus metrics exporter sidecar available)
|
||||||
|
* two pods each containing a redis slave and sentinel containers (optional prometheus metrics exporter sidecars available)
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
This chart bootstraps a [Redis](https://redis.io) highly available master/slave statefulset in a [Kubernetes](http://kubernetes.io) cluster using the Helm package manager.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
* Kubernetes 1.8+ with Beta APIs enabled
|
||||||
|
* PV provisioner support in the underlying infrastructure
|
||||||
|
|
||||||
|
## Upgrading the Chart
|
||||||
|
|
||||||
|
Please note that there have been a number of changes simplifying the redis management strategy (for better failover and elections) in the 3.x version of this chart. These changes allow the use of official [redis](https://hub.docker.com/_/redis/) images that do not require special RBAC or ServiceAccount roles. As a result when upgrading from version >=2.0.1 to >=3.0.0 of this chart, `Role`, `RoleBinding`, and `ServiceAccount` resources should be deleted manually.
|
||||||
|
|
||||||
|
### Upgrading the chart from 3.x to 4.x
|
||||||
|
|
||||||
|
Starting from version `4.x` HAProxy sidecar prometheus-exporter removed and replaced by the embedded [HAProxy metrics endpoint](https://github.com/haproxy/haproxy/tree/master/contrib/prometheus-exporter), as a result when upgrading from version 3.x to 4.x section `haproxy.exporter` should be removed and the `haproxy.metrics` need to be configured for fit your needs.
|
||||||
|
|
||||||
|
## Installing the Chart
|
||||||
|
|
||||||
|
To install the chart
|
||||||
|
|
||||||
|
```bash
|
||||||
|
helm repo add dandydev https://dandydeveloper.github.io/charts
|
||||||
|
helm install dandydev/redis-ha
|
||||||
|
```
|
||||||
|
|
||||||
|
The command deploys Redis on the Kubernetes cluster in the default configuration. By default this chart install one master pod containing redis master container and sentinel container along with 2 redis slave pods each containing their own sentinel sidecars. The [configuration](#configuration) section lists the parameters that can be configured during installation.
|
||||||
|
|
||||||
|
> **Tip**: List all releases using `helm list`
|
||||||
|
|
||||||
|
## Uninstalling the Chart
|
||||||
|
|
||||||
|
To uninstall/delete the deployment:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
helm delete <chart-name>
|
||||||
|
```
|
||||||
|
|
||||||
|
The command removes all the Kubernetes components associated with the chart and deletes the release.
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
The following table lists the configurable parameters of the Redis chart and their default values.
|
||||||
|
|
||||||
|
| Parameter | Description | Default |
|
||||||
|
|:--------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------|
|
||||||
|
| `image.repository` | Redis image repository | `redis` |
|
||||||
|
| `image.tag` | Redis image tag | `6.2.5-alpine` |
|
||||||
|
| `image.pullPolicy` | Redis image pull policy | `IfNotPresent` |
|
||||||
|
| `imagePullSecrets` | Reference to one or more secrets to be used when pulling redis images | [] |
|
||||||
|
| `tag` | Redis tag | `6.2.5-alpine` |
|
||||||
|
| `replicas` | Number of redis master/slave pods | `3` |
|
||||||
|
| `podManagementPolicy` | The statefulset pod management policy | `OrderedReady` |
|
||||||
|
| `ro_replicas` | Comma separated list of slaves which never get promoted to be master. Count starts with 0. Allowed values 1-9. i.e. 3,4 - 3th and 4th redis slave never make it to be master, where master is index 0. | ``|
|
||||||
|
| `serviceAccount.create` | Specifies whether a ServiceAccount should be created | `true` |
|
||||||
|
| `serviceAccount.name` | The name of the ServiceAccount to create | Generated using the redis-ha.fullname template |
|
||||||
|
| `serviceAccount.automountToken` | Opt in/out of automounting API credentials into container | `false` |
|
||||||
|
| `serviceAnnotations` | Annotations to set on Redis HA service | `null` |
|
||||||
|
| `serviceLabels` | Labels to set on Redis HA service | `{}` |
|
||||||
|
| `rbac.create` | Create and use RBAC resources | `true` |
|
||||||
|
| `redis.port` | Port to access the redis service | `6379` |
|
||||||
|
| `redis.tlsPort` | TLS Port to access the redis service |``|
|
||||||
|
| `redis.tlsReplication` | Configures redis with tls-replication parameter, if true sets "tls-replication yes" in redis.conf |``|
|
||||||
|
| `redis.authClients` | It is possible to disable client side certificates authentication when "authClients" is set to "no" |``|
|
||||||
|
| `redis.livenessProbe.initialDelaySeconds` | Initial delay in seconds for liveness probe | `30` |
|
||||||
|
| `redis.livenessProbe.periodSeconds` | Period in seconds after which liveness probe will be repeated | `15` |
|
||||||
|
| `redis.livenessProbe.timeoutSeconds` | Timeout seconds for liveness probe | `15` |
|
||||||
|
| `redis.livenessProbe.successThreshold` | Success threshold for liveness probe | `1` |
|
||||||
|
| `redis.livenessProbe.failureThreshold` | Failure threshold for liveness probe | `5` |
|
||||||
|
| `redis.readinessProbe.initialDelaySeconds` | Initial delay in seconds for readiness probe | `30` |
|
||||||
|
| `redis.readinessProbe.periodSeconds` | Period in seconds after which readiness probe will be repeated | `15` |
|
||||||
|
| `redis.readinessProbe.timeoutSeconds` | Timeout seconds for readiness probe | `15` |
|
||||||
|
| `redis.readinessProbe.successThreshold` | Success threshold for readiness probe | `1` |
|
||||||
|
| `redis.readinessProbe.failureThreshold` | Failure threshold for readiness probe | `5` |
|
||||||
|
| `redis.masterGroupName` | Redis convention for naming the cluster group: must match `^[\\w-\\.]+$` and can be templated | `mymaster` |
|
||||||
|
| `redis.disableCommands` | Array with commands to disable | `["FLUSHDB","FLUSHALL"]` |
|
||||||
|
| `redis.config` | Any valid redis config options in this section will be applied to each server (see below) | see values.yaml |
|
||||||
|
| `redis.customConfig` | Allows for custom redis.conf files to be applied. If this is used then `redis.config` is ignored |``|
|
||||||
|
| `redis.resources` | CPU/Memory for master/slave nodes resource requests/limits | `{}` |
|
||||||
|
| `redis.lifecycle` | Container Lifecycle Hooks for redis container | see values.yaml |
|
||||||
|
| `redis.annotations` | Annotations for the redis statefulset | `{}` |
|
||||||
|
| `redis.updateStategy.type`| Update strategy for redis statefulSet | `RollingUpdate` |
|
||||||
|
| `redis.extraVolumeMounts` | Extra volume mounts for Redis container | `[]` |
|
||||||
|
| `sentinel.port` | Port to access the sentinel service | `26379` |
|
||||||
|
| `sentinel.bind` | Configure the 'bind' directive to bind to a list of network interfaces | `` |
|
||||||
|
| `sentinel.tlsPort` | TLS Port to access the sentinel service |``|
|
||||||
|
| `sentinel.tlsReplication` | Configures sentinel with tls-replication parameter, if true sets "tls-replication yes" in sentinel.conf |``|
|
||||||
|
| `sentinel.authClients` | It is possible to disable client side certificates authentication when "authClients" is set to "no" |``|
|
||||||
|
| `sentinel.livenessProbe.initialDelaySeconds` | Initial delay in seconds for liveness probe | `30` |
|
||||||
|
| `sentinel.livenessProbe.periodSeconds` | Period in seconds after which liveness probe will be repeated | `15` |
|
||||||
|
| `sentinel.livenessProbe.timeoutSeconds` | Timeout seconds for liveness probe | `15` |
|
||||||
|
| `sentinel.livenessProbe.successThreshold` | Success threshold for liveness probe | `1` |
|
||||||
|
| `sentinel.livenessProbe.failureThreshold` | Failure threshold for liveness probe | `5` |
|
||||||
|
| `sentinel.readinessProbe.initialDelaySeconds` | Initial delay in seconds for readiness probe | `30` |
|
||||||
|
| `sentinel.readinessProbe.periodSeconds` | Period in seconds after which readiness probe will be repeated | `15` |
|
||||||
|
| `sentinel.readinessProbe.timeoutSeconds` | Timeout seconds for readiness probe | `15` |
|
||||||
|
| `sentinel.readinessProbe.successThreshold` | Success threshold for readiness probe | `3` |
|
||||||
|
| `sentinel.readinessProbe.failureThreshold` | Failure threshold for readiness probe | `5` |
|
||||||
|
| `sentinel.auth` | Enables or disables sentinel AUTH (Requires `sentinel.password` to be set) | `false` |
|
||||||
|
| `sentinel.password` | A password that configures a `requirepass` in the conf parameters (Requires `sentinel.auth: enabled`) |``|
|
||||||
|
| `sentinel.existingSecret` | An existing secret containing a key defined by `sentinel.authKey` that configures `requirepass` in the conf parameters (Requires `sentinel.auth: enabled`, cannot be used in conjunction with `.Values.sentinel.password`) |``|
|
||||||
|
| `sentinel.authKey` | The key holding the sentinel password in an existing secret. | `sentinel-password` |
|
||||||
|
| `sentinel.quorum` | Minimum number of servers necessary to maintain quorum | `2` |
|
||||||
|
| `sentinel.config` | Valid sentinel config options in this section will be applied as config options to each sentinel (see below) | see values.yaml |
|
||||||
|
| `sentinel.customConfig` | Allows for custom sentinel.conf files to be applied. If this is used then `sentinel.config` is ignored |``|
|
||||||
|
| `sentinel.resources` | CPU/Memory for sentinel node resource requests/limits | `{}` |
|
||||||
|
| `sentinel.lifecycle` | Container Lifecycle Hooks for sentinel container | `{}` |
|
||||||
|
| `sentinel.extraVolumeMounts` | Extra volume mounts for Sentinel container | `[]` |
|
||||||
|
| `init.resources` | CPU/Memory for init Container node resource requests/limits | `{}` |
|
||||||
|
| `auth` | Enables or disables redis AUTH (Requires `redisPassword` to be set) | `false` |
|
||||||
|
| `redisPassword` | A password that configures a `requirepass` and `masterauth` in the conf parameters (Requires `auth: enabled`) |``|
|
||||||
|
| `authKey` | The key holding the redis password in an existing secret. | `auth` |
|
||||||
|
| `existingSecret` | An existing secret containing a key defined by `authKey` that configures `requirepass` and `masterauth` in the conf parameters (Requires `auth: enabled`, cannot be used in conjunction with `.Values.redisPassword`) |``|
|
||||||
|
| `nodeSelector` | Node labels for pod assignment | `{}` |
|
||||||
|
| `tolerations` | Toleration labels for pod assignment | `[]` |
|
||||||
|
| `hardAntiAffinity` | Whether the Redis server pods should be forced to run on separate nodes. | `true` |
|
||||||
|
| `additionalAffinities` | Additional affinities to add to the Redis server pods. | `{}` |
|
||||||
|
| `securityContext` | Security context to be added to the Redis StatefulSet. | `{runAsUser: 1000, fsGroup: 1000, runAsNonRoot: true}` |
|
||||||
|
| `containerSecurityContext` | Security context to be added to the Redis containers. | `{ runAsNonRoot: true, allowPrivilegeEscalation: false, seccompProfile: { type: RuntimeDefault }, capabilities: { drop: [ "ALL" ] }` |
|
||||||
|
| `affinity` | Override all other affinity settings with a string. | `""` |
|
||||||
|
| `labels` | Labels for the Redis pod. | `{}` |
|
||||||
|
| `configmap.labels` | Labels for the Redis configmap. | `{}` |
|
||||||
|
| `configmapTest.image.repository` | Repository of the configmap shellcheck test image. | `koalaman/shellcheck` |
|
||||||
|
| `configmapTest.image.tag` | Tag of the configmap shellcheck test image. | `v0.5.0` |
|
||||||
|
| `configmapTest.resources` | Resources for the ConfigMap tests. | `{}` |
|
||||||
|
| `persistentVolume.size` | Size for the volume | 10Gi |
|
||||||
|
| `persistentVolume.annotations` | Annotations for the volume | `{}` |
|
||||||
|
| `persistentVolume.labels` | Labels for the volume | `{}` |
|
||||||
|
| `emptyDir` | Configuration of `emptyDir`, used only if persistentVolume is disabled and no hostPath specified | `{}` |
|
||||||
|
| `exporter.enabled` | If `true`, the prometheus exporter sidecar is enabled | `false` |
|
||||||
|
| `exporter.image` | Exporter image | `oliver006/redis_exporter` |
|
||||||
|
| `exporter.tag` | Exporter tag | `v1.27.0` |
|
||||||
|
| `exporter.port` | Exporter port | `9121` |
|
||||||
|
| `exporter.portName` | Exporter port name | `exporter-port` |
|
||||||
|
| `exporter.address` | Redis instance Hostname/Address Exists to circumvent some issues with issues in IPv6 hostname resolution | `localhost` |
|
||||||
|
| `exporter.annotations` | Prometheus scrape annotations | `{prometheus.io/path: /metrics, prometheus.io/port: "9121", prometheus.io/scrape: "true"}` |
|
||||||
|
| `exporter.extraArgs` | Additional args for the exporter | `{}` |
|
||||||
|
| `exporter.script` | A custom custom Lua script that will be mounted to exporter for collection of custom metrics. Creates a ConfigMap and sets env var `REDIS_EXPORTER_SCRIPT`. | |
|
||||||
|
| `exporter.serviceMonitor.enabled` | Use servicemonitor from prometheus operator | `false` |
|
||||||
|
| `exporter.serviceMonitor.namespace` | Namespace the service monitor is created in | `default` |
|
||||||
|
| `exporter.serviceMonitor.interval` | Scrape interval, If not set, the Prometheus default scrape interval is used | `nil` |
|
||||||
|
| `exporter.serviceMonitor.telemetryPath` | Path to redis-exporter telemetry-path | `/metrics` |
|
||||||
|
| `exporter.serviceMonitor.labels` | Labels for the servicemonitor passed to Prometheus Operator | `{}` |
|
||||||
|
| `exporter.serviceMonitor.timeout` | How long until a scrape request times out. If not set, the Prometheus default scape timeout is used | `nil` |
|
||||||
|
| `haproxy.enabled` | Enabled HAProxy LoadBalancing/Proxy | `false` |
|
||||||
|
| `haproxy.replicas` | Number of HAProxy instances | `3` |
|
||||||
|
| `haproxy.servicePort` | Modify HAProxy service port | `6379` |
|
||||||
|
| `haproxy.containerPort` | Modify HAProxy deployment container port | `6379`
|
||||||
|
| `haproxy.image.repository`| HAProxy Image Repository | `haproxy` |
|
||||||
|
| `haproxy.image.tag` | HAProxy Image Tag | `2.4.2` |
|
||||||
|
| `haproxy.image.pullPolicy`| HAProxy Image PullPolicy | `IfNotPresent` |
|
||||||
|
| `haproxy.imagePullSecrets`| Reference to one or more secrets to be used when pulling haproxy images | [] |
|
||||||
|
| `haproxy.tls.enabled` | If "true" this will enable TLS termination on haproxy | `false`
|
||||||
|
| `haproxy.tls.secretName` | Secret containing the .pem file | `""`
|
||||||
|
| `haproxy.tls.certMountPath` | Path to mount the secret that contains the certificates. haproxy | `false`
|
||||||
|
| `haproxy.tls.secretName` | Secret containing the .pem file | `""`
|
||||||
|
| `haproxy.annotations` | HAProxy template annotations | `{}` |
|
||||||
|
| `haproxy.customConfig` | Allows for custom config-haproxy.cfg file to be applied. If this is used then default config will be overwriten |``|
|
||||||
|
| `haproxy.extraConfig` | Allows to place any additional configuration section to add to the default config-haproxy.cfg |``|
|
||||||
|
| `haproxy.resources` | HAProxy resources | `{}` |
|
||||||
|
| `haproxy.emptyDir` | Configuration of `emptyDir` | `{}` |
|
||||||
|
| `haproxy.labels` | Labels for the HAProxy pod | `{}` |
|
||||||
|
| `haproxy.service.type` | HAProxy service type "ClusterIP", "LoadBalancer" or "NodePort" | `ClusterIP` |
|
||||||
|
| `haproxy.service.nodePort` | HAProxy service nodePort value (haproxy.service.type must be NodePort) | not set |
|
||||||
|
| `haproxy.image.serviceAccountName`| HAProxy serviceAccountName | `default`
|
||||||
|
| `haproxy.service.externalTrafficPolicy`| HAProxy service externalTrafficPolicy value (haproxy.service.type must be LoadBalancer) | not set |
|
||||||
|
| `haproxy.service.annotations` | HAProxy service annotations | `{}` |
|
||||||
|
| `haproxy.service.labels` | HAProxy service labels | `{}` |
|
||||||
|
| `haproxy.stickyBalancing` | HAProxy sticky load balancing to Redis nodes. Helps with connections shutdown. | `false` |
|
||||||
|
| `haproxy.hapreadport.enable` | Enable a read only port for redis slaves | `false` |
|
||||||
|
| `haproxy.hapreadport.port` | Haproxy port for read only redis slaves | `6380` |
|
||||||
|
| `haproxy.metrics.enabled` | HAProxy enable prometheus metric scraping | `false` |
|
||||||
|
| `haproxy.metrics.port` | HAProxy prometheus metrics scraping port | `9101` |
|
||||||
|
| `haproxy.metrics.portName` | HAProxy metrics scraping port name | `http-exporter-port` |
|
||||||
|
| `haproxy.metrics.scrapePath` | HAProxy prometheus metrics scraping port | `/metrics` |
|
||||||
|
| `haproxy.metrics.serviceMonitor.enabled` | Use servicemonitor from prometheus operator for HAProxy metrics | `false` |
|
||||||
|
| `haproxy.metrics.serviceMonitor.namespace` | Namespace the service monitor for HAProxy metrics is created in | `default` |
|
||||||
|
| `haproxy.metrics.serviceMonitor.interval` | Scrape interval, If not set, the Prometheus default scrape interval is used | `nil` |
|
||||||
|
| `haproxy.metrics.serviceMonitor.telemetryPath` | Path to HAProxy metrics telemetry-path | `/metrics` |
|
||||||
|
| `haproxy.metrics.serviceMonitor.labels` | Labels for the HAProxy metrics servicemonitor passed to Prometheus Operator | `{}` |
|
||||||
|
| `haproxy.metrics.serviceMonitor.timeout` | How long until a scrape request times out. If not set, the Prometheus default scape timeout is used | `nil` |
|
||||||
|
| `haproxy.init.resources` | Extra init resources | `{}` |
|
||||||
|
| `haproxy.timeout.connect` | haproxy.cfg `timeout connect` setting | `4s` |
|
||||||
|
| `haproxy.timeout.server` | haproxy.cfg `timeout server` setting | `30s` |
|
||||||
|
| `haproxy.timeout.client` | haproxy.cfg `timeout client` setting | `30s` |
|
||||||
|
| `haproxy.timeout.check` | haproxy.cfg `timeout check` setting | `2s` |
|
||||||
|
| `haproxy.checkInterval` | haproxy.cfg `check inter` setting | `1s` |
|
||||||
|
| `haproxy.checkFall` | haproxy.cfg `check fall` setting | `1` |
|
||||||
|
| `haproxy.priorityClassName` | priorityClassName for `haproxy` deployment | not set |
|
||||||
|
| `haproxy.securityContext` | Security context to be added to the HAProxy deployment. | `{runAsUser: 99, fsGroup: 99, runAsNonRoot: true}` |
|
||||||
|
| `haproxy.containerSecurityContext` | Security context to be added to the HAProxy containers. | `{ runAsNonRoot: true, allowPrivilegeEscalation: false, seccompProfile: { type: RuntimeDefault }, capabilities: { drop: [ "ALL" ] }` |
|
||||||
|
| `haproxy.hardAntiAffinity` | Whether the haproxy pods should be forced to run on separate nodes. | `true` |
|
||||||
|
| `haproxy.affinity` | Override all other haproxy affinity settings with a string. | `""` |
|
||||||
|
| `haproxy.additionalAffinities` | Additional affinities to add to the haproxy server pods. | `{}` |
|
||||||
|
| `haproxy.tests.resources` | Pod resources for the tests against HAProxy. | `{}` |
|
||||||
|
| `haproxy.IPv6.enabled` | Disables certain binding options to support non-IPv6 environments. | `true` |
|
||||||
|
| `podDisruptionBudget` | Pod Disruption Budget rules | `{}` |
|
||||||
|
| `nameOverride` | Override the chart name | `""` |
|
||||||
|
| `fullnameOverride` | Fully override the release name and chart name | `""` |
|
||||||
|
| `priorityClassName` | priorityClassName for `redis-ha-statefulset` | not set |
|
||||||
|
| `hostPath.path` | Use this path on the host for data storage | not set |
|
||||||
|
| `hostPath.chown` | Run an init-container as root to set ownership on the hostPath | `true` |
|
||||||
|
| `sysctlImage.enabled` | Enable an init container to modify Kernel settings | `false` |
|
||||||
|
| `sysctlImage.command` | sysctlImage command to execute | [] |
|
||||||
|
| `sysctlImage.registry` | sysctlImage Init container registry | `docker.io` |
|
||||||
|
| `sysctlImage.repository` | sysctlImage Init container name | `busybox` |
|
||||||
|
| `sysctlImage.tag` | sysctlImage Init container tag | `1.31.1` |
|
||||||
|
| `sysctlImage.pullPolicy` | sysctlImage Init container pull policy | `Always` |
|
||||||
|
| `sysctlImage.mountHostSys`| Mount the host `/sys` folder to `/host-sys` | `false` |
|
||||||
|
| `sysctlImage.resources` | sysctlImage resources | `{}` |
|
||||||
|
| `schedulerName` | Alternate scheduler name | `nil` |
|
||||||
|
| `tls.secretName` | The name of secret if you want to use your own TLS certificates. The secret should contains keys named by "tls.certFile" - the certificate, "tls.keyFile" - the private key, "tls.caCertFile" - the certificate of CA and "tls.dhParamsFile" - the dh parameter file | ``|
|
||||||
|
| `tls.certFile` | Name of certificate file | `redis.crt` |
|
||||||
|
| `tls.keyFile` | Name of key file | `redis.key` |
|
||||||
|
| `tls.dhParamsFile` | Name of Diffie-Hellman (DH) key exchange parameters file |`` |
|
||||||
|
| `tls.caCertFile` | Name of CA certificate file | `ca.crt` |
|
||||||
|
| `restore.s3.source` | Restore init container - AWS S3 location of dump - i.e. s3://bucket/dump.rdb | `false` |
|
||||||
|
| `restore.existingSecret` | Set to true to use existingSecret for the AWS S3 or SSH credentials | `false` |
|
||||||
|
| `topologySpreadConstraints.enabled` | Enable topology spread constraints |`false`|
|
||||||
|
| `topologySpreadConstraints.maxSkew` | Max skew of pods tolerated |`1`|
|
||||||
|
| `topologySpreadConstraints.topologyKey` | Topology key for spread |`topology.kubernetes.io/zone`|
|
||||||
|
| `topologySpreadConstraints.whenUnsatisfiable` | Enforcement policy, hard or soft |`ScheduleAnyway`|
|
||||||
|
| `restore.s3.access_key` | Restore init container - AWS AWS_ACCESS_KEY_ID to access restore.s3.source |``|
|
||||||
|
| `restore.s3.secret_key` | Restore init container - AWS AWS_SECRET_ACCESS_KEY to access restore.s3.source |``|
|
||||||
|
| `restore.s3.region` | Restore init container - AWS AWS_REGION to access restore.s3.source |``|
|
||||||
|
| `restore.ssh.source` | Restore init container - SSH scp location of dump - i.e. user@server:/path/dump.rdb | `false` |
|
||||||
|
| `restore.ssh.key` | Restore init container - SSH private key to scp restore.ssh.source to init container. Key should be in one line separated with \n. i.e. -----BEGIN RSA PRIVATE KEY-----\n...\n...\n-----END RSA PRIVATE KEY----- |`` |
|
||||||
|
| `extraContainers` | Extra containers to include in StatefulSet |`[]`|
|
||||||
|
| `extraInitContainers` | Extra init containers to include in StatefulSet |`[]`|
|
||||||
|
| `extraVolumes` | Extra volumes to include in StatefulSet |`[]`|
|
||||||
|
| `extraLabels` | Labels that should be applied to all created resources |`{}`|
|
||||||
|
| `networkPolicy.enabled` | Create NetworkPolicy for Redis StatefulSet pods |`false`|
|
||||||
|
| `networkPolicy.labels` | Labels for NetworkPolicy |`{}`|
|
||||||
|
| `networkPolicy.annotations` | Annotations for NetworkPolicy |`{}`|
|
||||||
|
| `networkPolicy.ingressRules[].selectors` | Label selector query to define resources for this ingress rule |`[]`|
|
||||||
|
| `networkPolicy.ingressRules[].ports` | The destination ports for the ingress rule |`[{port: redis.port, protocol: TCP}, {port: sentinel.port, protocol: TCP}]`|
|
||||||
|
| `networkPolicy.egressRules[].selectors` | Label selector query to define resources for this egress rule |`[]`|
|
||||||
|
| `networkPolicy.egressRules[].ports` | The destination ports for the egress rule |``|
|
||||||
|
| `splitBrainDetection.interval` | Interval between redis sentinel and server split brain checks (in seconds) |`60`|
|
||||||
|
| `splitBrainDetection.resources` | splitBrainDetection resources |`{}`|
|
||||||
|
|
||||||
|
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ helm repo add dandydev https://dandydeveloper.github.io/charts
|
||||||
|
$ helm install \
|
||||||
|
--set image=redis \
|
||||||
|
--set tag=5.0.5-alpine \
|
||||||
|
dandydev/redis-ha
|
||||||
|
```
|
||||||
|
|
||||||
|
The above command sets the Redis server within `default` namespace.
|
||||||
|
|
||||||
|
Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,
|
||||||
|
|
||||||
|
```bash
|
||||||
|
helm install -f values.yaml dandydev/redis-ha
|
||||||
|
```
|
||||||
|
|
||||||
|
> **Tip**: You can use the default [values.yaml](values.yaml)
|
||||||
|
|
||||||
|
## Custom Redis and Sentinel config options
|
||||||
|
|
||||||
|
This chart allows for most redis or sentinel config options to be passed as a key value pair through the `values.yaml` under `redis.config` and `sentinel.config`. See links below for all available options.
|
||||||
|
|
||||||
|
[Example redis.conf](http://download.redis.io/redis-stable/redis.conf)
|
||||||
|
[Example sentinel.conf](http://download.redis.io/redis-stable/sentinel.conf)
|
||||||
|
|
||||||
|
For example `repl-timeout 60` would be added to the `redis.config` section of the `values.yaml` as:
|
||||||
|
|
||||||
|
```yml
|
||||||
|
repl-timeout: "60"
|
||||||
|
```
|
||||||
|
|
||||||
|
Note:
|
||||||
|
|
||||||
|
1. Some config options should be renamed by redis version,e.g.:
|
||||||
|
|
||||||
|
```yml
|
||||||
|
# In redis 5.x,see https://raw.githubusercontent.com/antirez/redis/5.0/redis.conf
|
||||||
|
min-replicas-to-write: 1
|
||||||
|
min-replicas-max-lag: 5
|
||||||
|
|
||||||
|
# In redis 4.x and redis 3.x,see https://raw.githubusercontent.com/antirez/redis/4.0/redis.conf and https://raw.githubusercontent.com/antirez/redis/3.0/redis.conf
|
||||||
|
min-slaves-to-write 1
|
||||||
|
min-slaves-max-lag 5
|
||||||
|
```
|
||||||
|
|
||||||
|
Sentinel options supported must be in the the `sentinel <option> <master-group-name> <value>` format. For example, `sentinel down-after-milliseconds 30000` would be added to the `sentinel.config` section of the `values.yaml` as:
|
||||||
|
|
||||||
|
```yml
|
||||||
|
down-after-milliseconds: 30000
|
||||||
|
```
|
||||||
|
|
||||||
|
If more control is needed from either the redis or sentinel config then an entire config can be defined under `redis.customConfig` or `sentinel.customConfig`. Please note that these values will override any configuration options under their respective section. For example, if you define `sentinel.customConfig` then the `sentinel.config` is ignored.
|
||||||
|
|
||||||
|
## Host Kernel Settings
|
||||||
|
|
||||||
|
Redis may require some changes in the kernel of the host machine to work as expected, in particular increasing the `somaxconn` value and disabling transparent huge pages.
|
||||||
|
To do so, you can set up a privileged initContainer with the `sysctlImage` config values, for example:
|
||||||
|
|
||||||
|
```yml
|
||||||
|
sysctlImage:
|
||||||
|
enabled: true
|
||||||
|
mountHostSys: true
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -xc
|
||||||
|
- |-
|
||||||
|
sysctl -w net.core.somaxconn=10000
|
||||||
|
echo never > /host-sys/kernel/mm/transparent_hugepage/enabled
|
||||||
|
```
|
||||||
|
|
||||||
|
## HAProxy startup
|
||||||
|
|
||||||
|
When HAProxy is enabled, it will attempt to connect to each announce-service of each redis replica instance in its init container before starting.
|
||||||
|
It will fail if announce-service IP is not available fast enough (10 seconds max by announce-service).
|
||||||
|
A such case could happen if the orchestator is pending the nomination of redis pods.
|
||||||
|
Risk is limited because announce-service is using `publishNotReadyAddresses: true`, although, in such case, HAProxy pod will be rescheduled afterward by the orchestrator.
|
||||||
|
|
||||||
|
PodDisruptionBudgets are not configured by default, you may need to set the `haproxy.podDisruptionBudget` parameter in values.yaml to enable it.
|
||||||
|
|
||||||
|
## Network policies
|
||||||
|
|
||||||
|
If `networkPolicy.enabled` is set to `true`, then a `NetworkPolicy` resource is created with default rules to allow inter-Redis and Sentinel connectivity.
|
||||||
|
This is a requirement for Redis Pods to come up successfully.
|
||||||
|
|
||||||
|
You will need to define `ingressRules` to permit your application connectivity to Redis.
|
||||||
|
The `selectors` block should be in the format of a [label selector](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors).
|
||||||
|
Templating is also supported in the selectors.
|
||||||
|
See such a configuration below.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
networkPolicy: true
|
||||||
|
ingressRules:
|
||||||
|
- selectors:
|
||||||
|
- namespaceSelector:
|
||||||
|
matchLabels:
|
||||||
|
name: my-redis-client-namespace
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
# template example
|
||||||
|
app: |-
|
||||||
|
{{- .App.Name }}
|
||||||
|
## ports block is optional (defaults to below), define the block to override the defaults
|
||||||
|
# ports:
|
||||||
|
# - port: 6379
|
||||||
|
# protocol: TCP
|
||||||
|
# - port: 26379
|
||||||
|
# protocol: TCP
|
||||||
|
```
|
||||||
|
|
||||||
|
Should your Pod require additional egress rules, define them in a `egressRules` key which is structured identically to an `ingressRules` key.
|
||||||
|
|
||||||
|
## Sentinel and redis server split brain detection
|
||||||
|
|
||||||
|
Under not entirely known yet circumstances redis sentinel and its corresponding redis server reach a condition that this chart authors call "split brain" (for short). The observed behaviour is the following: the sentinel switches to the new re-elected master, but does not switch its redis server. Majority of original discussion on the problem has happened at the <https://github.com/DandyDeveloper/charts/issues/121>.
|
||||||
|
|
||||||
|
The proposed solution is currently implemented as a sidecar container that runs a bash script with the following logic:
|
||||||
|
|
||||||
|
1. Every `splitBrainDetection.interval` seconds a master (as known by sentinel) is determined
|
||||||
|
1. If it is the current node: ensure the redis server's role is master as well.
|
||||||
|
1. If it is not the current node: ensure the redis server also replicates from the same node.
|
||||||
|
|
||||||
|
If any of the checks above fails - the redis server reinitialisation happens (it regenerates configs the same way it's done during the pod init), and then the redis server is instructed to shutdown. Then kubernetes restarts the container immediately.
|
||||||
|
|
||||||
|
|
||||||
|
# Change Log
|
||||||
|
|
||||||
|
## 4.14.9 - ** POTENTIAL BREAKING CHANGE. **
|
||||||
|
Introduced the ability to change the Haproxy Deployment container pod
|
||||||
|
- Container port in redis-haproxy-deployment.yam has been changed. Was **redis.port** To **haproxy.containerPort**. Default value is 6379.
|
||||||
|
- Port in redis-haproxy-service.yaml has been changed. Was **redis.port** To **haproxy.servicePort**. Default value is 6379.
|
||||||
|
|
||||||
|
## 4.21.0 - BREAKING CHANGES (Kubernetes Deprecation)
|
||||||
|
This version introduced the deprecation of the PSP and subsequently added fields to the securityContexts that were introduced in Kubernetes v1.19:
|
||||||
|
|
||||||
|
https://kubernetes.io/docs/tutorials/security/seccomp/
|
||||||
|
|
||||||
|
As a result, from this version onwards Kubernetes versions older than 1.19 will fail to install without the removal of `.Values.containerSeucrityContext.seccompProfile` and `.Values.haproxy.containerSeucrityContext.seccompProfile` (If HAProxy is enabled)
|
|
@ -0,0 +1,25 @@
|
||||||
|
Redis can be accessed via {{ if ne (int .Values.redis.port) 0 }}port {{ .Values.redis.port }}{{ end }} {{ if .Values.redis.tlsPort }} tls-port {{ .Values.redis.tlsPort }}{{ end }} and Sentinel can be accessed via {{ if ne (int .Values.sentinel.port) 0 }}port {{ .Values.sentinel.port }}{{ end }} {{ if .Values.sentinel.tlsPort }} tls-port {{ .Values.sentinel.tlsPort }}{{ end }} on the following DNS name from within your cluster:
|
||||||
|
{{ template "redis-ha.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local
|
||||||
|
|
||||||
|
To connect to your Redis server:
|
||||||
|
|
||||||
|
{{- if .Values.auth }}
|
||||||
|
1. To retrieve the redis password:
|
||||||
|
echo $(kubectl get secret {{ template "redis-ha.fullname" . }} -o "jsonpath={.data['auth']}" | base64 --decode)
|
||||||
|
|
||||||
|
2. Connect to the Redis master pod that you can use as a client. By default the {{ template "redis-ha.fullname" . }}-server-0 pod is configured as the master:
|
||||||
|
|
||||||
|
kubectl exec -it {{ template "redis-ha.fullname" . }}-server-0 sh -n {{ .Release.Namespace }}
|
||||||
|
|
||||||
|
3. Connect using the Redis CLI (inside container):
|
||||||
|
|
||||||
|
redis-cli -a <REDIS-PASS-FROM-SECRET>
|
||||||
|
{{- else }}
|
||||||
|
1. Run a Redis pod that you can use as a client:
|
||||||
|
|
||||||
|
kubectl exec -it {{ template "redis-ha.fullname" . }}-server-0 sh -n {{ .Release.Namespace }}
|
||||||
|
|
||||||
|
2. Connect using the Redis CLI:
|
||||||
|
|
||||||
|
redis-cli -h {{ template "redis-ha.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,693 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
|
||||||
|
{{- define "config-redis.conf" }}
|
||||||
|
{{- if .Values.redis.customConfig }}
|
||||||
|
{{ tpl .Values.redis.customConfig . | indent 4 }}
|
||||||
|
{{- else }}
|
||||||
|
dir "/data"
|
||||||
|
port {{ .Values.redis.port }}
|
||||||
|
{{- if .Values.sentinel.tlsPort }}
|
||||||
|
tls-port {{ .Values.redis.tlsPort }}
|
||||||
|
tls-cert-file /tls-certs/{{ .Values.tls.certFile }}
|
||||||
|
tls-key-file /tls-certs/{{ .Values.tls.keyFile }}
|
||||||
|
{{- if .Values.tls.dhParamsFile }}
|
||||||
|
tls-dh-params-file /tls-certs/{{ .Values.tls.dhParamsFile }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.tls.caCertFile }}
|
||||||
|
tls-ca-cert-file /tls-certs/{{ .Values.tls.caCertFile }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if eq (default "yes" .Values.redis.authClients) "no"}}
|
||||||
|
tls-auth-clients no
|
||||||
|
{{- end }}
|
||||||
|
tls-replication {{ if .Values.redis.tlsReplication }}yes{{ else }}no{{ end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.redis.disableCommands }}
|
||||||
|
{{- range .Values.redis.disableCommands }}
|
||||||
|
rename-command {{ . }} ""
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- range $key, $value := .Values.redis.config }}
|
||||||
|
{{ $key }} {{ $value }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.auth }}
|
||||||
|
requirepass replace-default-auth
|
||||||
|
masterauth replace-default-auth
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- define "config-sentinel.conf" }}
|
||||||
|
{{- if .Values.sentinel.customConfig }}
|
||||||
|
{{ tpl .Values.sentinel.customConfig . | indent 4 }}
|
||||||
|
{{- else }}
|
||||||
|
dir "/data"
|
||||||
|
port {{ .Values.sentinel.port }}
|
||||||
|
{{- if .Values.sentinel.bind }}
|
||||||
|
bind {{ .Values.sentinel.bind }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.sentinel.tlsPort }}
|
||||||
|
tls-port {{ .Values.sentinel.tlsPort }}
|
||||||
|
tls-cert-file /tls-certs/{{ .Values.tls.certFile }}
|
||||||
|
tls-key-file /tls-certs/{{ .Values.tls.keyFile }}
|
||||||
|
{{- if .Values.tls.dhParamsFile }}
|
||||||
|
tls-dh-params-file /tls-certs/{{ .Values.tls.dhParamsFile }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.tls.caCertFile }}
|
||||||
|
tls-ca-cert-file /tls-certs/{{ .Values.tls.caCertFile }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if eq (default "yes" .Values.sentinel.authClients) "no"}}
|
||||||
|
tls-auth-clients no
|
||||||
|
{{- end }}
|
||||||
|
tls-replication {{ if .Values.sentinel.tlsReplication }}yes{{ else }}no{{ end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- range $key, $value := .Values.sentinel.config }}
|
||||||
|
{{- if eq "maxclients" $key }}
|
||||||
|
{{ $key }} {{ $value }}
|
||||||
|
{{- else }}
|
||||||
|
sentinel {{ $key }} {{ template "redis-ha.masterGroupName" $ }} {{ $value }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.auth }}
|
||||||
|
sentinel auth-pass {{ template "redis-ha.masterGroupName" . }} replace-default-auth
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.sentinel.auth }}
|
||||||
|
requirepass replace-default-sentinel-auth
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- define "lib.sh" }}
|
||||||
|
sentinel_get_master() {
|
||||||
|
set +e
|
||||||
|
if [ "$SENTINEL_PORT" -eq 0 ]; then
|
||||||
|
redis-cli -h "${SERVICE}" -p "${SENTINEL_TLS_PORT}" {{ if .Values.sentinel.auth }} -a "${SENTINELAUTH}" --no-auth-warning{{ end }} {{ if ne (default "yes" .Values.sentinel.authClients) "no"}} --tls --cacert /tls-certs/{{ .Values.tls.caCertFile }} --cert /tls-certs/{{ .Values.tls.certFile }} --key /tls-certs/{{ .Values.tls.keyFile }}{{ end }} sentinel get-master-addr-by-name "${MASTER_GROUP}" |\
|
||||||
|
grep -E '((^\s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))\s*$)|(^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?s*$))'
|
||||||
|
else
|
||||||
|
redis-cli -h "${SERVICE}" -p "${SENTINEL_PORT}" {{ if .Values.sentinel.auth }} -a "${SENTINELAUTH}" --no-auth-warning{{ end }} sentinel get-master-addr-by-name "${MASTER_GROUP}" |\
|
||||||
|
grep -E '((^\s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))\s*$)|(^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?s*$))'
|
||||||
|
fi
|
||||||
|
set -e
|
||||||
|
}
|
||||||
|
|
||||||
|
sentinel_get_master_retry() {
|
||||||
|
master=''
|
||||||
|
retry=${1}
|
||||||
|
sleep=3
|
||||||
|
for i in $(seq 1 "${retry}"); do
|
||||||
|
master=$(sentinel_get_master)
|
||||||
|
if [ -n "${master}" ]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep $((sleep + i))
|
||||||
|
done
|
||||||
|
echo "${master}"
|
||||||
|
}
|
||||||
|
|
||||||
|
identify_master() {
|
||||||
|
echo "Identifying redis master (get-master-addr-by-name).."
|
||||||
|
echo " using sentinel ({{ template "redis-ha.fullname" . }}), sentinel group name ({{ template "redis-ha.masterGroupName" . }})"
|
||||||
|
MASTER="$(sentinel_get_master_retry 3)"
|
||||||
|
if [ -n "${MASTER}" ]; then
|
||||||
|
echo " $(date) Found redis master (${MASTER})"
|
||||||
|
else
|
||||||
|
echo " $(date) Did not find redis master (${MASTER})"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
sentinel_update() {
|
||||||
|
echo "Updating sentinel config.."
|
||||||
|
echo " evaluating sentinel id (\${SENTINEL_ID_${INDEX}})"
|
||||||
|
eval MY_SENTINEL_ID="\$SENTINEL_ID_${INDEX}"
|
||||||
|
echo " sentinel id (${MY_SENTINEL_ID}), sentinel grp (${MASTER_GROUP}), quorum (${QUORUM})"
|
||||||
|
sed -i "1s/^/sentinel myid ${MY_SENTINEL_ID}\\n/" "${SENTINEL_CONF}"
|
||||||
|
if [ "$SENTINEL_TLS_REPLICATION_ENABLED" = true ]; then
|
||||||
|
echo " redis master (${1}:${REDIS_TLS_PORT})"
|
||||||
|
sed -i "2s/^/sentinel monitor ${MASTER_GROUP} ${1} ${REDIS_TLS_PORT} ${QUORUM} \\n/" "${SENTINEL_CONF}"
|
||||||
|
else
|
||||||
|
echo " redis master (${1}:${REDIS_PORT})"
|
||||||
|
sed -i "2s/^/sentinel monitor ${MASTER_GROUP} ${1} ${REDIS_PORT} ${QUORUM} \\n/" "${SENTINEL_CONF}"
|
||||||
|
fi
|
||||||
|
echo "sentinel announce-ip ${ANNOUNCE_IP}" >> ${SENTINEL_CONF}
|
||||||
|
if [ "$SENTINEL_PORT" -eq 0 ]; then
|
||||||
|
echo " announce (${ANNOUNCE_IP}:${SENTINEL_TLS_PORT})"
|
||||||
|
echo "sentinel announce-port ${SENTINEL_TLS_PORT}" >> ${SENTINEL_CONF}
|
||||||
|
else
|
||||||
|
echo " announce (${ANNOUNCE_IP}:${SENTINEL_PORT})"
|
||||||
|
echo "sentinel announce-port ${SENTINEL_PORT}" >> ${SENTINEL_CONF}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
redis_update() {
|
||||||
|
echo "Updating redis config.."
|
||||||
|
if [ "$REDIS_TLS_REPLICATION_ENABLED" = true ]; then
|
||||||
|
echo " we are slave of redis master (${1}:${REDIS_TLS_PORT})"
|
||||||
|
echo "slaveof ${1} ${REDIS_TLS_PORT}" >> "${REDIS_CONF}"
|
||||||
|
echo "slave-announce-port ${REDIS_TLS_PORT}" >> ${REDIS_CONF}
|
||||||
|
else
|
||||||
|
echo " we are slave of redis master (${1}:${REDIS_PORT})"
|
||||||
|
echo "slaveof ${1} ${REDIS_PORT}" >> "${REDIS_CONF}"
|
||||||
|
echo "slave-announce-port ${REDIS_PORT}" >> ${REDIS_CONF}
|
||||||
|
fi
|
||||||
|
echo "slave-announce-ip ${ANNOUNCE_IP}" >> ${REDIS_CONF}
|
||||||
|
}
|
||||||
|
|
||||||
|
copy_config() {
|
||||||
|
echo "Copying default redis config.."
|
||||||
|
echo " to '${REDIS_CONF}'"
|
||||||
|
cp /readonly-config/redis.conf "${REDIS_CONF}"
|
||||||
|
echo "Copying default sentinel config.."
|
||||||
|
echo " to '${SENTINEL_CONF}'"
|
||||||
|
cp /readonly-config/sentinel.conf "${SENTINEL_CONF}"
|
||||||
|
}
|
||||||
|
|
||||||
|
setup_defaults() {
|
||||||
|
echo "Setting up defaults.."
|
||||||
|
echo " using statefulset index (${INDEX})"
|
||||||
|
if [ "${INDEX}" = "0" ]; then
|
||||||
|
echo "Setting this pod as master for redis and sentinel.."
|
||||||
|
echo " using announce (${ANNOUNCE_IP})"
|
||||||
|
redis_update "${ANNOUNCE_IP}"
|
||||||
|
sentinel_update "${ANNOUNCE_IP}"
|
||||||
|
echo " make sure ${ANNOUNCE_IP} is not a slave (slaveof no one)"
|
||||||
|
sed -i "s/^.*slaveof.*//" "${REDIS_CONF}"
|
||||||
|
else
|
||||||
|
echo "Getting redis master ip.."
|
||||||
|
echo " blindly assuming (${SERVICE}-announce-0) or (${SERVICE}-server-0) are master"
|
||||||
|
DEFAULT_MASTER="$(getent_hosts 0 | awk '{ print $1 }')"
|
||||||
|
if [ -z "${DEFAULT_MASTER}" ]; then
|
||||||
|
echo "Error: Unable to resolve redis master (getent hosts)."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo " identified redis (may be redis master) ip (${DEFAULT_MASTER})"
|
||||||
|
echo "Setting default slave config for redis and sentinel.."
|
||||||
|
echo " using master ip (${DEFAULT_MASTER})"
|
||||||
|
redis_update "${DEFAULT_MASTER}"
|
||||||
|
sentinel_update "${DEFAULT_MASTER}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
redis_ping() {
|
||||||
|
set +e
|
||||||
|
if [ "$REDIS_PORT" -eq 0 ]; then
|
||||||
|
redis-cli -h "${MASTER}"{{ if .Values.auth }} -a "${AUTH}" --no-auth-warning{{ end }} -p "${REDIS_TLS_PORT}" {{ if ne (default "yes" .Values.sentinel.authClients) "no"}} --tls --cacert /tls-certs/{{ .Values.tls.caCertFile }} --cert /tls-certs/{{ .Values.tls.certFile }} --key /tls-certs/{{ .Values.tls.keyFile }}{{ end }} ping
|
||||||
|
else
|
||||||
|
redis-cli -h "${MASTER}"{{ if .Values.auth }} -a "${AUTH}" --no-auth-warning{{ end }} -p "${REDIS_PORT}" ping
|
||||||
|
fi
|
||||||
|
set -e
|
||||||
|
}
|
||||||
|
|
||||||
|
redis_ping_retry() {
|
||||||
|
ping=''
|
||||||
|
retry=${1}
|
||||||
|
sleep=3
|
||||||
|
for i in $(seq 1 "${retry}"); do
|
||||||
|
if [ "$(redis_ping)" = "PONG" ]; then
|
||||||
|
ping='PONG'
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep $((sleep + i))
|
||||||
|
MASTER=$(sentinel_get_master)
|
||||||
|
done
|
||||||
|
echo "${ping}"
|
||||||
|
}
|
||||||
|
|
||||||
|
find_master() {
|
||||||
|
echo "Verifying redis master.."
|
||||||
|
if [ "$REDIS_PORT" -eq 0 ]; then
|
||||||
|
echo " ping (${MASTER}:${REDIS_TLS_PORT})"
|
||||||
|
else
|
||||||
|
echo " ping (${MASTER}:${REDIS_PORT})"
|
||||||
|
fi
|
||||||
|
if [ "$(redis_ping_retry 3)" != "PONG" ]; then
|
||||||
|
echo " $(date) Can't ping redis master (${MASTER})"
|
||||||
|
echo "Attempting to force failover (sentinel failover).."
|
||||||
|
|
||||||
|
if [ "$SENTINEL_PORT" -eq 0 ]; then
|
||||||
|
echo " on sentinel (${SERVICE}:${SENTINEL_TLS_PORT}), sentinel grp (${MASTER_GROUP})"
|
||||||
|
if redis-cli -h "${SERVICE}" -p "${SENTINEL_TLS_PORT}" {{ if .Values.sentinel.auth }} -a "${SENTINELAUTH}" --no-auth-warning{{ end }} {{ if ne (default "yes" .Values.sentinel.authClients) "no"}} --tls --cacert /tls-certs/{{ .Values.tls.caCertFile }} --cert /tls-certs/{{ .Values.tls.certFile }} --key /tls-certs/{{ .Values.tls.keyFile }}{{ end }} sentinel failover "${MASTER_GROUP}" | grep -q 'NOGOODSLAVE' ; then
|
||||||
|
echo " $(date) Failover returned with 'NOGOODSLAVE'"
|
||||||
|
echo "Setting defaults for this pod.."
|
||||||
|
setup_defaults
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo " on sentinel (${SERVICE}:${SENTINEL_PORT}), sentinel grp (${MASTER_GROUP})"
|
||||||
|
if redis-cli -h "${SERVICE}" -p "${SENTINEL_PORT}" {{ if .Values.sentinel.auth }} -a "${SENTINELAUTH}" --no-auth-warning{{ end }} sentinel failover "${MASTER_GROUP}" | grep -q 'NOGOODSLAVE' ; then
|
||||||
|
echo " $(date) Failover returned with 'NOGOODSLAVE'"
|
||||||
|
echo "Setting defaults for this pod.."
|
||||||
|
setup_defaults
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Hold on for 10sec"
|
||||||
|
sleep 10
|
||||||
|
echo "We should get redis master's ip now. Asking (get-master-addr-by-name).."
|
||||||
|
if [ "$SENTINEL_PORT" -eq 0 ]; then
|
||||||
|
echo " sentinel (${SERVICE}:${SENTINEL_TLS_PORT}), sentinel grp (${MASTER_GROUP})"
|
||||||
|
else
|
||||||
|
echo " sentinel (${SERVICE}:${SENTINEL_PORT}), sentinel grp (${MASTER_GROUP})"
|
||||||
|
fi
|
||||||
|
MASTER="$(sentinel_get_master)"
|
||||||
|
if [ "${MASTER}" ]; then
|
||||||
|
echo " $(date) Found redis master (${MASTER})"
|
||||||
|
echo "Updating redis and sentinel config.."
|
||||||
|
sentinel_update "${MASTER}"
|
||||||
|
redis_update "${MASTER}"
|
||||||
|
else
|
||||||
|
echo "$(date) Error: Could not failover, exiting..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo " $(date) Found reachable redis master (${MASTER})"
|
||||||
|
echo "Updating redis and sentinel config.."
|
||||||
|
sentinel_update "${MASTER}"
|
||||||
|
redis_update "${MASTER}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
redis_ro_update() {
|
||||||
|
echo "Updating read-only redis config.."
|
||||||
|
echo " redis.conf set 'replica-priority 0'"
|
||||||
|
echo "replica-priority 0" >> ${REDIS_CONF}
|
||||||
|
}
|
||||||
|
|
||||||
|
getent_hosts() {
|
||||||
|
index=${1:-${INDEX}}
|
||||||
|
service="${SERVICE}-announce-${index}"
|
||||||
|
host=$(getent hosts "${service}")
|
||||||
|
echo "${host}"
|
||||||
|
}
|
||||||
|
|
||||||
|
identify_announce_ip() {
|
||||||
|
echo "Identify announce ip for this pod.."
|
||||||
|
echo " using (${SERVICE}-announce-${INDEX}) or (${SERVICE}-server-${INDEX})"
|
||||||
|
ANNOUNCE_IP=$(getent_hosts | awk '{ print $1 }')
|
||||||
|
echo " identified announce (${ANNOUNCE_IP})"
|
||||||
|
}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- define "vars.sh" }}
|
||||||
|
HOSTNAME="$(hostname)"
|
||||||
|
{{- if .Values.ro_replicas }}
|
||||||
|
RO_REPLICAS="{{ .Values.ro_replicas }}"
|
||||||
|
{{- end }}
|
||||||
|
INDEX="${HOSTNAME##*-}"
|
||||||
|
SENTINEL_PORT={{ .Values.sentinel.port }}
|
||||||
|
ANNOUNCE_IP=''
|
||||||
|
MASTER=''
|
||||||
|
MASTER_GROUP="{{ template "redis-ha.masterGroupName" . }}"
|
||||||
|
QUORUM="{{ .Values.sentinel.quorum }}"
|
||||||
|
REDIS_CONF=/data/conf/redis.conf
|
||||||
|
REDIS_PORT={{ .Values.redis.port }}
|
||||||
|
REDIS_TLS_PORT={{ .Values.redis.tlsPort }}
|
||||||
|
SENTINEL_CONF=/data/conf/sentinel.conf
|
||||||
|
SENTINEL_TLS_PORT={{ .Values.sentinel.tlsPort }}
|
||||||
|
SERVICE={{ template "redis-ha.fullname" . }}
|
||||||
|
SENTINEL_TLS_REPLICATION_ENABLED={{ default false .Values.sentinel.tlsReplication }}
|
||||||
|
REDIS_TLS_REPLICATION_ENABLED={{ default false .Values.redis.tlsReplication }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- define "config-init.sh" }}
|
||||||
|
echo "$(date) Start..."
|
||||||
|
{{- include "vars.sh" . }}
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
{{- include "lib.sh" . }}
|
||||||
|
|
||||||
|
mkdir -p /data/conf/
|
||||||
|
|
||||||
|
echo "Initializing config.."
|
||||||
|
copy_config
|
||||||
|
|
||||||
|
# where is redis master
|
||||||
|
identify_master
|
||||||
|
|
||||||
|
identify_announce_ip
|
||||||
|
|
||||||
|
if [ -z "${ANNOUNCE_IP}" ]; then
|
||||||
|
"Error: Could not resolve the announce ip for this pod."
|
||||||
|
exit 1
|
||||||
|
elif [ "${MASTER}" ]; then
|
||||||
|
find_master
|
||||||
|
else
|
||||||
|
setup_defaults
|
||||||
|
fi
|
||||||
|
|
||||||
|
{{- if .Values.ro_replicas }}
|
||||||
|
# works only if index is less than 10
|
||||||
|
echo "Verifying redis read-only replica.."
|
||||||
|
echo " we have RO_REPLICAS='${RO_REPLICAS}' with INDEX='${INDEX}'"
|
||||||
|
if echo "${RO_REPLICAS}" | grep -q "${INDEX}" ; then
|
||||||
|
redis_ro_update
|
||||||
|
fi
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
if [ "${AUTH:-}" ]; then
|
||||||
|
echo "Setting redis auth values.."
|
||||||
|
ESCAPED_AUTH=$(echo "${AUTH}" | sed -e 's/[\/&]/\\&/g');
|
||||||
|
sed -i "s/replace-default-auth/${ESCAPED_AUTH}/" "${REDIS_CONF}" "${SENTINEL_CONF}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${SENTINELAUTH:-}" ]; then
|
||||||
|
echo "Setting sentinel auth values"
|
||||||
|
ESCAPED_AUTH_SENTINEL=$(echo "$SENTINELAUTH" | sed -e 's/[\/&]/\\&/g');
|
||||||
|
sed -i "s/replace-default-sentinel-auth/${ESCAPED_AUTH_SENTINEL}/" "$SENTINEL_CONF"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$(date) Ready..."
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- define "trigger-failover-if-master.sh" }}
|
||||||
|
{{- if or (eq (int .Values.redis.port) 0) (eq (int .Values.sentinel.port) 0) }}
|
||||||
|
TLS_CLIENT_OPTION="--tls --cacert /tls-certs/{{ .Values.tls.caCertFile }} --cert /tls-certs/{{ .Values.tls.certFile }} --key /tls-certs/{{ .Values.tls.keyFile }}"
|
||||||
|
{{- end }}
|
||||||
|
get_redis_role() {
|
||||||
|
is_master=$(
|
||||||
|
redis-cli \
|
||||||
|
{{- if .Values.auth }}
|
||||||
|
-a "${AUTH}" --no-auth-warning \
|
||||||
|
{{- end }}
|
||||||
|
-h localhost \
|
||||||
|
{{- if (int .Values.redis.port) }}
|
||||||
|
-p {{ .Values.redis.port }} \
|
||||||
|
{{- else }}
|
||||||
|
-p {{ .Values.redis.tlsPort }} ${TLS_CLIENT_OPTION} \
|
||||||
|
{{- end}}
|
||||||
|
info | grep -c 'role:master' || true
|
||||||
|
)
|
||||||
|
}
|
||||||
|
get_redis_role
|
||||||
|
if [[ "$is_master" -eq 1 ]]; then
|
||||||
|
echo "This node is currently master, we trigger a failover."
|
||||||
|
{{- $masterGroupName := include "redis-ha.masterGroupName" . }}
|
||||||
|
response=$(
|
||||||
|
redis-cli \
|
||||||
|
{{- if .Values.sentinel.auth }}
|
||||||
|
-a "${SENTINELAUTH}" --no-auth-warning \
|
||||||
|
{{- end }}
|
||||||
|
-h localhost \
|
||||||
|
{{- if (int .Values.sentinel.port) }}
|
||||||
|
-p {{ .Values.sentinel.port }} \
|
||||||
|
{{- else }}
|
||||||
|
-p {{ .Values.sentinel.tlsPort }} ${TLS_CLIENT_OPTION} \
|
||||||
|
{{- end}}
|
||||||
|
SENTINEL failover {{ $masterGroupName }}
|
||||||
|
)
|
||||||
|
if [[ "$response" != "OK" ]] ; then
|
||||||
|
echo "$response"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
timeout=30
|
||||||
|
while [[ "$is_master" -eq 1 && $timeout -gt 0 ]]; do
|
||||||
|
sleep 1
|
||||||
|
get_redis_role
|
||||||
|
timeout=$((timeout - 1))
|
||||||
|
done
|
||||||
|
echo "Failover successful"
|
||||||
|
fi
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- define "fix-split-brain.sh" }}
|
||||||
|
{{- include "vars.sh" . }}
|
||||||
|
|
||||||
|
ROLE=''
|
||||||
|
REDIS_MASTER=''
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
{{- include "lib.sh" . }}
|
||||||
|
|
||||||
|
redis_role() {
|
||||||
|
set +e
|
||||||
|
if [ "$REDIS_PORT" -eq 0 ]; then
|
||||||
|
ROLE=$(redis-cli {{ if .Values.auth }} -a "${AUTH}" --no-auth-warning{{ end }} -p "${REDIS_TLS_PORT}" {{ if ne (default "yes" .Values.sentinel.authClients) "no"}} --tls --cacert /tls-certs/{{ .Values.tls.caCertFile }} --cert /tls-certs/{{ .Values.tls.certFile }} --key /tls-certs/{{ .Values.tls.keyFile }}{{ end }} info | grep role | sed 's/role://' | sed 's/\r//')
|
||||||
|
else
|
||||||
|
ROLE=$(redis-cli {{ if .Values.auth }} -a "${AUTH}" --no-auth-warning{{ end }} -p "${REDIS_PORT}" info | grep role | sed 's/role://' | sed 's/\r//')
|
||||||
|
fi
|
||||||
|
set -e
|
||||||
|
}
|
||||||
|
|
||||||
|
identify_redis_master() {
|
||||||
|
set +e
|
||||||
|
if [ "$REDIS_PORT" -eq 0 ]; then
|
||||||
|
REDIS_MASTER=$(redis-cli {{ if .Values.auth }} -a "${AUTH}" --no-auth-warning{{ end }} -p "${REDIS_TLS_PORT}" {{ if ne (default "yes" .Values.sentinel.authClients) "no"}} --tls --cacert /tls-certs/{{ .Values.tls.caCertFile }} --cert /tls-certs/{{ .Values.tls.certFile }} --key /tls-certs/{{ .Values.tls.keyFile }}{{ end }} info | grep master_host | sed 's/master_host://' | sed 's/\r//')
|
||||||
|
else
|
||||||
|
REDIS_MASTER=$(redis-cli {{ if .Values.auth }} -a "${AUTH}" --no-auth-warning{{ end }} -p "${REDIS_PORT}" info | grep master_host | sed 's/master_host://' | sed 's/\r//')
|
||||||
|
fi
|
||||||
|
set -e
|
||||||
|
}
|
||||||
|
|
||||||
|
reinit() {
|
||||||
|
set +e
|
||||||
|
sh /readonly-config/init.sh
|
||||||
|
|
||||||
|
if [ "$REDIS_PORT" -eq 0 ]; then
|
||||||
|
echo "shutdown" | redis-cli {{ if .Values.auth }} -a "${AUTH}" --no-auth-warning{{ end }} -p "${REDIS_TLS_PORT}" {{ if ne (default "yes" .Values.sentinel.authClients) "no"}} --tls --cacert /tls-certs/{{ .Values.tls.caCertFile }} --cert /tls-certs/{{ .Values.tls.certFile }} --key /tls-certs/{{ .Values.tls.keyFile }}{{ end }}
|
||||||
|
else
|
||||||
|
echo "shutdown" | redis-cli {{ if .Values.auth }} -a "${AUTH}" --no-auth-warning{{ end }} -p "${REDIS_PORT}"
|
||||||
|
fi
|
||||||
|
set -e
|
||||||
|
}
|
||||||
|
|
||||||
|
identify_announce_ip
|
||||||
|
|
||||||
|
while [ -z "${ANNOUNCE_IP}" ]; do
|
||||||
|
echo "Error: Could not resolve the announce ip for this pod."
|
||||||
|
sleep 30
|
||||||
|
identify_announce_ip
|
||||||
|
done
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
sleep {{ .Values.splitBrainDetection.interval }}
|
||||||
|
|
||||||
|
# where is redis master
|
||||||
|
identify_master
|
||||||
|
|
||||||
|
if [ "$MASTER" = "$ANNOUNCE_IP" ]; then
|
||||||
|
redis_role
|
||||||
|
if [ "$ROLE" != "master" ]; then
|
||||||
|
reinit
|
||||||
|
fi
|
||||||
|
elif [ "${MASTER}" ]; then
|
||||||
|
identify_redis_master
|
||||||
|
if [ "$REDIS_MASTER" != "$MASTER" ]; then
|
||||||
|
reinit
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- define "config-haproxy.cfg" }}
|
||||||
|
{{- if .Values.haproxy.customConfig }}
|
||||||
|
{{ tpl .Values.haproxy.customConfig . | indent 4 }}
|
||||||
|
{{- else }}
|
||||||
|
defaults REDIS
|
||||||
|
mode tcp
|
||||||
|
timeout connect {{ .Values.haproxy.timeout.connect }}
|
||||||
|
timeout server {{ .Values.haproxy.timeout.server }}
|
||||||
|
timeout client {{ .Values.haproxy.timeout.client }}
|
||||||
|
timeout check {{ .Values.haproxy.timeout.check }}
|
||||||
|
|
||||||
|
listen health_check_http_url
|
||||||
|
bind {{ if .Values.haproxy.IPv6.enabled }}[::]{{ end }}:8888 {{ if .Values.haproxy.IPv6.enabled }}v4v6{{ end }}
|
||||||
|
mode http
|
||||||
|
monitor-uri /healthz
|
||||||
|
option dontlognull
|
||||||
|
|
||||||
|
{{- $root := . }}
|
||||||
|
{{- $fullName := include "redis-ha.fullname" . }}
|
||||||
|
{{- $replicas := int (toString .Values.replicas) }}
|
||||||
|
{{- $masterGroupName := include "redis-ha.masterGroupName" . }}
|
||||||
|
{{- range $i := until $replicas }}
|
||||||
|
# Check Sentinel and whether they are nominated master
|
||||||
|
backend check_if_redis_is_master_{{ $i }}
|
||||||
|
mode tcp
|
||||||
|
option tcp-check
|
||||||
|
tcp-check connect
|
||||||
|
{{- if $root.Values.sentinel.auth }}
|
||||||
|
tcp-check send "AUTH ${SENTINELAUTH}"\r\n
|
||||||
|
tcp-check expect string +OK
|
||||||
|
{{- end }}
|
||||||
|
tcp-check send PING\r\n
|
||||||
|
tcp-check expect string +PONG
|
||||||
|
tcp-check send SENTINEL\ get-master-addr-by-name\ {{ $masterGroupName }}\r\n
|
||||||
|
tcp-check expect string REPLACE_ANNOUNCE{{ $i }}
|
||||||
|
tcp-check send QUIT\r\n
|
||||||
|
{{- range $i := until $replicas }}
|
||||||
|
server R{{ $i }} {{ $fullName }}-announce-{{ $i }}:26379 check inter {{ $root.Values.haproxy.checkInterval }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
# decide redis backend to use
|
||||||
|
#master
|
||||||
|
frontend ft_redis_master
|
||||||
|
{{- if .Values.haproxy.tls.enabled }}
|
||||||
|
bind {{ if .Values.haproxy.IPv6.enabled }}[::]{{ end }}:{{ $root.Values.haproxy.containerPort }} ssl crt {{ .Values.haproxy.tls.certMountPath }}{{ .Values.haproxy.tls.keyName }} {{ if .Values.haproxy.IPv6.enabled }}v4v6{{ end }}
|
||||||
|
{{ else }}
|
||||||
|
bind {{ if .Values.haproxy.IPv6.enabled }}[::]{{ end }}:{{ $root.Values.redis.port }} {{ if .Values.haproxy.IPv6.enabled }}v4v6{{ end }}
|
||||||
|
{{- end }}
|
||||||
|
use_backend bk_redis_master
|
||||||
|
{{- if .Values.haproxy.readOnly.enabled }}
|
||||||
|
#slave
|
||||||
|
frontend ft_redis_slave
|
||||||
|
bind {{ if .Values.haproxy.IPv6.enabled }}[::]{{ end }}:{{ .Values.haproxy.readOnly.port }} {{ if .Values.haproxy.IPv6.enabled }}v4v6{{ end }}
|
||||||
|
use_backend bk_redis_slave
|
||||||
|
{{- end }}
|
||||||
|
# Check all redis servers to see if they think they are master
|
||||||
|
backend bk_redis_master
|
||||||
|
{{- if .Values.haproxy.stickyBalancing }}
|
||||||
|
balance source
|
||||||
|
hash-type consistent
|
||||||
|
{{- end }}
|
||||||
|
mode tcp
|
||||||
|
option tcp-check
|
||||||
|
tcp-check connect
|
||||||
|
{{- if .Values.auth }}
|
||||||
|
tcp-check send "AUTH ${AUTH}"\r\n
|
||||||
|
tcp-check expect string +OK
|
||||||
|
{{- end }}
|
||||||
|
tcp-check send PING\r\n
|
||||||
|
tcp-check expect string +PONG
|
||||||
|
tcp-check send info\ replication\r\n
|
||||||
|
tcp-check expect string role:master
|
||||||
|
tcp-check send QUIT\r\n
|
||||||
|
tcp-check expect string +OK
|
||||||
|
{{- range $i := until $replicas }}
|
||||||
|
use-server R{{ $i }} if { srv_is_up(R{{ $i }}) } { nbsrv(check_if_redis_is_master_{{ $i }}) ge 2 }
|
||||||
|
server R{{ $i }} {{ $fullName }}-announce-{{ $i }}:{{ $root.Values.redis.port }} check inter {{ $root.Values.haproxy.checkInterval }} fall {{ $root.Values.haproxy.checkFall }} rise 1
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.haproxy.readOnly.enabled }}
|
||||||
|
backend bk_redis_slave
|
||||||
|
{{- if .Values.haproxy.stickyBalancing }}
|
||||||
|
balance source
|
||||||
|
hash-type consistent
|
||||||
|
{{- end }}
|
||||||
|
mode tcp
|
||||||
|
option tcp-check
|
||||||
|
tcp-check connect
|
||||||
|
{{- if .Values.auth }}
|
||||||
|
tcp-check send "AUTH ${AUTH}"\r\n
|
||||||
|
tcp-check expect string +OK
|
||||||
|
{{- end }}
|
||||||
|
tcp-check send PING\r\n
|
||||||
|
tcp-check expect string +PONG
|
||||||
|
tcp-check send info\ replication\r\n
|
||||||
|
tcp-check expect string role:slave
|
||||||
|
tcp-check send QUIT\r\n
|
||||||
|
tcp-check expect string +OK
|
||||||
|
{{- range $i := until $replicas }}
|
||||||
|
server R{{ $i }} {{ $fullName }}-announce-{{ $i }}:{{ $root.Values.redis.port }} check inter {{ $root.Values.haproxy.checkInterval }} fall {{ $root.Values.haproxy.checkFall }} rise 1
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.haproxy.metrics.enabled }}
|
||||||
|
frontend stats
|
||||||
|
mode http
|
||||||
|
bind {{ if .Values.haproxy.IPv6.enabled }}[::]{{ end }}:{{ .Values.haproxy.metrics.port }} {{ if .Values.haproxy.IPv6.enabled }}v4v6{{ end }}
|
||||||
|
http-request use-service prometheus-exporter if { path {{ .Values.haproxy.metrics.scrapePath }} }
|
||||||
|
stats enable
|
||||||
|
stats uri /stats
|
||||||
|
stats refresh 10s
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.haproxy.extraConfig }}
|
||||||
|
# Additional configuration
|
||||||
|
{{ .Values.haproxy.extraConfig | indent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
|
||||||
|
{{- define "config-haproxy_init.sh" }}
|
||||||
|
HAPROXY_CONF=/data/haproxy.cfg
|
||||||
|
cp /readonly/haproxy.cfg "$HAPROXY_CONF"
|
||||||
|
{{- $fullName := include "redis-ha.fullname" . }}
|
||||||
|
{{- $replicas := int (toString .Values.replicas) }}
|
||||||
|
{{- range $i := until $replicas }}
|
||||||
|
for loop in $(seq 1 10); do
|
||||||
|
getent hosts {{ $fullName }}-announce-{{ $i }} && break
|
||||||
|
echo "Waiting for service {{ $fullName }}-announce-{{ $i }} to be ready ($loop) ..." && sleep 1
|
||||||
|
done
|
||||||
|
ANNOUNCE_IP{{ $i }}=$(getent hosts "{{ $fullName }}-announce-{{ $i }}" | awk '{ print $1 }')
|
||||||
|
if [ -z "$ANNOUNCE_IP{{ $i }}" ]; then
|
||||||
|
echo "Could not resolve the announce ip for {{ $fullName }}-announce-{{ $i }}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
sed -i "s/REPLACE_ANNOUNCE{{ $i }}/$ANNOUNCE_IP{{ $i }}/" "$HAPROXY_CONF"
|
||||||
|
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- define "redis_liveness.sh" }}
|
||||||
|
{{- if not (ne (int .Values.sentinel.port) 0) }}
|
||||||
|
TLS_CLIENT_OPTION="--tls --cacert /tls-certs/{{ .Values.tls.caCertFile }} --cert /tls-certs/{{ .Values.tls.certFile }} --key /tls-certs/{{ .Values.tls.keyFile }}"
|
||||||
|
{{- end }}
|
||||||
|
response=$(
|
||||||
|
redis-cli \
|
||||||
|
{{- if .Values.auth }}
|
||||||
|
-a "${AUTH}" --no-auth-warning \
|
||||||
|
{{- end }}
|
||||||
|
-h localhost \
|
||||||
|
{{- if ne (int .Values.redis.port) 0 }}
|
||||||
|
-p {{ .Values.redis.port }} \
|
||||||
|
{{- else }}
|
||||||
|
-p {{ .Values.redis.tlsPort }} ${TLS_CLIENT_OPTION} \
|
||||||
|
{{- end}}
|
||||||
|
ping
|
||||||
|
)
|
||||||
|
if [ "$response" != "PONG" ] && [ "${response:0:7}" != "LOADING" ] ; then
|
||||||
|
echo "$response"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "response=$response"
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- define "redis_readiness.sh" }}
|
||||||
|
{{- if not (ne (int .Values.sentinel.port) 0) }}
|
||||||
|
TLS_CLIENT_OPTION="--tls --cacert /tls-certs/{{ .Values.tls.caCertFile }} --cert /tls-certs/{{ .Values.tls.certFile }} --key /tls-certs/{{ .Values.tls.keyFile }}"
|
||||||
|
{{- end }}
|
||||||
|
response=$(
|
||||||
|
redis-cli \
|
||||||
|
{{- if .Values.auth }}
|
||||||
|
-a "${AUTH}" --no-auth-warning \
|
||||||
|
{{- end }}
|
||||||
|
-h localhost \
|
||||||
|
{{- if ne (int .Values.redis.port) 0 }}
|
||||||
|
-p {{ .Values.redis.port }} \
|
||||||
|
{{- else }}
|
||||||
|
-p {{ .Values.redis.tlsPort }} ${TLS_CLIENT_OPTION} \
|
||||||
|
{{- end}}
|
||||||
|
ping
|
||||||
|
)
|
||||||
|
if [ "$response" != "PONG" ] ; then
|
||||||
|
echo "$response"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "response=$response"
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- define "sentinel_liveness.sh" }}
|
||||||
|
{{- if not (ne (int .Values.sentinel.port) 0) }}
|
||||||
|
TLS_CLIENT_OPTION="--tls --cacert /tls-certs/{{ .Values.tls.caCertFile }} --cert /tls-certs/{{ .Values.tls.certFile }} --key /tls-certs/{{ .Values.tls.keyFile }}"
|
||||||
|
{{- end }}
|
||||||
|
response=$(
|
||||||
|
redis-cli \
|
||||||
|
{{- if .Values.sentinel.auth }}
|
||||||
|
-a "${SENTINELAUTH}" --no-auth-warning \
|
||||||
|
{{- end }}
|
||||||
|
-h localhost \
|
||||||
|
{{- if ne (int .Values.sentinel.port) 0 }}
|
||||||
|
-p {{ .Values.sentinel.port }} \
|
||||||
|
{{- else }}
|
||||||
|
-p {{ .Values.sentinel.tlsPort }} ${TLS_CLIENT_OPTION} \
|
||||||
|
{{- end}}
|
||||||
|
ping
|
||||||
|
)
|
||||||
|
if [ "$response" != "PONG" ]; then
|
||||||
|
echo "$response"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "response=$response"
|
||||||
|
{{- end }}
|
||||||
|
|
|
@ -0,0 +1,94 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
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).
|
||||||
|
*/}}
|
||||||
|
{{- define "redis-ha.name" -}}
|
||||||
|
{{- default .Chart.Name .Values.nameOverride | 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).
|
||||||
|
*/}}
|
||||||
|
{{- define "redis-ha.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 -}}
|
||||||
|
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return sysctl image
|
||||||
|
*/}}
|
||||||
|
{{- define "redis.sysctl.image" -}}
|
||||||
|
{{- $registryName := default "docker.io" .Values.sysctlImage.registry -}}
|
||||||
|
{{- $tag := default "latest" .Values.sysctlImage.tag | toString -}}
|
||||||
|
{{- printf "%s/%s:%s" $registryName .Values.sysctlImage.repository $tag -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- /*
|
||||||
|
Credit: @technosophos
|
||||||
|
https://github.com/technosophos/common-chart/
|
||||||
|
labels.standard prints the standard Helm labels.
|
||||||
|
The standard labels are frequently used in metadata.
|
||||||
|
*/ -}}
|
||||||
|
{{- define "labels.standard" -}}
|
||||||
|
app: {{ template "redis-ha.name" . }}
|
||||||
|
heritage: {{ .Release.Service | quote }}
|
||||||
|
release: {{ .Release.Name | quote }}
|
||||||
|
chart: {{ template "chartref" . }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- /*
|
||||||
|
Credit: @technosophos
|
||||||
|
https://github.com/technosophos/common-chart/
|
||||||
|
chartref prints a chart name and version.
|
||||||
|
It does minimal escaping for use in Kubernetes labels.
|
||||||
|
Example output:
|
||||||
|
zookeeper-1.2.3
|
||||||
|
wordpress-3.2.1_20170219
|
||||||
|
*/ -}}
|
||||||
|
{{- define "chartref" -}}
|
||||||
|
{{- replace "+" "_" .Chart.Version | printf "%s-%s" .Chart.Name -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create the name of the service account to use
|
||||||
|
*/}}
|
||||||
|
{{- define "redis-ha.serviceAccountName" -}}
|
||||||
|
{{- if .Values.serviceAccount.create -}}
|
||||||
|
{{ default (include "redis-ha.fullname" .) .Values.serviceAccount.name }}
|
||||||
|
{{- else -}}
|
||||||
|
{{ default "default" .Values.serviceAccount.name }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "redis-ha.masterGroupName" -}}
|
||||||
|
{{- $masterGroupName := tpl ( .Values.redis.masterGroupName | default "") . -}}
|
||||||
|
{{- $validMasterGroupName := regexMatch "^[\\w-\\.]+$" $masterGroupName -}}
|
||||||
|
{{- if $validMasterGroupName -}}
|
||||||
|
{{ $masterGroupName }}
|
||||||
|
{{- else -}}
|
||||||
|
{{ required "A valid .Values.redis.masterGroupName entry is required (matching ^[\\w-\\.]+$)" ""}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the appropriate apiVersion for poddisruptionbudget.
|
||||||
|
*/}}
|
||||||
|
{{- define "redis-ha.podDisruptionBudget.apiVersion" -}}
|
||||||
|
{{- if .Capabilities.APIVersions.Has "policy/v1" }}
|
||||||
|
{{- print "policy/v1" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- print "policy/v1beta1" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
|
@ -0,0 +1,15 @@
|
||||||
|
{{- if and .Values.auth (not .Values.existingSecret) -}}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: {{ template "redis-ha.fullname" . }}
|
||||||
|
namespace: {{ .Release.Namespace | quote }}
|
||||||
|
labels:
|
||||||
|
{{ include "labels.standard" . | indent 4 }}
|
||||||
|
{{- range $key, $value := .Values.extraLabels }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
type: Opaque
|
||||||
|
data:
|
||||||
|
{{ .Values.authKey }}: {{ .Values.redisPassword | b64enc | quote }}
|
||||||
|
{{- end -}}
|
|
@ -0,0 +1,60 @@
|
||||||
|
{{- $fullName := include "redis-ha.fullname" . }}
|
||||||
|
{{- $namespace := .Release.Namespace -}}
|
||||||
|
{{- $replicas := int (toString .Values.replicas) }}
|
||||||
|
{{- $root := . }}
|
||||||
|
{{- range $i := until $replicas }}
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ $fullName }}-announce-{{ $i }}
|
||||||
|
namespace: {{ $namespace | quote}}
|
||||||
|
labels:
|
||||||
|
{{ include "labels.standard" $root | indent 4 }}
|
||||||
|
{{- range $key, $value := $root.Values.extraLabels }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
annotations:
|
||||||
|
service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
|
||||||
|
{{- if $root.Values.serviceAnnotations }}
|
||||||
|
{{ toYaml $root.Values.serviceAnnotations | indent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
publishNotReadyAddresses: true
|
||||||
|
type: ClusterIP
|
||||||
|
ports:
|
||||||
|
{{- if ne (int $root.Values.redis.port) 0 }}
|
||||||
|
- name: tcp-server
|
||||||
|
port: {{ $root.Values.redis.port }}
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: redis
|
||||||
|
{{- end }}
|
||||||
|
{{- if $root.Values.redis.tlsPort }}
|
||||||
|
- name: server-tls
|
||||||
|
port: {{ $root.Values.redis.tlsPort }}
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: redis-tls
|
||||||
|
{{- end }}
|
||||||
|
{{- if ne (int $root.Values.sentinel.port) 0 }}
|
||||||
|
- name: tcp-sentinel
|
||||||
|
port: {{ $root.Values.sentinel.port }}
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: sentinel
|
||||||
|
{{- end }}
|
||||||
|
{{- if $root.Values.sentinel.tlsPort }}
|
||||||
|
- name: sentinel-tls
|
||||||
|
port: {{ $root.Values.sentinel.tlsPort }}
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: sentinel-tls
|
||||||
|
{{- end }}
|
||||||
|
{{- if $root.Values.exporter.enabled }}
|
||||||
|
- name: http-exporter
|
||||||
|
port: {{ $root.Values.exporter.port }}
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: {{ $root.Values.exporter.portName }}
|
||||||
|
{{- end }}
|
||||||
|
selector:
|
||||||
|
release: {{ $root.Release.Name }}
|
||||||
|
app: {{ include "redis-ha.name" $root }}
|
||||||
|
"statefulset.kubernetes.io/pod-name": {{ $fullName }}-server-{{ $i }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,37 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: {{ template "redis-ha.fullname" . }}-configmap
|
||||||
|
namespace: {{ .Release.Namespace | quote }}
|
||||||
|
labels:
|
||||||
|
heritage: {{ .Release.Service }}
|
||||||
|
release: {{ .Release.Name }}
|
||||||
|
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||||
|
app: {{ template "redis-ha.fullname" . }}
|
||||||
|
{{- range $key, $value := .Values.configmap.labels }}
|
||||||
|
{{ $key }}: {{ $value | toString }}
|
||||||
|
{{- end }}
|
||||||
|
{{- range $key, $value := .Values.extraLabels }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
data:
|
||||||
|
redis.conf: |
|
||||||
|
{{- include "config-redis.conf" . }}
|
||||||
|
|
||||||
|
sentinel.conf: |
|
||||||
|
{{- include "config-sentinel.conf" . }}
|
||||||
|
|
||||||
|
init.sh: |
|
||||||
|
{{- include "config-init.sh" . }}
|
||||||
|
|
||||||
|
fix-split-brain.sh: |
|
||||||
|
{{- include "fix-split-brain.sh" . }}
|
||||||
|
|
||||||
|
{{ if .Values.haproxy.enabled }}
|
||||||
|
haproxy.cfg: |
|
||||||
|
{{- include "config-haproxy.cfg" . }}
|
||||||
|
{{- end }}
|
||||||
|
haproxy_init.sh: |
|
||||||
|
{{- include "config-haproxy_init.sh" . }}
|
||||||
|
trigger-failover-if-master.sh: |
|
||||||
|
{{- include "trigger-failover-if-master.sh" . }}
|
|
@ -0,0 +1,14 @@
|
||||||
|
{{- if .Values.exporter.script }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: {{ template "redis-ha.fullname" . }}-exporter-script-configmap
|
||||||
|
namespace: {{ .Release.Namespace | quote }}
|
||||||
|
labels:
|
||||||
|
{{ include "labels.standard" . | indent 4 }}
|
||||||
|
{{- range $key, $value := .Values.extraLabels }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
data:
|
||||||
|
script: {{ toYaml .Values.exporter.script | indent 2 }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,20 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: {{ template "redis-ha.fullname" . }}-health-configmap
|
||||||
|
namespace: {{ .Release.Namespace | quote }}
|
||||||
|
labels:
|
||||||
|
heritage: {{ .Release.Service }}
|
||||||
|
release: {{ .Release.Name }}
|
||||||
|
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||||
|
app: {{ template "redis-ha.fullname" . }}
|
||||||
|
{{- range $key, $value := .Values.extraLabels }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
data:
|
||||||
|
redis_liveness.sh: |
|
||||||
|
{{- include "redis_liveness.sh" . }}
|
||||||
|
redis_readiness.sh: |
|
||||||
|
{{- include "redis_readiness.sh" . }}
|
||||||
|
sentinel_liveness.sh: |
|
||||||
|
{{- include "sentinel_liveness.sh" . }}
|
|
@ -0,0 +1,87 @@
|
||||||
|
{{- if .Values.networkPolicy.enabled }}
|
||||||
|
{{- $root := . }}
|
||||||
|
kind: NetworkPolicy
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
metadata:
|
||||||
|
name: {{ template "redis-ha.fullname" . }}-network-policy
|
||||||
|
namespace: {{ .Release.Namespace | quote }}
|
||||||
|
{{- if .Values.networkPolicy.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- range $key, $value := .Values.networkPolicy.annotations }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
labels:
|
||||||
|
{{ include "labels.standard" . | indent 4 }}
|
||||||
|
{{- range $key, $value := .Values.networkPolicy.labels }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
release: {{ .Release.Name }}
|
||||||
|
app: {{ template "redis-ha.name" . }}
|
||||||
|
policyTypes:
|
||||||
|
- Ingress
|
||||||
|
- Egress
|
||||||
|
egress:
|
||||||
|
- to:
|
||||||
|
- podSelector:
|
||||||
|
matchLabels:
|
||||||
|
release: {{ .Release.Name }}
|
||||||
|
app: {{ template "redis-ha.name" . }}
|
||||||
|
ports:
|
||||||
|
- port: {{ .Values.redis.port }}
|
||||||
|
protocol: TCP
|
||||||
|
- port: {{ .Values.sentinel.port }}
|
||||||
|
protocol: TCP
|
||||||
|
- to:
|
||||||
|
- namespaceSelector: {}
|
||||||
|
ports:
|
||||||
|
- port: 53
|
||||||
|
protocol: UDP
|
||||||
|
- port: 53
|
||||||
|
protocol: TCP
|
||||||
|
{{- range $rule := .Values.networkPolicy.egressRules }}
|
||||||
|
- to:
|
||||||
|
{{ (tpl (toYaml $rule.selectors) $) | indent 7 }}
|
||||||
|
ports:
|
||||||
|
{{ toYaml $rule.ports | indent 7 }}
|
||||||
|
{{- end }}
|
||||||
|
ingress:
|
||||||
|
- from:
|
||||||
|
- podSelector:
|
||||||
|
matchLabels:
|
||||||
|
release: {{ .Release.Name }}
|
||||||
|
app: {{ template "redis-ha.name" . }}
|
||||||
|
ports:
|
||||||
|
- port: {{ .Values.redis.port }}
|
||||||
|
protocol: TCP
|
||||||
|
- port: {{ .Values.sentinel.port }}
|
||||||
|
protocol: TCP
|
||||||
|
{{- if .Values.haproxy.enabled }}
|
||||||
|
- from:
|
||||||
|
- podSelector:
|
||||||
|
matchLabels:
|
||||||
|
release: {{ .Release.Name }}
|
||||||
|
app: {{ template "redis-ha.name" . }}-haproxy
|
||||||
|
ports:
|
||||||
|
- port: {{ .Values.redis.port }}
|
||||||
|
protocol: TCP
|
||||||
|
- port: {{ .Values.sentinel.port }}
|
||||||
|
protocol: TCP
|
||||||
|
{{- end }}
|
||||||
|
{{- range $rule := .Values.networkPolicy.ingressRules }}
|
||||||
|
- from:
|
||||||
|
{{ (tpl (toYaml $rule.selectors) $) | indent 7 }}
|
||||||
|
ports:
|
||||||
|
{{- if $rule.ports }}
|
||||||
|
{{ toYaml $rule.ports | indent 7 }}
|
||||||
|
{{- else }}
|
||||||
|
- port: {{ $root.Values.redis.port }}
|
||||||
|
protocol: TCP
|
||||||
|
- port: {{ $root.Values.sentinel.port }}
|
||||||
|
protocol: TCP
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,21 @@
|
||||||
|
{{- if .Values.podDisruptionBudget -}}
|
||||||
|
apiVersion: {{ template "redis-ha.podDisruptionBudget.apiVersion" . }}
|
||||||
|
kind: PodDisruptionBudget
|
||||||
|
metadata:
|
||||||
|
name: {{ template "redis-ha.fullname" . }}-pdb
|
||||||
|
namespace: {{ .Release.Namespace | quote }}
|
||||||
|
labels:
|
||||||
|
{{ include "labels.standard" . | indent 4 }}
|
||||||
|
{{- range $key, $value := .Values.extraLabels }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
# The replica label is set on StatefulSet pods but not the Test pods
|
||||||
|
# We want to avoid including the Test pods in the budget
|
||||||
|
{{ template "redis-ha.fullname" . }}: replica
|
||||||
|
release: {{ .Release.Name }}
|
||||||
|
app: {{ template "redis-ha.name" . }}
|
||||||
|
{{ toYaml .Values.podDisruptionBudget | indent 2 }}
|
||||||
|
{{- end -}}
|
|
@ -0,0 +1,17 @@
|
||||||
|
{{- if .Values.prometheusRule.enabled }}
|
||||||
|
apiVersion: monitoring.coreos.com/v1
|
||||||
|
kind: PrometheusRule
|
||||||
|
metadata:
|
||||||
|
name: {{ template "redis-ha.fullname" . }}
|
||||||
|
{{- if .Values.prometheusRule.namespace }}
|
||||||
|
namespace: {{ .Values.prometheusRule.namespace }}
|
||||||
|
{{- end }}
|
||||||
|
labels: {{- toYaml .Values.prometheusRule.additionalLabels | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
groups:
|
||||||
|
- name: {{ template "redis-ha.fullname" . }}
|
||||||
|
{{- if .Values.prometheusRule.interval }}
|
||||||
|
interval: {{ .Values.prometheusRule.interval }}
|
||||||
|
{{- end }}
|
||||||
|
rules: {{- tpl (toYaml .Values.prometheusRule.rules) . | nindent 8 }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,19 @@
|
||||||
|
{{- if and .Values.serviceAccount.create .Values.rbac.create }}
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: Role
|
||||||
|
metadata:
|
||||||
|
name: {{ template "redis-ha.fullname" . }}
|
||||||
|
namespace: {{ .Release.Namespace | quote }}
|
||||||
|
labels:
|
||||||
|
{{ include "labels.standard" . | indent 4 }}
|
||||||
|
{{- range $key, $value := .Values.extraLabels }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
rules:
|
||||||
|
- apiGroups:
|
||||||
|
- ""
|
||||||
|
resources:
|
||||||
|
- endpoints
|
||||||
|
verbs:
|
||||||
|
- get
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,19 @@
|
||||||
|
{{- if and .Values.serviceAccount.create .Values.rbac.create }}
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: RoleBinding
|
||||||
|
metadata:
|
||||||
|
name: {{ template "redis-ha.fullname" . }}
|
||||||
|
namespace: {{ .Release.Namespace | quote }}
|
||||||
|
labels:
|
||||||
|
{{ include "labels.standard" . | indent 4 }}
|
||||||
|
{{- range $key, $value := .Values.extraLabels }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: {{ template "redis-ha.serviceAccountName" . }}
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: Role
|
||||||
|
name: {{ template "redis-ha.fullname" . }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,32 @@
|
||||||
|
{{- if not .Values.restore.existingSecret }}
|
||||||
|
|
||||||
|
|
||||||
|
{{- $regexRestoreS3 := "^s3://.+|^S3://.+" -}}
|
||||||
|
{{- $regexRestoreSSH := "^.+@.+:.+" -}}
|
||||||
|
|
||||||
|
{{- if or (regexFind $regexRestoreSSH (toString .Values.restore.ssh.source)) (regexFind $regexRestoreS3 (toString .Values.restore.s3.source)) }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: {{ include "redis-ha.fullname" . }}-secret
|
||||||
|
namespace: {{ .Release.Namespace | quote }}
|
||||||
|
labels:
|
||||||
|
heritage: {{ .Release.Service }}
|
||||||
|
release: {{ .Release.Name }}
|
||||||
|
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||||
|
app: {{ template "redis-ha.fullname" . }}
|
||||||
|
{{- range $key, $value := .Values.extraLabels }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
type: Opaque
|
||||||
|
data:
|
||||||
|
{{- if regexFind $regexRestoreSSH (toString .Values.restore.ssh.source) }}
|
||||||
|
SSH_KEY: "{{ .Values.restore.ssh.key | b64enc }}"
|
||||||
|
{{- end }}
|
||||||
|
{{- if regexFind $regexRestoreS3 (toString .Values.restore.s3.source) }}
|
||||||
|
AWS_SECRET_ACCESS_KEY: "{{ .Values.restore.s3.secret_key | b64enc }}"
|
||||||
|
AWS_ACCESS_KEY_ID: "{{ .Values.restore.s3.access_key | b64enc }}"
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,57 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ template "redis-ha.fullname" . }}
|
||||||
|
namespace: {{ .Release.Namespace | quote }}
|
||||||
|
labels:
|
||||||
|
{{ include "labels.standard" . | indent 4 }}
|
||||||
|
{{- if .Values.exporter.enabled }}
|
||||||
|
exporter: enabled
|
||||||
|
{{- end }}
|
||||||
|
{{- range $key, $value := .Values.extraLabels }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- range $key, $value := .Values.serviceLabels }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
annotations:
|
||||||
|
{{- if .Values.serviceAnnotations }}
|
||||||
|
{{ toYaml .Values.serviceAnnotations | indent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
type: ClusterIP
|
||||||
|
clusterIP: None
|
||||||
|
ports:
|
||||||
|
{{- if ne (int .Values.redis.port) 0 }}
|
||||||
|
- name: tcp-server
|
||||||
|
port: {{ .Values.redis.port }}
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: redis
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.redis.tlsPort }}
|
||||||
|
- name: server-tls
|
||||||
|
port: {{ .Values.redis.tlsPort }}
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: redis-tls
|
||||||
|
{{- end }}
|
||||||
|
{{- if ne (int .Values.sentinel.port) 0 }}
|
||||||
|
- name: tcp-sentinel
|
||||||
|
port: {{ .Values.sentinel.port }}
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: sentinel
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.sentinel.tlsPort }}
|
||||||
|
- name: sentinel-tls
|
||||||
|
port: {{ .Values.sentinel.tlsPort }}
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: sentinel-tls
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.exporter.enabled }}
|
||||||
|
- name: http-exporter-port
|
||||||
|
port: {{ .Values.exporter.port }}
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: {{ .Values.exporter.portName }}
|
||||||
|
{{- end }}
|
||||||
|
selector:
|
||||||
|
release: {{ .Release.Name }}
|
||||||
|
app: {{ template "redis-ha.name" . }}
|
|
@ -0,0 +1,27 @@
|
||||||
|
{{- if .Values.serviceAccount.create }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
metadata:
|
||||||
|
name: {{ template "redis-ha.serviceAccountName" . }}
|
||||||
|
namespace: {{ .Release.Namespace | quote }}
|
||||||
|
labels:
|
||||||
|
heritage: {{ .Release.Service }}
|
||||||
|
release: {{ .Release.Name }}
|
||||||
|
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||||
|
app: {{ template "redis-ha.fullname" . }}
|
||||||
|
{{- range $key, $value := .Values.extraLabels }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if or .Values.auth .Values.sentinel.auth }}
|
||||||
|
secrets:
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.auth }}
|
||||||
|
- name: {{ default (include "redis-ha.fullname" .) .Values.existingSecret }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.sentinel.auth }}
|
||||||
|
- name: {{ default (printf "%s-sentinel" (include "redis-ha.fullname" .)) .Values.sentinel.existingSecret }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.imagePullSecrets }}
|
||||||
|
imagePullSecrets: {{ toYaml .Values.imagePullSecrets | nindent 0 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,36 @@
|
||||||
|
{{- if and ( .Capabilities.APIVersions.Has "monitoring.coreos.com/v1" ) ( .Values.exporter.serviceMonitor.enabled ) ( .Values.exporter.enabled ) }}
|
||||||
|
apiVersion: monitoring.coreos.com/v1
|
||||||
|
kind: ServiceMonitor
|
||||||
|
metadata:
|
||||||
|
name: {{ template "redis-ha.fullname" . }}
|
||||||
|
namespace: {{ .Values.exporter.serviceMonitor.namespace | default .Release.Namespace | quote }}
|
||||||
|
labels:
|
||||||
|
{{ include "labels.standard" . | indent 4 }}
|
||||||
|
{{- range $key, $value := .Values.extraLabels }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- range $key, $value := .Values.exporter.serviceMonitor.labels }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
endpoints:
|
||||||
|
- targetPort: {{ .Values.exporter.port }}
|
||||||
|
{{- if .Values.exporter.serviceMonitor.interval }}
|
||||||
|
interval: {{ .Values.exporter.serviceMonitor.interval }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.exporter.serviceMonitor.telemetryPath }}
|
||||||
|
path: {{ .Values.exporter.serviceMonitor.telemetryPath }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.exporter.serviceMonitor.timeout }}
|
||||||
|
scrapeTimeout: {{ .Values.exporter.serviceMonitor.timeout }}
|
||||||
|
{{- end }}
|
||||||
|
jobLabel: {{ template "redis-ha.fullname" . }}
|
||||||
|
namespaceSelector:
|
||||||
|
matchNames:
|
||||||
|
- {{ .Release.Namespace | quote }}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: {{ template "redis-ha.name" . }}
|
||||||
|
release: {{ .Release.Name }}
|
||||||
|
exporter: enabled
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,589 @@
|
||||||
|
{{- $regexRestoreS3 := "^s3://.+|^S3://.+" -}}
|
||||||
|
{{- $regexRestoreSSH := "^.+@.+:.+" -}}
|
||||||
|
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: StatefulSet
|
||||||
|
metadata:
|
||||||
|
name: {{ template "redis-ha.fullname" . }}-server
|
||||||
|
namespace: {{ .Release.Namespace | quote }}
|
||||||
|
labels:
|
||||||
|
{{ template "redis-ha.fullname" . }}: replica
|
||||||
|
{{- range $key, $value := .Values.extraLabels }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{ include "labels.standard" . | indent 4 }}
|
||||||
|
annotations:
|
||||||
|
{{ toYaml .Values.redis.annotations | indent 4 }}
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
release: {{ .Release.Name }}
|
||||||
|
app: {{ template "redis-ha.name" . }}
|
||||||
|
serviceName: {{ template "redis-ha.fullname" . }}
|
||||||
|
replicas: {{ .Values.replicas }}
|
||||||
|
podManagementPolicy: {{ .Values.podManagementPolicy }}
|
||||||
|
updateStrategy:
|
||||||
|
type: {{ .Values.redis.updateStrategy.type }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
checksum/init-config: {{ print (include "config-redis.conf" .) (include "config-sentinel.conf" .) (include "config-init.sh" .) (include "fix-split-brain.sh" .) (include "redis_liveness.sh" .) (include "redis_readiness.sh" .) (include "sentinel_liveness.sh" .) (include "trigger-failover-if-master.sh" .)| sha256sum }}
|
||||||
|
{{- if .Values.podAnnotations }}
|
||||||
|
{{ toYaml .Values.podAnnotations | indent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if and (.Values.exporter.enabled) (not .Values.exporter.serviceMonitor.enabled) }}
|
||||||
|
prometheus.io/port: "{{ .Values.exporter.port }}"
|
||||||
|
prometheus.io/scrape: "true"
|
||||||
|
prometheus.io/path: {{ .Values.exporter.scrapePath }}
|
||||||
|
{{- end }}
|
||||||
|
labels:
|
||||||
|
release: {{ .Release.Name }}
|
||||||
|
app: {{ template "redis-ha.name" . }}
|
||||||
|
{{ template "redis-ha.fullname" . }}: replica
|
||||||
|
{{- range $key, $value := .Values.labels }}
|
||||||
|
{{ $key }}: {{ $value | toString }}
|
||||||
|
{{- end }}
|
||||||
|
{{- range $key, $value := .Values.extraLabels }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
{{- if .Values.redis.terminationGracePeriodSeconds }}
|
||||||
|
terminationGracePeriodSeconds: {{ .Values.redis.terminationGracePeriodSeconds }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.schedulerName }}
|
||||||
|
schedulerName: "{{ .Values.schedulerName }}"
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.nodeSelector }}
|
||||||
|
nodeSelector:
|
||||||
|
{{ toYaml .Values.nodeSelector | indent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.tolerations }}
|
||||||
|
tolerations:
|
||||||
|
{{ toYaml .Values.tolerations | indent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
affinity:
|
||||||
|
{{- if .Values.affinity }}
|
||||||
|
{{- with .Values.affinity }}
|
||||||
|
{{ tpl . $ | indent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- else }}
|
||||||
|
{{- if .Values.additionalAffinities }}
|
||||||
|
{{ toYaml .Values.additionalAffinities | indent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
podAntiAffinity:
|
||||||
|
{{- if .Values.hardAntiAffinity }}
|
||||||
|
requiredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
- labelSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: {{ template "redis-ha.name" . }}
|
||||||
|
release: {{ .Release.Name }}
|
||||||
|
{{ template "redis-ha.fullname" . }}: replica
|
||||||
|
topologyKey: kubernetes.io/hostname
|
||||||
|
{{- else }}
|
||||||
|
preferredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
- weight: 100
|
||||||
|
podAffinityTerm:
|
||||||
|
labelSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: {{ template "redis-ha.name" . }}
|
||||||
|
release: {{ .Release.Name }}
|
||||||
|
{{ template "redis-ha.fullname" . }}: replica
|
||||||
|
topologyKey: kubernetes.io/hostname
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.topologySpreadConstraints.enabled }}
|
||||||
|
topologySpreadConstraints:
|
||||||
|
- maxSkew: {{ .Values.topologySpreadConstraints.maxSkew | default 1 }}
|
||||||
|
topologyKey: {{ .Values.topologySpreadConstraints.topologyKey | default "topology.kubernetes.io/zone" }}
|
||||||
|
whenUnsatisfiable: {{ .Values.topologySpreadConstraints.whenUnsatisfiable | default "ScheduleAnyway" }}
|
||||||
|
labelSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: {{ template "redis-ha.name" . }}
|
||||||
|
release: {{ .Release.Name }}
|
||||||
|
{{ template "redis-ha.fullname" . }}: replica
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.imagePullSecrets }}
|
||||||
|
imagePullSecrets: {{ toYaml .Values.imagePullSecrets | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
securityContext: {{ toYaml .Values.securityContext | nindent 8 }}
|
||||||
|
serviceAccountName: {{ template "redis-ha.serviceAccountName" . }}
|
||||||
|
automountServiceAccountToken: {{ .Values.serviceAccount.automountToken }}
|
||||||
|
initContainers:
|
||||||
|
{{- if .Values.sysctlImage.enabled }}
|
||||||
|
- name: init-sysctl
|
||||||
|
image: {{ template "redis.sysctl.image" . }}
|
||||||
|
imagePullPolicy: {{ .Values.sysctlImage.pullPolicy }}
|
||||||
|
resources: {{ toYaml .Values.sysctlImage.resources | nindent 10 }}
|
||||||
|
{{- if .Values.sysctlImage.mountHostSys }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: host-sys
|
||||||
|
mountPath: /host-sys
|
||||||
|
{{- end }}
|
||||||
|
command: {{ toYaml .Values.sysctlImage.command | nindent 10 }}
|
||||||
|
securityContext: {{ toYaml .Values.containerSecurityContext | nindent 10 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if and .Values.hostPath.path .Values.hostPath.chown }}
|
||||||
|
- name: hostpath-chown
|
||||||
|
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
|
||||||
|
securityContext: {{ toYaml .Values.containerSecurityContext | nindent 10 }}
|
||||||
|
command:
|
||||||
|
- chown
|
||||||
|
- "{{ .Values.containerSecurityContext.runAsUser }}"
|
||||||
|
- /data
|
||||||
|
volumeMounts:
|
||||||
|
- name: data
|
||||||
|
mountPath: /data
|
||||||
|
{{- end }}
|
||||||
|
- name: config-init
|
||||||
|
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
|
||||||
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||||
|
resources:
|
||||||
|
{{ toYaml .Values.init.resources | indent 10 }}
|
||||||
|
command:
|
||||||
|
- sh
|
||||||
|
args:
|
||||||
|
- /readonly-config/init.sh
|
||||||
|
securityContext: {{ toYaml .Values.containerSecurityContext | nindent 10 }}
|
||||||
|
env:
|
||||||
|
{{- $replicas := int (toString .Values.replicas) -}}
|
||||||
|
{{- range $i := until $replicas }}
|
||||||
|
- name: SENTINEL_ID_{{ $i }}
|
||||||
|
value: {{ printf "%s\n%s\nindex: %d" (include "redis-ha.name" $) ($.Release.Name) $i | sha256sum | trunc 40 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.auth }}
|
||||||
|
- name: AUTH
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
{{- if .Values.existingSecret }}
|
||||||
|
name: {{ .Values.existingSecret }}
|
||||||
|
{{- else }}
|
||||||
|
name: {{ template "redis-ha.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
key: {{ .Values.authKey }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.sentinel.auth }}
|
||||||
|
- name: SENTINELAUTH
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
{{- if .Values.sentinel.existingSecret }}
|
||||||
|
name: {{ .Values.sentinel.existingSecret }}
|
||||||
|
{{- else }}
|
||||||
|
name: {{ template "redis-ha.fullname" . }}-sentinel
|
||||||
|
{{- end }}
|
||||||
|
key: {{ .Values.sentinel.authKey }}
|
||||||
|
{{- end }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: config
|
||||||
|
mountPath: /readonly-config
|
||||||
|
readOnly: true
|
||||||
|
- name: data
|
||||||
|
mountPath: /data
|
||||||
|
{{- if .Values.redis.tlsPort }}
|
||||||
|
- mountPath: /tls-certs
|
||||||
|
name: tls-certs
|
||||||
|
{{- end}}
|
||||||
|
{{ if regexFind $regexRestoreS3 (toString .Values.restore.s3.source) }}
|
||||||
|
- name: restore-s3
|
||||||
|
image: s3cmd/s3cmd:latest
|
||||||
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||||
|
resources:
|
||||||
|
{{ toYaml .Values.init.resources | indent 10 }}
|
||||||
|
command:
|
||||||
|
- sh
|
||||||
|
args:
|
||||||
|
- "-c"
|
||||||
|
- "timeout -t {{ .Values.restore.timeout }} \
|
||||||
|
s3cmd get {{ if .Values.restore.s3.region }}--region {{ .Values.restore.s3.region }} {{ end }}--force '{{ .Values.restore.s3.source }}' /data/dump.rdb_ \
|
||||||
|
&& test -s /data/dump.rdb_ \
|
||||||
|
&& if test -s /data/dump.rdb; \
|
||||||
|
then cp -v /data/dump.rdb /data/dump.rdb_orig; fi \
|
||||||
|
&& mv -v /data/dump.rdb_ /data/dump.rdb"
|
||||||
|
envFrom:
|
||||||
|
- secretRef:
|
||||||
|
{{- if .Values.restore.existingSecret }}
|
||||||
|
name: {{ .Values.existingSecret }}
|
||||||
|
{{- else }}
|
||||||
|
name: {{ include "redis-ha.fullname" . }}-secret
|
||||||
|
{{- end }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: data
|
||||||
|
mountPath: /data
|
||||||
|
{{- end }}
|
||||||
|
{{ if regexFind $regexRestoreSSH (toString .Values.restore.ssh.source) }}
|
||||||
|
- name: restore-ssh
|
||||||
|
image: lgatica/openssh-client:latest
|
||||||
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||||
|
resources:
|
||||||
|
{{ toYaml .Values.init.resources | indent 10 }}
|
||||||
|
command:
|
||||||
|
- sh
|
||||||
|
args:
|
||||||
|
- "-c"
|
||||||
|
- "rm -f key && echo -e \"${SSH_KEY}\" >key \
|
||||||
|
&& chmod 400 key \
|
||||||
|
&& timeout {{ .Values.restore.timeout }} \
|
||||||
|
scp -i key \
|
||||||
|
-o StrictHostKeyChecking=no \
|
||||||
|
-o UserKnownHostsFile=/dev/null \
|
||||||
|
'{{ .Values.restore.ssh.source }}' \
|
||||||
|
/data/dump.rdb_ \
|
||||||
|
&& test -s /data/dump.rdb_ \
|
||||||
|
&& if test -s /data/dump.rdb; \
|
||||||
|
then cp -v /data/dump.rdb /data/dump.rdb_orig; fi \
|
||||||
|
&& mv -v /data/dump.rdb_ /data/dump.rdb"
|
||||||
|
securityContext: {{ toYaml .Values.containerSecurityContext | nindent 10 }}
|
||||||
|
envFrom:
|
||||||
|
- secretRef:
|
||||||
|
{{- if .Values.restore.existingSecret }}
|
||||||
|
name: {{ .Values.existingSecret }}
|
||||||
|
{{- else }}
|
||||||
|
name: {{ include "redis-ha.fullname" . }}-secret
|
||||||
|
{{- end }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: data
|
||||||
|
mountPath: /data
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.extraInitContainers }}
|
||||||
|
{{- toYaml .Values.extraInitContainers | nindent 6 }}
|
||||||
|
{{- end }}
|
||||||
|
containers:
|
||||||
|
- name: redis
|
||||||
|
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
|
||||||
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||||
|
command:
|
||||||
|
- redis-server
|
||||||
|
args:
|
||||||
|
- /data/conf/redis.conf
|
||||||
|
securityContext: {{ toYaml .Values.containerSecurityContext | nindent 10 }}
|
||||||
|
{{- if .Values.auth }}
|
||||||
|
env:
|
||||||
|
- name: AUTH
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
{{- if .Values.existingSecret }}
|
||||||
|
name: {{ .Values.existingSecret }}
|
||||||
|
{{- else }}
|
||||||
|
name: {{ template "redis-ha.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
key: {{ .Values.authKey }}
|
||||||
|
{{- end }}
|
||||||
|
livenessProbe:
|
||||||
|
initialDelaySeconds: {{ .Values.redis.livenessProbe.initialDelaySeconds }}
|
||||||
|
periodSeconds: {{ .Values.redis.livenessProbe.periodSeconds }}
|
||||||
|
timeoutSeconds: {{ .Values.redis.livenessProbe.timeoutSeconds }}
|
||||||
|
successThreshold: {{ .Values.redis.livenessProbe.successThreshold }}
|
||||||
|
failureThreshold: {{ .Values.redis.livenessProbe.failureThreshold }}
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- sh
|
||||||
|
- -c
|
||||||
|
- /health/redis_liveness.sh
|
||||||
|
readinessProbe:
|
||||||
|
initialDelaySeconds: {{ .Values.redis.readinessProbe.initialDelaySeconds }}
|
||||||
|
periodSeconds: {{ .Values.redis.readinessProbe.periodSeconds }}
|
||||||
|
timeoutSeconds: {{ .Values.redis.readinessProbe.timeoutSeconds }}
|
||||||
|
successThreshold: {{ .Values.redis.readinessProbe.successThreshold }}
|
||||||
|
failureThreshold: {{ .Values.redis.readinessProbe.failureThreshold }}
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- sh
|
||||||
|
- -c
|
||||||
|
- /health/redis_readiness.sh
|
||||||
|
resources:
|
||||||
|
{{ toYaml .Values.redis.resources | indent 10 }}
|
||||||
|
ports:
|
||||||
|
{{- if ne (int .Values.redis.port) 0 }}
|
||||||
|
- name: redis
|
||||||
|
containerPort: {{ .Values.redis.port }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.redis.tlsPort }}
|
||||||
|
- name: redis-tls
|
||||||
|
containerPort: {{ .Values.redis.tlsPort }}
|
||||||
|
{{- end }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: config
|
||||||
|
mountPath: /readonly-config
|
||||||
|
readOnly: true
|
||||||
|
- mountPath: /data
|
||||||
|
name: data
|
||||||
|
{{- if .Values.redis.tlsPort }}
|
||||||
|
- mountPath: /tls-certs
|
||||||
|
name: tls-certs
|
||||||
|
{{- end}}
|
||||||
|
- mountPath: /health
|
||||||
|
name: health
|
||||||
|
{{- if .Values.redis.extraVolumeMounts }}
|
||||||
|
{{- toYaml .Values.redis.extraVolumeMounts | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
lifecycle:
|
||||||
|
{{ toYaml .Values.redis.lifecycle | indent 10 }}
|
||||||
|
- name: sentinel
|
||||||
|
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
|
||||||
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||||
|
command:
|
||||||
|
- redis-sentinel
|
||||||
|
args:
|
||||||
|
- /data/conf/sentinel.conf
|
||||||
|
securityContext: {{ toYaml .Values.containerSecurityContext | nindent 10 }}
|
||||||
|
{{- if or .Values.auth .Values.sentinel.auth}}
|
||||||
|
env:
|
||||||
|
{{- if .Values.auth }}
|
||||||
|
- name: AUTH
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
{{- if .Values.existingSecret }}
|
||||||
|
name: {{ .Values.existingSecret }}
|
||||||
|
{{- else }}
|
||||||
|
name: {{ template "redis-ha.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
key: {{ .Values.authKey }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.sentinel.auth }}
|
||||||
|
- name: SENTINELAUTH
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
{{- if .Values.sentinel.existingSecret }}
|
||||||
|
name: {{ .Values.sentinel.existingSecret }}
|
||||||
|
{{- else }}
|
||||||
|
name: {{ template "redis-ha.fullname" . }}-sentinel
|
||||||
|
{{- end }}
|
||||||
|
key: {{ .Values.sentinel.authKey }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
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/sentinel_liveness.sh
|
||||||
|
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/sentinel_liveness.sh
|
||||||
|
resources:
|
||||||
|
{{ toYaml .Values.sentinel.resources | indent 10 }}
|
||||||
|
ports:
|
||||||
|
{{- if ne (int .Values.sentinel.port) 0 }}
|
||||||
|
- name: sentinel
|
||||||
|
containerPort: {{ .Values.sentinel.port }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.sentinel.tlsPort }}
|
||||||
|
- name: sentinel-tls
|
||||||
|
containerPort: {{ .Values.sentinel.tlsPort }}
|
||||||
|
{{- end }}
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /data
|
||||||
|
name: data
|
||||||
|
{{- if .Values.redis.tlsPort }}
|
||||||
|
- mountPath: /tls-certs
|
||||||
|
name: tls-certs
|
||||||
|
{{- end }}
|
||||||
|
- mountPath: /health
|
||||||
|
name: health
|
||||||
|
{{- if .Values.sentinel.extraVolumeMounts }}
|
||||||
|
{{- toYaml .Values.sentinel.extraVolumeMounts | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
lifecycle:
|
||||||
|
{{ toYaml .Values.sentinel.lifecycle | indent 10 }}
|
||||||
|
|
||||||
|
- name: split-brain-fix
|
||||||
|
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
|
||||||
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||||
|
command:
|
||||||
|
- sh
|
||||||
|
args:
|
||||||
|
- /readonly-config/fix-split-brain.sh
|
||||||
|
securityContext: {{ toYaml .Values.containerSecurityContext | nindent 10 }}
|
||||||
|
env:
|
||||||
|
{{- $replicas := int (toString .Values.replicas) -}}
|
||||||
|
{{- range $i := until $replicas }}
|
||||||
|
- name: SENTINEL_ID_{{ $i }}
|
||||||
|
value: {{ printf "%s\n%s\nindex: %d" (include "redis-ha.name" $) ($.Release.Name) $i | sha256sum | trunc 40 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.auth }}
|
||||||
|
- name: AUTH
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
{{- if .Values.existingSecret }}
|
||||||
|
name: {{ .Values.existingSecret }}
|
||||||
|
{{- else }}
|
||||||
|
name: {{ template "redis-ha.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
key: {{ .Values.authKey }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.sentinel.auth }}
|
||||||
|
- name: SENTINELAUTH
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
{{- if .Values.sentinel.existingSecret }}
|
||||||
|
name: {{ .Values.sentinel.existingSecret }}
|
||||||
|
{{- else }}
|
||||||
|
name: {{ template "redis-ha.fullname" . }}-sentinel
|
||||||
|
{{- end }}
|
||||||
|
key: {{ .Values.sentinel.authKey }}
|
||||||
|
{{- end }}
|
||||||
|
resources:
|
||||||
|
{{- toYaml .Values.splitBrainDetection.resources | nindent 10 }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: config
|
||||||
|
mountPath: /readonly-config
|
||||||
|
readOnly: true
|
||||||
|
- mountPath: /data
|
||||||
|
name: data
|
||||||
|
{{- if .Values.redis.tlsPort }}
|
||||||
|
- mountPath: /tls-certs
|
||||||
|
name: tls-certs
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- if .Values.exporter.enabled }}
|
||||||
|
- name: redis-exporter
|
||||||
|
image: "{{ .Values.exporter.image }}:{{ .Values.exporter.tag }}"
|
||||||
|
imagePullPolicy: {{ .Values.exporter.pullPolicy }}
|
||||||
|
args:
|
||||||
|
{{- range $key, $value := .Values.exporter.extraArgs }}
|
||||||
|
- --{{ $key }}={{ $value }}
|
||||||
|
{{- end }}
|
||||||
|
env:
|
||||||
|
- name: REDIS_ADDR
|
||||||
|
{{- if .Values.exporter.sslEnabled }}
|
||||||
|
value: rediss://{{ default "localhost" .Values.exporter.address }}:{{ .Values.redis.tlsPort }}
|
||||||
|
{{- else }}
|
||||||
|
value: redis://{{ default "localhost" .Values.exporter.address }}:{{ .Values.redis.port }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.auth }}
|
||||||
|
- name: REDIS_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
{{- if .Values.existingSecret }}
|
||||||
|
name: {{ .Values.existingSecret }}
|
||||||
|
{{- else }}
|
||||||
|
name: {{ template "redis-ha.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
key: {{ .Values.authKey }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.exporter.script }}
|
||||||
|
- name: REDIS_EXPORTER_SCRIPT
|
||||||
|
value: /script/script.lua
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.exporter.sslEnabled }}
|
||||||
|
- name: REDIS_EXPORTER_TLS_CLIENT_KEY_FILE
|
||||||
|
value: /tls-certs/{{ .Values.tls.keyFile }}
|
||||||
|
- name: REDIS_EXPORTER_TLS_CLIENT_CERT_FILE
|
||||||
|
value: /tls-certs/{{ .Values.tls.certFile }}
|
||||||
|
- name: REDIS_EXPORTER_TLS_CA_CERT_FILE
|
||||||
|
value: /tls-certs/{{ .Values.tls.caCertFile }}
|
||||||
|
{{- end }}
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: {{ .Values.exporter.scrapePath }}
|
||||||
|
port: {{ .Values.exporter.port }}
|
||||||
|
initialDelaySeconds: {{ .Values.exporter.livenessProbe.initialDelaySeconds }}
|
||||||
|
timeoutSeconds: {{ .Values.exporter.livenessProbe.timeoutSeconds }}
|
||||||
|
periodSeconds: {{ .Values.exporter.livenessProbe.periodSeconds }}
|
||||||
|
readinessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: {{ .Values.exporter.scrapePath }}
|
||||||
|
port: {{ .Values.exporter.port }}
|
||||||
|
initialDelaySeconds: {{ .Values.exporter.readinessProbe.initialDelaySeconds }}
|
||||||
|
timeoutSeconds: {{ .Values.exporter.readinessProbe.timeoutSeconds }}
|
||||||
|
periodSeconds: {{ .Values.exporter.readinessProbe.periodSeconds }}
|
||||||
|
resources:
|
||||||
|
{{ toYaml .Values.exporter.resources | indent 10 }}
|
||||||
|
ports:
|
||||||
|
- name: {{ .Values.exporter.portName }}
|
||||||
|
containerPort: {{ .Values.exporter.port }}
|
||||||
|
volumeMounts:
|
||||||
|
{{- if .Values.exporter.script }}
|
||||||
|
- mountPath: /script
|
||||||
|
name: script-mount
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.exporter.sslEnabled }}
|
||||||
|
- mountPath: /tls-certs
|
||||||
|
name: tls-certs
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.extraContainers }}
|
||||||
|
{{- toYaml .Values.extraContainers | nindent 6 }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- if .Values.priorityClassName }}
|
||||||
|
priorityClassName: {{ .Values.priorityClassName }}
|
||||||
|
{{- end }}
|
||||||
|
volumes:
|
||||||
|
- name: config
|
||||||
|
configMap:
|
||||||
|
name: {{ template "redis-ha.fullname" . }}-configmap
|
||||||
|
{{- if .Values.sysctlImage.mountHostSys }}
|
||||||
|
- name: host-sys
|
||||||
|
hostPath:
|
||||||
|
path: /sys
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.exporter.script }}
|
||||||
|
- name: script-mount
|
||||||
|
configMap:
|
||||||
|
name: {{ template "redis-ha.fullname" . }}-exporter-script-configmap
|
||||||
|
items:
|
||||||
|
- key: script
|
||||||
|
path: script.lua
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.redis.tlsPort }}
|
||||||
|
- name: tls-certs
|
||||||
|
secret:
|
||||||
|
{{- if .Values.tls.secretName }}
|
||||||
|
secretName: {{ .Values.tls.secretName }}
|
||||||
|
{{- else }}
|
||||||
|
secretName: {{ template "redis-ha.fullname" . }}-tls-secret
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
- name: health
|
||||||
|
configMap:
|
||||||
|
name: {{ template "redis-ha.fullname" . }}-health-configmap
|
||||||
|
defaultMode: 0755
|
||||||
|
{{- if .Values.extraVolumes }}
|
||||||
|
{{- toYaml .Values.extraVolumes | nindent 6 }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- if .Values.persistentVolume.enabled }}
|
||||||
|
volumeClaimTemplates:
|
||||||
|
- metadata:
|
||||||
|
name: data
|
||||||
|
annotations:
|
||||||
|
{{- range $key, $value := .Values.persistentVolume.annotations }}
|
||||||
|
{{ $key }}: {{ $value }}
|
||||||
|
{{- end }}
|
||||||
|
labels: {{- toYaml .Values.persistentVolume.labels | nindent 8 }}
|
||||||
|
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
{{- range .Values.persistentVolume.accessModes }}
|
||||||
|
- {{ . | quote }}
|
||||||
|
{{- end }}
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: {{ .Values.persistentVolume.size | quote }}
|
||||||
|
{{- if .Values.persistentVolume.storageClass }}
|
||||||
|
{{- if (eq "-" .Values.persistentVolume.storageClass) }}
|
||||||
|
storageClassName: ""
|
||||||
|
{{- else }}
|
||||||
|
storageClassName: "{{ .Values.persistentVolume.storageClass }}"
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- else if .Values.hostPath.path }}
|
||||||
|
- name: data
|
||||||
|
hostPath:
|
||||||
|
path: {{ tpl .Values.hostPath.path .}}
|
||||||
|
{{- else }}
|
||||||
|
- name: data
|
||||||
|
emptyDir:
|
||||||
|
{{ toYaml .Values.emptyDir | indent 10 }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,201 @@
|
||||||
|
{{- if .Values.haproxy.enabled }}
|
||||||
|
kind: Deployment
|
||||||
|
apiVersion: apps/v1
|
||||||
|
metadata:
|
||||||
|
name: {{ template "redis-ha.fullname" . }}-haproxy
|
||||||
|
namespace: {{ .Release.Namespace | quote }}
|
||||||
|
labels:
|
||||||
|
{{ include "labels.standard" . | indent 4 }}
|
||||||
|
{{- range $key, $value := .Values.extraLabels }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
strategy:
|
||||||
|
type: RollingUpdate
|
||||||
|
revisionHistoryLimit: 1
|
||||||
|
replicas: {{ .Values.haproxy.replicas }}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: {{ template "redis-ha.name" . }}-haproxy
|
||||||
|
release: {{ .Release.Name }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
name: {{ template "redis-ha.fullname" . }}-haproxy
|
||||||
|
labels:
|
||||||
|
app: {{ template "redis-ha.name" . }}-haproxy
|
||||||
|
release: {{ .Release.Name }}
|
||||||
|
revision: "{{ .Release.Revision }}"
|
||||||
|
{{- range $key, $value := .Values.haproxy.labels }}
|
||||||
|
{{ $key }}: {{ $value | toString }}
|
||||||
|
{{- end }}
|
||||||
|
{{- range $key, $value := .Values.extraLabels }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
annotations:
|
||||||
|
{{- if and (.Values.haproxy.metrics.enabled) (not .Values.haproxy.metrics.serviceMonitor.enabled) }}
|
||||||
|
prometheus.io/port: "{{ .Values.haproxy.metrics.port }}"
|
||||||
|
prometheus.io/scrape: "true"
|
||||||
|
prometheus.io/path: "{{ .Values.haproxy.metrics.scrapePath }}"
|
||||||
|
{{- end }}
|
||||||
|
checksum/config: {{ print (include "config-haproxy.cfg" .) (include "config-haproxy_init.sh" .) | sha256sum }}
|
||||||
|
{{- if .Values.haproxy.annotations }}
|
||||||
|
{{ toYaml .Values.haproxy.annotations | indent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
# Needed when using unmodified rbac-setup.yml
|
||||||
|
{{ if .Values.haproxy.serviceAccount.create }}
|
||||||
|
serviceAccountName: {{ template "redis-ha.serviceAccountName" . }}-haproxy
|
||||||
|
{{- else }}
|
||||||
|
serviceAccountName: {{ .Values.haproxy.serviceAccountName }}
|
||||||
|
{{- end }}
|
||||||
|
securityContext: {{ toYaml .Values.haproxy.securityContext | nindent 8 }}
|
||||||
|
nodeSelector:
|
||||||
|
{{ toYaml .Values.nodeSelector | indent 8 }}
|
||||||
|
tolerations:
|
||||||
|
{{ toYaml .Values.tolerations | indent 8 }}
|
||||||
|
affinity:
|
||||||
|
{{- if .Values.haproxy.affinity }}
|
||||||
|
{{- with .Values.haproxy.affinity }}
|
||||||
|
{{ tpl . $ | indent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- else }}
|
||||||
|
{{- if .Values.haproxy.additionalAffinities }}
|
||||||
|
{{ toYaml .Values.haproxy.additionalAffinities | indent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
podAntiAffinity:
|
||||||
|
{{- if .Values.haproxy.hardAntiAffinity }}
|
||||||
|
requiredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
- labelSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: {{ template "redis-ha.name" . }}-haproxy
|
||||||
|
release: {{ .Release.Name }}
|
||||||
|
revision: "{{ .Release.Revision }}"
|
||||||
|
topologyKey: kubernetes.io/hostname
|
||||||
|
{{- else }}
|
||||||
|
preferredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
- weight: 100
|
||||||
|
podAffinityTerm:
|
||||||
|
labelSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: {{ template "redis-ha.name" . }}-haproxy
|
||||||
|
release: {{ .Release.Name }}
|
||||||
|
revision: "{{ .Release.Revision }}"
|
||||||
|
topologyKey: kubernetes.io/hostname
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.topologySpreadConstraints.enabled }}
|
||||||
|
topologySpreadConstraints:
|
||||||
|
- maxSkew: {{ .Values.topologySpreadConstraints.maxSkew | default 1 }}
|
||||||
|
topologyKey: {{ .Values.topologySpreadConstraints.topologyKey | default "topology.kubernetes.io/zone" }}
|
||||||
|
whenUnsatisfiable: {{ .Values.topologySpreadConstraints.whenUnsatisfiable | default "ScheduleAnyway" }}
|
||||||
|
labelSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: {{ template "redis-ha.name" . }}-haproxy
|
||||||
|
release: {{ .Release.Name }}
|
||||||
|
revision: "{{ .Release.Revision }}"
|
||||||
|
{{- end }}
|
||||||
|
initContainers:
|
||||||
|
- name: config-init
|
||||||
|
image: {{ .Values.haproxy.image.repository }}:{{ .Values.haproxy.image.tag }}
|
||||||
|
imagePullPolicy: {{ .Values.haproxy.image.pullPolicy }}
|
||||||
|
resources:
|
||||||
|
{{ toYaml .Values.haproxy.init.resources | indent 10 }}
|
||||||
|
command:
|
||||||
|
- sh
|
||||||
|
args:
|
||||||
|
- /readonly/haproxy_init.sh
|
||||||
|
securityContext: {{ toYaml .Values.haproxy.containerSecurityContext | nindent 10 }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: config-volume
|
||||||
|
mountPath: /readonly
|
||||||
|
readOnly: true
|
||||||
|
- name: data
|
||||||
|
mountPath: /data
|
||||||
|
{{- if .Values.haproxy.imagePullSecrets }}
|
||||||
|
imagePullSecrets: {{ toYaml .Values.haproxy.imagePullSecrets | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
containers:
|
||||||
|
- name: haproxy
|
||||||
|
image: {{ .Values.haproxy.image.repository }}:{{ .Values.haproxy.image.tag }}
|
||||||
|
imagePullPolicy: {{ .Values.haproxy.image.pullPolicy }}
|
||||||
|
securityContext: {{ toYaml .Values.haproxy.containerSecurityContext | nindent 10 }}
|
||||||
|
{{- if or .Values.auth .Values.sentinel.auth}}
|
||||||
|
env:
|
||||||
|
{{- if .Values.auth }}
|
||||||
|
- name: AUTH
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
{{- if .Values.existingSecret }}
|
||||||
|
name: {{ .Values.existingSecret }}
|
||||||
|
{{- else }}
|
||||||
|
name: {{ template "redis-ha.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
key: {{ .Values.authKey }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.sentinel.auth }}
|
||||||
|
- name: SENTINELAUTH
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
{{- if .Values.sentinel.existingSecret }}
|
||||||
|
name: {{ .Values.sentinel.existingSecret }}
|
||||||
|
{{- else }}
|
||||||
|
name: {{ template "redis-ha.fullname" . }}-sentinel
|
||||||
|
{{- end }}
|
||||||
|
key: {{ .Values.sentinel.authKey }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /healthz
|
||||||
|
port: 8888
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 3
|
||||||
|
readinessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /healthz
|
||||||
|
port: 8888
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 3
|
||||||
|
ports:
|
||||||
|
- name: redis
|
||||||
|
containerPort: {{ default "6379" .Values.haproxy.containerPort }}
|
||||||
|
{{- if .Values.haproxy.readOnly.enabled }}
|
||||||
|
- name: readonlyport
|
||||||
|
containerPort: {{ default "6380" .Values.haproxy.readOnly.port }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.haproxy.metrics.enabled }}
|
||||||
|
- name: metrics-port
|
||||||
|
containerPort: {{ default "9101" .Values.haproxy.metrics.port }}
|
||||||
|
{{- end }}
|
||||||
|
resources:
|
||||||
|
{{ toYaml .Values.haproxy.resources | indent 10 }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: data
|
||||||
|
mountPath: /usr/local/etc/haproxy
|
||||||
|
- name: shared-socket
|
||||||
|
mountPath: /run/haproxy
|
||||||
|
{{- if .Values.haproxy.tls.enabled }}
|
||||||
|
- name: pemfile
|
||||||
|
mountPath: {{ .Values.haproxy.tls.certMountPath }}
|
||||||
|
{{- end }}
|
||||||
|
lifecycle:
|
||||||
|
{{ toYaml .Values.haproxy.lifecycle | indent 10 }}
|
||||||
|
{{- if .Values.haproxy.priorityClassName }}
|
||||||
|
priorityClassName: {{ .Values.haproxy.priorityClassName }}
|
||||||
|
{{- end }}
|
||||||
|
volumes:
|
||||||
|
{{- if .Values.haproxy.tls.enabled }}
|
||||||
|
- name: pemfile
|
||||||
|
secret:
|
||||||
|
secretName: {{ .Values.haproxy.tls.secretName }}
|
||||||
|
{{- end }}
|
||||||
|
- name: config-volume
|
||||||
|
configMap:
|
||||||
|
name: {{ template "redis-ha.fullname" . }}-configmap
|
||||||
|
- name: shared-socket
|
||||||
|
emptyDir:
|
||||||
|
{{ toYaml .Values.haproxy.emptyDir | indent 10 }}
|
||||||
|
- name: data
|
||||||
|
emptyDir:
|
||||||
|
{{ toYaml .Values.haproxy.emptyDir | indent 10 }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,18 @@
|
||||||
|
{{- if .Values.haproxy.podDisruptionBudget -}}
|
||||||
|
apiVersion: {{ template "redis-ha.podDisruptionBudget.apiVersion" . }}
|
||||||
|
kind: PodDisruptionBudget
|
||||||
|
metadata:
|
||||||
|
name: {{ template "redis-ha.fullname" . }}-haproxy-pdb
|
||||||
|
namespace: {{ .Release.Namespace | quote }}
|
||||||
|
labels:
|
||||||
|
{{ include "labels.standard" . | indent 4 }}
|
||||||
|
{{- range $key, $value := .Values.extraLabels }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
release: {{ .Release.Name }}
|
||||||
|
app: {{ template "redis-ha.name" . }}-haproxy
|
||||||
|
{{ toYaml .Values.haproxy.podDisruptionBudget | indent 2 }}
|
||||||
|
{{- end -}}
|
|
@ -0,0 +1,22 @@
|
||||||
|
{{- if .Values.haproxy.enabled }}
|
||||||
|
{{- if and .Values.haproxy.serviceAccount.create .Values.rbac.create }}
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: Role
|
||||||
|
metadata:
|
||||||
|
name: {{ template "redis-ha.fullname" . }}-haproxy
|
||||||
|
namespace: {{ .Release.Namespace | quote }}
|
||||||
|
labels:
|
||||||
|
{{ include "labels.standard" . | indent 4 }}
|
||||||
|
component: {{ template "redis-ha.fullname" . }}-haproxy
|
||||||
|
{{- range $key, $value := .Values.extraLabels }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
rules:
|
||||||
|
- apiGroups:
|
||||||
|
- ""
|
||||||
|
resources:
|
||||||
|
- endpoints
|
||||||
|
verbs:
|
||||||
|
- get
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,22 @@
|
||||||
|
{{- if .Values.haproxy.enabled }}
|
||||||
|
{{- if and .Values.haproxy.serviceAccount.create .Values.rbac.create }}
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: RoleBinding
|
||||||
|
metadata:
|
||||||
|
name: {{ template "redis-ha.fullname" . }}-haproxy
|
||||||
|
namespace: {{ .Release.Namespace | quote }}
|
||||||
|
labels:
|
||||||
|
{{ include "labels.standard" . | indent 4 }}
|
||||||
|
component: {{ template "redis-ha.fullname" . }}-haproxy
|
||||||
|
{{- range $key, $value := .Values.extraLabels }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: {{ template "redis-ha.serviceAccountName" . }}-haproxy
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: Role
|
||||||
|
name: {{ template "redis-ha.fullname" . }}-haproxy
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,54 @@
|
||||||
|
{{- if .Values.haproxy.enabled }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ template "redis-ha.fullname" . }}-haproxy
|
||||||
|
namespace: {{ .Release.Namespace | quote }}
|
||||||
|
labels:
|
||||||
|
{{ include "labels.standard" . | indent 4 }}
|
||||||
|
component: {{ template "redis-ha.fullname" . }}-haproxy
|
||||||
|
{{- range $key, $value := .Values.extraLabels }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- range $key, $value := .Values.haproxy.service.labels }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
annotations:
|
||||||
|
{{- if .Values.haproxy.service.annotations }}
|
||||||
|
{{ toYaml .Values.haproxy.service.annotations | indent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
type: {{ default "ClusterIP" .Values.haproxy.service.type }}
|
||||||
|
{{- if and (eq .Values.haproxy.service.type "LoadBalancer") .Values.haproxy.service.loadBalancerIP }}
|
||||||
|
loadBalancerIP: {{ .Values.haproxy.service.loadBalancerIP }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if and (eq .Values.haproxy.service.type "LoadBalancer") .Values.haproxy.service.externalTrafficPolicy }}
|
||||||
|
externalTrafficPolicy: {{ .Values.haproxy.service.externalTrafficPolicy }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if and (eq .Values.haproxy.service.type "LoadBalancer") .Values.haproxy.service.loadBalancerSourceRanges }}
|
||||||
|
loadBalancerSourceRanges: {{ toYaml .Values.haproxy.service.loadBalancerSourceRanges | nindent 2 }}
|
||||||
|
{{- end }}
|
||||||
|
ports:
|
||||||
|
- name: tcp-haproxy
|
||||||
|
port: {{ .Values.haproxy.servicePort }}
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: redis
|
||||||
|
{{- if and (eq .Values.haproxy.service.type "NodePort") .Values.haproxy.service.nodePort }}
|
||||||
|
nodePort: {{ .Values.haproxy.service.nodePort }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.haproxy.readOnly.enabled }}
|
||||||
|
- name: tcp-haproxyreadonly
|
||||||
|
port: {{ .Values.haproxy.readOnly.port }}
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: {{ .Values.haproxy.readOnly.port }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.haproxy.metrics.enabled }}
|
||||||
|
- name: {{ .Values.haproxy.metrics.portName }}
|
||||||
|
port: {{ .Values.haproxy.metrics.port }}
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: metrics-port
|
||||||
|
{{- end }}
|
||||||
|
selector:
|
||||||
|
release: {{ .Release.Name }}
|
||||||
|
app: {{ template "redis-ha.name" . }}-haproxy
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,15 @@
|
||||||
|
{{- if and .Values.haproxy.serviceAccount.create .Values.haproxy.enabled }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
metadata:
|
||||||
|
name: {{ template "redis-ha.serviceAccountName" . }}-haproxy
|
||||||
|
namespace: {{ .Release.Namespace | quote }}
|
||||||
|
labels:
|
||||||
|
heritage: {{ .Release.Service }}
|
||||||
|
release: {{ .Release.Name }}
|
||||||
|
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||||
|
app: {{ template "redis-ha.fullname" . }}
|
||||||
|
{{- range $key, $value := .Values.extraLabels }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,36 @@
|
||||||
|
{{- if and ( .Capabilities.APIVersions.Has "monitoring.coreos.com/v1" ) ( .Values.haproxy.metrics.serviceMonitor.enabled ) ( .Values.haproxy.metrics.enabled ) }}
|
||||||
|
apiVersion: monitoring.coreos.com/v1
|
||||||
|
kind: ServiceMonitor
|
||||||
|
metadata:
|
||||||
|
name: {{ template "redis-ha.fullname" . }}-haproxy
|
||||||
|
namespace: {{ .Values.haproxy.metrics.serviceMonitor.namespace | default .Release.Namespace | quote }}
|
||||||
|
labels:
|
||||||
|
{{ include "labels.standard" . | indent 4 }}
|
||||||
|
{{- range $key, $value := .Values.extraLabels }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- range $key, $value := .Values.haproxy.metrics.serviceMonitor.labels }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
endpoints:
|
||||||
|
- targetPort: {{ .Values.haproxy.metrics.port }}
|
||||||
|
{{- if .Values.haproxy.metrics.serviceMonitor.interval }}
|
||||||
|
interval: {{ .Values.haproxy.metrics.serviceMonitor.interval }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.haproxy.metrics.serviceMonitor.telemetryPath }}
|
||||||
|
path: {{ .Values.haproxy.metrics.serviceMonitor.telemetryPath }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.haproxy.metrics.serviceMonitor.timeout }}
|
||||||
|
scrapeTimeout: {{ .Values.haproxy.metrics.serviceMonitor.timeout }}
|
||||||
|
{{- end }}
|
||||||
|
jobLabel: {{ template "redis-ha.fullname" . }}-haproxy
|
||||||
|
namespaceSelector:
|
||||||
|
matchNames:
|
||||||
|
- {{ .Release.Namespace | quote }}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: {{ template "redis-ha.name" . }}
|
||||||
|
release: {{ .Release.Name }}
|
||||||
|
component: {{ template "redis-ha.fullname" . }}-haproxy
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,27 @@
|
||||||
|
{{- if and .Values.redis.tlsPort (not .Values.tls.secretName) -}}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
metadata:
|
||||||
|
name: {{ template "redis-ha.fullname" . }}-tls-secret
|
||||||
|
namespace: {{ .Release.Namespace | quote }}
|
||||||
|
labels:
|
||||||
|
{{ include "labels.standard" . | indent 4 }}
|
||||||
|
{{- range $key, $value := .Values.extraLabels }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
type: Opaque
|
||||||
|
data:
|
||||||
|
{{- if .Values.tls.caCertFile }}
|
||||||
|
{{ .Values.tls.caCertFile }}: {{ .Files.Get "certs/ca.crt" | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.tls.certFile }}
|
||||||
|
{{ .Values.tls.certFile }}: {{ .Files.Get "certs/redis.crt" | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.tls.keyFile }}
|
||||||
|
{{ .Values.tls.keyFile }}: {{ .Files.Get "certs/redis.key" | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.tls.dhParamsFile }}
|
||||||
|
{{ .Values.tls.dhParamsFile }}: {{ .Files.Get "certs/redis.dh" | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,15 @@
|
||||||
|
{{- if and .Values.sentinel.auth (not .Values.sentinel.existingSecret) -}}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: {{ template "redis-ha.fullname" . }}-sentinel
|
||||||
|
namespace: {{ .Release.Namespace | quote }}
|
||||||
|
labels:
|
||||||
|
{{ include "labels.standard" . | indent 4 }}
|
||||||
|
{{- range $key, $value := .Values.extraLabels }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
type: Opaque
|
||||||
|
data:
|
||||||
|
{{ .Values.sentinel.authKey }}: {{ .Values.sentinel.password | b64enc | quote }}
|
||||||
|
{{- end -}}
|
|
@ -0,0 +1,32 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: {{ template "redis-ha.fullname" . }}-configmap-test
|
||||||
|
namespace: {{ .Release.Namespace | quote }}
|
||||||
|
labels:
|
||||||
|
{{ include "labels.standard" . | indent 4 }}
|
||||||
|
annotations:
|
||||||
|
"helm.sh/hook": test-success
|
||||||
|
spec:
|
||||||
|
nodeSelector: {{ toYaml .Values.nodeSelector | nindent 4 }}
|
||||||
|
tolerations: {{ toYaml .Values.tolerations | nindent 4 }}
|
||||||
|
containers:
|
||||||
|
- name: check-init
|
||||||
|
image: {{ .Values.configmapTest.image.repository }}:{{ .Values.configmapTest.image.tag }}
|
||||||
|
args:
|
||||||
|
- --shell=sh
|
||||||
|
- /readonly-config/init.sh
|
||||||
|
volumeMounts:
|
||||||
|
- name: config
|
||||||
|
mountPath: /readonly-config
|
||||||
|
readOnly: true
|
||||||
|
resources: {{ toYaml .Values.configmapTest.resources | nindent 6 }}
|
||||||
|
securityContext: {{ toYaml .Values.containerSecurityContext | nindent 6 }}
|
||||||
|
{{- if .Values.imagePullSecrets }}
|
||||||
|
imagePullSecrets: {{ toYaml .Values.imagePullSecrets | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
restartPolicy: Never
|
||||||
|
volumes:
|
||||||
|
- name: config
|
||||||
|
configMap:
|
||||||
|
name: {{ template "redis-ha.fullname" . }}-configmap
|
|
@ -0,0 +1,29 @@
|
||||||
|
{{- if .Values.haproxy.enabled }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: {{ template "redis-ha.fullname" . }}-service-test
|
||||||
|
namespace: {{ .Release.Namespace | quote }}
|
||||||
|
labels:
|
||||||
|
{{ include "labels.standard" . | indent 4 }}
|
||||||
|
annotations:
|
||||||
|
"helm.sh/hook": test-success
|
||||||
|
spec:
|
||||||
|
nodeSelector:
|
||||||
|
{{ toYaml .Values.nodeSelector | indent 4 }}
|
||||||
|
tolerations:
|
||||||
|
{{ toYaml .Values.tolerations | indent 4 }}
|
||||||
|
containers:
|
||||||
|
- name: "{{ .Release.Name }}-service-test"
|
||||||
|
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
|
||||||
|
command:
|
||||||
|
- sh
|
||||||
|
- -c
|
||||||
|
- redis-cli -h {{ template "redis-ha.fullname" . }}-haproxy -p {{ .Values.redis.port }} info server
|
||||||
|
resources: {{ toYaml .Values.haproxy.tests.resources | nindent 6 }}
|
||||||
|
securityContext: {{ toYaml .Values.containerSecurityContext | nindent 6 }}
|
||||||
|
{{- if .Values.imagePullSecrets }}
|
||||||
|
imagePullSecrets: {{ toYaml .Values.imagePullSecrets | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
restartPolicy: Never
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,701 @@
|
||||||
|
## Configure resource requests and limits
|
||||||
|
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
|
||||||
|
##
|
||||||
|
image:
|
||||||
|
repository: redis
|
||||||
|
tag: 7.0.5-alpine3.16
|
||||||
|
pullPolicy: IfNotPresent
|
||||||
|
|
||||||
|
## Reference to one or more secrets to be used when pulling images
|
||||||
|
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
|
||||||
|
## This imagePullSecrets is only for redis images
|
||||||
|
##
|
||||||
|
imagePullSecrets: []
|
||||||
|
# - name: "image-pull-secret"
|
||||||
|
|
||||||
|
## replicas number for each component
|
||||||
|
replicas: 3
|
||||||
|
|
||||||
|
## Customize the statefulset pod management policy:
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#pod-management-policies
|
||||||
|
podManagementPolicy: OrderedReady
|
||||||
|
|
||||||
|
## read-only replicas
|
||||||
|
## indexed slaves get never promoted to be master
|
||||||
|
## index starts with 0 - which is master on init
|
||||||
|
## i.e. "8,9" means 8th and 9th slave will be replica with replica-priority=0
|
||||||
|
## see also: https://redis.io/topics/sentinel
|
||||||
|
ro_replicas: ""
|
||||||
|
|
||||||
|
## Kubernetes priorityClass name for the redis-ha-server pod
|
||||||
|
# priorityClassName: ""
|
||||||
|
|
||||||
|
## Custom labels for the redis pod
|
||||||
|
labels: {}
|
||||||
|
|
||||||
|
## Custom labels for redis service
|
||||||
|
serviceLabels: {}
|
||||||
|
|
||||||
|
configmap:
|
||||||
|
## Custom labels for the redis configmap
|
||||||
|
labels: {}
|
||||||
|
|
||||||
|
configmapTest:
|
||||||
|
## Image for redis-ha-configmap-test hook
|
||||||
|
image:
|
||||||
|
repository: koalaman/shellcheck
|
||||||
|
tag: v0.5.0
|
||||||
|
## Resources for the ConfigMap test pod
|
||||||
|
resources: {}
|
||||||
|
|
||||||
|
## Pods Service Account
|
||||||
|
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
|
||||||
|
serviceAccount:
|
||||||
|
## Specifies whether a ServiceAccount should be created
|
||||||
|
##
|
||||||
|
create: true
|
||||||
|
## The name of the ServiceAccount to use.
|
||||||
|
## If not set and create is true, a name is generated using the redis-ha.fullname template
|
||||||
|
# name:
|
||||||
|
## opt in/out of automounting API credentials into container
|
||||||
|
## https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
|
||||||
|
automountToken: false
|
||||||
|
|
||||||
|
## Enables a HA Proxy for better LoadBalancing / Sentinel Master support. Automatically proxies to Redis master.
|
||||||
|
## Recommend for externally exposed Redis clusters.
|
||||||
|
## ref: https://cbonte.github.io/haproxy-dconv/1.9/intro.html
|
||||||
|
haproxy:
|
||||||
|
enabled: false
|
||||||
|
servicePort: 6379
|
||||||
|
containerPort: 6379
|
||||||
|
## Enable TLS termination on HAproxy, This will create a volume mount
|
||||||
|
tls:
|
||||||
|
enabled: false
|
||||||
|
secretName: ""
|
||||||
|
keyName:
|
||||||
|
certMountPath: /tmp/
|
||||||
|
# Enable if you want a dedicated port in haproxy for redis-slaves
|
||||||
|
readOnly:
|
||||||
|
enabled: false
|
||||||
|
port: 6380
|
||||||
|
replicas: 3
|
||||||
|
image:
|
||||||
|
repository: haproxy
|
||||||
|
tag: 2.6.4
|
||||||
|
pullPolicy: IfNotPresent
|
||||||
|
|
||||||
|
## Custom labels for the haproxy pod
|
||||||
|
labels: {}
|
||||||
|
|
||||||
|
## Reference to one or more secrets to be used when pulling images
|
||||||
|
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
|
||||||
|
##
|
||||||
|
imagePullSecrets: []
|
||||||
|
# - name: "image-pull-secret"
|
||||||
|
|
||||||
|
annotations: {}
|
||||||
|
resources: {}
|
||||||
|
emptyDir: {}
|
||||||
|
|
||||||
|
## Pod Disruption Budget
|
||||||
|
## ref: https://kubernetes.io/docs/tasks/run-application/configure-pdb/
|
||||||
|
##
|
||||||
|
podDisruptionBudget: {}
|
||||||
|
# Use only one of the two
|
||||||
|
# maxUnavailable: 1
|
||||||
|
# minAvailable: 1
|
||||||
|
|
||||||
|
|
||||||
|
## Enable sticky sessions to Redis nodes via HAProxy
|
||||||
|
## Very useful for long-living connections as in case of Sentry for example
|
||||||
|
stickyBalancing: false
|
||||||
|
## Kubernetes priorityClass name for the haproxy pod
|
||||||
|
# priorityClassName: ""
|
||||||
|
|
||||||
|
## Service for HAProxy
|
||||||
|
service:
|
||||||
|
type: ClusterIP
|
||||||
|
loadBalancerIP:
|
||||||
|
labels: {}
|
||||||
|
annotations: null
|
||||||
|
|
||||||
|
# List of CIDR's allowed to connect to LoadBalancer
|
||||||
|
# loadBalancerSourceRanges: []
|
||||||
|
|
||||||
|
serviceAccountName: redis-sa
|
||||||
|
serviceAccount:
|
||||||
|
create: true
|
||||||
|
## Official HAProxy embedded prometheus metrics settings.
|
||||||
|
## Ref: https://github.com/haproxy/haproxy/tree/master/contrib/prometheus-exporter
|
||||||
|
##
|
||||||
|
metrics:
|
||||||
|
enabled: false
|
||||||
|
# prometheus port & scrape path
|
||||||
|
port: 9101
|
||||||
|
portName: http-exporter-port
|
||||||
|
scrapePath: /metrics
|
||||||
|
|
||||||
|
serviceMonitor:
|
||||||
|
# When set true then use a ServiceMonitor to configure scraping
|
||||||
|
enabled: false
|
||||||
|
# Set the namespace the ServiceMonitor should be deployed
|
||||||
|
# namespace: "monitoring"
|
||||||
|
# Set how frequently Prometheus should scrape
|
||||||
|
# interval: 30s
|
||||||
|
# Set path to redis-exporter telemtery-path
|
||||||
|
# telemetryPath: /metrics
|
||||||
|
# Set labels for the ServiceMonitor, use this to define your scrape label for Prometheus Operator
|
||||||
|
# labels: {}
|
||||||
|
# Set timeout for scrape
|
||||||
|
# timeout: 10s
|
||||||
|
init:
|
||||||
|
resources: {}
|
||||||
|
timeout:
|
||||||
|
connect: 4s
|
||||||
|
server: 330s
|
||||||
|
client: 330s
|
||||||
|
check: 2s
|
||||||
|
checkInterval: 1s
|
||||||
|
checkFall: 1
|
||||||
|
|
||||||
|
securityContext:
|
||||||
|
runAsUser: 99
|
||||||
|
fsGroup: 99
|
||||||
|
runAsNonRoot: true
|
||||||
|
|
||||||
|
containerSecurityContext:
|
||||||
|
runAsNonRoot: true
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
seccompProfile:
|
||||||
|
type: RuntimeDefault
|
||||||
|
capabilities:
|
||||||
|
drop:
|
||||||
|
- ALL
|
||||||
|
|
||||||
|
## Whether the haproxy pods should be forced to run on separate nodes.
|
||||||
|
hardAntiAffinity: true
|
||||||
|
|
||||||
|
## Additional affinities to add to the haproxy pods.
|
||||||
|
additionalAffinities: {}
|
||||||
|
|
||||||
|
## Override all other affinity settings for the haproxy pods with a string.
|
||||||
|
affinity: |
|
||||||
|
|
||||||
|
## Custom config-haproxy.cfg files used to override default settings. If this file is
|
||||||
|
## specified then the config-haproxy.cfg above will be ignored.
|
||||||
|
# customConfig: |-
|
||||||
|
# Define configuration here
|
||||||
|
## Place any additional configuration section to add to the default config-haproxy.cfg
|
||||||
|
# extraConfig: |-
|
||||||
|
# Define configuration here
|
||||||
|
|
||||||
|
## Container lifecycle hooks
|
||||||
|
## Ref: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/
|
||||||
|
lifecycle: {}
|
||||||
|
|
||||||
|
## HAProxy test related options
|
||||||
|
tests:
|
||||||
|
resources: {}
|
||||||
|
|
||||||
|
## Enable HAProxy parameters to bind and consume IPv6 addresses. Enabled by default.
|
||||||
|
IPv6:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
## Role Based Access
|
||||||
|
## Ref: https://kubernetes.io/docs/admin/authorization/rbac/
|
||||||
|
##
|
||||||
|
rbac:
|
||||||
|
create: true
|
||||||
|
|
||||||
|
# NOT RECOMMENDED: Additional container in which you can execute arbitrary commands to update sysctl parameters
|
||||||
|
# You can now use securityContext.sysctls to leverage this capability
|
||||||
|
# Ref: https://kubernetes.io/docs/tasks/administer-cluster/sysctl-cluster/
|
||||||
|
##
|
||||||
|
sysctlImage:
|
||||||
|
enabled: false
|
||||||
|
command: []
|
||||||
|
registry: docker.io
|
||||||
|
repository: busybox
|
||||||
|
tag: 1.34.1
|
||||||
|
pullPolicy: Always
|
||||||
|
mountHostSys: false
|
||||||
|
resources: {}
|
||||||
|
|
||||||
|
## Use an alternate scheduler, e.g. "stork".
|
||||||
|
## ref: https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/
|
||||||
|
##
|
||||||
|
# schedulerName:
|
||||||
|
|
||||||
|
## Redis specific configuration options
|
||||||
|
redis:
|
||||||
|
port: 6379
|
||||||
|
masterGroupName: "mymaster" # must match ^[\\w-\\.]+$) and can be templated
|
||||||
|
|
||||||
|
## Configures redis with tls-port parameter
|
||||||
|
# tlsPort: 6385
|
||||||
|
|
||||||
|
## Configures redis with tls-replication parameter, if true sets "tls-replication yes" in redis.conf
|
||||||
|
# tlsReplication: true
|
||||||
|
|
||||||
|
## It is possible to disable client side certificates authentication when "authClients" is set to "no"
|
||||||
|
# authClients: "no"
|
||||||
|
|
||||||
|
## Increase terminationGracePeriodSeconds to allow writing large RDB snapshots. (k8s default is 30s)
|
||||||
|
## https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-termination-forced
|
||||||
|
terminationGracePeriodSeconds: 60
|
||||||
|
|
||||||
|
# liveness probe parameters for redis container
|
||||||
|
livenessProbe:
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 15
|
||||||
|
timeoutSeconds: 15
|
||||||
|
successThreshold: 1
|
||||||
|
failureThreshold: 5
|
||||||
|
|
||||||
|
readinessProbe:
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 15
|
||||||
|
timeoutSeconds: 15
|
||||||
|
successThreshold: 1
|
||||||
|
failureThreshold: 5
|
||||||
|
|
||||||
|
disableCommands:
|
||||||
|
- FLUSHDB
|
||||||
|
- FLUSHALL
|
||||||
|
|
||||||
|
config:
|
||||||
|
## Additional redis conf options can be added below
|
||||||
|
## For all available options see http://download.redis.io/redis-stable/redis.conf
|
||||||
|
min-replicas-to-write: 1
|
||||||
|
min-replicas-max-lag: 5 # Value in seconds
|
||||||
|
maxmemory: "0" # Max memory to use for each redis instance. Default is unlimited.
|
||||||
|
maxmemory-policy: "volatile-lru" # Max memory policy to use for each redis instance. Default is volatile-lru.
|
||||||
|
# Determines if scheduled RDB backups are created. Default is false.
|
||||||
|
# Please note that local (on-disk) RDBs will still be created when re-syncing with a new slave. The only way to prevent this is to enable diskless replication.
|
||||||
|
save: "900 1"
|
||||||
|
# When enabled, directly sends the RDB over the wire to slaves, without using the disk as intermediate storage. Default is false.
|
||||||
|
repl-diskless-sync: "yes"
|
||||||
|
rdbcompression: "yes"
|
||||||
|
rdbchecksum: "yes"
|
||||||
|
|
||||||
|
## Custom redis.conf files used to override default settings. If this file is
|
||||||
|
## specified then the redis.config above will be ignored.
|
||||||
|
# customConfig: |-
|
||||||
|
# Define configuration here
|
||||||
|
|
||||||
|
resources: {}
|
||||||
|
# requests:
|
||||||
|
# memory: 200Mi
|
||||||
|
# cpu: 100m
|
||||||
|
# limits:
|
||||||
|
# memory: 700Mi
|
||||||
|
|
||||||
|
## Container lifecycle hooks
|
||||||
|
## Ref: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/
|
||||||
|
lifecycle:
|
||||||
|
preStop:
|
||||||
|
exec:
|
||||||
|
command: ["/bin/sh", "/readonly-config/trigger-failover-if-master.sh"]
|
||||||
|
|
||||||
|
## annotations for the redis statefulset
|
||||||
|
annotations: {}
|
||||||
|
|
||||||
|
## updateStrategy for Redis StatefulSet
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#update-strategies
|
||||||
|
updateStrategy:
|
||||||
|
type: RollingUpdate
|
||||||
|
|
||||||
|
## additional volumeMounts for Redis container
|
||||||
|
extraVolumeMounts: []
|
||||||
|
# - name: empty
|
||||||
|
# mountPath: /empty
|
||||||
|
|
||||||
|
## Sentinel specific configuration options
|
||||||
|
sentinel:
|
||||||
|
port: 26379
|
||||||
|
|
||||||
|
## Configure the 'bind' directive to bind to a list of network interfaces
|
||||||
|
# bind: 0.0.0.0
|
||||||
|
|
||||||
|
## Configures sentinel with tls-port parameter
|
||||||
|
# tlsPort: 26385
|
||||||
|
|
||||||
|
## Configures sentinel with tls-replication parameter, if true sets "tls-replication yes" in sentinel.conf
|
||||||
|
# tlsReplication: true
|
||||||
|
|
||||||
|
## It is possible to disable client side certificates authentication when "authClients" is set to "no"
|
||||||
|
# authClients: "no"
|
||||||
|
|
||||||
|
## Configures sentinel with AUTH (requirepass params)
|
||||||
|
auth: false
|
||||||
|
|
||||||
|
# password: password
|
||||||
|
|
||||||
|
## Use existing secret containing key `authKey` (ignores sentinel.password)
|
||||||
|
# existingSecret: sentinel-secret
|
||||||
|
|
||||||
|
## Defines the key holding the sentinel password in existing secret.
|
||||||
|
authKey: sentinel-password
|
||||||
|
|
||||||
|
# liveness probe parameters for sentinel container
|
||||||
|
livenessProbe:
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 15
|
||||||
|
timeoutSeconds: 15
|
||||||
|
successThreshold: 1
|
||||||
|
failureThreshold: 5
|
||||||
|
|
||||||
|
# readiness probe parameters for sentinel container
|
||||||
|
readinessProbe:
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 15
|
||||||
|
timeoutSeconds: 15
|
||||||
|
successThreshold: 3
|
||||||
|
failureThreshold: 5
|
||||||
|
|
||||||
|
quorum: 2
|
||||||
|
config:
|
||||||
|
## Additional sentinel conf options can be added below. Only options that
|
||||||
|
## are expressed in the format simialar to 'sentinel xxx mymaster xxx' will
|
||||||
|
## be properly templated expect maxclients option.
|
||||||
|
## For available options see http://download.redis.io/redis-stable/sentinel.conf
|
||||||
|
down-after-milliseconds: 10000
|
||||||
|
## Failover timeout value in milliseconds
|
||||||
|
failover-timeout: 180000
|
||||||
|
parallel-syncs: 5
|
||||||
|
maxclients: 10000
|
||||||
|
|
||||||
|
## Custom sentinel.conf files used to override default settings. If this file is
|
||||||
|
## specified then the sentinel.config above will be ignored.
|
||||||
|
# customConfig: |-
|
||||||
|
# Define configuration here
|
||||||
|
|
||||||
|
resources: {}
|
||||||
|
# requests:
|
||||||
|
# memory: 200Mi
|
||||||
|
# cpu: 100m
|
||||||
|
# limits:
|
||||||
|
# memory: 200Mi
|
||||||
|
|
||||||
|
## Container lifecycle hooks
|
||||||
|
## Ref: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/
|
||||||
|
lifecycle: {}
|
||||||
|
|
||||||
|
## additional volumeMounts for Sentinel container
|
||||||
|
extraVolumeMounts: []
|
||||||
|
# - name: empty
|
||||||
|
# mountPath: /empty
|
||||||
|
|
||||||
|
securityContext:
|
||||||
|
runAsUser: 1000
|
||||||
|
fsGroup: 1000
|
||||||
|
runAsNonRoot: true
|
||||||
|
|
||||||
|
containerSecurityContext:
|
||||||
|
runAsUser: 1000
|
||||||
|
runAsNonRoot: true
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
seccompProfile:
|
||||||
|
type: RuntimeDefault
|
||||||
|
capabilities:
|
||||||
|
drop:
|
||||||
|
- ALL
|
||||||
|
|
||||||
|
## Assuming your kubelet allows it, you can the following instructions to configure
|
||||||
|
## specific sysctl parameters
|
||||||
|
##
|
||||||
|
# sysctls:
|
||||||
|
# - name: net.core.somaxconn
|
||||||
|
# value: '10000'
|
||||||
|
|
||||||
|
## Node labels, affinity, and tolerations for pod assignment
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#taints-and-tolerations-beta-feature
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
|
||||||
|
nodeSelector: {}
|
||||||
|
|
||||||
|
## Whether the Redis server pods should be forced to run on separate nodes.
|
||||||
|
## This is accomplished by setting their AntiAffinity with requiredDuringSchedulingIgnoredDuringExecution as opposed to preferred.
|
||||||
|
## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#inter-pod-affinity-and-anti-affinity-beta-feature
|
||||||
|
##
|
||||||
|
hardAntiAffinity: true
|
||||||
|
|
||||||
|
## Additional affinities to add to the Redis server pods.
|
||||||
|
##
|
||||||
|
## Example:
|
||||||
|
## nodeAffinity:
|
||||||
|
## preferredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
## - weight: 50
|
||||||
|
## preference:
|
||||||
|
## matchExpressions:
|
||||||
|
## - key: spot
|
||||||
|
## operator: NotIn
|
||||||
|
## values:
|
||||||
|
## - "true"
|
||||||
|
##
|
||||||
|
## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
|
||||||
|
##
|
||||||
|
additionalAffinities: {}
|
||||||
|
|
||||||
|
## Override all other affinity settings for the Redis server pods with a string.
|
||||||
|
##
|
||||||
|
## Example:
|
||||||
|
## affinity: |
|
||||||
|
## podAntiAffinity:
|
||||||
|
## requiredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
## - labelSelector:
|
||||||
|
## matchLabels:
|
||||||
|
## app: {{ template "redis-ha.name" . }}
|
||||||
|
## release: {{ .Release.Name }}
|
||||||
|
## topologyKey: kubernetes.io/hostname
|
||||||
|
## preferredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
## - weight: 100
|
||||||
|
## podAffinityTerm:
|
||||||
|
## labelSelector:
|
||||||
|
## matchLabels:
|
||||||
|
## app: {{ template "redis-ha.name" . }}
|
||||||
|
## release: {{ .Release.Name }}
|
||||||
|
## topologyKey: failure-domain.beta.kubernetes.io/zone
|
||||||
|
##
|
||||||
|
affinity: |
|
||||||
|
|
||||||
|
## https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/
|
||||||
|
topologySpreadConstraints:
|
||||||
|
enabled: false
|
||||||
|
maxSkew: ""
|
||||||
|
topologyKey: ""
|
||||||
|
whenUnsatisfiable: ""
|
||||||
|
|
||||||
|
# Prometheus exporter specific configuration options
|
||||||
|
exporter:
|
||||||
|
enabled: false
|
||||||
|
image: oliver006/redis_exporter
|
||||||
|
tag: v1.43.0
|
||||||
|
pullPolicy: IfNotPresent
|
||||||
|
|
||||||
|
# prometheus port & scrape path
|
||||||
|
port: 9121
|
||||||
|
portName: exporter-port
|
||||||
|
scrapePath: /metrics
|
||||||
|
|
||||||
|
# Address/Host for Redis instance. Default: localhost
|
||||||
|
# Exists to circumvent issues with IPv6 dns resolution that occurs on certain environments
|
||||||
|
##
|
||||||
|
address: localhost
|
||||||
|
|
||||||
|
## Set this to true if you want to connect to redis tls port
|
||||||
|
# sslEnabled: true
|
||||||
|
|
||||||
|
# cpu/memory resource limits/requests
|
||||||
|
resources: {}
|
||||||
|
|
||||||
|
# Additional args for redis exporter
|
||||||
|
extraArgs: {}
|
||||||
|
|
||||||
|
# Used to mount a LUA-Script via config map and use it for metrics-collection
|
||||||
|
# script: |
|
||||||
|
# -- Example script copied from: https://github.com/oliver006/redis_exporter/blob/master/contrib/sample_collect_script.lua
|
||||||
|
# -- Example collect script for -script option
|
||||||
|
# -- This returns a Lua table with alternating keys and values.
|
||||||
|
# -- Both keys and values must be strings, similar to a HGETALL result.
|
||||||
|
# -- More info about Redis Lua scripting: https://redis.io/commands/eval
|
||||||
|
#
|
||||||
|
# local result = {}
|
||||||
|
#
|
||||||
|
# -- Add all keys and values from some hash in db 5
|
||||||
|
# redis.call("SELECT", 5)
|
||||||
|
# local r = redis.call("HGETALL", "some-hash-with-stats")
|
||||||
|
# if r ~= nil then
|
||||||
|
# for _,v in ipairs(r) do
|
||||||
|
# table.insert(result, v) -- alternating keys and values
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# -- Set foo to 42
|
||||||
|
# table.insert(result, "foo")
|
||||||
|
# table.insert(result, "42") -- note the string, use tostring() if needed
|
||||||
|
#
|
||||||
|
# return result
|
||||||
|
|
||||||
|
serviceMonitor:
|
||||||
|
# When set true then use a ServiceMonitor to configure scraping
|
||||||
|
enabled: false
|
||||||
|
# Set the namespace the ServiceMonitor should be deployed
|
||||||
|
# namespace: "monitoring"
|
||||||
|
# Set how frequently Prometheus should scrape
|
||||||
|
# interval: 30s
|
||||||
|
# Set path to redis-exporter telemtery-path
|
||||||
|
# telemetryPath: /metrics
|
||||||
|
# Set labels for the ServiceMonitor, use this to define your scrape label for Prometheus Operator
|
||||||
|
# labels: {}
|
||||||
|
# Set timeout for scrape
|
||||||
|
# timeout: 10s
|
||||||
|
|
||||||
|
# prometheus exporter SCANS redis db which can take some time
|
||||||
|
# allow different probe settings to not let container crashloop
|
||||||
|
livenessProbe:
|
||||||
|
initialDelaySeconds: 15
|
||||||
|
timeoutSeconds: 3
|
||||||
|
periodSeconds: 15
|
||||||
|
|
||||||
|
readinessProbe:
|
||||||
|
initialDelaySeconds: 15
|
||||||
|
timeoutSeconds: 3
|
||||||
|
periodSeconds: 15
|
||||||
|
successThreshold: 2
|
||||||
|
|
||||||
|
podDisruptionBudget: {}
|
||||||
|
# Use only one of the two
|
||||||
|
# maxUnavailable: 1
|
||||||
|
# minAvailable: 1
|
||||||
|
|
||||||
|
## Configures redis with AUTH (requirepass & masterauth conf params)
|
||||||
|
auth: false
|
||||||
|
# redisPassword:
|
||||||
|
|
||||||
|
## Use existing secret containing key `authKey` (ignores redisPassword)
|
||||||
|
## Can also store AWS S3 or SSH secrets in this secret
|
||||||
|
# existingSecret:
|
||||||
|
|
||||||
|
## Defines the key holding the redis password in existing secret.
|
||||||
|
authKey: auth
|
||||||
|
|
||||||
|
persistentVolume:
|
||||||
|
enabled: true
|
||||||
|
## redis-ha data Persistent Volume Storage Class
|
||||||
|
## If defined, storageClassName: <storageClass>
|
||||||
|
## If set to "-", storageClassName: "", which disables dynamic provisioning
|
||||||
|
## If undefined (the default) or set to null, no storageClassName spec is
|
||||||
|
## set, choosing the default provisioner. (gp2 on AWS, standard on
|
||||||
|
## GKE, AWS & OpenStack)
|
||||||
|
##
|
||||||
|
# storageClass: "-"
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
size: 10Gi
|
||||||
|
annotations: {}
|
||||||
|
labels: {}
|
||||||
|
init:
|
||||||
|
resources: {}
|
||||||
|
|
||||||
|
# To use a hostPath for data, set persistentVolume.enabled to false
|
||||||
|
# and define hostPath.path.
|
||||||
|
# Warning: this might overwrite existing folders on the host system!
|
||||||
|
hostPath:
|
||||||
|
## path is evaluated as template so placeholders are replaced
|
||||||
|
# path: "/data/{{ .Release.Name }}"
|
||||||
|
|
||||||
|
# if chown is true, an init-container with root permissions is launched to
|
||||||
|
# change the owner of the hostPath folder to the user defined in the
|
||||||
|
# security context
|
||||||
|
chown: true
|
||||||
|
|
||||||
|
emptyDir: {}
|
||||||
|
|
||||||
|
tls:
|
||||||
|
## Fill the name of secret if you want to use your own TLS certificates.
|
||||||
|
## The secret should contains keys named by "tls.certFile" - the certificate, "tls.keyFile" - the private key, "tls.caCertFile" - the certificate of CA and "tls.dhParamsFile" - the dh parameter file
|
||||||
|
## These secret will be genrated using files from certs folder if the secretName is not set and redis.tlsPort is set
|
||||||
|
# secretName: tls-secret
|
||||||
|
|
||||||
|
## Name of certificate file
|
||||||
|
certFile: redis.crt
|
||||||
|
## Name of key file
|
||||||
|
keyFile: redis.key
|
||||||
|
## Name of Diffie-Hellman (DH) key exchange parameters file
|
||||||
|
# dhParamsFile: redis.dh
|
||||||
|
## Name of CA certificate file
|
||||||
|
caCertFile: ca.crt
|
||||||
|
|
||||||
|
# restore init container is executed if restore.[s3|ssh].source is not false
|
||||||
|
# restore init container creates /data/dump.rdb_ from original if exists
|
||||||
|
# restore init container overrides /data/dump.rdb
|
||||||
|
# secrets are stored into environment of init container - stored encoded on k8s
|
||||||
|
# REQUIRED for s3 restore: AWS 'access_key' and 'secret_key' or stored in existingSecret
|
||||||
|
# EXAMPLE source for s3 restore: 's3://bucket/dump.rdb'
|
||||||
|
# REQUIRED for ssh restore: 'key' should be in one line including CR i.e. '-----BEGIN RSA PRIVATE KEY-----\n...\n...\n...\n-----END RSA PRIVATE KEY-----'
|
||||||
|
# EXAMPLE source for ssh restore: 'user@server:/path/dump.rdb'
|
||||||
|
restore:
|
||||||
|
timeout: 600
|
||||||
|
# Set existingSecret to true to use secret specified in existingSecret above
|
||||||
|
existingSecret: false
|
||||||
|
s3:
|
||||||
|
source: false
|
||||||
|
# If using existingSecret, that secret must contain:
|
||||||
|
# AWS_SECRET_ACCESS_KEY: <YOUR_ACCESS_KEY:>
|
||||||
|
# AWS_ACCESS_KEY_ID: <YOUR_KEY_ID>
|
||||||
|
# If not set the key and ID as strings below:
|
||||||
|
access_key: ""
|
||||||
|
secret_key: ""
|
||||||
|
region: ""
|
||||||
|
ssh:
|
||||||
|
source: false
|
||||||
|
key: ""
|
||||||
|
|
||||||
|
## Custom PrometheusRule to be defined
|
||||||
|
## The value is evaluated as a template, so, for example, the value can depend on .Release or .Chart
|
||||||
|
## ref: https://github.com/coreos/prometheus-operator#customresourcedefinitions
|
||||||
|
prometheusRule:
|
||||||
|
# prometheusRule.enabled -- If true, creates a Prometheus Operator PrometheusRule.
|
||||||
|
enabled: false
|
||||||
|
# prometheusRule.additionalLabels -- Additional labels to be set in metadata.
|
||||||
|
additionalLabels: {}
|
||||||
|
# prometheusRule.namespace -- Namespace which Prometheus is running in.
|
||||||
|
namespace:
|
||||||
|
# prometheusRule.interval -- How often rules in the group are evaluated (falls back to `global.evaluation_interval` if not set).
|
||||||
|
interval: 10s
|
||||||
|
# prometheusRule.rules -- Rules spec template (see https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md#rule).
|
||||||
|
rules: []
|
||||||
|
# Example:
|
||||||
|
# - alert: RedisPodDown
|
||||||
|
# expr: |
|
||||||
|
# redis_up{job="{{ include "redis-ha.fullname" . }}"} == 0
|
||||||
|
# for: 5m
|
||||||
|
# labels:
|
||||||
|
# severity: critical
|
||||||
|
# annotations:
|
||||||
|
# description: Redis pod {{ "{{ $labels.pod }}" }} is down
|
||||||
|
# summary: Redis pod {{ "{{ $labels.pod }}" }} is down
|
||||||
|
|
||||||
|
extraInitContainers: []
|
||||||
|
# - name: extraInit
|
||||||
|
# image: alpine
|
||||||
|
extraContainers: []
|
||||||
|
# - name: extra
|
||||||
|
# image: alpine
|
||||||
|
extraVolumes: []
|
||||||
|
# - name: empty
|
||||||
|
# emptyDir: {}
|
||||||
|
|
||||||
|
# Labels added here are applied to all created resources
|
||||||
|
extraLabels: {}
|
||||||
|
|
||||||
|
networkPolicy:
|
||||||
|
## whether NetworkPolicy for Redis StatefulSets should be created
|
||||||
|
## when enabled, inter-Redis connectivity is created
|
||||||
|
enabled: false
|
||||||
|
annotations: {}
|
||||||
|
labels: {}
|
||||||
|
## user defines ingress rules that Redis should permit into
|
||||||
|
## uses the format defined in https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
|
||||||
|
ingressRules: []
|
||||||
|
# - selectors:
|
||||||
|
# - namespaceSelector:
|
||||||
|
# matchLabels:
|
||||||
|
# name: my-redis-client-namespace
|
||||||
|
# podSelector:
|
||||||
|
# matchLabels:
|
||||||
|
# application: redis-client
|
||||||
|
## if ports is not defined then it defaults to the ports defined for enabled services (redis, sentinel)
|
||||||
|
# ports:
|
||||||
|
# - port: 6379
|
||||||
|
# protocol: TCP
|
||||||
|
# - port: 26379
|
||||||
|
# protocol: TCP
|
||||||
|
|
||||||
|
## user can define egress rules too, uses the same structure as ingressRules
|
||||||
|
egressRules: []
|
||||||
|
|
||||||
|
splitBrainDetection:
|
||||||
|
interval: 60
|
||||||
|
resources: {}
|
|
@ -0,0 +1,74 @@
|
||||||
|
{{- if .Values.controller.args.statusProcessors }}
|
||||||
|
DEPRECATED option controller.args.statusProcessors - Use configs.params.controller.status.processors
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.controller.args.operationProcessors }}
|
||||||
|
DEPRECATED option controller.args.operationProcessors - Use configs.params.controller.operation.processors
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.controller.args.appResyncPeriod }}
|
||||||
|
DEPRECATED option controller.args.appResyncPeriod - Use server.config.timeout.reconciliation
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.controller.args.appHardResyncPeriod }}
|
||||||
|
DEPRECATED option controller.args.appHardResyncPeriod - Use server.config.timeout.hard.reconciliation
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.controller.args.selfHealTimeout }}
|
||||||
|
DEPRECATED option controller.args.selfHealTimeout - Use configs.params.controller.self.heal.timeout.seconds
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.controller.args.repoServerTimeoutSeconds }}
|
||||||
|
DEPRECATED option controller.args.repoServerTimeoutSeconds - Use configs.params.controller.repo.server.timeout.seconds
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.controller.logFormat }}
|
||||||
|
DEPRECATED option controller.logFormat - Use configs.params.controller.log.format
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.controller.logLevel }}
|
||||||
|
DEPRECATED option controller.logLevel - Use configs.params.controller.log.level
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.server.logFormat }}
|
||||||
|
DEPRECATED option server.logFormat - Use configs.params.server.log.format
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.server.logLevel }}
|
||||||
|
DEPRECATED option server.logLevel - Use configs.params.server.log.level
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.repoServer.logFormat }}
|
||||||
|
DEPRECATED option repoServer.logFormat - Use configs.params.repoServer.log.format
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.repoServer.logLevel }}
|
||||||
|
DEPRECATED option repoServer.logLevel - Use configs.params.repoServer.log.level
|
||||||
|
{{- end }}
|
||||||
|
{{- if or .Values.server.config (hasKey .Values.server "configEnabled") .Values.server.configAnnotations }}
|
||||||
|
DEPRECATED option server.config - Use configs.cm
|
||||||
|
{{- end }}
|
||||||
|
{{- if or .Values.server.rbacConfig (hasKey .Values.server "rbacConfigCreate") .Values.server.rbacConfigAnnotations }}
|
||||||
|
DEPRECATED option server.rbacConfig - Use configs.rbac
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.configs.secret.argocdServerTlsConfig }}
|
||||||
|
DEPRECATED option config.secret.argocdServerTlsConfig - Use server.certificate or server.certificateSecret
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.controller.service }}
|
||||||
|
REMOVED option controller.service - Use controller.metrics
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.repoServer.copyutil }}
|
||||||
|
REMOVED option repoSever.copyutil.resources - Use repoServer.resources
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
In order to access the server UI you have the following options:
|
||||||
|
|
||||||
|
1. kubectl port-forward service/{{ include "argo-cd.fullname" . }}-server -n {{ .Release.Namespace }} 8080:443
|
||||||
|
|
||||||
|
and then open the browser on http://localhost:8080 and accept the certificate
|
||||||
|
|
||||||
|
2. enable ingress in the values file `server.ingress.enabled` and either
|
||||||
|
- Add the annotation for ssl passthrough: https://argo-cd.readthedocs.io/en/stable/operator-manual/ingress/#option-1-ssl-passthrough
|
||||||
|
- Set the `configs.params."server.insecure"` in the values file and terminate SSL at your ingress: https://argo-cd.readthedocs.io/en/stable/operator-manual/ingress/#option-2-multiple-ingress-objects-and-hosts
|
||||||
|
|
||||||
|
|
||||||
|
{{ if eq (toString (index (coalesce .Values.server.config .Values.configs.cm) "admin.enabled")) "true" -}}
|
||||||
|
After reaching the UI the first time you can login with username: admin and the random password generated during the installation. You can find the password by running:
|
||||||
|
|
||||||
|
kubectl -n {{ .Release.Namespace }} get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d
|
||||||
|
|
||||||
|
(You should delete the initial secret afterwards as suggested by the Getting Started Guide: https://argo-cd.readthedocs.io/en/stable/getting_started/#4-login-using-the-cli)
|
||||||
|
{{ else if or (index .Values.configs.cm "dex.config") (index .Values.configs.cm "oidc.config") -}}
|
||||||
|
After reaching the UI the first time you can login using Dex or OIDC.
|
||||||
|
{{ else -}}
|
||||||
|
After reaching the UI the first time you cannot login with username and password since you've disabled it. You should enable admin back or configure Dex via `configs.cm.dex.config` or OIDC via `configs.cm.oidc.config`.
|
||||||
|
{{ end -}}
|
|
@ -0,0 +1,65 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Expand the name of the chart.
|
||||||
|
*/}}
|
||||||
|
{{- define "argo-cd.name" -}}
|
||||||
|
{{- default .Chart.Name .Values.nameOverride | 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 "argo-cd.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 chart name and version as used by the chart label.
|
||||||
|
*/}}
|
||||||
|
{{- define "argo-cd.chart" -}}
|
||||||
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create Argo CD app version
|
||||||
|
*/}}
|
||||||
|
{{- define "argo-cd.defaultTag" -}}
|
||||||
|
{{- default .Chart.AppVersion .Values.global.image.tag }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Common labels
|
||||||
|
*/}}
|
||||||
|
{{- define "argo-cd.labels" -}}
|
||||||
|
helm.sh/chart: {{ include "argo-cd.chart" .context }}
|
||||||
|
{{ include "argo-cd.selectorLabels" (dict "context" .context "component" .component "name" .name) }}
|
||||||
|
app.kubernetes.io/managed-by: {{ .context.Release.Service }}
|
||||||
|
app.kubernetes.io/part-of: argocd
|
||||||
|
{{- with .context.Values.global.additionalLabels }}
|
||||||
|
{{ toYaml . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Selector labels
|
||||||
|
*/}}
|
||||||
|
{{- define "argo-cd.selectorLabels" -}}
|
||||||
|
{{- if .name -}}
|
||||||
|
app.kubernetes.io/name: {{ include "argo-cd.name" .context }}-{{ .name }}
|
||||||
|
{{ end -}}
|
||||||
|
app.kubernetes.io/instance: {{ .context.Release.Name }}
|
||||||
|
{{- if .component }}
|
||||||
|
app.kubernetes.io/component: {{ .component }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,219 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Create controller name and version as used by the chart label.
|
||||||
|
Truncated at 52 chars because StatefulSet label 'controller-revision-hash' is limited
|
||||||
|
to 63 chars and it includes 10 chars of hash and a separating '-'.
|
||||||
|
*/}}
|
||||||
|
{{- define "argo-cd.controller.fullname" -}}
|
||||||
|
{{- printf "%s-%s" (include "argo-cd.fullname" .) .Values.controller.name | trunc 52 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create dex name and version as used by the chart label.
|
||||||
|
*/}}
|
||||||
|
{{- define "argo-cd.dex.fullname" -}}
|
||||||
|
{{- printf "%s-%s" (include "argo-cd.fullname" .) .Values.dex.name | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create Dex server endpoint
|
||||||
|
*/}}
|
||||||
|
{{- define "argo-cd.dex.server" -}}
|
||||||
|
{{- $insecure := index .Values.configs.params "dexserver.disable.tls" | toString -}}
|
||||||
|
{{- $scheme := (eq $insecure "true") | ternary "http" "https" -}}
|
||||||
|
{{- $host := include "argo-cd.dex.fullname" . -}}
|
||||||
|
{{- $port := int .Values.dex.servicePortHttp -}}
|
||||||
|
{{- printf "%s://%s:%d" $scheme $host $port }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create redis name and version as used by the chart label.
|
||||||
|
*/}}
|
||||||
|
{{- define "argo-cd.redis.fullname" -}}
|
||||||
|
{{- $redisHa := (index .Values "redis-ha") -}}
|
||||||
|
{{- $redisHaContext := dict "Chart" (dict "Name" "redis-ha") "Release" .Release "Values" $redisHa -}}
|
||||||
|
{{- if $redisHa.enabled -}}
|
||||||
|
{{- if $redisHa.haproxy.enabled -}}
|
||||||
|
{{- printf "%s-haproxy" (include "redis-ha.fullname" $redisHaContext) | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- printf "%s-%s" (include "argo-cd.fullname" .) .Values.redis.name | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return Redis server endpoint
|
||||||
|
*/}}
|
||||||
|
{{- define "argo-cd.redis.server" -}}
|
||||||
|
{{- $redisHa := (index .Values "redis-ha") -}}
|
||||||
|
{{- if or (and .Values.redis.enabled (not $redisHa.enabled)) (and $redisHa.enabled $redisHa.haproxy.enabled) }}
|
||||||
|
{{- printf "%s:%s" (include "argo-cd.redis.fullname" .) (toString .Values.redis.servicePort) }}
|
||||||
|
{{- else if and .Values.externalRedis.host .Values.externalRedis.port }}
|
||||||
|
{{- printf "%s:%s" .Values.externalRedis.host (toString .Values.externalRedis.port) }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create argocd server name and version as used by the chart label.
|
||||||
|
*/}}
|
||||||
|
{{- define "argo-cd.server.fullname" -}}
|
||||||
|
{{- printf "%s-%s" (include "argo-cd.fullname" .) .Values.server.name | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create argocd repo-server name and version as used by the chart label.
|
||||||
|
*/}}
|
||||||
|
{{- define "argo-cd.repoServer.fullname" -}}
|
||||||
|
{{- printf "%s-%s" (include "argo-cd.fullname" .) .Values.repoServer.name | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create argocd application set name and version as used by the chart label.
|
||||||
|
*/}}
|
||||||
|
{{- define "argo-cd.applicationSet.fullname" -}}
|
||||||
|
{{- printf "%s-%s" (include "argo-cd.fullname" .) .Values.applicationSet.name | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create argocd notifications name and version as used by the chart label.
|
||||||
|
*/}}
|
||||||
|
{{- define "argo-cd.notifications.fullname" -}}
|
||||||
|
{{- printf "%s-%s" (include "argo-cd.fullname" .) .Values.notifications.name | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create the name of the controller service account to use
|
||||||
|
*/}}
|
||||||
|
{{- define "argo-cd.controllerServiceAccountName" -}}
|
||||||
|
{{- if .Values.controller.serviceAccount.create -}}
|
||||||
|
{{ default (include "argo-cd.controller.fullname" .) .Values.controller.serviceAccount.name }}
|
||||||
|
{{- else -}}
|
||||||
|
{{ default "default" .Values.controller.serviceAccount.name }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create the name of the dex service account to use
|
||||||
|
*/}}
|
||||||
|
{{- define "argo-cd.dexServiceAccountName" -}}
|
||||||
|
{{- if .Values.dex.serviceAccount.create -}}
|
||||||
|
{{ default (include "argo-cd.dex.fullname" .) .Values.dex.serviceAccount.name }}
|
||||||
|
{{- else -}}
|
||||||
|
{{ default "default" .Values.dex.serviceAccount.name }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create the name of the redis service account to use
|
||||||
|
*/}}
|
||||||
|
{{- define "argo-cd.redisServiceAccountName" -}}
|
||||||
|
{{- if .Values.redis.serviceAccount.create -}}
|
||||||
|
{{ default (include "argo-cd.redis.fullname" .) .Values.redis.serviceAccount.name }}
|
||||||
|
{{- else -}}
|
||||||
|
{{ default "default" .Values.redis.serviceAccount.name }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create the name of the Argo CD server service account to use
|
||||||
|
*/}}
|
||||||
|
{{- define "argo-cd.serverServiceAccountName" -}}
|
||||||
|
{{- if .Values.server.serviceAccount.create -}}
|
||||||
|
{{ default (include "argo-cd.server.fullname" .) .Values.server.serviceAccount.name }}
|
||||||
|
{{- else -}}
|
||||||
|
{{ default "default" .Values.server.serviceAccount.name }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create the name of the repo-server service account to use
|
||||||
|
*/}}
|
||||||
|
{{- define "argo-cd.repoServerServiceAccountName" -}}
|
||||||
|
{{- if .Values.repoServer.serviceAccount.create -}}
|
||||||
|
{{ default (include "argo-cd.repoServer.fullname" .) .Values.repoServer.serviceAccount.name }}
|
||||||
|
{{- else -}}
|
||||||
|
{{ default "default" .Values.repoServer.serviceAccount.name }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create the name of the application set service account to use
|
||||||
|
*/}}
|
||||||
|
{{- define "argo-cd.applicationSetServiceAccountName" -}}
|
||||||
|
{{- if .Values.applicationSet.serviceAccount.create -}}
|
||||||
|
{{ default (include "argo-cd.applicationSet.fullname" .) .Values.applicationSet.serviceAccount.name }}
|
||||||
|
{{- else -}}
|
||||||
|
{{ default "default" .Values.applicationSet.serviceAccount.name }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create the name of the notifications service account to use
|
||||||
|
*/}}
|
||||||
|
{{- define "argo-cd.notificationsServiceAccountName" -}}
|
||||||
|
{{- if .Values.notifications.serviceAccount.create -}}
|
||||||
|
{{ default (include "argo-cd.notifications.fullname" .) .Values.notifications.serviceAccount.name }}
|
||||||
|
{{- else -}}
|
||||||
|
{{ default "default" .Values.notifications.serviceAccount.name }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create the name of the notifications bots slack service account to use
|
||||||
|
*/}}
|
||||||
|
{{- define "argo-cd.notificationsBotsSlackServiceAccountName" -}}
|
||||||
|
{{- if .Values.notifications.bots.slack.serviceAccount.create -}}
|
||||||
|
{{ default (include "argo-cd.notifications.fullname" .) .Values.notifications.bots.slack.serviceAccount.name }}
|
||||||
|
{{- else -}}
|
||||||
|
{{ default "default" .Values.notifications.bots.slack.serviceAccount.name }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Argo Configuration Preset Values (Incluenced by Values configuration)
|
||||||
|
*/}}
|
||||||
|
{{- define "argo-cd.config.cm.presets" -}}
|
||||||
|
{{- if .Values.configs.styles -}}
|
||||||
|
ui.cssurl: "./custom/custom.styles.css"
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Merge Argo Configuration with Preset Configuration
|
||||||
|
*/}}
|
||||||
|
{{- define "argo-cd.config.cm" -}}
|
||||||
|
{{- $config := (mergeOverwrite (deepCopy (omit .Values.configs.cm "create" "annotations")) (.Values.server.config | default dict)) -}}
|
||||||
|
{{- $preset := include "argo-cd.config.cm.presets" . | fromYaml | default dict -}}
|
||||||
|
{{- range $key, $value := mergeOverwrite $preset $config }}
|
||||||
|
{{ $key }}: {{ toString $value | toYaml }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Argo Params Default Configuration Presets
|
||||||
|
*/}}
|
||||||
|
{{- define "argo-cd.config.params.presets" -}}
|
||||||
|
repo.server: "{{ include "argo-cd.repoServer.fullname" . }}:{{ .Values.repoServer.service.port }}"
|
||||||
|
{{- with include "argo-cd.redis.server" . }}
|
||||||
|
redis.server: {{ . | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.dex.enabled }}
|
||||||
|
server.dex.server: {{ include "argo-cd.dex.server" . | quote }}
|
||||||
|
server.dex.server.strict.tls: {{ .Values.dex.certificateSecret.enabled | toString }}
|
||||||
|
{{- end }}
|
||||||
|
{{- range $component := tuple "controller" "server" "reposerver" }}
|
||||||
|
{{ $component }}.log.format: {{ $.Values.global.logging.format | quote }}
|
||||||
|
{{ $component }}.log.level: {{ $.Values.global.logging.level | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Merge Argo Params Configuration with Preset Configuration
|
||||||
|
*/}}
|
||||||
|
{{- define "argo-cd.config.params" -}}
|
||||||
|
{{- $config := omit .Values.configs.params "annotations" }}
|
||||||
|
{{- $preset := include "argo-cd.config.params.presets" . | fromYaml | default dict -}}
|
||||||
|
{{- range $key, $value := mergeOverwrite $preset $config }}
|
||||||
|
{{ $key }}: {{ toString $value | toYaml }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
|
@ -0,0 +1,78 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Return the target Kubernetes version
|
||||||
|
*/}}
|
||||||
|
{{- define "argo-cd.kubeVersion" -}}
|
||||||
|
{{- default .Capabilities.KubeVersion.Version .Values.kubeVersionOverride }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the appropriate apiVersion for autoscaling
|
||||||
|
*/}}
|
||||||
|
{{- define "argo-cd.apiVersion.autoscaling" -}}
|
||||||
|
{{- if .Values.apiVersionOverrides.autoscaling -}}
|
||||||
|
{{- print .Values.apiVersionOverrides.autoscaling -}}
|
||||||
|
{{- else if semverCompare "<1.23-0" (include "argo-cd.kubeVersion" .) -}}
|
||||||
|
{{- print "autoscaling/v2beta1" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- print "autoscaling/v2" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the appropriate apiVersion for ingress
|
||||||
|
*/}}
|
||||||
|
{{- define "argo-cd.apiVersion.ingress" -}}
|
||||||
|
{{- if .Values.apiVersionOverrides.ingress -}}
|
||||||
|
{{- print .Values.apiVersionOverrides.ingress -}}
|
||||||
|
{{- else if semverCompare "<1.14-0" (include "argo-cd.kubeVersion" .) -}}
|
||||||
|
{{- print "extensions/v1beta1" -}}
|
||||||
|
{{- else if semverCompare "<1.19-0" (include "argo-cd.kubeVersion" .) -}}
|
||||||
|
{{- print "networking.k8s.io/v1beta1" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- print "networking.k8s.io/v1" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the appropriate apiVersion for pod disruption budget
|
||||||
|
*/}}
|
||||||
|
{{- define "argo-cd.apiVersion.pdb" -}}
|
||||||
|
{{- if .Values.apiVersionOverrides.pdb -}}
|
||||||
|
{{- print .Values.apiVersionOverrides.pdb -}}
|
||||||
|
{{- else if semverCompare "<1.21-0" (include "argo-cd.kubeVersion" .) -}}
|
||||||
|
{{- print "policy/v1beta1" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- print "policy/v1" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the appropriate apiVersion for cert-manager
|
||||||
|
*/}}
|
||||||
|
{{- define "argo-cd.apiVersion.cert-manager" -}}
|
||||||
|
{{- if .Values.apiVersionOverrides.certmanager -}}
|
||||||
|
{{- print .Values.apiVersionOverrides.certmanager -}}
|
||||||
|
{{- else if .Capabilities.APIVersions.Has "cert-manager.io/v1" -}}
|
||||||
|
{{- print "cert-manager.io/v1" -}}
|
||||||
|
{{- else if .Capabilities.APIVersions.Has "cert-manager.io/v1alpha3" -}}
|
||||||
|
{{- print "cert-manager.io/v1alpha3" -}}
|
||||||
|
{{- else if .Capabilities.APIVersions.Has "cert-manager.io/v1alpha2" -}}
|
||||||
|
{{- print "cert-manager.io/v1alpha2" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- print "certmanager.k8s.io/v1alpha1" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the appropriate apiVersion for GKE resources
|
||||||
|
*/}}
|
||||||
|
{{- define "argo-cd.apiVersions.cloudgoogle" -}}
|
||||||
|
{{- if .Values.apiVersionOverrides.cloudgoogle -}}
|
||||||
|
{{- print .Values.apiVersionOverrides.cloudgoogle -}}
|
||||||
|
{{- else if .Capabilities.APIVersions.Has "cloud.google.com/v1" -}}
|
||||||
|
{{- print "cloud.google.com/v1" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- print "cloud.google.com/v1beta1" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
|
@ -0,0 +1,70 @@
|
||||||
|
{{- if .Values.createAggregateRoles }}
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: ClusterRole
|
||||||
|
metadata:
|
||||||
|
name: {{ include "argo-cd.fullname" . }}-aggregate-to-view
|
||||||
|
labels:
|
||||||
|
rbac.authorization.k8s.io/aggregate-to-view: "true"
|
||||||
|
{{- include "argo-cd.labels" (dict "context" .) | nindent 4 }}
|
||||||
|
rules:
|
||||||
|
- apiGroups:
|
||||||
|
- argoproj.io
|
||||||
|
resources:
|
||||||
|
- applications
|
||||||
|
- applicationsets
|
||||||
|
- appprojects
|
||||||
|
verbs:
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- watch
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: ClusterRole
|
||||||
|
metadata:
|
||||||
|
name: {{ include "argo-cd.fullname" . }}-aggregate-to-edit
|
||||||
|
labels:
|
||||||
|
rbac.authorization.k8s.io/aggregate-to-edit: "true"
|
||||||
|
{{- include "argo-cd.labels" (dict "context" .) | nindent 4 }}
|
||||||
|
rules:
|
||||||
|
- apiGroups:
|
||||||
|
- argoproj.io
|
||||||
|
resources:
|
||||||
|
- applications
|
||||||
|
- applicationsets
|
||||||
|
- appprojects
|
||||||
|
verbs:
|
||||||
|
- create
|
||||||
|
- delete
|
||||||
|
- deletecollection
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- patch
|
||||||
|
- update
|
||||||
|
- watch
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: ClusterRole
|
||||||
|
metadata:
|
||||||
|
name: {{ include "argo-cd.fullname" . }}-aggregate-to-admin
|
||||||
|
labels:
|
||||||
|
rbac.authorization.k8s.io/aggregate-to-admin: "true"
|
||||||
|
{{- include "argo-cd.labels" (dict "context" .) | nindent 4 }}
|
||||||
|
rules:
|
||||||
|
- apiGroups:
|
||||||
|
- argoproj.io
|
||||||
|
resources:
|
||||||
|
- applications
|
||||||
|
- applicationsets
|
||||||
|
- appprojects
|
||||||
|
verbs:
|
||||||
|
- create
|
||||||
|
- delete
|
||||||
|
- deletecollection
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- patch
|
||||||
|
- update
|
||||||
|
- watch
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,23 @@
|
||||||
|
{{- if .Values.controller.clusterAdminAccess.enabled }}
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: ClusterRole
|
||||||
|
metadata:
|
||||||
|
name: {{ template "argo-cd.controller.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.controller.name "name" .Values.controller.name) | nindent 4 }}
|
||||||
|
rules:
|
||||||
|
{{- if .Values.controller.clusterRoleRules.enabled }}
|
||||||
|
{{- toYaml .Values.controller.clusterRoleRules.rules | nindent 0 }}
|
||||||
|
{{- else }}
|
||||||
|
- apiGroups:
|
||||||
|
- '*'
|
||||||
|
resources:
|
||||||
|
- '*'
|
||||||
|
verbs:
|
||||||
|
- '*'
|
||||||
|
- nonResourceURLs:
|
||||||
|
- '*'
|
||||||
|
verbs:
|
||||||
|
- '*'
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,16 @@
|
||||||
|
{{- if .Values.controller.clusterAdminAccess.enabled }}
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: ClusterRoleBinding
|
||||||
|
metadata:
|
||||||
|
name: {{ template "argo-cd.controller.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.controller.name "name" .Values.controller.name) | nindent 4 }}
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: ClusterRole
|
||||||
|
name: {{ template "argo-cd.controller.fullname" . }}
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: {{ template "argo-cd.controllerServiceAccountName" . }}
|
||||||
|
namespace: {{ .Release.Namespace }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,25 @@
|
||||||
|
{{- if .Values.controller.metrics.enabled }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ include "argo-cd.controller.fullname" . }}-metrics
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.controller.name "name" "metrics") | nindent 4 }}
|
||||||
|
{{- with .Values.controller.metrics.service.labels }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.controller.metrics.service.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- range $key, $value := . }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- name: {{ .Values.controller.metrics.service.portName }}
|
||||||
|
protocol: TCP
|
||||||
|
port: {{ .Values.controller.metrics.service.servicePort }}
|
||||||
|
targetPort: metrics
|
||||||
|
selector:
|
||||||
|
{{- include "argo-cd.selectorLabels" (dict "context" . "name" .Values.controller.name) | nindent 4 }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,19 @@
|
||||||
|
{{- if .Values.global.networkPolicy.create }}
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.controller.name "name" .Values.controller.name) | nindent 4 }}
|
||||||
|
name: {{ template "argo-cd.controller.fullname" . }}
|
||||||
|
spec:
|
||||||
|
ingress:
|
||||||
|
- from:
|
||||||
|
- namespaceSelector: {}
|
||||||
|
ports:
|
||||||
|
- port: metrics
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "argo-cd.selectorLabels" (dict "context" . "name" .Values.controller.name) | nindent 6 }}
|
||||||
|
policyTypes:
|
||||||
|
- Ingress
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,26 @@
|
||||||
|
{{- if .Values.controller.pdb.enabled }}
|
||||||
|
apiVersion: {{ include "argo-cd.apiVersion.pdb" . }}
|
||||||
|
kind: PodDisruptionBudget
|
||||||
|
metadata:
|
||||||
|
name: {{ include "argo-cd.controller.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.controller.name "name" .Values.controller.name) | nindent 4 }}
|
||||||
|
{{- with .Values.controller.pdb.labels }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.controller.pdb.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- range $key, $value := . }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
{{- with .Values.controller.pdb.maxUnavailable }}
|
||||||
|
maxUnavailable: {{ . }}
|
||||||
|
{{- else }}
|
||||||
|
minAvailable: {{ .Values.controller.pdb.minAvailable | default 0 }}
|
||||||
|
{{- end }}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "argo-cd.selectorLabels" (dict "context" . "name" .Values.controller.name) | nindent 6 }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,22 @@
|
||||||
|
{{- if and .Values.controller.metrics.enabled .Values.controller.metrics.rules.enabled }}
|
||||||
|
apiVersion: monitoring.coreos.com/v1
|
||||||
|
kind: PrometheusRule
|
||||||
|
metadata:
|
||||||
|
name: {{ template "argo-cd.controller.fullname" . }}
|
||||||
|
{{- if .Values.controller.metrics.rules.namespace }}
|
||||||
|
namespace: {{ .Values.controller.metrics.rules.namespace }}
|
||||||
|
{{- end }}
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.controller.name "name" .Values.controller.name) | nindent 4 }}
|
||||||
|
{{- if .Values.controller.metrics.rules.selector }}
|
||||||
|
{{- toYaml .Values.controller.metrics.rules.selector | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.controller.metrics.rules.additionalLabels }}
|
||||||
|
{{- toYaml .Values.controller.metrics.rules.additionalLabels | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
groups:
|
||||||
|
- name: argocd
|
||||||
|
rules:
|
||||||
|
{{- toYaml .Values.controller.metrics.rules.spec | nindent 4 }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,36 @@
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: Role
|
||||||
|
metadata:
|
||||||
|
name: {{ template "argo-cd.controller.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.controller.name "name" .Values.controller.name) | nindent 4 }}
|
||||||
|
rules:
|
||||||
|
- apiGroups:
|
||||||
|
- ""
|
||||||
|
resources:
|
||||||
|
- secrets
|
||||||
|
- configmaps
|
||||||
|
verbs:
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- watch
|
||||||
|
- apiGroups:
|
||||||
|
- argoproj.io
|
||||||
|
resources:
|
||||||
|
- applications
|
||||||
|
- appprojects
|
||||||
|
verbs:
|
||||||
|
- create
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- watch
|
||||||
|
- update
|
||||||
|
- patch
|
||||||
|
- delete
|
||||||
|
- apiGroups:
|
||||||
|
- ""
|
||||||
|
resources:
|
||||||
|
- events
|
||||||
|
verbs:
|
||||||
|
- create
|
||||||
|
- list
|
|
@ -0,0 +1,14 @@
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: RoleBinding
|
||||||
|
metadata:
|
||||||
|
name: {{ template "argo-cd.controller.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.controller.name "name" .Values.controller.name) | nindent 4 }}
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: Role
|
||||||
|
name: {{ template "argo-cd.controller.fullname" . }}
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: {{ template "argo-cd.controllerServiceAccountName" . }}
|
||||||
|
namespace: {{ .Release.Namespace }}
|
|
@ -0,0 +1,18 @@
|
||||||
|
{{- if .Values.controller.serviceAccount.create }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
automountServiceAccountToken: {{ .Values.controller.serviceAccount.automountServiceAccountToken }}
|
||||||
|
metadata:
|
||||||
|
name: {{ template "argo-cd.controllerServiceAccountName" . }}
|
||||||
|
{{- if .Values.controller.serviceAccount.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- range $key, $value := .Values.controller.serviceAccount.annotations }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.controller.name "name" .Values.controller.name) | nindent 4 }}
|
||||||
|
{{- range $key, $value := .Values.controller.serviceAccount.labels }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,49 @@
|
||||||
|
{{- if and .Values.controller.metrics.enabled .Values.controller.metrics.serviceMonitor.enabled }}
|
||||||
|
apiVersion: monitoring.coreos.com/v1
|
||||||
|
kind: ServiceMonitor
|
||||||
|
metadata:
|
||||||
|
name: {{ template "argo-cd.controller.fullname" . }}
|
||||||
|
{{- with .Values.controller.metrics.serviceMonitor.namespace }}
|
||||||
|
namespace: {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.controller.name "name" .Values.controller.name) | nindent 4 }}
|
||||||
|
{{- with .Values.controller.metrics.serviceMonitor.selector }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.controller.metrics.serviceMonitor.additionalLabels }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.controller.metrics.serviceMonitor.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
endpoints:
|
||||||
|
- port: {{ .Values.controller.metrics.service.portName }}
|
||||||
|
{{- with .Values.controller.metrics.serviceMonitor.interval }}
|
||||||
|
interval: {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
path: /metrics
|
||||||
|
{{- with .Values.controller.metrics.serviceMonitor.relabelings }}
|
||||||
|
relabelings:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.controller.metrics.serviceMonitor.metricRelabelings }}
|
||||||
|
metricRelabelings:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.controller.metrics.serviceMonitor.scheme }}
|
||||||
|
scheme: {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.controller.metrics.serviceMonitor.tlsConfig }}
|
||||||
|
tlsConfig:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
namespaceSelector:
|
||||||
|
matchNames:
|
||||||
|
- {{ .Release.Namespace }}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "argo-cd.selectorLabels" (dict "context" . "component" .Values.controller.name "name" "metrics") | nindent 6 }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,307 @@
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: StatefulSet
|
||||||
|
metadata:
|
||||||
|
name: {{ include "argo-cd.controller.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.controller.name "name" .Values.controller.name) | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
replicas: {{ .Values.controller.replicas }}
|
||||||
|
# TODO: Remove for breaking release as history limit cannot be patched
|
||||||
|
revisionHistoryLimit: 5
|
||||||
|
serviceName: {{ include "argo-cd.controller.fullname" . }}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "argo-cd.selectorLabels" (dict "context" . "name" .Values.controller.name) | nindent 6 }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
checksum/cmd-params: {{ include (print $.Template.BasePath "/argocd-configs/argocd-cmd-params-cm.yaml") . | sha256sum }}
|
||||||
|
{{- with (mergeOverwrite (deepCopy .Values.global.podAnnotations) .Values.controller.podAnnotations) }}
|
||||||
|
{{- range $key, $value := . }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.controller.name "name" .Values.controller.name) | nindent 8 }}
|
||||||
|
{{- with (mergeOverwrite (deepCopy .Values.global.podLabels) .Values.controller.podLabels) }}
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
{{- with .Values.controller.imagePullSecrets | default .Values.global.imagePullSecrets }}
|
||||||
|
imagePullSecrets:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.global.securityContext }}
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
containers:
|
||||||
|
- command:
|
||||||
|
- argocd-application-controller
|
||||||
|
{{- with .Values.controller.args.statusProcessors }}
|
||||||
|
- --status-processors
|
||||||
|
- {{ . | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.controller.args.operationProcessors }}
|
||||||
|
- --operation-processors
|
||||||
|
- {{ . | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.controller.args.appResyncPeriod }}
|
||||||
|
- --app-resync
|
||||||
|
- {{ . | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.controller.args.appHardResyncPeriod }}
|
||||||
|
- --app-hard-resync
|
||||||
|
- {{ . | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.controller.args.selfHealTimeout }}
|
||||||
|
- --self-heal-timeout-seconds
|
||||||
|
- {{ . | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.controller.args.repoServerTimeoutSeconds }}
|
||||||
|
- --repo-server-timeout-seconds
|
||||||
|
- {{ . | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.controller.logFormat }}
|
||||||
|
- --logformat
|
||||||
|
- {{ . | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.controller.logLevel }}
|
||||||
|
- --loglevel
|
||||||
|
- {{ . | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.controller.metrics.applicationLabels.enabled }}
|
||||||
|
{{- range .Values.controller.metrics.applicationLabels.labels }}
|
||||||
|
- --metrics-application-labels
|
||||||
|
- {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.controller.extraArgs }}
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
image: {{ default .Values.global.image.repository .Values.controller.image.repository }}:{{ default (include "argo-cd.defaultTag" .) .Values.controller.image.tag }}
|
||||||
|
imagePullPolicy: {{ default .Values.global.image.imagePullPolicy .Values.controller.image.imagePullPolicy }}
|
||||||
|
name: {{ .Values.controller.name }}
|
||||||
|
env:
|
||||||
|
{{- with .Values.controller.env }}
|
||||||
|
{{- toYaml . | nindent 10 }}
|
||||||
|
{{- end }}
|
||||||
|
- name: ARGOCD_CONTROLLER_REPLICAS
|
||||||
|
value: {{ .Values.controller.replicas | quote }}
|
||||||
|
- name: ARGOCD_RECONCILIATION_TIMEOUT
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: argocd-cm
|
||||||
|
key: timeout.reconciliation
|
||||||
|
optional: true
|
||||||
|
- name: ARGOCD_HARD_RECONCILIATION_TIMEOUT
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: argocd-cm
|
||||||
|
key: timeout.hard.reconciliation
|
||||||
|
optional: true
|
||||||
|
- name: ARGOCD_APPLICATION_CONTROLLER_REPO_SERVER
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: argocd-cmd-params-cm
|
||||||
|
key: repo.server
|
||||||
|
optional: true
|
||||||
|
- name: ARGOCD_APPLICATION_CONTROLLER_REPO_SERVER_TIMEOUT_SECONDS
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: argocd-cmd-params-cm
|
||||||
|
key: controller.repo.server.timeout.seconds
|
||||||
|
optional: true
|
||||||
|
- name: ARGOCD_APPLICATION_CONTROLLER_STATUS_PROCESSORS
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: argocd-cmd-params-cm
|
||||||
|
key: controller.status.processors
|
||||||
|
optional: true
|
||||||
|
- name: ARGOCD_APPLICATION_CONTROLLER_OPERATION_PROCESSORS
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: argocd-cmd-params-cm
|
||||||
|
key: controller.operation.processors
|
||||||
|
optional: true
|
||||||
|
- name: ARGOCD_APPLICATION_CONTROLLER_LOGFORMAT
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: argocd-cmd-params-cm
|
||||||
|
key: controller.log.format
|
||||||
|
optional: true
|
||||||
|
- name: ARGOCD_APPLICATION_CONTROLLER_LOGLEVEL
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: argocd-cmd-params-cm
|
||||||
|
key: controller.log.level
|
||||||
|
optional: true
|
||||||
|
- name: ARGOCD_APPLICATION_CONTROLLER_METRICS_CACHE_EXPIRATION
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: argocd-cmd-params-cm
|
||||||
|
key: controller.metrics.cache.expiration
|
||||||
|
optional: true
|
||||||
|
- name: ARGOCD_APPLICATION_CONTROLLER_SELF_HEAL_TIMEOUT_SECONDS
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: argocd-cmd-params-cm
|
||||||
|
key: controller.self.heal.timeout.seconds
|
||||||
|
optional: true
|
||||||
|
- name: ARGOCD_APPLICATION_CONTROLLER_REPO_SERVER_PLAINTEXT
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: argocd-cmd-params-cm
|
||||||
|
key: controller.repo.server.plaintext
|
||||||
|
optional: true
|
||||||
|
- name: ARGOCD_APPLICATION_CONTROLLER_REPO_SERVER_STRICT_TLS
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: argocd-cmd-params-cm
|
||||||
|
key: controller.repo.server.strict.tls
|
||||||
|
optional: true
|
||||||
|
- name: ARGOCD_APPLICATION_CONTROLLER_PERSIST_RESOURCE_HEALTH
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: argocd-cmd-params-cm
|
||||||
|
key: controller.resource.health.persist
|
||||||
|
optional: true
|
||||||
|
- name: ARGOCD_APP_STATE_CACHE_EXPIRATION
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: argocd-cmd-params-cm
|
||||||
|
key: controller.app.state.cache.expiration
|
||||||
|
optional: true
|
||||||
|
- name: REDIS_SERVER
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: argocd-cmd-params-cm
|
||||||
|
key: redis.server
|
||||||
|
optional: true
|
||||||
|
- name: REDIS_COMPRESSION
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: argocd-cmd-params-cm
|
||||||
|
key: redis.compression
|
||||||
|
optional: true
|
||||||
|
- name: REDISDB
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: argocd-cmd-params-cm
|
||||||
|
key: redis.db
|
||||||
|
optional: true
|
||||||
|
- name: REDIS_USERNAME
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ default (include "argo-cd.redis.fullname" .) .Values.externalRedis.existingSecret }}
|
||||||
|
key: redis-username
|
||||||
|
optional: true
|
||||||
|
- name: REDIS_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ default (include "argo-cd.redis.fullname" .) .Values.externalRedis.existingSecret }}
|
||||||
|
key: redis-password
|
||||||
|
optional: true
|
||||||
|
- name: ARGOCD_DEFAULT_CACHE_EXPIRATION
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: argocd-cmd-params-cm
|
||||||
|
key: controller.default.cache.expiration
|
||||||
|
optional: true
|
||||||
|
- name: ARGOCD_APPLICATION_CONTROLLER_OTLP_ADDRESS
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: argocd-cmd-params-cm
|
||||||
|
key: otlp.address
|
||||||
|
optional: true
|
||||||
|
- name: ARGOCD_APPLICATION_NAMESPACES
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: argocd-cmd-params-cm
|
||||||
|
key: application.namespaces
|
||||||
|
optional: true
|
||||||
|
{{- with .Values.controller.envFrom }}
|
||||||
|
envFrom:
|
||||||
|
{{- toYaml . | nindent 10 }}
|
||||||
|
{{- end }}
|
||||||
|
ports:
|
||||||
|
- name: metrics
|
||||||
|
containerPort: {{ .Values.controller.containerPort }}
|
||||||
|
protocol: TCP
|
||||||
|
readinessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /healthz
|
||||||
|
port: metrics
|
||||||
|
initialDelaySeconds: {{ .Values.controller.readinessProbe.initialDelaySeconds }}
|
||||||
|
periodSeconds: {{ .Values.controller.readinessProbe.periodSeconds }}
|
||||||
|
timeoutSeconds: {{ .Values.controller.readinessProbe.timeoutSeconds }}
|
||||||
|
successThreshold: {{ .Values.controller.readinessProbe.successThreshold }}
|
||||||
|
failureThreshold: {{ .Values.controller.readinessProbe.failureThreshold }}
|
||||||
|
resources:
|
||||||
|
{{- toYaml .Values.controller.resources | nindent 10 }}
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml .Values.controller.containerSecurityContext | nindent 10 }}
|
||||||
|
workingDir: /home/argocd
|
||||||
|
volumeMounts:
|
||||||
|
{{- with .Values.controller.volumeMounts }}
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
- mountPath: /app/config/controller/tls
|
||||||
|
name: argocd-repo-server-tls
|
||||||
|
- mountPath: /home/argocd
|
||||||
|
name: argocd-home
|
||||||
|
{{- with .Values.controller.extraContainers }}
|
||||||
|
{{- toYaml . | nindent 6 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.controller.nodeSelector }}
|
||||||
|
nodeSelector:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.controller.tolerations }}
|
||||||
|
tolerations:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.controller.affinity }}
|
||||||
|
affinity:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.controller.topologySpreadConstraints }}
|
||||||
|
topologySpreadConstraints:
|
||||||
|
{{- range $constraint := . }}
|
||||||
|
- {{ toYaml $constraint | nindent 8 | trim }}
|
||||||
|
{{- if not $constraint.labelSelector }}
|
||||||
|
labelSelector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "argo-cd.selectorLabels" (dict "context" $ "name" $.Values.controller.name) | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
serviceAccountName: {{ template "argo-cd.controllerServiceAccountName" . }}
|
||||||
|
{{- with .Values.global.hostAliases }}
|
||||||
|
hostAliases:
|
||||||
|
{{- toYaml . | nindent 6 }}
|
||||||
|
{{- end }}
|
||||||
|
volumes:
|
||||||
|
{{- with .Values.controller.volumes }}
|
||||||
|
{{- toYaml . | nindent 6 }}
|
||||||
|
{{- end }}
|
||||||
|
- name: argocd-home
|
||||||
|
emptyDir: {}
|
||||||
|
- name: argocd-repo-server-tls
|
||||||
|
secret:
|
||||||
|
secretName: argocd-repo-server-tls
|
||||||
|
optional: true
|
||||||
|
items:
|
||||||
|
- key: tls.crt
|
||||||
|
path: tls.crt
|
||||||
|
- key: tls.key
|
||||||
|
path: tls.key
|
||||||
|
- key: ca.crt
|
||||||
|
path: ca.crt
|
||||||
|
{{- with .Values.controller.initContainers }}
|
||||||
|
initContainers:
|
||||||
|
{{- toYaml . | nindent 6 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.controller.priorityClassName }}
|
||||||
|
priorityClassName: {{ . }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,155 @@
|
||||||
|
{{- if .Values.applicationSet.enabled }}
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: {{ include "argo-cd.applicationSet.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.applicationSet.name "name" .Values.applicationSet.name) | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
replicas: {{ .Values.applicationSet.replicaCount }}
|
||||||
|
revisionHistoryLimit: {{ .Values.global.revisionHistoryLimit }}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "argo-cd.selectorLabels" (dict "context" . "name" .Values.applicationSet.name) | nindent 6 }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
{{- with (mergeOverwrite (deepCopy .Values.global.podAnnotations) .Values.applicationSet.podAnnotations) }}
|
||||||
|
annotations:
|
||||||
|
{{- range $key, $value := . }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.applicationSet.name "name" .Values.applicationSet.name) | nindent 8 }}
|
||||||
|
{{- with (mergeOverwrite (deepCopy .Values.global.podLabels) .Values.applicationSet.podLabels) }}
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
{{- with .Values.applicationSet.imagePullSecrets | default .Values.global.imagePullSecrets }}
|
||||||
|
imagePullSecrets:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.global.securityContext }}
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
serviceAccountName: {{ include "argo-cd.applicationSetServiceAccountName" . }}
|
||||||
|
containers:
|
||||||
|
- name: {{ .Values.applicationSet.name }}
|
||||||
|
image: {{ default .Values.global.image.repository .Values.applicationSet.image.repository }}:{{ default (include "argo-cd.defaultTag" .) .Values.applicationSet.image.tag }}
|
||||||
|
imagePullPolicy: {{ default .Values.global.image.imagePullPolicy .Values.applicationSet.image.imagePullPolicy }}
|
||||||
|
command:
|
||||||
|
- entrypoint.sh
|
||||||
|
- argocd-applicationset-controller
|
||||||
|
- --logformat
|
||||||
|
- {{ default .Values.global.logging.format .Values.applicationSet.logFormat }}
|
||||||
|
- --loglevel
|
||||||
|
- {{ default .Values.global.logging.level .Values.applicationSet.logLevel }}
|
||||||
|
- --metrics-addr={{ .Values.applicationSet.args.metricsAddr }}
|
||||||
|
- --probe-addr={{ .Values.applicationSet.args.probeBindAddr }}
|
||||||
|
{{- if or (gt ( .Values.applicationSet.replicaCount | int64) 1) .Values.applicationSet.args.enableLeaderElection }}
|
||||||
|
- --enable-leader-election=true
|
||||||
|
{{- end }}
|
||||||
|
- --argocd-repo-server={{ template "argo-cd.repoServer.fullname" . }}:{{ .Values.repoServer.service.port }}
|
||||||
|
- --policy={{ .Values.applicationSet.args.policy }}
|
||||||
|
- --debug={{ .Values.applicationSet.args.debug }}
|
||||||
|
- --dry-run={{ .Values.applicationSet.args.dryRun }}
|
||||||
|
{{- with .Values.applicationSet.extraArgs }}
|
||||||
|
{{- toYaml . | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
env:
|
||||||
|
{{- with .Values.applicationSet.extraEnv }}
|
||||||
|
{{- toYaml . | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
- name: NAMESPACE
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: metadata.namespace
|
||||||
|
{{- with .Values.applicationSet.extraEnvFrom }}
|
||||||
|
envFrom:
|
||||||
|
{{- toYaml . | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
ports:
|
||||||
|
- name: metrics
|
||||||
|
containerPort: {{ (split ":" .Values.applicationSet.args.metricsAddr)._1 }}
|
||||||
|
protocol: TCP
|
||||||
|
- name: probe
|
||||||
|
containerPort: {{ (split ":" .Values.applicationSet.args.probeBindAddr)._1 }}
|
||||||
|
protocol: TCP
|
||||||
|
- name: webhook
|
||||||
|
containerPort: 7000
|
||||||
|
protocol: TCP
|
||||||
|
{{- if .Values.applicationSet.livenessProbe.enabled }}
|
||||||
|
livenessProbe:
|
||||||
|
tcpSocket:
|
||||||
|
port: probe
|
||||||
|
initialDelaySeconds: {{ .Values.applicationSet.livenessProbe.initialDelaySeconds }}
|
||||||
|
periodSeconds: {{ .Values.applicationSet.livenessProbe.periodSeconds }}
|
||||||
|
timeoutSeconds: {{ .Values.applicationSet.livenessProbe.timeoutSeconds }}
|
||||||
|
successThreshold: {{ .Values.applicationSet.livenessProbe.successThreshold }}
|
||||||
|
failureThreshold: {{ .Values.applicationSet.livenessProbe.failureThreshold }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.applicationSet.readinessProbe.enabled }}
|
||||||
|
readinessProbe:
|
||||||
|
tcpSocket:
|
||||||
|
port: probe
|
||||||
|
initialDelaySeconds: {{ .Values.applicationSet.readinessProbe.initialDelaySeconds }}
|
||||||
|
periodSeconds: {{ .Values.applicationSet.readinessProbe.periodSeconds }}
|
||||||
|
timeoutSeconds: {{ .Values.applicationSet.readinessProbe.timeoutSeconds }}
|
||||||
|
successThreshold: {{ .Values.applicationSet.readinessProbe.successThreshold }}
|
||||||
|
failureThreshold: {{ .Values.applicationSet.readinessProbe.failureThreshold }}
|
||||||
|
{{- end }}
|
||||||
|
resources:
|
||||||
|
{{- toYaml .Values.applicationSet.resources | nindent 12 }}
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml .Values.applicationSet.containerSecurityContext | nindent 12 }}
|
||||||
|
volumeMounts:
|
||||||
|
{{- with .Values.applicationSet.extraVolumeMounts }}
|
||||||
|
{{- toYaml . | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
- mountPath: /app/config/ssh
|
||||||
|
name: ssh-known-hosts
|
||||||
|
- mountPath: /app/config/tls
|
||||||
|
name: tls-certs
|
||||||
|
- mountPath: /app/config/gpg/source
|
||||||
|
name: gpg-keys
|
||||||
|
- mountPath: /app/config/gpg/keys
|
||||||
|
name: gpg-keyring
|
||||||
|
- mountPath: /tmp
|
||||||
|
name: tmp
|
||||||
|
{{- with .Values.applicationSet.extraContainers }}
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.applicationSet.nodeSelector }}
|
||||||
|
nodeSelector:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.applicationSet.affinity }}
|
||||||
|
affinity:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.applicationSet.tolerations }}
|
||||||
|
tolerations:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.applicationSet.priorityClassName }}
|
||||||
|
priorityClassName: {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
volumes:
|
||||||
|
{{- with .Values.applicationSet.extraVolumes }}
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
- name: ssh-known-hosts
|
||||||
|
configMap:
|
||||||
|
name: argocd-ssh-known-hosts-cm
|
||||||
|
- name: tls-certs
|
||||||
|
configMap:
|
||||||
|
name: argocd-tls-certs-cm
|
||||||
|
- name: gpg-keys
|
||||||
|
configMap:
|
||||||
|
name: argocd-gpg-keys-cm
|
||||||
|
- name: gpg-keyring
|
||||||
|
emptyDir: {}
|
||||||
|
- name: tmp
|
||||||
|
emptyDir: {}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,25 @@
|
||||||
|
{{- if and .Values.applicationSet.enabled .Values.applicationSet.metrics.enabled }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ include "argo-cd.applicationSet.fullname" . }}-metrics
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.applicationSet.name "name" "metrics") | nindent 4 }}
|
||||||
|
{{- with .Values.applicationSet.metrics.service.labels }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.applicationSet.metrics.service.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- range $key, $value := . }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- name: {{ .Values.applicationSet.metrics.service.portName }}
|
||||||
|
protocol: TCP
|
||||||
|
port: {{ .Values.applicationSet.metrics.service.servicePort }}
|
||||||
|
targetPort: metrics
|
||||||
|
selector:
|
||||||
|
{{- include "argo-cd.selectorLabels" (dict "context" . "name" .Values.applicationSet.name) | nindent 4 }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,25 @@
|
||||||
|
{{- if and .Values.applicationSet.enabled .Values.global.networkPolicy.create (or .Values.applicationSet.metrics.enabled .Values.applicationSet.webhook.ingress.enabled) }}
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: {{ template "argo-cd.applicationSet.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.applicationSet.name "name" .Values.applicationSet.name) | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
ingress:
|
||||||
|
{{- if .Values.applicationSet.webhook.ingress.enabled }}
|
||||||
|
- ports:
|
||||||
|
- port: webhook
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.applicationSet.metrics.enabled }}
|
||||||
|
- from:
|
||||||
|
- namespaceSelector: {}
|
||||||
|
ports:
|
||||||
|
- port: metrics
|
||||||
|
{{- end }}
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "argo-cd.selectorLabels" (dict "context" . "name" .Values.applicationSet.name) | nindent 6 }}
|
||||||
|
policyTypes:
|
||||||
|
- Ingress
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,26 @@
|
||||||
|
{{- if and .Values.applicationSet.enabled .Values.applicationSet.pdb.enabled }}
|
||||||
|
apiVersion: {{ include "argo-cd.apiVersion.pdb" . }}
|
||||||
|
kind: PodDisruptionBudget
|
||||||
|
metadata:
|
||||||
|
name: {{ include "argo-cd.applicationSet.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.applicationSet.name "name" .Values.applicationSet.name) | nindent 4 }}
|
||||||
|
{{- with .Values.applicationSet.pdb.labels }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.applicationSet.pdb.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- range $key, $value := . }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
{{- with .Values.applicationSet.pdb.maxUnavailable }}
|
||||||
|
maxUnavailable: {{ . }}
|
||||||
|
{{- else }}
|
||||||
|
minAvailable: {{ .Values.applicationSet.pdb.minAvailable | default 0 }}
|
||||||
|
{{- end }}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "argo-cd.selectorLabels" (dict "context" . "name" .Values.applicationSet.name) | nindent 6 }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,87 @@
|
||||||
|
{{- if .Values.applicationSet.enabled }}
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: Role
|
||||||
|
metadata:
|
||||||
|
name: {{ include "argo-cd.applicationSet.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.applicationSet.name "name" .Values.applicationSet.name) | nindent 4 }}
|
||||||
|
rules:
|
||||||
|
- apiGroups:
|
||||||
|
- argoproj.io
|
||||||
|
resources:
|
||||||
|
- applications
|
||||||
|
- applicationsets
|
||||||
|
- applicationsets/finalizers
|
||||||
|
verbs:
|
||||||
|
- create
|
||||||
|
- delete
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- patch
|
||||||
|
- update
|
||||||
|
- watch
|
||||||
|
- apiGroups:
|
||||||
|
- argoproj.io
|
||||||
|
resources:
|
||||||
|
- applicationsets/status
|
||||||
|
verbs:
|
||||||
|
- get
|
||||||
|
- patch
|
||||||
|
- update
|
||||||
|
- apiGroups:
|
||||||
|
- argoproj.io
|
||||||
|
resources:
|
||||||
|
- appprojects
|
||||||
|
verbs:
|
||||||
|
- get
|
||||||
|
- apiGroups:
|
||||||
|
- ""
|
||||||
|
resources:
|
||||||
|
- events
|
||||||
|
verbs:
|
||||||
|
- create
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- patch
|
||||||
|
- watch
|
||||||
|
- apiGroups:
|
||||||
|
- ""
|
||||||
|
resources:
|
||||||
|
- secrets
|
||||||
|
- configmaps
|
||||||
|
verbs:
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- watch
|
||||||
|
- apiGroups:
|
||||||
|
- apps
|
||||||
|
- extensions
|
||||||
|
resources:
|
||||||
|
- deployments
|
||||||
|
verbs:
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- watch
|
||||||
|
# Leader election
|
||||||
|
- apiGroups:
|
||||||
|
- ""
|
||||||
|
resources:
|
||||||
|
- configmaps
|
||||||
|
verbs:
|
||||||
|
- create
|
||||||
|
- update
|
||||||
|
- delete
|
||||||
|
- patch
|
||||||
|
- apiGroups:
|
||||||
|
- coordination.k8s.io
|
||||||
|
resources:
|
||||||
|
- leases
|
||||||
|
verbs:
|
||||||
|
- create
|
||||||
|
- delete
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- patch
|
||||||
|
- update
|
||||||
|
- watch
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,16 @@
|
||||||
|
{{- if .Values.applicationSet.enabled }}
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: RoleBinding
|
||||||
|
metadata:
|
||||||
|
name: {{ template "argo-cd.applicationSet.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.applicationSet.name "name" .Values.applicationSet.name) | nindent 4 }}
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: Role
|
||||||
|
name: {{ template "argo-cd.applicationSet.fullname" . }}
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: {{ template "argo-cd.applicationSetServiceAccountName" . }}
|
||||||
|
namespace: {{ .Release.Namespace }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,24 @@
|
||||||
|
{{- if .Values.applicationSet.enabled }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
{{- if .Values.applicationSet.service.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- range $key, $value := .Values.applicationSet.service.annotations }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
name: {{ template "argo-cd.applicationSet.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.applicationSet.name "name" .Values.applicationSet.name) | nindent 4 }}
|
||||||
|
{{- with .Values.applicationSet.service.labels }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- name: {{ .Values.applicationSet.service.portName }}
|
||||||
|
port: {{ .Values.applicationSet.service.port }}
|
||||||
|
targetPort: webhook
|
||||||
|
selector:
|
||||||
|
{{- include "argo-cd.selectorLabels" (dict "context" . "name" .Values.applicationSet.name) | nindent 4 }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,18 @@
|
||||||
|
{{- if and .Values.applicationSet.enabled .Values.applicationSet.serviceAccount.create }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
automountServiceAccountToken: {{ .Values.applicationSet.serviceAccount.automountServiceAccountToken }}
|
||||||
|
metadata:
|
||||||
|
name: {{ template "argo-cd.applicationSetServiceAccountName" . }}
|
||||||
|
{{- if .Values.applicationSet.serviceAccount.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- range $key, $value := .Values.applicationSet.serviceAccount.annotations }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.applicationSet.name "name" .Values.applicationSet.name) | nindent 4 }}
|
||||||
|
{{- range $key, $value := .Values.applicationSet.serviceAccount.labels }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,51 @@
|
||||||
|
{{- if .Values.applicationSet.enabled }}
|
||||||
|
{{- if and .Values.applicationSet.metrics.enabled .Values.applicationSet.metrics.serviceMonitor.enabled }}
|
||||||
|
apiVersion: monitoring.coreos.com/v1
|
||||||
|
kind: ServiceMonitor
|
||||||
|
metadata:
|
||||||
|
name: {{ template "argo-cd.applicationSet.fullname" . }}
|
||||||
|
{{- with .Values.applicationSet.metrics.serviceMonitor.namespace }}
|
||||||
|
namespace: {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.applicationSet.name "name" .Values.applicationSet.name) | nindent 4 }}
|
||||||
|
{{- with .Values.applicationSet.metrics.serviceMonitor.selector }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.applicationSet.metrics.serviceMonitor.additionalLabels }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.applicationSet.metrics.serviceMonitor.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
endpoints:
|
||||||
|
- port: {{ .Values.applicationSet.metrics.service.portName }}
|
||||||
|
{{- with .Values.applicationSet.metrics.serviceMonitor.interval }}
|
||||||
|
interval: {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
path: /metrics
|
||||||
|
{{- with .Values.applicationSet.metrics.serviceMonitor.relabelings }}
|
||||||
|
relabelings:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.applicationSet.metrics.serviceMonitor.metricRelabelings }}
|
||||||
|
metricRelabelings:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.applicationSet.metrics.serviceMonitor.scheme }}
|
||||||
|
scheme: {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.applicationSet.metrics.serviceMonitor.tlsConfig }}
|
||||||
|
tlsConfig:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
namespaceSelector:
|
||||||
|
matchNames:
|
||||||
|
- {{ .Release.Namespace }}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "argo-cd.selectorLabels" (dict "context" . "component" .Values.applicationSet.name "name" "metrics") | nindent 6 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,89 @@
|
||||||
|
{{- if and .Values.applicationSet.enabled .Values.applicationSet.webhook.ingress.enabled -}}
|
||||||
|
{{- $serviceName := include "argo-cd.applicationSet.fullname" . -}}
|
||||||
|
{{- $servicePort := .Values.applicationSet.service.portName -}}
|
||||||
|
{{- $paths := .Values.applicationSet.webhook.ingress.paths -}}
|
||||||
|
{{- $extraPaths := .Values.applicationSet.webhook.ingress.extraPaths -}}
|
||||||
|
{{- $pathType := .Values.applicationSet.webhook.ingress.pathType -}}
|
||||||
|
apiVersion: {{ include "argo-cd.apiVersion.ingress" . }}
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
{{- if .Values.applicationSet.webhook.ingress.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- range $key, $value := .Values.applicationSet.webhook.ingress.annotations }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
name: {{ template "argo-cd.applicationSet.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.applicationSet.name "name" .Values.applicationSet.name) | nindent 4 }}
|
||||||
|
{{- if .Values.applicationSet.webhook.ingress.labels }}
|
||||||
|
{{- toYaml .Values.applicationSet.webhook.ingress.labels | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
{{- if eq (include "argo-cd.apiVersion.ingress" $) "networking.k8s.io/v1" }}
|
||||||
|
{{- with .Values.applicationSet.webhook.ingress.ingressClassName }}
|
||||||
|
ingressClassName: {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
rules:
|
||||||
|
{{- if .Values.applicationSet.webhook.ingress.hosts }}
|
||||||
|
{{- range $host := .Values.applicationSet.webhook.ingress.hosts }}
|
||||||
|
- host: {{ $host }}
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
{{- if $extraPaths }}
|
||||||
|
{{- toYaml $extraPaths | nindent 10 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- range $p := $paths }}
|
||||||
|
- path: {{ $p }}
|
||||||
|
{{- if eq (include "argo-cd.apiVersion.ingress" $) "networking.k8s.io/v1" }}
|
||||||
|
pathType: {{ $pathType }}
|
||||||
|
{{- end }}
|
||||||
|
backend:
|
||||||
|
{{- if eq (include "argo-cd.apiVersion.ingress" $) "networking.k8s.io/v1" }}
|
||||||
|
service:
|
||||||
|
name: {{ $serviceName }}
|
||||||
|
port:
|
||||||
|
{{- if kindIs "float64" $servicePort }}
|
||||||
|
number: {{ $servicePort }}
|
||||||
|
{{- else }}
|
||||||
|
name: {{ $servicePort }}
|
||||||
|
{{- end }}
|
||||||
|
{{- else }}
|
||||||
|
serviceName: {{ $serviceName }}
|
||||||
|
servicePort: {{ $servicePort }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- else }}
|
||||||
|
- http:
|
||||||
|
paths:
|
||||||
|
{{- if $extraPaths }}
|
||||||
|
{{- toYaml $extraPaths | nindent 10 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- range $p := $paths }}
|
||||||
|
- path: {{ $p }}
|
||||||
|
{{- if eq (include "argo-cd.apiVersion.ingress" $) "networking.k8s.io/v1" }}
|
||||||
|
pathType: {{ $pathType }}
|
||||||
|
{{- end }}
|
||||||
|
backend:
|
||||||
|
{{- if eq (include "argo-cd.apiVersion.ingress" $) "networking.k8s.io/v1" }}
|
||||||
|
service:
|
||||||
|
name: {{ $serviceName }}
|
||||||
|
port:
|
||||||
|
{{- if kindIs "float64" $servicePort }}
|
||||||
|
number: {{ $servicePort }}
|
||||||
|
{{- else }}
|
||||||
|
name: {{ $servicePort }}
|
||||||
|
{{- end }}
|
||||||
|
{{- else }}
|
||||||
|
serviceName: {{ $serviceName }}
|
||||||
|
servicePort: {{ $servicePort }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- if .Values.applicationSet.webhook.ingress.tls }}
|
||||||
|
tls:
|
||||||
|
{{- toYaml .Values.applicationSet.webhook.ingress.tls | nindent 4 }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
|
@ -0,0 +1,16 @@
|
||||||
|
{{- if (hasKey .Values.server "configEnabled") | ternary .Values.server.configEnabled .Values.configs.cm.create }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: argocd-cm
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.server.name "name" "cm") | nindent 4 }}
|
||||||
|
{{- with (mergeOverwrite (deepCopy .Values.configs.cm.annotations) (.Values.server.configAnnotations | default dict)) }}
|
||||||
|
annotations:
|
||||||
|
{{- range $key, $value := . }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
data:
|
||||||
|
{{- include "argo-cd.config.cm" . | trim | nindent 2 }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,14 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: argocd-cmd-params-cm
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.server.name "name" "cmd-params-cm") | nindent 4 }}
|
||||||
|
{{- if .Values.configs.params.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- range $key, $value := .Values.configs.params.annotations }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
data:
|
||||||
|
{{- include "argo-cd.config.params" . | trim | nindent 2 }}
|
|
@ -0,0 +1,24 @@
|
||||||
|
{{- if and .Values.dex.enabled .Values.dex.certificateSecret.enabled }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: argocd-dex-server-tls
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.dex.name "name" "dex-server-tls") | nindent 4 }}
|
||||||
|
{{- with .Values.dex.certificateSecret.labels }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.dex.certificateSecret.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- range $key, $value := . }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
type: kubernetes.io/tls
|
||||||
|
data:
|
||||||
|
{{- with .Values.dex.certificateSecret.ca }}
|
||||||
|
ca.crt: {{ . | b64enc | quote }}
|
||||||
|
{{- end }}
|
||||||
|
tls.crt: {{ .Values.dex.certificateSecret.crt | b64enc | quote }}
|
||||||
|
tls.key: {{ .Values.dex.certificateSecret.key | b64enc | quote }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,16 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: argocd-gpg-keys-cm
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "name" "gpg-keys-cm") | nindent 4 }}
|
||||||
|
{{- with .Values.configs.gpgKeysAnnotations }}
|
||||||
|
annotations:
|
||||||
|
{{- range $key, $value := . }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.configs.gpgKeys }}
|
||||||
|
data:
|
||||||
|
{{- toYaml . | nindent 2 }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,27 @@
|
||||||
|
{{- if and .Values.notifications.enabled .Values.notifications.cm.create }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: argocd-notifications-cm
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.notifications.name "name" .Values.notifications.name) | nindent 4 }}
|
||||||
|
data:
|
||||||
|
context: |
|
||||||
|
argocdUrl: {{ .Values.notifications.argocdUrl | quote }}
|
||||||
|
{{- with .Values.notifications.context }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.notifications.notifiers }}
|
||||||
|
{{- toYaml . | nindent 2 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.notifications.subscriptions }}
|
||||||
|
subscriptions: |
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.notifications.templates }}
|
||||||
|
{{- toYaml . | nindent 2 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.notifications.triggers }}
|
||||||
|
{{- toYaml . | nindent 2 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,19 @@
|
||||||
|
{{- if and .Values.notifications.enabled .Values.notifications.secret.create }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: argocd-notifications-secret
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.notifications.name "name" .Values.notifications.name) | nindent 4 }}
|
||||||
|
{{- with .Values.notifications.secret.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- range $key, $value := . }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
type: Opaque
|
||||||
|
stringData:
|
||||||
|
{{- with .Values.notifications.secret.items }}
|
||||||
|
{{- toYaml . | nindent 2 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,18 @@
|
||||||
|
{{- if (hasKey .Values.server "rbacConfigCreate") | ternary .Values.server.rbacConfigCreate .Values.configs.rbac.create }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: argocd-rbac-cm
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.server.name "name" "rbac-cm") | nindent 4 }}
|
||||||
|
{{- with (mergeOverwrite (deepCopy .Values.configs.rbac.annotations) (.Values.server.rbacConfigAnnotations | default dict)) }}
|
||||||
|
annotations:
|
||||||
|
{{- range $key, $value := . }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with (mergeOverwrite (deepCopy (omit .Values.configs.rbac "create" "annotations")) (.Values.server.rbacConfig | default dict)) }}
|
||||||
|
data:
|
||||||
|
{{- toYaml . | nindent 2 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,45 @@
|
||||||
|
{{- if .Values.configs.secret.createSecret }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: argocd-secret
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.server.name "name" "secret") | nindent 4 }}
|
||||||
|
{{- with .Values.configs.secret.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- range $key, $value := . }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
type: Opaque
|
||||||
|
{{- if or .Values.configs.secret.githubSecret (or .Values.configs.secret.gitlabSecret .Values.configs.secret.bitbucketUUID .Values.configs.secret.bitbucketServerSecret .Values.configs.secret.gogsSecret .Values.configs.secret.argocdServerAdminPassword .Values.configs.secret.argocdServerTlsConfig .Values.configs.secret.extra) }}
|
||||||
|
# Setting a blank data again will wipe admin password/key/cert
|
||||||
|
data:
|
||||||
|
{{- with .Values.configs.secret.githubSecret }}
|
||||||
|
webhook.github.secret: {{ . | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.configs.secret.gitlabSecret }}
|
||||||
|
webhook.gitlab.secret: {{ . | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.configs.secret.bitbucketServerSecret }}
|
||||||
|
webhook.bitbucketserver.secret: {{ . | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.configs.secret.bitbucketUUID }}
|
||||||
|
webhook.bitbucket.uuid: {{ . | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.configs.secret.gogsSecret }}
|
||||||
|
webhook.gogs.secret: {{ . | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.configs.secret.argocdServerTlsConfig }}
|
||||||
|
tls.key: {{ .key | b64enc }}
|
||||||
|
tls.crt: {{ .crt | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.configs.secret.argocdServerAdminPassword }}
|
||||||
|
admin.password: {{ .Values.configs.secret.argocdServerAdminPassword | b64enc }}
|
||||||
|
admin.passwordMtime: {{ default (dateInZone "2006-01-02T15:04:05Z" (now) "UTC") .Values.configs.secret.argocdServerAdminPasswordMtime | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- range $key, $value := .Values.configs.secret.extra }}
|
||||||
|
{{ $key }}: {{ $value | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,21 @@
|
||||||
|
{{- if and .Values.server.certificateSecret.enabled (not .Values.server.certificate.enabled) }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: argocd-server-tls
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.server.name "name" "server-tls") | nindent 4 }}
|
||||||
|
{{- with .Values.server.certificateSecret.labels }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.server.certificateSecret.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- range $key, $value := . }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
type: kubernetes.io/tls
|
||||||
|
data:
|
||||||
|
tls.crt: {{ .Values.server.certificateSecret.crt | b64enc | quote }}
|
||||||
|
tls.key: {{ .Values.server.certificateSecret.key | b64enc | quote }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,13 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: argocd-ssh-known-hosts-cm
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.server.name "name" "ssh-known-hosts-cm") | nindent 4 }}
|
||||||
|
{{- with .Values.configs.knownHostsAnnotations }}
|
||||||
|
annotations:
|
||||||
|
{{- range $key, $value := . }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- toYaml .Values.configs.knownHosts | nindent 0 }}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{{- if .Values.configs.styles }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: argocd-styles-cm
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.repoServer.name "name" .Values.repoServer.name) | nindent 4 }}
|
||||||
|
data:
|
||||||
|
custom.styles.css: |
|
||||||
|
{{- .Values.configs.styles | nindent 4 }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,15 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: argocd-tls-certs-cm
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.server.name "name" "tls-certs-cm") | nindent 4 }}
|
||||||
|
{{- with .Values.configs.tlsCertsAnnotations }}
|
||||||
|
annotations:
|
||||||
|
{{- range $key, $value := . }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.configs.tlsCerts }}
|
||||||
|
{{- toYaml . | nindent 0 }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,30 @@
|
||||||
|
{{- range .Values.configs.clusterCredentials }}
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: {{ include "argo-cd.name" $ }}-cluster-{{ .name }}
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" $) | nindent 4 }}
|
||||||
|
{{- with .labels }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
argocd.argoproj.io/secret-type: cluster
|
||||||
|
{{- with .annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- range $key, $value := . }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
type: Opaque
|
||||||
|
stringData:
|
||||||
|
name: {{ required "A valid .Values.configs.clusterCredentials[].name entry is required!" .name }}
|
||||||
|
server: {{ required "A valid .Values.configs.clusterCredentials[].server entry is required!" .server }}
|
||||||
|
{{- if .namespaces }}
|
||||||
|
namespaces: {{ .namespaces }}
|
||||||
|
{{- if .clusterResources }}
|
||||||
|
clusterResources: {{ .clusterResources | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
config: {{ required "A valid .Values.configs.clusterCredentials[].config entry is required!" .config | toRawJson }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,22 @@
|
||||||
|
{{- if and (or .Values.externalRedis.username .Values.externalRedis.password) (not .Values.externalRedis.existingSecret) }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: {{ include "argo-cd.redis.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" $) | nindent 4 }}
|
||||||
|
{{- with .Values.externalRedis.secretAnnotations }}
|
||||||
|
annotations:
|
||||||
|
{{- range $key, $value := . }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
type: Opaque
|
||||||
|
data:
|
||||||
|
{{- with .Values.externalRedis.username }}
|
||||||
|
redis-username: {{ . | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.externalRedis.password }}
|
||||||
|
redis-password: {{ . | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,20 @@
|
||||||
|
{{- range $repo_cred_key, $repo_cred_value := .Values.configs.credentialTemplates }}
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: argocd-repo-creds-{{ $repo_cred_key }}
|
||||||
|
labels:
|
||||||
|
argocd.argoproj.io/secret-type: repo-creds
|
||||||
|
{{- include "argo-cd.labels" (dict "context" $) | nindent 4 }}
|
||||||
|
{{- with $.Values.configs.credentialTemplatesAnnotations }}
|
||||||
|
annotations:
|
||||||
|
{{- range $key, $value := . }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
data:
|
||||||
|
{{- range $key, $value := $repo_cred_value }}
|
||||||
|
{{ $key }}: {{ $value | toString | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,20 @@
|
||||||
|
{{- range $repo_key, $repo_value := .Values.configs.repositories }}
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: argocd-repo-{{ $repo_key }}
|
||||||
|
labels:
|
||||||
|
argocd.argoproj.io/secret-type: repository
|
||||||
|
{{- include "argo-cd.labels" (dict "context" $) | nindent 4 }}
|
||||||
|
{{- with $.Values.configs.repositoriesAnnotations }}
|
||||||
|
annotations:
|
||||||
|
{{- range $key, $value := . }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
data:
|
||||||
|
{{- range $key, $value := $repo_value }}
|
||||||
|
{{ $key }}: {{ $value | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,57 @@
|
||||||
|
{{ if and .Values.notifications.enabled .Values.notifications.bots.slack.enabled }}
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: {{ include "argo-cd.notifications.fullname" . }}-bot
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.notifications.bots.slack.name "name" .Values.notifications.bots.slack.name) | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
revisionHistoryLimit: {{ .Values.global.revisionHistoryLimit }}
|
||||||
|
strategy:
|
||||||
|
type: Recreate
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "argo-cd.selectorLabels" (dict "context" . "component" .Values.notifications.bots.slack.name "name" "metrics") | nindent 6 }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.selectorLabels" (dict "context" . "component" .Values.notifications.bots.slack.name "name" "metrics") | nindent 8 }}
|
||||||
|
spec:
|
||||||
|
{{- with .Values.notifications.bots.slack.imagePullSecrets | default .Values.global.imagePullSecrets }}
|
||||||
|
imagePullSecrets:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.global.securityContext }}
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
serviceAccountName: {{ include "argo-cd.notificationsBotsSlackServiceAccountName" . }}
|
||||||
|
containers:
|
||||||
|
- name: {{ include "argo-cd.notifications.fullname" . }}-bot
|
||||||
|
image: {{ default .Values.global.image.repository .Values.notifications.bots.slack.image.repository }}:{{ default (include "argo-cd.defaultTag" .) .Values.notifications.bots.slack.image.tag }}
|
||||||
|
imagePullPolicy: {{ default .Values.global.image.imagePullPolicy .Values.notifications.bots.slack.image.pullPolicy }}
|
||||||
|
command:
|
||||||
|
- argocd-notifications
|
||||||
|
- bot
|
||||||
|
workingDir: /app
|
||||||
|
ports:
|
||||||
|
- containerPort: 8080
|
||||||
|
name: http
|
||||||
|
resources:
|
||||||
|
{{- toYaml .Values.notifications.bots.slack.resources | nindent 12 }}
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml .Values.notifications.bots.slack.containerSecurityContext | nindent 12 }}
|
||||||
|
{{- with .Values.notifications.bots.slack.nodeSelector }}
|
||||||
|
nodeSelector:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.notifications.bots.slack.affinity }}
|
||||||
|
affinity:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.notifications.bots.slack.tolerations }}
|
||||||
|
tolerations:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{ end }}
|
|
@ -0,0 +1,26 @@
|
||||||
|
{{- if and .Values.notifications.enabled .Values.notifications.bots.slack.enabled .Values.notifications.bots.slack.pdb.enabled }}
|
||||||
|
apiVersion: {{ include "argo-cd.apiVersion.pdb" . }}
|
||||||
|
kind: PodDisruptionBudget
|
||||||
|
metadata:
|
||||||
|
name: {{ include "argo-cd.notifications.fullname" . }}-bot
|
||||||
|
labels:
|
||||||
|
{{- include "argo-cd.labels" (dict "context" . "component" .Values.notifications.bots.slack.name "name" .Values.notifications.bots.slack.name) | nindent 4 }}
|
||||||
|
{{- with .Values.notifications.bots.slack.pdb.labels }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.notifications.bots.slack.pdb.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- range $key, $value := . }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
{{- with .Values.notifications.bots.slack.pdb.maxUnavailable }}
|
||||||
|
maxUnavailable: {{ . }}
|
||||||
|
{{- else }}
|
||||||
|
minAvailable: {{ .Values.notifications.bots.slack.pdb.minAvailable | default 0 }}
|
||||||
|
{{- end }}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "argo-cd.selectorLabels" (dict "context" . "component" .Values.notifications.bots.slack.name "name" "metrics") | nindent 6 }}
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,27 @@
|
||||||
|
{{ if and .Values.notifications.enabled .Values.notifications.bots.slack.enabled }}
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: Role
|
||||||
|
metadata:
|
||||||
|
name: {{ template "argo-cd.notifications.fullname" . }}-bot
|
||||||
|
rules:
|
||||||
|
- apiGroups:
|
||||||
|
- ""
|
||||||
|
resources:
|
||||||
|
- secrets
|
||||||
|
- configmaps
|
||||||
|
verbs:
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- watch
|
||||||
|
- apiGroups:
|
||||||
|
- argoproj.io
|
||||||
|
resources:
|
||||||
|
- applications
|
||||||
|
- appprojects
|
||||||
|
verbs:
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- watch
|
||||||
|
- update
|
||||||
|
- patch
|
||||||
|
{{ end }}
|
|
@ -0,0 +1,13 @@
|
||||||
|
{{ if and .Values.notifications.enabled .Values.notifications.bots.slack.enabled }}
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: RoleBinding
|
||||||
|
metadata:
|
||||||
|
name: {{ template "argo-cd.notifications.fullname" . }}-bot
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: Role
|
||||||
|
name: {{ template "argo-cd.notifications.fullname" . }}-bot
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: {{ template "argo-cd.notificationsBotsSlackServiceAccountName" . }}
|
||||||
|
{{ end }}
|
|
@ -0,0 +1,19 @@
|
||||||
|
{{ if and .Values.notifications.enabled .Values.notifications.bots.slack.enabled }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ template "argo-cd.notifications.fullname" . }}-bot
|
||||||
|
{{- if .Values.notifications.bots.slack.service.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- toYaml .Values.notifications.bots.slack.service.annotations | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
port: {{ .Values.notifications.bots.slack.service.port }}
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: http
|
||||||
|
selector:
|
||||||
|
{{- include "argo-cd.selectorLabels" (dict "context" . "component" .Values.notifications.bots.slack.name "name" "metrics") | nindent 6 }}
|
||||||
|
type: {{ .Values.notifications.bots.slack.service.type }}
|
||||||
|
{{ end }}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue