Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions e2e-tests/conf/eks-storage-class.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: gp3-expandable
annotations:
storageclass.kubernetes.io/is-default-class: "true"
provisioner: ebs.csi.aws.com
parameters:
type: gp3
allowVolumeExpansion: true
reclaimPolicy: Delete
volumeBindingMode: WaitForFirstConsumer
44 changes: 36 additions & 8 deletions e2e-tests/functions
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ if oc get projects 2>/dev/null; then
OPENSHIFT=4
fi

if [ $(kubectl version -o json | jq -r '.serverVersion.gitVersion' | grep "\-eks\-") ]; then
EKS=1
else
EKS=0
fi

init_temp_dir() {
rm -rf "$TEMP_DIR"
mkdir -p "$TEMP_DIR"
Expand Down Expand Up @@ -317,6 +323,7 @@ deploy_minio() {
prepare_vault_tls() {
local name=$1
local namespace=$2
local platform=$3
local csr_name=vault-csr-${RANDOM}
local csr_api_ver="v1"
local csr_signer
Expand Down Expand Up @@ -423,14 +430,17 @@ _deploy_vault() {

if [[ ${platform} == "openshift" ]]; then
oc patch clusterrole system:auth-delegator --type='json' -p '[{"op":"add","path":"/rules/-", "value":{"apiGroups":["security.openshift.io"], "attributeRestrictions":null, "resourceNames": ["privileged"], "resources":["securitycontextconstraints"],"verbs":["use"]}}]'
local extra_args="--set server.image.repository=docker.io/hashicorp/vault \
--set injector.image.repository=docker.io/hashicorp/vault-k8s"
fi

if [ $protocol == "https" ]; then
prepare_vault_tls ${name} ${namespace}
prepare_vault_tls ${name} ${namespace} ${platform}
helm install $name hashicorp/vault \
--disable-openapi-validation \
--version ${VAULT_VER} \
--namespace "${namespace}" \
$extra_args \
--set dataStorage.enabled=false \
--set global.tlsDisable=false \
--set global.logLevel="trace" \
Expand All @@ -455,6 +465,7 @@ storage \"file\" {
--disable-openapi-validation \
--version ${VAULT_VER} \
--namespace "${namespace}" \
$extra_args \
--set dataStorage.enabled=false \
--set global.logLevel="trace" \
--set global.platform="${platform}"
Expand Down Expand Up @@ -503,6 +514,14 @@ deploy_vault() {
local tmp_dir=/tmp/vault
echo "Using tmp dir: ${tmp_dir}"

if [[ -n ${OPENSHIFT} ]]; then
platform=openshift
fi

if [ "$EKS" = 1 ]; then
platform=eks
fi

_deploy_vault ${name} ${protocol} ${platform} ${namespace} ${tmp_dir}

local unsealKey=$(jq -r ".unseal_keys_b64[]" <"$tmp_dir/$name")
Expand Down Expand Up @@ -1018,15 +1037,23 @@ check_passwords_leak() {
}

deploy_chaos_mesh() {
destroy_chaos_mesh
local container_runtime="containerd"
local socket_path="/run/containerd/containerd.sock"

helm repo add chaos-mesh https://charts.chaos-mesh.org
destroy_chaos_mesh

if [ -n "${MINIKUBE}" ]; then
helm install chaos-mesh chaos-mesh/chaos-mesh --namespace=${NAMESPACE} --set chaosDaemon.runtime=docker --set dashboard.create=false --version ${CHAOS_MESH_VER}
else
helm install chaos-mesh chaos-mesh/chaos-mesh --namespace=${NAMESPACE} --set chaosDaemon.runtime=containerd --set chaosDaemon.socketPath=/run/containerd/containerd.sock --set dashboard.create=false --version ${CHAOS_MESH_VER}
container_runtime=docker
socket_path=/var/run/docker.sock
elif [ -n "${OPENSHIFT}" ]; then
container_runtime=crio
socket_path=/var/run/crio/crio.sock
fi
if [[ -n $OPENSHIFT ]]; then

helm repo add chaos-mesh https://charts.chaos-mesh.org
helm install chaos-mesh chaos-mesh/chaos-mesh --namespace=${NAMESPACE} --set chaosDaemon.runtime=$container_runtime --set chaosDaemon.socketPath=$socket_path --set dashboard.create=false --version ${CHAOS_MESH_VER}

if [ -n "${OPENSHIFT}" ]; then
oc adm policy add-scc-to-user privileged -z chaos-daemon --namespace=${NAMESPACE}
fi

Expand Down Expand Up @@ -1220,7 +1247,8 @@ check_primary_chaos() {
online_members=$(get_innodb_cluster_status ${uri} \
| jq .defaultReplicaSet.topology[].status \
| grep ONLINE \
| wc -l)
| wc -l \
| sed 's/ //g')

if [[ ${online_members} != 3 ]]; then
echo "expected 3 online members, got ${online_members}"
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/tests/gr-self-healing/01-deploy-chaos-mesh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ commands:
source ../../functions

deploy_chaos_mesh
timeout: 120
timeout: 240
2 changes: 1 addition & 1 deletion e2e-tests/tests/gr-self-healing/14-assert.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
timeout: 480
timeout: 720
---
kind: StatefulSet
apiVersion: apps/v1
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/tests/gr-self-healing/17-assert.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
timeout: 480
timeout: 720
---
kind: StatefulSet
apiVersion: apps/v1
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/tests/pvc-resize/01-assert.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
timeout: 300
timeout: 400
---
apiVersion: ps.percona.com/v1alpha1
kind: PerconaServerMySQL
Expand Down
4 changes: 4 additions & 0 deletions e2e-tests/tests/pvc-resize/01-create-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ commands:

source ../../functions

if [ "$EKS" = 1 ]; then
kubectl apply -f ../../conf/eks-storage-class.yaml
fi

get_cr \
| yq eval '.spec.mysql.clusterType="group-replication"' - \
| yq eval '.spec.mysql.size=3' - \
Expand Down
Loading