Skip to content

Commit ae19e11

Browse files
authored
Merge pull request kubernetes-sigs#8 from Leaseweb/capi15
Update to CAPI 1.5
2 parents 2eb1a84 + d244282 commit ae19e11

Some content is hidden

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

43 files changed

+783
-1154
lines changed

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ managers:
8989

9090
.PHONY: manager-cloudstack-infrastructure
9191
manager-cloudstack-infrastructure: ## Build manager binary.
92-
CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -ldflags "${LDFLAGS} -extldflags '-static'" -o $(BIN_DIR)/manager .
92+
CGO_ENABLED=0 go build -ldflags "${LDFLAGS} -extldflags '-static'" -o $(BIN_DIR)/manager .
9393

94-
export K8S_VERSION=1.26.1
94+
export K8S_VERSION=1.27.1
9595
$(KUBECTL) $(API_SERVER) $(ETCD) &:
9696
cd $(TOOLS_DIR) && curl --silent -L "https://go.kubebuilder.io/test-tools/${K8S_VERSION}/$(shell go env GOOS)/$(shell go env GOARCH)" --output - | \
9797
tar -C ./ --strip-components=1 -zvxf -
@@ -243,7 +243,7 @@ delete-kind-cluster:
243243
kind delete cluster --name $(KIND_CLUSTER_NAME)
244244

245245
cluster-api: ## Clone cluster-api repository for tilt use.
246-
git clone --branch v1.4.8 --depth 1 https://github.com/kubernetes-sigs/cluster-api.git
246+
git clone --branch v1.5.4 --depth 1 https://github.com/kubernetes-sigs/cluster-api.git
247247

248248
cluster-api/tilt-settings.json: hack/tilt-settings.json cluster-api
249249
cp ./hack/tilt-settings.json cluster-api

api/v1beta3/cloudstackcluster_webhook.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
ctrl "sigs.k8s.io/controller-runtime"
2929
logf "sigs.k8s.io/controller-runtime/pkg/log"
3030
"sigs.k8s.io/controller-runtime/pkg/webhook"
31+
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
3132
)
3233

3334
// log is for logging in this package.
@@ -54,7 +55,7 @@ func (r *CloudStackCluster) Default() {
5455
}
5556

5657
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
57-
func (r *CloudStackCluster) ValidateCreate() error {
58+
func (r *CloudStackCluster) ValidateCreate() (admission.Warnings, error) {
5859
cloudstackclusterlog.V(1).Info("entered validate create webhook", "api resource name", r.Name)
5960

6061
var errorList field.ErrorList
@@ -81,18 +82,18 @@ func (r *CloudStackCluster) ValidateCreate() error {
8182
}
8283
}
8384

84-
return webhookutil.AggregateObjErrors(r.GroupVersionKind().GroupKind(), r.Name, errorList)
85+
return nil, webhookutil.AggregateObjErrors(r.GroupVersionKind().GroupKind(), r.Name, errorList)
8586
}
8687

8788
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
88-
func (r *CloudStackCluster) ValidateUpdate(old runtime.Object) error {
89+
func (r *CloudStackCluster) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
8990
cloudstackclusterlog.V(1).Info("entered validate update webhook", "api resource name", r.Name)
9091

9192
spec := r.Spec
9293

9394
oldCluster, ok := old.(*CloudStackCluster)
9495
if !ok {
95-
return errors.NewBadRequest(fmt.Sprintf("expected a CloudStackCluster but got a %T", old))
96+
return nil, errors.NewBadRequest(fmt.Sprintf("expected a CloudStackCluster but got a %T", old))
9697
}
9798
oldSpec := oldCluster.Spec
9899

@@ -117,7 +118,7 @@ func (r *CloudStackCluster) ValidateUpdate(old runtime.Object) error {
117118
)
118119
}
119120

120-
return webhookutil.AggregateObjErrors(r.GroupVersionKind().GroupKind(), r.Name, errorList)
121+
return nil, webhookutil.AggregateObjErrors(r.GroupVersionKind().GroupKind(), r.Name, errorList)
121122
}
122123

123124
// ValidateFailureDomainUpdates verifies that at least one failure domain has not been deleted, and
@@ -158,8 +159,8 @@ func FailureDomainsEqual(fd1, fd2 CloudStackFailureDomainSpec) bool {
158159
}
159160

160161
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
161-
func (r *CloudStackCluster) ValidateDelete() error {
162+
func (r *CloudStackCluster) ValidateDelete() (admission.Warnings, error) {
162163
cloudstackclusterlog.V(1).Info("entered validate delete webhook", "api resource name", r.Name)
163164
// No deletion validations. Deletion webhook not enabled.
164-
return nil
165+
return nil, nil
165166
}

api/v1beta3/cloudstackmachine_webhook.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
ctrl "sigs.k8s.io/controller-runtime"
2828
logf "sigs.k8s.io/controller-runtime/pkg/log"
2929
"sigs.k8s.io/controller-runtime/pkg/webhook"
30+
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
3031
)
3132

3233
// log is for logging in this package.
@@ -53,7 +54,7 @@ func (r *CloudStackMachine) Default() {
5354
}
5455

5556
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
56-
func (r *CloudStackMachine) ValidateCreate() error {
57+
func (r *CloudStackMachine) ValidateCreate() (admission.Warnings, error) {
5758
cloudstackmachinelog.V(1).Info("entered validate create webhook", "api resource name", r.Name)
5859

5960
var errorList field.ErrorList
@@ -64,18 +65,18 @@ func (r *CloudStackMachine) ValidateCreate() error {
6465
errorList = webhookutil.EnsureIntFieldsAreNotNegative(r.Spec.DiskOffering.CustomSize, "customSizeInGB", errorList)
6566
}
6667

67-
return webhookutil.AggregateObjErrors(r.GroupVersionKind().GroupKind(), r.Name, errorList)
68+
return nil, webhookutil.AggregateObjErrors(r.GroupVersionKind().GroupKind(), r.Name, errorList)
6869
}
6970

7071
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
71-
func (r *CloudStackMachine) ValidateUpdate(old runtime.Object) error {
72+
func (r *CloudStackMachine) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
7273
cloudstackmachinelog.V(1).Info("entered validate update webhook", "api resource name", r.Name)
7374

7475
var errorList field.ErrorList
7576

7677
oldMachine, ok := old.(*CloudStackMachine)
7778
if !ok {
78-
return errors.NewBadRequest(fmt.Sprintf("expected a CloudStackMachine but got a %T", old))
79+
return nil, errors.NewBadRequest(fmt.Sprintf("expected a CloudStackMachine but got a %T", old))
7980
}
8081
oldSpec := oldMachine.Spec
8182

@@ -100,12 +101,12 @@ func (r *CloudStackMachine) ValidateUpdate(old runtime.Object) error {
100101
errorList = append(errorList, field.Forbidden(field.NewPath("spec", "AffinityGroupIDs"), "AffinityGroupIDs"))
101102
}
102103

103-
return webhookutil.AggregateObjErrors(r.GroupVersionKind().GroupKind(), r.Name, errorList)
104+
return nil, webhookutil.AggregateObjErrors(r.GroupVersionKind().GroupKind(), r.Name, errorList)
104105
}
105106

106107
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
107-
func (r *CloudStackMachine) ValidateDelete() error {
108+
func (r *CloudStackMachine) ValidateDelete() (admission.Warnings, error) {
108109
cloudstackmachinelog.V(1).Info("entered validate delete webhook", "api resource name", r.Name)
109110
// No deletion validations. Deletion webhook not enabled.
110-
return nil
111+
return nil, nil
111112
}

api/v1beta3/cloudstackmachinetemplate_webhook.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
ctrl "sigs.k8s.io/controller-runtime"
2929
logf "sigs.k8s.io/controller-runtime/pkg/log"
3030
"sigs.k8s.io/controller-runtime/pkg/webhook"
31+
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
3132
)
3233

3334
// log is for logging in this package.
@@ -54,7 +55,7 @@ func (r *CloudStackMachineTemplate) Default() {
5455
}
5556

5657
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
57-
func (r *CloudStackMachineTemplate) ValidateCreate() error {
58+
func (r *CloudStackMachineTemplate) ValidateCreate() (admission.Warnings, error) {
5859
cloudstackmachinetemplatelog.V(1).Info("entered validate create webhook", "api resource name", r.Name)
5960

6061
var errorList field.ErrorList
@@ -75,16 +76,16 @@ func (r *CloudStackMachineTemplate) ValidateCreate() error {
7576
errorList = webhookutil.EnsureAtLeastOneFieldExists(spec.Offering.ID, spec.Offering.Name, "Offering", errorList)
7677
errorList = webhookutil.EnsureAtLeastOneFieldExists(spec.Template.ID, spec.Template.Name, "Template", errorList)
7778

78-
return webhookutil.AggregateObjErrors(r.GroupVersionKind().GroupKind(), r.Name, errorList)
79+
return nil, webhookutil.AggregateObjErrors(r.GroupVersionKind().GroupKind(), r.Name, errorList)
7980
}
8081

8182
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
82-
func (r *CloudStackMachineTemplate) ValidateUpdate(old runtime.Object) error {
83+
func (r *CloudStackMachineTemplate) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
8384
cloudstackmachinetemplatelog.V(1).Info("entered validate update webhook", "api resource name", r.Name)
8485

8586
oldMachineTemplate, ok := old.(*CloudStackMachineTemplate)
8687
if !ok {
87-
return errors.NewBadRequest(fmt.Sprintf("expected a CloudStackMachineTemplate but got a %T", old))
88+
return nil, errors.NewBadRequest(fmt.Sprintf("expected a CloudStackMachineTemplate but got a %T", old))
8889
}
8990

9091
// CloudStackMachineTemplateSpec.CloudStackMachineTemplateResource.CloudStackMachineSpec
@@ -108,12 +109,12 @@ func (r *CloudStackMachineTemplate) ValidateUpdate(old runtime.Object) error {
108109
errorList = append(errorList, field.Forbidden(field.NewPath("spec", "AffinityGroupIDs"), "AffinityGroupIDs"))
109110
}
110111

111-
return webhookutil.AggregateObjErrors(r.GroupVersionKind().GroupKind(), r.Name, errorList)
112+
return nil, webhookutil.AggregateObjErrors(r.GroupVersionKind().GroupKind(), r.Name, errorList)
112113
}
113114

114115
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
115-
func (r *CloudStackMachineTemplate) ValidateDelete() error {
116+
func (r *CloudStackMachineTemplate) ValidateDelete() (admission.Warnings, error) {
116117
cloudstackmachinetemplatelog.V(1).Info("entered validate delete webhook", "api resource name", r.Name)
117118
// No deletion validations. Deletion webhook not enabled.
118-
return nil
119+
return nil, nil
119120
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.11.3
7-
creationTimestamp: null
6+
controller-gen.kubebuilder.io/version: v0.12.0
87
name: cloudstackaffinitygroups.infrastructure.cluster.x-k8s.io
98
spec:
109
group: infrastructure.cluster.x-k8s.io

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.11.3
7-
creationTimestamp: null
6+
controller-gen.kubebuilder.io/version: v0.12.0
87
name: cloudstackclusters.infrastructure.cluster.x-k8s.io
98
spec:
109
group: infrastructure.cluster.x-k8s.io

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.11.3
7-
creationTimestamp: null
6+
controller-gen.kubebuilder.io/version: v0.12.0
87
name: cloudstackfailuredomains.infrastructure.cluster.x-k8s.io
98
spec:
109
group: infrastructure.cluster.x-k8s.io

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.11.3
7-
creationTimestamp: null
6+
controller-gen.kubebuilder.io/version: v0.12.0
87
name: cloudstackisolatednetworks.infrastructure.cluster.x-k8s.io
98
spec:
109
group: infrastructure.cluster.x-k8s.io

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.11.3
7-
creationTimestamp: null
6+
controller-gen.kubebuilder.io/version: v0.12.0
87
name: cloudstackmachines.infrastructure.cluster.x-k8s.io
98
spec:
109
group: infrastructure.cluster.x-k8s.io

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.11.3
7-
creationTimestamp: null
6+
controller-gen.kubebuilder.io/version: v0.12.0
87
name: cloudstackmachinestatecheckers.infrastructure.cluster.x-k8s.io
98
spec:
109
group: infrastructure.cluster.x-k8s.io

0 commit comments

Comments
 (0)