[MARIADB][COMMON] Add support for mariadb-operator
[oom.git] / kubernetes / common / common / templates / _cassOp.tpl
1 {{/*
2 # Copyright © 2022 Deutsche Telekom AG
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #       http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 */}}
16
17 {{/* Cassandra Data Center. */}}
18 {{- define "common.k8ssandraCluster" -}}
19 {{- $global := .Values.global }}
20 ---
21 apiVersion: k8ssandra.io/v1alpha1
22 kind: K8ssandraCluster
23 metadata:
24   name: {{ .Values.k8ssandraOperator.config.clusterName }}
25 spec:
26   reaper:
27     containerImage:
28       registry: {{ include "repositoryGenerator.dockerHubRepository" . }}
29     autoScheduling:
30       enabled: true
31   stargate:
32     containerImage:
33       registry: {{ include "repositoryGenerator.dockerHubRepository" . }}
34       tag: {{ .Values.k8ssandraOperator.stargate.tag }}
35     size: {{ .Values.k8ssandraOperator.stargate.size }}
36     heapSize: {{ .Values.k8ssandraOperator.stargate.jvmOptions.heapSize }}
37     livenessProbe:
38       initialDelaySeconds: 200
39       periodSeconds: 10
40       failureThreshold: 20
41       successThreshold: 1
42       timeoutSeconds: 20
43     readinessProbe:
44       initialDelaySeconds: 200
45       periodSeconds: 10
46       failureThreshold: 20
47       successThreshold: 1
48       timeoutSeconds: 20
49   cassandra:
50     serverVersion: {{ .Values.k8ssandraOperator.cassandraVersion }}
51     storageConfig:
52       cassandraDataVolumeClaimSpec:
53         {{ if .Values.k8ssandraOperator.persistence.storageClassName -}}
54         storageClassName: {{ .Values.k8ssandraOperator.persistence.storageClassName }}
55         {{- end }}
56         accessModes:
57           - ReadWriteOnce
58         resources:
59           requests:
60             storage: {{ .Values.k8ssandraOperator.persistence.size }}
61     superuserSecretRef:
62       name: {{ include "common.fullname" . }}-{{ .Values.k8ssandraOperator.config.secretName }}
63     config:
64       {{ if .Values.k8ssandraOperator.config.casOptions -}}
65       cassandraYaml:
66         {{ toYaml .Values.k8ssandraOperator.config.casOptions | nindent 8 }}
67       {{- end }}
68       {{ if .Values.k8ssandraOperator.config.jvmOptions -}}
69       jvmOptions:
70         {{ toYaml .Values.k8ssandraOperator.config.jvmOptions | nindent 8 }}
71       {{- end }}
72     networking:
73       hostNetwork: {{ .Values.k8ssandraOperator.config.hostNetwork }}
74     datacenters:
75       {{- range $datacenter := .Values.k8ssandraOperator.datacenters }}
76       - metadata:
77           name: {{ $datacenter.name }}
78         size: {{ $datacenter.size }}
79       {{- end }}
80     {{ if .Values.podAnnotations -}}
81     metadata:
82       pods:
83         annotations:
84           {{ toYaml .Values.podAnnotations | nindent 10 }}
85       commonLabels:
86         app: {{ .Values.k8ssandraOperator.config.clusterName }}
87         version: {{ .Values.k8ssandraOperator.cassandraVersion }}
88     {{- end }}
89 {{ end }}