summaryrefslogtreecommitdiffstats
path: root/kubernetes
diff options
context:
space:
mode:
authorMahendra Raghuwanshi <mahendra.raghuwanshi@amdocs.com>2019-02-20 06:54:46 +0000
committerMahendra Raghuwanshi <mahendra.raghuwanshi@amdocs.com>2019-02-20 07:02:29 +0000
commitf59d9258543481a594a5da26577fdd8288d56df5 (patch)
tree27b9124983e5ebd6d428f214d61bb3893d489119 /kubernetes
parent6c6854859571b9e9a8d8ef1bfcae618eae7ac865 (diff)
Instantiate common cassandra cluster
Issue-ID: OOM-1198 Change-Id: Ie49a34cfbe5bdb2620312e8780dccbc0b86a0d6e Signed-off-by: Mahendra Raghuwanshi <mahendra.raghuwanshi@amdocs.com>
Diffstat (limited to 'kubernetes')
-rw-r--r--kubernetes/common/cassandra/templates/configmap.yaml15
-rw-r--r--kubernetes/common/cassandra/templates/pv.yaml (renamed from kubernetes/common/cassandra/templates/volumes.yaml)4
-rw-r--r--kubernetes/common/cassandra/templates/service.yaml58
-rw-r--r--kubernetes/common/cassandra/templates/statefulset.yaml79
-rw-r--r--kubernetes/common/cassandra/values.yaml48
-rw-r--r--kubernetes/onap/requirements.yaml4
-rw-r--r--kubernetes/onap/resources/environments/disable-allcharts.yaml2
-rw-r--r--kubernetes/onap/values.yaml2
8 files changed, 119 insertions, 93 deletions
diff --git a/kubernetes/common/cassandra/templates/configmap.yaml b/kubernetes/common/cassandra/templates/configmap.yaml
new file mode 100644
index 0000000000..a9420d7e5b
--- /dev/null
+++ b/kubernetes/common/cassandra/templates/configmap.yaml
@@ -0,0 +1,15 @@
+{{- if .Values.configOverrides }}
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: {{ include "common.fullname" . }}-configOverrides
+ namespace: {{ include "common.namespace" . }}
+ labels:
+ app: {{ include "common.name" . }}
+ chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+ release: {{ .Release.Name }}
+ heritage: {{ .Release.Service }}
+data:
+{{ toYaml .Values.configOverrides | indent 2 }}
+{{- end }}
+
diff --git a/kubernetes/common/cassandra/templates/volumes.yaml b/kubernetes/common/cassandra/templates/pv.yaml
index 9640aef7e3..06f41e7683 100644
--- a/kubernetes/common/cassandra/templates/volumes.yaml
+++ b/kubernetes/common/cassandra/templates/pv.yaml
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-#{{ if .Values.persistence.enabled }}
+{{ if .Values.persistence.enabled }}
{{- $root := . -}}
{{ range $i, $e := until (int $root.Values.replicaCount) }}
---
@@ -36,4 +36,4 @@ spec:
path: {{ $root.Values.persistence.mountPath }}/{{ $root.Release.Name }}/{{ $root.Values.persistence.mountSubPath }}-{{ $i }}
persistentVolumeReclaimPolicy: {{ $root.Values.persistence.volumeReclaimPolicy }}
{{ end }}
-#{{ end }}
+{{ end }}
diff --git a/kubernetes/common/cassandra/templates/service.yaml b/kubernetes/common/cassandra/templates/service.yaml
index 467a6a9d44..cda519115d 100644
--- a/kubernetes/common/cassandra/templates/service.yaml
+++ b/kubernetes/common/cassandra/templates/service.yaml
@@ -22,48 +22,28 @@ metadata:
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
+ annotations:
+ service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
spec:
type: {{ .Values.service.type }}
+ publishNotReadyAddresses: true
ports:
- {{if eq .Values.service.type "NodePort" -}}
- - port: {{ .Values.service.externalPort }}
- targetPort: {{ .Values.service.internalPort }}
- nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort }}
- name: {{ .Values.service.portName }}
- - port: {{ .Values.service.externalPort2 }}
- targetPort: {{ .Values.service.internalPort2 }}
- nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort2 }}
- name: {{ .Values.service.portName }}2
- - port: {{ .Values.service.externalPort3 }}
- targetPort: {{ .Values.service.internalPort3 }}
- nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort3 }}
- name: {{ .Values.service.portName }}3
- - port: {{ .Values.service.externalPort4 }}
- targetPort: {{ .Values.service.internalPort4 }}
- nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort4 }}
- name: {{ .Values.service.portName }}4
- - port: {{ .Values.service.externalPort5 }}
- targetPort: {{ .Values.service.internalPort5 }}
- nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort5 }}
- name: {{ .Values.service.portName }}5
-
- {{- else -}}
- - port: {{ .Values.service.externalPort }}
- targetPort: {{ .Values.service.internalPort }}
- name: {{ .Values.service.portName }}
- - port: {{ .Values.service.externalPort2 }}
- targetPort: {{ .Values.service.internalPort2 }}
- name: {{ .Values.service.portName }}2
- - port: {{ .Values.service.externalPort3 }}
- targetPort: {{ .Values.service.internalPort3 }}
- name: {{ .Values.service.portName }}3
- - port: {{ .Values.service.externalPort4 }}
- targetPort: {{ .Values.service.internalPort4 }}
- name: {{ .Values.service.portName }}4
- - port: {{ .Values.service.externalPort5 }}
- targetPort: {{ .Values.service.internalPort5 }}
- name: {{ .Values.service.portName }}5
- {{- end}}
+ {{if eq .Values.service.type "NodePort" -}}
+ {{- $global := . }}
+ {{- range $index, $ports := .Values.service.ports }}
+ - port: {{ $ports.port }}
+ targetPort: {{ $ports.port }}
+ nodePort: {{ $global.Values.global.nodePortPrefix | default $global.Values.nodePortPrefix }}{{ $ports.nodePort }}
+ name: {{ $ports.name }}
+ {{- end }}
+{{- else -}}
+ {{- range $index, $ports := .Values.service.ports }}
+ - port: {{ $ports.port }}
+ targetPort: {{ $ports.port }}
+ name: {{ $ports.name }}
+ {{- end }}
+{{- end}}
selector:
app: {{ include "common.name" . }}
release: {{ .Release.Name }}
+ clusterIP: None
diff --git a/kubernetes/common/cassandra/templates/statefulset.yaml b/kubernetes/common/cassandra/templates/statefulset.yaml
index 960d97ed52..86cf46751e 100644
--- a/kubernetes/common/cassandra/templates/statefulset.yaml
+++ b/kubernetes/common/cassandra/templates/statefulset.yaml
@@ -23,6 +23,10 @@ metadata:
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
+ selector:
+ matchLabels:
+ app: {{ include "common.name" . }}
+ release: {{ .Release.Name }}
serviceName: {{ include "common.servicename" . }}
replicas: {{ .Values.replicaCount }}
podManagementPolicy: {{ .Values.podManagementPolicy }}
@@ -35,24 +39,26 @@ spec:
release: {{ .Release.Name }}
name: {{ include "common.name" . }}
spec:
+ hostNetwork: {{ .Values.hostNetwork }}
containers:
- name: {{ include "common.name" . }}
image: {{ .Values.image }}
imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
ports:
- - containerPort: {{ .Values.service.internalPort }}
- - containerPort: {{ .Values.service.internalPort2 }}
- - containerPort: {{ .Values.service.internalPort3 }}
- - containerPort: {{ .Values.service.internalPort4 }}
- - containerPort: {{ .Values.service.internalPort5 }}
+ {{- range $index, $ports := .Values.service.ports }}
+ - containerPort: {{ $ports.port }}
+ {{- end }}
volumeMounts:
- - name: {{ .Values.service.name }}
+ - name: cassandra-data
mountPath: /var/lib/cassandra
- {{ if eq .Values.configmapping true }}
- - name: {{ .Values.service.name }}-docker-entry-initd
- mountPath: /{{ .Values.service.name }}-docker-entrypoint-initdb.d/cassandra.cql
- subPath: cassandra.cql
- {{ end }}
+ - name: localtime
+ mountPath: /etc/localtime
+ readOnly: true
+ {{- range $key, $value := .Values.configOverrides }}
+ - name: cassandra-config-{{ $key | replace "." "-" }}
+ mountPath: /etc/cassandra/{{ $key }}
+ subPath: {{ $key }}
+ {{- end }}
{{- if eq .Values.liveness.enabled true }}
livenessProbe:
exec:
@@ -62,6 +68,9 @@ spec:
- nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }'
initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
periodSeconds: {{ .Values.liveness.periodSeconds }}
+ timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
+ successThreshold: {{ .Values.liveness.successThreshold }}
+ failureThreshold: {{ .Values.liveness.failureThreshold }}
{{ end -}}
readinessProbe:
exec:
@@ -70,10 +79,19 @@ spec:
- -c
- nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }'
initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
- timeoutSeconds: {{ .Values.liveness.periodSeconds }}
+ periodSeconds: {{ .Values.readiness.periodSeconds }}
+ timeoutSeconds: {{ .Values.readiness.timeoutSeconds }}
+ successThreshold: {{ .Values.readiness.successThreshold }}
+ failureThreshold: {{ .Values.readiness.failureThreshold }}
env:
- {{- $seed_size := default 1 .Values.replicaCount | int -}}
- {{- $global := . }}
+ {{- $seed_size := default 1 .Values.replicaCount | int -}}
+ {{- $global := . }}
+ - name: CASSANDRA_SEEDS
+ {{- if .Values.hostNetwork }}
+ value: {{ required "You must fill \".Values.config.seeds\" with list of Cassandra seeds when hostNetwork is set to true" .Values.config.seeds | quote }}
+ {{- else }}
+ value: "{{- range $i, $e := until $seed_size }}{{ template "common.fullname" $global }}-{{ $i }}.{{ template "common.servicename" $global }}.{{ $global.Release.Namespace }}.svc.{{ $global.Values.config.cluster_domain }}{{- if (lt ( add1 $i ) $seed_size ) }},{{- end }}{{- end }}"
+ {{- end }}
- name: MAX_HEAP_SIZE
value: {{ .Values.config.heap.max }}
- name: HEAP_NEWSIZE
@@ -88,22 +106,22 @@ spec:
value: {{ .Values.config.rackName | quote }}
- name: CASSANDRA_AUTO_BOOTSTRAP
value: {{ .Values.config.autoBootstrap | quote }}
+ - name: CASSANDRA_START_RPC
+ value: {{ default "true" .Values.config.start_rpc | quote }}
+ - name: CASSANDRA_ENDPOINT_SNITCH
+ value: {{ default "SimpleSnitch" .Values.config.endpoint_snitch | quote }}
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- {{ if eq .Values.configmapping true }}
lifecycle:
- postStart:
+ preStop:
exec:
- command:
- - /bin/sh
- - -c
- - >
- /bin/sleep {{ .Values.readiness.initialDelaySeconds }};
- cd /{{ .Values.service.name }}-docker-entrypoint-initdb.d;
- cqlsh -u root -p root -f cassandra.cql
- {{ end }}
+ {{- if not .Values.persistence.enabled }}
+ command: ["/bin/sh", "-c", "exec nodetool decommission"]
+ {{- else }}
+ command: ["/bin/sh", "-c", "PID=$(pidof java) && kill $PID && while ps -p $PID > /dev/null; do sleep 1; done"]
+ {{- end }}
resources:
{{ toYaml .Values.resources | indent 10 }}
{{- if .Values.nodeSelector }}
@@ -118,21 +136,20 @@ spec:
- name: localtime
hostPath:
path: /etc/localtime
- {{ if eq .Values.configmapping true }}
- - name: {{ .Values.service.name }}-docker-entry-initd
+ {{- range $key, $value := .Values.configOverrides }}
+ - name: cassandra-config-{{ $key | replace "." "-" }}
configMap:
- name: {{ .Values.service.name }}-docker-entry-initd
- {{ end }}
+ name: {{ include "common.fullname" . }}-configOverrides
+ {{- end }}
{{- if not .Values.persistence.enabled }}
- - name: {{ .Values.service.name }}
+ - name: cassandra-data
emptyDir: {}
{{- else }}
volumeClaimTemplates:
- metadata:
- name: {{ .Values.service.name }}
+ name: cassandra-data
labels:
app: {{ template "common.fullname" . }}
- chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
annotations:
diff --git a/kubernetes/common/cassandra/values.yaml b/kubernetes/common/cassandra/values.yaml
index 375d7ae8dd..51e82f306e 100644
--- a/kubernetes/common/cassandra/values.yaml
+++ b/kubernetes/common/cassandra/values.yaml
@@ -27,14 +27,9 @@ pullPolicy: Always
# flag to enable debugging - application support required
debugEnabled: false
-# configmapping detail whether it exist locally or not
-# by default it is false, if you wanna configure it then mention
-# locally TRUE value in local values.yaml.
-
-configmapping: false
-
# application configuration
config:
+ cluster_domain: cluster.local
heap:
max: 512M
min: 100M
@@ -43,11 +38,13 @@ config:
dataCenter: Pod
rackName: Rack
autoBootstrap: true
- cassandraUsername: root
- cassandraPassword: root
+ # If hostNetwork is true then provide the comma separated list of seeds.
+ #seeds:seed1,seed2
# default number of instances
-replicaCount: 1
+replicaCount: 3
+
+hostNetwork: false
nodeSelector: {}
@@ -57,6 +54,9 @@ affinity: {}
liveness:
initialDelaySeconds: 60
periodSeconds: 10
+ timeoutSeconds: 3
+ successThreshold: 1
+ failureThreshold: 3
# necessary to disable liveness probe when setting breakpoints
# in debugger so K8s doesn't restart unresponsive container
enabled: true
@@ -64,25 +64,30 @@ liveness:
readiness:
initialDelaySeconds: 60
periodSeconds: 10
+ timeoutSeconds: 3
+ successThreshold: 1
+ failureThreshold: 3
service:
type: ClusterIP
name: cassandra
- portName: cassandra
- externalPort: 9160
- internalPort: 9160
- externalPort2: 7000
- internalPort2: 7000
- externalPort3: 7001
- internalPort3: 7001
- externalPort4: 7199
- internalPort4: 7199
- externalPort5: 9042
- internalPort5: 9042
+ ports:
+ - name: intra
+ port: 7000
+ - name: tls
+ port: 7001
+ - name: jmx
+ port: 7199
+ - name: cql
+ port: 9042
+ - name: thrift
+ port: 9160
+ - name: agent
+ port: 61621
podManagementPolicy: OrderedReady
updateStrategy:
- type: OnDelete
+ type: RollingUpdate
ingress:
enabled: false
@@ -111,6 +116,7 @@ persistence:
storageType: local
storageClass: ""
+configOverrides: {}
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
diff --git a/kubernetes/onap/requirements.yaml b/kubernetes/onap/requirements.yaml
index 96f3fb2199..0a6bfc7639 100644
--- a/kubernetes/onap/requirements.yaml
+++ b/kubernetes/onap/requirements.yaml
@@ -29,6 +29,10 @@ dependencies:
version: ~4.x-0
repository: '@local'
condition: appc.enabled
+ - name: cassandra
+ version: ~4.x-0
+ repository: '@local'
+ condition: cassandra.enabled
- name: clamp
version: ~4.x-0
repository: '@local'
diff --git a/kubernetes/onap/resources/environments/disable-allcharts.yaml b/kubernetes/onap/resources/environments/disable-allcharts.yaml
index dd30e1d87e..2364a9f393 100644
--- a/kubernetes/onap/resources/environments/disable-allcharts.yaml
+++ b/kubernetes/onap/resources/environments/disable-allcharts.yaml
@@ -31,6 +31,8 @@ aai:
enabled: false
appc:
enabled: false
+cassandra:
+ enabled: false
clamp:
enabled: false
cli:
diff --git a/kubernetes/onap/values.yaml b/kubernetes/onap/values.yaml
index d944e2e829..20e8b77c6e 100644
--- a/kubernetes/onap/values.yaml
+++ b/kubernetes/onap/values.yaml
@@ -71,6 +71,8 @@ appc:
openStackDomain: default
openStackUserName: admin
openStackEncryptedPassword: admin
+cassandra:
+ enabled: true
clamp:
enabled: true
cli: