Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add worker profile status #3053

Merged
merged 17 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .sha256sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
1d167031baf0209fe8c46df9654585c64e8cc9a0c89555d7479c4ed6dc150251 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-09-04/redhatopenshift.json
622404e8311c62f27fba778e30e760bb1901e5bd221b23de72f449cafbdf0c45 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-04-01/redhatopenshift.json
3aede70b183bad612c23cb776fe5a932c5709334e1fe1ad7ff8772b58be3661f swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/preview/2023-07-01-preview/redhatopenshift.json
0c2bfc4b4308ff10d3cdd1c66c1356ba4153342ce536d478bcbb515fa1fe5958 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-09-04/redhatopenshift.json
3127f0a6acebf9ce09623df69dbd88824384b58967fe36c19acf2e2cf34c46b2 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-09-04/redhatopenshift.json
57 changes: 30 additions & 27 deletions pkg/api/admin/openshiftcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,33 +28,36 @@ type OpenShiftCluster struct {

// OpenShiftClusterProperties represents an OpenShift cluster's properties.
type OpenShiftClusterProperties struct {
ArchitectureVersion ArchitectureVersion `json:"architectureVersion"` // ArchitectureVersion is int so 0 is valid value to be returned
ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
LastProvisioningState ProvisioningState `json:"lastProvisioningState,omitempty"`
FailedProvisioningState ProvisioningState `json:"failedProvisioningState,omitempty"`
LastAdminUpdateError string `json:"lastAdminUpdateError,omitempty"`
MaintenanceTask MaintenanceTask `json:"maintenanceTask,omitempty" mutable:"true"`
OperatorFlags OperatorFlags `json:"operatorFlags,omitempty" mutable:"true"`
OperatorVersion string `json:"operatorVersion,omitempty" mutable:"true"`
CreatedAt time.Time `json:"createdAt,omitempty"`
CreatedBy string `json:"createdBy,omitempty"`
ProvisionedBy string `json:"provisionedBy,omitempty"`
ClusterProfile ClusterProfile `json:"clusterProfile,omitempty"`
FeatureProfile FeatureProfile `json:"featureProfile,omitempty"`
ConsoleProfile ConsoleProfile `json:"consoleProfile,omitempty"`
ServicePrincipalProfile ServicePrincipalProfile `json:"servicePrincipalProfile,omitempty"`
NetworkProfile NetworkProfile `json:"networkProfile,omitempty"`
MasterProfile MasterProfile `json:"masterProfile,omitempty"`
WorkerProfiles []WorkerProfile `json:"workerProfiles,omitempty"`
APIServerProfile APIServerProfile `json:"apiserverProfile,omitempty"`
IngressProfiles []IngressProfile `json:"ingressProfiles,omitempty"`
Install *Install `json:"install,omitempty"`
StorageSuffix string `json:"storageSuffix,omitempty"`
RegistryProfiles []RegistryProfile `json:"registryProfiles,omitempty"`
ImageRegistryStorageAccountName string `json:"imageRegistryStorageAccountName,omitempty"`
InfraID string `json:"infraId,omitempty"`
HiveProfile HiveProfile `json:"hiveProfile,omitempty"`
PucmPending bool `json:"pucmPending,omitempty"`
ArchitectureVersion ArchitectureVersion `json:"architectureVersion"` // ArchitectureVersion is int so 0 is valid value to be returned
ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
LastProvisioningState ProvisioningState `json:"lastProvisioningState,omitempty"`
FailedProvisioningState ProvisioningState `json:"failedProvisioningState,omitempty"`
LastAdminUpdateError string `json:"lastAdminUpdateError,omitempty"`
MaintenanceTask MaintenanceTask `json:"maintenanceTask,omitempty" mutable:"true"`
OperatorFlags OperatorFlags `json:"operatorFlags,omitempty" mutable:"true"`
OperatorVersion string `json:"operatorVersion,omitempty" mutable:"true"`
CreatedAt time.Time `json:"createdAt,omitempty"`
CreatedBy string `json:"createdBy,omitempty"`
ProvisionedBy string `json:"provisionedBy,omitempty"`
ClusterProfile ClusterProfile `json:"clusterProfile,omitempty"`
FeatureProfile FeatureProfile `json:"featureProfile,omitempty"`
ConsoleProfile ConsoleProfile `json:"consoleProfile,omitempty"`
ServicePrincipalProfile ServicePrincipalProfile `json:"servicePrincipalProfile,omitempty"`
NetworkProfile NetworkProfile `json:"networkProfile,omitempty"`
MasterProfile MasterProfile `json:"masterProfile,omitempty"`
// WorkerProfiles is used to store the worker profile data that was sent in the api request
WorkerProfiles []WorkerProfile `json:"workerProfiles,omitempty"`
// WorkerProfilesStatus is used to store the enriched worker profile data
WorkerProfilesStatus []WorkerProfile `json:"workerProfilesStatus,omitempty"`
APIServerProfile APIServerProfile `json:"apiserverProfile,omitempty"`
IngressProfiles []IngressProfile `json:"ingressProfiles,omitempty"`
Install *Install `json:"install,omitempty"`
StorageSuffix string `json:"storageSuffix,omitempty"`
RegistryProfiles []RegistryProfile `json:"registryProfiles,omitempty"`
ImageRegistryStorageAccountName string `json:"imageRegistryStorageAccountName,omitempty"`
InfraID string `json:"infraId,omitempty"`
HiveProfile HiveProfile `json:"hiveProfile,omitempty"`
PucmPending bool `json:"pucmPending,omitempty"`
}

// ProvisioningState represents a provisioning state.
Expand Down
29 changes: 29 additions & 0 deletions pkg/api/admin/openshiftcluster_convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,21 @@ func (c openShiftClusterConverter) ToExternal(oc *api.OpenShiftCluster) interfac
}
}

if oc.Properties.WorkerProfilesStatus != nil {
out.Properties.WorkerProfilesStatus = make([]WorkerProfile, 0, len(oc.Properties.WorkerProfilesStatus))
for _, p := range oc.Properties.WorkerProfilesStatus {
out.Properties.WorkerProfilesStatus = append(out.Properties.WorkerProfilesStatus, WorkerProfile{
Name: p.Name,
VMSize: VMSize(p.VMSize),
DiskSizeGB: p.DiskSizeGB,
SubnetID: p.SubnetID,
Count: p.Count,
EncryptionAtHost: EncryptionAtHost(p.EncryptionAtHost),
DiskEncryptionSetID: p.DiskEncryptionSetID,
})
}
}

if oc.Properties.IngressProfiles != nil {
out.Properties.IngressProfiles = make([]IngressProfile, 0, len(oc.Properties.IngressProfiles))
for _, p := range oc.Properties.IngressProfiles {
Expand Down Expand Up @@ -285,6 +300,20 @@ func (c openShiftClusterConverter) ToInternal(_oc interface{}, out *api.OpenShif
out.Properties.WorkerProfiles[i].DiskEncryptionSetID = oc.Properties.WorkerProfiles[i].DiskEncryptionSetID
}
}
if oc.Properties.WorkerProfilesStatus != nil {
out.Properties.WorkerProfilesStatus = make([]api.WorkerProfile, len(oc.Properties.WorkerProfilesStatus))
for _, p := range oc.Properties.WorkerProfilesStatus {
out.Properties.WorkerProfilesStatus = append(out.Properties.WorkerProfilesStatus, api.WorkerProfile{
Name: p.Name,
VMSize: api.VMSize(p.VMSize),
DiskSizeGB: p.DiskSizeGB,
SubnetID: p.SubnetID,
Count: p.Count,
EncryptionAtHost: api.EncryptionAtHost(p.EncryptionAtHost),
DiskEncryptionSetID: p.DiskEncryptionSetID,
})
}
}
out.Properties.APIServerProfile.Visibility = api.Visibility(oc.Properties.APIServerProfile.Visibility)
out.Properties.APIServerProfile.URL = oc.Properties.APIServerProfile.URL
out.Properties.APIServerProfile.IP = oc.Properties.APIServerProfile.IP
Expand Down
6 changes: 6 additions & 0 deletions pkg/api/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ func SetDefaults(doc *OpenShiftClusterDocument) {
}
}

for i, wp := range doc.OpenShiftCluster.Properties.WorkerProfilesStatus {
if wp.EncryptionAtHost == "" {
doc.OpenShiftCluster.Properties.WorkerProfilesStatus[i].EncryptionAtHost = EncryptionAtHostDisabled
}
}

if doc.OpenShiftCluster.Properties.ClusterProfile.FipsValidatedModules == "" {
doc.OpenShiftCluster.Properties.ClusterProfile.FipsValidatedModules = FipsValidatedModulesDisabled
}
Expand Down
5 changes: 5 additions & 0 deletions pkg/api/defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ func validOpenShiftClusterDocument() *OpenShiftClusterDocument {
EncryptionAtHost: EncryptionAtHostDisabled,
},
},
WorkerProfilesStatus: []WorkerProfile{
{
EncryptionAtHost: EncryptionAtHostDisabled,
},
},
ClusterProfile: ClusterProfile{
FipsValidatedModules: FipsValidatedModulesDisabled,
},
Expand Down
13 changes: 13 additions & 0 deletions pkg/api/openshiftcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,12 @@ type OpenShiftClusterProperties struct {

MasterProfile MasterProfile `json:"masterProfile,omitempty"`

// WorkerProfiles is used to store the worker profile data that was sent in the api request
WorkerProfiles []WorkerProfile `json:"workerProfiles,omitempty"`

// WorkerProfilesStatus is used to store the enriched worker profile data
WorkerProfilesStatus []WorkerProfile `json:"workerProfilesStatus,omitempty"`

APIServerProfile APIServerProfile `json:"apiserverProfile,omitempty"`

IngressProfiles []IngressProfile `json:"ingressProfiles,omitempty"`
Expand Down Expand Up @@ -632,6 +636,15 @@ type WorkerProfile struct {
DiskEncryptionSetID string `json:"diskEncryptionSetId,omitempty"`
}

// GetEnrichedWorkerProfiles returns WorkerProfilesStatus if not nil, otherwise WorkerProfiles
// with their respective json property name
func GetEnrichedWorkerProfiles(ocp OpenShiftClusterProperties) ([]WorkerProfile, string) {
if ocp.WorkerProfilesStatus != nil {
return ocp.WorkerProfilesStatus, "workerProfilesStatus"
}
return ocp.WorkerProfiles, "workerProfiles"
}

// APIServerProfile represents an API server profile
type APIServerProfile struct {
MissingFields
Expand Down
23 changes: 23 additions & 0 deletions pkg/api/openshiftclusterdocument_example.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,29 @@ func ExampleOpenShiftClusterDocument() *OpenShiftClusterDocument {
Count: 3,
},
},
WorkerProfilesStatus: []WorkerProfile{
{
Name: "worker1",
VMSize: VMSizeStandardD2sV3,
DiskSizeGB: 128,
SubnetID: "/subscriptions/subscriptionId/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/worker",
Count: 1,
},
{
Name: "worker2",
VMSize: VMSizeStandardD2sV3,
DiskSizeGB: 128,
SubnetID: "/subscriptions/subscriptionId/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/worker",
Count: 1,
},
{
Name: "worker3",
VMSize: VMSizeStandardD2sV3,
DiskSizeGB: 128,
SubnetID: "/subscriptions/subscriptionId/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/worker",
Count: 1,
},
},
APIServerProfile: APIServerProfile{
Visibility: VisibilityPublic,
URL: "https://api.cluster.location.aroapp.io:6443/",
Expand Down
4 changes: 3 additions & 1 deletion pkg/api/util/subnet/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ func NetworkSecurityGroupID(oc *api.OpenShiftCluster, subnetID string) (string,
infraID = "aro"
}
isWorkerSubnet := false
for _, s := range oc.Properties.WorkerProfiles {
workerProfiles, _ := api.GetEnrichedWorkerProfiles(oc.Properties)

for _, s := range workerProfiles {
if strings.EqualFold(subnetID, s.SubnetID) {
isWorkerSubnet = true
break
Expand Down
17 changes: 17 additions & 0 deletions pkg/api/util/subnet/subnet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func TestNetworkSecurityGroupID(t *testing.T) {
infraID string
archVersion api.ArchitectureVersion
subnetID string
wpStatus bool
wantNSGID string
wantErr string
}{
Expand Down Expand Up @@ -64,11 +65,27 @@ func TestNetworkSecurityGroupID(t *testing.T) {
archVersion: api.ArchitectureVersion(42),
wantErr: `unknown architecture version 42`,
},
{
name: "worker arch v2 to use enriched worker Profile",
infraID: "test-1234",
archVersion: api.ArchitectureVersionV2,
wpStatus: true,
subnetID: "/subscriptions/subscriptionId/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/Enrichedworker",
wantNSGID: "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup/providers/Microsoft.Network/networkSecurityGroups/test-1234-nsg",
},
} {
t.Run(tt.name, func(t *testing.T) {
oc.Properties.InfraID = tt.infraID
oc.Properties.ArchitectureVersion = tt.archVersion

if tt.wpStatus {
oc.Properties.WorkerProfilesStatus = []api.WorkerProfile{
{
SubnetID: "/subscriptions/subscriptionId/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/Enrichedworker",
},
}
}

nsgID, err := NetworkSecurityGroupID(oc, tt.subnetID)
utilerror.AssertErrorMessage(t, err, tt.wantErr)

Expand Down
11 changes: 9 additions & 2 deletions pkg/api/v20191231preview/openshiftcluster_convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,15 @@ func (c openShiftClusterConverter) ToExternal(oc *api.OpenShiftCluster) interfac
}

if oc.Properties.WorkerProfiles != nil {
out.Properties.WorkerProfiles = make([]WorkerProfile, 0, len(oc.Properties.WorkerProfiles))
for _, p := range oc.Properties.WorkerProfiles {
workerProfiles := oc.Properties.WorkerProfiles

// Use enriched worker profile data when available
if oc.Properties.WorkerProfilesStatus != nil {
workerProfiles = oc.Properties.WorkerProfilesStatus
}

out.Properties.WorkerProfiles = make([]WorkerProfile, 0, len(workerProfiles))
for _, p := range workerProfiles {
out.Properties.WorkerProfiles = append(out.Properties.WorkerProfiles, WorkerProfile{
Name: p.Name,
VMSize: VMSize(p.VMSize),
Expand Down
1 change: 1 addition & 0 deletions pkg/api/v20191231preview/openshiftcluster_example.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

func exampleOpenShiftCluster() *OpenShiftCluster {
doc := api.ExampleOpenShiftClusterDocument()
doc.OpenShiftCluster.Properties.WorkerProfilesStatus = nil
return (&openShiftClusterConverter{}).ToExternal(doc.OpenShiftCluster).(*OpenShiftCluster)
}

Expand Down
11 changes: 9 additions & 2 deletions pkg/api/v20200430/openshiftcluster_convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,15 @@ func (c openShiftClusterConverter) ToExternal(oc *api.OpenShiftCluster) interfac
}

if oc.Properties.WorkerProfiles != nil {
out.Properties.WorkerProfiles = make([]WorkerProfile, 0, len(oc.Properties.WorkerProfiles))
for _, p := range oc.Properties.WorkerProfiles {
workerProfiles := oc.Properties.WorkerProfiles

// Use enriched worker profile data when available
if oc.Properties.WorkerProfilesStatus != nil {
workerProfiles = oc.Properties.WorkerProfilesStatus
}

out.Properties.WorkerProfiles = make([]WorkerProfile, 0, len(workerProfiles))
for _, p := range workerProfiles {
Comment on lines +54 to +62
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this generate new examples for the older API?

Copy link
Contributor Author

@gouthamMN gouthamMN Jul 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, because under openshiftcluster_example.go package we set the WorkerProfilesStatus field to nil before calling the converter function (ToExternal). This will ensure that the swagger examples remain unchanged.

Older APIs swagger examples never showed the enriched worker profile data under workerProfiles field. So I decided to keep it same.

out.Properties.WorkerProfiles = append(out.Properties.WorkerProfiles, WorkerProfile{
Name: p.Name,
VMSize: VMSize(p.VMSize),
Expand Down
1 change: 1 addition & 0 deletions pkg/api/v20200430/openshiftcluster_example.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

func exampleOpenShiftCluster() *OpenShiftCluster {
doc := api.ExampleOpenShiftClusterDocument()
doc.OpenShiftCluster.Properties.WorkerProfilesStatus = nil
return (&openShiftClusterConverter{}).ToExternal(doc.OpenShiftCluster).(*OpenShiftCluster)
}

Expand Down
11 changes: 9 additions & 2 deletions pkg/api/v20210901preview/openshiftcluster_convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,15 @@ func (c openShiftClusterConverter) ToExternal(oc *api.OpenShiftCluster) interfac
}

if oc.Properties.WorkerProfiles != nil {
out.Properties.WorkerProfiles = make([]WorkerProfile, 0, len(oc.Properties.WorkerProfiles))
for _, p := range oc.Properties.WorkerProfiles {
workerProfiles := oc.Properties.WorkerProfiles

// Use enriched worker profile data when available
if oc.Properties.WorkerProfilesStatus != nil {
workerProfiles = oc.Properties.WorkerProfilesStatus
}

out.Properties.WorkerProfiles = make([]WorkerProfile, 0, len(workerProfiles))
for _, p := range workerProfiles {
out.Properties.WorkerProfiles = append(out.Properties.WorkerProfiles, WorkerProfile{
Name: p.Name,
VMSize: VMSize(p.VMSize),
Expand Down
1 change: 1 addition & 0 deletions pkg/api/v20210901preview/openshiftcluster_example.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

func exampleOpenShiftCluster() *OpenShiftCluster {
doc := api.ExampleOpenShiftClusterDocument()
doc.OpenShiftCluster.Properties.WorkerProfilesStatus = nil
return (&openShiftClusterConverter{}).ToExternal(doc.OpenShiftCluster).(*OpenShiftCluster)
}

Expand Down
11 changes: 9 additions & 2 deletions pkg/api/v20220401/openshiftcluster_convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,15 @@ func (c openShiftClusterConverter) ToExternal(oc *api.OpenShiftCluster) interfac
}

if oc.Properties.WorkerProfiles != nil {
out.Properties.WorkerProfiles = make([]WorkerProfile, 0, len(oc.Properties.WorkerProfiles))
for _, p := range oc.Properties.WorkerProfiles {
workerProfiles := oc.Properties.WorkerProfiles

// Use enriched worker profile data when available
if oc.Properties.WorkerProfilesStatus != nil {
workerProfiles = oc.Properties.WorkerProfilesStatus
}

out.Properties.WorkerProfiles = make([]WorkerProfile, 0, len(workerProfiles))
for _, p := range workerProfiles {
out.Properties.WorkerProfiles = append(out.Properties.WorkerProfiles, WorkerProfile{
Name: p.Name,
VMSize: VMSize(p.VMSize),
Expand Down
1 change: 1 addition & 0 deletions pkg/api/v20220401/openshiftcluster_example.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

func exampleOpenShiftCluster() *OpenShiftCluster {
doc := api.ExampleOpenShiftClusterDocument()
doc.OpenShiftCluster.Properties.WorkerProfilesStatus = nil
return (&openShiftClusterConverter{}).ToExternal(doc.OpenShiftCluster).(*OpenShiftCluster)
}

Expand Down
11 changes: 9 additions & 2 deletions pkg/api/v20220904/openshiftcluster_convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,15 @@ func (c openShiftClusterConverter) ToExternal(oc *api.OpenShiftCluster) interfac
}

if oc.Properties.WorkerProfiles != nil {
out.Properties.WorkerProfiles = make([]WorkerProfile, 0, len(oc.Properties.WorkerProfiles))
for _, p := range oc.Properties.WorkerProfiles {
workerProfiles := oc.Properties.WorkerProfiles

// Use enriched worker profile data when available
if oc.Properties.WorkerProfilesStatus != nil {
workerProfiles = oc.Properties.WorkerProfilesStatus
}

out.Properties.WorkerProfiles = make([]WorkerProfile, 0, len(workerProfiles))
for _, p := range workerProfiles {
out.Properties.WorkerProfiles = append(out.Properties.WorkerProfiles, WorkerProfile{
Name: p.Name,
VMSize: VMSize(p.VMSize),
Expand Down
1 change: 1 addition & 0 deletions pkg/api/v20220904/openshiftcluster_example.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

func exampleOpenShiftCluster() *OpenShiftCluster {
doc := api.ExampleOpenShiftClusterDocument()
doc.OpenShiftCluster.Properties.WorkerProfilesStatus = nil
return (&openShiftClusterConverter{}).ToExternal(doc.OpenShiftCluster).(*OpenShiftCluster)
}

Expand Down
11 changes: 9 additions & 2 deletions pkg/api/v20230401/openshiftcluster_convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,15 @@ func (c openShiftClusterConverter) ToExternal(oc *api.OpenShiftCluster) interfac
}

if oc.Properties.WorkerProfiles != nil {
out.Properties.WorkerProfiles = make([]WorkerProfile, 0, len(oc.Properties.WorkerProfiles))
for _, p := range oc.Properties.WorkerProfiles {
workerProfiles := oc.Properties.WorkerProfiles

// Use enriched worker profile data when available
if oc.Properties.WorkerProfilesStatus != nil {
workerProfiles = oc.Properties.WorkerProfilesStatus
}

out.Properties.WorkerProfiles = make([]WorkerProfile, 0, len(workerProfiles))
for _, p := range workerProfiles {
out.Properties.WorkerProfiles = append(out.Properties.WorkerProfiles, WorkerProfile{
Name: p.Name,
VMSize: VMSize(p.VMSize),
Expand Down
1 change: 1 addition & 0 deletions pkg/api/v20230401/openshiftcluster_example.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

func exampleOpenShiftCluster() *OpenShiftCluster {
doc := api.ExampleOpenShiftClusterDocument()
doc.OpenShiftCluster.Properties.WorkerProfilesStatus = nil
return (&openShiftClusterConverter{}).ToExternal(doc.OpenShiftCluster).(*OpenShiftCluster)
}

Expand Down
Loading
Loading