Skip to content

How to Deploy Using Helm

In this section we will explain how to use Helm Charts to deploy OpenCAPIF using Helm Scripts present at repository.

Overview

Complete deployment of OpenCAPIF involves below services:

  • HashiCorp Vault.
  • Monitoring stack (Prometheus, Grafana, ...)
  • OpenCAPIF.

All needed files, like helm deployments and scripts are under Helm Main directory at OpenCAPIF repository.

Helm Directory

In order to simplify the way to deploy, OCF SDG created different helm definitions to allow the deployment of all related services, like Vault, Monitoring Stack and OpenCAPIF.

Those helm are fully functional, you will need to configure each one and also load security information to vault, and also you will need the knowledge to launch helm deployment on your environment. This is out of the scope of this Documentation.

But we also created some scripts to simplify this process.

Helm Scripts

OCF SDG created a set of scripts to deploy/undeploy OpenCAPIF at k8s environment, and also perform some other tasks like create users, run tests suites, ...

All scripts are stored at Helm Scripts.

All scripts use configurations defined under variables.sh and environment files if they are defined.

There are different types of scripts:

Step-by-step Installation (granular control)

These scripts install individual groups of helm charts in order:

  • 00_install_capif_monitoring.sh: Deploy monitoring namespace (Grafana, Prometheus, Tempo, Loki, FluentBit, OpenTelemetry).
  • 01_install_capif_db.sh: Deploy MongoDB instances (CAPIF DB and Register DB).
  • 02_install_capif_db_express.sh: Deploy Mongo Express for both CAPIF and Register databases.
  • 03_install_capif_commons.sh: Deploy common services (Redis, Celery, mock server).
  • 04_install_capif_services.sh: Deploy all OpenCAPIF core services (CAPIF APIs, NGINX, Helper).
  • 05_install_capif_register.sh: Deploy the Register service.

Deployment Management

All-in-one scripts that combine the step-by-step scripts above:

  • install_vault.sh: Deploy Vault component on k8s cluster, only needed if vault is not previously deployed. If already deployed you can set the vault token in variables.sh.
  • install_monitoring.sh: Deploy monitoring on k8s cluster.
  • install_capif.sh: Deploy OpenCAPIF on k8s cluster. Executes all six step-by-step scripts in order.
  • deploy_interconnection_environment.sh: Deploy two OpenCAPIF environments locally with interconnection enabled.
  • uninstall_vault.sh: Rollback Vault component from k8s cluster.
  • uninstall_monitoring.sh: Rollback monitoring components from k8s cluster.
  • uninstall_capif.sh: Rollback OpenCAPIF from k8s cluster.

Manage Remote Users

  • create_remote_users.sh: Create users on deployed OpenCAPIF using configured parameters. Users are created by administrator.
  • remove_remote_users.sh: Remove a user from deployed OpenCAPIF.
  • remove_remote_users_by_prefix.sh: Remove users by prefix.

DNS Resolution

  • get_ingress.sh: Generate a fixed DNS resolution configuration for ingress in the namespace passed by parameters.
  • set_ingress.sh: Add the fixed DNS resolution for ingress to /etc/hosts for the namespace passed by parameters.

Run Robot Test Suites

  • run_remote_capif_tests.sh: Launch Robot Test Docker image on current machine to reach deployed OpenCAPIF. Useful to launch with “--include smoke” to verify everything is deployed properly.

Create Testing Dummy Data

  • populate_create_remote_dummy_users.sh: Create dummy providers and invokers, publish service APIs and create security contexts for invokers.
  • populate_remove_remote_dummy_users.sh: Remove dummy information created.

How to Run Scripts

Configure environment parameters

variables.sh contains all configuration that will be used on remote operation.

Currently also environment files are supported. Those environment files contains the override of variables present on variables.sh.

If you want to use environment files, just place a file under /helm/scripts/envs with name of your environment and extension ".env". You can see the example environment here

After add this environment file, you just need to indicate when you run any of the scripts at /helm/scripts directory, in this way:

./<script_to_run>.sh [environment] [command_options]

Example

Create a file under /helm/scripts/envs called production.env with below information:

# Setup kubeconfig to be used
export CUSTOM_KUBECONFIG="production.kubeconfig"

# Setup Vault parameters to deploy on this environment
export VAULT_HOSTNAME=vault.company.production
export DOMAIN1=*.company.production
export DOMAIN2=*.company.staging
export DOMAIN3=*.company.dev

# Setup Monitoring parameters
export PROMETHEUS_HOSTNAME=prometheus.company.production

# Setup OpenCAPIF parameters
export CAPIF_HOSTNAME="capif.company.production"
export REGISTER_HOSTNAME="register.company.production"
export CAPIF_NAMESPACE=ocf-capif
export CAPIF_CI_ENV_ENDPOINT=latest
export CAPIF_DOMAIN=company.production
export CAPIF_IMAGE_TAG="v3.0.0-release"

This is our environment file, with specific information of our environment. Now we can run for example the deployment scripts, just adding as first parameter the name of environment (name of file without extension):

./install_vault.sh production
./install_monitoring.sh production
./install_capif.sh production

After deploy OpenCAPIF we can run tests for example:

./run_remote_capif_tests.sh production --include capif_api_invoker_management-1

Or run any other task related, for example, creation of users at new environment:

./create_remote_users.sh production -u user -p pass

NOTE: You can check also information of how to use the scripts by including "-h" flag (not present on Deployment Management scripts)