Skip to content

Commit

Permalink
test: cover azure provisioning via cluster class (#779)
Browse files Browse the repository at this point in the history
* test: cover azure provisioning via cluster class

Signed-off-by: Carlos Salas <carlos.salas@suse.com>

* test: remove "standard" aks e2e scenario

Signed-off-by: Carlos Salas <carlos.salas@suse.com>

* test: reference rke2 bootstrap in aks class template

Signed-off-by: Carlos Salas <carlos.salas@suse.com>

---------

Signed-off-by: Carlos Salas <carlos.salas@suse.com>
  • Loading branch information
salasberryfin authored Oct 17, 2024
1 parent 2027f18 commit 4fe5fb4
Show file tree
Hide file tree
Showing 5 changed files with 156 additions and 136 deletions.
4 changes: 2 additions & 2 deletions test/e2e/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ var (
//go:embed data/cluster-templates/aws-eks-mmp.yaml
CAPIAwsEKSMMP []byte

//go:embed data/cluster-templates/azure-aks-mmp.yaml
CAPIAzureAKSMMP []byte
//go:embed data/cluster-templates/azure-aks-topology.yaml
CAPIAzureAKSTopology []byte

//go:embed data/cluster-templates/vsphere-kubeadm.yaml
CAPIvSphereKubeadm []byte
Expand Down
131 changes: 0 additions & 131 deletions test/e2e/data/cluster-templates/azure-aks-mmp.yaml

This file was deleted.

150 changes: 150 additions & 0 deletions test/e2e/data/cluster-templates/azure-aks-topology.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
apiVersion: cluster.x-k8s.io/v1beta1
kind: ClusterClass
metadata:
name: ${CLUSTER_CLASS_NAME}
namespace: default
spec:
controlPlane:
ref:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: AzureManagedControlPlaneTemplate
name: ${CLUSTER_NAME}-control-plane
infrastructure:
ref:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: AzureManagedClusterTemplate
name: ${CLUSTER_NAME}
workers:
machinePools:
- class: default-system
template:
bootstrap:
ref:
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: RKE2ConfigTemplate
name: ${CLUSTER_NAME}-pool0
infrastructure:
ref:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: AzureManagedMachinePoolTemplate
name: ${CLUSTER_NAME}-pool0
- class: default-worker
template:
bootstrap:
ref:
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: RKE2ConfigTemplate
name: ${CLUSTER_NAME}-pool1
infrastructure:
ref:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: AzureManagedMachinePoolTemplate
name: ${CLUSTER_NAME}-pool1
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: AzureManagedControlPlaneTemplate
metadata:
name: ${CLUSTER_NAME}-control-plane
namespace: default
spec:
template:
spec:
identityRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: AzureClusterIdentity
name: cluster-identity
location: southcentralus
resourceGroupName: "${CLUSTER_NAME}"
subscriptionID: ${AZURE_SUBSCRIPTION_ID}
version: ${KUBERNETES_VERSION}
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: AzureManagedClusterTemplate
metadata:
name: ${CLUSTER_NAME}
namespace: default
spec:
template:
spec: {}
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: AzureManagedMachinePoolTemplate
metadata:
name: ${CLUSTER_NAME}-pool0
namespace: default
spec:
template:
spec:
mode: System
name: pool0
sku: Standard_D2s_v3
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: AzureManagedMachinePoolTemplate
metadata:
name: ${CLUSTER_NAME}-pool1
namespace: default
spec:
template:
spec:
mode: User
name: pool1
sku: Standard_D2s_v3
---
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: RKE2ConfigTemplate
metadata:
name: ${CLUSTER_NAME}-pool0
namespace: default
spec:
template:
spec: {}
---
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: RKE2ConfigTemplate
metadata:
name: ${CLUSTER_NAME}-pool1
namespace: default
spec:
template:
spec: {}
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: AzureClusterIdentity
metadata:
annotations:
"helm.sh/resource-policy": keep
labels:
clusterctl.cluster.x-k8s.io/move-hierarchy: "true"
name: cluster-identity
namespace: default
spec:
allowedNamespaces: {}
clientID: ${AZURE_CLIENT_ID}
clientSecret:
name: cluster-identity-secret
namespace: default
tenantID: ${AZURE_TENANT_ID}
type: ServicePrincipal
---
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
name: ${CLUSTER_NAME}
namespace: default
spec:
clusterNetwork:
pods:
cidrBlocks:
- 192.168.0.0/16
topology:
class: ${CLUSTER_CLASS_NAME}
version: ${KUBERNETES_VERSION}
workers:
machinePools:
- class: default-system
name: mp-0
replicas: 1
- class: default-worker
name: mp-1
replicas: 1
1 change: 1 addition & 0 deletions test/e2e/specs/import_gitops_mgmtv3.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ func CreateMgmtV3UsingGitOpsSpec(ctx context.Context, inputGetter func() CreateM

additionalVars := map[string]string{
"CLUSTER_NAME": input.ClusterName,
"CLUSTER_CLASS_NAME": fmt.Sprintf("%s-class", input.ClusterName),
"WORKER_MACHINE_COUNT": strconv.Itoa(workerMachineCount),
"CONTROL_PLANE_MACHINE_COUNT": strconv.Itoa(controlPlaneMachineCount),
}
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/suites/import-gitops-v3/import_gitops_v3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ var _ = Describe("[Docker] [RKE2] - [management.cattle.io/v3] Create and delete
})
})

var _ = Describe("[Azure] [AKS] - [management.cattle.io/v3] Create and delete CAPI cluster functionality should work with namespace auto-import", Label(e2e.FullTestLabel), func() {
var _ = Describe("[Azure] [AKS] - [management.cattle.io/v3] Create and delete CAPI cluster from cluster class", Label(e2e.FullTestLabel), func() {
BeforeEach(func() {
komega.SetClient(setupClusterResult.BootstrapClusterProxy.GetClient())
komega.SetContext(ctx)
Expand All @@ -107,8 +107,8 @@ var _ = Describe("[Azure] [AKS] - [management.cattle.io/v3] Create and delete CA
BootstrapClusterProxy: setupClusterResult.BootstrapClusterProxy,
ClusterctlConfigPath: flagVals.ConfigPath,
ArtifactFolder: artifactsFolder,
ClusterTemplate: e2e.CAPIAzureAKSMMP,
ClusterName: "highlander-e2e-clusterv3-2",
ClusterTemplate: e2e.CAPIAzureAKSTopology,
ClusterName: "highlander-e2e-topology",
ControlPlaneMachineCount: ptr.To[int](1),
WorkerMachineCount: ptr.To[int](1),
GitAddr: giteaResult.GitAddress,
Expand Down

0 comments on commit 4fe5fb4

Please sign in to comment.