Skip to content

Commit

Permalink
Revert clusters_mgmt v2alpha1 to v1
Browse files Browse the repository at this point in the history
v2alpha1 was removed again in openshift-online/ocm-api-model#982

Signed-off-by: Michael Shen <[email protected]>
  • Loading branch information
mjlshen committed Sep 12, 2024
1 parent 1d5726b commit d87f638
Show file tree
Hide file tree
Showing 12 changed files with 99 additions and 105 deletions.
12 changes: 6 additions & 6 deletions frontend/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.14.0
github.com/google/go-cmp v0.6.0
github.com/google/uuid v1.6.0
github.com/openshift-online/ocm-sdk-go v0.1.439
github.com/openshift-online/ocm-sdk-go v0.1.441
github.com/prometheus/client_golang v1.20.3
github.com/spf13/cobra v1.8.1
golang.org/x/exp v0.0.0-20240707233637-46b078467d37
Expand All @@ -21,7 +21,7 @@ require github.com/klauspost/compress v1.17.9 // indirect
require (
github.com/Azure/azure-sdk-for-go v68.0.0+incompatible // indirect
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/data/azcosmos v1.0.3 // indirect
github.com/Azure/azure-sdk-for-go/sdk/data/azcosmos v1.1.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect
github.com/aymerick/douceur v0.2.0 // indirect
Expand Down Expand Up @@ -54,11 +54,11 @@ require (
github.com/prometheus/procfs v0.15.1 // indirect
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/crypto v0.25.0 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/oauth2 v0.22.0 // indirect
golang.org/x/sys v0.23.0 // indirect
golang.org/x/text v0.17.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
18 changes: 6 additions & 12 deletions frontend/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.14.0 h1:nyQWyZvwGTvunIMxi1Y9uXkc
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.14.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0=
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc=
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg=
github.com/Azure/azure-sdk-for-go/sdk/data/azcosmos v1.0.3 h1:gBWC0dYF3aO+7xGxL0Ccjv9BmnV30C8VZIrUPlMct6g=
github.com/Azure/azure-sdk-for-go/sdk/data/azcosmos v1.0.3/go.mod h1:7LBWaO4KRASAo9VpfhpxQKkdY6PBwkv9UDKzL9Sajuw=
github.com/Azure/azure-sdk-for-go/sdk/data/azcosmos v1.1.0 h1:c726lgbwpwFBuj+Fyrwuh/vUilqFo+hUAOUNjsKj5DI=
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY=
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY=
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU=
Expand Down Expand Up @@ -111,8 +110,7 @@ github.com/onsi/ginkgo/v2 v2.15.0 h1:79HwNRBAZHOEwrczrgSOPy+eFTTlIGELKy5as+ClttY
github.com/onsi/ginkgo/v2 v2.15.0/go.mod h1:HlxMHtYF57y6Dpf+mc5529KKmSq9h2FpCF+/ZkwUxKM=
github.com/onsi/gomega v1.31.0 h1:54UJxxj6cPInHS3a35wm6BK/F9nHYueZ1NVujHDrnXE=
github.com/onsi/gomega v1.31.0/go.mod h1:DW9aCi7U6Yi40wNVAvT6kzFnEVEI5n3DloYBiKiT6zk=
github.com/openshift-online/ocm-sdk-go v0.1.439 h1:ELrJjmYgtzhdUY1cOJ0chtbhBEGz682EiTvojt5/xVM=
github.com/openshift-online/ocm-sdk-go v0.1.439/go.mod h1:CiAu2jwl3ITKOxkeV0Qnhzv4gs35AmpIzVABQLtcI2Y=
github.com/openshift-online/ocm-sdk-go v0.1.441 h1:9qht/dFxoE6n2uZc/w2k5I1yu85Q2HnbHkelmKbrWL8=
github.com/openshift/api v0.0.0-20240429104249-ac9356ba1784 h1:SmOZFMxuAH4d1Cj7dOftVyo4Wg/mEC4pwz6QIJJsAkc=
github.com/openshift/api v0.0.0-20240429104249-ac9356ba1784/go.mod h1:CxgbWAlvu2iQB0UmKTtRu1YfepRg1/vJ64n2DlIEVz4=
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=
Expand Down Expand Up @@ -148,8 +146,7 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30=
golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M=
golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw=
golang.org/x/exp v0.0.0-20240707233637-46b078467d37 h1:uLDX+AfeFCct3a2C7uIWBKMJIR3CJMhcgfrUAqjRK6w=
golang.org/x/exp v0.0.0-20240707233637-46b078467d37/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
Expand All @@ -160,8 +157,7 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys=
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs=
golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand All @@ -171,12 +167,10 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
Expand Down
16 changes: 8 additions & 8 deletions frontend/pkg/frontend/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

azcorearm "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
"github.com/google/uuid"
cmv2alpha1 "github.com/openshift-online/ocm-sdk-go/clustersmgmt/v2alpha1"
cmv1 "github.com/openshift-online/ocm-sdk-go/clustersmgmt/v1"
ocmerrors "github.com/openshift-online/ocm-sdk-go/errors"
"golang.org/x/sync/errgroup"

Expand Down Expand Up @@ -177,7 +177,7 @@ func (f *Frontend) ArmResourceList(writer http.ResponseWriter, request *http.Req
}

// Create the request with initial parameters:
clustersRequest := f.clusterServiceConfig.Conn.ClustersMgmt().V2alpha1().Clusters().List().Search(query)
clustersRequest := f.clusterServiceConfig.Conn.ClustersMgmt().V1().Clusters().List().Search(query)
clustersRequest.Size(pageSize)
clustersRequest.Page(pageNumber)

Expand Down Expand Up @@ -843,8 +843,8 @@ func (f *Frontend) CreateOrUpdateNodePool(writer http.ResponseWriter, request *h
return
}

if csCluster.State() == cmv2alpha1.ClusterStateUninstalling {
f.logger.Error(fmt.Sprintf("failed to create node pool for cluster %s as it is in %v state", clusterResourceID, cmv2alpha1.ClusterStateUninstalling))
if csCluster.State() == cmv1.ClusterStateUninstalling {
f.logger.Error(fmt.Sprintf("failed to create node pool for cluster %s as it is in %v state", clusterResourceID, cmv1.ClusterStateUninstalling))
arm.WriteInternalServerError(writer)
return
}
Expand Down Expand Up @@ -1217,7 +1217,7 @@ func (f *Frontend) MarshalResource(ctx context.Context, resourceID *arm.Resource
}

switch doc.InternalID.Kind() {
case cmv2alpha1.ClusterKind:
case cmv1.ClusterKind:
csCluster, err := f.clusterServiceConfig.GetCSCluster(ctx, doc.InternalID)
if err != nil {
f.logger.Error(err.Error())
Expand All @@ -1233,7 +1233,7 @@ func (f *Frontend) MarshalResource(ctx context.Context, resourceID *arm.Resource
return nil, arm.NewInternalServerError()
}

case cmv2alpha1.NodePoolKind:
case cmv1.NodePoolKind:
csNodePool, err := f.clusterServiceConfig.GetCSNodePool(ctx, doc.InternalID)
if err != nil {
f.logger.Error(err.Error())
Expand All @@ -1259,7 +1259,7 @@ func (f *Frontend) MarshalResource(ctx context.Context, resourceID *arm.Resource

// marshalCSCluster renders a CS Cluster object in JSON format, applying
// the necessary conversions for the API version of the request.
func marshalCSCluster(csCluster *cmv2alpha1.Cluster, doc *database.ResourceDocument, versionedInterface api.Version) ([]byte, error) {
func marshalCSCluster(csCluster *cmv1.Cluster, doc *database.ResourceDocument, versionedInterface api.Version) ([]byte, error) {
hcpCluster := ConvertCStoHCPOpenShiftCluster(doc.Key, csCluster)
hcpCluster.TrackedResource.Resource.SystemData = doc.SystemData
hcpCluster.TrackedResource.Tags = maps.Clone(doc.Tags)
Expand All @@ -1269,7 +1269,7 @@ func marshalCSCluster(csCluster *cmv2alpha1.Cluster, doc *database.ResourceDocum

// marshalCSNodePool renders a CS NodePool object in JSON format, applying
// the necessary conversions for the API version of the request.
func marshalCSNodePool(csNodePool *cmv2alpha1.NodePool, doc *database.ResourceDocument, versionedInterface api.Version) ([]byte, error) {
func marshalCSNodePool(csNodePool *cmv1.NodePool, doc *database.ResourceDocument, versionedInterface api.Version) ([]byte, error) {
hcpNodePool := ConvertCStoNodePool(doc.Key, csNodePool)
hcpNodePool.TrackedResource.Resource.SystemData = doc.SystemData
hcpNodePool.TrackedResource.Tags = maps.Clone(doc.Tags)
Expand Down
56 changes: 28 additions & 28 deletions frontend/pkg/frontend/ocm.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"

cmv2alpha1 "github.com/openshift-online/ocm-sdk-go/clustersmgmt/v2alpha1"
cmv1 "github.com/openshift-online/ocm-sdk-go/clustersmgmt/v1"
configv1 "github.com/openshift/api/config/v1"

"github.com/Azure/ARO-HCP/internal/api"
Expand All @@ -20,28 +20,28 @@ const (
csCCSEnabled bool = true
)

func convertListeningToVisibility(listening cmv2alpha1.ListeningMethod) (visibility api.Visibility) {
func convertListeningToVisibility(listening cmv1.ListeningMethod) (visibility api.Visibility) {
switch listening {
case cmv2alpha1.ListeningMethodExternal:
case cmv1.ListeningMethodExternal:
visibility = api.VisibilityPublic
case cmv2alpha1.ListeningMethodInternal:
case cmv1.ListeningMethodInternal:
visibility = api.VisibilityPrivate
}
return
}

func convertVisibilityToListening(visibility api.Visibility) (listening cmv2alpha1.ListeningMethod) {
func convertVisibilityToListening(visibility api.Visibility) (listening cmv1.ListeningMethod) {
switch visibility {
case api.VisibilityPublic:
listening = cmv2alpha1.ListeningMethodExternal
listening = cmv1.ListeningMethodExternal
case api.VisibilityPrivate:
listening = cmv2alpha1.ListeningMethodInternal
listening = cmv1.ListeningMethodInternal
}
return
}

// ConvertCStoHCPOpenShiftCluster converts a CS Cluster object into HCPOpenShiftCluster object
func ConvertCStoHCPOpenShiftCluster(resourceID *arm.ResourceID, cluster *cmv2alpha1.Cluster) *api.HCPOpenShiftCluster {
func ConvertCStoHCPOpenShiftCluster(resourceID *arm.ResourceID, cluster *cmv1.Cluster) *api.HCPOpenShiftCluster {
hcpcluster := &api.HCPOpenShiftCluster{
TrackedResource: arm.TrackedResource{
Location: cluster.Region().ID(),
Expand Down Expand Up @@ -106,7 +106,7 @@ func ConvertCStoHCPOpenShiftCluster(resourceID *arm.ResourceID, cluster *cmv2alp
}

// BuildCSCluster creates a CS Cluster object from an HCPOpenShiftCluster object
func (f *Frontend) BuildCSCluster(ctx context.Context, hcpCluster *api.HCPOpenShiftCluster, updating bool) (*cmv2alpha1.Cluster, error) {
func (f *Frontend) BuildCSCluster(ctx context.Context, hcpCluster *api.HCPOpenShiftCluster, updating bool) (*cmv1.Cluster, error) {
resourceID, err := ResourceIDFromContext(ctx)
if err != nil {
return nil, fmt.Errorf("could not get parsed resource ID: %w", err)
Expand Down Expand Up @@ -142,7 +142,7 @@ func (f *Frontend) BuildCSCluster(ctx context.Context, hcpCluster *api.HCPOpenSh
additionalProperties["provisioner_noop_deprovision"] = "true"
}

clusterBuilder := cmv2alpha1.NewCluster()
clusterBuilder := cmv1.NewCluster()

// FIXME HcpOpenShiftCluster attributes not being passed:
// PlatformProfile.OutboundType (no CS equivalent?)
Expand All @@ -153,36 +153,36 @@ func (f *Frontend) BuildCSCluster(ctx context.Context, hcpCluster *api.HCPOpenSh
if !updating {
clusterBuilder = clusterBuilder.
Name(hcpCluster.Name).
Flavour(cmv2alpha1.NewFlavour().
Flavour(cmv1.NewFlavour().
ID(csFlavourId)).
Region(cmv2alpha1.NewCloudRegion().
Region(cmv1.NewCloudRegion().
ID(f.location)).
CloudProvider(cmv2alpha1.NewCloudProvider().
CloudProvider(cmv1.NewCloudProvider().
ID(csCloudProvider)).
Azure(cmv2alpha1.NewAzure().
Azure(cmv1.NewAzure().
TenantID(tenantID).
SubscriptionID(resourceID.SubscriptionID).
ResourceGroupName(resourceID.ResourceGroupName).
ResourceName(hcpCluster.Name).
ManagedResourceGroupName(hcpCluster.Properties.Spec.Platform.ManagedResourceGroup).
SubnetResourceID(hcpCluster.Properties.Spec.Platform.SubnetID).
NetworkSecurityGroupResourceID(hcpCluster.Properties.Spec.Platform.NetworkSecurityGroupID)).
Product(cmv2alpha1.NewProduct().
Product(cmv1.NewProduct().
ID(csProductId)).
Hypershift(cmv2alpha1.NewHypershift().
Hypershift(cmv1.NewHypershift().
Enabled(csHypershifEnabled)).
MultiAZ(csMultiAzEnabled).
CCS(cmv2alpha1.NewCCS().Enabled(csCCSEnabled)).
Version(cmv2alpha1.NewVersion().
CCS(cmv1.NewCCS().Enabled(csCCSEnabled)).
Version(cmv1.NewVersion().
ID(hcpCluster.Properties.Spec.Version.ID).
ChannelGroup(hcpCluster.Properties.Spec.Version.ChannelGroup)).
Network(cmv2alpha1.NewNetwork().
Network(cmv1.NewNetwork().
Type(string(hcpCluster.Properties.Spec.Network.NetworkType)).
PodCIDR(hcpCluster.Properties.Spec.Network.PodCIDR).
ServiceCIDR(hcpCluster.Properties.Spec.Network.ServiceCIDR).
MachineCIDR(hcpCluster.Properties.Spec.Network.MachineCIDR).
HostPrefix(int(hcpCluster.Properties.Spec.Network.HostPrefix))).
API(cmv2alpha1.NewClusterAPI().
API(cmv1.NewClusterAPI().
Listening(convertVisibilityToListening(hcpCluster.Properties.Spec.API.Visibility))).
FIPS(hcpCluster.Properties.Spec.FIPS).
EtcdEncryption(hcpCluster.Properties.Spec.EtcdEncryption)
Expand All @@ -194,7 +194,7 @@ func (f *Frontend) BuildCSCluster(ctx context.Context, hcpCluster *api.HCPOpenSh
}
}

proxyBuilder := cmv2alpha1.NewProxy()
proxyBuilder := cmv1.NewProxy()
// Cluster Service allows an empty HTTPProxy on PATCH but not PUT.
if updating || hcpCluster.Properties.Spec.Proxy.HTTPProxy != "" {
proxyBuilder = proxyBuilder.
Expand Down Expand Up @@ -225,7 +225,7 @@ func (f *Frontend) BuildCSCluster(ctx context.Context, hcpCluster *api.HCPOpenSh
}

// ConvertCStoNodePool converts a CS Node Pool object into HCPOpenShiftClusterNodePool object
func ConvertCStoNodePool(resourceID *arm.ResourceID, np *cmv2alpha1.NodePool) *api.HCPOpenShiftClusterNodePool {
func ConvertCStoNodePool(resourceID *arm.ResourceID, np *cmv1.NodePool) *api.HCPOpenShiftClusterNodePool {
nodePool := &api.HCPOpenShiftClusterNodePool{
TrackedResource: arm.TrackedResource{
Resource: arm.Resource{
Expand Down Expand Up @@ -278,8 +278,8 @@ func ConvertCStoNodePool(resourceID *arm.ResourceID, np *cmv2alpha1.NodePool) *a
}

// BuildCSNodePool creates a CS Node Pool object from an HCPOpenShiftClusterNodePool object
func (f *Frontend) BuildCSNodePool(ctx context.Context, nodePool *api.HCPOpenShiftClusterNodePool, updating bool) (*cmv2alpha1.NodePool, error) {
npBuilder := cmv2alpha1.NewNodePool()
func (f *Frontend) BuildCSNodePool(ctx context.Context, nodePool *api.HCPOpenShiftClusterNodePool, updating bool) (*cmv1.NodePool, error) {
npBuilder := cmv1.NewNodePool()

// FIXME HCPOpenShiftClusterNodePool attributes not being passed:
// PlatformProfile.EncryptionAtHost (no CS equivalent?)
Expand All @@ -289,12 +289,12 @@ func (f *Frontend) BuildCSNodePool(ctx context.Context, nodePool *api.HCPOpenShi
if !updating {
npBuilder = npBuilder.
ID(nodePool.Name).
Version(cmv2alpha1.NewVersion().
Version(cmv1.NewVersion().
ID(nodePool.Properties.Spec.Version.ID).
ChannelGroup(nodePool.Properties.Spec.Version.ChannelGroup).
AvailableUpgrades(nodePool.Properties.Spec.Version.AvailableUpgrades...)).
Subnet(nodePool.Properties.Spec.Platform.SubnetID).
AzureNodePool(cmv2alpha1.NewAzureNodePool().
AzureNodePool(cmv1.NewAzureNodePool().
ResourceName(nodePool.Name).
VMSize(nodePool.Properties.Spec.Platform.VMSize).
OSDiskSizeGibibytes(int(nodePool.Properties.Spec.Platform.DiskSizeGiB)).
Expand All @@ -312,13 +312,13 @@ func (f *Frontend) BuildCSNodePool(ctx context.Context, nodePool *api.HCPOpenShi
if nodePool.Properties.Spec.Replicas != 0 {
npBuilder.Replicas(int(nodePool.Properties.Spec.Replicas))
} else {
npBuilder.Autoscaling(cmv2alpha1.NewNodePoolAutoscaling().
npBuilder.Autoscaling(cmv1.NewNodePoolAutoscaling().
MinReplica(int(nodePool.Properties.Spec.Autoscaling.Min)).
MaxReplica(int(nodePool.Properties.Spec.Autoscaling.Max)))
}

for _, t := range nodePool.Properties.Spec.Taints {
npBuilder = npBuilder.Taints(cmv2alpha1.NewTaint().
npBuilder = npBuilder.Taints(cmv1.NewTaint().
Effect(string(t.Effect)).
Key(t.Key).
Value(t.Value))
Expand Down
Loading

0 comments on commit d87f638

Please sign in to comment.