From 20f013d962b9a4c083996386d732daae9b87b0c9 Mon Sep 17 00:00:00 2001 From: Jorge Moratinos Salcines Date: Tue, 19 Aug 2025 10:36:19 +0200 Subject: [PATCH 1/8] Helm scripts and helm charts upgraded --- .../charts/mongo/templates/deployment.yaml | 2 +- helm/capif/charts/mongo/values.yaml | 6 +++ helm/scripts/install_capif.sh | 48 +++++++++++++------ helm/scripts/install_monitoring.sh | 12 ++++- helm/scripts/run_remote_capif_tests.sh | 4 +- helm/scripts/variables.sh | 18 ++++++- .../push_base_images_ocf.sh | 3 +- 7 files changed, 72 insertions(+), 21 deletions(-) diff --git a/helm/capif/charts/mongo/templates/deployment.yaml b/helm/capif/charts/mongo/templates/deployment.yaml index 80cedad5..244693cc 100644 --- a/helm/capif/charts/mongo/templates/deployment.yaml +++ b/helm/capif/charts/mongo/templates/deployment.yaml @@ -56,7 +56,7 @@ spec: {{- toYaml . | nindent 12 }} {{- end }} - name: mongo-helper - image: busybox + image: "{{ .Values.busybox.repository }}:{{ .Values.busybox.tag | default .Chart.AppVersion }}" command: - sh - -c diff --git a/helm/capif/charts/mongo/values.yaml b/helm/capif/charts/mongo/values.yaml index 6e15c566..0ba34e90 100644 --- a/helm/capif/charts/mongo/values.yaml +++ b/helm/capif/charts/mongo/values.yaml @@ -10,6 +10,12 @@ image: # Overrides the image tag whose default is the chart appVersion. tag: "6.0.2" +busybox: + repository: busybox + pullPolicy: Always + # Overrides the image tag whose default is the chart appVersion. + tag: "1.37.0" + imagePullSecrets: [] nameOverride: "" fullnameOverride: "" diff --git a/helm/scripts/install_capif.sh b/helm/scripts/install_capif.sh index 74b1146a..6a166590 100755 --- a/helm/scripts/install_capif.sh +++ b/helm/scripts/install_capif.sh @@ -31,7 +31,7 @@ helm $KUBECONFIG upgrade --install -n $CAPIF_NAMESPACE $CAPIF_NAME_VERSION_CHART --set ocf-access-control-policy.image.tag=$CAPIF_IMAGE_TAG \ --set ocf-access-control-policy.image.env.capifHostname=$CAPIF_HOSTNAME \ --set ocf-access-control-policy.monitoring="true" \ ---set ocf-access-control-policy.env.logLevel="DEBUG" \ +--set ocf-access-control-policy.env.logLevel="$LOG_LEVEL" \ --set ocf-api-invocation-logs.image.repository=$CAPIF_DOCKER_REGISTRY/ocf-logging-api-invocation-api \ --set ocf-api-invocation-logs.image.tag=$CAPIF_IMAGE_TAG \ --set ocf-api-invocation-logs.env.monitoring="true" \ @@ -39,7 +39,7 @@ helm $KUBECONFIG upgrade --install -n $CAPIF_NAMESPACE $CAPIF_NAME_VERSION_CHART --set ocf-api-invocation-logs.env.vaultHostname=$VAULT_INTERNAL_HOSTNAME \ --set ocf-api-invocation-logs.env.vaultPort=$VAULT_PORT \ --set ocf-api-invocation-logs.env.vaultAccessToken=$VAULT_ACCESS_TOKEN \ ---set ocf-api-invocation-logs.env.logLevel="DEBUG" \ +--set ocf-api-invocation-logs.env.logLevel="$LOG_LEVEL" \ --set ocf-api-invoker-management.image.repository=$CAPIF_DOCKER_REGISTRY/ocf-api-invoker-management-api \ --set ocf-api-invoker-management.image.tag=$CAPIF_IMAGE_TAG \ --set ocf-api-invoker-management.env.monitoring="true" \ @@ -47,24 +47,24 @@ helm $KUBECONFIG upgrade --install -n $CAPIF_NAMESPACE $CAPIF_NAME_VERSION_CHART --set ocf-api-invoker-management.env.vaultHostname=$VAULT_INTERNAL_HOSTNAME \ --set ocf-api-invoker-management.env.vaultPort=$VAULT_PORT \ --set ocf-api-invoker-management.env.vaultAccessToken=$VAULT_ACCESS_TOKEN \ ---set ocf-api-invoker-management.env.logLevel="DEBUG" \ +--set ocf-api-invoker-management.env.logLevel="$LOG_LEVEL" \ --set ocf-api-provider-management.image.repository=$CAPIF_DOCKER_REGISTRY/ocf-api-provider-management-api \ --set ocf-api-provider-management.image.tag=$CAPIF_IMAGE_TAG \ --set ocf-api-provider-management.env.monitoring="true" \ --set ocf-api-provider-management.env.capifHostname=$CAPIF_HOSTNAME \ --set ocf-api-provider-management.env.vaultHostname=$VAULT_INTERNAL_HOSTNAME \ ---set ocf-api-provider-management.env.logLevel="DEBUG" \ +--set ocf-api-provider-management.env.logLevel="$LOG_LEVEL" \ --set ocf-api-provider-management.env.vaultPort=$VAULT_PORT \ --set ocf-api-provider-management.env.vaultAccessToken=$VAULT_ACCESS_TOKEN \ --set ocf-events.image.repository=$CAPIF_DOCKER_REGISTRY/ocf-events-api \ --set ocf-events.image.tag=$CAPIF_IMAGE_TAG \ --set ocf-events.env.monitoring="true" \ --set ocf-events.env.capifHostname=$CAPIF_HOSTNAME \ ---set ocf-events.env.logLevel="DEBUG" \ +--set ocf-events.env.logLevel="$LOG_LEVEL" \ --set ocf-routing-info.image.repository=$CAPIF_DOCKER_REGISTRY/ocf-routing-info-api \ --set ocf-routing-info.image.tag=$CAPIF_IMAGE_TAG \ --set ocf-routing-info.env.monitoring="true" \ ---set ocf-routing-info.env.logLevel="DEBUG" \ +--set ocf-routing-info.env.logLevel="$LOG_LEVEL" \ --set ocf-security.image.repository=$CAPIF_DOCKER_REGISTRY/ocf-security-api \ --set ocf-security.image.tag=$CAPIF_IMAGE_TAG \ --set ocf-security.env.monitoring="true" \ @@ -72,7 +72,7 @@ helm $KUBECONFIG upgrade --install -n $CAPIF_NAMESPACE $CAPIF_NAME_VERSION_CHART --set ocf-security.env.vaultHostname=$VAULT_INTERNAL_HOSTNAME \ --set ocf-security.env.vaultPort=$VAULT_PORT \ --set ocf-security.env.vaultAccessToken=$VAULT_ACCESS_TOKEN \ ---set ocf-security.env.logLevel="DEBUG" \ +--set ocf-security.env.logLevel="$LOG_LEVEL" \ --set ocf-register.image.repository=$CAPIF_DOCKER_REGISTRY/register \ --set ocf-register.image.tag=$CAPIF_IMAGE_TAG \ --set ocf-register.env.vaultHostname=$VAULT_INTERNAL_HOSTNAME \ @@ -85,22 +85,22 @@ helm $KUBECONFIG upgrade --install -n $CAPIF_NAMESPACE $CAPIF_NAME_VERSION_CHART --set ocf-register.ingress.hosts[0].host=$REGISTER_HOSTNAME \ --set ocf-register.ingress.hosts[0].paths[0].path="/" \ --set ocf-register.ingress.hosts[0].paths[0].pathType="Prefix" \ ---set ocf-register.env.logLevel="DEBUG" \ +--set ocf-register.env.logLevel="$LOG_LEVEL" \ --set ocf-register.extraConfigPod.hostAliases[0].hostnames[0]=$CAPIF_HOSTNAME \ --set ocf-register.extraConfigPod.hostAliases[0].ip=$K8S_IP \ --set ocf-auditing-api-logs.image.repository=$CAPIF_DOCKER_REGISTRY/ocf-auditing-api \ --set ocf-auditing-api-logs.image.tag=$CAPIF_IMAGE_TAG \ --set ocf-auditing-api-logs.env.monitoring="true" \ ---set ocf-auditing-api-logs.env.logLevel="DEBUG" \ +--set ocf-auditing-api-logs.env.logLevel="$LOG_LEVEL" \ --set ocf-publish-service-api.image.repository=$CAPIF_DOCKER_REGISTRY/ocf-publish-service-api \ --set ocf-publish-service-api.image.tag=$CAPIF_IMAGE_TAG \ --set ocf-publish-service-api.env.monitoring="true" \ --set ocf-publish-service-api.env.capifHostname=$CAPIF_HOSTNAME \ ---set ocf-publish-service-api.env.logLevel="DEBUG" \ +--set ocf-publish-service-api.env.logLevel="$LOG_LEVEL" \ --set ocf-discover-service-api.image.repository=$CAPIF_DOCKER_REGISTRY/ocf-discover-service-api \ --set ocf-discover-service-api.image.tag=$CAPIF_IMAGE_TAG \ --set ocf-discover-service-api.env.monitoring="true" \ ---set ocf-discover-service-api.env.logLevel="DEBUG" \ +--set ocf-discover-service-api.env.logLevel="$LOG_LEVEL" \ --set nginx.image.repository=$CAPIF_DOCKER_REGISTRY/nginx \ --set nginx.image.tag=$CAPIF_IMAGE_TAG \ --set nginx.env.capifHostname=$CAPIF_HOSTNAME \ @@ -111,14 +111,14 @@ helm $KUBECONFIG upgrade --install -n $CAPIF_NAMESPACE $CAPIF_NAME_VERSION_CHART --set nginx.ingress.hosts[0].host=$CAPIF_HOSTNAME \ --set nginx.ingress.hosts[0].paths[0].path="/" \ --set nginx.ingress.hosts[0].paths[0].pathType="Prefix" \ ---set nginx.env.logLevel="debug" \ +--set nginx.env.logLevel="$LOG_LEVEL" \ --set ocf-helper.image.repository=$CAPIF_DOCKER_REGISTRY/helper \ --set ocf-helper.image.tag=$CAPIF_IMAGE_TAG \ --set ocf-helper.env.vaultHostname=$VAULT_INTERNAL_HOSTNAME \ --set ocf-helper.env.vaultPort=$VAULT_PORT \ --set ocf-helper.env.vaultAccessToken=$VAULT_ACCESS_TOKEN \ --set ocf-helper.env.capifHostname=$CAPIF_HOSTNAME \ ---set ocf-helper.env.logLevel="DEBUG" \ +--set ocf-helper.env.logLevel="$LOG_LEVEL" \ --set mock-server.enabled=true \ --set mock-server.image.repository=$CAPIF_DOCKER_REGISTRY/mock-server \ --set mock-server.image.tag=$CAPIF_IMAGE_TAG \ @@ -126,9 +126,11 @@ helm $KUBECONFIG upgrade --install -n $CAPIF_NAMESPACE $CAPIF_NAME_VERSION_CHART --set mock-server.ingress.hosts[0].host=mock-server-$CAPIF_CI_ENV_ENDPOINT.$CAPIF_DOMAIN \ --set mock-server.ingress.hosts[0].paths[0].path="/" \ --set mock-server.ingress.hosts[0].paths[0].pathType="Prefix" \ ---set mock-server.env.logLevel="DEBUG" \ +--set mock-server.env.logLevel="$LOG_LEVEL" \ --set mock-server.service.port=$MOCK_SERVER_PORT \ --set mock-server.livenessProbe.tcpSocket.port=$MOCK_SERVER_PORT \ +--set mongo-register.image.repository=$BASE_DOCKER_REGISTRY/mongo \ +--set mongo-register.image.tag=6.0.2 \ --set mongo-register.persistence.storageClass=$CAPIF_STORAGE_CLASS \ --set mongo-register.persistence.storage=$CAPIF_MONGO_REGISTER_STORAGE_SIZE \ --set mongo-register.extraFlags[0]="--repair" \ @@ -140,9 +142,27 @@ helm $KUBECONFIG upgrade --install -n $CAPIF_NAMESPACE $CAPIF_NAME_VERSION_CHART --set mongo.persistence.storageClass=$CAPIF_STORAGE_CLASS \ --set mongo.persistence.storage=$CAPIF_MONGO_STORAGE_SIZE \ --set mongo.extraFlags[0]="--repair" \ +--set mongo.image.repository=$BASE_DOCKER_REGISTRY/mongo \ +--set mongo.image.tag=6.0.2 \ +--set mongo.busybox.repository=$BASE_DOCKER_REGISTRY/busybox \ +--set mongo.busybox.tag=1.37.0 \ --set mongo-express.enabled=true \ --set mongo-express.ingress.enabled=true \ --set mongo-express.ingress.hosts[0].host="mongo-express-$CAPIF_CI_ENV_ENDPOINT.$CAPIF_DOMAIN" \ --set mongo-express.ingress.hosts[0].paths[0].path="/" \ --set mongo-express.ingress.hosts[0].paths[0].pathType="Prefix" \ +--set redis.image.repository=$BASE_DOCKER_REGISTRY/redis \ +--set redis.image.tag=7.4.2-alpine \ +--set celery-beat.image.repository=$CAPIF_DOCKER_REGISTRY/celery \ +--set celery-beat.image.tag=$CAPIF_IMAGE_TAG \ +--set celery-beat.env.celeryModel=beat \ +--set celery-beat.env.redisHost=redis \ +--set celery-beat.env.redisPort=6379 \ +--set celery-beat.env.logLevel="$LOG_LEVEL" \ +--set celery-worker.image.repository=$CAPIF_DOCKER_REGISTRY/celery \ +--set celery-worker.image.tag=$CAPIF_IMAGE_TAG \ +--set celery-worker.env.celeryModel=worker \ +--set celery-worker.env.redisHost=redis \ +--set celery-worker.env.redisPort=6379 \ +--set celery-worker.env.logLevel="$LOG_LEVEL" \ --wait --timeout=10m --create-namespace --atomic $CAPIF_RESOURCES_RESERVE $CAPIF_STORAGE_ACCESS_MODE $CAPIF_RUN_AS_USER_CONFIG diff --git a/helm/scripts/install_monitoring.sh b/helm/scripts/install_monitoring.sh index 9d6a00f3..fa7882ec 100755 --- a/helm/scripts/install_monitoring.sh +++ b/helm/scripts/install_monitoring.sh @@ -7,13 +7,21 @@ helm repo add grafana https://grafana.github.io/helm-charts helm $KUBECONFIG dependency build $HELM_DIR/monitoring-stack/ helm $KUBECONFIG upgrade --install -n $MONITORING_NAMESPACE $MONITORING_SERVICE_NAME $HELM_DIR/monitoring-stack/ \ ---set grafana.enabled=false \ +--set grafana.enabled=$MONITORING_GRAFANA_ENABLED \ --set grafana.env.prometheusUrl=$PROMETHEUS_URL \ ---set prometheus.enabled=true \ +--set grafana.ingress.enabled=true \ +--set grafana.ingress.hosts[0].host=$GRAFANA_HOSTNAME \ +--set grafana.ingress.hosts[0].paths[0].path="/" \ +--set grafana.ingress.hosts[0].paths[0].pathType="Prefix" \ +--set prometheus.enabled=$MONITORING_PROMETHEUS_ENABLED \ --set prometheus.ingress.enabled=true \ --set prometheus.ingress.hosts[0].host=$PROMETHEUS_HOSTNAME \ --set prometheus.ingress.hosts[0].paths[0].path="/" \ --set prometheus.ingress.hosts[0].paths[0].pathType="Prefix" \ --set skooner.enabled=$MONITORING_SNOOKER_ENABLED \ +--set skooner.ingress.enabled=true \ +--set skooner.ingress.hosts[0].host=$SKOONER_HOSTNAME \ +--set skooner.ingress.hosts[0].paths[0].path="/" \ +--set skooner.ingress.hosts[0].paths[0].pathType="Prefix" \ --wait --timeout=10m --create-namespace --atomic diff --git a/helm/scripts/run_remote_capif_tests.sh b/helm/scripts/run_remote_capif_tests.sh index 38b7e807..4de115a4 100755 --- a/helm/scripts/run_remote_capif_tests.sh +++ b/helm/scripts/run_remote_capif_tests.sh @@ -37,6 +37,7 @@ echo "CAPIF_VAULT_PORT = $VAULT_PORT" echo "CAPIF_VAULT_TOKEN = $VAULT_ACCESS_TOKEN" echo "MOCK_SERVER_URL = $MOCK_SERVER_URL" echo "DOCKER_ROBOT_IMAGE = $DOCKER_ROBOT_IMAGE:$DOCKER_ROBOT_IMAGE_VERSION" +echo "REGISTER_ADMIN_PASSWORD = $REGISTER_ADMIN_PASSWORD" INPUT_OPTIONS=$@ # Check if input is provided @@ -83,4 +84,5 @@ docker run -ti --rm --network="host" \ --variable CAPIF_VAULT_PORT:$CAPIF_VAULT_PORT \ --variable CAPIF_VAULT_TOKEN:$CAPIF_VAULT_TOKEN \ --variable NOTIFICATION_DESTINATION_URL:$NOTIFICATION_DESTINATION_URL \ - --variable MOCK_SERVER_URL:$MOCK_SERVER_URL $INPUT_OPTIONS + --variable MOCK_SERVER_URL:$MOCK_SERVER_URL \ + --variable REGISTER_ADMIN_PASSWORD:$REGISTER_ADMIN_PASSWORD $INPUT_OPTIONS diff --git a/helm/scripts/variables.sh b/helm/scripts/variables.sh index 2abf7de3..04a659a1 100755 --- a/helm/scripts/variables.sh +++ b/helm/scripts/variables.sh @@ -25,6 +25,14 @@ export SCRIPTS_DIR=$(dirname "$(readlink -f "$0")") export HELM_DIR=$(dirname "$SCRIPTS_DIR") export CAPIF_BASE_DIR=$(dirname "$HELM_DIR") +# Docker registry to be used in deployment +export BASE_DOCKER_REGISTRY="labs.etsi.org:5050/ocf/capif" +# Common Configurations +## Log level to be used in deployment [CRITICAL, FATAL, ERROR, WARNING, WARN, INFO, DEBUG, NOTSET] +export LOG_LEVEL=DEBUG +## Register admin password to be used on testing +export REGISTER_ADMIN_PASSWORD='password123' + # Print scripts directory echo "The /helm/scripts directory is: $SCRIPTS_DIR" echo "The /helm directory is: $HELM_DIR" @@ -53,9 +61,15 @@ VAULT_JOB_NAME=vault-pki # Monitoring installation variables ## Prometheus Hostname to be used at ingress configuration export PROMETHEUS_HOSTNAME=prometheus.testbed.develop +export SKOONER_HOSTNAME=skooner.testbed.develop +export GRAFANA_HOSTNAME=grafana.testbed.develop +## Monitoring namespace and service name export MONITORING_NAMESPACE=monitoring export MONITORING_SERVICE_NAME=monitoring +## Monitoring Services enabled export MONITORING_SNOOKER_ENABLED=false +export MONITORING_GRAFANA_ENABLED=false +export MONITORING_PROMETHEUS_ENABLED=true # OpenCAPIF deployment variables export CAPIF_RESOURCES_RESERVE="YES" @@ -85,7 +99,7 @@ export CAPIF_CI_ENV_ENDPOINT=capif export CAPIF_DOMAIN=testbed.develop ## Configuration of images to be used on deplyment ### Docker Registry to download images (must be accesible by k8s cluster) -export CAPIF_DOCKER_REGISTRY="labs.etsi.org:5050/ocf/capif/prod" +export CAPIF_DOCKER_REGISTRY="$BASE_DOCKER_REGISTRY/prod" ### Tag to be used export CAPIF_IMAGE_TAG="v1.0.0-release" ## Prometheus url, usually internal k8s hostname (if capif will be deployed on same k8s cluster) with port 9090 @@ -186,4 +200,4 @@ else --set $service.resources.requests.cpu=$CAPIF_RESOURCES_REQUESTS_CPU --set $service.resources.requests.memory=$CAPIF_RESOURCES_REQUESTS_MEMORY " done -fi \ No newline at end of file +fi diff --git a/tools/base_images_scripts/push_base_images_ocf.sh b/tools/base_images_scripts/push_base_images_ocf.sh index 2a9d472e..4bbc12c1 100755 --- a/tools/base_images_scripts/push_base_images_ocf.sh +++ b/tools/base_images_scripts/push_base_images_ocf.sh @@ -10,7 +10,8 @@ BASIC_IMAGES=("python:3-slim-bullseye" "ubuntu:20.04" "redis:7.4.2-alpine" "mongo-express:1.0.0-alpha.4" -"mongo:6.0.2") +"mongo:6.0.2" +"busybox:1.37.0") docker login labs.etsi.org:5050 for basic_image in "${BASIC_IMAGES[@]}"; do -- GitLab From fe92540954519cc875021d35f37a265d3b1a54f0 Mon Sep 17 00:00:00 2001 From: Jorge Moratinos Salcines Date: Tue, 19 Aug 2025 10:59:53 +0200 Subject: [PATCH 2/8] variables.sh now support environment files --- helm/scripts/variables.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/helm/scripts/variables.sh b/helm/scripts/variables.sh index 04a659a1..f29e3395 100755 --- a/helm/scripts/variables.sh +++ b/helm/scripts/variables.sh @@ -201,3 +201,19 @@ else --set $service.resources.requests.memory=$CAPIF_RESOURCES_REQUESTS_MEMORY " done fi + +# Directory for environment variables +ENV_DIR="$SCRIPTS_DIR/envs" + +# Environment selection (default: dev) +ENVIRONMENT="${1:-dev}" +ENV_FILE="$ENV_DIR/$ENVIRONMENT.env" + +if [ -f "$ENV_FILE" ]; then + echo "Loading environment configuration: $ENVIRONMENT" + set -a + source "$ENV_FILE" + set +a +else + echo "Environment file not found: $ENV_FILE. Using default values." +fi -- GitLab From e0aeae5bfbf96a27a90486a702b28d9f3621ce1c Mon Sep 17 00:00:00 2001 From: Jorge Moratinos Salcines Date: Tue, 19 Aug 2025 11:43:46 +0200 Subject: [PATCH 3/8] upgraded helm scripts with new environment optional file and improved help description on all of them --- helm/scripts/create_remote_users.sh | 32 +++++++++++++++---- helm/scripts/get_ingress.sh | 32 +++++++++++++++---- helm/scripts/install_capif.sh | 12 ++++++- helm/scripts/install_monitoring.sh | 11 ++++++- helm/scripts/install_vault.sh | 11 ++++++- .../populate_create_remote_dummy_users.sh | 30 ++++++++++++++--- .../populate_remove_remote_dummy_users.sh | 29 ++++++++++++++--- helm/scripts/remove_remote_users.sh | 28 +++++++++++++--- helm/scripts/remove_remote_users_by_prefix.sh | 28 +++++++++++++--- helm/scripts/run_remote_capif_tests.sh | 12 ++++++- helm/scripts/set_ingress.sh | 30 +++++++++++++---- helm/scripts/uninstall_capif.sh | 26 ++++++++++++--- helm/scripts/uninstall_monitoring.sh | 26 ++++++++++++--- helm/scripts/uninstall_vault.sh | 26 ++++++++++++--- helm/scripts/variables.sh | 3 +- 15 files changed, 283 insertions(+), 53 deletions(-) diff --git a/helm/scripts/create_remote_users.sh b/helm/scripts/create_remote_users.sh index a0209b31..d7b4ce58 100755 --- a/helm/scripts/create_remote_users.sh +++ b/helm/scripts/create_remote_users.sh @@ -1,5 +1,14 @@ #!/bin/bash -source $(dirname "$(readlink -f "$0")")/variables.sh + +# Capture the first parameter as a possible environment +ENVIRONMENT="dev" +if [[ "$1" != -* && -n "$1" ]]; then + ENVIRONMENT="$1" + shift +fi + +# Load variables for the selected environment +source "$(dirname "$0")/variables.sh" "$ENVIRONMENT" # User to create TOTAL_USERS=1 @@ -7,11 +16,20 @@ USERNAME_PREFIX= USER_PASSWORD= help() { - echo "Usage: $1 " - echo " -u : User prefix to use" - echo " -p : Password to set for user" - echo " -t : Total user to create (default 1)" - echo " -h : show this help" + echo "Usage: $0 [environment] [options]" + echo "" + echo " environment Optional. Environment name to use (e.g. dev, prod)." + echo " If not specified, 'dev' will be used by default." + echo "" + echo "Options:" + echo " -u User prefix to use (required)" + echo " -p Password to set for user (required)" + echo " -t Total users to create (default: 1)" + echo " -h Show this help message" + echo "" + echo "Examples:" + echo " $0 prod -u testuser -p pass123 -t 5" + echo " $0 -u testuser -p pass123" exit 1 } @@ -142,4 +160,6 @@ docker run -ti --rm --network="host" \ --variable TOTAL_USERS:$TOTAL_USERS \ --variable USERNAME_PREFIX:$USERNAME_PREFIX \ --variable USER_PASSWORD:$USER_PASSWORD \ + --variable REGISTER_ADMIN_USER:$REGISTER_ADMIN_USER \ + --variable REGISTER_ADMIN_PASSWORD:$REGISTER_ADMIN_PASSWORD \ --include create-users diff --git a/helm/scripts/get_ingress.sh b/helm/scripts/get_ingress.sh index 53b79c31..b8010715 100755 --- a/helm/scripts/get_ingress.sh +++ b/helm/scripts/get_ingress.sh @@ -1,17 +1,35 @@ #!/bin/bash IP="" NAMESPACE="" -source $(dirname "$(readlink -f "$0")")/variables.sh + +# Capture the first parameter as a possible environment +ENVIRONMENT="dev" +if [[ "$1" != -* && -n "$1" ]]; then + ENVIRONMENT="$1" + shift +fi + +# Load variables for the selected environment +source "$(dirname "$0")/variables.sh" "$ENVIRONMENT" help() { - echo "Usage: $1 " - echo " -i : IP to use" - echo " -n : Namespace to get ingress information" - echo " -k : Kubeconfig to be used" - echo " -h : show this help" + echo "Usage: $0 [environment] [options]" + echo "" + echo " environment Optional. Environment name to use (e.g. dev, prod)." + echo " If not specified, 'dev' will be used by default." + echo "" + echo "Options:" + echo " -i IP to use" + echo " -n Namespace to get ingress information" + echo " -k Kubeconfig to be used" + echo " -h Show this help message" + echo "" + echo "Examples:" + echo " $0 prod -i 10.0.0.1 -n mynamespace" + echo " $0 -n mynamespace" exit 1 } -# Read params +# Process flags with getopts while getopts ":i:n:k:h" opt; do case $opt in i) diff --git a/helm/scripts/install_capif.sh b/helm/scripts/install_capif.sh index 6a166590..43522556 100755 --- a/helm/scripts/install_capif.sh +++ b/helm/scripts/install_capif.sh @@ -1,5 +1,15 @@ #!/bin/bash -source $(dirname "$(readlink -f "$0")")/variables.sh + + +# Capture the first parameter as a possible environment +ENVIRONMENT="dev" +if [[ "$1" != -* && -n "$1" ]]; then + ENVIRONMENT="$1" + shift +fi + +# Load variables for the selected environment +source "$(dirname "$0")/variables.sh" "$ENVIRONMENT" helm repo add grafana https://grafana.github.io/helm-charts diff --git a/helm/scripts/install_monitoring.sh b/helm/scripts/install_monitoring.sh index fa7882ec..9f201ccf 100755 --- a/helm/scripts/install_monitoring.sh +++ b/helm/scripts/install_monitoring.sh @@ -1,5 +1,14 @@ #!/bin/bash -source $(dirname "$(readlink -f "$0")")/variables.sh + +# Capture the first parameter as a possible environment +ENVIRONMENT="dev" +if [[ "$1" != -* && -n "$1" ]]; then + ENVIRONMENT="$1" + shift +fi + +# Load variables for the selected environment +source "$(dirname "$0")/variables.sh" "$ENVIRONMENT" helm repo add bitnami https://charts.bitnami.com/bitnami helm repo add grafana https://grafana.github.io/helm-charts diff --git a/helm/scripts/install_vault.sh b/helm/scripts/install_vault.sh index 971d5200..52dfbdf3 100755 --- a/helm/scripts/install_vault.sh +++ b/helm/scripts/install_vault.sh @@ -1,5 +1,14 @@ #!/bin/bash -source $(dirname "$(readlink -f "$0")")/variables.sh + +# Capture the first parameter as a possible environment +ENVIRONMENT="dev" +if [[ "$1" != -* && -n "$1" ]]; then + ENVIRONMENT="$1" + shift +fi + +# Load variables for the selected environment +source "$(dirname "$0")/variables.sh" "$ENVIRONMENT" # Function to get the service status get_service_status() { diff --git a/helm/scripts/populate_create_remote_dummy_users.sh b/helm/scripts/populate_create_remote_dummy_users.sh index 3243db82..2c7dbfbe 100755 --- a/helm/scripts/populate_create_remote_dummy_users.sh +++ b/helm/scripts/populate_create_remote_dummy_users.sh @@ -1,15 +1,33 @@ #!/bin/bash -source $(dirname "$(readlink -f "$0")")/variables.sh + +# Capture the first parameter as a possible environment +ENVIRONMENT="dev" +if [[ "$1" != -* && -n "$1" ]]; then + ENVIRONMENT="$1" + shift +fi + +# Load variables for the selected environment +source "$(dirname "$0")/variables.sh" "$ENVIRONMENT" # Populate variables TOTAL_INVOKERS=10 TOTAL_PROVIDERS=10 help() { - echo "Usage: $1 " - echo " -p : Total providers to create (default 10)" - echo " -i : Total providers to create (default 10)" - echo " -h : show this help" + echo "Usage: $0 [environment] [options]" + echo "" + echo " environment Optional. Environment name to use (e.g. dev, prod)." + echo " If not specified, 'dev' will be used by default." + echo "" + echo "Options:" + echo " -p Total providers to create (default: 10)" + echo " -i Total invokers to create (default: 10)" + echo " -h Show this help message" + echo "" + echo "Examples:" + echo " $0 prod -p 20 -i 15" + echo " $0 -p 5" exit 1 } @@ -122,4 +140,6 @@ docker run -ti --rm --network="host" \ --variable MOCK_SERVER_URL:$MOCK_SERVER_URL \ --variable TOTAL_PROVIDERS:$TOTAL_PROVIDERS \ --variable TOTAL_INVOKERS:$TOTAL_INVOKERS \ + --variable REGISTER_ADMIN_USER:$REGISTER_ADMIN_USER \ + --variable REGISTER_ADMIN_PASSWORD:$REGISTER_ADMIN_PASSWORD \ --include populate-create diff --git a/helm/scripts/populate_remove_remote_dummy_users.sh b/helm/scripts/populate_remove_remote_dummy_users.sh index 7847525e..8c55005f 100755 --- a/helm/scripts/populate_remove_remote_dummy_users.sh +++ b/helm/scripts/populate_remove_remote_dummy_users.sh @@ -1,10 +1,29 @@ #!/bin/bash -source $(dirname "$(readlink -f "$0")")/variables.sh + +# Capture the first parameter as a possible environment +ENVIRONMENT="dev" +if [[ "$1" != -* && -n "$1" ]]; then + ENVIRONMENT="$1" + shift +fi + +# Load variables for the selected environment +source "$(dirname "$0")/variables.sh" "$ENVIRONMENT" help() { - echo "Usage: $1 " - echo "Removes all dummy users populated, stored on latest zip file on results" - echo " -h : show this help" + echo "Usage: $0 [environment] [options]" + echo "" + echo " environment Optional. Environment name to use (e.g. dev, prod)." + echo " If not specified, 'dev' will be used by default." + echo "" + echo "Options:" + echo " -h Show this help message" + echo "" + echo "Removes all dummy users populated, stored on latest zip file in results." + echo "" + echo "Examples:" + echo " $0 prod" + echo " $0" exit 1 } @@ -109,4 +128,6 @@ docker run -ti --rm --network="host" \ --variable CAPIF_VAULT_TOKEN:$CAPIF_VAULT_TOKEN \ --variable NOTIFICATION_DESTINATION_URL:$NOTIFICATION_DESTINATION_URL \ --variable MOCK_SERVER_URL:$MOCK_SERVER_URL \ + --variable REGISTER_ADMIN_USER:$REGISTER_ADMIN_USER \ + --variable REGISTER_ADMIN_PASSWORD:$REGISTER_ADMIN_PASSWORD \ --include populate-remove diff --git a/helm/scripts/remove_remote_users.sh b/helm/scripts/remove_remote_users.sh index dc6fa762..ad9b89f6 100755 --- a/helm/scripts/remove_remote_users.sh +++ b/helm/scripts/remove_remote_users.sh @@ -1,13 +1,31 @@ #!/bin/bash -source $(dirname "$(readlink -f "$0")")/variables.sh + +# Capture the first parameter as a possible environment +ENVIRONMENT="dev" +if [[ "$1" != -* && -n "$1" ]]; then + ENVIRONMENT="$1" + shift +fi + +# Load variables for the selected environment +source "$(dirname "$0")/variables.sh" "$ENVIRONMENT" # User to remove USERNAME_PREFIX= help() { - echo "Usage: $1 " - echo " -u : User prefix to use" - echo " -h : show this help" + echo "Usage: $0 [environment] [options]" + echo "" + echo " environment Optional. Environment name to use (e.g. dev, prod)." + echo " If not specified, 'dev' will be used by default." + echo "" + echo "Options:" + echo " -u User prefix to use (required)" + echo " -h Show this help message" + echo "" + echo "Examples:" + echo " $0 prod -u testuser" + echo " $0 -u testuser" exit 1 } @@ -123,4 +141,6 @@ docker run -ti --rm --network="host" \ --variable NOTIFICATION_DESTINATION_URL:$NOTIFICATION_DESTINATION_URL \ --variable MOCK_SERVER_URL:$MOCK_SERVER_URL \ --variable USERNAME_PREFIX:$USERNAME_PREFIX \ + --variable REGISTER_ADMIN_USER:$REGISTER_ADMIN_USER \ + --variable REGISTER_ADMIN_PASSWORD:$REGISTER_ADMIN_PASSWORD \ --include remove-users diff --git a/helm/scripts/remove_remote_users_by_prefix.sh b/helm/scripts/remove_remote_users_by_prefix.sh index 003d694f..ccc2ded6 100755 --- a/helm/scripts/remove_remote_users_by_prefix.sh +++ b/helm/scripts/remove_remote_users_by_prefix.sh @@ -1,13 +1,31 @@ #!/bin/bash -source $(dirname "$(readlink -f "$0")")/variables.sh + +# Capture the first parameter as a possible environment +ENVIRONMENT="dev" +if [[ "$1" != -* && -n "$1" ]]; then + ENVIRONMENT="$1" + shift +fi + +# Load variables for the selected environment +source "$(dirname "$0")/variables.sh" "$ENVIRONMENT" # User to remove USERNAME_PREFIX= help() { - echo "Usage: $1 " - echo " -u : User prefix to use" - echo " -h : show this help" + echo "Usage: $0 [environment] [options]" + echo "" + echo " environment Optional. Environment name to use (e.g. dev, prod)." + echo " If not specified, 'dev' will be used by default." + echo "" + echo "Options:" + echo " -u User prefix to use (required)" + echo " -h Show this help message" + echo "" + echo "Examples:" + echo " $0 prod -u testuser" + echo " $0 -u testuser" exit 1 } @@ -123,4 +141,6 @@ docker run -ti --rm --network="host" \ --variable NOTIFICATION_DESTINATION_URL:$NOTIFICATION_DESTINATION_URL \ --variable MOCK_SERVER_URL:$MOCK_SERVER_URL \ --variable USERNAME_PREFIX:$USERNAME_PREFIX \ + --variable REGISTER_ADMIN_USER:$REGISTER_ADMIN_USER \ + --variable REGISTER_ADMIN_PASSWORD:$REGISTER_ADMIN_PASSWORD \ --include remove-users-by-prefix diff --git a/helm/scripts/run_remote_capif_tests.sh b/helm/scripts/run_remote_capif_tests.sh index 4de115a4..086f2a8b 100755 --- a/helm/scripts/run_remote_capif_tests.sh +++ b/helm/scripts/run_remote_capif_tests.sh @@ -1,5 +1,14 @@ #!/bin/bash -source $(dirname "$(readlink -f "$0")")/variables.sh + +# Capture the first parameter as a possible environment +ENVIRONMENT="dev" +if [[ "$1" != -* && -n "$1" ]]; then + ENVIRONMENT="$1" + shift +fi + +# Load variables for the selected environment +source "$(dirname "$0")/variables.sh" "$ENVIRONMENT" DOCKER_ROBOT_IMAGE=labs.etsi.org:5050/ocf/capif/robot-tests-image DOCKER_ROBOT_IMAGE_VERSION=1.0 @@ -85,4 +94,5 @@ docker run -ti --rm --network="host" \ --variable CAPIF_VAULT_TOKEN:$CAPIF_VAULT_TOKEN \ --variable NOTIFICATION_DESTINATION_URL:$NOTIFICATION_DESTINATION_URL \ --variable MOCK_SERVER_URL:$MOCK_SERVER_URL \ + --variable REGISTER_ADMIN_USER:$REGISTER_ADMIN_USER \ --variable REGISTER_ADMIN_PASSWORD:$REGISTER_ADMIN_PASSWORD $INPUT_OPTIONS diff --git a/helm/scripts/set_ingress.sh b/helm/scripts/set_ingress.sh index 7f403477..4aa8dbb4 100755 --- a/helm/scripts/set_ingress.sh +++ b/helm/scripts/set_ingress.sh @@ -1,14 +1,32 @@ #!/bin/bash IP="" NAMESPACE="" -source $(dirname "$(readlink -f "$0")")/variables.sh + +# Capture the first parameter as a possible environment +ENVIRONMENT="dev" +if [[ "$1" != -* && -n "$1" ]]; then + ENVIRONMENT="$1" + shift +fi + +# Load variables for the selected environment +source "$(dirname "$0")/variables.sh" "$ENVIRONMENT" help() { - echo "Usage: $1 " - echo " -i : IP to use" - echo " -n : Namespace to get ingress information" - echo " -k : Kubeconfig to be used" - echo " -h : show this help" + echo "Usage: $0 [environment] [options]" + echo "" + echo " environment Optional. Environment name to use (e.g. dev, prod)." + echo " If not specified, 'dev' will be used by default." + echo "" + echo "Options:" + echo " -i IP to use" + echo " -n Namespace to get ingress information" + echo " -k Kubeconfig to be used" + echo " -h Show this help message" + echo "" + echo "Examples:" + echo " $0 prod -i 10.0.0.1 -n mynamespace" + echo " $0 -n mynamespace" exit 1 } # Read params diff --git a/helm/scripts/uninstall_capif.sh b/helm/scripts/uninstall_capif.sh index bacd0e0f..afb7aabd 100755 --- a/helm/scripts/uninstall_capif.sh +++ b/helm/scripts/uninstall_capif.sh @@ -1,10 +1,28 @@ #!/bin/bash -source $(dirname "$(readlink -f "$0")")/variables.sh + +# Capture the first parameter as a possible environment +ENVIRONMENT="dev" +if [[ "$1" != -* && -n "$1" ]]; then + ENVIRONMENT="$1" + shift +fi + +# Load variables for the selected environment +source "$(dirname "$0")/variables.sh" "$ENVIRONMENT" help() { - echo "Usage: $1 " - echo " -y : Force uninstall component" - echo " -h : show this help" + echo "Usage: $0 [environment] [options]" + echo "" + echo " environment Optional. Environment name to use (e.g. dev, prod)." + echo " If not specified, 'dev' will be used by default." + echo "" + echo "Options:" + echo " -y Force uninstall component" + echo " -h Show this help message" + echo "" + echo "Examples:" + echo " $0 prod -y" + echo " $0" exit 1 } diff --git a/helm/scripts/uninstall_monitoring.sh b/helm/scripts/uninstall_monitoring.sh index aff1706b..8599dc0e 100755 --- a/helm/scripts/uninstall_monitoring.sh +++ b/helm/scripts/uninstall_monitoring.sh @@ -1,10 +1,28 @@ #!/bin/bash -source $(dirname "$(readlink -f "$0")")/variables.sh + +# Capture the first parameter as a possible environment +ENVIRONMENT="dev" +if [[ "$1" != -* && -n "$1" ]]; then + ENVIRONMENT="$1" + shift +fi + +# Load variables for the selected environment +source "$(dirname "$0")/variables.sh" "$ENVIRONMENT" help() { - echo "Usage: $1 " - echo " -y : Force uninstall component" - echo " -h : show this help" + echo "Usage: $0 [environment] [options]" + echo "" + echo " environment Optional. Environment name to use (e.g. dev, prod)." + echo " If not specified, 'dev' will be used by default." + echo "" + echo "Options:" + echo " -y Force uninstall component" + echo " -h Show this help message" + echo "" + echo "Examples:" + echo " $0 prod -y" + echo " $0" exit 1 } diff --git a/helm/scripts/uninstall_vault.sh b/helm/scripts/uninstall_vault.sh index cb9535f6..3834c1ed 100755 --- a/helm/scripts/uninstall_vault.sh +++ b/helm/scripts/uninstall_vault.sh @@ -1,10 +1,28 @@ #!/bin/bash -source $(dirname "$(readlink -f "$0")")/variables.sh + +# Capture the first parameter as a possible environment +ENVIRONMENT="dev" +if [[ "$1" != -* && -n "$1" ]]; then + ENVIRONMENT="$1" + shift +fi + +# Load variables for the selected environment +source "$(dirname "$0")/variables.sh" "$ENVIRONMENT" help() { - echo "Usage: $1 " - echo " -y : Force uninstall component" - echo " -h : show this help" + echo "Usage: $0 [environment] [options]" + echo "" + echo " environment Optional. Environment name to use (e.g. dev, prod)." + echo " If not specified, 'dev' will be used by default." + echo "" + echo "Options:" + echo " -y Force uninstall component" + echo " -h Show this help message" + echo "" + echo "Examples:" + echo " $0 prod -y" + echo " $0" exit 1 } diff --git a/helm/scripts/variables.sh b/helm/scripts/variables.sh index f29e3395..70929e24 100755 --- a/helm/scripts/variables.sh +++ b/helm/scripts/variables.sh @@ -30,7 +30,8 @@ export BASE_DOCKER_REGISTRY="labs.etsi.org:5050/ocf/capif" # Common Configurations ## Log level to be used in deployment [CRITICAL, FATAL, ERROR, WARNING, WARN, INFO, DEBUG, NOTSET] export LOG_LEVEL=DEBUG -## Register admin password to be used on testing +## Register admin user and password to be used on testing +export REGISTER_ADMIN_USER='admin' export REGISTER_ADMIN_PASSWORD='password123' # Print scripts directory -- GitLab From e0c33da4364d3a66d301c93837b07f5f88fb1028 Mon Sep 17 00:00:00 2001 From: Jorge Moratinos Salcines Date: Wed, 20 Aug 2025 11:25:19 +0200 Subject: [PATCH 4/8] remove empty line --- helm/scripts/install_capif.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/helm/scripts/install_capif.sh b/helm/scripts/install_capif.sh index 43522556..803b59cf 100755 --- a/helm/scripts/install_capif.sh +++ b/helm/scripts/install_capif.sh @@ -1,6 +1,5 @@ #!/bin/bash - # Capture the first parameter as a possible environment ENVIRONMENT="dev" if [[ "$1" != -* && -n "$1" ]]; then -- GitLab From 09a09b5ba2a762829930ac0e3e1e9bd33b85e2f1 Mon Sep 17 00:00:00 2001 From: Jorge Moratinos Salcines Date: Wed, 20 Aug 2025 12:29:19 +0200 Subject: [PATCH 5/8] Add env folder with .gitkeep --- helm/scripts/envs/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 helm/scripts/envs/.gitkeep diff --git a/helm/scripts/envs/.gitkeep b/helm/scripts/envs/.gitkeep new file mode 100644 index 00000000..e69de29b -- GitLab From f01555a8e0ff67854c89bfd4edf64f4842ed997d Mon Sep 17 00:00:00 2001 From: Jorge Moratinos Salcines Date: Wed, 20 Aug 2025 12:35:31 +0200 Subject: [PATCH 6/8] Added example environment --- helm/scripts/envs/example.env | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 helm/scripts/envs/example.env diff --git a/helm/scripts/envs/example.env b/helm/scripts/envs/example.env new file mode 100644 index 00000000..bd19f70d --- /dev/null +++ b/helm/scripts/envs/example.env @@ -0,0 +1,12 @@ + export CUSTOM_KUBECONFIG="cluster-example.kubeconfig" + export VAULT_HOSTNAME=vault.example.org + export DOMAIN1=*.example.production + export DOMAIN2=*.example.staging + export DOMAIN3=*.example.dev + export PROMETHEUS_HOSTNAME=prometheus.example.production + export CAPIF_HOSTNAME="capif.example.staging" + export REGISTER_HOSTNAME="register.example.staging" + export CAPIF_NAMESPACE=ocf-capif + export CAPIF_CI_ENV_ENDPOINT=staging + export CAPIF_DOMAIN=example.staging + export CAPIF_IMAGE_TAG="v3.0.0-release" -- GitLab From 951bf244df6e9af605f0cfdecd371784fc5d58c2 Mon Sep 17 00:00:00 2001 From: Jorge Moratinos Salcines Date: Wed, 20 Aug 2025 12:42:53 +0200 Subject: [PATCH 7/8] Added example environment --- helm/scripts/envs/example.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/scripts/envs/example.env b/helm/scripts/envs/example.env index bd19f70d..b86dfd4f 100644 --- a/helm/scripts/envs/example.env +++ b/helm/scripts/envs/example.env @@ -1,5 +1,5 @@ export CUSTOM_KUBECONFIG="cluster-example.kubeconfig" - export VAULT_HOSTNAME=vault.example.org + export VAULT_HOSTNAME=vault.example.production export DOMAIN1=*.example.production export DOMAIN2=*.example.staging export DOMAIN3=*.example.dev -- GitLab From c1c834871904a30e89c56ed4d0c356b70e08393e Mon Sep 17 00:00:00 2001 From: Jorge Moratinos Salcines Date: Wed, 20 Aug 2025 12:56:59 +0200 Subject: [PATCH 8/8] Added example environment --- helm/scripts/envs/example.env | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/helm/scripts/envs/example.env b/helm/scripts/envs/example.env index b86dfd4f..0d976b1b 100644 --- a/helm/scripts/envs/example.env +++ b/helm/scripts/envs/example.env @@ -1,12 +1,19 @@ - export CUSTOM_KUBECONFIG="cluster-example.kubeconfig" - export VAULT_HOSTNAME=vault.example.production - export DOMAIN1=*.example.production - export DOMAIN2=*.example.staging - export DOMAIN3=*.example.dev - export PROMETHEUS_HOSTNAME=prometheus.example.production - export CAPIF_HOSTNAME="capif.example.staging" - export REGISTER_HOSTNAME="register.example.staging" - export CAPIF_NAMESPACE=ocf-capif - export CAPIF_CI_ENV_ENDPOINT=staging - export CAPIF_DOMAIN=example.staging - export CAPIF_IMAGE_TAG="v3.0.0-release" +# Setup kubeconfig to be used +export CUSTOM_KUBECONFIG="cluster-example.kubeconfig" + +# Setup Vault parameters to deploy on this environment +export VAULT_HOSTNAME=vault.example.production +export DOMAIN1=*.example.production +export DOMAIN2=*.example.staging +export DOMAIN3=*.example.dev + +# Setup Monitoring parameters +export PROMETHEUS_HOSTNAME=prometheus.example.production + +# Setup OpenCAPIF parameters +export CAPIF_HOSTNAME="capif.example.staging" +export REGISTER_HOSTNAME="register.example.staging" +export CAPIF_NAMESPACE=ocf-capif +export CAPIF_CI_ENV_ENDPOINT=staging +export CAPIF_DOMAIN=example.staging +export CAPIF_IMAGE_TAG="v3.0.0-release" -- GitLab