Skip to content

Commit

Permalink
✨ Upgrade to CAPI 1.5
Browse files Browse the repository at this point in the history
Update CAPI and controller runtime
  • Loading branch information
janiskemper committed Aug 24, 2023
1 parent f7a9756 commit 00f054a
Show file tree
Hide file tree
Showing 8,926 changed files with 86,417 additions and 2,241,684 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ $(CTLPTL):
CLUSTERCTL := $(abspath $(TOOLS_BIN_DIR)/clusterctl)
clusterctl: $(CLUSTERCTL) ## Build a local copy of clusterctl
$(CLUSTERCTL):
curl -sSLf https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.4.3/clusterctl-$$(go env GOOS)-$$(go env GOARCH) -o $(CLUSTERCTL)
curl -sSLf https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.5.0/clusterctl-$$(go env GOOS)-$$(go env GOARCH) -o $(CLUSTERCTL)
chmod a+rx $(CLUSTERCTL)

KIND := $(abspath $(TOOLS_BIN_DIR)/kind)
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ In addition to the pure creation and operation of Kubernetes clusters, this prov

This provider's versions are compatible with the following versions of Cluster API:

| | Cluster API `v1beta1` (`v1.0.x`) | Cluster API `v1beta1` (`v1.1.x`) | Cluster API `v1beta1` (`v1.2.x`) | Cluster API `v1beta1` (`v1.3.x`) | Cluster API `v1beta1` (`v1.4.x`) |
|---|---|---|---|---|---|
|Hetzner Provider `v1.0.x` ||||||
| | Cluster API `v1beta1` (`v1.0.x`) | Cluster API `v1beta1` (`v1.1.x`) | Cluster API `v1beta1` (`v1.2.x`) | Cluster API `v1beta1` (`v1.3.x`) | Cluster API `v1beta1` (`v1.4.x`) | Cluster API `v1beta1` (`v1.5.x`) |
|---|---|---|---|---|---|---|
|Hetzner Provider `v1.0.x` |||||||

This provider's versions can install and manage the following versions of Kubernetes:

Expand Down
2 changes: 1 addition & 1 deletion Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ settings = {
"deploy_observability": False,
"preload_images_for_kind": True,
"kind_cluster_name": "caph",
"capi_version": "v1.4.1",
"capi_version": "v1.5.0",
"cabpt_version": "v0.5.6",
"cacppt_version": "v0.4.11",
"cert_manager_version": "v1.11.0",
Expand Down
15 changes: 8 additions & 7 deletions api/v1beta1/hcloudmachine_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"k8s.io/apimachinery/pkg/util/validation/field"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"

"github.com/syself/cluster-api-provider-hetzner/pkg/utils"
)
Expand Down Expand Up @@ -65,20 +66,20 @@ func (r *HCloudMachine) Default() {
var _ webhook.Validator = &HCloudMachine{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type.
func (r *HCloudMachine) ValidateCreate() error {
func (r *HCloudMachine) ValidateCreate() (admission.Warnings, error) {
hcloudmachinelog.V(1).Info("validate create", "name", r.Name)
var allErrs field.ErrorList

return aggregateObjErrors(r.GroupVersionKind().GroupKind(), r.Name, allErrs)
return nil, aggregateObjErrors(r.GroupVersionKind().GroupKind(), r.Name, allErrs)
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type.
func (r *HCloudMachine) ValidateUpdate(old runtime.Object) error {
func (r *HCloudMachine) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
hcloudmachinelog.V(1).Info("validate update", "name", r.Name)

oldM, ok := old.(*HCloudMachine)
if !ok {
return apierrors.NewBadRequest(fmt.Sprintf("expected an HCloudMachine but got a %T", old))
return nil, apierrors.NewBadRequest(fmt.Sprintf("expected an HCloudMachine but got a %T", old))
}

var allErrs field.ErrorList
Expand Down Expand Up @@ -111,11 +112,11 @@ func (r *HCloudMachine) ValidateUpdate(old runtime.Object) error {
)
}

return aggregateObjErrors(r.GroupVersionKind().GroupKind(), r.Name, allErrs)
return nil, aggregateObjErrors(r.GroupVersionKind().GroupKind(), r.Name, allErrs)
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type.
func (r *HCloudMachine) ValidateDelete() error {
func (r *HCloudMachine) ValidateDelete() (admission.Warnings, error) {
hcloudmachinelog.V(1).Info("validate delete", "name", r.Name)
return nil
return nil, nil
}
18 changes: 9 additions & 9 deletions api/v1beta1/hcloudmachinetemplate_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,24 @@ type HCloudMachineTemplateWebhook struct{}
var _ webhook.CustomValidator = &HCloudMachineTemplateWebhook{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type.
func (r *HCloudMachineTemplateWebhook) ValidateCreate(_ context.Context, _ runtime.Object) error {
return nil
func (r *HCloudMachineTemplateWebhook) ValidateCreate(_ context.Context, _ runtime.Object) (admission.Warnings, error) {
return nil, nil
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type.
func (r *HCloudMachineTemplateWebhook) ValidateUpdate(ctx context.Context, oldRaw runtime.Object, newRaw runtime.Object) error {
func (r *HCloudMachineTemplateWebhook) ValidateUpdate(ctx context.Context, oldRaw runtime.Object, newRaw runtime.Object) (admission.Warnings, error) {
newHCloudMachineTemplate, ok := newRaw.(*HCloudMachineTemplate)
if !ok {
return apierrors.NewBadRequest(fmt.Sprintf("expected a HCloudMachineTemplate but got a %T", newRaw))
return nil, apierrors.NewBadRequest(fmt.Sprintf("expected a HCloudMachineTemplate but got a %T", newRaw))
}
oldHCloudMachineTemplate, ok := oldRaw.(*HCloudMachineTemplate)
if !ok {
return apierrors.NewBadRequest(fmt.Sprintf("expected a HCloudMachineTemplate but got a %T", oldRaw))
return nil, apierrors.NewBadRequest(fmt.Sprintf("expected a HCloudMachineTemplate but got a %T", oldRaw))
}

req, err := admission.RequestFromContext(ctx)
if err != nil {
return apierrors.NewBadRequest(fmt.Sprintf("expected a admission.Request inside context: %v", err))
return nil, apierrors.NewBadRequest(fmt.Sprintf("expected a admission.Request inside context: %v", err))
}

var allErrs field.ErrorList
Expand All @@ -73,10 +73,10 @@ func (r *HCloudMachineTemplateWebhook) ValidateUpdate(ctx context.Context, oldRa
allErrs = append(allErrs, field.Invalid(field.NewPath("spec"), newHCloudMachineTemplate, "HCloudMachineTemplate.Spec is immutable"))
}

return aggregateObjErrors(newHCloudMachineTemplate.GroupVersionKind().GroupKind(), newHCloudMachineTemplate.Name, allErrs)
return nil, aggregateObjErrors(newHCloudMachineTemplate.GroupVersionKind().GroupKind(), newHCloudMachineTemplate.Name, allErrs)
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type.
func (r *HCloudMachineTemplateWebhook) ValidateDelete(_ context.Context, _ runtime.Object) error {
return nil
func (r *HCloudMachineTemplateWebhook) ValidateDelete(_ context.Context, _ runtime.Object) (admission.Warnings, error) {
return nil, nil
}
13 changes: 7 additions & 6 deletions api/v1beta1/hcloudremediation_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
)

// SetupWebhookWithManager initializes webhook manager for HCloudRemediation.
Expand All @@ -42,16 +43,16 @@ func (r *HCloudRemediation) Default() {
var _ webhook.Validator = &HCloudRemediation{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type.
func (r *HCloudRemediation) ValidateCreate() error {
return nil
func (r *HCloudRemediation) ValidateCreate() (admission.Warnings, error) {
return nil, nil
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type.
func (r *HCloudRemediation) ValidateUpdate(runtime.Object) error {
return nil
func (r *HCloudRemediation) ValidateUpdate(runtime.Object) (admission.Warnings, error) {
return nil, nil
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type.
func (r *HCloudRemediation) ValidateDelete() error {
return nil
func (r *HCloudRemediation) ValidateDelete() (admission.Warnings, error) {
return nil, nil
}
13 changes: 7 additions & 6 deletions api/v1beta1/hcloudremediationtemplate_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
)

// SetupWebhookWithManager initializes webhook manager for HCloudRemediationTemplate.
Expand All @@ -42,16 +43,16 @@ func (r *HCloudRemediationTemplate) Default() {
var _ webhook.Validator = &HCloudRemediationTemplate{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type.
func (r *HCloudRemediationTemplate) ValidateCreate() error {
return nil
func (r *HCloudRemediationTemplate) ValidateCreate() (admission.Warnings, error) {
return nil, nil
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type.
func (r *HCloudRemediationTemplate) ValidateUpdate(runtime.Object) error {
return nil
func (r *HCloudRemediationTemplate) ValidateUpdate(runtime.Object) (admission.Warnings, error) {
return nil, nil
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type.
func (r *HCloudRemediationTemplate) ValidateDelete() error {
return nil
func (r *HCloudRemediationTemplate) ValidateDelete() (admission.Warnings, error) {
return nil, nil
}
13 changes: 7 additions & 6 deletions api/v1beta1/hetznerbaremetalhost_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
)

// SetupWebhookWithManager initializes webhook manager for HetznerBareMetalHost.
Expand All @@ -42,16 +43,16 @@ func (host *HetznerBareMetalHost) Default() {
var _ webhook.Validator = &HetznerBareMetalHost{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type.
func (host *HetznerBareMetalHost) ValidateCreate() error {
return nil
func (host *HetznerBareMetalHost) ValidateCreate() (admission.Warnings, error) {
return nil, nil
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type.
func (host *HetznerBareMetalHost) ValidateUpdate(runtime.Object) error {
return nil
func (host *HetznerBareMetalHost) ValidateUpdate(runtime.Object) (admission.Warnings, error) {
return nil, nil
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type.
func (host *HetznerBareMetalHost) ValidateDelete() error {
return nil
func (host *HetznerBareMetalHost) ValidateDelete() (admission.Warnings, error) {
return nil, nil
}
13 changes: 7 additions & 6 deletions api/v1beta1/hetznerbaremetalmachine_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"k8s.io/apimachinery/pkg/util/validation/field"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
)

// SetupWebhookWithManager initializes webhook manager for HetznerBareMetalMachine.
Expand All @@ -48,7 +49,7 @@ func (bmMachine *HetznerBareMetalMachine) Default() {}
var _ webhook.Validator = &HetznerBareMetalMachine{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type.
func (bmMachine *HetznerBareMetalMachine) ValidateCreate() error {
func (bmMachine *HetznerBareMetalMachine) ValidateCreate() (admission.Warnings, error) {
var allErrs field.ErrorList

if bmMachine.Spec.SSHSpec.PortAfterCloudInit == 0 {
Expand Down Expand Up @@ -91,11 +92,11 @@ func (bmMachine *HetznerBareMetalMachine) ValidateCreate() error {
}
}

return aggregateObjErrors(bmMachine.GroupVersionKind().GroupKind(), bmMachine.Name, allErrs)
return nil, aggregateObjErrors(bmMachine.GroupVersionKind().GroupKind(), bmMachine.Name, allErrs)
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type.
func (bmMachine *HetznerBareMetalMachine) ValidateUpdate(old runtime.Object) error {
func (bmMachine *HetznerBareMetalMachine) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
var allErrs field.ErrorList

oldHetznerBareMetalMachine := old.(*HetznerBareMetalMachine)
Expand All @@ -114,10 +115,10 @@ func (bmMachine *HetznerBareMetalMachine) ValidateUpdate(old runtime.Object) err
field.Invalid(field.NewPath("spec", "hostSelector"), bmMachine.Spec.HostSelector, "hostSelector immutable"),
)
}
return aggregateObjErrors(bmMachine.GroupVersionKind().GroupKind(), bmMachine.Name, allErrs)
return nil, aggregateObjErrors(bmMachine.GroupVersionKind().GroupKind(), bmMachine.Name, allErrs)
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type.
func (bmMachine *HetznerBareMetalMachine) ValidateDelete() error {
return nil
func (bmMachine *HetznerBareMetalMachine) ValidateDelete() (admission.Warnings, error) {
return nil, nil
}
18 changes: 9 additions & 9 deletions api/v1beta1/hetznerbaremetalmachinetemplate_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,24 @@ type HetznerBareMetalMachineTemplateWebhook struct{}
var _ webhook.CustomValidator = &HetznerBareMetalMachineTemplateWebhook{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type.
func (r *HetznerBareMetalMachineTemplateWebhook) ValidateCreate(_ context.Context, _ runtime.Object) error {
return nil
func (r *HetznerBareMetalMachineTemplateWebhook) ValidateCreate(_ context.Context, _ runtime.Object) (admission.Warnings, error) {
return nil, nil
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type.
func (r *HetznerBareMetalMachineTemplateWebhook) ValidateUpdate(ctx context.Context, oldRaw runtime.Object, newRaw runtime.Object) error {
func (r *HetznerBareMetalMachineTemplateWebhook) ValidateUpdate(ctx context.Context, oldRaw runtime.Object, newRaw runtime.Object) (admission.Warnings, error) {
newHetznerBareMetalMachineTemplate, ok := newRaw.(*HetznerBareMetalMachineTemplate)
if !ok {
return apierrors.NewBadRequest(fmt.Sprintf("expected a HetznerBareMetalMachineTemplate but got a %T", newRaw))
return nil, apierrors.NewBadRequest(fmt.Sprintf("expected a HetznerBareMetalMachineTemplate but got a %T", newRaw))
}
oldHetznerBareMetalMachineTemplate, ok := oldRaw.(*HetznerBareMetalMachineTemplate)
if !ok {
return apierrors.NewBadRequest(fmt.Sprintf("expected a HetznerBareMetalMachineTemplate but got a %T", oldRaw))
return nil, apierrors.NewBadRequest(fmt.Sprintf("expected a HetznerBareMetalMachineTemplate but got a %T", oldRaw))
}

req, err := admission.RequestFromContext(ctx)
if err != nil {
return apierrors.NewBadRequest(fmt.Sprintf("expected a admission.Request inside context: %v", err))
return nil, apierrors.NewBadRequest(fmt.Sprintf("expected a admission.Request inside context: %v", err))
}

var allErrs field.ErrorList
Expand All @@ -73,10 +73,10 @@ func (r *HetznerBareMetalMachineTemplateWebhook) ValidateUpdate(ctx context.Cont
allErrs = append(allErrs, field.Invalid(field.NewPath("spec"), newHetznerBareMetalMachineTemplate, "HetznerBareMetalMachineTemplate.Spec is immutable"))
}

return aggregateObjErrors(newHetznerBareMetalMachineTemplate.GroupVersionKind().GroupKind(), newHetznerBareMetalMachineTemplate.Name, allErrs)
return nil, aggregateObjErrors(newHetznerBareMetalMachineTemplate.GroupVersionKind().GroupKind(), newHetznerBareMetalMachineTemplate.Name, allErrs)
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type.
func (r *HetznerBareMetalMachineTemplateWebhook) ValidateDelete(_ context.Context, _ runtime.Object) error {
return nil
func (r *HetznerBareMetalMachineTemplateWebhook) ValidateDelete(_ context.Context, _ runtime.Object) (admission.Warnings, error) {
return nil, nil
}
13 changes: 7 additions & 6 deletions api/v1beta1/hetznerbaremetalremediation_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
)

// SetupWebhookWithManager initializes webhook manager for HetznerBareMetalRemediation.
Expand All @@ -42,16 +43,16 @@ func (r *HetznerBareMetalRemediation) Default() {
var _ webhook.Validator = &HetznerBareMetalRemediation{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type.
func (r *HetznerBareMetalRemediation) ValidateCreate() error {
return nil
func (r *HetznerBareMetalRemediation) ValidateCreate() (admission.Warnings, error) {
return nil, nil
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type.
func (r *HetznerBareMetalRemediation) ValidateUpdate(runtime.Object) error {
return nil
func (r *HetznerBareMetalRemediation) ValidateUpdate(runtime.Object) (admission.Warnings, error) {
return nil, nil
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type.
func (r *HetznerBareMetalRemediation) ValidateDelete() error {
return nil
func (r *HetznerBareMetalRemediation) ValidateDelete() (admission.Warnings, error) {
return nil, nil
}
13 changes: 7 additions & 6 deletions api/v1beta1/hetznerbaremetalremediationtemplate_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
)

// SetupWebhookWithManager initializes webhook manager for HetznerBareMetalRemediationTemplate.
Expand All @@ -42,16 +43,16 @@ func (r *HetznerBareMetalRemediationTemplate) Default() {
var _ webhook.Validator = &HetznerBareMetalRemediationTemplate{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type.
func (r *HetznerBareMetalRemediationTemplate) ValidateCreate() error {
return nil
func (r *HetznerBareMetalRemediationTemplate) ValidateCreate() (admission.Warnings, error) {
return nil, nil
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type.
func (r *HetznerBareMetalRemediationTemplate) ValidateUpdate(runtime.Object) error {
return nil
func (r *HetznerBareMetalRemediationTemplate) ValidateUpdate(runtime.Object) (admission.Warnings, error) {
return nil, nil
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type.
func (r *HetznerBareMetalRemediationTemplate) ValidateDelete() error {
return nil
func (r *HetznerBareMetalRemediationTemplate) ValidateDelete() (admission.Warnings, error) {
return nil, nil
}
Loading

0 comments on commit 00f054a

Please sign in to comment.