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 0d9449e commit 528b43d
Show file tree
Hide file tree
Showing 11 changed files with 78 additions and 81 deletions.
2 changes: 1 addition & 1 deletion 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 Down
3 changes: 1 addition & 2 deletions frontend/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,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
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
2 changes: 1 addition & 1 deletion internal/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ require (
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.20.2 // indirect
github.com/prometheus/client_golang v1.20.3 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.55.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
Expand Down
4 changes: 2 additions & 2 deletions internal/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg=
github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
github.com/prometheus/client_golang v1.20.3 h1:oPksm4K8B+Vt35tUhw6GbSNSgVlVSBH0qELP/7u83l4=
github.com/prometheus/client_golang v1.20.3/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc=
Expand Down
34 changes: 17 additions & 17 deletions internal/ocm/internalid.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import (
"path"
"strings"

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

const (
v2alpha1Pattern = "/api/clusters_mgmt/v2alpha1"
v2alpha1ClusterPattern = v2alpha1Pattern + "/clusters/*"
v2alpha1NodePoolPattern = v2alpha1ClusterPattern + "/node_pools/*"
v1Pattern = "/api/clusters_mgmt/v1"
v1ClusterPattern = v1Pattern + "/clusters/*"
v1NodePoolPattern = v1ClusterPattern + "/node_pools/*"
)

// InternalID represents a Cluster Service resource.
Expand All @@ -29,14 +29,14 @@ func (id *InternalID) validate() error {
// This is where we will catch and convert any legacy API versions
// to the version the RP is actively using.
//
// For example, once the RP is using "v2" we will convert "v2alpha1"
// For example, once the RP is using "v2" we will convert "v1"
// and any other legacy transitional versions we see to "v2".

if match, _ = path.Match(v2alpha1ClusterPattern, id.path); match {
if match, _ = path.Match(v1ClusterPattern, id.path); match {
return nil
}

if match, _ = path.Match(v2alpha1NodePoolPattern, id.path); match {
if match, _ = path.Match(v1NodePoolPattern, id.path); match {
return nil
}

Expand Down Expand Up @@ -75,12 +75,12 @@ func (id *InternalID) Kind() string {
var match bool
var kind string

if match, _ = path.Match(v2alpha1ClusterPattern, id.path); match {
kind = cmv2alpha1.ClusterKind
if match, _ = path.Match(v1ClusterPattern, id.path); match {
kind = cmv1.ClusterKind
}

if match, _ = path.Match(v2alpha1NodePoolPattern, id.path); match {
kind = cmv2alpha1.NodePoolKind
if match, _ = path.Match(v1NodePoolPattern, id.path); match {
kind = cmv1.NodePoolKind
}

return kind
Expand All @@ -89,13 +89,13 @@ func (id *InternalID) Kind() string {
// GetClusterClient returns a v1 ClusterClient from the InternalID.
// This works for both cluster and node pool resources. The transport
// is most likely to be a Connection object from the SDK.
func (id *InternalID) GetClusterClient(transport http.RoundTripper) (*cmv2alpha1.ClusterClient, bool) {
func (id *InternalID) GetClusterClient(transport http.RoundTripper) (*cmv1.ClusterClient, bool) {
var thisPath string = id.path
var lastPath string

for thisPath != lastPath {
if match, _ := path.Match(v2alpha1ClusterPattern, thisPath); match {
return cmv2alpha1.NewClusterClient(transport, thisPath), true
if match, _ := path.Match(v1ClusterPattern, thisPath); match {
return cmv1.NewClusterClient(transport, thisPath), true
} else {
lastPath = thisPath
thisPath = path.Dir(thisPath)
Expand All @@ -107,9 +107,9 @@ func (id *InternalID) GetClusterClient(transport http.RoundTripper) (*cmv2alpha1

// GetNodePoolClient returns a v1 NodePoolClient from the InternalID.
// The transport is most likely to be a Connection object from the SDK.
func (id *InternalID) GetNodePoolClient(transport http.RoundTripper) (*cmv2alpha1.NodePoolClient, bool) {
if match, _ := path.Match(v2alpha1NodePoolPattern, id.path); match {
return cmv2alpha1.NewNodePoolClient(transport, id.path), true
func (id *InternalID) GetNodePoolClient(transport http.RoundTripper) (*cmv1.NodePoolClient, bool) {
if match, _ := path.Match(v1NodePoolPattern, id.path); match {
return cmv1.NewNodePoolClient(transport, id.path), true
}
return nil, false
}
16 changes: 8 additions & 8 deletions internal/ocm/internalid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"net/http"
"testing"

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

type FakeTransport struct{}
Expand All @@ -32,15 +32,15 @@ func TestInternalID(t *testing.T) {
expectErr: true,
},
{
name: "parse v2alpha1 cluster",
path: "/api/clusters_mgmt/v2alpha1/clusters/abc",
kind: cmv2alpha1.ClusterKind,
name: "parse v1 cluster",
path: "/api/clusters_mgmt/v1/clusters/abc",
kind: cmv1.ClusterKind,
expectErr: false,
},
{
name: "parse v2alpha1 node pool",
path: "/api/clusters_mgmt/v2alpha1/clusters/abc/node_pools/def",
kind: cmv2alpha1.NodePoolKind,
name: "parse v1 node pool",
path: "/api/clusters_mgmt/v1/clusters/abc/node_pools/def",
kind: cmv1.NodePoolKind,
expectErr: false,
},
}
Expand Down Expand Up @@ -74,7 +74,7 @@ func TestInternalID(t *testing.T) {
if _, ok := internalID.GetClusterClient(transport); !ok {
t.Errorf("failed to get cluster client")
}
if kind == cmv2alpha1.NodePoolKind {
if kind == cmv1.NodePoolKind {
if _, ok := internalID.GetNodePoolClient(transport); !ok {
t.Errorf("failed to get node pool client")
}
Expand Down
Loading

0 comments on commit 528b43d

Please sign in to comment.