Skip to content

Environments

Hive runs in several Kubernetes clusters. Each cluster is an environment with its own Hive API, Knative domain, ArgoCD and PostgreSQL. A service is deployed to an environment by a CI stage that runs hive ci --global -E <name> — see CI/CD.

Environment Kind Knative domain Hive API
staging staging knative-staging.svcik.org https://api.hive-api.knative-staging.svcik.org
production production knative.svcik.org https://api.hive-api.knative.svcik.org
envik production knative.envik.org https://api.hive-api.knative.envik.org

The list lives in cli/environments.yaml in the hive-api repository. An unknown name in -E is an error.

Choosing where to deploy

Add one stage per environment to the parent .gitlab-ci.yml. Most services need staging and production. Add envik only if the service has to run in that cluster.

The service URL follows the environment's domain:

https://{name}.{namespace}.knative-staging.svcik.org   # staging
https://{name}.{namespace}.knative.svcik.org           # production
https://{name}.{namespace}.knative.envik.org           # envik

How the CLI knows the environment

hive deploy takes the environment from HIVE_ENVIRONMENT, which hive ci -E <name> sets in the generated jobs. Without it, the CLI matches HIVE_DOMAIN, then HIVE_API_URL, against the table above. If nothing matches, it uses staging and prints a warning. An unknown HIVE_ENVIRONMENT is a fatal error (exit code 1).

More than one production

Each environment is a separate cluster. Nothing is shared between them:

  • Database. storage.database: true creates a separate, empty database in each cluster. Data is not synchronised.
  • Hive domain, ArgoCD, secrets. Each cluster has its own.
  • customDomains. A flat list applies in every production environment. If the service deploys to both production and envik, use the per-environment form with different hostnames: the same hostname in two clusters breaks DNS and TLS. See Custom Domains.