Skip to content

Commit 15b3bfb

Browse files
Merge pull request #3494 from Azure/ARO-22966-democluster-use-RPAPI
Convert cluster/nodepool operations to use RP API
2 parents 3ee9d6a + 9de013e commit 15b3bfb

8 files changed

+77
-128
lines changed

nonlocal-e2e-specs.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
"should allow API access only from authorized VM IP",
1414
"should be able to create a cluster with an external auth config and get the external auth config",
1515
"should be able to create an HCP cluster and custom node pool osDisk size using bicep template",
16-
"should be able to lifecycle and confirm external auth on a cluster",
17-
"should be able to list HCP clusters without node pools at both subscription and resource group levels",
1816
"should confirm the HCP cluster is deleted (not found)",
19-
"should create an HCP cluster and validate TLS certificates",
20-
"should not be able to create a 4.18 HCP cluster"
17+
"should create an HCP cluster and validate TLS certificates"
2118
]

test/e2e-setup/bicep/modules/customer-infra.bicep

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@description('If set to true, the cluster will not be deleted automatically after few days.')
2-
param persistTagValue bool
2+
param persistTagValue bool = false
33

44
@description('Network Security Group Name')
55
param customerNsgName string = 'customer-nsg'

test/e2e/cluster_create_missing_info.go

Lines changed: 20 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,10 @@ var _ = Describe("Customer", func() {
3838
labels.RequireNothing,
3939
labels.Critical,
4040
labels.Negative,
41+
labels.AroRpApiCompatible,
4142
func(ctx context.Context) {
4243
const (
43-
customerNetworkSecurityGroupName = "customer-nsg-name"
44-
customerVnetName = "customer-vnet-name"
45-
customerVnetSubnetName = "customer-vnet-subnet1"
46-
customerClusterName = "illegal-hcp-cluster"
44+
customerClusterName = "illegal-hcp-cluster"
4745
)
4846
tc := framework.NewTestContext()
4947

@@ -56,64 +54,28 @@ var _ = Describe("Customer", func() {
5654
resourceGroup, err := tc.NewResourceGroup(ctx, "illegal-ocp-version", tc.Location())
5755
Expect(err).NotTo(HaveOccurred())
5856

59-
By("creating a customer-infra")
60-
customerInfraDeploymentResult, err := tc.CreateBicepTemplateAndWait(ctx,
61-
framework.WithTemplateFromFS(TestArtifactsFS, "test-artifacts/generated-test-artifacts/modules/customer-infra.json"),
62-
framework.WithDeploymentName("customer-infra"),
63-
framework.WithScope(framework.BicepDeploymentScopeResourceGroup),
64-
framework.WithClusterResourceGroup(*resourceGroup.Name),
65-
framework.WithParameters(map[string]interface{}{
66-
"persistTagValue": false,
67-
"customerNsgName": customerNetworkSecurityGroupName,
68-
"customerVnetName": customerVnetName,
69-
"customerVnetSubnetName": customerVnetSubnetName,
70-
}),
71-
framework.WithTimeout(45*time.Minute),
72-
)
73-
Expect(err).NotTo(HaveOccurred())
57+
By("creating cluster parameters with invalid version")
58+
clusterParams := framework.NewDefaultClusterParams()
59+
clusterParams.ClusterName = customerClusterName
60+
clusterParams.OpenshiftVersionId = version
61+
managedResourceGroupName := framework.SuffixName(*resourceGroup.Name, "managed", 64)
62+
clusterParams.ManagedResourceGroupName = managedResourceGroupName
7463

75-
By("creating/reusing managed identities")
76-
keyVaultName, err := framework.GetOutputValue(customerInfraDeploymentResult, "keyVaultName")
77-
Expect(err).NotTo(HaveOccurred())
78-
managedIdentityDeploymentResult, err := tc.DeployManagedIdentities(ctx,
79-
customerClusterName,
80-
framework.WithTemplateFromFS(TestArtifactsFS, "test-artifacts/generated-test-artifacts/modules/managed-identities.json"),
81-
framework.WithClusterResourceGroup(*resourceGroup.Name),
82-
framework.WithParameters(map[string]interface{}{
83-
"nsgName": customerNetworkSecurityGroupName,
84-
"vnetName": customerVnetName,
85-
"subnetName": customerVnetSubnetName,
86-
"keyVaultName": keyVaultName,
87-
}),
64+
By("creating customer resources")
65+
clusterParams, err = tc.CreateClusterCustomerResources(ctx,
66+
resourceGroup,
67+
clusterParams,
68+
map[string]interface{}{},
69+
TestArtifactsFS,
8870
)
8971
Expect(err).NotTo(HaveOccurred())
9072

91-
By("creating the hcp cluster")
92-
userAssignedIdentities, err := framework.GetOutputValue(managedIdentityDeploymentResult, "userAssignedIdentitiesValue")
93-
Expect(err).NotTo(HaveOccurred())
94-
identity, err := framework.GetOutputValue(managedIdentityDeploymentResult, "identityValue")
95-
Expect(err).NotTo(HaveOccurred())
96-
etcdEncryptionKeyName, err := framework.GetOutputValue(customerInfraDeploymentResult, "etcdEncryptionKeyName")
97-
Expect(err).NotTo(HaveOccurred())
98-
managedResourceGroupName := framework.SuffixName(*resourceGroup.Name, "managed", 64)
99-
_, err = tc.CreateBicepTemplateAndWait(ctx,
100-
framework.WithTemplateFromFS(TestArtifactsFS, "test-artifacts/generated-test-artifacts/modules/cluster.json"),
101-
framework.WithDeploymentName("cluster"),
102-
framework.WithScope(framework.BicepDeploymentScopeResourceGroup),
103-
framework.WithClusterResourceGroup(*resourceGroup.Name),
104-
framework.WithParameters(map[string]interface{}{
105-
"openshiftVersionId": version,
106-
"clusterName": customerClusterName,
107-
"managedResourceGroupName": managedResourceGroupName,
108-
"nsgName": customerNetworkSecurityGroupName,
109-
"subnetName": customerVnetSubnetName,
110-
"vnetName": customerVnetName,
111-
"userAssignedIdentitiesValue": userAssignedIdentities,
112-
"identityValue": identity,
113-
"keyVaultName": keyVaultName,
114-
"etcdEncryptionKeyName": etcdEncryptionKeyName,
115-
}),
116-
framework.WithTimeout(45*time.Minute),
73+
By("attempting to create the hcp cluster with invalid version")
74+
err = tc.CreateHCPClusterFromParam(ctx,
75+
GinkgoLogr,
76+
*resourceGroup.Name,
77+
clusterParams,
78+
45*time.Minute,
11779
)
11880
Expect(err).To(HaveOccurred())
11981
Expect(err).To(MatchError(MatchRegexp("Version .* (doesn't exist|is disabled)")))

test/e2e/cluster_list_no_infra.go

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,20 @@ var _ = Describe("Customer", func() {
3636
labels.RequireNothing,
3737
labels.Positive,
3838
labels.Medium,
39+
labels.AroRpApiCompatible,
3940
func(ctx context.Context) {
40-
const createClustersCount = 2
41-
4241
tc := framework.NewTestContext()
4342
openshiftControlPlaneVersionId := framework.DefaultOpenshiftControlPlaneVersionId()
4443

44+
var resourceGroups []*armresources.ResourceGroup
45+
var clusterNames []string
46+
const createClustersCount = 2
47+
4548
if tc.UsePooledIdentities() {
4649
err := tc.AssignIdentityContainers(ctx, createClustersCount, 60*time.Second)
4750
Expect(err).NotTo(HaveOccurred())
4851
}
4952

50-
var resourceGroups []*armresources.ResourceGroup
51-
var clusterNames []string
52-
5353
for range createClustersCount {
5454
By("creating resource group for cluster listing test")
5555
resourceGroup, err := tc.NewResourceGroup(ctx, "cluster-listing", tc.Location())
@@ -59,24 +59,28 @@ var _ = Describe("Customer", func() {
5959
clusterName := "list-test-cluster-" + rand.String(6)
6060
clusterNames = append(clusterNames, clusterName)
6161

62-
By("creating cluster without node pool using cluster-only template: " + clusterName)
63-
64-
identities, usePooledForCluster, err := tc.ResolveIdentitiesForTemplate(*resourceGroup.Name)
62+
By("creating cluster without node pool: " + clusterName)
63+
clusterParams := framework.NewDefaultClusterParams()
64+
clusterParams.ClusterName = clusterName
65+
clusterParams.OpenshiftVersionId = openshiftControlPlaneVersionId
66+
managedResourceGroupName := framework.SuffixName(*resourceGroup.Name, "managed", 64)
67+
clusterParams.ManagedResourceGroupName = managedResourceGroupName
68+
69+
By("creating customer resources for cluster: " + clusterName)
70+
clusterParams, err = tc.CreateClusterCustomerResources(ctx,
71+
resourceGroup,
72+
clusterParams,
73+
map[string]interface{}{},
74+
TestArtifactsFS,
75+
)
6576
Expect(err).NotTo(HaveOccurred())
6677

67-
_, err = tc.CreateBicepTemplateAndWait(ctx,
68-
framework.WithTemplateFromFS(TestArtifactsFS, "test-artifacts/generated-test-artifacts/cluster-only.json"),
69-
framework.WithDeploymentName("cluster-only"),
70-
framework.WithScope(framework.BicepDeploymentScopeResourceGroup),
71-
framework.WithClusterResourceGroup(*resourceGroup.Name),
72-
framework.WithParameters(map[string]any{
73-
"openshiftControlPlaneVersionId": openshiftControlPlaneVersionId,
74-
"clusterName": clusterName,
75-
"persistTagValue": false,
76-
"identities": identities,
77-
"usePooledIdentities": usePooledForCluster,
78-
}),
79-
framework.WithTimeout(45*time.Minute),
78+
By("creating HCP cluster: " + clusterName)
79+
err = tc.CreateHCPClusterFromParam(ctx,
80+
GinkgoLogr,
81+
*resourceGroup.Name,
82+
clusterParams,
83+
45*time.Minute,
8084
)
8185
Expect(err).NotTo(HaveOccurred())
8286
}

test/e2e/external_auth_list_and_verify.go

Lines changed: 22 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ package e2e
1717

1818
import (
1919
"context"
20-
"encoding/json"
2120
"fmt"
2221
"time"
2322

@@ -27,7 +26,6 @@ import (
2726
"k8s.io/apimachinery/pkg/util/rand"
2827

2928
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
30-
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources"
3129

3230
hcpsdk "github.com/Azure/ARO-HCP/test/sdk/resourcemanager/redhatopenshifthcp/armredhatopenshifthcp"
3331
"github.com/Azure/ARO-HCP/test/util/framework"
@@ -43,7 +41,10 @@ var _ = Describe("Customer", func() {
4341
dummyUID := "00000000-0000-0000-0000-000000000000"
4442

4543
It("should be able to lifecycle and confirm external auth on a cluster",
46-
labels.RequireNothing, labels.High, labels.Positive,
44+
labels.RequireNothing,
45+
labels.High,
46+
labels.Positive,
47+
labels.AroRpApiCompatible,
4748
func(ctx context.Context) {
4849
clusterName := testingPrefix + rand.String(6)
4950
tc := framework.NewTestContext()
@@ -57,53 +58,30 @@ var _ = Describe("Customer", func() {
5758
resourceGroup, err := tc.NewResourceGroup(ctx, testingPrefix, tc.Location())
5859
Expect(err).NotTo(HaveOccurred())
5960

60-
By("starting cluster-only template deployment")
61-
deploymentsClient := tc.GetARMResourcesClientFactoryOrDie(ctx).NewDeploymentsClient()
62-
63-
// Prepare the template and parameters
64-
templateBytes := framework.Must(TestArtifactsFS.ReadFile("test-artifacts/generated-test-artifacts/cluster-only.json"))
65-
bicepTemplateMap := map[string]interface{}{}
66-
err = json.Unmarshal(templateBytes, &bicepTemplateMap)
67-
Expect(err).NotTo(HaveOccurred())
68-
69-
identities, usePooled, err := tc.ResolveIdentitiesForTemplate(*resourceGroup.Name)
61+
By("creating cluster parameters")
62+
clusterParams := framework.NewDefaultClusterParams()
63+
clusterParams.ClusterName = clusterName
64+
managedResourceGroupName := framework.SuffixName(*resourceGroup.Name, "managed", 64)
65+
clusterParams.ManagedResourceGroupName = managedResourceGroupName
66+
67+
By("creating customer resources")
68+
clusterParams, err = tc.CreateClusterCustomerResources(ctx,
69+
resourceGroup,
70+
clusterParams,
71+
map[string]interface{}{},
72+
TestArtifactsFS,
73+
)
7074
Expect(err).NotTo(HaveOccurred())
7175

72-
bicepParameters := map[string]interface{}{
73-
"clusterName": map[string]interface{}{
74-
"value": clusterName,
75-
},
76-
"identities": map[string]interface{}{
77-
"value": identities,
78-
},
79-
"usePooledIdentities": map[string]interface{}{
80-
"value": usePooled,
81-
},
82-
}
83-
84-
// Create ARO HCP cluster
85-
timeout := 45 * time.Minute
86-
deploymentCtx, deploymentCancel := context.WithTimeoutCause(ctx, timeout, fmt.Errorf("timeout '%f' minutes exceeded during external auth list and verify test", timeout.Minutes()))
87-
defer deploymentCancel()
88-
89-
deploymentResp, err := deploymentsClient.BeginCreateOrUpdate(
90-
deploymentCtx,
76+
By("creating HCP cluster")
77+
err = tc.CreateHCPClusterFromParam(ctx,
78+
GinkgoLogr,
9179
*resourceGroup.Name,
92-
clusterName,
93-
armresources.Deployment{
94-
Properties: &armresources.DeploymentProperties{
95-
Template: bicepTemplateMap,
96-
Parameters: bicepParameters,
97-
Mode: to.Ptr(armresources.DeploymentModeIncremental),
98-
},
99-
},
100-
nil,
80+
clusterParams,
81+
45*time.Minute,
10182
)
10283
Expect(err).NotTo(HaveOccurred())
10384

104-
_, err = deploymentResp.PollUntilDone(deploymentCtx, nil)
105-
Expect(err).NotTo(HaveOccurred())
106-
10785
expectedExternalAuth := hcpsdk.ExternalAuth{
10886
Name: to.Ptr(testingPrefix),
10987
Properties: &hcpsdk.ExternalAuthProperties{

test/testdata/zz_fixture_TestMainListSuitesForEachSuite_dev_cd_check_paralleldev_cd_check_parallel.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ Customer should be able to test admin credentials before cluster ready, then ful
33
Customer should be able to create node pools with ARM64-based VMs
44
Customer should be able to create an HCP cluster with custom autoscaling
55
Customer should be able to create a HCP cluster without CNI
6+
Customer should be able to list HCP clusters without node pools at both subscription and resource group levels
67
Update HCPOpenShiftCluster Positive creates a cluster and updates tags with a PATCH request
78
Customer should be able to create several HCP clusters in their customer resource group, but not in the same managed resource group
89
Customer should be able to create an HCP cluster using bicep templates
10+
Customer should be able to lifecycle and confirm external auth on a cluster
911
Customer should be able to create an HCP cluster with Image Registry not present
1012
Engineering should be able to retrieve kusto logs for a cluster and services
1113
Customer should be able to create a cluster with default autoscaling and a nodepool with autoscaling enabled

test/testdata/zz_fixture_TestMainListSuitesForEachSuite_rp_api_compat_all_parallel_01rp_api_compat_all_parallel_development.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@ Customer should be able to test admin credentials before cluster ready, then ful
33
Customer should be able to create node pools with ARM64-based VMs
44
Customer should be able to create an HCP cluster with custom autoscaling
55
Customer should reject cluster creation with unreasonably high MaxNodesTotal
6+
Customer should not be able to create a 4.18 HCP cluster
67
Customer should be able to create a HCP cluster without CNI
8+
Customer should be able to list HCP clusters without node pools at both subscription and resource group levels
79
Customer should not be able to deploy 2 identically named clusters within the same resource group
810
Customer should not be able to deploy cluster with invalid name
911
Update HCPOpenShiftCluster Positive creates a cluster and updates tags with a PATCH request
1012
Customer should be able to create several HCP clusters in their customer resource group, but not in the same managed resource group
1113
Customer should be able to create an HCP cluster using bicep templates
14+
Customer should be able to lifecycle and confirm external auth on a cluster
1215
Customer should be able to create an HCP cluster with Image Registry not present
1316
Engineering should be able to retrieve kusto logs for a cluster and services
1417
Customer should be able to create a cluster with default autoscaling and a nodepool with autoscaling enabled

test/testdata/zz_fixture_TestMainListSuitesForEachSuite_rp_api_compat_all_parallelrp_api_compat_all_parallel.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@ Customer should be able to test admin credentials before cluster ready, then ful
33
Customer should be able to create node pools with ARM64-based VMs
44
Customer should be able to create an HCP cluster with custom autoscaling
55
Customer should reject cluster creation with unreasonably high MaxNodesTotal
6+
Customer should not be able to create a 4.18 HCP cluster
67
Customer should be able to create a HCP cluster without CNI
8+
Customer should be able to list HCP clusters without node pools at both subscription and resource group levels
79
Customer should not be able to deploy 2 identically named clusters within the same resource group
810
Customer should not be able to deploy cluster with invalid name
911
Update HCPOpenShiftCluster Positive creates a cluster and updates tags with a PATCH request
1012
Customer should be able to create several HCP clusters in their customer resource group, but not in the same managed resource group
1113
Customer should be able to create an HCP cluster using bicep templates
14+
Customer should be able to lifecycle and confirm external auth on a cluster
1215
Customer should be able to create an HCP cluster with Image Registry not present
1316
Customer should be able to create a cluster with default autoscaling and a nodepool with autoscaling enabled
1417
Customer should reject nodepool creation with both replicas and autoscaling configured

0 commit comments

Comments
 (0)