diff --git a/pkg/api/admin/openshiftcluster.go b/pkg/api/admin/openshiftcluster.go index de790d76968..ed328772e43 100644 --- a/pkg/api/admin/openshiftcluster.go +++ b/pkg/api/admin/openshiftcluster.go @@ -422,7 +422,7 @@ type PlatformWorkloadIdentityProfile struct { PlatformWorkloadIdentities []PlatformWorkloadIdentity `json:"platformWorkloadIdentities,omitempty"` } -// UpgradeableTo stores a single OpenShift version a workload idetntiy cluster can be upgraded to +// UpgradeableTo stores a single OpenShift version a workload identity cluster can be upgraded to type UpgradeableTo string // PlatformWorkloadIdentity stores information representing a single workload identity. diff --git a/pkg/api/openshiftcluster.go b/pkg/api/openshiftcluster.go index f4efa59c51f..e0517ad1090 100644 --- a/pkg/api/openshiftcluster.go +++ b/pkg/api/openshiftcluster.go @@ -777,7 +777,7 @@ type PlatformWorkloadIdentityProfile struct { PlatformWorkloadIdentities []PlatformWorkloadIdentity `json:"platformWorkloadIdentities,omitempty"` } -// UpgradeableTo stores a single OpenShift version a workload idetntiy cluster can be upgraded to +// UpgradeableTo stores a single OpenShift version a workload identity cluster can be upgraded to type UpgradeableTo string // PlatformWorkloadIdentity stores information representing a single workload identity. diff --git a/pkg/api/v20240812preview/openshiftcluster.go b/pkg/api/v20240812preview/openshiftcluster.go index ae89d745e27..28e7d4bd171 100644 --- a/pkg/api/v20240812preview/openshiftcluster.go +++ b/pkg/api/v20240812preview/openshiftcluster.go @@ -294,7 +294,7 @@ type PlatformWorkloadIdentityProfile struct { PlatformWorkloadIdentities []PlatformWorkloadIdentity `json:"platformWorkloadIdentities,omitempty" mutable:"true"` } -// UpgradeableTo stores a single OpenShift version a workload idetntiy cluster can be upgraded to +// UpgradeableTo stores a single OpenShift version a workload identity cluster can be upgraded to type UpgradeableTo string // PlatformWorkloadIdentity stores information representing a single workload identity. diff --git a/pkg/api/v20240812preview/openshiftcluster_validatestatic.go b/pkg/api/v20240812preview/openshiftcluster_validatestatic.go index 7de4109b0e7..b5011fdd210 100644 --- a/pkg/api/v20240812preview/openshiftcluster_validatestatic.go +++ b/pkg/api/v20240812preview/openshiftcluster_validatestatic.go @@ -8,11 +8,11 @@ import ( "net" "net/http" "net/url" - "regexp" "strings" azcorearm "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/go-autorest/autorest/azure" + "github.com/coreos/go-semver/semver" "github.com/Azure/ARO-RP/pkg/api" "github.com/Azure/ARO-RP/pkg/api/util/immutable" @@ -445,9 +445,9 @@ func (sv openShiftClusterStaticValidator) validatePlatformWorkloadIdentityProfil } if pwip.UpgradeableTo != nil { - matches, err := regexp.MatchString(`^4\.[0-9]{2}\.`, string(*pwip.UpgradeableTo)) - if !matches || err != nil { - return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, fmt.Sprintf("%s.UpgradeableTo[%v]", path, *pwip.UpgradeableTo), "UpgradeableTo must be a valid OpenShift version.") + _, err := semver.NewVersion(string(*pwip.UpgradeableTo)) + if err != nil { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, fmt.Sprintf("%s.UpgradeableTo[%v]", path, *pwip.UpgradeableTo), "UpgradeableTo must be a valid OpenShift version in the format 'x.y.z'.") } } diff --git a/pkg/api/v20240812preview/openshiftcluster_validatestatic_test.go b/pkg/api/v20240812preview/openshiftcluster_validatestatic_test.go index 3688e8e1f12..884df39ea8a 100644 --- a/pkg/api/v20240812preview/openshiftcluster_validatestatic_test.go +++ b/pkg/api/v20240812preview/openshiftcluster_validatestatic_test.go @@ -1164,7 +1164,7 @@ func TestOpenShiftClusterStaticValidateDelta(t *testing.T) { func TestOpenShiftClusterStaticValidatePlatformWorkloadIdentityProfile(t *testing.T) { validUpgradeableToValue := UpgradeableTo("4.14.29") - invalidUpgradeableToValue := UpgradeableTo("16.107.90") + invalidUpgradeableToValue := UpgradeableTo("16.107.invalid") createTests := []*validateTest{ { @@ -1345,7 +1345,7 @@ func TestOpenShiftClusterStaticValidatePlatformWorkloadIdentityProfile(t *testin UpgradeableTo: &invalidUpgradeableToValue, } }, - wantErr: `400: InvalidParameter: properties.platformWorkloadIdentityProfile.UpgradeableTo[16.107.90]: UpgradeableTo must be a valid OpenShift version.`, + wantErr: `400: InvalidParameter: properties.platformWorkloadIdentityProfile.UpgradeableTo[16.107.invalid]: UpgradeableTo must be a valid OpenShift version in the format 'x.y.z'.`, }, } diff --git a/python/client/azure/mgmt/redhatopenshift/v2024_08_12_preview/models/_models.py b/python/client/azure/mgmt/redhatopenshift/v2024_08_12_preview/models/_models.py index 3d6c4bfa60f..b7e1fab631d 100644 --- a/python/client/azure/mgmt/redhatopenshift/v2024_08_12_preview/models/_models.py +++ b/python/client/azure/mgmt/redhatopenshift/v2024_08_12_preview/models/_models.py @@ -1303,7 +1303,7 @@ def __init__( class PlatformWorkloadIdentityProfile(msrest.serialization.Model): """PlatformWorkloadIdentityProfile encapsulates all information that is specific to workload identity clusters. - :ivar upgradeable_to: UpgradeableTo stores a single OpenShift version a workload idetntiy + :ivar upgradeable_to: UpgradeableTo stores a single OpenShift version a workload identity cluster can be upgraded to. :vartype upgradeable_to: str :ivar platform_workload_identities: @@ -1321,7 +1321,7 @@ def __init__( **kwargs ): """ - :keyword upgradeable_to: UpgradeableTo stores a single OpenShift version a workload idetntiy + :keyword upgradeable_to: UpgradeableTo stores a single OpenShift version a workload identity cluster can be upgraded to. :paramtype upgradeable_to: str :keyword platform_workload_identities: diff --git a/python/client/azure/mgmt/redhatopenshift/v2024_08_12_preview/models/_models_py3.py b/python/client/azure/mgmt/redhatopenshift/v2024_08_12_preview/models/_models_py3.py index e38a84f2987..b8c2d9a1d1d 100644 --- a/python/client/azure/mgmt/redhatopenshift/v2024_08_12_preview/models/_models_py3.py +++ b/python/client/azure/mgmt/redhatopenshift/v2024_08_12_preview/models/_models_py3.py @@ -1412,7 +1412,7 @@ def __init__( class PlatformWorkloadIdentityProfile(msrest.serialization.Model): """PlatformWorkloadIdentityProfile encapsulates all information that is specific to workload identity clusters. - :ivar upgradeable_to: UpgradeableTo stores a single OpenShift version a workload idetntiy + :ivar upgradeable_to: UpgradeableTo stores a single OpenShift version a workload identity cluster can be upgraded to. :vartype upgradeable_to: str :ivar platform_workload_identities: @@ -1433,7 +1433,7 @@ def __init__( **kwargs ): """ - :keyword upgradeable_to: UpgradeableTo stores a single OpenShift version a workload idetntiy + :keyword upgradeable_to: UpgradeableTo stores a single OpenShift version a workload identity cluster can be upgraded to. :paramtype upgradeable_to: str :keyword platform_workload_identities: diff --git a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/preview/2024-08-12-preview/redhatopenshift.json b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/preview/2024-08-12-preview/redhatopenshift.json index 482fba9cc5a..95e0131f58f 100644 --- a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/preview/2024-08-12-preview/redhatopenshift.json +++ b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/preview/2024-08-12-preview/redhatopenshift.json @@ -2607,7 +2607,7 @@ } }, "UpgradeableTo": { - "description": "UpgradeableTo stores a single OpenShift version a workload idetntiy cluster can be upgraded to", + "description": "UpgradeableTo stores a single OpenShift version a workload identity cluster can be upgraded to", "type": "string" }, "UserAssignedIdentities": {