Skip to content

Commit

Permalink
Delete deprecated provider-specific MachineClass CRDs
Browse files Browse the repository at this point in the history
  • Loading branch information
rfranzke committed Mar 6, 2023
1 parent 8c3036b commit f56ca6f
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 1,089 deletions.
30 changes: 29 additions & 1 deletion extensions/pkg/controller/worker/machine_crds.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ import (
"path/filepath"
"text/template"

apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
apiextensionsscheme "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/client-go/rest"
Expand Down Expand Up @@ -96,5 +99,30 @@ func ApplyMachineResources(ctx context.Context, c client.Client) error {

applier := kubernetes.NewApplier(c, c.RESTMapper())

return applier.ApplyManifest(ctx, manifestReader, kubernetes.DefaultMergeFuncs)
if err := applier.ApplyManifest(ctx, manifestReader, kubernetes.DefaultMergeFuncs); err != nil {
return err
}

// TODO(rfrankze): Delete this in a future version.
for _, crd := range []*apiextensionsv1.CustomResourceDefinition{
{ObjectMeta: metav1.ObjectMeta{Name: "alicloudmachineclasses.machine.sapcloud.io"}},
{ObjectMeta: metav1.ObjectMeta{Name: "awsmachineclasses.machine.sapcloud.io"}},
{ObjectMeta: metav1.ObjectMeta{Name: "azuremachineclasses.machine.sapcloud.io"}},
{ObjectMeta: metav1.ObjectMeta{Name: "gcpmachineclasses.machine.sapcloud.io"}},
{ObjectMeta: metav1.ObjectMeta{Name: "openstackmachineclasses.machine.sapcloud.io"}},
{ObjectMeta: metav1.ObjectMeta{Name: "packetmachineclasses.machine.sapcloud.io"}},
} {
if err := gardenerutils.ConfirmDeletion(ctx, c, crd); err != nil {
if !apierrors.IsNotFound(err) {
return err
}
continue
}

if err := c.Delete(ctx, crd); client.IgnoreNotFound(err) != nil {
return err
}
}

return nil
}

This file was deleted.

Loading

0 comments on commit f56ca6f

Please sign in to comment.