-
Story
-
Resolution: Unresolved
-
Undefined
-
None
-
None
-
None
As a user, I want to be able to check if a specific Kubernetes object exists during template rendering.
Example:
Let's say I have in my template an object like this:
apiVersion: hypershift.openshift.io/v1beta1 kind: NodePool metadata: name: "{{ .Site.ClusterName }}" namespace: clusters annotations: metaclusterinstall.openshift.io/sync-wave: "3" spec: ... config: - name: "{{ .Site.ClusterName }}-machineconfigs" management: autoRepair: true upgradeType: Replace ...
The .spec.config points to a ConfigMap that has some configurations, maybe that configmap does not exist for some clusters. Since this is a cluster template in order for the template to be as generic as possible it would be great to do something like this:
apiVersion: hypershift.openshift.io/v1beta1 kind: NodePool metadata: name: "{{ .Site.ClusterName }}" namespace: clusters annotations: metaclusterinstall.openshift.io/sync-wave: "3" spec: ... {{ if .ObjectExists.ConfigMap.<namespace>.<configmap-name> }} config: - name: "{{ .Site.ClusterName }}-machineconfigs" {{ endif }} management: autoRepair: true upgradeType: Replace ...