Metadata for K8s objects

Labels

All Kubernetes objects produced by qbec have the following labels associated with them:

  • qbec.io/application - the app name from qbec.yaml.
  • qbec.io/environment - the environment name in qbec.yaml for which the object was created.
  • qbec.io/tag - the --app-tag parameter passed in on the command line. This label is only set when non-blank.

The labels are used to efficiently find all cluster objects for a specific app and environment (and tag, if specified) for garbage collection.

Annotations

All Kubernetes objects produced by qbec have the following annotation associated with them:

  • qbec.io/last-applied - this is the pristine version of the object stored for the purposes of diff and 3-way merge patches and plays the same role as the kubectl.kubernetes.io/last-applied-configuration annotation set by kubectl apply.
  • qbec.io/component - the component that created the object. This is derived from the file name of the component.

The component annotation is used to respect component filters for apply and delete operations. Specifically, if apply is being run with component filters, only the extra remote objects matching the filter are garbage-collected.