Skip to content

Commit

Permalink
Experimental
Browse files Browse the repository at this point in the history
  • Loading branch information
marcobebway committed Sep 9, 2024
1 parent 6b6fa6c commit 209fd5c
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 5 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/setup-test-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,14 @@ jobs:
echo "Kyma is Ready"
echo "::endgroup::"
- name: Deploy Kyma modules
run: |
echo "::group::Kyma - Deploy Kyma modules"
chmod +x ./scripts/shell/deploy_kyma_modules.sh
./scripts/shell/deploy_kyma_modules.sh
echo "::endgroup::"
- name: Deploy all single-namespace test-cases
run: |
chmod +x ./scripts/shell/deploy_test_scenarios.sh
./scripts/shell/deploy_test_scenarios.sh
if [ $? -ne 0 ]; then
echo "Failed to deploy all single-namespace test-cases"
exit 1
fi
40 changes: 39 additions & 1 deletion scripts/shell/clean_up_cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,41 @@ set -o errexit # exit immediately when a command fails.
set -E # needs to be set if we want the ERR trap
set -o pipefail # prevents errors in a pipeline from being masked

delete_kyma_modules() {
echo "## Delete Subscriptions ##"
kubectl delete --timeout=120s --wait=false -A subscriptions.eventing.kyma-project.io --all || true

echo "## Delete API Rules ##"
kubectl delete --timeout=120s --wait=false -A apirules.gateway.kyma-project.io --all || true

echo "## Delete Functions ##"
kubectl delete --timeout=120s --wait=false -A functions.serverless.kyma-project.io --all || true

echo "## Delete Eventing ##"
kubectl delete --timeout=120s --ignore-not-found -f https://github.com/kyma-project/eventing-manager/releases/latest/download/eventing-default-cr.yaml || true
kubectl delete --timeout=120s --wait=false --ignore-not-found -f https://github.com/kyma-project/eventing-manager/releases/latest/download/eventing-manager.yaml || true

echo "## Delete NATS ##"
kubectl delete --timeout=120s --ignore-not-found -f https://github.com/kyma-project/nats-manager/releases/latest/download/nats-default-cr.yaml || true
kubectl delete --timeout=120s --wait=false --ignore-not-found -f https://github.com/kyma-project/nats-manager/releases/latest/download/nats-manager.yaml || true

echo "## Delete Serverless ##"
kubectl delete --timeout=120s --ignore-not-found -f https://github.com/kyma-project/serverless-manager/releases/latest/download/default-serverless-cr.yaml -n kyma-system || true
kubectl delete --timeout=120s --wait=false --ignore-not-found -f https://github.com/kyma-project/serverless-manager/releases/latest/download/serverless-operator.yaml || true

echo "## Delete API Gateway ##"
kubectl patch apigateways.operator.kyma-project.io default -p '{"metadata":{"finalizers":null}}' --type=merge || true
kubectl delete --timeout=120s --ignore-not-found -f https://github.com/kyma-project/api-gateway/releases/latest/download/apigateway-default-cr.yaml || true
kubectl delete --timeout=120s --wait=false --ignore-not-found -f https://github.com/kyma-project/api-gateway/releases/latest/download/api-gateway-manager.yaml || true

echo "## Delete Istio ##"
kubectl patch istios.operator.kyma-project.io -n kyma-system default -p '{"metadata":{"finalizers":null}}' --type=merge || true
kubectl delete --timeout=120s --wait=false --ignore-not-found peerauthentications.security.istio.io --all -A --force=true || true
kubectl delete --timeout=120s --ignore-not-found -f https://github.com/kyma-project/istio/releases/latest/download/istio-default-cr.yaml || true
kubectl delete --timeout=120s --wait=false --ignore-not-found -f https://github.com/kyma-project/istio/releases/latest/download/istio-manager.yaml || true
kubectl label namespace kyma-system istio-injection- || true
}

# Define namespaces to exclude from deletion
EXCLUDED_NAMESPACES=("default" "kube-system" "kube-public" "kube-node-lease")

Expand Down Expand Up @@ -59,6 +94,9 @@ delete_custom_resource_definitions() {

## Main script starts here ##

echo "### Deleting Kyma modules. ###"
delete_kyma_modules

# Remove Custom Resource Definitions (CRDs) that contain 'kyma-project'
echo "### Removing CRDs related to 'kyma-project'. ###"

Expand Down Expand Up @@ -107,4 +145,4 @@ done
echo "### Deleting all non-critical namespaces. ###"
kubectl get namespaces --no-headers | awk -v excl="$EXCLUDED_REGEX" '$1 !~ excl {print $1}' | xargs -r kubectl delete namespace

echo "### Cleanup completed! ###"
echo "### Cleanup completed! ###"
36 changes: 36 additions & 0 deletions scripts/shell/deploy_kyma_modules.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bash

##############################################################################
# NOTE: This script is used in the GitHub Actions workflow.
# Make sure any changes are compatible with the existing workflows.
##############################################################################

# standard bash error handling
set -o nounset # treat unset variables as an error and exit immediately.
set -o errexit # exit immediately when a command fails.
set -E # needs to be set if we want the ERR trap
set -o pipefail # prevents errors in a pipeline from being masked

#echo "### Create kyma-system namespace ###"
#kubectl create namespace kyma-system --dry-run=client -o yaml | kubectl apply -f -

echo "### Deploy Istio ###"
kubectl label namespace kyma-system istio-injection=enabled --overwrite
kubectl apply -f https://github.com/kyma-project/istio/releases/latest/download/istio-manager.yaml
kubectl apply -f https://github.com/kyma-project/istio/releases/latest/download/istio-default-cr.yaml

echo "### Deploy API Gateway ###"
kubectl apply -f https://github.com/kyma-project/api-gateway/releases/latest/download/api-gateway-manager.yaml
kubectl apply -f https://github.com/kyma-project/api-gateway/releases/latest/download/apigateway-default-cr.yaml

echo "### Deploy Serverless ###"
kubectl apply -f https://github.com/kyma-project/serverless-manager/releases/latest/download/serverless-operator.yaml
kubectl apply -f https://github.com/kyma-project/serverless-manager/releases/latest/download/default-serverless-cr.yaml -n kyma-system

echo "### Deploy NATS ###"
kubectl apply -f https://github.com/kyma-project/nats-manager/releases/latest/download/nats-manager.yaml
kubectl apply -f https://github.com/kyma-project/nats-manager/releases/latest/download/nats-default-cr.yaml

echo "### Deploy Eventing ###"
kubectl apply -f https://github.com/kyma-project/eventing-manager/releases/latest/download/eventing-manager.yaml
kubectl apply -f https://github.com/kyma-project/eventing-manager/releases/latest/download/eventing-default-cr.yaml

0 comments on commit 209fd5c

Please sign in to comment.