Skip to content

Commit 9cc8e7f

Browse files
committed
Stop serving v1alpha7
The API was marked as deprecated in v0.11.x, we propose to stop serving it in v0.12.x and we'll remove it in v0.13.x. That would give ~1 year to our users to update their manifests, since the v1beta1 release.
1 parent d741f26 commit 9cc8e7f

11 files changed

+8
-122
lines changed

api/v1alpha7/openstackcluster_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ type OpenStackClusterStatus struct {
234234
// +kubebuilder:object:root=true
235235
// +kubebuilder:resource:path=openstackclusters,scope=Namespaced,categories=cluster-api,shortName=osc
236236
// +kubebuilder:subresource:status
237+
// +kubebuilder:unservedversion
237238
// +kubebuilder:deprecatedversion:warning="The v1alpha7 version of OpenStackCluster has been deprecated and will be removed in a future release."
238239
// +kubebuilder:printcolumn:name="Cluster",type="string",JSONPath=".metadata.labels.cluster\\.x-k8s\\.io/cluster-name",description="Cluster to which this OpenStackCluster belongs"
239240
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.ready",description="Cluster infrastructure is ready for OpenStack instances"

api/v1alpha7/openstackclustertemplate_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ type OpenStackClusterTemplateSpec struct {
3232

3333
// +genclient
3434
// +kubebuilder:object:root=true
35+
// +kubebuilder:unservedversion
3536
// +kubebuilder:deprecatedversion:warning="The v1alpha7 version of OpenStackClusterTemplate has been deprecated and will be removed in a future release."
3637
// +kubebuilder:resource:path=openstackclustertemplates,scope=Namespaced,categories=cluster-api,shortName=osct
3738

api/v1alpha7/openstackmachine_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ type OpenStackMachineStatus struct {
145145

146146
// +genclient
147147
// +kubebuilder:object:root=true
148+
// +kubebuilder:unservedversion
148149
// +kubebuilder:deprecatedversion:warning="The v1alpha7 version of OpenStackMachine has been deprecated and will be removed in a future release."
149150
// +kubebuilder:resource:path=openstackmachines,scope=Namespaced,categories=cluster-api,shortName=osm
150151
// +kubebuilder:subresource:status

api/v1alpha7/openstackmachinetemplate_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ type OpenStackMachineTemplateSpec struct {
2727

2828
// +genclient
2929
// +kubebuilder:object:root=true
30+
// +kubebuilder:unservedversion
3031
// +kubebuilder:deprecatedversion:warning="The v1alpha7 version of OpenStackMachineTemplate has been deprecated and will be removed in a future release."
3132
// +kubebuilder:resource:path=openstackmachinetemplates,scope=Namespaced,categories=cluster-api,shortName=osmt
3233

config/crd/bases/infrastructure.cluster.x-k8s.io_openstackclusters.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/infrastructure.cluster.x-k8s.io_openstackclustertemplates.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/infrastructure.cluster.x-k8s.io_openstackmachines.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/infrastructure.cluster.x-k8s.io_openstackmachinetemplates.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/e2e/suites/apivalidations/openstackcluster_test.go

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,14 @@ import (
2121

2222
. "github.com/onsi/ginkgo/v2"
2323
. "github.com/onsi/gomega"
24-
"github.com/onsi/gomega/format"
2524
corev1 "k8s.io/api/core/v1"
2625
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
2726
"k8s.io/apimachinery/pkg/runtime"
2827
"k8s.io/apimachinery/pkg/runtime/schema"
2928
"k8s.io/apimachinery/pkg/types"
3029
"k8s.io/utils/ptr"
3130
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
32-
"sigs.k8s.io/controller-runtime/pkg/client"
3331

34-
infrav1alpha7 "sigs.k8s.io/cluster-api-provider-openstack/api/v1alpha7"
3532
infrav1 "sigs.k8s.io/cluster-api-provider-openstack/api/v1beta1"
3633
)
3734

@@ -239,79 +236,4 @@ var _ = Describe("OpenStackCluster API validations", func() {
239236
Expect(createObj(u)).To(Succeed(), "OpenStackCluster creation should succeed")
240237
})
241238
})
242-
243-
Context("v1alpha7", func() {
244-
var cluster *infrav1alpha7.OpenStackCluster //nolint: staticcheck
245-
246-
BeforeEach(func() {
247-
// Initialise a basic cluster object in the correct namespace
248-
cluster = &infrav1alpha7.OpenStackCluster{} //nolint: staticcheck
249-
cluster.Namespace = namespace.Name
250-
cluster.GenerateName = clusterNamePrefix
251-
})
252-
253-
It("should restore cluster spec idempotently after controller writes to controlPlaneEndpoint", func() {
254-
// Set identityRef.Kind, as it will be lost if the restorer does not execute
255-
cluster.Spec.IdentityRef = &infrav1alpha7.OpenStackIdentityReference{
256-
Kind: "FakeKind",
257-
Name: "identity-ref",
258-
}
259-
Expect(createObj(cluster)).To(Succeed(), "OpenStackCluster creation should succeed")
260-
261-
// Fetch the infrav1 version of the cluster
262-
infrav1Cluster := &infrav1.OpenStackCluster{}
263-
Expect(k8sClient.Get(ctx, types.NamespacedName{Name: cluster.Name, Namespace: cluster.Namespace}, infrav1Cluster)).To(Succeed(), "OpenStackCluster fetch should succeed")
264-
265-
// Update the infrav1 cluster to set the control plane endpoint
266-
infrav1Cluster.Spec.ControlPlaneEndpoint = &clusterv1.APIEndpoint{
267-
Host: "foo",
268-
Port: 1234,
269-
}
270-
Expect(k8sClient.Update(ctx, infrav1Cluster)).To(Succeed(), "Setting control plane endpoint should succeed")
271-
272-
// Fetch the v1alpha7 version of the cluster and ensure that both the new control plane endpoint and the identityRef.Kind are present
273-
cluster = &infrav1alpha7.OpenStackCluster{} //nolint:staticcheck
274-
Expect(k8sClient.Get(ctx, types.NamespacedName{Name: infrav1Cluster.Name, Namespace: infrav1Cluster.Namespace}, cluster)).To(Succeed(), "OpenStackCluster fetch should succeed")
275-
Expect(cluster.Spec.ControlPlaneEndpoint).To(Equal(*infrav1Cluster.Spec.ControlPlaneEndpoint), "Control plane endpoint should be restored")
276-
Expect(cluster.Spec.IdentityRef.Kind).To(Equal("FakeKind"), "IdentityRef.Kind should be restored")
277-
})
278-
279-
It("should not enable an explicitly disabled bastion when converting to v1beta1", func() {
280-
cluster.Spec.Bastion = &infrav1alpha7.Bastion{Enabled: false}
281-
Expect(createObj(cluster)).To(Succeed(), "OpenStackCluster creation should succeed")
282-
283-
// Fetch the infrav1 version of the cluster
284-
infrav1Cluster := &infrav1.OpenStackCluster{}
285-
Expect(k8sClient.Get(ctx, types.NamespacedName{Name: cluster.Name, Namespace: cluster.Namespace}, infrav1Cluster)).To(Succeed(), "OpenStackCluster fetch should succeed")
286-
287-
infrav1Bastion := infrav1Cluster.Spec.Bastion
288-
289-
// NOTE(mdbooth): It may be reasonable to remove the
290-
// bastion if it is disabled with no other properties.
291-
// It would be reasonable to update the assertions
292-
// accordingly if we did that.
293-
Expect(infrav1Bastion).ToNot(BeNil(), "Bastion should not have been removed")
294-
Expect(infrav1Bastion.Enabled).To(Equal(ptr.To(false)), "Bastion should remain disabled")
295-
})
296-
297-
It("should downgrade cleanly from infrav1", func() {
298-
infrav1Cluster := &infrav1.OpenStackCluster{}
299-
infrav1Cluster.Namespace = namespace.Name
300-
infrav1Cluster.GenerateName = clusterNamePrefix
301-
infrav1Cluster.Spec.IdentityRef.CloudName = "test-cloud"
302-
infrav1Cluster.Spec.IdentityRef.Name = "test-credentials"
303-
Expect(createObj(infrav1Cluster)).To(Succeed(), "infrav1 OpenStackCluster creation should succeed")
304-
305-
// Just fetching the object as v1alpha7 doesn't trigger
306-
// validation failure, so we first fetch it and then
307-
// patch the object with identical contents. The patch
308-
// triggers a validation failure.
309-
cluster := &infrav1alpha7.OpenStackCluster{} //nolint: staticcheck
310-
Expect(k8sClient.Get(ctx, types.NamespacedName{Name: infrav1Cluster.Name, Namespace: infrav1Cluster.Namespace}, cluster)).To(Succeed(), "OpenStackCluster fetch should succeed")
311-
312-
setObjectGVK(cluster)
313-
cluster.ManagedFields = nil
314-
Expect(k8sClient.Patch(ctx, cluster, client.Apply, client.FieldOwner("test"), client.ForceOwnership)).To(Succeed(), format.Object(cluster, 4))
315-
})
316-
})
317239
})

test/e2e/suites/apivalidations/openstackmachine_test.go

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,9 @@ import (
2121

2222
. "github.com/onsi/ginkgo/v2"
2323
. "github.com/onsi/gomega"
24-
"github.com/onsi/gomega/format"
2524
corev1 "k8s.io/api/core/v1"
26-
"k8s.io/apimachinery/pkg/types"
2725
"k8s.io/utils/ptr"
28-
"sigs.k8s.io/controller-runtime/pkg/client"
2926

30-
infrav1alpha7 "sigs.k8s.io/cluster-api-provider-openstack/api/v1alpha7"
3127
infrav1 "sigs.k8s.io/cluster-api-provider-openstack/api/v1beta1"
3228
)
3329

@@ -548,30 +544,4 @@ var _ = Describe("OpenStackMachine API validations", func() {
548544
Expect(k8sClient.Create(ctx, machineSN)).NotTo(Succeed(), "Creating a machine with string type but number value scheduler hint property should fail.")
549545
})
550546
})
551-
552-
Context("v1alpha7", func() {
553-
It("should downgrade cleanly from infrav1", func() {
554-
infrav1Machine := &infrav1.OpenStackMachine{}
555-
infrav1Machine.Namespace = namespace.Name
556-
infrav1Machine.GenerateName = clusterNamePrefix
557-
infrav1Machine.Spec.IdentityRef = &infrav1.OpenStackIdentityReference{
558-
CloudName: "test-cloud",
559-
Name: "test-credentials",
560-
}
561-
infrav1Machine.Spec.Image.ID = ptr.To("de9872ee-0c2c-44ed-9414-90163c8b0e0d")
562-
infrav1Machine.Spec.Flavor = ptr.To("flavor-name")
563-
Expect(createObj(infrav1Machine)).To(Succeed(), "infrav1 OpenStackMachine creation should succeed")
564-
565-
// Just fetching the object as v1alpha7 doesn't trigger
566-
// validation failure, so we first fetch it and then
567-
// patch the object with identical contents. The patch
568-
// triggers a validation failure.
569-
machine := &infrav1alpha7.OpenStackMachine{} //nolint: staticcheck
570-
Expect(k8sClient.Get(ctx, types.NamespacedName{Name: infrav1Machine.Name, Namespace: infrav1Machine.Namespace}, machine)).To(Succeed(), "OpenStackMachine fetch should succeed")
571-
572-
setObjectGVK(machine)
573-
machine.ManagedFields = nil
574-
Expect(k8sClient.Patch(ctx, machine, client.Apply, client.FieldOwner("test"), client.ForceOwnership)).To(Succeed(), format.Object(machine, 4))
575-
})
576-
})
577547
})

0 commit comments

Comments
 (0)