Skip to content

Commit 81010e8

Browse files
Merge pull request #213 from elfosardo/update-ironic29
✨ Update supported versions for ironic-image release-29.0
2 parents da86336 + eb265a1 commit 81010e8

File tree

4 files changed

+127
-148
lines changed

4 files changed

+127
-148
lines changed

api/v1alpha1/ironic_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222

2323
var (
2424
VersionLatest = Version{}
25+
Version290 = Version{Major: 29, Minor: 0}
2526
Version280 = Version{Major: 28, Minor: 0}
2627
Version270 = Version{Major: 27, Minor: 0}
2728
)
@@ -33,6 +34,7 @@ var (
3334
// expectations.
3435
var SupportedVersions = map[Version]string{
3536
VersionLatest: "latest",
37+
Version290: "release-29.0",
3638
Version280: "release-28.0",
3739
Version270: "release-27.0",
3840
}

pkg/ironic/validation_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ func TestValidateIronic(t *testing.T) {
214214
Ironic: metal3api.IronicSpec{
215215
Version: "42.42",
216216
},
217-
ExpectedError: "version 42.42 is not supported, supported versions are 27.0, 28.0, latest",
217+
ExpectedError: "version 42.42 is not supported, supported versions are 27.0, 28.0, 29.0, latest",
218218
},
219219
}
220220

pkg/ironic/version_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ func TestWithIronicOverrides(t *testing.T) {
6262

6363
Ironic: metal3api.Ironic{
6464
Spec: metal3api.IronicSpec{
65-
Version: "28.0",
65+
Version: "29.0",
6666
},
6767
},
6868

6969
Expected: VersionInfo{
70-
InstalledVersion: metal3api.Version280,
71-
IronicImage: "quay.io/metal3-io/ironic:release-28.0",
70+
InstalledVersion: metal3api.Version290,
71+
IronicImage: "quay.io/metal3-io/ironic:release-29.0",
7272
KeepalivedImage: "quay.io/metal3-io/keepalived:latest",
7373
RamdiskDownloaderImage: "quay.io/metal3-io/ironic-ipa-downloader:latest",
7474
MariaDBImage: "quay.io/metal3-io/mariadb:latest",
@@ -79,13 +79,13 @@ func TestWithIronicOverrides(t *testing.T) {
7979

8080
Ironic: metal3api.Ironic{
8181
Spec: metal3api.IronicSpec{
82-
Version: "27.0",
82+
Version: "28.0",
8383
},
8484
},
8585

8686
Expected: VersionInfo{
87-
InstalledVersion: metal3api.Version270,
88-
IronicImage: "quay.io/metal3-io/ironic:release-27.0",
87+
InstalledVersion: metal3api.Version280,
88+
IronicImage: "quay.io/metal3-io/ironic:release-28.0",
8989
KeepalivedImage: "quay.io/metal3-io/keepalived:latest",
9090
RamdiskDownloaderImage: "quay.io/metal3-io/ironic-ipa-downloader:latest",
9191
MariaDBImage: "quay.io/metal3-io/mariadb:latest",

test/suite_test.go

Lines changed: 118 additions & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,13 @@ import (
6161
// every time the API is changed. The listing of all versions is here:
6262
// https://docs.openstack.org/ironic/latest/contributor/webapi-version-history.html
6363
const (
64-
// NOTE(dtantsur): latest is now at least 1.95, so we can rely on this
65-
// value to check that specifying Version: 27.0 actually installs 27.0
64+
// NOTE(dtantsur): latest is now at least 1.96, so we can rely on this
65+
// value to check that specifying Version: 29.0 actually installs 29.0
6666
apiVersionIn270 = "1.94"
6767
apiVersionIn280 = "1.95"
68+
apiVersionIn290 = "1.96"
6869
// Update this periodically to make sure we're installing the latest version by default
69-
knownAPIMinorVersion = 95
70+
knownAPIMinorVersion = 96
7071

7172
numberOfNodes = 100
7273
)
@@ -609,6 +610,109 @@ func saveEvents(namespace string) {
609610
}
610611
}
611612

613+
func testUpgrade(ironicVersionOld string, ironicVersionNew string, apiVersionOld string, apiVersionNew string, namespace string) {
614+
if customImage != "" || customImageVersion != "" {
615+
Skip("skipping because a custom image is provided")
616+
}
617+
618+
name := types.NamespacedName{
619+
Name: "test-ironic",
620+
Namespace: namespace,
621+
}
622+
623+
ironic := buildIronic(name, metal3api.IronicSpec{
624+
Version: ironicVersionOld,
625+
})
626+
err := k8sClient.Create(ctx, ironic)
627+
Expect(err).NotTo(HaveOccurred())
628+
DeferCleanup(func() {
629+
CollectLogs(namespace)
630+
DeleteAndWait(ironic)
631+
})
632+
633+
ironic = WaitForIronic(name)
634+
VerifyIronic(ironic, TestAssumptions{maxAPIVersion: apiVersionOld})
635+
636+
By(fmt.Sprintf("upgrading to Ironic %s", ironicVersionNew))
637+
638+
patch := client.MergeFrom(ironic.DeepCopy())
639+
ironic.Spec.Version = ironicVersionNew
640+
err = k8sClient.Patch(ctx, ironic, patch)
641+
Expect(err).NotTo(HaveOccurred())
642+
643+
ironic = WaitForUpgrade(name, ironicVersionOld, ironicVersionNew)
644+
VerifyIronic(ironic, TestAssumptions{maxAPIVersion: apiVersionNew})
645+
646+
By(fmt.Sprintf("downgrading to Ironic %s (without a database)", ironicVersionOld))
647+
648+
patch = client.MergeFrom(ironic.DeepCopy())
649+
ironic.Spec.Version = ironicVersionOld
650+
err = k8sClient.Patch(ctx, ironic, patch)
651+
Expect(err).NotTo(HaveOccurred())
652+
653+
ironic = WaitForUpgrade(name, ironicVersionNew, ironicVersionOld)
654+
VerifyIronic(ironic, TestAssumptions{maxAPIVersion: apiVersionOld})
655+
}
656+
657+
func testUpgradeHA(ironicVersionOld string, ironicVersionNew string, apiVersionOld string, apiVersionNew string, namespace string) {
658+
if customImage != "" || customImageVersion != "" {
659+
Skip("skipping because a custom image is provided")
660+
}
661+
662+
name := types.NamespacedName{
663+
Name: "test-ironic",
664+
Namespace: namespace,
665+
}
666+
667+
secret := &corev1.Secret{
668+
ObjectMeta: metav1.ObjectMeta{
669+
Name: fmt.Sprintf("%s-api", name.Name),
670+
Namespace: namespace,
671+
},
672+
Data: map[string][]byte{
673+
corev1.BasicAuthUsernameKey: []byte("admin"),
674+
corev1.BasicAuthPasswordKey: []byte("test-password"),
675+
},
676+
Type: corev1.SecretTypeBasicAuth,
677+
}
678+
err := k8sClient.Create(ctx, secret)
679+
Expect(err).NotTo(HaveOccurred())
680+
681+
// FIXME(dtantsur): use a real database in this test, e.g. one deployed by mariadb-operator.
682+
ironicDB := buildDatabase(name, secret.Name)
683+
err = k8sClient.Create(ctx, ironicDB)
684+
Expect(err).NotTo(HaveOccurred())
685+
686+
ironic := buildIronic(name, metal3api.IronicSpec{
687+
Database: &metal3api.Database{
688+
CredentialsName: secret.Name,
689+
Host: fmt.Sprintf("%s-database.%s.svc", ironicDB.Name, namespace),
690+
Name: "ironic",
691+
},
692+
HighAvailability: true,
693+
Version: ironicVersionOld,
694+
})
695+
err = k8sClient.Create(ctx, ironic)
696+
Expect(err).NotTo(HaveOccurred())
697+
DeferCleanup(func() {
698+
CollectLogs(namespace)
699+
DeleteAndWait(ironic)
700+
})
701+
702+
ironic = WaitForIronic(name)
703+
VerifyIronic(ironic, TestAssumptions{maxAPIVersion: apiVersionOld})
704+
705+
By(fmt.Sprintf("upgrading to Ironic %s", ironicVersionNew))
706+
707+
patch := client.MergeFrom(ironic.DeepCopy())
708+
ironic.Spec.Version = ironicVersionNew
709+
err = k8sClient.Patch(ctx, ironic, patch)
710+
Expect(err).NotTo(HaveOccurred())
711+
712+
ironic = WaitForUpgrade(name, ironicVersionOld, ironicVersionNew)
713+
VerifyIronic(ironic, TestAssumptions{maxAPIVersion: apiVersionNew})
714+
}
715+
612716
var _ = Describe("Ironic object tests", func() {
613717
var namespace string
614718

@@ -733,91 +837,15 @@ var _ = Describe("Ironic object tests", func() {
733837
})
734838

735839
It("creates Ironic 27.0 and upgrades to 28.0", Label("v270-to-280"), func() {
736-
if customImage != "" || customImageVersion != "" {
737-
Skip("skipping because a custom image is provided")
738-
}
739-
740-
name := types.NamespacedName{
741-
Name: "test-ironic",
742-
Namespace: namespace,
743-
}
744-
745-
ironic := buildIronic(name, metal3api.IronicSpec{
746-
Version: "27.0",
747-
})
748-
err := k8sClient.Create(ctx, ironic)
749-
Expect(err).NotTo(HaveOccurred())
750-
DeferCleanup(func() {
751-
CollectLogs(namespace)
752-
DeleteAndWait(ironic)
753-
})
754-
755-
ironic = WaitForIronic(name)
756-
VerifyIronic(ironic, TestAssumptions{maxAPIVersion: apiVersionIn270})
757-
758-
By("upgrading to Ironic 28.0")
759-
760-
patch := client.MergeFrom(ironic.DeepCopy())
761-
ironic.Spec.Version = "28.0"
762-
err = k8sClient.Patch(ctx, ironic, patch)
763-
Expect(err).NotTo(HaveOccurred())
764-
765-
ironic = WaitForUpgrade(name, "27.0", "28.0")
766-
VerifyIronic(ironic, TestAssumptions{maxAPIVersion: apiVersionIn280})
767-
768-
By("downgrading to Ironic 27.0 (without a database)")
769-
770-
patch = client.MergeFrom(ironic.DeepCopy())
771-
ironic.Spec.Version = "27.0"
772-
err = k8sClient.Patch(ctx, ironic, patch)
773-
Expect(err).NotTo(HaveOccurred())
774-
775-
ironic = WaitForUpgrade(name, "28.0", "27.0")
776-
VerifyIronic(ironic, TestAssumptions{maxAPIVersion: apiVersionIn270})
840+
testUpgrade("27.0", "28.0", apiVersionIn270, apiVersionIn280, namespace)
777841
})
778842

779-
It("creates Ironic 28.0 and upgrades to latest", Label("v280-to-latest"), func() {
780-
if customImage != "" || customImageVersion != "" {
781-
Skip("skipping because a custom image is provided")
782-
}
783-
784-
name := types.NamespacedName{
785-
Name: "test-ironic",
786-
Namespace: namespace,
787-
}
788-
789-
ironic := buildIronic(name, metal3api.IronicSpec{
790-
Version: "28.0",
791-
})
792-
err := k8sClient.Create(ctx, ironic)
793-
Expect(err).NotTo(HaveOccurred())
794-
DeferCleanup(func() {
795-
CollectLogs(namespace)
796-
DeleteAndWait(ironic)
797-
})
798-
799-
ironic = WaitForIronic(name)
800-
VerifyIronic(ironic, TestAssumptions{maxAPIVersion: apiVersionIn280})
801-
802-
By("upgrading to Ironic latest")
803-
804-
patch := client.MergeFrom(ironic.DeepCopy())
805-
ironic.Spec.Version = "latest"
806-
err = k8sClient.Patch(ctx, ironic, patch)
807-
Expect(err).NotTo(HaveOccurred())
808-
809-
ironic = WaitForUpgrade(name, "28.0", "latest")
810-
VerifyIronic(ironic, TestAssumptions{})
811-
812-
By("downgrading to Ironic 28.0 (without a database)")
813-
814-
patch = client.MergeFrom(ironic.DeepCopy())
815-
ironic.Spec.Version = "28.0"
816-
err = k8sClient.Patch(ctx, ironic, patch)
817-
Expect(err).NotTo(HaveOccurred())
843+
It("creates Ironic 28.0 and upgrades to 29.0", Label("v280-to-290"), func() {
844+
testUpgrade("28.0", "29.0", apiVersionIn280, apiVersionIn290, namespace)
845+
})
818846

819-
ironic = WaitForUpgrade(name, "latest", "28.0")
820-
VerifyIronic(ironic, TestAssumptions{maxAPIVersion: apiVersionIn280})
847+
It("creates Ironic 29.0 and upgrades to latest", Label("v290-to-latest"), func() {
848+
testUpgrade("29.0", "latest", apiVersionIn290, "", namespace)
821849
})
822850

823851
It("refuses to downgrade Ironic with a database", Label("no-db-downgrade"), func() {
@@ -854,63 +882,12 @@ var _ = Describe("Ironic object tests", func() {
854882
_ = WaitForIronicFailure(name, "Ironic does not support downgrades", true)
855883
})
856884

857-
It("creates Ironic 28.0 with HA and upgrades to latest", Label("ha-v280-to-latest"), func() {
858-
if customImage != "" || customImageVersion != "" {
859-
Skip("skipping because a custom image is provided")
860-
}
861-
862-
name := types.NamespacedName{
863-
Name: "test-ironic",
864-
Namespace: namespace,
865-
}
866-
867-
secret := &corev1.Secret{
868-
ObjectMeta: metav1.ObjectMeta{
869-
Name: fmt.Sprintf("%s-api", name.Name),
870-
Namespace: namespace,
871-
},
872-
Data: map[string][]byte{
873-
corev1.BasicAuthUsernameKey: []byte("admin"),
874-
corev1.BasicAuthPasswordKey: []byte("test-password"),
875-
},
876-
Type: corev1.SecretTypeBasicAuth,
877-
}
878-
err := k8sClient.Create(ctx, secret)
879-
Expect(err).NotTo(HaveOccurred())
880-
881-
// FIXME(dtantsur): use a real database in this test, e.g. one deployed by mariadb-operator.
882-
ironicDB := buildDatabase(name, secret.Name)
883-
err = k8sClient.Create(ctx, ironicDB)
884-
Expect(err).NotTo(HaveOccurred())
885-
886-
ironic := buildIronic(name, metal3api.IronicSpec{
887-
Database: &metal3api.Database{
888-
CredentialsName: secret.Name,
889-
Host: fmt.Sprintf("%s-database.%s.svc", ironicDB.Name, namespace),
890-
Name: "ironic",
891-
},
892-
HighAvailability: true,
893-
Version: "28.0",
894-
})
895-
err = k8sClient.Create(ctx, ironic)
896-
Expect(err).NotTo(HaveOccurred())
897-
DeferCleanup(func() {
898-
CollectLogs(namespace)
899-
DeleteAndWait(ironic)
900-
})
901-
902-
ironic = WaitForIronic(name)
903-
VerifyIronic(ironic, TestAssumptions{maxAPIVersion: apiVersionIn280})
904-
905-
By("upgrading to Ironic latest")
906-
907-
patch := client.MergeFrom(ironic.DeepCopy())
908-
ironic.Spec.Version = "latest"
909-
err = k8sClient.Patch(ctx, ironic, patch)
910-
Expect(err).NotTo(HaveOccurred())
885+
It("creates Ironic 28.0 with HA and upgrades to 29.0", Label("ha-v280-to-v290"), func() {
886+
testUpgradeHA("28.0", "29.0", apiVersionIn280, apiVersionIn290, namespace)
887+
})
911888

912-
ironic = WaitForUpgrade(name, "28.0", "latest")
913-
VerifyIronic(ironic, TestAssumptions{})
889+
It("creates Ironic 29.0 with HA and upgrades to latest", Label("ha-v290-to-latest"), func() {
890+
testUpgradeHA("29.0", "latest", apiVersionIn290, "", namespace)
914891
})
915892

916893
It("creates Ironic with keepalived and DHCP", Label("keepalived-dnsmasq"), func() {

0 commit comments

Comments
 (0)