Uploaded image for project: 'Red Hat Advanced Cluster Management'
  1. Red Hat Advanced Cluster Management
  2. ACM-15729

RFE - Allow checking if an object exists during template rendering

XMLWordPrintable

    • Icon: Story Story
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • None
    • SiteConfig Operator
    • 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
            ...

              Unassigned Unassigned
              mavazque@redhat.com Mario Vazquez Cebrian
              Sharat Akhoury Sharat Akhoury
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: