From a1f0ffd357321a96713f641db89925a2a5e7f240 Mon Sep 17 00:00:00 2001
From: Matthew Booth
@@ -1575,10 +1575,10 @@ address in any subnet of the port’s network.image
-
-ImageFilter
+
+ImageParam
(Appears on: -OpenStackMachineSpec) +ImageParam)
-
ImageFilter describes the data needed to identify which image to use. If ID is provided it is required that all other fields are unset.
+ImageFilter describes a query for an image.
-id + name string |
(Optional)
- The ID of the desired image. If ID is provided, the other filters cannot be provided. Must be in UUID format. +The name of the desired image. If specified, the combination of name and tags must return a single matching image or an error will be raised. |
-name + tags + +[]string + + |
+
+(Optional)
+ The tags associated with the desired image. If specified, the combination of name and tags must return a single matching image or an error will be raised. + |
+
+(Appears on: +OpenStackMachineSpec) +
++
ImageParam describes a glance image. It can be specified by ID or filter.
+ +Field | +Description | +
---|---|
+id string |
(Optional)
- The name of the desired image. If specified, the combination of name and tags must return a single matching image or an error will be raised. +ID is the uuid of the image. ID will not be validated before use. |
-tags + filter -[]string + +ImageFilter + |
(Optional)
- The tags associated with the desired image. If specified, the combination of name and tags must return a single matching image or an error will be raised. +Filter describes a query for an image. If specified, the combination +of name and tags must return a single matching image or an error will +be raised. |
image - -ImageFilter + +ImageParam |
@@ -3430,8 +3465,8 @@ string
image - -ImageFilter + +ImageParam |
diff --git a/kustomize/v1beta1/default/cluster-template.yaml b/kustomize/v1beta1/default/cluster-template.yaml
index 52ab6c2f88..ae7db083cf 100644
--- a/kustomize/v1beta1/default/cluster-template.yaml
+++ b/kustomize/v1beta1/default/cluster-template.yaml
@@ -97,7 +97,8 @@ spec:
spec:
flavor: ${OPENSTACK_CONTROL_PLANE_MACHINE_FLAVOR}
image:
- name: ${OPENSTACK_IMAGE_NAME}
+ filter:
+ name: ${OPENSTACK_IMAGE_NAME}
sshKeyName: ${OPENSTACK_SSH_KEY_NAME}
---
apiVersion: cluster.x-k8s.io/v1beta1
@@ -133,7 +134,8 @@ spec:
spec:
flavor: ${OPENSTACK_NODE_MACHINE_FLAVOR}
image:
- name: ${OPENSTACK_IMAGE_NAME}
+ filter:
+ name: ${OPENSTACK_IMAGE_NAME}
sshKeyName: ${OPENSTACK_SSH_KEY_NAME}
---
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
diff --git a/pkg/cloud/services/compute/instance.go b/pkg/cloud/services/compute/instance.go
index eebfd9278d..ac0b377bed 100644
--- a/pkg/cloud/services/compute/instance.go
+++ b/pkg/cloud/services/compute/instance.go
@@ -18,6 +18,7 @@ package compute
import (
"context"
+ "errors"
"fmt"
"os"
"strconv"
@@ -332,12 +333,17 @@ func applyServerGroupID(opts servers.CreateOptsBuilder, serverGroupID string) se
}
// Helper function for getting image ID from name, ID, or tags.
-func (s *Service) GetImageID(image infrav1.ImageFilter) (string, error) {
+func (s *Service) GetImageID(image infrav1.ImageParam) (string, error) {
if image.ID != nil {
return *image.ID, nil
}
- listOpts := filterconvert.ImageFilterToListOpts(&image)
+ if image.Filter == nil {
+ // Should have been caught by validation
+ return "", errors.New("image id and filter are both nil")
+ }
+
+ listOpts := filterconvert.ImageFilterToListOpts(image.Filter)
allImages, err := s.getImageClient().ListImages(listOpts)
if err != nil {
return "", err
diff --git a/pkg/cloud/services/compute/instance_test.go b/pkg/cloud/services/compute/instance_test.go
index af9214e8a7..b571b25021 100644
--- a/pkg/cloud/services/compute/instance_test.go
+++ b/pkg/cloud/services/compute/instance_test.go
@@ -47,22 +47,26 @@ func TestService_getImageID(t *testing.T) {
tests := []struct {
testName string
- image infrav1.ImageFilter
+ image infrav1.ImageParam
expect func(m *mock.MockImageClientMockRecorder)
want string
wantErr bool
}{
{
testName: "Return image ID when ID given",
- image: infrav1.ImageFilter{ID: &imageID},
+ image: infrav1.ImageParam{ID: &imageID},
want: imageID,
expect: func(m *mock.MockImageClientMockRecorder) {},
wantErr: false,
},
{
testName: "Return image ID when name given",
- image: infrav1.ImageFilter{Name: &imageName},
- want: imageID,
+ image: infrav1.ImageParam{
+ Filter: &infrav1.ImageFilter{
+ Name: &imageName,
+ },
+ },
+ want: imageID,
expect: func(m *mock.MockImageClientMockRecorder) {
m.ListImages(images.ListOpts{Name: imageName}).Return(
[]images.Image{{ID: imageID, Name: imageName}},
@@ -72,8 +76,12 @@ func TestService_getImageID(t *testing.T) {
},
{
testName: "Return image ID when tags given",
- image: infrav1.ImageFilter{Tags: imageTags},
- want: imageID,
+ image: infrav1.ImageParam{
+ Filter: &infrav1.ImageFilter{
+ Tags: imageTags,
+ },
+ },
+ want: imageID,
expect: func(m *mock.MockImageClientMockRecorder) {
m.ListImages(images.ListOpts{Tags: imageTags}).Return(
[]images.Image{{ID: imageID, Name: imageName, Tags: imageTags}},
@@ -83,7 +91,11 @@ func TestService_getImageID(t *testing.T) {
},
{
testName: "Return no results",
- image: infrav1.ImageFilter{Name: &imageName},
+ image: infrav1.ImageParam{
+ Filter: &infrav1.ImageFilter{
+ Name: &imageName,
+ },
+ },
expect: func(m *mock.MockImageClientMockRecorder) {
m.ListImages(images.ListOpts{Name: imageName}).Return(
[]images.Image{},
@@ -94,7 +106,11 @@ func TestService_getImageID(t *testing.T) {
},
{
testName: "Return multiple results",
- image: infrav1.ImageFilter{Name: &imageName},
+ image: infrav1.ImageParam{
+ Filter: &infrav1.ImageFilter{
+ Name: &imageName,
+ },
+ },
expect: func(m *mock.MockImageClientMockRecorder) {
m.ListImages(images.ListOpts{Name: "test-image"}).Return(
[]images.Image{
@@ -107,7 +123,11 @@ func TestService_getImageID(t *testing.T) {
},
{
testName: "OpenStack returns error",
- image: infrav1.ImageFilter{Name: &imageName},
+ image: infrav1.ImageParam{
+ Filter: &infrav1.ImageFilter{
+ Name: &imageName,
+ },
+ },
expect: func(m *mock.MockImageClientMockRecorder) {
m.ListImages(images.ListOpts{Name: "test-image"}).Return(
nil,
diff --git a/pkg/cloud/services/compute/referenced_resources_test.go b/pkg/cloud/services/compute/referenced_resources_test.go
index 1f13ce5427..64adaf3641 100644
--- a/pkg/cloud/services/compute/referenced_resources_test.go
+++ b/pkg/cloud/services/compute/referenced_resources_test.go
@@ -68,7 +68,7 @@ func Test_ResolveReferencedMachineResources(t *testing.T) {
testName: "Resources ID passed",
spec: infrav1.OpenStackMachineSpec{
ServerGroup: &infrav1.ServerGroupFilter{ID: serverGroupID1},
- Image: infrav1.ImageFilter{ID: pointer.String(imageID1)},
+ Image: infrav1.ImageParam{ID: pointer.String(imageID1)},
},
want: &infrav1.ResolvedMachineSpec{
ImageID: imageID1,
@@ -79,7 +79,7 @@ func Test_ResolveReferencedMachineResources(t *testing.T) {
{
testName: "Only image ID passed: want image id and default ports",
spec: infrav1.OpenStackMachineSpec{
- Image: infrav1.ImageFilter{ID: pointer.String(imageID1)},
+ Image: infrav1.ImageParam{ID: pointer.String(imageID1)},
},
want: &infrav1.ResolvedMachineSpec{
ImageID: imageID1,
@@ -89,7 +89,7 @@ func Test_ResolveReferencedMachineResources(t *testing.T) {
{
testName: "Server group empty",
spec: infrav1.OpenStackMachineSpec{
- Image: infrav1.ImageFilter{ID: pointer.String(imageID1)},
+ Image: infrav1.ImageParam{ID: pointer.String(imageID1)},
ServerGroup: &infrav1.ServerGroupFilter{},
},
want: &infrav1.ResolvedMachineSpec{
@@ -100,7 +100,7 @@ func Test_ResolveReferencedMachineResources(t *testing.T) {
{
testName: "Server group by Name not found",
spec: infrav1.OpenStackMachineSpec{
- Image: infrav1.ImageFilter{ID: pointer.String(imageID1)},
+ Image: infrav1.ImageParam{ID: pointer.String(imageID1)},
ServerGroup: &infrav1.ServerGroupFilter{Name: "test-server-group"},
},
expectComputeMock: func(m *mock.MockComputeClientMockRecorder) {
@@ -114,7 +114,11 @@ func Test_ResolveReferencedMachineResources(t *testing.T) {
{
testName: "Image by Name not found",
spec: infrav1.OpenStackMachineSpec{
- Image: infrav1.ImageFilter{Name: pointer.String("test-image")},
+ Image: infrav1.ImageParam{
+ Filter: &infrav1.ImageFilter{
+ Name: pointer.String("test-image"),
+ },
+ },
},
expectImageMock: func(m *mock.MockImageClientMockRecorder) {
m.ListImages(images.ListOpts{Name: "test-image"}).Return([]images.Image{}, nil)
@@ -125,7 +129,7 @@ func Test_ResolveReferencedMachineResources(t *testing.T) {
{
testName: "Ports set",
spec: infrav1.OpenStackMachineSpec{
- Image: infrav1.ImageFilter{ID: pointer.String(imageID1)},
+ Image: infrav1.ImageParam{ID: pointer.String(imageID1)},
Ports: []infrav1.PortOpts{
{
Network: &infrav1.NetworkFilter{
diff --git a/pkg/webhooks/openstackcluster_webhook_test.go b/pkg/webhooks/openstackcluster_webhook_test.go
index 3d65376486..09c18dcc70 100644
--- a/pkg/webhooks/openstackcluster_webhook_test.go
+++ b/pkg/webhooks/openstackcluster_webhook_test.go
@@ -85,7 +85,11 @@ func TestOpenStackCluster_ValidateUpdate(t *testing.T) {
},
Bastion: &infrav1.Bastion{
Spec: &infrav1.OpenStackMachineSpec{
- Image: infrav1.ImageFilter{Name: pointer.String("foobar")},
+ Image: infrav1.ImageParam{
+ Filter: &infrav1.ImageFilter{
+ Name: pointer.String("foobar"),
+ },
+ },
Flavor: "minimal",
},
Enabled: true,
@@ -105,7 +109,11 @@ func TestOpenStackCluster_ValidateUpdate(t *testing.T) {
},
Bastion: &infrav1.Bastion{
Spec: &infrav1.OpenStackMachineSpec{
- Image: infrav1.ImageFilter{Name: pointer.String("foobarbaz")},
+ Image: infrav1.ImageParam{
+ Filter: &infrav1.ImageFilter{
+ Name: pointer.String("foobarbaz"),
+ },
+ },
Flavor: "medium",
},
Enabled: true,
@@ -454,7 +462,11 @@ func TestOpenStackCluster_ValidateUpdate(t *testing.T) {
Enabled: true,
Spec: &infrav1.OpenStackMachineSpec{
Flavor: "m1.small",
- Image: infrav1.ImageFilter{Name: pointer.String("ubuntu")},
+ Image: infrav1.ImageParam{
+ Filter: &infrav1.ImageFilter{
+ Name: pointer.String("ubuntu"),
+ },
+ },
},
},
},
@@ -481,7 +493,11 @@ func TestOpenStackCluster_ValidateUpdate(t *testing.T) {
Enabled: false,
Spec: &infrav1.OpenStackMachineSpec{
Flavor: "m1.small",
- Image: infrav1.ImageFilter{Name: pointer.String("ubuntu")},
+ Image: infrav1.ImageParam{
+ Filter: &infrav1.ImageFilter{
+ Name: pointer.String("ubuntu"),
+ },
+ },
},
},
},
diff --git a/pkg/webhooks/openstackmachinetemplate_webhook_test.go b/pkg/webhooks/openstackmachinetemplate_webhook_test.go
index 899cf509f1..6b148f3bfa 100644
--- a/pkg/webhooks/openstackmachinetemplate_webhook_test.go
+++ b/pkg/webhooks/openstackmachinetemplate_webhook_test.go
@@ -47,7 +47,11 @@ func TestOpenStackMachineTemplate_ValidateUpdate(t *testing.T) {
Template: infrav1.OpenStackMachineTemplateResource{
Spec: infrav1.OpenStackMachineSpec{
Flavor: "foo",
- Image: infrav1.ImageFilter{Name: pointer.String("bar")},
+ Image: infrav1.ImageParam{
+ Filter: &infrav1.ImageFilter{
+ Name: pointer.String("bar"),
+ },
+ },
},
},
},
@@ -57,7 +61,11 @@ func TestOpenStackMachineTemplate_ValidateUpdate(t *testing.T) {
Template: infrav1.OpenStackMachineTemplateResource{
Spec: infrav1.OpenStackMachineSpec{
Flavor: "foo",
- Image: infrav1.ImageFilter{Name: pointer.String("NewImage")},
+ Image: infrav1.ImageParam{
+ Filter: &infrav1.ImageFilter{
+ Name: pointer.String("NewImage"),
+ },
+ },
},
},
},
@@ -72,7 +80,11 @@ func TestOpenStackMachineTemplate_ValidateUpdate(t *testing.T) {
Template: infrav1.OpenStackMachineTemplateResource{
Spec: infrav1.OpenStackMachineSpec{
Flavor: "foo",
- Image: infrav1.ImageFilter{Name: pointer.String("bar")},
+ Image: infrav1.ImageParam{
+ Filter: &infrav1.ImageFilter{
+ Name: pointer.String("bar"),
+ },
+ },
},
},
},
@@ -85,7 +97,11 @@ func TestOpenStackMachineTemplate_ValidateUpdate(t *testing.T) {
Template: infrav1.OpenStackMachineTemplateResource{
Spec: infrav1.OpenStackMachineSpec{
Flavor: "foo",
- Image: infrav1.ImageFilter{Name: pointer.String("bar")},
+ Image: infrav1.ImageParam{
+ Filter: &infrav1.ImageFilter{
+ Name: pointer.String("bar"),
+ },
+ },
},
},
},
@@ -102,7 +118,11 @@ func TestOpenStackMachineTemplate_ValidateUpdate(t *testing.T) {
Template: infrav1.OpenStackMachineTemplateResource{
Spec: infrav1.OpenStackMachineSpec{
Flavor: "foo",
- Image: infrav1.ImageFilter{Name: pointer.String("bar")},
+ Image: infrav1.ImageParam{
+ Filter: &infrav1.ImageFilter{
+ Name: pointer.String("bar"),
+ },
+ },
},
},
},
@@ -112,7 +132,11 @@ func TestOpenStackMachineTemplate_ValidateUpdate(t *testing.T) {
Template: infrav1.OpenStackMachineTemplateResource{
Spec: infrav1.OpenStackMachineSpec{
Flavor: "foo",
- Image: infrav1.ImageFilter{Name: pointer.String("NewImage")},
+ Image: infrav1.ImageParam{
+ Filter: &infrav1.ImageFilter{
+ Name: pointer.String("NewImage"),
+ },
+ },
},
},
},
@@ -127,7 +151,11 @@ func TestOpenStackMachineTemplate_ValidateUpdate(t *testing.T) {
Template: infrav1.OpenStackMachineTemplateResource{
Spec: infrav1.OpenStackMachineSpec{
Flavor: "foo",
- Image: infrav1.ImageFilter{Name: pointer.String("bar")},
+ Image: infrav1.ImageParam{
+ Filter: &infrav1.ImageFilter{
+ Name: pointer.String("bar"),
+ },
+ },
},
},
},
@@ -142,7 +170,11 @@ func TestOpenStackMachineTemplate_ValidateUpdate(t *testing.T) {
Template: infrav1.OpenStackMachineTemplateResource{
Spec: infrav1.OpenStackMachineSpec{
Flavor: "foo",
- Image: infrav1.ImageFilter{Name: pointer.String("NewImage")},
+ Image: infrav1.ImageParam{
+ Filter: &infrav1.ImageFilter{
+ Name: pointer.String("NewImage"),
+ },
+ },
},
},
},
diff --git a/test/e2e/data/kustomize/k8s-upgrade/upgrade-from-template.yaml b/test/e2e/data/kustomize/k8s-upgrade/upgrade-from-template.yaml
index 6e9098977b..d49208116d 100644
--- a/test/e2e/data/kustomize/k8s-upgrade/upgrade-from-template.yaml
+++ b/test/e2e/data/kustomize/k8s-upgrade/upgrade-from-template.yaml
@@ -8,7 +8,8 @@ spec:
spec:
flavor: ${OPENSTACK_CONTROL_PLANE_MACHINE_FLAVOR}
image:
- name: ${OPENSTACK_IMAGE_NAME_UPGRADE_FROM}
+ filter:
+ name: ${OPENSTACK_IMAGE_NAME_UPGRADE_FROM}
sshKeyName: ${OPENSTACK_SSH_KEY_NAME}
tags:
- control-plane
@@ -22,7 +23,8 @@ spec:
spec:
flavor: ${OPENSTACK_NODE_MACHINE_FLAVOR}
image:
- name: ${OPENSTACK_IMAGE_NAME_UPGRADE_FROM}
+ filter:
+ name: ${OPENSTACK_IMAGE_NAME_UPGRADE_FROM}
sshKeyName: ${OPENSTACK_SSH_KEY_NAME}
tags:
- machine
diff --git a/test/e2e/data/kustomize/k8s-upgrade/upgrade-to-template.yaml b/test/e2e/data/kustomize/k8s-upgrade/upgrade-to-template.yaml
index 39272254fd..466cb7931b 100644
--- a/test/e2e/data/kustomize/k8s-upgrade/upgrade-to-template.yaml
+++ b/test/e2e/data/kustomize/k8s-upgrade/upgrade-to-template.yaml
@@ -15,7 +15,8 @@ spec:
spec:
flavor: ${OPENSTACK_CONTROL_PLANE_MACHINE_FLAVOR}
image:
- name: ${OPENSTACK_IMAGE_NAME}
+ filter:
+ name: ${OPENSTACK_IMAGE_NAME}
sshKeyName: ${OPENSTACK_SSH_KEY_NAME}
tags:
- control-plane
@@ -31,7 +32,8 @@ spec:
spec:
flavor: ${OPENSTACK_NODE_MACHINE_FLAVOR}
image:
- name: ${OPENSTACK_IMAGE_NAME}
+ filter:
+ name: ${OPENSTACK_IMAGE_NAME}
sshKeyName: ${OPENSTACK_SSH_KEY_NAME}
tags:
- machine
diff --git a/test/e2e/suites/apivalidations/filters_test.go b/test/e2e/suites/apivalidations/filters_test.go
index b4e256cff8..ac576951c5 100644
--- a/test/e2e/suites/apivalidations/filters_test.go
+++ b/test/e2e/suites/apivalidations/filters_test.go
@@ -36,7 +36,11 @@ var _ = Describe("Filter API validations", func() {
namespace = createNamespace()
// Initialise a basic machine object in the correct namespace
- machine = &infrav1.OpenStackMachine{}
+ machine = &infrav1.OpenStackMachine{
+ Spec: infrav1.OpenStackMachineSpec{
+ Image: infrav1.ImageParam{Filter: &infrav1.ImageFilter{Name: pointer.String("test-image")}},
+ },
+ }
machine.Namespace = namespace.Name
machine.GenerateName = "machine-"
@@ -177,27 +181,31 @@ var _ = Describe("Filter API validations", func() {
const imageUUID = "5a78f794-cdc3-48d2-8d9f-0fd472fdd743"
- It("should not allow both ID and Name of ImageFilter to be set", func() {
+ It("should not allow both ID and Filter to be set", func() {
By("Creating a machine")
- machine.Spec.Image = infrav1.ImageFilter{
- ID: pointer.String(imageUUID),
- Name: pointer.String("bar"),
+ machine.Spec.Image = infrav1.ImageParam{
+ ID: pointer.String(imageUUID),
+ Filter: &infrav1.ImageFilter{
+ Name: pointer.String("bar"),
+ },
}
Expect(k8sClient.Create(ctx, machine)).NotTo(Succeed(), "OpenStackMachine creation should fail")
})
It("should not allow both ID and Tags of ImageFilter to be set", func() {
By("Creating a machine")
- machine.Spec.Image = infrav1.ImageFilter{
- ID: pointer.String(imageUUID),
- Tags: []string{"bar", "baz"},
+ machine.Spec.Image = infrav1.ImageParam{
+ ID: pointer.String(imageUUID),
+ Filter: &infrav1.ImageFilter{
+ Tags: []string{"bar", "baz"},
+ },
}
Expect(k8sClient.Create(ctx, machine)).NotTo(Succeed(), "OpenStackMachine creation should fail")
})
It("should allow UUID ID of ImageFilter to be set", func() {
By("Creating a machine")
- machine.Spec.Image = infrav1.ImageFilter{
+ machine.Spec.Image = infrav1.ImageParam{
ID: pointer.String(imageUUID),
}
Expect(k8sClient.Create(ctx, machine)).To(Succeed(), "OpenStackMachine creation should succeed")
@@ -205,7 +213,7 @@ var _ = Describe("Filter API validations", func() {
It("should not allow non-UUID ID of ImageFilter to be set", func() {
By("Creating a machine")
- machine.Spec.Image = infrav1.ImageFilter{
+ machine.Spec.Image = infrav1.ImageParam{
ID: pointer.String("foo"),
}
Expect(k8sClient.Create(ctx, machine)).NotTo(Succeed(), "OpenStackMachine creation should fail")
@@ -213,10 +221,20 @@ var _ = Describe("Filter API validations", func() {
It("should allow Name and Tags of ImageFilter to be set", func() {
By("Creating a machine")
- machine.Spec.Image = infrav1.ImageFilter{
- Name: pointer.String("bar"),
- Tags: []string{"bar", "baz"},
+ machine.Spec.Image = infrav1.ImageParam{
+ Filter: &infrav1.ImageFilter{
+ Name: pointer.String("bar"),
+ Tags: []string{"bar", "baz"},
+ },
}
Expect(k8sClient.Create(ctx, machine)).To(Succeed(), "OpenStackMachine creation should succeed")
})
+
+ It("should not allow a non-nil, empty image filter", func() {
+ By("Creating a machine")
+ machine.Spec.Image = infrav1.ImageParam{
+ Filter: &infrav1.ImageFilter{},
+ }
+ Expect(k8sClient.Create(ctx, machine)).NotTo(Succeed(), "OpenStackMachine creation should fail")
+ })
})
diff --git a/test/e2e/suites/apivalidations/openstackcluster_test.go b/test/e2e/suites/apivalidations/openstackcluster_test.go
index f84e1d13d7..947f9b7b84 100644
--- a/test/e2e/suites/apivalidations/openstackcluster_test.go
+++ b/test/e2e/suites/apivalidations/openstackcluster_test.go
@@ -92,7 +92,11 @@ var _ = Describe("OpenStackCluster API validations", func() {
cluster.Spec.Bastion = &infrav1.Bastion{
Enabled: true,
Spec: &infrav1.OpenStackMachineSpec{
- Image: infrav1.ImageFilter{Name: pointer.String("fake-image")},
+ Image: infrav1.ImageParam{
+ Filter: &infrav1.ImageFilter{
+ Name: pointer.String("fake-image"),
+ },
+ },
},
}
Expect(k8sClient.Create(ctx, cluster)).To(Succeed(), "OpenStackCluster creation should succeed")
@@ -120,7 +124,11 @@ var _ = Describe("OpenStackCluster API validations", func() {
cluster.Spec.Bastion = &infrav1.Bastion{
Enabled: true,
Spec: &infrav1.OpenStackMachineSpec{
- Image: infrav1.ImageFilter{Name: pointer.String("fake-image")},
+ Image: infrav1.ImageParam{
+ Filter: &infrav1.ImageFilter{
+ Name: pointer.String("fake-image"),
+ },
+ },
},
FloatingIP: pointer.String("10.0.0.0"),
}
@@ -131,7 +139,11 @@ var _ = Describe("OpenStackCluster API validations", func() {
cluster.Spec.Bastion = &infrav1.Bastion{
Enabled: true,
Spec: &infrav1.OpenStackMachineSpec{
- Image: infrav1.ImageFilter{Name: pointer.String("fake-image")},
+ Image: infrav1.ImageParam{
+ Filter: &infrav1.ImageFilter{
+ Name: pointer.String("fake-image"),
+ },
+ },
},
FloatingIP: pointer.String("foobar"),
}
diff --git a/test/e2e/suites/apivalidations/openstackmachine_test.go b/test/e2e/suites/apivalidations/openstackmachine_test.go
index c984ab1e61..4e888a3a41 100644
--- a/test/e2e/suites/apivalidations/openstackmachine_test.go
+++ b/test/e2e/suites/apivalidations/openstackmachine_test.go
@@ -35,7 +35,11 @@ var _ = Describe("OpenStackMachine API validations", func() {
namespace = createNamespace()
// Initialise a basic machine object in the correct namespace
- machine = &infrav1.OpenStackMachine{}
+ machine = &infrav1.OpenStackMachine{
+ Spec: infrav1.OpenStackMachineSpec{
+ Image: infrav1.ImageParam{Filter: &infrav1.ImageFilter{Name: pointer.String("test-image")}},
+ },
+ }
machine.Namespace = namespace.Name
machine.GenerateName = "machine-"
})
diff --git a/test/e2e/suites/e2e/e2e_test.go b/test/e2e/suites/e2e/e2e_test.go
index ff0cb9c7ba..c271143483 100644
--- a/test/e2e/suites/e2e/e2e_test.go
+++ b/test/e2e/suites/e2e/e2e_test.go
@@ -859,8 +859,10 @@ func makeOpenStackMachineTemplate(namespace, clusterName, name string) *infrav1.
Template: infrav1.OpenStackMachineTemplateResource{
Spec: infrav1.OpenStackMachineSpec{
Flavor: e2eCtx.E2EConfig.GetVariable(shared.OpenStackNodeMachineFlavor),
- Image: infrav1.ImageFilter{
- Name: pointer.String(e2eCtx.E2EConfig.GetVariable(shared.OpenStackImageName)),
+ Image: infrav1.ImageParam{
+ Filter: &infrav1.ImageFilter{
+ Name: pointer.String(e2eCtx.E2EConfig.GetVariable(shared.OpenStackImageName)),
+ },
},
SSHKeyName: shared.DefaultSSHKeyPairName,
IdentityRef: &infrav1.OpenStackIdentityReference{
@@ -883,8 +885,10 @@ func makeOpenStackMachineTemplateWithPortOptions(namespace, clusterName, name st
Template: infrav1.OpenStackMachineTemplateResource{
Spec: infrav1.OpenStackMachineSpec{
Flavor: e2eCtx.E2EConfig.GetVariable(shared.OpenStackNodeMachineFlavor),
- Image: infrav1.ImageFilter{
- Name: pointer.String(e2eCtx.E2EConfig.GetVariable(shared.OpenStackImageName)),
+ Image: infrav1.ImageParam{
+ Filter: &infrav1.ImageFilter{
+ Name: pointer.String(e2eCtx.E2EConfig.GetVariable(shared.OpenStackImageName)),
+ },
},
SSHKeyName: shared.DefaultSSHKeyPairName,
IdentityRef: &infrav1.OpenStackIdentityReference{