Skip to content

Commit 04af9f7

Browse files
committed
Fix precondition guards and use dynamic nodepool spec values
Add has() guards to clusterNotReady/nodepoolNotReady precondition expressions so fresh resources without status.conditions fall back to true instead of erroring. Replace hardcoded NodePool spec values in adapter-task-config with index .nodepoolSpec lookups matching the pattern in nodepool-manifest.yaml.
1 parent af065ee commit 04af9f7

2 files changed

Lines changed: 18 additions & 14 deletions

File tree

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

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,11 @@ preconditions:
6565
field: "spec"
6666
- name: "nodepoolNotReady"
6767
expression: |
68-
status.conditions.filter(c, c.type == "Ready").size() > 0
69-
? status.conditions.filter(c, c.type == "Ready")[0].status != "True"
70-
: true
68+
!has(status) || !has(status.conditions)
69+
? true
70+
: (status.conditions.filter(c, c.type == "Ready").size() > 0
71+
? status.conditions.filter(c, c.type == "Ready")[0].status != "True"
72+
: true)
7173
7274
# Fetch parent cluster details (need the cluster name for clusterName ref)
7375
- name: "clusterDetails"
@@ -118,22 +120,22 @@ resources:
118120
hyperfleet.io/nodepool-name: "{{ .nodepoolName }}"
119121
spec:
120122
clusterName: "{{ .clusterName }}"
121-
replicas: 2
123+
replicas: {{ index .nodepoolSpec "replicas" | default 2 }}
122124
management:
123125
autoRepair: true
124126
upgradeType: Replace
125127
platform:
126128
type: OCI
127129
oci:
128-
instanceShape: "{{ .ociShape }}"
130+
instanceShape: "{{ index .nodepoolSpec "instanceShape" | default .ociShape }}"
129131
instanceShapeConfig:
130-
ocpus: 4
131-
memoryInGBs: 16
132-
availabilityDomain: "{{ .ociAD }}"
133-
subnetId: "{{ .ociSubnetId }}"
134-
bootVolumeSize: 120
132+
ocpus: {{ index .nodepoolSpec "ocpus" | default .ociOcpus }}
133+
memoryInGBs: {{ index .nodepoolSpec "memoryInGBs" | default .ociMemoryGBs }}
134+
availabilityDomain: "{{ index .nodepoolSpec "availabilityDomain" | default .ociAD }}"
135+
subnetId: "{{ index .nodepoolSpec "subnetId" | default .ociSubnetId }}"
136+
bootVolumeSize: {{ index .nodepoolSpec "bootVolumeSize" | default .ociBootVolumeGB }}
135137
release:
136-
image: "quay.io/openshift-release-dev/ocp-release:4.20.2-x86_64"
138+
image: "{{ index .nodepoolSpec "releaseImage" | default "quay.io/openshift-release-dev/ocp-release:4.20.2-x86_64" }}"
137139
discovery:
138140
namespace: "{{ .namespace }}"
139141
by_selectors:

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,11 @@ preconditions:
5353
field: "generation"
5454
- name: "clusterNotReady"
5555
expression: |
56-
status.conditions.filter(c, c.type == "Ready").size() > 0
57-
? status.conditions.filter(c, c.type == "Ready")[0].status != "True"
58-
: true
56+
!has(status) || !has(status.conditions)
57+
? true
58+
: (status.conditions.filter(c, c.type == "Ready").size() > 0
59+
? status.conditions.filter(c, c.type == "Ready")[0].status != "True"
60+
: true)
5961
6062
- name: "validationCheck"
6163
expression: |

0 commit comments

Comments
 (0)