Skip to content

Commit dd36cf5

Browse files
authored
Merge pull request #2986 from bnallapeta/v1beta2-controllers
⚠️ Migrate controllers and types to CAPI v1beta2 conditions
2 parents ec10b2a + 90bf8d5 commit dd36cf5

File tree

337 files changed

+14614
-1672
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

337 files changed

+14614
-1672
lines changed

.golangci.yml

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ linters:
9393
- pkg: sigs.k8s.io/cluster-api-provider-openstack/api/v1alpha1
9494
alias: infrav1alpha1
9595
- pkg: sigs.k8s.io/cluster-api-provider-openstack/api/v1beta1
96+
alias: infrav1beta1
97+
- pkg: sigs.k8s.io/cluster-api-provider-openstack/api/v1beta2
9698
alias: infrav1
9799
- pkg: sigs.k8s.io/cluster-api-provider-openstack/pkg/utils/errors
98100
alias: capoerrors
@@ -105,14 +107,8 @@ linters:
105107
alias: clusterv1
106108
- pkg: sigs.k8s.io/cluster-api/api/core/v1beta1
107109
alias: clusterv1beta1
108-
- pkg: sigs.k8s.io/cluster-api/util/deprecated/v1beta1/conditions
109-
alias: v1beta1conditions
110-
- pkg: sigs.k8s.io/cluster-api/util/deprecated/v1beta1/conditions/v1beta2
111-
alias: deprecatedv1beta2conditions
112-
- pkg: sigs.k8s.io/cluster-api/util/conditions/deprecated/v1beta1
113-
alias: deprecatedv1beta1conditions
114-
- pkg: sigs.k8s.io/cluster-api/util/deprecated/v1beta1/patch
115-
alias: v1beta1patch
110+
- pkg: sigs.k8s.io/cluster-api/util/conditions
111+
alias: conditions
116112
- pkg: sigs.k8s.io/cluster-api/api/ipam/v1beta2
117113
alias: ipamv1
118114
# CABPK
@@ -183,18 +179,6 @@ linters:
183179
- linters:
184180
- staticcheck
185181
text: 'SA1019: "sigs.k8s.io/cluster-api/api/core/v1beta1" is deprecated: This package is deprecated and is going to be removed when support for v1beta1 will be dropped.'
186-
- linters:
187-
- staticcheck
188-
text: 'SA1019: "sigs.k8s.io/cluster-api/util/deprecated/v1beta1/conditions" is deprecated: This package is deprecated and is going to be removed when support for v1beta1 will be dropped. Please see https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more details.'
189-
- linters:
190-
- staticcheck
191-
text: 'SA1019: .*.Status.Ready is deprecated: This field is deprecated and will be removed in a future API version. Use status.conditions to determine the ready state of the *'
192-
- linters:
193-
- staticcheck
194-
text: 'SA1019: .*.Status.FailureReason is deprecated: This field is deprecated and will be removed in a future API version. Use status.conditions to report failures.'
195-
- linters:
196-
- staticcheck
197-
text: 'SA1019: .*.Status.FailureMessage is deprecated: This field is deprecated and will be removed in a future API version. Use status.conditions to report failures.'
198182
paths:
199183
- zz_generated.*\.go$
200184
- third_party$

Makefile

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ generate-controller-gen: $(CONTROLLER_GEN)
328328
generate-codegen: generate-controller-gen $(OPENAPI_GEN) $(APPLYCONFIGURATION_GEN) $(CLIENT_GEN) $(LISTER_GEN) $(INFORMER_GEN)
329329
@echo "** Generating OpenAPI definitions **"
330330
# The package list includes:
331-
# - CAPO's own API packages (v1alpha1, v1beta1) that have // +k8s:openapi-gen= markers
331+
# - CAPO's own API packages (v1alpha1, v1beta1, v1beta2) that have // +k8s:openapi-gen= markers
332332
# - Dependency packages from CAPI and k8s.io that are referenced by CAPO's APIs
333333
# - Base k8s.io/apimachinery packages
334334
$(OPENAPI_GEN) \
@@ -339,6 +339,7 @@ generate-codegen: generate-controller-gen $(OPENAPI_GEN) $(APPLYCONFIGURATION_GE
339339
--report-filename=./api_violations.report \
340340
sigs.k8s.io/cluster-api-provider-openstack/api/v1alpha1 \
341341
sigs.k8s.io/cluster-api-provider-openstack/api/v1beta1 \
342+
sigs.k8s.io/cluster-api-provider-openstack/api/v1beta2 \
342343
sigs.k8s.io/cluster-api/api/core/v1beta2 \
343344
sigs.k8s.io/cluster-api/api/ipam/v1beta2 \
344345
sigs.k8s.io/cluster-api/api/core/v1beta1 \
@@ -357,7 +358,8 @@ generate-codegen: generate-controller-gen $(OPENAPI_GEN) $(APPLYCONFIGURATION_GE
357358
--output-pkg=sigs.k8s.io/cluster-api-provider-openstack/pkg/generated/applyconfiguration \
358359
--openapi-schema=./openapi.json \
359360
sigs.k8s.io/cluster-api-provider-openstack/api/v1alpha1 \
360-
sigs.k8s.io/cluster-api-provider-openstack/api/v1beta1
361+
sigs.k8s.io/cluster-api-provider-openstack/api/v1beta1 \
362+
sigs.k8s.io/cluster-api-provider-openstack/api/v1beta2
361363
@echo "** Generating clientset code **"
362364
$(CLIENT_GEN) \
363365
--go-header-file=./hack/boilerplate.go.txt \
@@ -367,14 +369,16 @@ generate-codegen: generate-controller-gen $(OPENAPI_GEN) $(APPLYCONFIGURATION_GE
367369
--input-base=sigs.k8s.io/cluster-api-provider-openstack \
368370
--apply-configuration-package=sigs.k8s.io/cluster-api-provider-openstack/pkg/generated/applyconfiguration \
369371
--input=api/v1alpha1 \
370-
--input=api/v1beta1
372+
--input=api/v1beta1 \
373+
--input=api/v1beta2
371374
@echo "** Generating lister code **"
372375
$(LISTER_GEN) \
373376
--go-header-file=./hack/boilerplate.go.txt \
374377
--output-dir=./pkg/generated/listers \
375378
--output-pkg=sigs.k8s.io/cluster-api-provider-openstack/pkg/generated/listers \
376379
sigs.k8s.io/cluster-api-provider-openstack/api/v1alpha1 \
377-
sigs.k8s.io/cluster-api-provider-openstack/api/v1beta1
380+
sigs.k8s.io/cluster-api-provider-openstack/api/v1beta1 \
381+
sigs.k8s.io/cluster-api-provider-openstack/api/v1beta2
378382
@echo "** Generating informer code **"
379383
$(INFORMER_GEN) \
380384
--go-header-file=./hack/boilerplate.go.txt \
@@ -383,7 +387,8 @@ generate-codegen: generate-controller-gen $(OPENAPI_GEN) $(APPLYCONFIGURATION_GE
383387
--versioned-clientset-package=sigs.k8s.io/cluster-api-provider-openstack/pkg/generated/clientset/clientset \
384388
--listers-package=sigs.k8s.io/cluster-api-provider-openstack/pkg/generated/listers \
385389
sigs.k8s.io/cluster-api-provider-openstack/api/v1alpha1 \
386-
sigs.k8s.io/cluster-api-provider-openstack/api/v1beta1
390+
sigs.k8s.io/cluster-api-provider-openstack/api/v1beta1 \
391+
sigs.k8s.io/cluster-api-provider-openstack/api/v1beta2
387392

388393
.PHONY: generate-manifests
389394
generate-manifests: $(CONTROLLER_GEN) ## Generate manifests e.g. CRD, RBAC etc.
@@ -578,10 +583,10 @@ templates: templates/cluster-template.yaml \
578583
templates/cluster-template-flatcar-sysext.yaml \
579584
templates/cluster-template-capi-v1beta1.yaml
580585

581-
templates/cluster-template.yaml: kustomize/v1beta1/default $(KUSTOMIZE) FORCE
586+
templates/cluster-template.yaml: kustomize/default $(KUSTOMIZE) FORCE
582587
$(KUSTOMIZE) build "$<" > "$@"
583588

584-
templates/cluster-template-%.yaml: kustomize/v1beta1/% $(KUSTOMIZE) FORCE
589+
templates/cluster-template-%.yaml: kustomize/% $(KUSTOMIZE) FORCE
585590
$(KUSTOMIZE) build "$<" > "$@"
586591

587592
.PHONY: release-templates

api/v1alpha1/openstackfloatingippool_types.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ import (
2020
"fmt"
2121

2222
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
23-
clusterv1beta1 "sigs.k8s.io/cluster-api/api/core/v1beta1"
2423

25-
infrav1 "sigs.k8s.io/cluster-api-provider-openstack/api/v1beta1"
24+
infrav1 "sigs.k8s.io/cluster-api-provider-openstack/api/v1beta2"
2625
)
2726

2827
const (
@@ -88,7 +87,7 @@ type OpenStackFloatingIPPoolStatus struct {
8887
// +optional
8988
FloatingIPNetwork *infrav1.NetworkStatus `json:"floatingIPNetwork,omitempty"`
9089

91-
Conditions clusterv1beta1.Conditions `json:"conditions,omitempty"`
90+
Conditions []metav1.Condition `json:"conditions,omitempty"`
9291
}
9392

9493
//+kubebuilder:object:root=true
@@ -114,12 +113,12 @@ type OpenStackFloatingIPPoolList struct {
114113
}
115114

116115
// GetConditions returns the observations of the operational state of the OpenStackFloatingIPPool resource.
117-
func (r *OpenStackFloatingIPPool) GetConditions() clusterv1beta1.Conditions {
116+
func (r *OpenStackFloatingIPPool) GetConditions() []metav1.Condition {
118117
return r.Status.Conditions
119118
}
120119

121120
// SetConditions sets the underlying service state of the OpenStackFloatingIPPool to the predescribed clusterv1.Conditions.
122-
func (r *OpenStackFloatingIPPool) SetConditions(conditions clusterv1beta1.Conditions) {
121+
func (r *OpenStackFloatingIPPool) SetConditions(conditions []metav1.Condition) {
123122
r.Status.Conditions = conditions
124123
}
125124

api/v1alpha1/openstackserver_types.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ import (
2121
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2222
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
2323
runtime "k8s.io/apimachinery/pkg/runtime"
24-
clusterv1beta1 "sigs.k8s.io/cluster-api/api/core/v1beta1"
2524

26-
infrav1 "sigs.k8s.io/cluster-api-provider-openstack/api/v1beta1"
25+
infrav1 "sigs.k8s.io/cluster-api-provider-openstack/api/v1beta2"
2726
"sigs.k8s.io/cluster-api-provider-openstack/pkg/utils/optional"
2827
)
2928

@@ -153,7 +152,7 @@ type OpenStackServerStatus struct {
153152

154153
// Conditions defines current service state of the OpenStackServer.
155154
// +optional
156-
Conditions clusterv1beta1.Conditions `json:"conditions,omitempty"`
155+
Conditions []metav1.Condition `json:"conditions,omitempty"`
157156
}
158157

159158
// +genclient
@@ -185,12 +184,12 @@ type OpenStackServerList struct {
185184
}
186185

187186
// GetConditions returns the observations of the operational state of the OpenStackServer resource.
188-
func (r *OpenStackServer) GetConditions() clusterv1beta1.Conditions {
187+
func (r *OpenStackServer) GetConditions() []metav1.Condition {
189188
return r.Status.Conditions
190189
}
191190

192191
// SetConditions sets the underlying service state of the OpenStackServer to the predescribed clusterv1.Conditions.
193-
func (r *OpenStackServer) SetConditions(conditions clusterv1beta1.Conditions) {
192+
func (r *OpenStackServer) SetConditions(conditions []metav1.Condition) {
194193
r.Status.Conditions = conditions
195194
}
196195

api/v1alpha1/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ limitations under the License.
1717
package v1alpha1
1818

1919
import (
20-
infrav1 "sigs.k8s.io/cluster-api-provider-openstack/api/v1beta1"
20+
infrav1 "sigs.k8s.io/cluster-api-provider-openstack/api/v1beta2"
2121
)
2222

2323
// ResolvedServerSpec contains resolved references to resources required by the server.

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 16 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)