Loading helm/scripts/get_ingress.sh +13 −2 Original line number Diff line number Diff line #!/bin/bash IP="" NAMESPACE="" KUBECONFIG="" help() { echo "Usage: $1 <options>" echo " -i : IP to use" echo " -n : Namespace to get ingress information" echo " -k : Kubeconfig to be used" echo " -h : show this help" exit 1 } # Read params while getopts ":i:n:h" opt; do while getopts ":i:n:k:h" opt; do case $opt in i) IP="$OPTARG" Loading @@ -17,6 +19,15 @@ while getopts ":i:n:h" opt; do n) NAMESPACE="$OPTARG" ;; k) KUBECONFIG="$OPTARG" if [ -z "$KUBECONFIG" ]; then echo "The variable KUBECONFIG is empty. Using default k8s environment..." else KUBECONFIG="--kubeconfig $KUBECONFIG" echo "The variable KUBECONFIG is not empty. Its value is: $KUBECONFIG" fi ;; h) help ;; Loading @@ -40,4 +51,4 @@ else fi kubectl -n $NAMESPACE get ing|grep -v NAME|awk "{print \"$IP \"\$3}" kubectl $KUBECONFIG -n $NAMESPACE get ing|grep -v NAME|awk "{print \"$IP \"\$3}" helm/scripts/install_capif.sh +3 −3 Original line number Diff line number Diff line Loading @@ -2,10 +2,10 @@ source $(dirname "$(readlink -f "$0")")/variables.sh ### download dependencies helm dependency build $HELM_DIR/capif/ helm $KUBECONFIG dependency build $HELM_DIR/capif/ ### check ingress_ip.oneke and get ip from ingress-nginx-controller kubectl get svc -A | grep ingress-nginx-controller kubectl $KUBECONFIG get svc -A | grep ingress-nginx-controller ### To deploy in other environment we need to setup urls according to it and also using specific kubeconfig: if [ -f "$VAULT_FILE" ] && [ -s "$VAULT_FILE" ]; then Loading @@ -16,7 +16,7 @@ else fi echo "Using value on VAULT_ACCESS_TOKEN=$VAULT_ACCESS_TOKEN" helm upgrade --install -n $CAPIF_NAMESPACE $CAPIF_NAME_VERSION_CHART $HELM_DIR/capif/ \ helm $KUBECONFIG upgrade --install -n $CAPIF_NAMESPACE $CAPIF_NAME_VERSION_CHART $HELM_DIR/capif/ \ --set grafana.enabled=true \ --set grafana.ingress.enabled=true \ --set grafana.ingress.hosts[0].host=ocf-mon-$CAPIF_CI_ENV_ENDPOINT.$CAPIF_DOMAIN \ Loading helm/scripts/install_monitoring.sh +2 −2 Original line number Diff line number Diff line #!/bin/bash source $(dirname "$(readlink -f "$0")")/variables.sh helm dependency build $HELM_DIR/monitoring-stack/ helm $KUBECONFIG dependency build $HELM_DIR/monitoring-stack/ helm upgrade --install -n $MONITORING_NAMESPACE $MONITORING_SERVICE_NAME $HELM_DIR/monitoring-stack/ \ helm $KUBECONFIG upgrade --install -n $MONITORING_NAMESPACE $MONITORING_SERVICE_NAME $HELM_DIR/monitoring-stack/ \ --set grafana.enabled=false \ --set prometheus.enabled=true \ --set prometheus.ingress.enabled=true \ Loading helm/scripts/install_vault.sh +13 −13 Original line number Diff line number Diff line Loading @@ -3,38 +3,38 @@ source $(dirname "$(readlink -f "$0")")/variables.sh # Function to get the service status get_service_status() { kubectl get pods -n "$VAULT_NAMESPACE" -l $LABEL_TO_CHECK="$VAULT_SERVICE_NAME" -o jsonpath='{.items[*].status.phase}' kubectl $KUBECONFIG get pods -n "$VAULT_NAMESPACE" -l $LABEL_TO_CHECK="$VAULT_SERVICE_NAME" -o jsonpath='{.items[*].status.phase}' } # Function to get the number of ready replicas get_ready_replicas() { kubectl get pods -n "$VAULT_NAMESPACE" -l $LABEL_TO_CHECK="$VAULT_SERVICE_NAME" -o jsonpath='{.items[*].status.containerStatuses[0].ready}' kubectl $KUBECONFIG get pods -n "$VAULT_NAMESPACE" -l $LABEL_TO_CHECK="$VAULT_SERVICE_NAME" -o jsonpath='{.items[*].status.containerStatuses[0].ready}' } # Function to get the number of ready replicas get_started_replicas() { kubectl get pods -n "$VAULT_NAMESPACE" -l $LABEL_TO_CHECK="$VAULT_SERVICE_NAME" -o jsonpath='{.items[*].status.containerStatuses[0].started}' kubectl $KUBECONFIG get pods -n "$VAULT_NAMESPACE" -l $LABEL_TO_CHECK="$VAULT_SERVICE_NAME" -o jsonpath='{.items[*].status.containerStatuses[0].started}' } get_succeeded_job_status() { kubectl get jobs -n "$VAULT_NAMESPACE" -o jsonpath='{.items[*].status.succeeded}' kubectl $KUBECONFIG get jobs -n "$VAULT_NAMESPACE" -o jsonpath='{.items[*].status.succeeded}' } get_failed_job_status() { kubectl get jobs -n "$VAULT_NAMESPACE" -o jsonpath='{.items[*].status.failed}' kubectl $KUBECONFIG get jobs -n "$VAULT_NAMESPACE" -o jsonpath='{.items[*].status.failed}' } get_completion_job_status() { kubectl get jobs -n "$VAULT_NAMESPACE" -o jsonpath='{.items[*].status.conditions[0].status}' kubectl $KUBECONFIG get jobs -n "$VAULT_NAMESPACE" -o jsonpath='{.items[*].status.conditions[0].status}' } get_completed_type_job_status(){ kubectl get jobs -n "$VAULT_NAMESPACE" -o jsonpath='{.items[*].status.conditions[0].type}' kubectl $KUBECONFIG get jobs -n "$VAULT_NAMESPACE" -o jsonpath='{.items[*].status.conditions[0].type}' } helm repo add hashicorp https://helm.releases.hashicorp.com helm $KUBECONFIG repo add hashicorp https://helm.releases.hashicorp.com helm upgrade --install vault hashicorp/vault -n $VAULT_NAMESPACE --set server.ingress.enabled=true \ helm $KUBECONFIG upgrade --install vault hashicorp/vault -n $VAULT_NAMESPACE --set server.ingress.enabled=true \ --set server.ingress.hosts[0].host="$VAULT_HOSTNAME" \ --set server.ingress.ingressClassName=nginx \ --set server.standalone.enabled=true --create-namespace Loading Loading @@ -63,7 +63,7 @@ echo "The service $VAULT_SERVICE_NAME is now in the desired state." # Init vault echo "" echo "Init vault" kubectl exec -ti vault-0 -n $VAULT_NAMESPACE -- vault operator init -key-shares=1 -key-threshold=1 > $VAULT_FILE kubectl $KUBECONFIG exec -ti vault-0 -n $VAULT_NAMESPACE -- vault operator init -key-shares=1 -key-threshold=1 > $VAULT_FILE # Remove control characters cat $VAULT_FILE | sed -r 's/\x1B\[[0-9;]*[JKmsu]//g' | sed -e 's/[^[:print:]\t\n]//g' > $VAULT_FILE.tmp Loading @@ -76,7 +76,7 @@ VAULT_TOKEN=$(awk '/Initial Root Token/{ print $4 }' $VAULT_FILE) echo "UNSEAL KEY: $UNSEAL_KEY" echo "VAULT TOKEN: $VAULT_TOKEN" kubectl exec -ti vault-0 -n $VAULT_NAMESPACE -- vault operator unseal $UNSEAL_KEY kubectl $KUBECONFIG exec -ti vault-0 -n $VAULT_NAMESPACE -- vault operator unseal $UNSEAL_KEY # Loop to wait until the service is in "Running" state and has 1/1 ready replicas while true; do Loading @@ -103,8 +103,8 @@ sed -i "s/DOMAIN1=.*/DOMAIN1=$DOMAIN1/g" $HELM_DIR/vault-job/vault-job.yaml sed -i "s/DOMAIN2=.*/DOMAIN2=$DOMAIN2/g" $HELM_DIR/vault-job/vault-job.yaml sed -i "s/DOMAIN3=.*/DOMAIN3=$DOMAIN3/g" $HELM_DIR/vault-job/vault-job.yaml kubectl delete job $VAULT_JOB_NAME -n ocf-vault || echo "No vault job present" kubectl apply -f $HELM_DIR/vault-job/ kubectl $KUBECONFIG delete job $VAULT_JOB_NAME -n ocf-vault || echo "No vault job present" kubectl $KUBECONFIG apply -f $HELM_DIR/vault-job/ # Check job status while true; do Loading helm/scripts/uninstall_capif.sh +2 −2 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ fi # Proceed with the uninstallation process echo "Proceeding with uninstallation..." helm uninstall $CAPIF_NAME_VERSION_CHART -n $CAPIF_NAMESPACE || echo "$CAPIF_NAME_VERSION_CHART is not present" kubectl delete namespace $CAPIF_NAMESPACE || echo "$CAPIF_NAMESPACE is not present" helm $KUBECONFIG uninstall $CAPIF_NAME_VERSION_CHART -n $CAPIF_NAMESPACE || echo "$CAPIF_NAME_VERSION_CHART is not present" kubectl $KUBECONFIG delete namespace $CAPIF_NAMESPACE || echo "$CAPIF_NAMESPACE is not present" echo "Uninstallation complete. The CAPIF service and all associated data have been removed." No newline at end of file Loading
helm/scripts/get_ingress.sh +13 −2 Original line number Diff line number Diff line #!/bin/bash IP="" NAMESPACE="" KUBECONFIG="" help() { echo "Usage: $1 <options>" echo " -i : IP to use" echo " -n : Namespace to get ingress information" echo " -k : Kubeconfig to be used" echo " -h : show this help" exit 1 } # Read params while getopts ":i:n:h" opt; do while getopts ":i:n:k:h" opt; do case $opt in i) IP="$OPTARG" Loading @@ -17,6 +19,15 @@ while getopts ":i:n:h" opt; do n) NAMESPACE="$OPTARG" ;; k) KUBECONFIG="$OPTARG" if [ -z "$KUBECONFIG" ]; then echo "The variable KUBECONFIG is empty. Using default k8s environment..." else KUBECONFIG="--kubeconfig $KUBECONFIG" echo "The variable KUBECONFIG is not empty. Its value is: $KUBECONFIG" fi ;; h) help ;; Loading @@ -40,4 +51,4 @@ else fi kubectl -n $NAMESPACE get ing|grep -v NAME|awk "{print \"$IP \"\$3}" kubectl $KUBECONFIG -n $NAMESPACE get ing|grep -v NAME|awk "{print \"$IP \"\$3}"
helm/scripts/install_capif.sh +3 −3 Original line number Diff line number Diff line Loading @@ -2,10 +2,10 @@ source $(dirname "$(readlink -f "$0")")/variables.sh ### download dependencies helm dependency build $HELM_DIR/capif/ helm $KUBECONFIG dependency build $HELM_DIR/capif/ ### check ingress_ip.oneke and get ip from ingress-nginx-controller kubectl get svc -A | grep ingress-nginx-controller kubectl $KUBECONFIG get svc -A | grep ingress-nginx-controller ### To deploy in other environment we need to setup urls according to it and also using specific kubeconfig: if [ -f "$VAULT_FILE" ] && [ -s "$VAULT_FILE" ]; then Loading @@ -16,7 +16,7 @@ else fi echo "Using value on VAULT_ACCESS_TOKEN=$VAULT_ACCESS_TOKEN" helm upgrade --install -n $CAPIF_NAMESPACE $CAPIF_NAME_VERSION_CHART $HELM_DIR/capif/ \ helm $KUBECONFIG upgrade --install -n $CAPIF_NAMESPACE $CAPIF_NAME_VERSION_CHART $HELM_DIR/capif/ \ --set grafana.enabled=true \ --set grafana.ingress.enabled=true \ --set grafana.ingress.hosts[0].host=ocf-mon-$CAPIF_CI_ENV_ENDPOINT.$CAPIF_DOMAIN \ Loading
helm/scripts/install_monitoring.sh +2 −2 Original line number Diff line number Diff line #!/bin/bash source $(dirname "$(readlink -f "$0")")/variables.sh helm dependency build $HELM_DIR/monitoring-stack/ helm $KUBECONFIG dependency build $HELM_DIR/monitoring-stack/ helm upgrade --install -n $MONITORING_NAMESPACE $MONITORING_SERVICE_NAME $HELM_DIR/monitoring-stack/ \ helm $KUBECONFIG upgrade --install -n $MONITORING_NAMESPACE $MONITORING_SERVICE_NAME $HELM_DIR/monitoring-stack/ \ --set grafana.enabled=false \ --set prometheus.enabled=true \ --set prometheus.ingress.enabled=true \ Loading
helm/scripts/install_vault.sh +13 −13 Original line number Diff line number Diff line Loading @@ -3,38 +3,38 @@ source $(dirname "$(readlink -f "$0")")/variables.sh # Function to get the service status get_service_status() { kubectl get pods -n "$VAULT_NAMESPACE" -l $LABEL_TO_CHECK="$VAULT_SERVICE_NAME" -o jsonpath='{.items[*].status.phase}' kubectl $KUBECONFIG get pods -n "$VAULT_NAMESPACE" -l $LABEL_TO_CHECK="$VAULT_SERVICE_NAME" -o jsonpath='{.items[*].status.phase}' } # Function to get the number of ready replicas get_ready_replicas() { kubectl get pods -n "$VAULT_NAMESPACE" -l $LABEL_TO_CHECK="$VAULT_SERVICE_NAME" -o jsonpath='{.items[*].status.containerStatuses[0].ready}' kubectl $KUBECONFIG get pods -n "$VAULT_NAMESPACE" -l $LABEL_TO_CHECK="$VAULT_SERVICE_NAME" -o jsonpath='{.items[*].status.containerStatuses[0].ready}' } # Function to get the number of ready replicas get_started_replicas() { kubectl get pods -n "$VAULT_NAMESPACE" -l $LABEL_TO_CHECK="$VAULT_SERVICE_NAME" -o jsonpath='{.items[*].status.containerStatuses[0].started}' kubectl $KUBECONFIG get pods -n "$VAULT_NAMESPACE" -l $LABEL_TO_CHECK="$VAULT_SERVICE_NAME" -o jsonpath='{.items[*].status.containerStatuses[0].started}' } get_succeeded_job_status() { kubectl get jobs -n "$VAULT_NAMESPACE" -o jsonpath='{.items[*].status.succeeded}' kubectl $KUBECONFIG get jobs -n "$VAULT_NAMESPACE" -o jsonpath='{.items[*].status.succeeded}' } get_failed_job_status() { kubectl get jobs -n "$VAULT_NAMESPACE" -o jsonpath='{.items[*].status.failed}' kubectl $KUBECONFIG get jobs -n "$VAULT_NAMESPACE" -o jsonpath='{.items[*].status.failed}' } get_completion_job_status() { kubectl get jobs -n "$VAULT_NAMESPACE" -o jsonpath='{.items[*].status.conditions[0].status}' kubectl $KUBECONFIG get jobs -n "$VAULT_NAMESPACE" -o jsonpath='{.items[*].status.conditions[0].status}' } get_completed_type_job_status(){ kubectl get jobs -n "$VAULT_NAMESPACE" -o jsonpath='{.items[*].status.conditions[0].type}' kubectl $KUBECONFIG get jobs -n "$VAULT_NAMESPACE" -o jsonpath='{.items[*].status.conditions[0].type}' } helm repo add hashicorp https://helm.releases.hashicorp.com helm $KUBECONFIG repo add hashicorp https://helm.releases.hashicorp.com helm upgrade --install vault hashicorp/vault -n $VAULT_NAMESPACE --set server.ingress.enabled=true \ helm $KUBECONFIG upgrade --install vault hashicorp/vault -n $VAULT_NAMESPACE --set server.ingress.enabled=true \ --set server.ingress.hosts[0].host="$VAULT_HOSTNAME" \ --set server.ingress.ingressClassName=nginx \ --set server.standalone.enabled=true --create-namespace Loading Loading @@ -63,7 +63,7 @@ echo "The service $VAULT_SERVICE_NAME is now in the desired state." # Init vault echo "" echo "Init vault" kubectl exec -ti vault-0 -n $VAULT_NAMESPACE -- vault operator init -key-shares=1 -key-threshold=1 > $VAULT_FILE kubectl $KUBECONFIG exec -ti vault-0 -n $VAULT_NAMESPACE -- vault operator init -key-shares=1 -key-threshold=1 > $VAULT_FILE # Remove control characters cat $VAULT_FILE | sed -r 's/\x1B\[[0-9;]*[JKmsu]//g' | sed -e 's/[^[:print:]\t\n]//g' > $VAULT_FILE.tmp Loading @@ -76,7 +76,7 @@ VAULT_TOKEN=$(awk '/Initial Root Token/{ print $4 }' $VAULT_FILE) echo "UNSEAL KEY: $UNSEAL_KEY" echo "VAULT TOKEN: $VAULT_TOKEN" kubectl exec -ti vault-0 -n $VAULT_NAMESPACE -- vault operator unseal $UNSEAL_KEY kubectl $KUBECONFIG exec -ti vault-0 -n $VAULT_NAMESPACE -- vault operator unseal $UNSEAL_KEY # Loop to wait until the service is in "Running" state and has 1/1 ready replicas while true; do Loading @@ -103,8 +103,8 @@ sed -i "s/DOMAIN1=.*/DOMAIN1=$DOMAIN1/g" $HELM_DIR/vault-job/vault-job.yaml sed -i "s/DOMAIN2=.*/DOMAIN2=$DOMAIN2/g" $HELM_DIR/vault-job/vault-job.yaml sed -i "s/DOMAIN3=.*/DOMAIN3=$DOMAIN3/g" $HELM_DIR/vault-job/vault-job.yaml kubectl delete job $VAULT_JOB_NAME -n ocf-vault || echo "No vault job present" kubectl apply -f $HELM_DIR/vault-job/ kubectl $KUBECONFIG delete job $VAULT_JOB_NAME -n ocf-vault || echo "No vault job present" kubectl $KUBECONFIG apply -f $HELM_DIR/vault-job/ # Check job status while true; do Loading
helm/scripts/uninstall_capif.sh +2 −2 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ fi # Proceed with the uninstallation process echo "Proceeding with uninstallation..." helm uninstall $CAPIF_NAME_VERSION_CHART -n $CAPIF_NAMESPACE || echo "$CAPIF_NAME_VERSION_CHART is not present" kubectl delete namespace $CAPIF_NAMESPACE || echo "$CAPIF_NAMESPACE is not present" helm $KUBECONFIG uninstall $CAPIF_NAME_VERSION_CHART -n $CAPIF_NAMESPACE || echo "$CAPIF_NAME_VERSION_CHART is not present" kubectl $KUBECONFIG delete namespace $CAPIF_NAMESPACE || echo "$CAPIF_NAMESPACE is not present" echo "Uninstallation complete. The CAPIF service and all associated data have been removed." No newline at end of file