UNCLASSIFIED

Commit b91507ac authored by bhearn's avatar bhearn
Browse files

Merge branch 'redis-test' into 'main'

update redis dep

See merge request !35
parents 4cfc9c82 74512f88
Pipeline #312446 passed with stages
in 4 minutes and 25 seconds
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: {{ template "redis.fullname" . }}-headless name: {{ printf "%s-headless" (include "common.names.fullname" .) }}
namespace: {{ .Release.Namespace | quote }} namespace: {{ .Release.Namespace | quote }}
labels: labels: {{- include "common.labels.standard" . | nindent 4 }}
app: {{ template "redis.name" . }} {{- if .Values.commonLabels }}
chart: {{ template "redis.chart" . }} {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
release: {{ .Release.Name }} {{- end }}
heritage: {{ .Release.Service }} {{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec: spec:
type: ClusterIP type: ClusterIP
clusterIP: None clusterIP: None
...@@ -16,13 +18,11 @@ spec: ...@@ -16,13 +18,11 @@ spec:
{{- end }} {{- end }}
ports: ports:
- name: tcp-redis - name: tcp-redis
port: {{ .Values.redisPort }} port: {{ if .Values.sentinel.enabled }}{{ .Values.sentinel.service.port }}{{ else }}{{ .Values.master.service.port }}{{ end }}
targetPort: redis targetPort: redis
{{- if .Values.sentinel.enabled }} {{- if .Values.sentinel.enabled }}
- name: tcp-sentinel - name: tcp-sentinel
port: {{ .Values.sentinel.port }} port: {{ .Values.sentinel.service.sentinelPort }}
targetPort: redis-sentinel targetPort: sentinel
{{- end }} {{- end }}
selector: selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
app: {{ template "redis.name" . }}
release: {{ .Release.Name }}
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
name: {{ template "redis.fullname" . }}-health name: {{ printf "%s-health" (include "common.names.fullname" .) }}
namespace: {{ .Release.Namespace | quote }} namespace: {{ .Release.Namespace | quote }}
labels: labels: {{- include "common.labels.standard" . | nindent 4 }}
app: {{ template "redis.name" . }} {{- if .Values.commonLabels }}
chart: {{ template "redis.chart" . }} {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
heritage: {{ .Release.Service }} {{- end }}
release: {{ .Release.Name }} {{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
data: data:
ping_readiness_local.sh: |- ping_readiness_local.sh: |-
#!/bin/bash #!/bin/bash
{{- if .Values.usePasswordFile }}
password_aux=`cat ${REDIS_PASSWORD_FILE}` [[ -f $REDIS_PASSWORD_FILE ]] && export REDIS_PASSWORD="$(< "${REDIS_PASSWORD_FILE}")"
export REDIS_PASSWORD=$password_aux
{{- end }}
export REDISCLI_AUTH="$REDIS_PASSWORD" export REDISCLI_AUTH="$REDIS_PASSWORD"
response=$( response=$(
timeout -s 3 $1 \ timeout -s 3 $1 \
...@@ -39,10 +39,8 @@ data: ...@@ -39,10 +39,8 @@ data:
fi fi
ping_liveness_local.sh: |- ping_liveness_local.sh: |-
#!/bin/bash #!/bin/bash
{{- if .Values.usePasswordFile }}
password_aux=`cat ${REDIS_PASSWORD_FILE}` [[ -f $REDIS_PASSWORD_FILE ]] && export REDIS_PASSWORD="$(< "${REDIS_PASSWORD_FILE}")"
export REDIS_PASSWORD=$password_aux
{{- end }}
export REDISCLI_AUTH="$REDIS_PASSWORD" export REDISCLI_AUTH="$REDIS_PASSWORD"
response=$( response=$(
timeout -s 3 $1 \ timeout -s 3 $1 \
...@@ -68,10 +66,8 @@ data: ...@@ -68,10 +66,8 @@ data:
{{- if .Values.sentinel.enabled }} {{- if .Values.sentinel.enabled }}
ping_sentinel.sh: |- ping_sentinel.sh: |-
#!/bin/bash #!/bin/bash
{{- if .Values.usePasswordFile }}
password_aux=`cat ${REDIS_PASSWORD_FILE}` [[ -f $REDIS_PASSWORD_FILE ]] && export REDIS_PASSWORD="$(< "${REDIS_PASSWORD_FILE}")"
export REDIS_PASSWORD=$password_aux
{{- end }}
export REDISCLI_AUTH="$REDIS_PASSWORD" export REDISCLI_AUTH="$REDIS_PASSWORD"
response=$( response=$(
timeout -s 3 $1 \ timeout -s 3 $1 \
...@@ -112,10 +108,8 @@ data: ...@@ -112,10 +108,8 @@ data:
{{- end }} {{- end }}
ping_readiness_master.sh: |- ping_readiness_master.sh: |-
#!/bin/bash #!/bin/bash
{{- if .Values.usePasswordFile }}
password_aux=`cat ${REDIS_MASTER_PASSWORD_FILE}` [[ -f $REDIS_MASTER_PASSWORD_FILE ]] && export REDIS_MASTER_PASSWORD="$(< "${REDIS_MASTER_PASSWORD_FILE}")"
export REDIS_MASTER_PASSWORD=$password_aux
{{- end }}
export REDISCLI_AUTH="$REDIS_MASTER_PASSWORD" export REDISCLI_AUTH="$REDIS_MASTER_PASSWORD"
response=$( response=$(
timeout -s 3 $1 \ timeout -s 3 $1 \
...@@ -138,10 +132,8 @@ data: ...@@ -138,10 +132,8 @@ data:
fi fi
ping_liveness_master.sh: |- ping_liveness_master.sh: |-
#!/bin/bash #!/bin/bash
{{- if .Values.usePasswordFile }}
password_aux=`cat ${REDIS_MASTER_PASSWORD_FILE}` [[ -f $REDIS_MASTER_PASSWORD_FILE ]] && export REDIS_MASTER_PASSWORD="$(< "${REDIS_MASTER_PASSWORD_FILE}")"
export REDIS_MASTER_PASSWORD=$password_aux
{{- end }}
export REDISCLI_AUTH="$REDIS_MASTER_PASSWORD" export REDISCLI_AUTH="$REDIS_MASTER_PASSWORD"
response=$( response=$(
timeout -s 3 $1 \ timeout -s 3 $1 \
......
...@@ -2,20 +2,22 @@ ...@@ -2,20 +2,22 @@
apiVersion: {{ template "podSecurityPolicy.apiVersion" . }} apiVersion: {{ template "podSecurityPolicy.apiVersion" . }}
kind: PodSecurityPolicy kind: PodSecurityPolicy
metadata: metadata:
name: {{ template "redis.fullname" . }} name: {{ printf "%s-master" (include "common.names.fullname" .) }}
namespace: {{ .Release.Namespace | quote }} namespace: {{ .Release.Namespace | quote }}
labels: labels: {{- include "common.labels.standard" . | nindent 4 }}
app: {{ template "redis.name" . }} {{- if .Values.commonLabels }}
chart: {{ template "redis.chart" . }} {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
heritage: {{ .Release.Service }} {{- end }}
release: {{ .Release.Name }} {{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec: spec:
allowPrivilegeEscalation: false allowPrivilegeEscalation: false
fsGroup: fsGroup:
rule: 'MustRunAs' rule: 'MustRunAs'
ranges: ranges:
- min: {{ .Values.securityContext.fsGroup }} - min: {{ .Values.master.podSecurityContext.fsGroup }}
max: {{ .Values.securityContext.fsGroup }} max: {{ .Values.master.podSecurityContext.fsGroup }}
hostIPC: false hostIPC: false
hostNetwork: false hostNetwork: false
hostPID: false hostPID: false
...@@ -26,15 +28,15 @@ spec: ...@@ -26,15 +28,15 @@ spec:
runAsUser: runAsUser:
rule: 'MustRunAs' rule: 'MustRunAs'
ranges: ranges:
- min: {{ .Values.containerSecurityContext.runAsUser }} - min: {{ .Values.master.containerSecurityContext.runAsUser }}
max: {{ .Values.containerSecurityContext.runAsUser }} max: {{ .Values.master.containerSecurityContext.runAsUser }}
seLinux: seLinux:
rule: 'RunAsAny' rule: 'RunAsAny'
supplementalGroups: supplementalGroups:
rule: 'MustRunAs' rule: 'MustRunAs'
ranges: ranges:
- min: {{ .Values.containerSecurityContext.runAsUser }} - min: {{ .Values.master.containerSecurityContext.runAsUser }}
max: {{ .Values.containerSecurityContext.runAsUser }} max: {{ .Values.master.containerSecurityContext.runAsUser }}
volumes: volumes:
- 'configMap' - 'configMap'
- 'secret' - 'secret'
......
...@@ -2,19 +2,22 @@ ...@@ -2,19 +2,22 @@
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: {{ template "redis.fullname" . }}-master name: {{ printf "%s-master" (include "common.names.fullname" .) }}
namespace: {{ .Release.Namespace | quote }} namespace: {{ .Release.Namespace | quote }}
labels: labels: {{- include "common.labels.standard" . | nindent 4 }}
app: {{ template "redis.name" . }} app.kubernetes.io/component: master
chart: {{ template "redis.chart" . }} {{- if .Values.commonLabels }}
release: {{ .Release.Name }} {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
heritage: {{ .Release.Service }} {{- end }}
{{- if .Values.master.service.labels -}} {{- if or .Values.master.service.annotations .Values.commonAnnotations }}
{{- toYaml .Values.master.service.labels | nindent 4 }} annotations:
{{- end -}} {{- if .Values.master.service.annotations }}
{{- if .Values.master.service.annotations }} {{- include "common.tplvalues.render" ( dict "value" .Values.master.service.annotations "context" $ ) | nindent 4 }}
annotations: {{- toYaml .Values.master.service.annotations | nindent 4 }} {{- end }}
{{- end }} {{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec: spec:
type: {{ .Values.master.service.type }} type: {{ .Values.master.service.type }}
{{ if eq .Values.master.service.type "LoadBalancer" }} {{ if eq .Values.master.service.type "LoadBalancer" }}
...@@ -24,20 +27,20 @@ spec: ...@@ -24,20 +27,20 @@ spec:
loadBalancerIP: {{ .Values.master.service.loadBalancerIP }} loadBalancerIP: {{ .Values.master.service.loadBalancerIP }}
{{- end }} {{- end }}
{{- if and (eq .Values.master.service.type "LoadBalancer") .Values.master.service.loadBalancerSourceRanges }} {{- if and (eq .Values.master.service.type "LoadBalancer") .Values.master.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges: loadBalancerSourceRanges: {{- toYaml .Values.master.service.loadBalancerSourceRanges | nindent 4 }}
{{- with .Values.master.service.loadBalancerSourceRanges }} {{- end }}
{{- toYaml . | nindent 4 }} {{- if and (eq .Values.master.service.type "ClusterIP") .Values.master.service.clusterIP }}
{{- end }} clusterIP: {{ .Values.master.service.clusterIP }}
{{- end }} {{- end }}
ports: ports:
- name: tcp-redis - name: tcp-redis
port: {{ .Values.master.service.port }} port: {{ .Values.master.service.port }}
targetPort: redis targetPort: redis
{{- if .Values.master.service.nodePort }} {{- if and (or (eq .Values.master.service.type "NodePort") (eq .Values.master.service.type "LoadBalancer")) .Values.master.service.nodePort }}
nodePort: {{ .Values.master.service.nodePort }} nodePort: {{ .Values.master.service.nodePort }}
{{- else if eq .Values.master.service.type "ClusterIP" }}
nodePort: null
{{- end }} {{- end }}
selector: selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
app: {{ template "redis.name" . }} app.kubernetes.io/component: master
release: {{ .Release.Name }}
role: master
{{- end }} {{- end }}
{{- if and (.Values.metrics.enabled) (.Values.metrics.serviceMonitor.enabled) }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "redis.fullname" . }}
{{- if .Values.metrics.serviceMonitor.namespace }}
namespace: {{ .Values.metrics.serviceMonitor.namespace }}
{{- else }}
namespace: {{ .Release.Namespace | quote }}
{{- end }}
labels:
app: {{ template "redis.name" . }}
chart: {{ template "redis.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- range $key, $value := .Values.metrics.serviceMonitor.selector }}
{{ $key }}: {{ $value | quote }}
{{- end }}
spec:
endpoints:
- port: metrics
{{- if .Values.metrics.serviceMonitor.interval }}
interval: {{ .Values.metrics.serviceMonitor.interval }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.relabelings }}
relabelings: {{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.relabelings "context" $) | nindent 6 }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.metricRelabelings }}
metricRelabelings: {{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.metricRelabelings "context" $) | nindent 6 }}
{{- end }}
selector:
matchLabels:
app: {{ template "redis.name" . }}
release: {{ .Release.Name }}
app.kubernetes.io/component: "metrics"
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
{{- end -}}
{{- if and .Values.sentinel.enabled .Values.metrics.sentinel.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ printf "%s-sentinel-metrics" (include "common.names.fullname" .) }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: sentinel-metrics
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.metrics.sentinel.service.annotations .Values.commonAnnotations }}
annotations:
{{- if .Values.metrics.sentinel.service.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.sentinel.service.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
type: {{ .Values.metrics.sentinel.service.type }}
{{- if eq .Values.metrics.sentinel.service.type "LoadBalancer" }}
externalTrafficPolicy: {{ .Values.metrics.sentinel.service.externalTrafficPolicy }}
{{- end }}
{{- if and (eq .Values.metrics.sentinel.service.type "LoadBalancer") .Values.metrics.sentinel.service.loadBalancerIP }}
loadBalancerIP: {{ .Values.metrics.sentinel.service.loadBalancerIP }}
{{- end }}
{{- if and (eq .Values.metrics.sentinel.service.type "LoadBalancer") .Values.metrics.sentinel.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges: {{- toYaml .Values.metrics.sentinel.service.loadBalancerSourceRanges | nindent 4 }}
{{- end }}
ports:
- name: tcp-metrics
port: {{ .Values.metrics.sentinel.service.port }}
protocol: TCP
targetPort: sentinelmetrics
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
{{- end }}
...@@ -2,33 +2,37 @@ ...@@ -2,33 +2,37 @@
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: {{ template "redis.fullname" . }}-metrics name: {{ printf "%s-metrics" (include "common.names.fullname" .) }}
namespace: {{ .Release.Namespace | quote }} namespace: {{ .Release.Namespace | quote }}
labels: labels: {{- include "common.labels.standard" . | nindent 4 }}
app: {{ template "redis.name" . }} app.kubernetes.io/component: metrics
chart: {{ template "redis.chart" . }} {{- if .Values.commonLabels }}
release: {{ .Release.Name }} {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
heritage: {{ .Release.Service }} {{- end }}
app.kubernetes.io/component: "metrics" {{- if or .Values.metrics.service.annotations .Values.commonAnnotations }}
{{- if .Values.metrics.service.labels -}} annotations:
{{- toYaml .Values.metrics.service.labels | nindent 4 }} {{- if .Values.metrics.service.annotations }}
{{- end -}} {{- include "common.tplvalues.render" ( dict "value" .Values.metrics.service.annotations "context" $ ) | nindent 4 }}
{{- if .Values.metrics.service.annotations }} {{- end }}
annotations: {{- toYaml .Values.metrics.service.annotations | nindent 4 }} {{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }} {{- end }}
spec: spec:
type: {{ .Values.metrics.service.type }} type: {{ .Values.metrics.service.type }}
{{ if eq .Values.metrics.service.type "LoadBalancer" }} {{- if eq .Values.metrics.service.type "LoadBalancer" }}
externalTrafficPolicy: {{ .Values.metrics.service.externalTrafficPolicy }} externalTrafficPolicy: {{ .Values.metrics.service.externalTrafficPolicy }}
{{- end }} {{- end }}
{{ if and (eq .Values.metrics.service.type "LoadBalancer") .Values.metrics.service.loadBalancerIP }} {{- if and (eq .Values.metrics.service.type "LoadBalancer") .Values.metrics.service.loadBalancerIP }}
loadBalancerIP: {{ .Values.metrics.service.loadBalancerIP }} loadBalancerIP: {{ .Values.metrics.service.loadBalancerIP }}
{{- end }} {{- end }}
{{- if and (eq .Values.metrics.service.type "LoadBalancer") .Values.metrics.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges: {{- toYaml .Values.metrics.service.loadBalancerSourceRanges | nindent 4 }}
{{- end }}
ports: ports:
- name: metrics - name: tcp-metrics
port: 9121 port: {{ .Values.metrics.service.port }}
protocol: TCP
targetPort: metrics targetPort: metrics
selector: selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
app: {{ template "redis.name" . }}
release: {{ .Release.Name }}
{{- end }} {{- end }}
...@@ -2,55 +2,56 @@ ...@@ -2,55 +2,56 @@
kind: NetworkPolicy kind: NetworkPolicy
apiVersion: {{ template "networkPolicy.apiVersion" . }} apiVersion: {{ template "networkPolicy.apiVersion" . }}
metadata: metadata:
name: {{ template "redis.fullname" . }} name: {{ template "common.names.fullname" . }}
namespace: {{ .Release.Namespace | quote }} namespace: {{ .Release.Namespace | quote }}
labels: labels: {{- include "common.labels.standard" . | nindent 4 }}
app: {{ template "redis.name" . }} {{- if .Values.commonLabels }}
chart: {{ template "redis.chart" . }} {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
release: {{ .Release.Name }} {{- end }}
heritage: {{ .Release.Service }} {{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec: spec:
podSelector: podSelector:
matchLabels: matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
app: {{ template "redis.name" . }}
release: {{ .Release.Name }}
{{- if .Values.cluster.enabled }}
policyTypes: policyTypes:
- Ingress - Ingress
{{- if or (eq .Values.architecture "replication") .Values.networkPolicy.extraEgress }}
- Egress - Egress
egress: egress:
{{- if eq .Values.architecture "replication" }}
# Allow dns resolution # Allow dns resolution
- ports: - ports:
- port: 53 - port: 53
protocol: UDP protocol: UDP
# Allow outbound connections to other cluster pods # Allow outbound connections to other cluster pods
- ports: - ports:
- port: {{ .Values.redisPort }} - port: {{ .Values.master.containerPort }}
{{- if .Values.sentinel.enabled }} {{- if .Values.sentinel.enabled }}
- port: {{ .Values.sentinel.port }} - port: {{ .Values.sentinel.containerPort }}
{{- end }} {{- end }}
to: to:
- podSelector: - podSelector:
matchLabels: matchLabels: {{- include "common.labels.matchLabels" . | nindent 14 }}
app: {{ template "redis.name" . }} {{- end }}
release: {{ .Release.Name }} {{- if .Values.networkPolicy.extraEgress }}
{{- include "common.tplvalues.render" ( dict "value" .Values.networkPolicy.extraEgress "context" $ ) | nindent 4 }}
{{- end }}
{{- end }} {{- end }}
ingress: ingress:
# Allow inbound connections # Allow inbound connections
- ports: - ports:
- port: {{ .Values.redisPort }} - port: {{ .Values.master.containerPort }}
{{- if .Values.sentinel.enabled }} {{- if .Values.sentinel.enabled }}
- port: {{ .Values.sentinel.port }} - port: {{ .Values.sentinel.containerPort }}
{{- end }} {{- end }}
{{- if not .Values.networkPolicy.allowExternal }} {{- if not .Values.networkPolicy.allowExternal }}
from: from:
- podSelector: - podSelector:
matchLabels: matchLabels:
{{ template "redis.fullname" . }}-client: "true" {{ template "common.names.fullname" . }}-client: "true"
- podSelector: - podSelector:
matchLabels: matchLabels: {{- include "common.labels.matchLabels" . | nindent 14 }}
app: {{ template "redis.name" . }}
release: {{ .Release.Name }}
{{- if .Values.networkPolicy.ingressNSMatchLabels }} {{- if .Values.networkPolicy.ingressNSMatchLabels }}
- namespaceSelector: - namespaceSelector:
matchLabels: matchLabels:
...@@ -65,10 +66,18 @@ spec: ...@@ -65,10 +66,18 @@ spec:
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if .Values.metrics.enabled }} {{- if .Values.metrics.enabled }}
# Allow prometheus scrapes for metrics # Allow prometheus scrapes for metrics
- ports: - ports:
- port: 9121 - port: 9121
{{- end }} {{- end }}
{{- if .Values.metrics.sentinel.enabled }}
# Allow prometheus scrapes for sentinel metrics
- ports:
- port: 9355
{{- end }}
{{- if .Values.networkPolicy.extraIngress }}
{{- include "common.tplvalues.render" ( dict "value" .Values.networkPolicy.extraIngress "context" $ ) | nindent 4 }}
{{- end }}
{{- end }} {{- end }}
{{- if .Values.podDisruptionBudget.enabled }} {{- if .Values.pdb.create }}
apiVersion: policy/v1beta1 apiVersion: policy/v1beta1
kind: PodDisruptionBudget kind: PodDisruptionBudget
metadata: metadata:
name: {{ template "redis.fullname" . }} name: {{ template "common.names.fullname" . }}
namespace: {{ .Release.Namespace | quote }} namespace: {{ .Release.Namespace | quote }}
labels: labels: {{- include "common.labels.standard" . | nindent 4 }}
app: {{ template "redis.name" . }} {{- if .Values.commonLabels }}
chart: {{ template "redis.chart" . }} {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec: spec:
{{- if .Values.podDisruptionBudget.minAvailable }} {{- if .Values.pdb.minAvailable }}
minAvailable: {{ .Values.podDisruptionBudget.minAvailable }} minAvailable: {{ .Values.pdb.minAvailable }}
{{- end }} {{- end }}
{{- if .Values.podDisruptionBudget.maxUnavailable }} {{- if .Values.pdb.maxUnavailable }}
maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }} maxUnavailable: {{ .Values.pdb.maxUnavailable }}
{{- end }} {{- end }}
selector: selector:
matchLabels: matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
app: {{ template "redis.name" . }}
chart: {{ template "redis.chart" . }}
release: {{ .Release.Name }}
{{- end }} {{- end }}
...@@ -2,24 +2,26 @@ ...@@ -2,24 +2,26 @@
apiVersion: monitoring.coreos.com/v1 apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule kind: PrometheusRule
metadata: metadata:
name: {{ template "redis.fullname" . }} name: {{ template "common.names.fullname" . }}
{{- if .Values.metrics.prometheusRule.namespace }} {{- if .Values.metrics.prometheusRule.namespace }}
namespace: {{ .Values.metrics.prometheusRule.namespace }} namespace: {{ .Values.metrics.prometheusRule.namespace }}
{{- else }} {{- else }}
namespace: {{ .Release.Namespace | quote }} namespace: {{ .Release.Namespace | quote }}
{{- end }} {{- end }}
labels: labels: {{- include "common.labels.standard" . | nindent 4 }}
app: {{ template "redis.name" . }} {{- if .Values.metrics.prometheusRule.additionalLabels }}
chart: {{ template "redis.chart" . }} {{- include "common.tplvalues.render" (dict "value" .Values.metrics.prometheusRule.additionalLabels "context" $) | nindent 4 }}
release: {{ .Release.Name | quote }} {{- end }}
heritage: {{ .Release.Service | quote }} {{- if .Values.commonLabels }}
{{- with .Values.metrics.prometheusRule.additionalLabels }} {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- toYaml . | nindent 4 }} {{- end }}
{{- end }} {{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec: spec:
{{- with .Values.metrics.prometheusRule.rules }} {{- with .Values.metrics.prometheusRule.rules }}
groups: groups:
- name: {{ template "redis.name" $ }} - name: {{ template "common.names.name" $ }}
rules: {{- tpl (toYaml .) $ | nindent 8 }} rules: {{- tpl (toYaml .) $ | nindent 8 }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if .Values.rbac.create -}}
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
kind: Role
metadata:
name: {{ template "redis.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels:
app: {{ template "redis.name" . }}
chart: {{ template "redis.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
rules:
{{- if .Values.podSecurityPolicy.create }}
- apiGroups: ['{{ template "podSecurityPolicy.apiGroup" . }}']
resources: ['podsecuritypolicies']
verbs: ['use']
resourceNames: [{{ template "redis.fullname" . }}]
{{- end -}}
{{- if .Values.rbac.role.rules }}
{{- toYaml .Values.rbac.role.rules | nindent 2 }}
{{- end -}}
{{- end -}}
{{- if .Values.rbac.create -}}
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
kind: RoleBinding
metadata:
name: {{ template "redis.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels:
app: {{ template "redis.name" . }}
chart: {{ template "redis.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ template "redis.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ template "redis.serviceAccountName" . }}
{{- end -}}
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ template "redis.serviceAccountName" . }}
namespace: {{ .Release.Namespace | quote }}
labels:
app: {{ template "redis.name" . }}
chart: {{ template "redis.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if .Values.serviceAccount.annotations }}
annotations: {{ toYaml .Values.serviceAccount.annotations | nindent 4 }}
{{- end }}
{{- end -}}
{{- if and .Values.cluster.enabled (not .Values.sentinel.enabled) }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "redis.fullname" . }}-slave
namespace: {{ .Release.Namespace | quote }}
labels:
app: {{ template "redis.name" . }}
chart: {{ template "redis.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if .Values.slave.service.labels -}}
{{- toYaml .Values.slave.service.labels | nindent 4 }}
{{- end -}}
{{- if .Values.slave.service.annotations }}
annotations: {{- toYaml .Values.slave.service.annotations | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.slave.service.type }}
{{ if eq .Values.slave.service.type "LoadBalancer" }}
externalTrafficPolicy: {{ .Values.slave.service.externalTrafficPolicy }}
{{- end }}
{{- if and (eq .Values.slave.service.type "LoadBalancer") .Values.slave.service.loadBalancerIP }}
loadBalancerIP: {{ .Values.slave.service.loadBalancerIP }}
{{- end }}
{{- if and (eq .Values.slave.service.type "LoadBalancer") .Values.slave.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{- with .Values.slave.service.loadBalancerSourceRanges }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
ports:
- name: tcp-redis
port: {{ .Values.slave.service.port }}
targetPort: redis
{{- if .Values.slave.service.nodePort }}
nodePort: {{ .Values.slave.service.nodePort }}
{{- end }}
selector:
app: {{ template "redis.name" . }}
release: {{ .Release.Name }}
role: slave
{{- end }}
{{- if .Values.sentinel.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "redis.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels:
app: {{ template "redis.name" . }}
chart: {{ template "redis.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if .Values.sentinel.service.labels }}
{{- toYaml .Values.sentinel.service.labels | nindent 4 }}
{{- end }}
{{- if .Values.sentinel.service.annotations }}
annotations: {{- toYaml .Values.sentinel.service.annotations | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.sentinel.service.type }}
{{ if eq .Values.sentinel.service.type "LoadBalancer" }}
externalTrafficPolicy: {{ .Values.sentinel.service.externalTrafficPolicy }}
{{- end }}
{{ if eq .Values.sentinel.service.type "LoadBalancer" -}} {{ if .Values.sentinel.service.loadBalancerIP }}
loadBalancerIP: {{ .Values.sentinel.service.loadBalancerIP }}
{{ end -}}
{{- end -}}
ports:
- name: tcp-redis
port: {{ .Values.sentinel.service.redisPort }}
targetPort: redis
{{- if .Values.sentinel.service.redisNodePort }}
nodePort: {{ .Values.sentinel.service.redisNodePort }}
{{- end }}
- name: tcp-sentinel
port: {{ .Values.sentinel.service.sentinelPort }}
targetPort: redis-sentinel
{{- if .Values.sentinel.service.sentinelNodePort }}
nodePort: {{ .Values.sentinel.service.sentinelNodePort }}
{{- end }}
selector:
app: {{ template "redis.name" . }}
release: {{ .Release.Name }}
{{- end }}
{{- if and (eq .Values.architecture "replication") (not .Values.sentinel.enabled) }}
apiVersion: v1
kind: Service
metadata:
name: {{ printf "%s-replicas" (include "common.names.fullname" .) }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: replica
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.replica.service.annotations .Values.commonAnnotations }}
annotations:
{{- if .Values.replica.service.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.replica.service.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
type: {{ .Values.replica.service.type }}
{{- if eq .Values.replica.service.type "LoadBalancer" }}
externalTrafficPolicy: {{ .Values.replica.service.externalTrafficPolicy }}
{{- end }}
{{- if and (eq .Values.replica.service.type "LoadBalancer") .Values.replica.service.loadBalancerIP }}
loadBalancerIP: {{ .Values.replica.service.loadBalancerIP }}
{{- end }}
{{- if and (eq .Values.replica.service.type "LoadBalancer") .Values.replica.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges: {{- toYaml .Values.replica.service.loadBalancerSourceRanges | nindent 4 }}
{{- end }}
{{- if and (eq .Values.replica.service.type "ClusterIP") .Values.replica.service.clusterIP }}
clusterIP: {{ .Values.replica.service.clusterIP }}
{{- end }}
ports:
- name: tcp-redis
port: {{ .Values.replica.service.port }}
targetPort: redis
{{- if and (or (eq .Values.replica.service.type "NodePort") (eq .Values.replica.service.type "LoadBalancer")) .Values.replica.service.nodePort }}
nodePort: {{ .Values.replica.service.nodePort }}
{{- else if eq .Values.replica.service.type "ClusterIP" }}
nodePort: null
{{- end }}
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
app.kubernetes.io/component: replica
{{- end }}
{{- if .Values.rbac.create }}
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
kind: Role
metadata:
name: {{ template "common.names.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
rules:
{{- if .Values.podSecurityPolicy.create }}
- apiGroups:
- '{{ template "podSecurityPolicy.apiGroup" . }}'
resources:
- 'podsecuritypolicies'
verbs:
- 'use'
resourceNames: [{{ template "common.names.fullname" . }}]
{{- end }}
{{- if .Values.rbac.rules }}
{{- include "common.tplvalues.render" ( dict "value" .Values.rbac.rules "context" $ ) | nindent 2 }}
{{- end }}
{{- end }}
{{- if .Values.rbac.create }}
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
kind: RoleBinding
metadata:
name: {{ template "common.names.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ template "common.names.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ template "redis.serviceAccountName" . }}
{{- end }}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment