ska-tango-charts

This repository is the bridge between the TANGO-controls framework and Kubernetes. It provides Helm charts for deploying a minimal TANGO environment and for defining TANGO device servers.

Charts

| Chart | Type | Purpose | |—|—|—| | ska-tango-base | Application | Deploys the core TANGO infrastructure: TangoDB (MySQL), DatabaseDS, and device servers | | ska-tango-util | Library | Helm partials for defining device servers; consumed by ska-tango-base and downstream charts | | ska-tango-umbrella | Application | Example umbrella chart demonstrating advanced features (multiple DatabaseDS, external DB) |

Getting started

This project uses make as its UI (run make help for target documentation). It uses a git submodule, so initialise it first:

git submodule update --init --recursive

Prerequisites

  • Docker: follow the instructions at the Docker Engine docs.

  • Minikube (or equivalent): follow the deploy-minikube instructions:

    git clone git@gitlab.com:ska-telescope/sdi/deploy-minikube.git
    cd deploy-minikube
    make all
    

Install, test, and uninstall

make k8s-install-chart   # deploy
make k8s-wait            # wait for pods to be ready
make k8s-test            # run helm tests
make k8s-uninstall-chart # tear down

Configuration

Operator vs non-operator mode

Set global.operator: true to deploy device servers via the ska-tango-operator CRDs. Set it to false to deploy plain Kubernetes StatefulSet + Service resources.

External TangoDB (MySQL)

By default (tangodb.enabled: true) the chart deploys its own MySQL instance (tangodb). Set tangodb.enabled: false when pointing at an external database. To use an existing external MySQL instead, set externalTangoDBMySqlHost on the databaseds section or on a databasedsInstances entry:

# values.yaml (operator mode only)
databaseds:
  externalTangoDBMySqlHost: "my-mysql-host:3306"

Multiple DatabaseDS instances

Use databasedsInstances to deploy more than one DatabaseDS (operator mode only). Each key becomes the Kubernetes Service name and CR name:

databasedsInstances:
  tango-databaseds:           # primary — backed by the chart's own TangoDB
    usePV: true

  tango-databaseds4:          # secondary — backed by an external MySQL
    usePV: true
    tangoDBStorageClass: nfss1
    externalTangoDBMySqlHost: "my-mysql-host.namespace:3306"
    externalDatabaseDS: tango-databaseds   # the primary DS that holds the device registration
    dbPasswordSecretName: "mysql-secret-name"
    dbPasswordSecretKey: "password"
    instanceName: "4"
    deviceName: "sys/database/4"
    exposeDS: true

Available per-instance fields:

| Field | Default | Description | |—|—|—| | usePV | false | Attach a PersistentVolume to the TangoDB pod | | tangoDBStorageClass | nfss1 / standard (minikube) | Storage class for the PV | | externalTangoDBMySqlHost | — | Use an existing MySQL instead of deploying TangoDB | | externalDatabaseDS | — | Hostname of the primary DS that registered this device | | dbPasswordSecretName / dbPasswordSecretKey | — | K8s Secret for the MySQL password | | dbUserSecretName / dbUserSecretKey | — | K8s Secret for the MySQL username | | instanceName | "2" | DataBaseds instance number | | deviceName | sys/database/2 | TANGO device path | | exposeDS | false | Create a LoadBalancer Service | | loadBalancerIP / clusterIP | — | Fixed IP for the Service | | labels / annotations | — | Merged with global labels/annotations |

DatabaseDS as a plain device server (ska-tango-util)

It is also possible to deploy a DataBaseds process as an ordinary device server through ska-tango-util (i.e. via deviceServers). This is useful when you need a second DatabaseDS that connects to the primary one for its own device registration:

deviceServers:
  tango-ds3:
    name: tango-ds3
    function: databaseds
    domain: tango-base
    command: "/usr/local/bin/DataBaseds"
    instances: ["3"]
    device_server_port: 10000
    server:
      name: "DataBaseds"
      instances:
      - name: "3"
        classes:
        - name: "DataBase"
          devices:
          - name: "sys/database/3"
    image:
      registry: artefact.skao.int
      image: ska-tango-images-tango-cpp
      tag: 9.5.0
      pullPolicy: IfNotPresent
    depends_on:
      - device: sys/database/2
    orbport: 10000
    environment_variables:
      - name: MYSQL_HOST
        value: my-mysql-host:3306
      - name: MYSQL_DATABASE
        value: tango
      - name: MYSQL_USER
        value: tango
    existingSecrets:
    - secretName: mysql-secret-name
      env:
      - envName: MYSQL_PASSWORD
        secretKey: password

See ska-tango-umbrella/values.yaml for a complete working example.