diff --git a/.github/workflows/auto_update.yml b/.github/workflows/auto_update.yml index 1307edd..0660305 100644 --- a/.github/workflows/auto_update.yml +++ b/.github/workflows/auto_update.yml @@ -67,4 +67,7 @@ jobs: --force \ --push \ --restore-path .github/workflows \ + --restore-path config/rbac \ + --restore-path .custom-gcl.yml \ + --restore-path test/utils \ --open-gh-issue diff --git a/PROJECT b/PROJECT index 6fe0a06..dec6475 100644 --- a/PROJECT +++ b/PROJECT @@ -2,7 +2,7 @@ # This file is used to track the info used to scaffold your project # and allow the plugins properly work. # More info: https://book.kubebuilder.io/reference/project-config.html -cliVersion: 4.13.0 +cliVersion: 4.13.1 domain: cluster.x-k8s.io layout: - go.kubebuilder.io/v4 diff --git a/api/v1beta2/groupversion_info.go b/api/v1beta2/groupversion_info.go index bbd29ca..fe04f58 100644 --- a/api/v1beta2/groupversion_info.go +++ b/api/v1beta2/groupversion_info.go @@ -26,8 +26,12 @@ import ( ) var ( - // GroupVersion is group version used to register these objects. - GroupVersion = schema.GroupVersion{Group: "infrastructure.cluster.x-k8s.io", Version: "v1beta2"} + // SchemeGroupVersion is group version used to register these objects. + // This name is used by applyconfiguration generators (e.g. controller-gen). + SchemeGroupVersion = schema.GroupVersion{Group: "infrastructure.cluster.x-k8s.io", Version: "v1beta2"} + + // GroupVersion is an alias for SchemeGroupVersion, for backward compatibility. + GroupVersion = SchemeGroupVersion // SchemeBuilder is used to add go types to the GroupVersionKind scheme. schemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) @@ -39,7 +43,7 @@ var ( ) func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(GroupVersion, objectTypes...) - metav1.AddToGroupVersion(scheme, GroupVersion) + scheme.AddKnownTypes(SchemeGroupVersion, objectTypes...) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil } diff --git a/cmd/main.go b/cmd/main.go index d1d627d..015214b 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -134,7 +134,7 @@ func main() { // Metrics endpoint is enabled in 'config/default/kustomization.yaml'. The Metrics options configure the server. // More info: - // - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.23.1/pkg/metrics/server + // - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.23.3/pkg/metrics/server // - https://book.kubebuilder.io/reference/metrics.html metricsServerOptions := metricsserver.Options{ BindAddress: metricsAddr, @@ -146,7 +146,7 @@ func main() { // FilterProvider is used to protect the metrics endpoint with authn/authz. // These configurations ensure that only authorized users and service accounts // can access the metrics endpoint. The RBAC are configured in 'config/rbac/kustomization.yaml'. More info: - // https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.23.1/pkg/metrics/filters#WithAuthenticationAndAuthorization + // https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.23.3/pkg/metrics/filters#WithAuthenticationAndAuthorization metricsServerOptions.FilterProvider = filters.WithAuthenticationAndAuthorization } diff --git a/internal/controller/cloudscalecluster_controller.go b/internal/controller/cloudscalecluster_controller.go index 85acf7e..37b8f34 100644 --- a/internal/controller/cloudscalecluster_controller.go +++ b/internal/controller/cloudscalecluster_controller.go @@ -267,7 +267,7 @@ func (r *CloudscaleClusterReconciler) SetupWithManager(ctx context.Context, mgr WithEventFilter(predicates.ResourceIsNotExternallyManaged(r.Scheme, logger)). Watches( &clusterv1.Cluster{}, - handler.EnqueueRequestsFromMapFunc(util.ClusterToInfrastructureMapFunc(ctx, infrastructurev1beta2.GroupVersion.WithKind("CloudscaleCluster"), mgr.GetClient(), &infrastructurev1beta2.CloudscaleCluster{})), + handler.EnqueueRequestsFromMapFunc(util.ClusterToInfrastructureMapFunc(ctx, infrastructurev1beta2.SchemeGroupVersion.WithKind("CloudscaleCluster"), mgr.GetClient(), &infrastructurev1beta2.CloudscaleCluster{})), ). Watches( &infrastructurev1beta2.CloudscaleMachine{}, diff --git a/internal/controller/cloudscalemachine_controller.go b/internal/controller/cloudscalemachine_controller.go index 3f19e19..b886f6b 100644 --- a/internal/controller/cloudscalemachine_controller.go +++ b/internal/controller/cloudscalemachine_controller.go @@ -266,7 +266,7 @@ func (r *CloudscaleMachineReconciler) SetupWithManager(ctx context.Context, mgr WithEventFilter(predicates.ResourceIsNotExternallyManaged(r.Scheme, logger)). Watches( &clusterv1.Machine{}, - handler.EnqueueRequestsFromMapFunc(util.MachineToInfrastructureMapFunc(infrastructurev1beta2.GroupVersion.WithKind("CloudscaleMachine"))), + handler.EnqueueRequestsFromMapFunc(util.MachineToInfrastructureMapFunc(infrastructurev1beta2.SchemeGroupVersion.WithKind("CloudscaleMachine"))), ). Watches( &clusterv1.Cluster{}, diff --git a/internal/webhook/v1beta2/cloudscalecluster_webhook.go b/internal/webhook/v1beta2/cloudscalecluster_webhook.go index c5707f4..fd3925e 100644 --- a/internal/webhook/v1beta2/cloudscalecluster_webhook.go +++ b/internal/webhook/v1beta2/cloudscalecluster_webhook.go @@ -153,7 +153,7 @@ func (v *CloudscaleClusterCustomValidator) ValidateCreate(_ context.Context, clu if len(allErrs) > 0 { return nil, apierrors.NewInvalid( - schema.GroupKind{Group: infrastructurev1beta2.GroupVersion.Group, Kind: "CloudscaleCluster"}, + schema.GroupKind{Group: infrastructurev1beta2.SchemeGroupVersion.Group, Kind: "CloudscaleCluster"}, cluster.Name, allErrs) } @@ -225,7 +225,7 @@ func (v *CloudscaleClusterCustomValidator) ValidateUpdate(_ context.Context, old if len(allErrs) > 0 { return nil, apierrors.NewInvalid( - schema.GroupKind{Group: infrastructurev1beta2.GroupVersion.Group, Kind: "CloudscaleCluster"}, + schema.GroupKind{Group: infrastructurev1beta2.SchemeGroupVersion.Group, Kind: "CloudscaleCluster"}, newCluster.Name, allErrs) } diff --git a/internal/webhook/v1beta2/cloudscalemachine_webhook.go b/internal/webhook/v1beta2/cloudscalemachine_webhook.go index c03912d..d0dc6c1 100644 --- a/internal/webhook/v1beta2/cloudscalemachine_webhook.go +++ b/internal/webhook/v1beta2/cloudscalemachine_webhook.go @@ -76,7 +76,7 @@ func (v *CloudscaleMachineCustomValidator) ValidateCreate(_ context.Context, obj allErrs := validateMachineSpec(&obj.Spec, v.FlavorInfo, field.NewPath("spec")) if len(allErrs) > 0 { return nil, apierrors.NewInvalid( - schema.GroupKind{Group: infrastructurev1beta2.GroupVersion.Group, Kind: "CloudscaleMachine"}, + schema.GroupKind{Group: infrastructurev1beta2.SchemeGroupVersion.Group, Kind: "CloudscaleMachine"}, obj.Name, allErrs) } @@ -90,7 +90,7 @@ func (v *CloudscaleMachineCustomValidator) ValidateUpdate(_ context.Context, old allErrs := validateMachineSpecUpdate(&newObj.Spec, &oldObj.Spec, field.NewPath("spec")) if len(allErrs) > 0 { return nil, apierrors.NewInvalid( - schema.GroupKind{Group: infrastructurev1beta2.GroupVersion.Group, Kind: "CloudscaleMachine"}, + schema.GroupKind{Group: infrastructurev1beta2.SchemeGroupVersion.Group, Kind: "CloudscaleMachine"}, newObj.Name, allErrs) } diff --git a/internal/webhook/v1beta2/cloudscalemachinetemplate_webhook.go b/internal/webhook/v1beta2/cloudscalemachinetemplate_webhook.go index 5f969b2..07793b3 100644 --- a/internal/webhook/v1beta2/cloudscalemachinetemplate_webhook.go +++ b/internal/webhook/v1beta2/cloudscalemachinetemplate_webhook.go @@ -77,7 +77,7 @@ func (v *CloudscaleMachineTemplateCustomValidator) ValidateCreate(_ context.Cont allErrs := validateMachineSpec(&obj.Spec.Template.Spec, v.FlavorInfo, field.NewPath("spec", "template", "spec")) if len(allErrs) > 0 { return nil, apierrors.NewInvalid( - schema.GroupKind{Group: infrastructurev1beta2.GroupVersion.Group, Kind: "CloudscaleMachineTemplate"}, + schema.GroupKind{Group: infrastructurev1beta2.SchemeGroupVersion.Group, Kind: "CloudscaleMachineTemplate"}, obj.Name, allErrs) } @@ -95,7 +95,7 @@ func (v *CloudscaleMachineTemplateCustomValidator) ValidateUpdate(_ context.Cont field.NewPath("spec", "template", "spec"), "field is immutable")) return nil, apierrors.NewInvalid( - schema.GroupKind{Group: infrastructurev1beta2.GroupVersion.Group, Kind: "CloudscaleMachineTemplate"}, + schema.GroupKind{Group: infrastructurev1beta2.SchemeGroupVersion.Group, Kind: "CloudscaleMachineTemplate"}, newObj.Name, allErrs) }