From d5f9e065c8b398a68949fce0c40f3650cdfe5b87 Mon Sep 17 00:00:00 2001 From: Sam Gartner Date: Wed, 12 Jun 2024 13:23:49 -0500 Subject: [PATCH] Credentials update update go.mod update go.mod Update the load credentials func --- go.mod | 2 +- go.sum | 4 +-- tests/v2/actions/charts/rke2template.go | 6 ++--- tests/v2/actions/provisioning/creates.go | 25 +++++++++++-------- tests/v2/actions/provisioning/providers.go | 3 ++- .../actions/rke1/nodetemplates/aws/create.go | 7 ++++-- .../rke1/nodetemplates/azure/create.go | 7 ++++-- .../rke1/nodetemplates/harvester/create.go | 7 ++++-- .../rke1/nodetemplates/linode/create.go | 7 ++++-- .../rke1/nodetemplates/vsphere/create.go | 7 ++++-- .../provisioning/k3s/template_test.go | 8 +++--- .../provisioning/rke2/template_test.go | 8 +++--- 12 files changed, 57 insertions(+), 34 deletions(-) diff --git a/go.mod b/go.mod index 8b78bcc280d..28c9ae99c26 100644 --- a/go.mod +++ b/go.mod @@ -62,7 +62,7 @@ replace ( require ( github.com/antihax/optional v1.0.0 github.com/rancher/rancher/pkg/apis v0.0.0-20240719121207-baeda6b89fe3 - github.com/rancher/shepherd v0.0.0-20240829173041-d255c925da7d + github.com/rancher/shepherd v0.0.0-20240829194632-40f661e08bd6 go.qase.io/client v0.0.0-20231114201952-65195ec001fa ) diff --git a/go.sum b/go.sum index 9612fca2315..475679c3536 100644 --- a/go.sum +++ b/go.sum @@ -1794,8 +1794,8 @@ github.com/rancher/remotedialer v0.4.0 h1:T9yC5bFMsZFVQ6rK0dNrRg6rRb6Zr/4vsig8S0 github.com/rancher/remotedialer v0.4.0/go.mod h1:Ys004RpJuTLSm+k4aYUCoFiOOad37ubYev3TkOFg/5w= github.com/rancher/rke v1.6.1 h1:ipktVDW1Xcs2SIR4vB9vCxH09kVrfD+1RmcUtWIPUV8= github.com/rancher/rke v1.6.1/go.mod h1:5xRbf3L8PxqJRhABjYRfaBqbpVqAnqyH3maUNQEuwvk= -github.com/rancher/shepherd v0.0.0-20240829173041-d255c925da7d h1:67/7UcaYRqLh5KiG8gX5TM7gXfmkq98yzPXeS77A6vo= -github.com/rancher/shepherd v0.0.0-20240829173041-d255c925da7d/go.mod h1:nVphr8v6qtXd0pth8wMCF9U5eKEPBIaD5+HQCH19uRw= +github.com/rancher/shepherd v0.0.0-20240829194632-40f661e08bd6 h1:Qz/LQ+nVPIC8A/rMy9gCJ29iGaTfy4d4u5nmAQtNpr8= +github.com/rancher/shepherd v0.0.0-20240829194632-40f661e08bd6/go.mod h1:nVphr8v6qtXd0pth8wMCF9U5eKEPBIaD5+HQCH19uRw= github.com/rancher/steve v0.0.0-20240806133920-61be17faa3d2 h1:mmm2uQ1NsNCrr6jxq9eAdGxvaf+6061gV4BMvuhcT6I= github.com/rancher/steve v0.0.0-20240806133920-61be17faa3d2/go.mod h1:Za4nSt0V6kIHRfUo6jTXKkv6ABMMCHINA8EzhzygCfk= github.com/rancher/system-upgrade-controller/pkg/apis v0.0.0-20210727200656-10b094e30007 h1:ru+mqGnxMmKeU0Q3XIDxkARvInDIqT1hH2amTcsjxI4= diff --git a/tests/v2/actions/charts/rke2template.go b/tests/v2/actions/charts/rke2template.go index 69407016ace..2e298b56414 100644 --- a/tests/v2/actions/charts/rke2template.go +++ b/tests/v2/actions/charts/rke2template.go @@ -5,8 +5,8 @@ import ( "github.com/rancher/rancher/tests/v2/actions/projects" "github.com/rancher/shepherd/clients/rancher" + v1 "github.com/rancher/shepherd/clients/rancher/v1" "github.com/rancher/shepherd/extensions/charts" - "github.com/rancher/shepherd/extensions/cloudcredentials" "github.com/rancher/shepherd/extensions/clusters" "github.com/rancher/shepherd/extensions/defaults" "github.com/rancher/shepherd/extensions/wait" @@ -21,7 +21,7 @@ const ( ) // InstallTemplateChart installs a template from a repo. -func InstallTemplateChart(client *rancher.Client, repoName, templateName, clusterName, k8sVersion string, credentials *cloudcredentials.CloudCredential) error { +func InstallTemplateChart(client *rancher.Client, repoName, templateName, clusterName, k8sVersion string, credentials *v1.SteveAPIObject) error { latestVersion, err := client.Catalog.GetLatestChartVersion(templateName, repoName) if err != nil { return err @@ -63,7 +63,7 @@ func InstallTemplateChart(client *rancher.Client, repoName, templateName, cluste return err } - chartInstallAction := TemplateInstallAction(chartInstallActionPayload, repoName, clusterName, credentials.ID, k8sVersion, fleetNamespace, chartValues) + chartInstallAction := TemplateInstallAction(chartInstallActionPayload, repoName, clusterName, credentials.Namespace+":"+credentials.Name, k8sVersion, fleetNamespace, chartValues) catalogClient, err := client.GetClusterCatalogClient(installOptions.Cluster.ID) if err != nil { diff --git a/tests/v2/actions/provisioning/creates.go b/tests/v2/actions/provisioning/creates.go index a8ccb5231e1..3d08a03cfc3 100644 --- a/tests/v2/actions/provisioning/creates.go +++ b/tests/v2/actions/provisioning/creates.go @@ -27,6 +27,7 @@ import ( "github.com/rancher/rancher/tests/v2/actions/rke1/nodetemplates" "github.com/rancher/rancher/tests/v2/actions/secrets" v1 "github.com/rancher/shepherd/clients/rancher/v1" + "github.com/rancher/shepherd/extensions/cloudcredentials" "github.com/rancher/shepherd/extensions/cloudcredentials/aws" "github.com/rancher/shepherd/extensions/cloudcredentials/azure" "github.com/rancher/shepherd/extensions/cloudcredentials/google" @@ -67,7 +68,8 @@ const ( // CreateProvisioningCluster provisions a non-rke1 cluster, then runs verify checks func CreateProvisioningCluster(client *rancher.Client, provider Provider, clustersConfig *clusters.ClusterConfig, hostnameTruncation []machinepools.HostnameTruncation) (*v1.SteveAPIObject, error) { - cloudCredential, err := provider.CloudCredFunc(client) + credentialSpec := cloudcredentials.LoadCloudCredential(string(provider.Name)) + cloudCredential, err := provider.CloudCredFunc(client, credentialSpec) if err != nil { return nil, err } @@ -138,9 +140,9 @@ func CreateProvisioningCluster(client *rancher.Client, provider Provider, cluste vcenterCredentials := map[string]interface{}{ "datacenters": machinePoolConfigs[0].Object["datacenter"], - "host": cloudCredential.VmwareVsphereConfig.Vcenter, + "host": credentialSpec.VmwareVsphereConfig.Vcenter, "password": vsphere.GetVspherePassword(), - "username": cloudCredential.VmwareVsphereConfig.Username, + "username": credentialSpec.VmwareVsphereConfig.Username, } clustersConfig.AddOnConfig = &provisioninginput.AddOnConfig{ ChartValues: &rkev1.GenericMap{ @@ -159,7 +161,7 @@ func CreateProvisioningCluster(client *rancher.Client, provider Provider, cluste } } - cluster := clusters.NewK3SRKE2ClusterConfig(clusterName, namespace, clustersConfig, machinePools, cloudCredential.ID) + cluster := clusters.NewK3SRKE2ClusterConfig(clusterName, namespace, clustersConfig, machinePools, cloudCredential.Namespace+":"+cloudCredential.Name) for _, truncatedPool := range hostnameTruncation { if truncatedPool.PoolNameLengthLimit > 0 || truncatedPool.ClusterNameLengthLimit > 0 { @@ -723,13 +725,14 @@ func CreateProvisioningRKE1AirgapCustomCluster(client *rancher.Client, clustersC // CreateProvisioningAKSHostedCluster provisions an AKS cluster, then runs verify checks func CreateProvisioningAKSHostedCluster(client *rancher.Client, aksClusterConfig aks.ClusterConfig) (*management.Cluster, error) { - cloudCredential, err := azure.CreateAzureCloudCredentials(client) + cloudCredentialConfig := cloudcredentials.LoadCloudCredential("azure") + cloudCredential, err := azure.CreateAzureCloudCredentials(client, cloudCredentialConfig) if err != nil { return nil, err } clusterName := namegen.AppendRandomString("akshostcluster") - clusterResp, err := aks.CreateAKSHostedCluster(client, clusterName, cloudCredential.ID, aksClusterConfig, false, false, false, false, nil) + clusterResp, err := aks.CreateAKSHostedCluster(client, clusterName, cloudCredential.Namespace+":"+cloudCredential.Name, aksClusterConfig, false, false, false, false, nil) if err != nil { return nil, err } @@ -748,13 +751,14 @@ func CreateProvisioningAKSHostedCluster(client *rancher.Client, aksClusterConfig // CreateProvisioningEKSHostedCluster provisions an EKS cluster, then runs verify checks func CreateProvisioningEKSHostedCluster(client *rancher.Client, eksClusterConfig eks.ClusterConfig) (*management.Cluster, error) { - cloudCredential, err := aws.CreateAWSCloudCredentials(client) + cloudCredentialConfig := cloudcredentials.LoadCloudCredential("aws") + cloudCredential, err := aws.CreateAWSCloudCredentials(client, cloudCredentialConfig) if err != nil { return nil, err } clusterName := namegen.AppendRandomString("ekshostcluster") - clusterResp, err := eks.CreateEKSHostedCluster(client, clusterName, cloudCredential.ID, eksClusterConfig, false, false, false, false, nil) + clusterResp, err := eks.CreateEKSHostedCluster(client, clusterName, cloudCredential.Namespace+":"+cloudCredential.Name, eksClusterConfig, false, false, false, false, nil) if err != nil { return nil, err } @@ -773,13 +777,14 @@ func CreateProvisioningEKSHostedCluster(client *rancher.Client, eksClusterConfig // CreateProvisioningGKEHostedCluster provisions an GKE cluster, then runs verify checks func CreateProvisioningGKEHostedCluster(client *rancher.Client, gkeClusterConfig gke.ClusterConfig) (*management.Cluster, error) { - cloudCredential, err := google.CreateGoogleCloudCredentials(client) + credentialSpec := cloudcredentials.LoadCloudCredential(provisioninginput.GoogleProviderName.String()) + cloudCredential, err := google.CreateGoogleCloudCredentials(client, credentialSpec) if err != nil { return nil, err } clusterName := namegen.AppendRandomString("gkehostcluster") - clusterResp, err := gke.CreateGKEHostedCluster(client, clusterName, cloudCredential.ID, gkeClusterConfig, false, false, false, false, nil) + clusterResp, err := gke.CreateGKEHostedCluster(client, clusterName, cloudCredential.Namespace+":"+cloudCredential.Name, gkeClusterConfig, false, false, false, false, nil) if err != nil { return nil, err } diff --git a/tests/v2/actions/provisioning/providers.go b/tests/v2/actions/provisioning/providers.go index bcec388542b..65bf5c1f21b 100644 --- a/tests/v2/actions/provisioning/providers.go +++ b/tests/v2/actions/provisioning/providers.go @@ -6,6 +6,7 @@ import ( "github.com/rancher/rancher/tests/v2/actions/machinepools" "github.com/rancher/rancher/tests/v2/actions/provisioninginput" "github.com/rancher/shepherd/clients/rancher" + v1 "github.com/rancher/shepherd/clients/rancher/v1" "github.com/rancher/shepherd/extensions/cloudcredentials" "github.com/rancher/shepherd/extensions/cloudcredentials/aws" "github.com/rancher/shepherd/extensions/cloudcredentials/azure" @@ -23,7 +24,7 @@ import ( r1vsphere "github.com/rancher/rancher/tests/v2/actions/rke1/nodetemplates/vsphere" ) -type CloudCredFunc func(rancherClient *rancher.Client) (*cloudcredentials.CloudCredential, error) +type CloudCredFunc func(rancherClient *rancher.Client, credentials cloudcredentials.CloudCredential) (*v1.SteveAPIObject, error) type MachinePoolFunc func(generatedPoolName, namespace string) []unstructured.Unstructured type Provider struct { diff --git a/tests/v2/actions/rke1/nodetemplates/aws/create.go b/tests/v2/actions/rke1/nodetemplates/aws/create.go index da37ce506e6..a8d88ea0701 100644 --- a/tests/v2/actions/rke1/nodetemplates/aws/create.go +++ b/tests/v2/actions/rke1/nodetemplates/aws/create.go @@ -4,11 +4,13 @@ import ( "github.com/rancher/rancher/tests/v2/actions/rke1/nodetemplates" "github.com/rancher/shepherd/clients/rancher" management "github.com/rancher/shepherd/clients/rancher/generated/management/v3" + "github.com/rancher/shepherd/extensions/cloudcredentials" "github.com/rancher/shepherd/extensions/cloudcredentials/aws" "github.com/rancher/shepherd/pkg/config" ) const awsEC2NodeTemplateNameBase = "awsNodeConfig" +const providerName = "aws" // CreateAWSNodeTemplate is a helper function that takes the rancher Client as a parameter and creates // an AWS node template and returns the NodeTemplate response @@ -16,7 +18,8 @@ func CreateAWSNodeTemplate(rancherClient *rancher.Client) (*nodetemplates.NodeTe var amazonEC2NodeTemplateConfig nodetemplates.AmazonEC2NodeTemplateConfig config.LoadConfig(nodetemplates.AmazonEC2NodeTemplateConfigurationFileKey, &amazonEC2NodeTemplateConfig) - cloudCredential, err := aws.CreateAWSCloudCredentials(rancherClient) + cloudCredentialConfig := cloudcredentials.LoadCloudCredential(providerName) + cloudCredential, err := aws.CreateAWSCloudCredentials(rancherClient, cloudCredentialConfig) if err != nil { return nil, err } @@ -28,7 +31,7 @@ func CreateAWSNodeTemplate(rancherClient *rancher.Client) (*nodetemplates.NodeTe } nodeTemplateConfig := &nodetemplates.NodeTemplate{ - CloudCredentialID: cloudCredential.ID, + CloudCredentialID: cloudCredential.Namespace + ":" + cloudCredential.Name, } config.LoadConfig(nodetemplates.NodeTemplateConfigurationFileKey, nodeTemplateConfig) diff --git a/tests/v2/actions/rke1/nodetemplates/azure/create.go b/tests/v2/actions/rke1/nodetemplates/azure/create.go index 188b197cb8b..dbb3da58a6d 100644 --- a/tests/v2/actions/rke1/nodetemplates/azure/create.go +++ b/tests/v2/actions/rke1/nodetemplates/azure/create.go @@ -4,11 +4,13 @@ import ( "github.com/rancher/rancher/tests/v2/actions/rke1/nodetemplates" "github.com/rancher/shepherd/clients/rancher" management "github.com/rancher/shepherd/clients/rancher/generated/management/v3" + "github.com/rancher/shepherd/extensions/cloudcredentials" "github.com/rancher/shepherd/extensions/cloudcredentials/azure" "github.com/rancher/shepherd/pkg/config" ) const azureNodeTemplateNameBase = "azureNodeConfig" +const providerName = "azure" // CreateAzureNodeTemplate is a helper function that takes the rancher Client as a parameter and creates // an Azure node template and returns the NodeTemplate response @@ -16,7 +18,8 @@ func CreateAzureNodeTemplate(rancherClient *rancher.Client) (*nodetemplates.Node var azureNodeTemplateConfig nodetemplates.AzureNodeTemplateConfig config.LoadConfig(nodetemplates.AzureNodeTemplateConfigurationFileKey, &azureNodeTemplateConfig) - cloudCredential, err := azure.CreateAzureCloudCredentials(rancherClient) + cloudCredentialConfig := cloudcredentials.LoadCloudCredential(providerName) + cloudCredential, err := azure.CreateAzureCloudCredentials(rancherClient, cloudCredentialConfig) if err != nil { return nil, err } @@ -28,7 +31,7 @@ func CreateAzureNodeTemplate(rancherClient *rancher.Client) (*nodetemplates.Node } nodeTemplateConfig := &nodetemplates.NodeTemplate{ - CloudCredentialID: cloudCredential.ID, + CloudCredentialID: cloudCredential.Namespace + ":" + cloudCredential.Name, } config.LoadConfig(nodetemplates.NodeTemplateConfigurationFileKey, nodeTemplateConfig) diff --git a/tests/v2/actions/rke1/nodetemplates/harvester/create.go b/tests/v2/actions/rke1/nodetemplates/harvester/create.go index 545d0e72cd2..b466b1c412e 100644 --- a/tests/v2/actions/rke1/nodetemplates/harvester/create.go +++ b/tests/v2/actions/rke1/nodetemplates/harvester/create.go @@ -4,11 +4,13 @@ import ( "github.com/rancher/rancher/tests/v2/actions/rke1/nodetemplates" "github.com/rancher/shepherd/clients/rancher" management "github.com/rancher/shepherd/clients/rancher/generated/management/v3" + "github.com/rancher/shepherd/extensions/cloudcredentials" "github.com/rancher/shepherd/extensions/cloudcredentials/harvester" "github.com/rancher/shepherd/pkg/config" ) const harvesterNodeTemplateNameBase = "harvesterNodeConfig" +const providerName = "harvester" // CreateHarvesterNodeTemplate is a helper function that takes the rancher Client as a parameter and creates // an Harvester node template and returns the NodeTemplate response @@ -16,7 +18,8 @@ func CreateHarvesterNodeTemplate(rancherClient *rancher.Client) (*nodetemplates. var harvesterNodeTemplateConfig nodetemplates.HarvesterNodeTemplateConfig config.LoadConfig(nodetemplates.HarvesterNodeTemplateConfigurationFileKey, &harvesterNodeTemplateConfig) - cloudCredential, err := harvester.CreateHarvesterCloudCredentials(rancherClient) + cloudCredentialConfig := cloudcredentials.LoadCloudCredential(providerName) + cloudCredential, err := harvester.CreateHarvesterCloudCredentials(rancherClient, cloudCredentialConfig) if err != nil { return nil, err } @@ -28,7 +31,7 @@ func CreateHarvesterNodeTemplate(rancherClient *rancher.Client) (*nodetemplates. } nodeTemplateConfig := &nodetemplates.NodeTemplate{ - CloudCredentialID: cloudCredential.ID, + CloudCredentialID: cloudCredential.Namespace + ":" + cloudCredential.Name, } config.LoadConfig(nodetemplates.NodeTemplateConfigurationFileKey, nodeTemplateConfig) diff --git a/tests/v2/actions/rke1/nodetemplates/linode/create.go b/tests/v2/actions/rke1/nodetemplates/linode/create.go index bd9bba73428..35f26847d1a 100644 --- a/tests/v2/actions/rke1/nodetemplates/linode/create.go +++ b/tests/v2/actions/rke1/nodetemplates/linode/create.go @@ -4,11 +4,13 @@ import ( "github.com/rancher/rancher/tests/v2/actions/rke1/nodetemplates" "github.com/rancher/shepherd/clients/rancher" management "github.com/rancher/shepherd/clients/rancher/generated/management/v3" + "github.com/rancher/shepherd/extensions/cloudcredentials" "github.com/rancher/shepherd/extensions/cloudcredentials/linode" "github.com/rancher/shepherd/pkg/config" ) const linodeNodeTemplateNameBase = "linodeNodeConfig" +const providerName = "linode" // CreateLinodeNodeTemplate is a helper function that takes the rancher Client as a parameter and creates // an Linode node template and returns the NodeTemplate response @@ -16,7 +18,8 @@ func CreateLinodeNodeTemplate(rancherClient *rancher.Client) (*nodetemplates.Nod var linodeNodeTemplateConfig nodetemplates.LinodeNodeTemplateConfig config.LoadConfig(nodetemplates.LinodeNodeTemplateConfigurationFileKey, &linodeNodeTemplateConfig) - cloudCredential, err := linode.CreateLinodeCloudCredentials(rancherClient) + cloudCredentialConfig := cloudcredentials.LoadCloudCredential(providerName) + cloudCredential, err := linode.CreateLinodeCloudCredentials(rancherClient, cloudCredentialConfig) if err != nil { return nil, err } @@ -28,7 +31,7 @@ func CreateLinodeNodeTemplate(rancherClient *rancher.Client) (*nodetemplates.Nod } nodeTemplateConfig := &nodetemplates.NodeTemplate{ - CloudCredentialID: cloudCredential.ID, + CloudCredentialID: cloudCredential.Namespace + ":" + cloudCredential.Name, } config.LoadConfig(nodetemplates.NodeTemplateConfigurationFileKey, nodeTemplateConfig) diff --git a/tests/v2/actions/rke1/nodetemplates/vsphere/create.go b/tests/v2/actions/rke1/nodetemplates/vsphere/create.go index 441e7de36b7..d6efd5436be 100644 --- a/tests/v2/actions/rke1/nodetemplates/vsphere/create.go +++ b/tests/v2/actions/rke1/nodetemplates/vsphere/create.go @@ -4,11 +4,13 @@ import ( "github.com/rancher/rancher/tests/v2/actions/rke1/nodetemplates" "github.com/rancher/shepherd/clients/rancher" management "github.com/rancher/shepherd/clients/rancher/generated/management/v3" + "github.com/rancher/shepherd/extensions/cloudcredentials" "github.com/rancher/shepherd/extensions/cloudcredentials/vsphere" "github.com/rancher/shepherd/pkg/config" ) const vmwarevsphereNodeTemplateNameBase = "vmwarevsphereNodeConfig" +const providerName = "vsphere" // CreateVSphereNodeTemplate is a helper function that takes the rancher Client as a parameter and creates // a VSphere node template and returns the NodeTemplate response @@ -16,7 +18,8 @@ func CreateVSphereNodeTemplate(rancherClient *rancher.Client) (*nodetemplates.No var vmwarevsphereNodeTemplateConfig nodetemplates.VmwareVsphereNodeTemplateConfig config.LoadConfig(nodetemplates.VmwareVsphereNodeTemplateConfigurationFileKey, &vmwarevsphereNodeTemplateConfig) - cloudCredential, err := vsphere.CreateVsphereCloudCredentials(rancherClient) + cloudCredentialConfig := cloudcredentials.LoadCloudCredential(providerName) + cloudCredential, err := vsphere.CreateVsphereCloudCredentials(rancherClient, cloudCredentialConfig) if err != nil { return nil, err } @@ -28,7 +31,7 @@ func CreateVSphereNodeTemplate(rancherClient *rancher.Client) (*nodetemplates.No } nodeTemplateConfig := &nodetemplates.NodeTemplate{ - CloudCredentialID: cloudCredential.ID, + CloudCredentialID: cloudCredential.Namespace + ":" + cloudCredential.Name, } config.LoadConfig(nodetemplates.NodeTemplateConfigurationFileKey, nodeTemplateConfig) diff --git a/tests/v2/validation/provisioning/k3s/template_test.go b/tests/v2/validation/provisioning/k3s/template_test.go index cb3734a5891..25f11f9992a 100644 --- a/tests/v2/validation/provisioning/k3s/template_test.go +++ b/tests/v2/validation/provisioning/k3s/template_test.go @@ -10,6 +10,7 @@ import ( "github.com/rancher/rancher/tests/v2/actions/provisioning" "github.com/rancher/rancher/tests/v2/actions/provisioninginput" "github.com/rancher/shepherd/clients/rancher" + v1 "github.com/rancher/shepherd/clients/rancher/v1" "github.com/rancher/shepherd/extensions/cloudcredentials" "github.com/rancher/shepherd/extensions/clusters" "github.com/rancher/shepherd/extensions/clusters/kubernetesversions" @@ -36,7 +37,7 @@ type ClusterTemplateTestSuite struct { standardUserClient *rancher.Client session *session.Session templateConfig *provisioninginput.TemplateConfig - cloudCredentials *cloudcredentials.CloudCredential + cloudCredentials *v1.SteveAPIObject } func (r *ClusterTemplateTestSuite) TearDownSuite() { @@ -55,11 +56,12 @@ func (r *ClusterTemplateTestSuite) SetupSuite() { r.client = client provider := provisioning.CreateProvider(r.templateConfig.TemplateProvider) - r.cloudCredentials, err = provider.CloudCredFunc(client) + cloudCredentialConfig := cloudcredentials.LoadCloudCredential(r.templateConfig.TemplateProvider) + r.cloudCredentials, err = provider.CloudCredFunc(client, cloudCredentialConfig) require.NoError(r.T(), err) } -func (r *ClusterTemplateTestSuite) TestProvisionK3sTemplateCluster() { +func (r *ClusterTemplateTestSuite) TestProvisionK3STemplateCluster() { _, err := steve.CreateAndWaitForResource(r.client, stevetypes.ClusterRepo, r.templateConfig.Repo, true, 5*time.Second, defaults.FiveMinuteTimeout) require.NoError(r.T(), err) diff --git a/tests/v2/validation/provisioning/rke2/template_test.go b/tests/v2/validation/provisioning/rke2/template_test.go index 5431474bfa4..152d786ae37 100644 --- a/tests/v2/validation/provisioning/rke2/template_test.go +++ b/tests/v2/validation/provisioning/rke2/template_test.go @@ -1,5 +1,3 @@ -//go:build (validation || extended) && !infra.any && !infra.aks && !infra.eks && !infra.gke && !infra.rke2k3s && !cluster.any && !cluster.custom && !cluster.nodedriver && !sanity && !stress - package rke2 import ( @@ -11,6 +9,7 @@ import ( "github.com/rancher/rancher/tests/v2/actions/provisioninginput" "github.com/rancher/rancher/tests/v2/actions/reports" "github.com/rancher/shepherd/clients/rancher" + v1 "github.com/rancher/shepherd/clients/rancher/v1" "github.com/rancher/shepherd/extensions/cloudcredentials" "github.com/rancher/shepherd/extensions/clusters" "github.com/rancher/shepherd/extensions/clusters/kubernetesversions" @@ -37,7 +36,7 @@ type ClusterTemplateTestSuite struct { standardUserClient *rancher.Client session *session.Session templateConfig *provisioninginput.TemplateConfig - cloudCredentials *cloudcredentials.CloudCredential + cloudCredentials *v1.SteveAPIObject } func (r *ClusterTemplateTestSuite) TearDownSuite() { @@ -56,7 +55,8 @@ func (r *ClusterTemplateTestSuite) SetupSuite() { r.client = client provider := provisioning.CreateProvider(r.templateConfig.TemplateProvider) - r.cloudCredentials, err = provider.CloudCredFunc(client) + cloudCredentialConfig := cloudcredentials.LoadCloudCredential(r.templateConfig.TemplateProvider) + r.cloudCredentials, err = provider.CloudCredFunc(client, cloudCredentialConfig) require.NoError(r.T(), err) }