You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a kustomization author,
In order to leverage metadata about current flux context and kustomization in the rendered templates,
I need to get metadata as default substitution variables
It is sometimes useful for a container to have information about itself, without being overly coupled to Kubernetes. The downward API allows containers to consume information about themselves or the cluster without using the Kubernetes client or API server.
Kustomize apps have access to the standard build environment which can be used in combination with a config managment plugin to alter the rendered manifests.
The resolved revision, e.g. f913b6cbf58aa5ae5ca1f8a2b149477aebcbd9d8.
ARGOCD_APP_SOURCE_PATH
The path of the app within the source repo.
ARGOCD_APP_SOURCE_REPO_URL
The source repo URL.
ARGOCD_APP_SOURCE_TARGET_REVISION
The target revision from the spec, e.g. master.
KUBE_VERSION
The version of Kubernetes.
KUBE_API_VERSIONS
The version of the Kubernetes API.
[Kustomize](https://argo-cd.readthedocs.io/en/stable/user-guide/kustomize/) support the following build env vars:
Variable Description
ARGOCD_APP_NAME The name of the application.
ARGOCD_APP_NAMESPACE The destination namespace of the application.
ARGOCD_APP_REVISION The resolved revision, e.g. f913b6cbf58aa5ae5ca1f8a2b149477aebcbd9d8.
ARGOCD_APP_SOURCE_PATH The path of the app within the source repo.
ARGOCD_APP_SOURCE_REPO_URL The source repo URL.
ARGOCD_APP_SOURCE_TARGET_REVISION The target revision from the spec, e.g. master.
KUBE_VERSION The version of Kubernetes.
KUBE_API_VERSIONS The version of the Kubernetes API.
kapp-controller’s downward API was recently introduced into develop (not yet in any release) and works similar to the k8s downward API: We make available certain information from the metadata of the AppCR to the template step. (see develop branch App CR docs for more).
Here we add two new pieces of information: the current version of kapp-controller and of kubernetes itself, and allow the user to specify a name to bind that data to which can then be used during templating. This would allow users to create conditionals during templating that are sensitive to e.g. the current kubernetes version.
For helm, expose kubernetesVersion: {} and kubernetesAPIs:{} bc those correspond to flags we’ll pass in to the helm template.
Then we’ll have the items still in the downwardsAPIs for the other templaters (and technically helm though wouldn’t expect anyone to ever use)
valuesFrom:
[...]# downwardAPI allows passing info about App CR as values into templates (v0.39.0+)
- downwardAPI:
items:
# name specifies the key used when the downwardAPI values are rendered. # nested keys are supported by using a '.'. for e.g. `name: parent.child`. # keys requiring a '.' can escape using '\\.'. for e.g. `name: key\\.with\\.dots`
- name: namespace# fieldPath accepts relaxed jsonpath to select metadata fields from the AppCR (name, namespace, uid, labels, annotations)fieldPath: metadata.namespace
- name: specificAnnotationfieldPath: metadata.annotations['specificAnnotation']
The text was updated successfully, but these errors were encountered:
As a kustomization author,
In order to leverage metadata about current flux context and kustomization in the rendered templates,
I need to get metadata as default substitution variables
This would be similar in intent to the K8S downward api
https://kubernetes.io/docs/concepts/workloads/pods/downward-api/
Example metadata:
revision
andlastUpdateTime
Example use-cases:
Similar feature in other git ops controllers:
https://argo-cd.readthedocs.io/en/stable/user-guide/kustomize/
https://argo-cd.readthedocs.io/en/stable/user-guide/build-environment/
carvel-dev/kapp-controller#781
https://hackmd.io/6FQhzRIPR_uceqtTqSIXaA
https://carvel.dev/kapp-controller/docs/v0.39.0/app-spec/
The text was updated successfully, but these errors were encountered: