Skip to content

Commit f2d847c

Browse files
committed
Guard clusterAvailable conditions and fix YAML quoting in nodepool adapter
Add has() guard to clusterAvailable expression so missing conditions field returns false instead of erroring. Switch outer double quotes to single quotes on nodepoolSpec index expressions to avoid nested quote YAML parsing errors.
1 parent 04af9f7 commit f2d847c

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

helm/adapter-hypershift-nodepool/adapter-task-config.yaml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,13 @@ preconditions:
9494
capture:
9595
- name: "clusterAvailable"
9696
expression: |
97-
items.filter(s, s.adapter == "adapter-hypershift").size() > 0 ? (items.filter(s, s.adapter == "adapter-hypershift")[0].conditions.filter(c, c.type == "Available").size() > 0 ? items.filter(s, s.adapter == "adapter-hypershift")[0].conditions.filter(c, c.type == "Available")[0].status == "True" : false) : false
97+
items.filter(s, s.adapter == "adapter-hypershift").size() > 0
98+
? (has(items.filter(s, s.adapter == "adapter-hypershift")[0].conditions)
99+
? (items.filter(s, s.adapter == "adapter-hypershift")[0].conditions.filter(c, c.type == "Available").size() > 0
100+
? items.filter(s, s.adapter == "adapter-hypershift")[0].conditions.filter(c, c.type == "Available")[0].status == "True"
101+
: false)
102+
: false)
103+
: false
98104
99105
- name: "validationCheck"
100106
# Only proceed if nodepool is NOT Ready AND HostedCluster adapter reports Available
@@ -127,15 +133,15 @@ resources:
127133
platform:
128134
type: OCI
129135
oci:
130-
instanceShape: "{{ index .nodepoolSpec "instanceShape" | default .ociShape }}"
136+
instanceShape: '{{ index .nodepoolSpec "instanceShape" | default .ociShape }}'
131137
instanceShapeConfig:
132138
ocpus: {{ index .nodepoolSpec "ocpus" | default .ociOcpus }}
133139
memoryInGBs: {{ index .nodepoolSpec "memoryInGBs" | default .ociMemoryGBs }}
134-
availabilityDomain: "{{ index .nodepoolSpec "availabilityDomain" | default .ociAD }}"
135-
subnetId: "{{ index .nodepoolSpec "subnetId" | default .ociSubnetId }}"
140+
availabilityDomain: '{{ index .nodepoolSpec "availabilityDomain" | default .ociAD }}'
141+
subnetId: '{{ index .nodepoolSpec "subnetId" | default .ociSubnetId }}'
136142
bootVolumeSize: {{ index .nodepoolSpec "bootVolumeSize" | default .ociBootVolumeGB }}
137143
release:
138-
image: "{{ index .nodepoolSpec "releaseImage" | default "quay.io/openshift-release-dev/ocp-release:4.20.2-x86_64" }}"
144+
image: '{{ index .nodepoolSpec "releaseImage" | default "quay.io/openshift-release-dev/ocp-release:4.20.2-x86_64" }}'
139145
discovery:
140146
namespace: "{{ .namespace }}"
141147
by_selectors:

0 commit comments

Comments
 (0)