################################################################################### # ============LICENSE_START======================================================= # # ================================================================================ # Copyright (C) 2020 Hcl Technologies Limited. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============LICENSE_END========================================================= ################################################################################### apiVersion: apps/v1 kind: StatefulSet metadata: name: {{ .Values.rediscluster.name }} spec: serviceName: {{ .Values.service.name }} replicas: {{ .Values.rediscluster.replicaCount }} selector: matchLabels: app.kubernetes.io/name: {{ .Values.rediscluster.name }} app.kubernetes.io/instance: {{ .Release.Name }} template: metadata: labels: app.kubernetes.io/name: {{ .Values.rediscluster.name }} app.kubernetes.io/instance: {{ .Release.Name }} spec: topologySpreadConstraints: - maxSkew: 1 topologyKey: kubernetes.io/hostname whenUnsatisfiable: {{ .Values.topology.policyUnstisfiable }} #whenUnsatisfiable: ScheduleAnyway #whenUnsatisfiable: DoNotSchedule labelSelector: matchLabels: app.kubernetes.io/name: {{ .Values.rediscluster.name }} app.kubernetes.io/instance: {{ .Release.Name }} containers: - name: {{ .Values.container.name }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} ports: - containerPort: 6379 name: client - containerPort: 16379 name: gossip command: ["/conf/update-node.sh", "redis-server", "/conf/redis.conf"] env: - name: POD_IP valueFrom: fieldRef: fieldPath: status.podIP volumeMounts: - name: conf mountPath: /conf readOnly: false - name: data mountPath: /data readOnly: false volumes: - name: conf configMap: name: {{ .Values.rediscluster.name }}-cm defaultMode: 0755 volumeClaimTemplates: - metadata: name: data labels: app.kubernetes.io/name: {{ .Values.rediscluster.name }} app.kubernetes.io/instance: {{ .Release.Name }} spec: accessModes: [ "ReadWriteOnce" ] resources: requests: storage: {{ .Values.volume.storage }}