From 5bbfcab3c95c26b1a8c35eb35806ba5e0744fceb Mon Sep 17 00:00:00 2001 From: Svein-Petter Johnsen <83902071+sveinpj@users.noreply.github.com> Date: Thu, 12 Dec 2024 07:35:35 +0100 Subject: [PATCH] Remove cicd-canary from bootstrap (#1540) Co-authored-by: Automatic Update --- scripts/cicd-canary/bootstrap.sh | 183 ----------------------------- scripts/install_base_components.sh | 10 -- 2 files changed, 193 deletions(-) delete mode 100755 scripts/cicd-canary/bootstrap.sh diff --git a/scripts/cicd-canary/bootstrap.sh b/scripts/cicd-canary/bootstrap.sh deleted file mode 100755 index ebb0ae2fd..000000000 --- a/scripts/cicd-canary/bootstrap.sh +++ /dev/null @@ -1,183 +0,0 @@ -#!/usr/bin/env bash - -####################################################################################### -### PURPOSE -### - -# Bootstrap radix-cicd-canary in a radix cluster - -####################################################################################### -### PRECONDITIONS -### - -# - AKS cluster is available -# - User has role cluster-admin -# - Helm RBAC is configured in cluster -# - Secret "radix-cicd-canary-values" is available in the keyvault - -####################################################################################### -### INPUTS -### - -# Required: -# - RADIX_ZONE_ENV : Path to *.env file -# - CLUSTER_NAME : Ex: "test-2", "weekly-93" - -####################################################################################### -### HOW TO USE -### - -# NORMAL -# RADIX_ZONE_ENV=../radix-zone/radix_zone_dev.env CLUSTER_NAME="weekly-2" ./bootstrap.sh - -####################################################################################### -### START -### -red=$'\e[1;31m' -grn=$'\e[1;32m' -yel=$'\e[1;33m' -normal=$(tput sgr0) - -echo "" -echo "Start bootstrap of radix-cicd-canary... " - -script_dir_path="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -####################################################################################### -### Check for prerequisites binaries -### - -echo "" -printf "Check for neccesary executables... " -hash az 2>/dev/null || { - echo -e "\nERROR: Azure-CLI not found in PATH. Exiting..." >&2 - exit 1 -} -hash kubectl 2>/dev/null || { - echo -e "\nERROR: kubectl not found in PATH. Exiting..." >&2 - exit 1 -} -hash helm 2>/dev/null || { - echo -e "\nERROR: helm not found in PATH. Exiting..." >&2 - exit 1 -} -hash jq 2>/dev/null || { - echo -e "\nERROR: jq not found in PATH. Exiting..." >&2 - exit 1 -} - -CREATE_MANAGED_IDENTITY_SCRIPT="$script_dir_path/scaling/create-managed-identity.sh" -if ! [[ -x "$CREATE_MANAGED_IDENTITY_SCRIPT" ]]; then - # Print to stderror - echo "ERROR: The restore apps script is not found or it is not executable in path $CREATE_MANAGED_IDENTITY_SCRIPT" >&2 -fi - -printf "All is good." -echo "" - -####################################################################################### -### Read inputs and configs -### - -# Required inputs - -if [[ -z "$RADIX_ZONE_ENV" ]]; then - echo "ERROR: Please provide RADIX_ZONE_ENV" >&2 - exit 1 -else - if [[ ! -f "$RADIX_ZONE_ENV" ]]; then - echo "ERROR: RADIX_ZONE_ENV=$RADIX_ZONE_ENV is invalid, the file does not exist." >&2 - exit 1 - fi - source "$RADIX_ZONE_ENV" -fi - -if [[ -z "$CLUSTER_NAME" ]]; then - echo "ERROR: Please provide CLUSTER_NAME" >&2 - exit 1 -fi - -# Source util scripts - -source ${RADIX_PLATFORM_REPOSITORY_PATH}/scripts/utility/util.sh - -# Optional inputs - -####################################################################################### -### Prepare az session -### - -printf "Logging you in to Azure if not already logged in... " -az account show >/dev/null || az login >/dev/null -az account set --subscription "$AZ_SUBSCRIPTION_ID" >/dev/null -printf "Done.\n" - -####################################################################################### -### Connect kubectl -### - -# Exit if cluster does not exist -printf "Connecting kubectl..." -get_credentials "$AZ_RESOURCE_GROUP_CLUSTERS" "$CLUSTER_NAME" || { - # Send message to stderr - echo -e "ERROR: Cluster \"$CLUSTER_NAME\" not found." >&2 - exit 0 -} -printf "...Done.\n" - -####################################################################################### -### Verify cluster access -### -verify_cluster_access - -echo "Install Radix CICD Canary" -SECRET_VALUES=$(az keyvault secret show \ - --vault-name "$AZ_RESOURCE_KEYVAULT" \ - --name radix-cicd-canary-values | - jq '.value | fromjson') - -# Create .yaml with values from keyvault. -YAML_SECRET_FILE="radix-cicd-canary-values.yaml" -echo "impersonate: - user: $(echo $SECRET_VALUES | jq -r '.impersonate.user') - -deployKey: - public: $(echo $SECRET_VALUES | jq -r '.deployKey.public') - private: $(echo $SECRET_VALUES | jq -r '.deployKey.private') - -deployKeyCanary3: - public: $(echo $SECRET_VALUES | jq -r '.deployKeyCanary3.public') - private: $(echo $SECRET_VALUES | jq -r '.deployKeyCanary3.private') - -deployKeyCanary4: - public: $(echo $SECRET_VALUES | jq -r '.deployKeyCanary4.public') - private: $(echo $SECRET_VALUES | jq -r '.deployKeyCanary4.private') - -privateImageHub: - password: $(echo $SECRET_VALUES | jq -r '.privateImageHub.password') - -networkPolicyCanary: - password: $(echo $SECRET_VALUES | jq -r '.networkPolicyCanary.password') - -clusterType: $CLUSTER_TYPE -clusterFqdn: $CLUSTER_NAME.$AZ_RESOURCE_DNS -" >> $YAML_SECRET_FILE - -# Create radix-cicd-canary namespace -if [[ ! $(kubectl get namespace --output jsonpath='{.items[?(.metadata.name=="radix-cicd-canary")]}') ]]; then - kubectl create namespace radix-cicd-canary -fi - -# Create secret -kubectl create secret generic canary-secrets --namespace radix-cicd-canary \ - --from-file=./$YAML_SECRET_FILE \ - --dry-run=client -o yaml | - kubectl apply -f - - -rm -f $YAML_SECRET_FILE - -# create managed identity and RBAC settings to allow for scheduled scaling -printf "%s► Execute %s%s\n" "${grn}" "$CREATE_MANAGED_IDENTITY_SCRIPT" "${normal}" -(RADIX_ZONE_ENV=${RADIX_ZONE_ENV} CLUSTER_NAME="${CLUSTER_NAME}" ${CREATE_MANAGED_IDENTITY_SCRIPT}) -wait # wait for subshell to finish - -echo "Done." diff --git a/scripts/install_base_components.sh b/scripts/install_base_components.sh index dd69c0d0c..e637e2ce7 100755 --- a/scripts/install_base_components.sh +++ b/scripts/install_base_components.sh @@ -250,16 +250,6 @@ wait ### For network security policy applied by operator to work, the namespace hosting prometheus and nginx-ingress-controller need to be labeled kubectl label ns default purpose=radix-base-ns --overwrite - -####################################################################################### -### Install Radix CICD Canary -### - -echo "" -printf "%s► Execute %s%s\n" "${grn}" "$WORKDIR_PATH/scripts/cicd-canary/bootstrap.sh" "${normal}" -(./cicd-canary/bootstrap.sh) -wait - ####################################################################################### ### Install prerequisites for Velero ###