ibm-devops-loop

by joaquinito2051

Helm chartv3.0.0App 3.0.0Apache-2.0

A Helm chart for the DevOps Loop

About this chart

IBM DevOps Loop

Introduction

IBM DevOps Loop is a cloud-based continuous integration platform built on modern, cloud-native technologies that enables product teams to plan, code, test, and deploy the applications and also provides a holistic view of the progress in the DevOps cycle. Loop is built to install on IBM® Red Hat OpenShift & K8s platforms.

K8s Installation Instructions

Prerequisites

  1. An available K8s cluster.

  2. Install and setup the Helm 3 CLI.

  3. A valid public certificates issued by trusted Certificate Authorities (CAs).

  4. For installation instructions and requisite requirements, see Installation of DevOps Loop at https://www.ibm.com/docs/en/devops-loop/3.0.0?topic=administration-installation-devops-loop

  5. Image and Helm Chart - The DevOps Loop images and helm chart can be accessed via the Entitled Registry and public Helm repository.

* The public Helm chart repository can be accessed at <https://github.com/IBM/charts/tree/master/repo/ibm-helm> and directions for accessing the DevOps Loop chart will be discussed later in this README.
* Get a key to the entitled registry
  * Log in to [MyIBM Container Software Library](https://myibm.ibm.com/products-services/containerlibrary) with the IBMid and password that are associated with the entitled software.
  * In the Entitlement keys section, select Copy key to copy the entitlement key to the clipboard.
  * An imagePullSecret must be created to be able to authenticate and pull images from the Entitled Registry.  Note: Secrets are namespace scoped, so they must be created in every namespace you plan to install DevOps Loop into.  Following is an example command to create an imagePullSecret named 'ibm-entitlement-key'.

  ```bash
  kubectl create secret docker-registry ibm-entitlement-key \
    --namespace [namespace_name] \
    --docker-username=cp \
    --docker-password=<EntitlementKey> \
    --docker-server=cp.icr.io
  ```

Storage

If the cluster default StorageClass does not support the ReadWriteMany (RWX) accessMode, an alternative class must be specified using the following additional helm value: global.persistence.rwxStorageClass For example, ibmc-file-gold-gid.

ReadWriteOnce (RWO) access mode storage can be configured with the following helm value: global.persistence.rwoStorageClass For example, ibmc-block-gold.

MongoDB Provisioning

Bitnami MongoDB provisioning has been removed. Managed installs use the official library/mongo:8.0.28 image by default because DevOps Loop 3.0.0 includes Velocity 5.3.0, and Velocity 5.2.x supports MongoDB Community/Enterprise 7.0 and 8.0. MongoDB 6.0 is not supported for Velocity 5.1.8 or later, and MongoDB 8.2.x is not currently listed as supported for Velocity 5.2.x.

Installers create or validate mongodb-url-secret with key password and pass --set ibm-ucv-prod.secrets.database=mongodb-url-secret to the Loop chart. Existing secrets are reused unless MONGO_FORCE_RECREATE_SECRET=true is set. For air-gapped installs, mirror docker.io/library/mongo:8.0.28 into a private registry. OpenShift internal-registry installs can use split image components:

MONGO_INSTALL_MODE=airgap
MONGO_REGISTRY=image-registry.openshift-image-registry.svc:5000
MONGO_IMAGE_REPO=devops-loop/mongo
MONGO_IMAGE_TAG=8.0.28
MONGO_PULLSECRET=default-dockercfg-qxkr6

The existing full private repository style is also valid:

MONGO_INSTALL_MODE=airgap
MONGO_IMAGE_REPO=${DEST_REGISTRY}/mongo
MONGO_IMAGE_TAG=8.0.28
MONGO_IMAGE_PULL_SECRET=<private-registry-pull-secret>

Or set MONGO_INSTALL_MODE=external and pre-create mongodb-url-secret.

Licensing

DevOps Loop requires an installed IBM Rational License Key Server (RLKS). You must specify this RLKS server during installation.

See IBM Rational License Key Server documentation for more details.

Optional Harbor integration

Harbor is optional and disabled by default. To install DevOps Loop with Harbor enabled, set the following value in the installation script:

HARBOR_ENABLED=true

The installer runs the base Loop install with Harbor disabled first. If HARBOR_ENABLED=false, it exits after the base install; if HARBOR_ENABLED=true, it waits for release jobs before the Harbor enablement upgrade.

Harbor requires S3-compatible object storage. Set these values before running the installer:

HARBOR_S3_BUCKET=<bucket-name>
HARBOR_S3_REGION=<region>
HARBOR_S3_ENDPOINT=<s3-compatible-endpoint>

Create the Harbor S3 credential secret in the DevOps Loop namespace before enabling Harbor. The secret must be named harbor-s3-secret and must contain the keys accesskey and secretkey.

kubectl create secret generic harbor-s3-secret \
  --namespace <namespace> \
  --from-literal=accesskey='<ACCESS_KEY>' \
  --from-literal=secretkey='<SECRET_KEY>'

Harbor Trivy requires a storage class for its cache. Set:

HARBOR_TRIVY_STORAGE_CLASS=<rwx-storage-class>

Optionally set the Harbor OIDC administrator group:

HARBOR_OIDC_ADMIN_GROUP=<keycloak-group-name>

If this value is not set, the installer uses the chart default. Users in this Keycloak group become Harbor administrators.

After installation, Harbor is available from the DevOps Loop app launcher/switcher and from the configured Harbor external URL.

To import images into Harbor, update:

scripts/harbor/bootstrap-images.txt

Each line uses this format:

source_image target_project target_repo target_tag

Example:

registry.example.com/team/application:1.0.0 library application 1.0.0

Then run:

DOMAIN=<domain> NAMESPACE=<namespace> RELEASE=<helm-release> scripts/harbor/bootstrap-images.sh

Optional Harbor on OpenShift

Before enabling Harbor on OpenShift, a cluster administrator must first apply a dedicated, narrowly scoped Security Context Constraints (SCC) for Harbor.

Harbor upstream images run with UID/GID 10000. The DevOps Loop chart creates and uses a dedicated Harbor ServiceAccount on OpenShift, and the custom SCC must be bound only to that ServiceAccount.

The SCC manifest is provided at:

scripts/harbor/openshift/harbor-scc.yaml

A helper script is provided for a cluster administrator to apply the SCC and bind it to the dedicated Harbor ServiceAccount:

scripts/harbor/openshift/apply-harbor-scc.sh \
  --namespace devops-loop \
  --service-account harbor \
  --scc-name harbor-uid-10000-devops-loop

The SCC is not automatically rendered by Helm because it is stored under scripts/harbor/openshift/, not under templates/. The OpenShift installer checks that the SCC exists and is bound correctly before enabling Harbor, but it does not silently create or modify the SCC.

For OpenShift, set HARBOR_EXTERNAL_URL to the full HTTPS URL for the fixed Harbor Route hostname when one is required. The hostname must resolve through the OpenShift router wildcard DNS.

Install

This installation includes locally deployed databases. This includes a sample install of MongoDB.

Before you begin, follow requisite steps and configuration at Installation of DevOps Loop: https://www.ibm.com/docs/en/devops-loop/3.0.0?topic=administration-installation-devops-loop

Fetch chart for install:

helm repo add ibm-helm https://raw.githubusercontent.com/IBM/charts/master/repo/ibm-helm --force-update
#Required
#External fully qualified domain name of the cluster
#
#See Installation of DevOps Loop documentation for more details:
#https://www.ibm.com/docs/en/devops-loop/3.0.0?topic=administration-installation-devops-loop
DOMAIN=

#Required
#Set value to 'true' to accept the license.
ACCEPT_LICENSE=

#Required
#Hostname of IBM Rational license server
LICENSE_SERVER=

#Required
#SMTP Server configuration
EMAIL_SERVER_HOST=
EMAIL_SERVER_PORT=
EMAIL_FROM_ADDRESS=

#Optional
#Additional SMTP Server configuration
EMAIL_SERVER_USERNAME=""
EMAIL_SERVER_PASSWORD=""
EMAIL_SERVER_STARTTLS=false
EMAIL_SERVER_SMTPS=false

#Required
#Secure seed required to generate passwords
#A random string
#Unrecoverable so keep it safe
PASSWORD_SEED=

#Specify the TLS secret name in your namespace as necessary.
#
#See Installation of DevOps Loop documentation for more details:
#https://www.ibm.com/docs/en/devops-loop/3.0.0?topic=administration-installation-devops-loop
TLS_CERT_SECRET_NAME=

#Set SELF_SIGNED=true to generate and use a self-signed certificate for the
#installation of DevOps Loop
SELF_SIGNED=

#Alternative RWX storage class
#See Storage
#For example: ibmc-file-gold-gid
RWX_STORAGE_CLASS=

#Alternative RWO storage class
#See Storage
#For example: ibmc-block-gold
RWO_STORAGE_CLASS=

# optional Appscan integration
APP_SCAN_ENABLED=false

# Required only when APP_SCAN_ENABLED=true
# External URL for AppScan (e.g. https://cloud.appscan.com)
APPSCAN_EXTERNAL_URL=

# Optional Harbor integration
HARBOR_ENABLED=false

# Required only when HARBOR_ENABLED=true
HARBOR_S3_BUCKET=
HARBOR_S3_REGION=
HARBOR_S3_ENDPOINT=

# Harbor Trivy cache uses RWX
#See Storage
#For example: ibmc-file-gold-gid
HARBOR_TRIVY_STORAGE_CLASS=

# Harbor OIDC admin group in Keycloak
# Users in this group become Harbor system administrators.
HARBOR_OIDC_ADMIN_GROUP=

#Required
NAMESPACE=devops-loop
HELM_NAME=devops-loop
LOOP_CHART_VERSION=3.0.0

#Optional Additional Helm options
ADDITIONAL_HELM_OPTIONS=""

SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"

MONGODB_HELPER_SCRIPT="${MONGODB_HELPER_SCRIPT:-${ROOT_DIR}/scripts/mongodb.sh}"
if [ ! -f "${MONGODB_HELPER_SCRIPT}" ]; then
  echo "ERROR: MongoDB helper not found at ${MONGODB_HELPER_SCRIPT}."
  echo "Set ROOT_DIR to the extracted DevOps Loop helm chart directory or set MONGODB_HELPER_SCRIPT."
  exit 1
fi
. "${MONGODB_HELPER_SCRIPT}"

wait_for_secret() {
  local secret_name="$1"
  local timeout_seconds="${2:-900}"
  local waited=0

  echo "Waiting for secret ${secret_name} in namespace ${NAMESPACE}..."

  until kubectl get secret "${secret_name}" -n "${NAMESPACE}" >/dev/null 2>&1; do
    if [ "${waited}" -ge "${timeout_seconds}" ]; then
      echo "Timed out waiting for secret ${secret_name}"
      return 1
    fi
    sleep 10
    waited=$((waited + 10))
  done

  echo "Secret ${secret_name} is available."
}

run_install() {

  if ! kubectl get namespace ${NAMESPACE} > /dev/null 2>&1; then
    kubectl  create namespace ${NAMESPACE} || { echo "Failed to create namespace"; return 1; }
  fi

  # Bitnami MongoDB provisioning has been removed. The helper deploys MongoDB
  # using the official library/mongo image by default, with MONGO_IMAGE_TAG=8.0.28 because
  # Velocity 5.2.x supports MongoDB 7.0 and 8.0. MongoDB 6.0 is unsupported for
  # Velocity 5.1.8 and later, and MongoDB 8.2.x is not currently listed as
  # supported for Velocity 5.2.x.
  KUBE_CMD=kubectl ensure_mongodb_url_secret || return 1

  if [ "${SELF_SIGNED}" = "true" ]; then
    export TLS_CERT_SECRET_NAME=devops-loop-tls-secret
    openssl genrsa -out key.pem 2048
    openssl req -new -x509 -key key.pem -out cert.pem -days 365 \
            -subj "/CN=${DOMAIN}" -addext "subjectAltName = DNS:${DOMAIN},DNS:*.${DOMAIN}" \
            -addext "certificatePolicies = 1.2.3.4"

    kubectl create secret generic ${TLS_CERT_SECRET_NAME} \
      --type=kubernetes.io/tls \
      --from-file=ca.crt=./cert.pem \
      --from-file=tls.crt=./cert.pem \
      --from-file=tls.key=./key.pem \
      --namespace ${NAMESPACE}
  fi

  HELM_OPTIONS="${HELM_OPTIONS:-} \
--set global.domain=${DOMAIN} \
--set-literal global.passwordSeed=${PASSWORD_SEED} \
--set global.platform.smtp.sender=${EMAIL_FROM_ADDRESS} \
--set global.platform.smtp.host=${EMAIL_SERVER_HOST} \
--set global.platform.smtp.port=${EMAIL_SERVER_PORT} \
--set global.platform.smtp.username=${EMAIL_SERVER_USERNAME} \
--set global.platform.smtp.password=${EMAIL_SERVER_PASSWORD} \
--set global.platform.smtp.startTLS=${EMAIL_SERVER_STARTTLS} \
--set global.platform.smtp.smtps=${EMAIL_SERVER_SMTPS} \
--set global.ibmCertSecretName=${TLS_CERT_SECRET_NAME} \
--set license=${ACCEPT_LICENSE} \
--set platform.appscan.enabled=${APP_SCAN_ENABLED}
"

  if [ "${APP_SCAN_ENABLED}" = "true" ] && [ -n "${APPSCAN_EXTERNAL_URL}" ]; then
    HELM_OPTIONS="${HELM_OPTIONS} --set-string platform.appscan.externalURL=${APPSCAN_EXTERNAL_URL}"
  fi

  if [ "${SELF_SIGNED}" = "true" ]; then
     HELM_OPTIONS="${HELM_OPTIONS} --set global.privateCaBundleSecretName=${TLS_CERT_SECRET_NAME}"
     HELM_OPTIONS="${HELM_OPTIONS} --set ibm-devops-prod.ingress.cert.selfSigned=true"
  fi

  if [ -n "${LICENSE_SERVER}" ]; then
    HELM_OPTIONS="${HELM_OPTIONS} --set global.rationalLicenseKeyServer=@${LICENSE_SERVER}"
  fi

  if [ -n "${RWX_STORAGE_CLASS}" ]; then
    HELM_OPTIONS="${HELM_OPTIONS} --set global.persistence.rwxStorageClass=${RWX_STORAGE_CLASS}"
  fi

  if [ -n "${RWO_STORAGE_CLASS}" ]; then
    HELM_OPTIONS="${HELM_OPTIONS} --set global.persistence.rwoStorageClass=${RWO_STORAGE_CLASS}"
  fi

  HELM_OPTIONS="${HELM_OPTIONS} ${ADDITIONAL_HELM_OPTIONS}"

  helm upgrade --install ${HELM_NAME} ibm-helm/ibm-devops-loop --version ${LOOP_CHART_VERSION} ${HELM_OPTIONS} \
    --set ibm-ucv-prod.secrets.database=mongodb-url-secret \
    --set harbor.enabled=false \
    -n ${NAMESPACE} || return 1

  if [ "${HARBOR_ENABLED}" != "true" ]; then
    echo "Harbor is disabled. DevOps Loop installation completed."
    return 0
  fi

  echo "Waiting for release jobs to complete before enabling Harbor..."
  for job in $(kubectl get jobs -n "${NAMESPACE}" \
    -l "app.kubernetes.io/instance=${HELM_NAME}" \
    -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}'); do
    kubectl get job "${job}" -n "${NAMESPACE}" >/dev/null 2>&1 || continue
    kubectl wait --for=condition=complete "job/${job}" -n "${NAMESPACE}" --timeout=900s 2>/dev/null || \
    { kubectl get job "${job}" -n 

Deploy ibm-devops-loop with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has ibm-devops-loop on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartibm-devops-loop is pinned at v3.0.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply