Skip to content

Commit

Permalink
ci: bump k8s and Rancher Manager versions
Browse files Browse the repository at this point in the history
Execute E2E tests on latest versions.

Signed-off-by: Loic Devulder <[email protected]>
  • Loading branch information
ldevulder committed Oct 10, 2023
1 parent 908f70d commit a6e7be4
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 60 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ jobs:
e2e-tests:
strategy:
matrix:
kubernetes: [ "v1.24.6", "v1.25.8"]
kubernetes: [ "v1.23.17", "v1.24.15", "v1.25.11", "v1.26.6" ]
replicas: ["1"]
rancherVersion : ["2.7.2"]
rancherVersion : ["2.7.8"]
runs-on: ubuntu-latest
needs: prepare-build
name: k8s ${{ matrix.kubernetes }} - Rancher ${{ matrix.rancherVersion }} - ${{ matrix.replicas }} replicas
Expand Down
8 changes: 4 additions & 4 deletions tests/e2e/config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ operatorReplicas: 1
noSetup: false
artifactsDir: ../../_artifacts

nginxVersion: controller-v1.4.0
nginxVersion: controller-v1.9.1
nginxURL: https://raw.githubusercontent.com/kubernetes/ingress-nginx/${NGINX_VERSION}/deploy/static/provider/kind/deploy.yaml

certManagerVersion: v1.7.1
certManagerVersion: v1.13.1
certManagerChartURL: https://charts.jetstack.io/charts/cert-manager-${CERT_MANAGER_VERSION}.tgz

rancherVersion: 2.7.2
rancherVersion: 2.7.8
rancherChartURL: https://releases.rancher.com/server-charts/latest/rancher-${RANCHER_VERSION}.tgz

systemUpgradeControllerVersion: v0.9.1
systemUpgradeControllerVersion: v0.13.1
systemUpgradeControllerURL: https://github.com/rancher/system-upgrade-controller/releases/download/${SYSTEM_UPGRADE_CONTROLLER_VERSION}/system-upgrade-controller.yaml
25 changes: 0 additions & 25 deletions tests/e2e/do_nothing_test.go

This file was deleted.

31 changes: 19 additions & 12 deletions tests/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"context"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"path/filepath"
Expand Down Expand Up @@ -64,9 +63,11 @@ const (
certManagerCAInjectorName = "cert-manager-cainjector"
cattleSystemNamespace = "cattle-system"
rancherName = "rancher"
cattleFleetNamespace = "cattle-fleet-local-system"
fleetNamespace = "fleet-local"
cattleFleetName = "fleet-agent"
cattleFleetNamespace = "cattle-fleet-system"
fleetController = "fleet-controller"
cattleCapiNamespace = "cattle-provisioning-capi-system"
capiController = "capi-controller-manager"
fleetNamespace = "fleet-default"
sysUpgradeControllerName = "system-upgrade-controller"
)

Expand Down Expand Up @@ -114,11 +115,6 @@ var _ = BeforeSuite(func() {
return
}

if isOperatorInstalled(k) {
By("rancher-os already deployed, skipping setup")
return
}

if isOperatorInstalled(k) { // only operator upgrade required, no furher bootstrap
By("Upgrading the operator only", func() {
err := kubectl.DeleteNamespace(operatorNamespace)
Expand Down Expand Up @@ -165,6 +161,7 @@ var _ = BeforeSuite(func() {
By("already installed")
return
}

Expect(kubectl.Apply(nginxNamespace, e2eCfg.NginxURL)).To(Succeed())

Eventually(func() bool {
Expand All @@ -177,6 +174,7 @@ var _ = BeforeSuite(func() {
By("already installed")
return
}

Expect(kubectl.RunHelmBinaryWithCustomErr(
"-n",
certManagerNamespace,
Expand All @@ -187,9 +185,11 @@ var _ = BeforeSuite(func() {
certManagerNamespace,
e2eCfg.CertManagerChartURL,
)).To(Succeed())

Eventually(func() bool {
return isDeploymentReady(certManagerNamespace, certManagerName)
}, 5*time.Minute, 2*time.Second).Should(BeTrue())

Eventually(func() bool {
return isDeploymentReady(certManagerNamespace, certManagerCAInjectorName)
}, 5*time.Minute, 2*time.Second).Should(BeTrue())
Expand All @@ -200,6 +200,7 @@ var _ = BeforeSuite(func() {
By("already installed")
return
}

Expect(kubectl.RunHelmBinaryWithCustomErr(
"-n",
cattleSystemNamespace,
Expand All @@ -213,11 +214,17 @@ var _ = BeforeSuite(func() {
rancherName,
fmt.Sprintf(e2eCfg.RancherChartURL),
)).To(Succeed())

Eventually(func() bool {
return isDeploymentReady(cattleSystemNamespace, rancherName)
}, 5*time.Minute, 2*time.Second).Should(BeTrue())

Eventually(func() bool {
return isDeploymentReady(cattleFleetNamespace, fleetController)
}, 5*time.Minute, 2*time.Second).Should(BeTrue())

Eventually(func() bool {
return isDeploymentReady(cattleFleetNamespace, cattleFleetName)
return isDeploymentReady(cattleCapiNamespace, capiController)
}, 5*time.Minute, 2*time.Second).Should(BeTrue())
})

Expand All @@ -233,11 +240,11 @@ var _ = BeforeSuite(func() {
// It needs to look over cattle-system ns to be functional
toApply := strings.ReplaceAll(data.String(), "namespace: system-upgrade", "namespace: cattle-system")

temp, err := ioutil.TempFile("", "temp")
temp, err := os.CreateTemp("", "temp")
Expect(err).ToNot(HaveOccurred())

defer os.RemoveAll(temp.Name())
Expect(ioutil.WriteFile(temp.Name(), []byte(toApply), os.ModePerm)).To(Succeed())
Expect(os.WriteFile(temp.Name(), []byte(toApply), os.ModePerm)).To(Succeed())
Expect(kubectl.Apply(cattleSystemNamespace, temp.Name())).To(Succeed())

Eventually(func() bool {
Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/machineregistration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var _ = Describe("MachineRegistration e2e tests", func() {

BeforeEach(func() {
mRegistration = catalog.NewMachineRegistration(
operatorNamespace,
fleetNamespace,
"machine-registration",
&elementalv1.Config{})
})
Expand Down Expand Up @@ -75,7 +75,7 @@ var _ = Describe("MachineRegistration e2e tests", func() {
}
cconfig, _ := json.Marshal(config)
mRegistration = catalog.NewMachineRegistration(
operatorNamespace,
fleetNamespace,
"machine-registration",
&elementalv1.Config{
Elemental: elementalv1.Elemental{
Expand All @@ -85,7 +85,7 @@ var _ = Describe("MachineRegistration e2e tests", func() {
},
},
CloudConfig: map[string]runtime.RawExtension{
"write_files": runtime.RawExtension{
"write_files": {
Raw: cconfig,
},
},
Expand Down
18 changes: 8 additions & 10 deletions tests/e2e/managedosimage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,14 @@ import (
"k8s.io/apimachinery/pkg/runtime"
)

const testnamespace = "fleet-default"

var _ = Describe("ManagedOSImage e2e tests", func() {
Context("Using OSImage reference", func() {
var ui *elementalv1.ManagedOSImage

BeforeEach(func() {
By("Creating a new ManagedOSImage CRD")
ui = catalog.NewManagedOSImage(
testnamespace,
fleetNamespace,
"update-image",
[]elementalv1.BundleTarget{{
ClusterName: "dummycluster",
Expand All @@ -56,7 +54,7 @@ var _ = Describe("ManagedOSImage e2e tests", func() {

AfterEach(func() {
ui = catalog.NewManagedOSImage(
testnamespace,
fleetNamespace,
"update-image",
[]elementalv1.BundleTarget{{
ClusterName: "dummycluster",
Expand All @@ -75,7 +73,7 @@ var _ = Describe("ManagedOSImage e2e tests", func() {

if err := cl.Get(ctx, client.ObjectKey{
Name: "mos-update-image",
Namespace: testnamespace,
Namespace: fleetNamespace,
}, bundle); err != nil {
return err.Error()
}
Expand All @@ -95,13 +93,13 @@ var _ = Describe("ManagedOSImage e2e tests", func() {

AfterEach(func() {

Expect(cl.DeleteAllOf(ctx, &elementalv1.ManagedOSImage{}, client.InNamespace(testnamespace)))
Expect(cl.DeleteAllOf(ctx, &elementalv1.ManagedOSVersion{}, client.InNamespace(testnamespace)))
Expect(cl.DeleteAllOf(ctx, &elementalv1.ManagedOSImage{}, client.InNamespace(fleetNamespace)))
Expect(cl.DeleteAllOf(ctx, &elementalv1.ManagedOSVersion{}, client.InNamespace(fleetNamespace)))
})

createsCorrectPlan := func(name string, meta map[string]runtime.RawExtension, c *upgradev1.ContainerSpec, m types.GomegaMatcher) {
ov := catalog.NewManagedOSVersion(
testnamespace,
fleetNamespace,
name, "v1.0", "0.0.0",
meta,
c,
Expand All @@ -110,7 +108,7 @@ var _ = Describe("ManagedOSImage e2e tests", func() {
Expect(cl.Create(ctx, ov)).To(Succeed())

ui := catalog.NewManagedOSImage(
testnamespace,
fleetNamespace,
name,
[]elementalv1.BundleTarget{{
ClusterName: "dummycluster",
Expand All @@ -126,7 +124,7 @@ var _ = Describe("ManagedOSImage e2e tests", func() {

if err := cl.Get(ctx, client.ObjectKey{
Name: "mos-" + name,
Namespace: testnamespace,
Namespace: fleetNamespace,
}, bundle); err != nil {
return err.Error()
}
Expand Down
8 changes: 4 additions & 4 deletions tests/e2e/managedosversionchannel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ var _ = Describe("ManagedOSVersionChannel e2e tests", func() {
},
}
})
It("Reports failure events", func() {

It("Reports failure events", func() {
By("Create an invalid ManagedOSVersionChannel")
ch := catalog.NewManagedOSVersionChannel(
fleetNamespace, channelName, "", "10m",
Expand All @@ -100,7 +100,7 @@ var _ = Describe("ManagedOSVersionChannel e2e tests", func() {
Eventually(func() string {
gCh := &elementalv1.ManagedOSVersionChannel{}
_ = cl.Get(ctx, client.ObjectKey{
Name: "testchannel",
Name: channelName,
Namespace: fleetNamespace,
}, gCh)

Expand Down Expand Up @@ -134,7 +134,7 @@ var _ = Describe("ManagedOSVersionChannel e2e tests", func() {

gCh := &elementalv1.ManagedOSVersionChannel{}
Expect(cl.Get(ctx, client.ObjectKey{
Name: "testchannel",
Name: channelName,
Namespace: fleetNamespace,
}, gCh)).To(Succeed())
Expect(gCh.Spec.Type).To(Equal("json"))
Expand Down Expand Up @@ -203,7 +203,7 @@ var _ = Describe("ManagedOSVersionChannel e2e tests", func() {

gCh := &elementalv1.ManagedOSVersionChannel{}
Expect(cl.Get(ctx, client.ObjectKey{
Name: "testchannel",
Name: channelName,
Namespace: fleetNamespace,
}, gCh)).To(Succeed())
Expect(gCh.Spec.Type).To(Equal("custom"))
Expand Down

0 comments on commit a6e7be4

Please sign in to comment.