Skip to content

Commit

Permalink
populate name and type for new openshift rolesets and versions
Browse files Browse the repository at this point in the history
  • Loading branch information
rajdeepc2792 authored and cadenmarchese committed Jan 3, 2025
1 parent 712f07d commit aa21f59
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 4 deletions.
2 changes: 2 additions & 0 deletions cmd/aro/update_ocp_versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ func appendOpenShiftVersions(ocpVersions []api.OpenShiftVersion, installStreams
Enabled: true,
Default: isDefault,
},
Name: fullVersion,
Type: api.OpenShiftVersionsType,
})
}

Expand Down
2 changes: 2 additions & 0 deletions cmd/aro/update_role_sets.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ func updatePlatformWorkloadIdentityRoleSetsInCosmosDB(ctx context.Context, dbPla
ID: dbPlatformWorkloadIdentityRoleSets.NewUUID(),
PlatformWorkloadIdentityRoleSet: &api.PlatformWorkloadIdentityRoleSet{
Properties: doc,
Name: doc.OpenShiftVersion,
Type: api.PlatformWorkloadIdentityRoleSetsType,
},
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/api/admin/openshiftversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ type OpenShiftVersion struct {
// Name of the resource.
Name string `json:"name,omitempty"`

// The resource type.
Type string `json:"type,omitempty" mutable:"case"`

// The properties for the OpenShiftVersion resource.
Properties OpenShiftVersionProperties `json:"properties,omitempty"`
}
Expand Down
10 changes: 10 additions & 0 deletions pkg/api/admin/openshiftversion_convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ func (openShiftVersionConverter) ToExternal(v *api.OpenShiftVersion) interface{}
},
}

if out.Name != "" {
out.Name = v.Properties.Version
}

if out.Type != "" {
out.Type = api.OpenShiftVersionsType
}

return out
}

Expand Down Expand Up @@ -52,4 +60,6 @@ func (c openShiftVersionConverter) ToInternal(_new interface{}, out *api.OpenShi
out.Properties.InstallerPullspec = new.Properties.InstallerPullspec
out.Properties.OpenShiftPullspec = new.Properties.OpenShiftPullspec
out.Properties.Version = new.Properties.Version
out.Name = new.Properties.Version
out.Type = api.OpenShiftVersionsType
}
3 changes: 3 additions & 0 deletions pkg/api/admin/platformworkloadidentityroleset.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ type PlatformWorkloadIdentityRoleSet struct {
// Name of the resource.
Name string `json:"name,omitempty" mutable:"case"`

// The resource type.
Type string `json:"type,omitempty" mutable:"case"`

// The properties for the PlatformWorkloadIdentityRoleSet resource.
Properties PlatformWorkloadIdentityRoleSetProperties `json:"properties,omitempty"`
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/api/admin/platformworkloadidentityroleset_convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ func (c platformWorkloadIdentityRoleSetConverter) ToExternal(s *api.PlatformWork
OpenShiftVersion: s.Properties.OpenShiftVersion,
PlatformWorkloadIdentityRoles: make([]PlatformWorkloadIdentityRole, 0, len(s.Properties.PlatformWorkloadIdentityRoles)),
},
Name: s.Name,
Type: s.Type,
}

for _, r := range s.Properties.PlatformWorkloadIdentityRoles {
Expand Down Expand Up @@ -76,4 +78,6 @@ func (c platformWorkloadIdentityRoleSetConverter) ToInternal(_new interface{}, o

out.Properties.PlatformWorkloadIdentityRoles = append(out.Properties.PlatformWorkloadIdentityRoles, role)
}
out.Name = new.Properties.OpenShiftVersion
out.Type = api.PlatformWorkloadIdentityRoleSetsType
}
14 changes: 12 additions & 2 deletions pkg/api/v20240812preview/openshiftversion_convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,16 @@ func (openShiftVersionConverter) ToExternal(v *api.OpenShiftVersion) interface{}
Properties: OpenShiftVersionProperties{
Version: v.Properties.Version,
},
Name: v.Properties.Version,
Type: api.OpenShiftVersionsType,
Name: v.Name,
Type: v.Type,
}

if out.Name != "" {
out.Name = v.Properties.Version
}

if out.Type != "" {
out.Type = api.OpenShiftVersionsType
}

return out
Expand All @@ -49,4 +57,6 @@ func (c openShiftVersionConverter) ToExternalList(vers []*api.OpenShiftVersion)
func (c openShiftVersionConverter) ToInternal(_new interface{}, out *api.OpenShiftVersion) {
new := _new.(*OpenShiftVersion)
out.Properties.Version = new.Properties.Version
out.Name = new.Properties.Version
out.Type = api.OpenShiftVersionsType
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ func (c platformWorkloadIdentityRoleSetConverter) ToExternal(s *api.PlatformWork
OpenShiftVersion: s.Properties.OpenShiftVersion,
PlatformWorkloadIdentityRoles: make([]PlatformWorkloadIdentityRole, 0, len(s.Properties.PlatformWorkloadIdentityRoles)),
},
Name: s.Properties.OpenShiftVersion,
Type: api.PlatformWorkloadIdentityRoleSetsType,
Name: s.Name,
Type: s.Type,
}

for _, r := range s.Properties.PlatformWorkloadIdentityRoles {
Expand Down Expand Up @@ -70,4 +70,6 @@ func (c platformWorkloadIdentityRoleSetConverter) ToInternal(_new interface{}, o
}
out.Properties.PlatformWorkloadIdentityRoles = append(out.Properties.PlatformWorkloadIdentityRoles, role)
}
out.Name = new.Properties.OpenShiftVersion
out.Type = api.PlatformWorkloadIdentityRoleSetsType
}

0 comments on commit aa21f59

Please sign in to comment.