[CASSANDRA] Make stargate and reaper deployment optional

As Reaper startup is failing in many cases the deployment
it should be possible to disable it to stabilize the gating
Change the delay handling in the deploy plugin.

Issue-ID: OOM-3246

Change-Id: Ibf435d30551aacc213d7c9d38bce72198f4f4b3d
Signed-off-by: Andreas Geissler <andreas-geissler@telekom.de>
diff --git a/kubernetes/aai/components/aai-graphadmin/templates/job-copy-db-backup.yaml b/kubernetes/aai/components/aai-graphadmin/templates/job-copy-db-backup.yaml
index 2bee19f..865dfe3 100644
--- a/kubernetes/aai/components/aai-graphadmin/templates/job-copy-db-backup.yaml
+++ b/kubernetes/aai/components/aai-graphadmin/templates/job-copy-db-backup.yaml
@@ -64,11 +64,7 @@
       - command:
         - /bin/bash
         - -c
-        {{- if .Values.global.cassandra.useOperator }}
-        - /app/ready.py --app-name aai-cassandra-reaper --timeout 1 || /app/ready.py --app-name cassandra-reaper
-        {{- else }}
         - /app/ready.py --app-name aai-cassandra --timeout 1 || /app/ready.py --app-name cassandra
-        {{- end }}
         env:
         - name: NAMESPACE
           valueFrom:
diff --git a/kubernetes/aai/components/aai-graphadmin/templates/job-create-db.yaml b/kubernetes/aai/components/aai-graphadmin/templates/job-create-db.yaml
index c80d348..1a81249 100644
--- a/kubernetes/aai/components/aai-graphadmin/templates/job-create-db.yaml
+++ b/kubernetes/aai/components/aai-graphadmin/templates/job-create-db.yaml
@@ -60,9 +60,9 @@
         args:
         - --app-name
         {{- if .Values.global.cassandra.localCluster }}
-        - {{ ternary "aai-cassandra-reaper" "aai-cassandra" .Values.global.cassandra.useOperator }}
+        - aai-cassandra
         {{- else }}
-        - {{ ternary "cassandra-reaper" "cassandra" .Values.global.cassandra.useOperator }}
+        - cassandra
         {{- end }}
         - --container-name
         - aai-schema-service
diff --git a/kubernetes/aai/components/aai-graphadmin/templates/job-migration.yaml b/kubernetes/aai/components/aai-graphadmin/templates/job-migration.yaml
index b2bc0e7..bf3279f 100644
--- a/kubernetes/aai/components/aai-graphadmin/templates/job-migration.yaml
+++ b/kubernetes/aai/components/aai-graphadmin/templates/job-migration.yaml
@@ -65,9 +65,9 @@
         args:
         - --app-name
         {{- if .Values.global.cassandra.localCluster }}
-        - {{ ternary "aai-cassandra-reaper" "aai-cassandra" .Values.global.cassandra.useOperator }}
+        - aai-cassandra
         {{- else }}
-        - {{ ternary "cassandra-reaper" "cassandra" .Values.global.cassandra.useOperator }}
+        - cassandra
         {{- end }}
         - --container-name
         - aai-schema-service
diff --git a/kubernetes/common/cassandra/values.yaml b/kubernetes/common/cassandra/values.yaml
index eef716e..205c711 100644
--- a/kubernetes/common/cassandra/values.yaml
+++ b/kubernetes/common/cassandra/values.yaml
@@ -29,7 +29,7 @@
     enableServiceAccount: false
 
 k8ssandraOperator:
-  cassandraVersion: 4.0.1
+  cassandraVersion: 4.0.10
   persistence:
     #storageClassName: default
     size: 10Gi
@@ -47,7 +47,10 @@
   datacenters:
     - name: dc1
       size: 3
+  reaper:
+    enabled: true
   stargate:
+    enabled: true
     tag: v1.0.76
     size: 1
     jvmOptions:
diff --git a/kubernetes/common/common/templates/_cassOp.tpl b/kubernetes/common/common/templates/_cassOp.tpl
index 3ea3ff1..b9f6766 100644
--- a/kubernetes/common/common/templates/_cassOp.tpl
+++ b/kubernetes/common/common/templates/_cassOp.tpl
@@ -23,6 +23,7 @@
 metadata:
   name: {{ .Values.k8ssandraOperator.config.clusterName }}
 spec:
+  {{ if .Values.k8ssandraOperator.reaper.enabled -}}
   reaper:
     initContainerImage:
       registry: {{ include "repositoryGenerator.dockerHubRepository" . }}
@@ -34,6 +35,8 @@
       commonLabels:
         app: {{ .Values.k8ssandraOperator.config.clusterName }}-reaper
         version: {{ .Values.k8ssandraOperator.cassandraVersion }}
+  {{- end }}
+  {{ if .Values.k8ssandraOperator.stargate.enabled -}}
   stargate:
     containerImage:
       registry: {{ include "repositoryGenerator.dockerHubRepository" . }}
@@ -56,6 +59,7 @@
       failureThreshold: 20
       successThreshold: 1
       timeoutSeconds: 20
+  {{- end }}
   cassandra:
     serverVersion: {{ .Values.k8ssandraOperator.cassandraVersion }}
     storageConfig:
diff --git a/kubernetes/helm/plugins/deploy/deploy.sh b/kubernetes/helm/plugins/deploy/deploy.sh
index 3b16bf3..f60a2d3 100755
--- a/kubernetes/helm/plugins/deploy/deploy.sh
+++ b/kubernetes/helm/plugins/deploy/deploy.sh
@@ -296,8 +296,8 @@
         done
       fi
     done
-
-
+    # Disable delay
+    DELAY="false"
     for subchart in * ; do
       SUBCHART_OVERRIDES=$CACHE_SUBCHART_DIR/$subchart/subchart-overrides.yaml
 
diff --git a/kubernetes/sdc/components/sdc-cs/templates/job.yaml b/kubernetes/sdc/components/sdc-cs/templates/job.yaml
index 8082054..3738ff4 100644
--- a/kubernetes/sdc/components/sdc-cs/templates/job.yaml
+++ b/kubernetes/sdc/components/sdc-cs/templates/job.yaml
@@ -36,9 +36,9 @@
         args:
         - --app-name
         {{- if .Values.global.sdc_cassandra.localCluster }}
-        - {{ ternary "sdc-cs-reaper" "sdc-cs" .Values.global.sdc_cassandra.useOperator }}
+        - sdc-cs
         {{- else }}
-        - {{ ternary "cassandra-reaper" "cassandra" .Values.global.sdc_cassandra.useOperator }}
+        - cassandra
         {{- end }}
         - "-t"
         - "15"