Skip to content

Commit

Permalink
chore: prettify syntax in redis-sentiel,redis-cluster,redis-operator
Browse files Browse the repository at this point in the history
Signed-off-by: genofire <[email protected]>
  • Loading branch information
genofire committed Feb 23, 2023
1 parent 77cd9e8 commit 3100976
Show file tree
Hide file tree
Showing 13 changed files with 171 additions and 195 deletions.
2 changes: 1 addition & 1 deletion charts/redis-cluster/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ maintainers:
name: redis-cluster
sources:
- https://github.com/ot-container-kit/redis-operator
version: 0.14.2
version: 0.14.3
appVersion: "0.14.0"
home: https://github.com/ot-container-kit/redis-operator
keywords:
Expand Down
2 changes: 1 addition & 1 deletion charts/redis-cluster/templates/extra-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if eq .Values.externalConfig.enabled true }}
{{- if .Values.externalConfig.enabled }}
---
apiVersion: v1
kind: ConfigMap
Expand Down
14 changes: 7 additions & 7 deletions charts/redis-cluster/templates/follower-service.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
{{- if and (gt (int .Values.redisCluster.follower.replicas) 0) (eq .Values.externalService.enabled true) }}
{{- if and .Values.externalService.enabled (gt (int .Values.redisCluster.follower.replicas) 0) }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-follower-external-service
{{- if .Values.externalService.annotations }}
annotations:
{{ toYaml .Values.externalService.annotations | indent 4 }}
{{- end }}
labels:
app.kubernetes.io/name: {{ .Release.Name }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
app.kubernetes.io/component: middleware
{{- with .Values.externalService.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.externalService.serviceType }}
selector:
app: {{ .Release.Name }}-follower
redis_setup_type: follower
app: {{ .Release.Name }}}-follower
redis_setup_type: cluster
role: follower
ports:
- protocol: TCP
Expand Down
27 changes: 0 additions & 27 deletions charts/redis-cluster/templates/follower-sm.yaml

This file was deleted.

12 changes: 6 additions & 6 deletions charts/redis-cluster/templates/leader-service.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
{{- if and (gt (int .Values.redisCluster.leader.replicas) 0) (eq .Values.externalService.enabled true) }}
{{- if and .Values.externalService.enabled (gt (int .Values.redisCluster.leader.replicas) 0) }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-leader-external-service
{{- if .Values.externalService.annotations }}
annotations:
{{ toYaml .Values.externalService.annotations | indent 4 }}
{{- end }}
labels:
app.kubernetes.io/name: {{ .Release.Name }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
app.kubernetes.io/component: middleware
{{- with .Values.externalService.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.externalService.serviceType }}
selector:
app: {{ .Release.Name }}-leader
redis_setup_type: leader
redis_setup_type: cluster
role: leader
ports:
- protocol: TCP
Expand Down
128 changes: 67 additions & 61 deletions charts/redis-cluster/templates/redis-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,98 +10,104 @@ metadata:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
app.kubernetes.io/component: middleware
{{- if .Values.labels }}
{{- range $labelkey, $labelvalue := .Values.labels }}
{{ $labelkey}}: {{ $labelvalue }}
{{- end }}
{{- end }}
{{- with .Values.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
clusterSize: {{ .Values.redisCluster.clusterSize }}
persistenceEnabled: {{ .Values.redisCluster.persistenceEnabled }}
clusterVersion: {{ .Values.redisCluster.clusterVersion }}
{{- with .Values.redisCluster.leader }}
redisLeader:
{{- if .Values.redisCluster.leader.affinity }}
{{- with .affinity }}
affinity:
{{ toYaml .Values.redisCluster.leader.affinity | nindent 6 }}
{{- end }}
replicas: {{ .Values.redisCluster.leader.replicas }}
{{- if eq .Values.externalConfig.enabled true }}
{{- toYaml . | nindent 6 }}
{{- end }}
replicas: {{ .replicas }}
{{- if $.Values.externalConfig.enabled }}
redisConfig:
additionalRedisConfig: {{ .Release.Name }}-ext-config
{{- end }}
{{- if eq .Values.pdb.enabled true }}
{{- end }}
{{- with $.Values.pdb }}
{{- if .enabled }}
pdb:
enabled: {{ .Values.pdb.enabled }}
{{- if .Values.pdb.maxUnavailable }}
maxUnavailable: {{ .Values.pdb.maxUnavailable }}
enabled: true
{{- with .maxUnavailable }}
maxUnavailable: {{ . }}
{{- end }}
{{- if .Values.pdb.minAvailable }}
minAvailable: {{ .Values.pdb.minAvailable }}
{{- with .minAvailable }}
minAvailable: {{ . }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- with .Values.redisCluster.follower }}
redisFollower:
{{- if .Values.redisCluster.follower.affinity }}
{{- with .affinity }}
affinity:
{{ toYaml .Values.redisCluster.follower.affinity | nindent 6 }}
{{- end }}
replicas: {{ .Values.redisCluster.follower.replicas }}
{{- if eq .Values.externalConfig.enabled true }}
{{- toYaml . | nindent 6 }}
{{- end }}
replicas: {{ .replicas }}
{{- if $.Values.externalConfig.enabled }}
redisConfig:
additionalRedisConfig: {{ .Release.Name }}-ext-config
{{- end }}
{{- if eq .Values.pdb.enabled true }}
{{- end }}
{{- with $.Values.pdb }}
{{- if .enabled }}
pdb:
enabled: {{ .Values.pdb.enabled }}
{{- if .Values.pdb.maxUnavailable }}
maxUnavailable: {{ .Values.pdb.maxUnavailable }}
enabled: true
{{- with .maxUnavailable }}
maxUnavailable: {{ . }}
{{- end }}
{{- if .Values.pdb.minAvailable }}
minAvailable: {{ .Values.pdb.minAvailable }}
{{- with .minAvailable }}
minAvailable: {{ . }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
redisExporter:
enabled: {{ .Values.redisExporter.enabled }}
image: "{{ .Values.redisExporter.image }}:{{ .Values.redisExporter.tag }}"
imagePullPolicy: "{{ .Values.redisExporter.imagePullPolicy }}"
resources:
{{ toYaml .Values.redisExporter.resources | indent 6 }}
{{- toYaml .Values.redisExporter.resources | nindent 6 }}
kubernetesConfig:
image: "{{ .Values.redisCluster.image }}:{{ .Values.redisCluster.tag }}"
imagePullPolicy: "{{ .Values.redisCluster.imagePullPolicy }}"
resources:
{{ toYaml .Values.redisCluster.resources | indent 6 }}
{{- if .Values.redisCluster.redisSecret }}
{{- toYaml .Values.redisCluster.resources | nindent 6 }}
{{- with .Values.redisCluster.redisSecret }}
redisSecret:
name: "{{ .Values.redisCluster.redisSecret.secretName }}"
key: "{{ .Values.redisCluster.redisSecret.secretKey }}"
{{- end }}
{{- if .Values.storageSpec }}
name: "{{ .secretName }}"
key: "{{ .secretKey }}"
{{- end }}
{{- with .Values.storageSpec }}
storage:
{{ toYaml .Values.storageSpec | indent 4 }}
{{- end }}
{{- if .Values.priorityClassName }}
priorityClassName: "{{ .Values.priorityClassName }}"
{{- end }}
{{- if .Values.nodeSelector }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.priorityClassName }}
priorityClassName: "{{ . }}"
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 4 }}
{{- end }}
{{- if .Values.securityContext }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.securityContext }}
securityContext:
{{ toYaml .Values.securityContext | indent 4 }}
{{- end }}
{{- if .Values.tolerations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if .Values.tolerations }}
tolerations:
{{ toYaml .Values.tolerations | indent 4 }}
{{- end }}
{{- if .Values.TLS }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.TLS }}
TLS:
{{ toYaml .Values.TLS | indent 4 }}
{{- end}}
{{- if .Values.sidecars }}
{{ toYaml . | nindent 4 }}
{{- end}}
{{- with .Values.sidecars }}
sidecars:
{{ toYaml .Values.sidecars | indent 4 }}
{{- end }}
{{- if .Values.serviceAccountName }}
serviceAccountName: "{{ .Values.serviceAccountName }}"
{{- end }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.serviceAccountName }}
serviceAccountName: "{{ . }}"
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
{{- if and (eq .Values.serviceMonitor.enabled true) (gt (int .Values.redisCluster.leader.replicas) 0) }}
{{- if and .Values.serviceMonitor.enabled }}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ .Release.Name }}-leader-prometheus-monitoring
labels:
app.kubernetes.io/name: {{ .Release.Name }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/name: {{ .Release.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
app.kubernetes.io/component: middleware
spec:
selector:
matchLabels:
app: {{ .Release.Name }}-leader
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/name: {{ .Release.Name }}
redis_setup_type: cluster
role: leader
endpoints:
- port: redis-exporter
interval: {{ .Values.serviceMonitor.interval }}
scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }}
- port: redis-exporter
interval: {{ .Values.serviceMonitor.interval }}
scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }}
namespaceSelector:
matchNames:
- {{ .Values.serviceMonitor.namespace }}
- {{ .Values.serviceMonitor.namespace }}
{{- end }}
2 changes: 1 addition & 1 deletion charts/redis-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
apiVersion: v2
version: 0.14.3
version: 0.14.4
appVersion: "0.14.0"
description: Provides easy redis setup definitions for Kubernetes services, and deployment.
engine: gotpl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,41 +24,42 @@ spec:
{{- end }}
labels:
name: {{ .Values.redisOperator.name }}
{{- with .Values.redisOperator.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.redisOperator.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
containers:
- name: "{{ .Values.redisOperator.name }}"
image: "{{ .Values.redisOperator.imageName }}:{{ .Values.redisOperator.imageTag | default (printf "v%s" .Chart.AppVersion) }}"
imagePullPolicy: {{ .Values.redisOperator.imagePullPolicy }}
imagePullPolicy: "{{ .Values.redisOperator.imagePullPolicy }}"
command:
- /manager
- /manager
args:
- --leader-elect
{{- if .Values.watch_namespace }}
- "--leader-elect"
{{- with .Values.watch_namespace }}
env:
- name: NAMESPACE
value: {{ .Values.watch_namespace }}
{{- end }}
{{- if .Values.resources }}
value: "{{ . }}"
{{- end }}
{{- with .Values.resources }}
resources:
{{ toYaml .Values.resources | indent 10 }}
{{- end }}
{{- toYaml . | nindent 10 }}
{{- end }}
nodeSelector:
{{- with .Values.nodeSelector }}
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
{{- toYaml . | nindent 8 }}
{{- end }}
priorityClassName: {{ .Values.priorityClassName }}
{{- with .Values.affinity }}
affinity: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
tolerations:
{{- if .Values.tolerateAllTaints }}
{{- if .Values.tolerateAllTaints }}
- operator: Exists
{{- end }}
{{- with .Values.tolerations }}
{{ toYaml . | indent 8 }}
{{- end }}
{{- end }}
{{- with .Values.tolerations }}
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: "{{ .Values.serviceAccountName }}"
serviceAccount: "{{ .Values.serviceAccountName }}"
2 changes: 1 addition & 1 deletion charts/redis-sentinel/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ maintainers:
name: redis-sentinel
sources:
- https://github.com/ot-container-kit/redis-operator
version: 0.14.2
version: 0.14.3
appVersion: "0.14.0"
home: https://github.com/ot-container-kit/redis-operator
keywords:
Expand Down
Loading

0 comments on commit 3100976

Please sign in to comment.