diff --git a/hack/validation/labels.sh b/hack/validation/labels.sh index bf1a526e7..ef971c3f5 100755 --- a/hack/validation/labels.sh +++ b/hack/validation/labels.sh @@ -29,6 +29,9 @@ rule=${rule//\"/\\\"} # escape double quotes rule=${rule//$'\n'/} # remove newlines rule=$(echo "$rule" | tr -s ' ') # remove extra spaces +# check that .spec.versions has 2 entries +[[ $(yq e '.spec.versions | length' pkg/apis/crds/karpenter.sh_nodepools.yaml) -eq 2 ]] || { echo "expected two versions"; exit 1; } + # nodepool # v1beta1 printf -v expr '.spec.versions[1].schema.openAPIV3Schema.properties.spec.properties.template.properties.metadata.properties.labels.x-kubernetes-validations += diff --git a/hack/validation/requirements.sh b/hack/validation/requirements.sh index 8bfec794d..93cbd5530 100755 --- a/hack/validation/requirements.sh +++ b/hack/validation/requirements.sh @@ -28,6 +28,10 @@ rule=${rule//\"/\\\"} # escape double quotes rule=${rule//$'\n'/} # remove newlines rule=$(echo "$rule" | tr -s ' ') # remove extra spaces +# check that .spec.versions has 2 entries +[[ $(yq e '.spec.versions | length' pkg/apis/crds/karpenter.sh_nodepools.yaml) -eq 2 ]] || { echo "expected two versions"; exit 1; } +[[ $(yq e '.spec.versions | length' pkg/apis/crds/karpenter.sh_nodeclaims.yaml) -eq 2 ]] || { echo "expected two versions"; exit 1; } + # v1beta1 # nodeclaim printf -v expr '.spec.versions[1].schema.openAPIV3Schema.properties.spec.properties.requirements.items.properties.key.x-kubernetes-validations +=