Skip to content

Commit 58cdfcd

Browse files
committed
added e2e test for nsg-feature
1 parent 32b00c9 commit 58cdfcd

File tree

6 files changed

+81
-5
lines changed

6 files changed

+81
-5
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ generate-e2e-templates: $(KUSTOMIZE)
297297
$(KUSTOMIZE) build $(OCI_TEMPLATES)/v1beta2/cluster-template-managed-self-managed-nodes --load-restrictor LoadRestrictionsNone > $(OCI_TEMPLATES)/v1beta2/cluster-template-managed-self-managed-nodes.yaml
298298
$(KUSTOMIZE) build $(OCI_TEMPLATES)/v1beta2/cluster-template-machine-with-ipv6 --load-restrictor LoadRestrictionsNone > $(OCI_TEMPLATES)/v1beta2/cluster-template-machine-with-ipv6.yaml
299299
$(KUSTOMIZE) build $(OCI_TEMPLATES)/v1beta2/cluster-template-with-paravirt-bv --load-restrictor LoadRestrictionsNone > $(OCI_TEMPLATES)/v1beta2/cluster-template-with-paravirt-bv.yaml
300+
$(KUSTOMIZE) build $(OCI_TEMPLATES)/v1beta2/cluster-template-self-manage-nsg --load-restrictor LoadRestrictionsNone > $(OCI_TEMPLATES)/v1beta2/cluster-template-self-manage-nsg.yaml
300301

301302
.PHONY: test-e2e-run
302303
test-e2e-run: generate-e2e-templates $(GINKGO) $(ENVSUBST) ## Run e2e tests

templates/cluster-template-with-nsg.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ spec:
3636
compartmentId: "${OCI_COMPARTMENT_ID}"
3737
networkSpec:
3838
vcn:
39-
id: "${VCN_ID}"
39+
id: "${EXTERNAL_VCN_ID}"
4040
skip: true
4141
networkSecurityGroup:
4242
skip: false
@@ -49,22 +49,22 @@ spec:
4949
routeTable:
5050
skip: true
5151
subnets:
52-
- id: "${SUBNET_ID_CPE}"
52+
- id: "${EXTERNAL_VCN_CPE_SUBNET}"
5353
role: control-plane-endpoint
5454
name: control-plane-endpoint
5555
type: public
5656
skip: true
57-
- id: "${SUBNET_ID_W}"
57+
- id: "${EXTERNAL_VCN_WORKER_SUBNET}"
5858
role: worker
5959
name: worker
6060
type: private
6161
skip: true
62-
- id: "${SUBNET_ID_CP}"
62+
- id: "${EXTERNAL_VCN_CP_SUBNET}"
6363
role: control-plane
6464
name: control-plane
6565
type: private
6666
skip: true
67-
- id: "${SUBNET_ID_LB}"
67+
- id: "${EXTERNAL_VCN_CPE_SUBNET}"
6868
role: service-lb
6969
name: service-lb
7070
type: public

test/e2e/cluster_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,28 @@ var _ = Describe("Workload cluster creation", func() {
582582
}, result)
583583
})
584584

585+
It("Self manage NSG [PRBlocking]", func() {
586+
clusterName = getClusterName(clusterNamePrefix, "self-manage-nsg")
587+
clusterctl.ApplyClusterTemplateAndWait(ctx, clusterctl.ApplyClusterTemplateAndWaitInput{
588+
ClusterProxy: bootstrapClusterProxy,
589+
ConfigCluster: clusterctl.ConfigClusterInput{
590+
LogFolder: filepath.Join(artifactFolder, "clusters", bootstrapClusterProxy.GetName()),
591+
ClusterctlConfigPath: clusterctlConfigPath,
592+
KubeconfigPath: bootstrapClusterProxy.GetKubeconfigPath(),
593+
InfrastructureProvider: clusterctl.DefaultInfrastructureProvider,
594+
Flavor: "self-manage-nsg",
595+
Namespace: namespace.Name,
596+
ClusterName: clusterName,
597+
KubernetesVersion: e2eConfig.GetVariable(capi_e2e.KubernetesVersion),
598+
ControlPlaneMachineCount: pointer.Int64(1),
599+
WorkerMachineCount: pointer.Int64(0),
600+
},
601+
CNIManifestPath: e2eConfig.GetVariable(capi_e2e.CNIPath),
602+
WaitForClusterIntervals: e2eConfig.GetIntervals(specName, "wait-cluster"),
603+
WaitForControlPlaneIntervals: e2eConfig.GetIntervals(specName, "wait-control-plane-nsg"),
604+
}, result)
605+
})
606+
585607
It("Machine Pool - Simple", func() {
586608
clusterName = getClusterName(clusterNamePrefix, "machine-pool")
587609
clusterctl.ApplyClusterTemplateAndWait(ctx, clusterctl.ApplyClusterTemplateAndWaitInput{

test/e2e/config/e2e_conf.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ providers:
7979
- sourcePath: "../data/infrastructure-oci/v1beta2/cluster-template-windows-calico.yaml"
8080
- sourcePath: "../data/infrastructure-oci/v1beta2/cluster-template-machine-with-ipv6.yaml"
8181
- sourcePath: "../data/infrastructure-oci/v1beta2/cluster-template-with-paravirt-bv.yaml"
82+
- sourcePath: "../data/infrastructure-oci/v1beta2/cluster-template-self-manage-nsg.yaml"
8283
- sourcePath: "../data/infrastructure-oci/v1beta2/metadata.yaml"
8384

8485
variables:
@@ -115,6 +116,7 @@ intervals:
115116
default/wait-controllers: ["3m", "10s"]
116117
default/wait-cluster: ["30m", "10s"]
117118
default/wait-control-plane: ["30m", "10s"]
119+
default/wait-control-plane-nsg: ["10m", "10s"]
118120
default/wait-worker-nodes: ["30m", "10s"]
119121
default/wait-windows-worker-nodes: ["60m", "30s"]
120122
default/wait-cluster-bare-metal: [ "60m", "10s" ]
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
3+
kind: OCICluster
4+
metadata:
5+
labels:
6+
cluster.x-k8s.io/cluster-name: "${CLUSTER_NAME}"
7+
name: "${CLUSTER_NAME}"
8+
spec:
9+
compartmentId: "${OCI_COMPARTMENT_ID}"
10+
networkSpec:
11+
vcn:
12+
id: "${EXTERNAL_VCN_ID}"
13+
skip: true
14+
networkSecurityGroup:
15+
skip: false
16+
internetGateway:
17+
skip: true
18+
natGateway:
19+
skip: true
20+
serviceGateway:
21+
skip: true
22+
routeTable:
23+
skip: true
24+
subnets:
25+
- id: "${EXTERNAL_VCN_CPE_SUBNET}"
26+
role: control-plane-endpoint
27+
name: control-plane-endpoint
28+
type: public
29+
skip: true
30+
- id: "${EXTERNAL_VCN_WORKER_SUBNET}"
31+
role: worker
32+
name: worker
33+
type: private
34+
skip: true
35+
- id: "${EXTERNAL_VCN_CP_SUBNET}"
36+
role: control-plane
37+
name: control-plane
38+
type: private
39+
skip: true
40+
- id: "${EXTERNAL_VCN_LB_SUBNET}"
41+
role: service-lb
42+
name: service-lb
43+
type: public
44+
skip: true
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
bases:
2+
- ../bases/cluster.yaml
3+
- ../bases/md.yaml
4+
- ../../bases/ccm.yaml
5+
patchesStrategicMerge:
6+
- ./cluster.yaml
7+

0 commit comments

Comments
 (0)