diff --git a/kuttl/tests/helm_sva/c3/00-assert.yaml b/kuttl/tests/helm_sva/c3/00-assert.yaml new file mode 100644 index 000000000..84aa8c23a --- /dev/null +++ b/kuttl/tests/helm_sva/c3/00-assert.yaml @@ -0,0 +1,9 @@ +--- +# assert for splunk operator deployment to be ready +apiVersion: apps/v1 +kind: Deployment +metadata: + name: splunk-operator-controller-manager +status: + readyReplicas: 1 + availableReplicas: 1 \ No newline at end of file diff --git a/kuttl/tests/helm_sva/c3/00-install-operator.yaml b/kuttl/tests/helm_sva/c3/00-install-operator.yaml new file mode 100644 index 000000000..602ebe0c1 --- /dev/null +++ b/kuttl/tests/helm_sva/c3/00-install-operator.yaml @@ -0,0 +1,6 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - script: ../script/installoperator.sh + background: false \ No newline at end of file diff --git a/kuttl/tests/helm_sva/c3/01-assert.yaml b/kuttl/tests/helm_sva/c3/01-assert.yaml new file mode 100644 index 000000000..3e6fc7b5c --- /dev/null +++ b/kuttl/tests/helm_sva/c3/01-assert.yaml @@ -0,0 +1,90 @@ +--- +# assert for cluster manager custom resource to be ready +apiVersion: enterprise.splunk.com/v4 +kind: ClusterManager +metadata: + name: cm +status: + phase: Ready + +--- +# check if stateful sets are created +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: splunk-cm-cluster-manager +status: + replicas: 1 + +--- +# check if secret object are created +apiVersion: v1 +kind: Secret +metadata: + name: splunk-cm-cluster-manager-secret-v1 + +--- +# assert for indexer cluster custom resource to be ready +apiVersion: enterprise.splunk.com/v4 +kind: IndexerCluster +metadata: + name: idxc +status: + phase: Ready + +--- +# check for stateful set and replicas as configured +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: splunk-idxc-indexer +status: + replicas: 3 + +--- +# check if secret object are created +apiVersion: v1 +kind: Secret +metadata: + name: splunk-idxc-indexer-secret-v1 + +--- +# assert for SearchHeadCluster custom resource to be ready +apiVersion: enterprise.splunk.com/v4 +kind: SearchHeadCluster +metadata: + name: shc +status: + phase: Ready + +--- +# check if secret object are created +apiVersion: v1 +kind: Secret +metadata: + name: splunk-shc-deployer-secret-v1 + +--- +# check if secret object are created +apiVersion: v1 +kind: Secret +metadata: + name: splunk-shc-search-head-secret-v1 + +--- +# check for stateful set and replicas as configured +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: splunk-shc-search-head +status: + replicas: 3 + +--- +# check for statefull set +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: splunk-shc-deployer +status: + replicas: 1 diff --git a/kuttl/tests/helm_sva/c3/01-install-c3.yaml b/kuttl/tests/helm_sva/c3/01-install-c3.yaml new file mode 100644 index 000000000..4bca3d6e5 --- /dev/null +++ b/kuttl/tests/helm_sva/c3/01-install-c3.yaml @@ -0,0 +1,6 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - command: helm install splunk-c3 $HELM_REPO_PATH/splunk-enterprise -f c3_config.yaml + namespaced: true \ No newline at end of file diff --git a/kuttl/tests/helm_sva/c3/02-assert.yaml b/kuttl/tests/helm_sva/c3/02-assert.yaml new file mode 100644 index 000000000..84b4ee495 --- /dev/null +++ b/kuttl/tests/helm_sva/c3/02-assert.yaml @@ -0,0 +1,17 @@ +--- +# assert for indexer cluster custom resource to be ready +apiVersion: enterprise.splunk.com/v4 +kind: IndexerCluster +metadata: + name: idxc +status: + phase: Ready + +--- +# check for stateful sets and replicas updated +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: splunk-idxc-indexer +status: + replicas: 4 diff --git a/kuttl/tests/helm_sva/c3/02-scaleup-c3.yaml b/kuttl/tests/helm_sva/c3/02-scaleup-c3.yaml new file mode 100644 index 000000000..49a676b51 --- /dev/null +++ b/kuttl/tests/helm_sva/c3/02-scaleup-c3.yaml @@ -0,0 +1,5 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - command: helm upgrade splunk-c3 $HELM_REPO_PATH/splunk-enterprise --reuse-values --set indexerCluster.replicaCount=4 + namespaced: true diff --git a/kuttl/tests/helm_sva/c3/03-uninstall-c3.yaml b/kuttl/tests/helm_sva/c3/03-uninstall-c3.yaml new file mode 100644 index 000000000..01ee67e58 --- /dev/null +++ b/kuttl/tests/helm_sva/c3/03-uninstall-c3.yaml @@ -0,0 +1,5 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - command: helm uninstall splunk-c3 + namespaced: true diff --git a/kuttl/tests/helm_sva/c3/c3_config.yaml b/kuttl/tests/helm_sva/c3/c3_config.yaml new file mode 100644 index 000000000..e41af84a0 --- /dev/null +++ b/kuttl/tests/helm_sva/c3/c3_config.yaml @@ -0,0 +1,41 @@ +splunk-operator: + enabled: false + splunkOperator: + clusterWideAccess: false + persistentVolumeClaim: + storageClassName: gp2 + +sva: + c3: + enabled: true + + clusterManager: + name: cm + + indexerClusters: + - name: idxc + + searchHeadClusters: + - name: shc + + +indexerCluster: + enabled: true + additionalLabels: + label: "true" + additionalAnnotations: + annotation: "true" + +clusterManager: + enabled: true + additionalLabels: + label: "true" + additionalAnnotations: + annotation: "true" + +searchHeadCluster: + enabled: true + additionalLabels: + label: "true" + additionalAnnotations: + annotation: "true" diff --git a/kuttl/tests/helm_sva/c3/c3_scale_config.yaml b/kuttl/tests/helm_sva/c3/c3_scale_config.yaml new file mode 100644 index 000000000..a40260e50 --- /dev/null +++ b/kuttl/tests/helm_sva/c3/c3_scale_config.yaml @@ -0,0 +1,15 @@ +splunk-operator: + enabled: false +sva: + c3: + enabled: true + + clusterManager: + name: cm + + indexerClusters: + - name: idxc + replicaCount: 4 + + searchHeadClusters: + - name: shc diff --git a/kuttl/tests/helm_sva/m4/00-install-operator.yaml b/kuttl/tests/helm_sva/m4/00-install-operator.yaml new file mode 100644 index 000000000..602ebe0c1 --- /dev/null +++ b/kuttl/tests/helm_sva/m4/00-install-operator.yaml @@ -0,0 +1,6 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - script: ../script/installoperator.sh + background: false \ No newline at end of file diff --git a/kuttl/tests/helm_sva/m4/01-assert.yaml b/kuttl/tests/helm_sva/m4/01-assert.yaml new file mode 100644 index 000000000..f6443acd2 --- /dev/null +++ b/kuttl/tests/helm_sva/m4/01-assert.yaml @@ -0,0 +1,84 @@ + +--- +# assert for cluster manager custom resource to be ready +apiVersion: enterprise.splunk.com/v4 +kind: ClusterManager +metadata: + name: cm +status: + phase: Ready + +--- +# check for stateful set +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: splunk-cm-cluster-manager +status: + replicas: 1 + +--- +# check if secret object is created +apiVersion: v1 +kind: Secret +metadata: + name: splunk-cm-cluster-manager-secret-v1 + +--- +# assert for indexer cluster custom resource to be ready +apiVersion: enterprise.splunk.com/v4 +kind: IndexerCluster +metadata: + name: idx1 +status: + phase: Ready + +--- +# assert for indexer cluster custom resource to be ready +apiVersion: enterprise.splunk.com/v4 +kind: IndexerCluster +metadata: + name: idx2 +status: + phase: Ready + +--- +# assert for SearchHeadCluster custom resource to be ready +apiVersion: enterprise.splunk.com/v4 +kind: SearchHeadCluster +metadata: + name: shc1 +status: + phase: Ready + +--- +# check if secret object is created +apiVersion: v1 +kind: Secret +metadata: + name: splunk-shc1-deployer-secret-v1 + +--- +# check if secret object is created +apiVersion: v1 +kind: Secret +metadata: + name: splunk-shc1-search-head-secret-v1 + +--- +# check for stateful set and replicas +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: splunk-shc1-search-head +status: + replicas: 3 + +--- +# check for stateful set +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: splunk-shc1-deployer +status: + replicas: 1 diff --git a/kuttl/tests/helm_sva/m4/01-install-m4.yaml b/kuttl/tests/helm_sva/m4/01-install-m4.yaml new file mode 100644 index 000000000..70c03c4a8 --- /dev/null +++ b/kuttl/tests/helm_sva/m4/01-install-m4.yaml @@ -0,0 +1,6 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - command: helm install splunk-m4 $HELM_REPO_PATH/splunk-enterprise -f m4_config.yaml + namespaced: true diff --git a/kuttl/tests/helm_sva/m4/02-uninstall-m4.yaml b/kuttl/tests/helm_sva/m4/02-uninstall-m4.yaml new file mode 100644 index 000000000..7b7e44f99 --- /dev/null +++ b/kuttl/tests/helm_sva/m4/02-uninstall-m4.yaml @@ -0,0 +1,5 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - command: helm uninstall splunk-m4 + namespaced: true diff --git a/kuttl/tests/helm_sva/m4/m4_config.yaml b/kuttl/tests/helm_sva/m4/m4_config.yaml new file mode 100644 index 000000000..a14e05bd8 --- /dev/null +++ b/kuttl/tests/helm_sva/m4/m4_config.yaml @@ -0,0 +1,28 @@ +splunk-operator: + enabled: false + splunkOperator: + clusterWideAccess: false + persistentVolumeClaim: + storageClassName: gp2 +sva: + m4: + enabled: true + + clusterManager: + name: cm + allSites: "site1,site2" + site: site1 + zone: us-west-2d + + indexerClusters: + - name: idx1 + site: site1 + zone: us-west-2d + - name: idx2 + site: site2 + zone: us-west-2b + + searchHeadClusters: + - name: shc1 + site: site2 + zone: us-west-2b diff --git a/kuttl/tests/helm_sva/s1/00-install-operator.yaml b/kuttl/tests/helm_sva/s1/00-install-operator.yaml new file mode 100644 index 000000000..602ebe0c1 --- /dev/null +++ b/kuttl/tests/helm_sva/s1/00-install-operator.yaml @@ -0,0 +1,6 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - script: ../script/installoperator.sh + background: false \ No newline at end of file diff --git a/kuttl/tests/helm_sva/s1/00-install-service-account.yaml b/kuttl/tests/helm_sva/s1/00-install-service-account.yaml new file mode 100644 index 000000000..0bac79641 --- /dev/null +++ b/kuttl/tests/helm_sva/s1/00-install-service-account.yaml @@ -0,0 +1,6 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: helm-service-account +spec: {} diff --git a/kuttl/tests/helm_sva/s1/01-assert.yaml b/kuttl/tests/helm_sva/s1/01-assert.yaml new file mode 100644 index 000000000..41ddd97d2 --- /dev/null +++ b/kuttl/tests/helm_sva/s1/01-assert.yaml @@ -0,0 +1,7 @@ +# check for standalone to be in ready state +apiVersion: enterprise.splunk.com/v4 +kind: Standalone +metadata: + name: stdln +status: + phase: Ready diff --git a/kuttl/tests/helm_sva/s1/01-install-standalone.yaml b/kuttl/tests/helm_sva/s1/01-install-standalone.yaml new file mode 100644 index 000000000..191e42c79 --- /dev/null +++ b/kuttl/tests/helm_sva/s1/01-install-standalone.yaml @@ -0,0 +1,7 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - command: helm install splunk-stdl $HELM_REPO_PATH/splunk-enterprise --set splunk-operator.enabled=false --set standalone.enabled=true + namespaced: true +spec: + serviceAccount: helm-service-account diff --git a/kuttl/tests/helm_sva/s1/02-assert.yaml b/kuttl/tests/helm_sva/s1/02-assert.yaml new file mode 100644 index 000000000..be9139729 --- /dev/null +++ b/kuttl/tests/helm_sva/s1/02-assert.yaml @@ -0,0 +1,7 @@ +# check for standalone to be scaled +apiVersion: enterprise.splunk.com/v4 +kind: Standalone +metadata: + name: stdln +status: + replicas: 2 diff --git a/kuttl/tests/helm_sva/s1/02-scaleup-standalone.yaml b/kuttl/tests/helm_sva/s1/02-scaleup-standalone.yaml new file mode 100644 index 000000000..6695f352e --- /dev/null +++ b/kuttl/tests/helm_sva/s1/02-scaleup-standalone.yaml @@ -0,0 +1,7 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - command: helm upgrade --set standalone.replicaCount=2 --set splunk-operator.enabled=false --set standalone.enabled=true splunk-stdl ../../../../helm-chart/splunk-enterprise + namespaced: true +spec: + serviceAccount: helm-service-account diff --git a/kuttl/tests/helm_sva/s1/03-assert.yaml b/kuttl/tests/helm_sva/s1/03-assert.yaml new file mode 100644 index 000000000..328b504cf --- /dev/null +++ b/kuttl/tests/helm_sva/s1/03-assert.yaml @@ -0,0 +1,7 @@ +# check for standalone to be scaled down +apiVersion: enterprise.splunk.com/v4 +kind: Standalone +metadata: + name: stdln +status: + replicas: 1 diff --git a/kuttl/tests/helm_sva/s1/03-rollback-standalone.yaml b/kuttl/tests/helm_sva/s1/03-rollback-standalone.yaml new file mode 100644 index 000000000..6534b5811 --- /dev/null +++ b/kuttl/tests/helm_sva/s1/03-rollback-standalone.yaml @@ -0,0 +1,7 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - command: helm rollback splunk-stdl 1 + namespaced: true +spec: + serviceAccount: helm-service-account diff --git a/kuttl/tests/helm_sva/s1/04-assert.yaml b/kuttl/tests/helm_sva/s1/04-assert.yaml new file mode 100644 index 000000000..143f57d6e --- /dev/null +++ b/kuttl/tests/helm_sva/s1/04-assert.yaml @@ -0,0 +1,17 @@ +--- +# check for MonitoringConsole to be in ready state +apiVersion: enterprise.splunk.com/v4 +kind: MonitoringConsole +metadata: + name: mc +status: + phase: Ready + +--- +# check for standalone to be in ready state +apiVersion: enterprise.splunk.com/v4 +kind: Standalone +metadata: + name: stdln +status: + phase: Ready diff --git a/kuttl/tests/helm_sva/s1/04-monitoringconsole-standalone.yaml b/kuttl/tests/helm_sva/s1/04-monitoringconsole-standalone.yaml new file mode 100644 index 000000000..0584cb744 --- /dev/null +++ b/kuttl/tests/helm_sva/s1/04-monitoringconsole-standalone.yaml @@ -0,0 +1,7 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - command: helm upgrade splunk-stdl $HELM_REPO_PATH/splunk-enterprise --set splunk-operator.enabled=false --set standalone.enabled=true --set monitoringConsole.enabled=true + namespaced: true +spec: + serviceAccount: helm-service-account diff --git a/kuttl/tests/helm_sva/s1/05-assert.yaml b/kuttl/tests/helm_sva/s1/05-assert.yaml new file mode 100644 index 000000000..8cd3aca61 --- /dev/null +++ b/kuttl/tests/helm_sva/s1/05-assert.yaml @@ -0,0 +1,7 @@ +# check for License manager to be in ready state +apiVersion: enterprise.splunk.com/v4 +kind: LicenseManager +metadata: + name: lm +status: + phase: Ready diff --git a/kuttl/tests/helm_sva/s1/05-licensemanager-standalone.yaml b/kuttl/tests/helm_sva/s1/05-licensemanager-standalone.yaml new file mode 100644 index 000000000..6ae274d8b --- /dev/null +++ b/kuttl/tests/helm_sva/s1/05-licensemanager-standalone.yaml @@ -0,0 +1,7 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - command: helm upgrade splunk-stdl $HELM_REPO_PATH/splunk-enterprise --set splunk-operator.enabled=false --set standalone.enabled=true --set monitoringConsole.enabled=true --set licenseManager.enabled=true + namespaced: true +spec: + serviceAccount: helm-service-account \ No newline at end of file diff --git a/kuttl/tests/helm_sva/s1/06-delete-standalone.yaml b/kuttl/tests/helm_sva/s1/06-delete-standalone.yaml new file mode 100644 index 000000000..cdabbf173 --- /dev/null +++ b/kuttl/tests/helm_sva/s1/06-delete-standalone.yaml @@ -0,0 +1,7 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - command: helm uninstall splunk-stdl + namespaced: true +spec: + serviceAccount: helm-service-account diff --git a/kuttl/tests/helm_sva/s1/06-errors.yaml b/kuttl/tests/helm_sva/s1/06-errors.yaml new file mode 100644 index 000000000..8399de722 --- /dev/null +++ b/kuttl/tests/helm_sva/s1/06-errors.yaml @@ -0,0 +1,4 @@ +--- +apiVersion: enterprise.splunk.com/v3 +kind: Standalone +name: test diff --git a/kuttl/tests/helm_sva/script/installoperator.sh b/kuttl/tests/helm_sva/script/installoperator.sh new file mode 100755 index 000000000..9edd00e4f --- /dev/null +++ b/kuttl/tests/helm_sva/script/installoperator.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +if [ "${INSTALL_OPERATOR}" = true ]; then + echo "installing operator" + helm install splunk-operator $HELM_REPO_PATH/splunk-operator --namespace $NAMESPACE --set splunkOperator.persistentVolumeClaim.storageClassName=gp2 --set splunkOperator.clusterWideAccess=false --set splunkOperator.image.repository=${KUTTL_SPLUNK_OPERATOR_IMAGE} --set image.repository=${KUTTL_SPLUNK_ENTERPRISE_IMAGE} + retVal=$? + if [ $retVal -ne 0 ]; then + echo "operator installation failed" + echo "Error" + exit $retVal + else + kubectl wait --for=condition=ready pod -l control-plane=controller-manager --timeout=600s -n $NAMESPACE + retVal=$? + echo "operator installation success" + exit $retVal + fi +else + echo "INSTALL_OPERATOR env is not set, skip" +fi