Environments
How clusters are grouped into environments by label, what a class does, and what an environment adds to a deployment.
An environment is a named group of clusters, such as development, staging or production. It lets you say "deploy this app to production" without listing every production cluster, and it is where rules about production attach. Read Deployments first.
The mental model
clusters environments deployment
prod-eu-1 env=prod region=eu ┐
prod-us-1 env=prod region=us ├─▶ production (selector env=prod) ◀── shop
prod-us-2 env=prod region=us ┘ class: production
stg-1 env=stg ───▶ staging (selector env=stg) ◀── shop-stagingA cluster has a tier (production, staging or development) and labels you set. An environment has a selector: clusters whose labels match are placed in it when you save the environment, and a cluster that registers later with matching labels can be placed too. Setting a selector never moves a cluster that already has an environment.
What an environment has
| Field | Meaning |
|---|---|
| Name | Up to 48 characters, such as production. |
| Class | A free-form label for what kind of environment it is, such as production or staging. Guardrails select environments by class, and rules for production attach to the class production. |
| Selector | The cluster labels that place clusters in the environment. |
| Order | Where it appears in lists, lowest first. |
| Deploy window | The days and hours, in a time zone, when deployments may start. A window does not cross midnight. |
| Notification targets | A Slack channel, email address or https webhook. They are stored; nothing is delivered to them yet. |
| Owners | The people who manage it. |
An environment that still holds clusters cannot be archived.
One deployment, many clusters
When a deployment targets an environment, Wardn queues one apply per cluster in it and tracks each separately. If one cluster is offline, the others still apply. Adding a cluster to the environment makes the deployment reach it. This is how one app gets onto every cluster of a region or a tier without a deployment per cluster.
| Deployment target | Applied to | Tracked as |
|---|---|---|
| A cluster | That cluster | One state |
| An environment | Every cluster in it | One state per cluster, and the worst overall |
Why class matters
The class is how Wardn tells production from the rest. Environments of class production have the protected-branch guardrail on by default: they take snapshots only from a protected branch. Other classes leave it off. You can set or change the branch rule on any environment.
Guardrails and pipelines both refer to environments: a guardrail can target everything of a class, and a pipeline stage is bound to one environment.
Deploy windows
The deploy window is stored on the environment and is the default for the windows of pipeline stages in it. A stage can narrow the window and never widen it. See Stage rules.
Environments and access
Whoever creates an environment owns it. Owning lets you manage the environment and, with the matching grant, act on the deployments in it. A person who can see a deployment on an environment but not the environment itself sees a limited view: its name, health and versions, and only their own deployments. See the access model.
A cluster belongs to at most one environment. An environment is also not the same as a Kubernetes namespace: namespaces are where a deployment's objects go, and environments group the clusters that hold those namespaces.
Guides that use this
- Environments and many clusters: create an environment, select clusters, set a window.
- One app on every cluster in an environment.
- From a push to production.