You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OCPBUGS-54566: Apply defaults then validate confidentialCompute
When confidentialCompute is not set to Disabled (or an empty value), the
value of onHostMaintenance has to be "Terminate". Also, a supported
machine instance type hast to be set.
This validation occurred previously in ValidateMachinePool in
pkg/types/gcp/validation/machinepool.go. This validation is applied
separately onto defaultMachinePlatform, compute and controlPlane
configurations in the install-config file. This makes it appropriate to
validate single values of some of the configuration parameters. However,
it's not the best choice when it comes to validating parameter
combinations, as in the case of confidentialCompute. This is due to
compute and controlPlane configs "inheriting" the defaults set in
defaultMachinePlatform.
This lead to the validation raising some false errors on properly
configured install-config files.
To avoid the issue, this patch moves the validation from the previous
location into pkg/asset/installconfig/gcp/validation.go, where
validations take the default value inheritance into account. It also
removes the unit tests from pkg/types/gcp/validation/machinepool_test.go
and implements them into pkg/asset/installconfig/gcp/validation_test.go.
allErrs=append(allErrs, field.Invalid(fldPath.Child("onHostMaintenance"), onHostMaintenance, fmt.Sprintf("onHostMaintenace must be set to Terminate when confidentialCompute is %s", confidentialCompute)))
allErrs=append(allErrs, field.Invalid(fldPath.Child("type"), instanceType, fmt.Sprintf("Machine type do not support %s. Machine types supporting %s: %s", confidentialCompute, confidentialCompute, strings.Join(supportedMachineTypes, ", "))))
134
+
}
135
+
136
+
returnallErrs
137
+
}
138
+
113
139
// ValidateInstanceType ensures the instance type has sufficient Vcpu and Memory.
0 commit comments