diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 818aa1f3d8ce6cce712c3752f285918fba7afe43..32a7e9b108a2d7ac2861a801645f3a6bd5f5e48f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -33,7 +33,7 @@ stages: - kubectl get helmrelease -A .deploy_bigbang: &deploy_bigbang - - for script in ./scripts/*.sh; do chmod +x $script && $script; done + - for script in ./scripts/deploy/*.sh; do chmod +x $script && $script; done .test_bigbang: &test_bigbang - for test in ./tests/bash/*.sh; do chmod +x $test && $test; done @@ -194,14 +194,11 @@ aws/rke2/bigbang test: - mkdir -p ~/.kube - cp ${CI_PROJECT_DIR}/rke2.yaml ~/.kube/config script: - - sleep 240 - - kubectl get all -A - - kubectl get vs -A - - kubectl describe gateway main -n istio-system - - kubectl get gateway main -n istio-system - - kubectl get gateway main -n istio-system -o yaml - - kubectl get service -n istio-system - - kubectl get service istio-ingressgateway -n istio-system -o yaml + ## Move this yum install to the dockerfile for the builder + ## putting it here now for a quick way to install dig + - yum install bind-utils -y + - chmod +x scripts/hosts.sh && ./scripts/hosts.sh + - *test_bigbang # Uninstall BigBang on RKE2 cluster on AWS aws/rke2/bigbang down: diff --git a/examples/complete/envs/dev/patch-bigbang.yaml b/examples/complete/envs/dev/patch-bigbang.yaml index 763cb5aca3708362fc10f6f80cad2629a0be6737..dafec97c53016e19e671856407b0a6baa9a24c9e 100644 --- a/examples/complete/envs/dev/patch-bigbang.yaml +++ b/examples/complete/envs/dev/patch-bigbang.yaml @@ -46,12 +46,6 @@ spec: dashboard: auth: strategy: "anonymous" - ingressGateway: - serviceAnnotations: - # Ensure mission apps have internal load balancer only - service.beta.kubernetes.io/aws-load-balancer-internal: "true" - # Enable cross zone load balancing - service.beta.kubernetes.io/aws-load-balancer-cross-zone-load-balancing-enabled: "true" gatekeeper: # Directly modify chart values for dev workloads diff --git a/scripts/01_deploy_bigbang.sh b/scripts/01_deploy_bigbang.sh deleted file mode 100644 index 68d4efb508eed4039631f84290c8745a55263f2f..0000000000000000000000000000000000000000 --- a/scripts/01_deploy_bigbang.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -set -e - -# Deploy flux and wait for it to be ready -echo "Installing Flux" -flux --version -flux install - -# Deploy BigBang -echo "Installing BigBang" -helm upgrade -i bigbang chart -n bigbang --create-namespace --set registryCredentials.username='robot$bigbang' --set registryCredentials.password=${REGISTRY1_PASSWORD} --set addons.argocd.enabled=true --set addons.authservice.enabled=true - -# Apply secrets kustomization pointing to current branch -echo "Deploying secrets from the ${CI_COMMIT_REF_NAME} branch" -cat examples/complete/envs/dev/source-secrets.yaml | sed 's|master|'$CI_COMMIT_REF_NAME'|g' | kubectl apply -f - \ No newline at end of file diff --git a/scripts/02_wait_for_helmrealeases.sh b/scripts/02_wait_for_helmrealeases.sh deleted file mode 100644 index b87bfa53f65c49cdce3befa65c9c194e1f90bc2a..0000000000000000000000000000000000000000 --- a/scripts/02_wait_for_helmrealeases.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash - -set -e - -## This is an array to instantiate the order of wait conditions -ORDERED_HELMRELEASES="gatekeeper istio-operator istio monitoring eck-operator ek fluent-bit twistlock cluster-auditor" - - -## This the actual deployed helmrelease objects in the cluster -DEPLOYED_HELMRELEASES=$(kubectl get hr --no-headers -n bigbang | awk '{ print $1}') - -## Function to test an array contains an element -## Args: -## $1: array to search -## $2: element to search for -function array_contains() { - local array="$1[@]" - local seeking=$2 - local in=1 - for element in ${!array}; do - if [[ $element == "$seeking" ]]; then - in=0 - break - fi - done - return $in -} - -## Function to wait on helmrelease -## Args: -## $1: package name -function wait_on() { - echo "Waiting on package $1" - kubectl wait --for=condition=Ready --timeout 500s helmrelease -n bigbang $1; -} - -for package in $ORDERED_HELMRELEASES; -do - if array_contains DEPLOYED_HELMRELEASES "$package"; - then wait_on "$package" - else echo "Expected package: $package, but not found in release. Update the array in this script if this package is no longer needed" - fi -done - -for package in $DEPLOYED_HELMRELEASES; -do - if array_contains ORDERED_HELMRELEASES "$package"; - then echo "" - else - echo "Found package: $package, but not found in this script array. Update the array in this script if this package is always needed" - wait_on "$package" - fi -done - -echo "Waiting on Secrets Kustomization" -kubectl wait --for=condition=Ready --timeout 30s kustomizations.kustomize.toolkit.fluxcd.io -n bigbang secrets \ No newline at end of file diff --git a/scripts/hosts.sh b/scripts/hosts.sh new file mode 100644 index 0000000000000000000000000000000000000000..ad4ff4fbdb5336bf49694c9d223b0edb5d7e729e --- /dev/null +++ b/scripts/hosts.sh @@ -0,0 +1,19 @@ +#!/bin/bash +set -e + +## Adds all the vs hostnames and LB IP to /etc/hosts +## Get the LB Hostname +INGRESS_LB_Hostname=$(kubectl get svc -n istio-system istio-ingressgateway -o jsonpath="{.status.loadBalancer.ingress[0].hostname}") +## Get IP address from Hostname +INGRESS_LB_IP=$(dig $INGRESS_LB_Hostname +search +short | head -1) + +## Get a list of all the vs in cluster +VIRTUAL_SERVICES=$(kubectl get vs -A -o jsonpath={..spec.hosts[0]}) + +## For each vs put it in /etc/hosts +for vs in $VIRTUAL_SERVICES; +do echo "$INGRESS_LB_IP $vs" >> /etc/hosts +done + +##Cat out the file to see what we've done +cat /etc/hosts