Skip to content

Commit ae4993d

Browse files
Use fleet to deploy CNI across all providers
Signed-off-by: Danil-Grigorev <[email protected]>
1 parent 4b8c59f commit ae4993d

File tree

13 files changed

+65
-4762
lines changed

13 files changed

+65
-4762
lines changed

examples/applications/cni/calico/helm-chart.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,4 @@ spec:
3838
- vsphere-kubeadm-example
3939
- docker-kubeadm-example
4040
- docker-rke2-example
41+
- etcd-snapshot-restore

test/e2e/data/cni/kindnet.yaml renamed to examples/applications/cni/kindnet/kindnet.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
kind: Bundle
33
apiVersion: fleet.cattle.io/v1alpha1
44
metadata:
5-
name: kindnet-cni-${CLUSTER_NAME}
5+
name: kindnet-cni
66
spec:
77
resources:
88
# List of all resources that will be deployed

examples/examples.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,7 @@ var (
3939

4040
//go:embed applications/ccm/vsphere/helm-chart.yaml
4141
CAPIVsphereCPIHelmApp []byte
42+
43+
//go:embed applications/cni/kindnet/kindnet.yaml
44+
CAPIKindnet []byte
4245
)

test/e2e/const.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -114,18 +114,9 @@ var (
114114
//go:embed data/cluster-templates/vsphere-rke2-topology.yaml
115115
CAPIvSphereRKE2Topology []byte
116116

117-
//go:embed data/cni/kindnet.yaml
118-
CAPIKindnet []byte
119-
120-
//go:embed data/cni/calico.yaml
121-
CAPICalico []byte
122-
123117
//go:embed data/cpi-csi/aws.yaml
124118
CAPIAWSCPICSI []byte
125119

126-
//go:embed data/cluster-api-addon-provider-fleet/host-network-patch.yaml
127-
AddonProviderFleetHostNetworkPatch []byte
128-
129120
//go:embed data/gitea/ingress.yaml
130121
GiteaIngress []byte
131122

test/e2e/data/cluster-api-addon-provider-fleet/host-network-patch.yaml

Lines changed: 0 additions & 7 deletions
This file was deleted.

test/e2e/data/cluster-templates/docker-rke2.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ metadata:
66
annotations:
77
cluster-api.cattle.io/upstream-system-agent: "true"
88
labels:
9-
cni: kindnet
9+
cni: calico
1010
spec:
1111
clusterNetwork:
1212
pods:

test/e2e/data/cni/calico.yaml

Lines changed: 0 additions & 4731 deletions
This file was deleted.

test/e2e/specs/etcd_snapshot_restore.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ type ETCDSnapshotRestoreInput struct {
7676

7777
SkipCleanup bool `env:"SKIP_RESOURCE_CLEANUP"`
7878
SkipDeletionTest bool `env:"SKIP_DELETION_TEST"`
79+
80+
// AdditionalFleetGitRepos specifies additional FleetGitRepos to be created before the main GitRepo.
81+
// This is useful for setting up resources like cluster classes/cni/cpi that some tests require.
82+
AdditionalFleetGitRepos []turtlesframework.FleetCreateGitRepoInput
7983
}
8084

8185
// CreateUsingGitOpsSpec implements a spec that will create a cluster via Fleet and test that it
@@ -174,6 +178,14 @@ func ETCDSnapshotRestore(ctx context.Context, inputGetter func() ETCDSnapshotRes
174178
workerMachineCount = *input.WorkerMachineCount
175179
}
176180

181+
for _, additionalRepo := range input.AdditionalFleetGitRepos {
182+
if additionalRepo.TargetClusterNamespace {
183+
additionalRepo.TargetNamespace = namespace.Name
184+
}
185+
186+
turtlesframework.FleetCreateGitRepo(ctx, additionalRepo)
187+
}
188+
177189
turtlesframework.AddLabelsToNamespace(ctx, turtlesframework.AddLabelsToNamespaceInput{ // Set import label to trigger fleet installation
178190
ClusterProxy: input.BootstrapClusterProxy,
179191
Name: namespace.Name,

test/e2e/specs/import_gitops_mgmtv3.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,10 @@ func CreateMgmtV3UsingGitOpsSpec(ctx context.Context, inputGetter func() CreateM
235235
}
236236

237237
for _, additionalRepo := range input.AdditionalFleetGitRepos {
238+
if additionalRepo.TargetClusterNamespace {
239+
additionalRepo.TargetNamespace = namespace.Name
240+
}
241+
238242
turtlesframework.FleetCreateGitRepo(ctx, additionalRepo)
239243
}
240244

test/e2e/suites/etcd-snapshot-restore/etcd_snapshot_restore_test.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828

2929
"github.com/rancher/turtles/test/e2e"
3030
"github.com/rancher/turtles/test/e2e/specs"
31+
turtlesframework "github.com/rancher/turtles/test/framework"
3132
)
3233

3334
var _ = Describe("[Docker] [RKE2] Perform an ETCD backup and restore of the cluster", Label(e2e.ShortTestLabel), func() {
@@ -38,10 +39,17 @@ var _ = Describe("[Docker] [RKE2] Perform an ETCD backup and restore of the clus
3839

3940
specs.ETCDSnapshotRestore(ctx, func() specs.ETCDSnapshotRestoreInput {
4041
return specs.ETCDSnapshotRestoreInput{
41-
E2EConfig: e2e.LoadE2EConfig(),
42-
BootstrapClusterProxy: bootstrapClusterProxy,
43-
ClusterTemplate: e2e.CAPIDockerRKE2,
44-
AdditionalTemplates: [][]byte{e2e.CAPIKindnet},
42+
E2EConfig: e2e.LoadE2EConfig(),
43+
BootstrapClusterProxy: bootstrapClusterProxy,
44+
ClusterTemplate: e2e.CAPIDockerRKE2,
45+
AdditionalFleetGitRepos: []turtlesframework.FleetCreateGitRepoInput{
46+
{
47+
Name: "etcd-snapshot-restore-calico",
48+
Paths: []string{"examples/applications/cni/calico"},
49+
ClusterProxy: bootstrapClusterProxy,
50+
TargetClusterNamespace: true,
51+
},
52+
},
4553
ClusterName: "etcd-snapshot-restore",
4654
ControlPlaneMachineCount: ptr.To[int](1),
4755
WorkerMachineCount: ptr.To[int](0),

0 commit comments

Comments
 (0)