MATIH Platform is in active MVP development. Documentation reflects current implementation status.
18. CI/CD & Build System
Scripts Library
Kubernetes Libraries

Kubernetes Libraries

The Kubernetes libraries provide functions for namespace management, secret operations, pod health checks, and build infrastructure management. They abstract kubectl commands behind safe, idempotent functions.

Source: scripts/lib/k8s/


namespace.sh -- Namespace Management

Module: scripts/lib/k8s/namespace.sh

Functions

FunctionDescription
k8s_ns_existsCheck if a namespace exists
k8s_ns_ensureCreate namespace if not exists, with optional labels
k8s_ns_createCreate namespace with standard MATIH labels

Standard Labels

All namespaces created by MATIH scripts include:

app.kubernetes.io/component=<component>
app.kubernetes.io/managed-by=matih

secrets.sh -- Secret Management

Module: scripts/lib/k8s/secrets.sh

Functions

FunctionDescription
k8s_secret_existsCheck if a secret exists in a namespace
k8s_secret_createCreate a generic secret with key=value pairs
k8s_secret_getRead a secret value
k8s_secret_deleteDelete a secret

All functions are idempotent -- creating an existing secret is a no-op.


dev-secrets.sh -- Dev Environment Secrets

Module: scripts/lib/k8s/dev-secrets.sh

Creates development environment secrets with predictable values for local and dev cluster testing. These secrets are NOT used in production (ESO manages production secrets).

Created Secrets

SecretNamespacePurpose
postgresqlmatih-control-planePostgreSQL credentials
postgresqlmatih-data-planePostgreSQL credentials
redismatih-control-planeRedis password
mlflow-s3-credentialsmatih-data-planeMinIO access for MLflow
db-credentialsmatih-data-planeApplication database credentials

health.sh -- Pod Health Checks

Module: scripts/lib/k8s/health.sh

Functions

FunctionDescription
k8s_pods_readyCheck if all pods matching a selector are Ready
k8s_wait_podsWait for pods to become Ready with timeout
k8s_get_failing_podsList pods in error states
k8s_diagnose_podGet detailed diagnostic info for a failing pod

Wait Pattern

# Wait up to 180 seconds for Spark Operator pods
k8s_wait_pods "matih-data-plane" "app.kubernetes.io/name=spark-operator" 180 1

build.sh -- Build Infrastructure

Module: scripts/lib/k8s/build.sh

Manages Kubernetes resources used during the build process (e.g., build pods, PVCs).


nodepool.sh -- Nodepool Management

Module: scripts/lib/k8s/nodepool.sh

Manages AKS nodepool scaling for build and GPU workloads.


Related Pages