diff --git a/.golangci.yml b/.golangci.yml index 85761c3889e3..9f665cd69564 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -112,6 +112,8 @@ linters-settings: - pkg: sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1 alias: runtimev1 - pkg: sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1 + alias: runtimehooksv1alpha1 + - pkg: sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha2 alias: runtimehooksv1 - pkg: sigs.k8s.io/cluster-api/exp/runtime/controllers alias: runtimecontrollers diff --git a/Makefile b/Makefile index adcff408b1cd..902cd309d5fe 100644 --- a/Makefile +++ b/Makefile @@ -338,13 +338,20 @@ generate-go-conversions-core-exp: $(CONVERSION_GEN) ## Generate conversions go c .PHONY: generate-go-conversions-core-runtime generate-go-conversions-core-runtime: $(CONVERSION_GEN) ## Generate conversions go code for core runtime - $(MAKE) clean-generated-conversions SRC_DIRS="./internal/runtime/test/v1alpha1,./internal/runtime/test/v1alpha2" + $(MAKE) clean-generated-conversions SRC_DIRS="./exp/runtime/hooks/api/v1alpha1" $(CONVERSION_GEN) \ - --input-dirs=./internal/runtime/test/v1alpha1 \ - --input-dirs=./internal/runtime/test/v1alpha2 \ + --input-dirs=./exp/runtime/hooks/api/v1alpha1 \ + --input-dirs=./exp/runtime/hooks/api/v1alpha2 \ --build-tag=ignore_autogenerated_runtime \ --output-file-base=zz_generated.conversion $(CONVERSION_GEN_OUTPUT_BASE) \ --go-header-file=./hack/boilerplate/boilerplate.generatego.txt +# $(MAKE) clean-generated-conversions SRC_DIRS="./internal/runtime/test/v1alpha1,./internal/runtime/test/v1alpha2" +# $(CONVERSION_GEN) \ +# --input-dirs=./internal/runtime/test/v1alpha1 \ +# --input-dirs=./internal/runtime/test/v1alpha2 \ +# --build-tag=ignore_autogenerated_runtime \ +# --output-file-base=zz_generated.conversion $(CONVERSION_GEN_OUTPUT_BASE) \ +# --go-header-file=./hack/boilerplate/boilerplate.generatego.txt .PHONY: generate-go-conversions-kubeadm-bootstrap generate-go-conversions-kubeadm-bootstrap: $(CONVERSION_GEN) ## Generate conversions go code for kubeadm bootstrap diff --git a/exp/runtime/hooks/api/v1alpha1/conversion.go b/exp/runtime/hooks/api/v1alpha1/conversion.go new file mode 100644 index 000000000000..a9829018cc66 --- /dev/null +++ b/exp/runtime/hooks/api/v1alpha1/conversion.go @@ -0,0 +1,32 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/conversion" + + clusterv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" + clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" +) + +func Convert_v1alpha4_Cluster_To_v1beta1_Cluster(in *clusterv1alpha4.Cluster, out *clusterv1.Cluster, s conversion.Scope) error { + return clusterv1alpha4.Convert_v1alpha4_Cluster_To_v1beta1_Cluster(in, out, s) +} + +func Convert_v1beta1_Cluster_To_v1alpha4_Cluster(in *clusterv1.Cluster, out *clusterv1alpha4.Cluster, s conversion.Scope) error { + return clusterv1alpha4.Convert_v1beta1_Cluster_To_v1alpha4_Cluster(in, out, s) +} diff --git a/exp/runtime/hooks/api/v1alpha1/conversion_test.go b/exp/runtime/hooks/api/v1alpha1/conversion_test.go new file mode 100644 index 000000000000..b6114e4c28cd --- /dev/null +++ b/exp/runtime/hooks/api/v1alpha1/conversion_test.go @@ -0,0 +1,42 @@ +/* +Copyright 2022 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + "context" + "testing" + + runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha2" + runtimecatalog "sigs.k8s.io/cluster-api/internal/runtime/catalog" +) + +func TestConversion(t *testing.T) { + // NOTE: this is only a very simple conversion test + // We need something more once we merge multiple versions of a type + // and actually use conversion. + + var c = runtimecatalog.New() + _ = AddToCatalog(c) + _ = runtimehooksv1.AddToCatalog(c) + + c1 := &runtimehooksv1.BeforeClusterCreateRequest{} + c2 := &BeforeClusterCreateRequest{} + + if err := c.Convert(c1, c2, context.Background()); err != nil { + t.Fatal(err) + } +} diff --git a/exp/runtime/hooks/api/v1alpha1/doc.go b/exp/runtime/hooks/api/v1alpha1/doc.go index c3fbb8fa2343..30ee4c12fa1b 100644 --- a/exp/runtime/hooks/api/v1alpha1/doc.go +++ b/exp/runtime/hooks/api/v1alpha1/doc.go @@ -15,6 +15,7 @@ limitations under the License. */ // Package v1alpha1 contains the v1alpha1 RuntimeHooks. +// +k8s:conversion-gen=sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha2 // +kubebuilder:object:generate=true // +k8s:openapi-gen=true package v1alpha1 diff --git a/exp/runtime/hooks/api/v1alpha1/groupversion_info.go b/exp/runtime/hooks/api/v1alpha1/groupversion_info.go index 7fdb0a73a10d..8ecd65d00608 100644 --- a/exp/runtime/hooks/api/v1alpha1/groupversion_info.go +++ b/exp/runtime/hooks/api/v1alpha1/groupversion_info.go @@ -34,6 +34,12 @@ var ( // AddToCatalog adds RuntimeHooks defined in this package and their request and // response types to a catalog. AddToCatalog = catalogBuilder.AddToCatalog + + // localSchemeBuilder provide access to the SchemeBuilder used for managing rpc + // method's request and response types defined in this package. + // NOTE: this object is required to allow registration of automatically generated + // conversions func. + localSchemeBuilder = catalogBuilder ) func init() { diff --git a/exp/runtime/hooks/api/v1alpha1/lifecyclehooks_types.go b/exp/runtime/hooks/api/v1alpha1/lifecyclehooks_types.go index 467a49897a0c..76449e050621 100644 --- a/exp/runtime/hooks/api/v1alpha1/lifecyclehooks_types.go +++ b/exp/runtime/hooks/api/v1alpha1/lifecyclehooks_types.go @@ -19,7 +19,7 @@ package v1alpha1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" + clusterv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" runtimecatalog "sigs.k8s.io/cluster-api/internal/runtime/catalog" ) @@ -29,7 +29,7 @@ type BeforeClusterCreateRequest struct { metav1.TypeMeta `json:",inline"` // The cluster object the lifecycle hook corresponds to. - Cluster clusterv1.Cluster `json:"cluster"` + Cluster clusterv1alpha4.Cluster `json:"cluster"` } var _ RetryResponseObject = &BeforeClusterCreateResponse{} @@ -52,7 +52,7 @@ type AfterControlPlaneInitializedRequest struct { metav1.TypeMeta `json:",inline"` // The cluster object the lifecycle hook corresponds to. - Cluster clusterv1.Cluster `json:"cluster"` + Cluster clusterv1alpha4.Cluster `json:"cluster"` } var _ ResponseObject = &AfterControlPlaneInitializedResponse{} @@ -76,7 +76,7 @@ type BeforeClusterUpgradeRequest struct { metav1.TypeMeta `json:",inline"` // The cluster object the lifecycle hook corresponds to. - Cluster clusterv1.Cluster `json:"cluster"` + Cluster clusterv1alpha4.Cluster `json:"cluster"` // The current Kubernetes version of the cluster. FromKubernetesVersion string `json:"fromKubernetesVersion"` @@ -106,7 +106,7 @@ type AfterControlPlaneUpgradeRequest struct { metav1.TypeMeta `json:",inline"` // The cluster object the lifecycle hook corresponds to. - Cluster clusterv1.Cluster `json:"cluster"` + Cluster clusterv1alpha4.Cluster `json:"cluster"` // The Kubernetes version after upgrade. KubernetesVersion string `json:"kubernetesVersion"` @@ -133,7 +133,7 @@ type AfterClusterUpgradeRequest struct { metav1.TypeMeta `json:",inline"` // The cluster object the lifecycle hook corresponds to. - Cluster clusterv1.Cluster `json:"cluster"` + Cluster clusterv1alpha4.Cluster `json:"cluster"` // The Kubernetes version after upgrade. KubernetesVersion string `json:"kubernetesVersion"` @@ -160,7 +160,7 @@ type BeforeClusterDeleteRequest struct { metav1.TypeMeta `json:",inline"` // The cluster object the lifecycle hook corresponds to. - Cluster clusterv1.Cluster `json:"cluster"` + Cluster clusterv1alpha4.Cluster `json:"cluster"` } var _ RetryResponseObject = &BeforeClusterDeleteResponse{} diff --git a/exp/runtime/hooks/api/v1alpha1/zz_generated.conversion.go b/exp/runtime/hooks/api/v1alpha1/zz_generated.conversion.go new file mode 100644 index 000000000000..42286ee79a94 --- /dev/null +++ b/exp/runtime/hooks/api/v1alpha1/zz_generated.conversion.go @@ -0,0 +1,989 @@ +//go:build !ignore_autogenerated_runtime +// +build !ignore_autogenerated_runtime + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by conversion-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + unsafe "unsafe" + + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" + types "k8s.io/apimachinery/pkg/types" + v1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" + v1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" + v1alpha2 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha2" +) + +func init() { + localSchemeBuilder.Register(RegisterConversions) +} + +// RegisterConversions adds conversion functions to the given scheme. +// Public to allow building arbitrary schemes. +func RegisterConversions(s *runtime.Scheme) error { + if err := s.AddGeneratedConversionFunc((*AfterClusterUpgradeRequest)(nil), (*v1alpha2.AfterClusterUpgradeRequest)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_AfterClusterUpgradeRequest_To_v1alpha2_AfterClusterUpgradeRequest(a.(*AfterClusterUpgradeRequest), b.(*v1alpha2.AfterClusterUpgradeRequest), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.AfterClusterUpgradeRequest)(nil), (*AfterClusterUpgradeRequest)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_AfterClusterUpgradeRequest_To_v1alpha1_AfterClusterUpgradeRequest(a.(*v1alpha2.AfterClusterUpgradeRequest), b.(*AfterClusterUpgradeRequest), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*AfterClusterUpgradeResponse)(nil), (*v1alpha2.AfterClusterUpgradeResponse)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_AfterClusterUpgradeResponse_To_v1alpha2_AfterClusterUpgradeResponse(a.(*AfterClusterUpgradeResponse), b.(*v1alpha2.AfterClusterUpgradeResponse), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.AfterClusterUpgradeResponse)(nil), (*AfterClusterUpgradeResponse)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_AfterClusterUpgradeResponse_To_v1alpha1_AfterClusterUpgradeResponse(a.(*v1alpha2.AfterClusterUpgradeResponse), b.(*AfterClusterUpgradeResponse), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*AfterControlPlaneInitializedRequest)(nil), (*v1alpha2.AfterControlPlaneInitializedRequest)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_AfterControlPlaneInitializedRequest_To_v1alpha2_AfterControlPlaneInitializedRequest(a.(*AfterControlPlaneInitializedRequest), b.(*v1alpha2.AfterControlPlaneInitializedRequest), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.AfterControlPlaneInitializedRequest)(nil), (*AfterControlPlaneInitializedRequest)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_AfterControlPlaneInitializedRequest_To_v1alpha1_AfterControlPlaneInitializedRequest(a.(*v1alpha2.AfterControlPlaneInitializedRequest), b.(*AfterControlPlaneInitializedRequest), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*AfterControlPlaneInitializedResponse)(nil), (*v1alpha2.AfterControlPlaneInitializedResponse)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_AfterControlPlaneInitializedResponse_To_v1alpha2_AfterControlPlaneInitializedResponse(a.(*AfterControlPlaneInitializedResponse), b.(*v1alpha2.AfterControlPlaneInitializedResponse), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.AfterControlPlaneInitializedResponse)(nil), (*AfterControlPlaneInitializedResponse)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_AfterControlPlaneInitializedResponse_To_v1alpha1_AfterControlPlaneInitializedResponse(a.(*v1alpha2.AfterControlPlaneInitializedResponse), b.(*AfterControlPlaneInitializedResponse), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*AfterControlPlaneUpgradeRequest)(nil), (*v1alpha2.AfterControlPlaneUpgradeRequest)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_AfterControlPlaneUpgradeRequest_To_v1alpha2_AfterControlPlaneUpgradeRequest(a.(*AfterControlPlaneUpgradeRequest), b.(*v1alpha2.AfterControlPlaneUpgradeRequest), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.AfterControlPlaneUpgradeRequest)(nil), (*AfterControlPlaneUpgradeRequest)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_AfterControlPlaneUpgradeRequest_To_v1alpha1_AfterControlPlaneUpgradeRequest(a.(*v1alpha2.AfterControlPlaneUpgradeRequest), b.(*AfterControlPlaneUpgradeRequest), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*AfterControlPlaneUpgradeResponse)(nil), (*v1alpha2.AfterControlPlaneUpgradeResponse)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_AfterControlPlaneUpgradeResponse_To_v1alpha2_AfterControlPlaneUpgradeResponse(a.(*AfterControlPlaneUpgradeResponse), b.(*v1alpha2.AfterControlPlaneUpgradeResponse), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.AfterControlPlaneUpgradeResponse)(nil), (*AfterControlPlaneUpgradeResponse)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_AfterControlPlaneUpgradeResponse_To_v1alpha1_AfterControlPlaneUpgradeResponse(a.(*v1alpha2.AfterControlPlaneUpgradeResponse), b.(*AfterControlPlaneUpgradeResponse), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*BeforeClusterCreateRequest)(nil), (*v1alpha2.BeforeClusterCreateRequest)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_BeforeClusterCreateRequest_To_v1alpha2_BeforeClusterCreateRequest(a.(*BeforeClusterCreateRequest), b.(*v1alpha2.BeforeClusterCreateRequest), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.BeforeClusterCreateRequest)(nil), (*BeforeClusterCreateRequest)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_BeforeClusterCreateRequest_To_v1alpha1_BeforeClusterCreateRequest(a.(*v1alpha2.BeforeClusterCreateRequest), b.(*BeforeClusterCreateRequest), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*BeforeClusterCreateResponse)(nil), (*v1alpha2.BeforeClusterCreateResponse)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_BeforeClusterCreateResponse_To_v1alpha2_BeforeClusterCreateResponse(a.(*BeforeClusterCreateResponse), b.(*v1alpha2.BeforeClusterCreateResponse), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.BeforeClusterCreateResponse)(nil), (*BeforeClusterCreateResponse)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_BeforeClusterCreateResponse_To_v1alpha1_BeforeClusterCreateResponse(a.(*v1alpha2.BeforeClusterCreateResponse), b.(*BeforeClusterCreateResponse), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*BeforeClusterDeleteRequest)(nil), (*v1alpha2.BeforeClusterDeleteRequest)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_BeforeClusterDeleteRequest_To_v1alpha2_BeforeClusterDeleteRequest(a.(*BeforeClusterDeleteRequest), b.(*v1alpha2.BeforeClusterDeleteRequest), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.BeforeClusterDeleteRequest)(nil), (*BeforeClusterDeleteRequest)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_BeforeClusterDeleteRequest_To_v1alpha1_BeforeClusterDeleteRequest(a.(*v1alpha2.BeforeClusterDeleteRequest), b.(*BeforeClusterDeleteRequest), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*BeforeClusterDeleteResponse)(nil), (*v1alpha2.BeforeClusterDeleteResponse)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_BeforeClusterDeleteResponse_To_v1alpha2_BeforeClusterDeleteResponse(a.(*BeforeClusterDeleteResponse), b.(*v1alpha2.BeforeClusterDeleteResponse), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.BeforeClusterDeleteResponse)(nil), (*BeforeClusterDeleteResponse)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_BeforeClusterDeleteResponse_To_v1alpha1_BeforeClusterDeleteResponse(a.(*v1alpha2.BeforeClusterDeleteResponse), b.(*BeforeClusterDeleteResponse), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*BeforeClusterUpgradeRequest)(nil), (*v1alpha2.BeforeClusterUpgradeRequest)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_BeforeClusterUpgradeRequest_To_v1alpha2_BeforeClusterUpgradeRequest(a.(*BeforeClusterUpgradeRequest), b.(*v1alpha2.BeforeClusterUpgradeRequest), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.BeforeClusterUpgradeRequest)(nil), (*BeforeClusterUpgradeRequest)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_BeforeClusterUpgradeRequest_To_v1alpha1_BeforeClusterUpgradeRequest(a.(*v1alpha2.BeforeClusterUpgradeRequest), b.(*BeforeClusterUpgradeRequest), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*BeforeClusterUpgradeResponse)(nil), (*v1alpha2.BeforeClusterUpgradeResponse)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_BeforeClusterUpgradeResponse_To_v1alpha2_BeforeClusterUpgradeResponse(a.(*BeforeClusterUpgradeResponse), b.(*v1alpha2.BeforeClusterUpgradeResponse), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.BeforeClusterUpgradeResponse)(nil), (*BeforeClusterUpgradeResponse)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_BeforeClusterUpgradeResponse_To_v1alpha1_BeforeClusterUpgradeResponse(a.(*v1alpha2.BeforeClusterUpgradeResponse), b.(*BeforeClusterUpgradeResponse), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*CommonResponse)(nil), (*v1alpha2.CommonResponse)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_CommonResponse_To_v1alpha2_CommonResponse(a.(*CommonResponse), b.(*v1alpha2.CommonResponse), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.CommonResponse)(nil), (*CommonResponse)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_CommonResponse_To_v1alpha1_CommonResponse(a.(*v1alpha2.CommonResponse), b.(*CommonResponse), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*CommonRetryResponse)(nil), (*v1alpha2.CommonRetryResponse)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_CommonRetryResponse_To_v1alpha2_CommonRetryResponse(a.(*CommonRetryResponse), b.(*v1alpha2.CommonRetryResponse), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.CommonRetryResponse)(nil), (*CommonRetryResponse)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_CommonRetryResponse_To_v1alpha1_CommonRetryResponse(a.(*v1alpha2.CommonRetryResponse), b.(*CommonRetryResponse), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DiscoveryRequest)(nil), (*v1alpha2.DiscoveryRequest)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_DiscoveryRequest_To_v1alpha2_DiscoveryRequest(a.(*DiscoveryRequest), b.(*v1alpha2.DiscoveryRequest), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.DiscoveryRequest)(nil), (*DiscoveryRequest)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_DiscoveryRequest_To_v1alpha1_DiscoveryRequest(a.(*v1alpha2.DiscoveryRequest), b.(*DiscoveryRequest), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DiscoveryResponse)(nil), (*v1alpha2.DiscoveryResponse)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_DiscoveryResponse_To_v1alpha2_DiscoveryResponse(a.(*DiscoveryResponse), b.(*v1alpha2.DiscoveryResponse), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.DiscoveryResponse)(nil), (*DiscoveryResponse)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_DiscoveryResponse_To_v1alpha1_DiscoveryResponse(a.(*v1alpha2.DiscoveryResponse), b.(*DiscoveryResponse), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ExtensionHandler)(nil), (*v1alpha2.ExtensionHandler)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ExtensionHandler_To_v1alpha2_ExtensionHandler(a.(*ExtensionHandler), b.(*v1alpha2.ExtensionHandler), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.ExtensionHandler)(nil), (*ExtensionHandler)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_ExtensionHandler_To_v1alpha1_ExtensionHandler(a.(*v1alpha2.ExtensionHandler), b.(*ExtensionHandler), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*GeneratePatchesRequest)(nil), (*v1alpha2.GeneratePatchesRequest)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_GeneratePatchesRequest_To_v1alpha2_GeneratePatchesRequest(a.(*GeneratePatchesRequest), b.(*v1alpha2.GeneratePatchesRequest), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.GeneratePatchesRequest)(nil), (*GeneratePatchesRequest)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_GeneratePatchesRequest_To_v1alpha1_GeneratePatchesRequest(a.(*v1alpha2.GeneratePatchesRequest), b.(*GeneratePatchesRequest), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*GeneratePatchesRequestItem)(nil), (*v1alpha2.GeneratePatchesRequestItem)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_GeneratePatchesRequestItem_To_v1alpha2_GeneratePatchesRequestItem(a.(*GeneratePatchesRequestItem), b.(*v1alpha2.GeneratePatchesRequestItem), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.GeneratePatchesRequestItem)(nil), (*GeneratePatchesRequestItem)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_GeneratePatchesRequestItem_To_v1alpha1_GeneratePatchesRequestItem(a.(*v1alpha2.GeneratePatchesRequestItem), b.(*GeneratePatchesRequestItem), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*GeneratePatchesResponse)(nil), (*v1alpha2.GeneratePatchesResponse)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_GeneratePatchesResponse_To_v1alpha2_GeneratePatchesResponse(a.(*GeneratePatchesResponse), b.(*v1alpha2.GeneratePatchesResponse), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.GeneratePatchesResponse)(nil), (*GeneratePatchesResponse)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_GeneratePatchesResponse_To_v1alpha1_GeneratePatchesResponse(a.(*v1alpha2.GeneratePatchesResponse), b.(*GeneratePatchesResponse), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*GeneratePatchesResponseItem)(nil), (*v1alpha2.GeneratePatchesResponseItem)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_GeneratePatchesResponseItem_To_v1alpha2_GeneratePatchesResponseItem(a.(*GeneratePatchesResponseItem), b.(*v1alpha2.GeneratePatchesResponseItem), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.GeneratePatchesResponseItem)(nil), (*GeneratePatchesResponseItem)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_GeneratePatchesResponseItem_To_v1alpha1_GeneratePatchesResponseItem(a.(*v1alpha2.GeneratePatchesResponseItem), b.(*GeneratePatchesResponseItem), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*GroupVersionHook)(nil), (*v1alpha2.GroupVersionHook)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_GroupVersionHook_To_v1alpha2_GroupVersionHook(a.(*GroupVersionHook), b.(*v1alpha2.GroupVersionHook), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.GroupVersionHook)(nil), (*GroupVersionHook)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_GroupVersionHook_To_v1alpha1_GroupVersionHook(a.(*v1alpha2.GroupVersionHook), b.(*GroupVersionHook), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*HolderReference)(nil), (*v1alpha2.HolderReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_HolderReference_To_v1alpha2_HolderReference(a.(*HolderReference), b.(*v1alpha2.HolderReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.HolderReference)(nil), (*HolderReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_HolderReference_To_v1alpha1_HolderReference(a.(*v1alpha2.HolderReference), b.(*HolderReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ValidateTopologyRequest)(nil), (*v1alpha2.ValidateTopologyRequest)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ValidateTopologyRequest_To_v1alpha2_ValidateTopologyRequest(a.(*ValidateTopologyRequest), b.(*v1alpha2.ValidateTopologyRequest), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.ValidateTopologyRequest)(nil), (*ValidateTopologyRequest)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_ValidateTopologyRequest_To_v1alpha1_ValidateTopologyRequest(a.(*v1alpha2.ValidateTopologyRequest), b.(*ValidateTopologyRequest), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ValidateTopologyRequestItem)(nil), (*v1alpha2.ValidateTopologyRequestItem)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ValidateTopologyRequestItem_To_v1alpha2_ValidateTopologyRequestItem(a.(*ValidateTopologyRequestItem), b.(*v1alpha2.ValidateTopologyRequestItem), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.ValidateTopologyRequestItem)(nil), (*ValidateTopologyRequestItem)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_ValidateTopologyRequestItem_To_v1alpha1_ValidateTopologyRequestItem(a.(*v1alpha2.ValidateTopologyRequestItem), b.(*ValidateTopologyRequestItem), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ValidateTopologyResponse)(nil), (*v1alpha2.ValidateTopologyResponse)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ValidateTopologyResponse_To_v1alpha2_ValidateTopologyResponse(a.(*ValidateTopologyResponse), b.(*v1alpha2.ValidateTopologyResponse), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.ValidateTopologyResponse)(nil), (*ValidateTopologyResponse)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_ValidateTopologyResponse_To_v1alpha1_ValidateTopologyResponse(a.(*v1alpha2.ValidateTopologyResponse), b.(*ValidateTopologyResponse), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Variable)(nil), (*v1alpha2.Variable)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Variable_To_v1alpha2_Variable(a.(*Variable), b.(*v1alpha2.Variable), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.Variable)(nil), (*Variable)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_Variable_To_v1alpha1_Variable(a.(*v1alpha2.Variable), b.(*Variable), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*v1alpha4.Cluster)(nil), (*v1beta1.Cluster)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_Cluster_To_v1beta1_Cluster(a.(*v1alpha4.Cluster), b.(*v1beta1.Cluster), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*v1beta1.Cluster)(nil), (*v1alpha4.Cluster)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_Cluster_To_v1alpha4_Cluster(a.(*v1beta1.Cluster), b.(*v1alpha4.Cluster), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1alpha1_AfterClusterUpgradeRequest_To_v1alpha2_AfterClusterUpgradeRequest(in *AfterClusterUpgradeRequest, out *v1alpha2.AfterClusterUpgradeRequest, s conversion.Scope) error { + if err := Convert_v1alpha4_Cluster_To_v1beta1_Cluster(&in.Cluster, &out.Cluster, s); err != nil { + return err + } + out.KubernetesVersion = in.KubernetesVersion + return nil +} + +// Convert_v1alpha1_AfterClusterUpgradeRequest_To_v1alpha2_AfterClusterUpgradeRequest is an autogenerated conversion function. +func Convert_v1alpha1_AfterClusterUpgradeRequest_To_v1alpha2_AfterClusterUpgradeRequest(in *AfterClusterUpgradeRequest, out *v1alpha2.AfterClusterUpgradeRequest, s conversion.Scope) error { + return autoConvert_v1alpha1_AfterClusterUpgradeRequest_To_v1alpha2_AfterClusterUpgradeRequest(in, out, s) +} + +func autoConvert_v1alpha2_AfterClusterUpgradeRequest_To_v1alpha1_AfterClusterUpgradeRequest(in *v1alpha2.AfterClusterUpgradeRequest, out *AfterClusterUpgradeRequest, s conversion.Scope) error { + if err := Convert_v1beta1_Cluster_To_v1alpha4_Cluster(&in.Cluster, &out.Cluster, s); err != nil { + return err + } + out.KubernetesVersion = in.KubernetesVersion + return nil +} + +// Convert_v1alpha2_AfterClusterUpgradeRequest_To_v1alpha1_AfterClusterUpgradeRequest is an autogenerated conversion function. +func Convert_v1alpha2_AfterClusterUpgradeRequest_To_v1alpha1_AfterClusterUpgradeRequest(in *v1alpha2.AfterClusterUpgradeRequest, out *AfterClusterUpgradeRequest, s conversion.Scope) error { + return autoConvert_v1alpha2_AfterClusterUpgradeRequest_To_v1alpha1_AfterClusterUpgradeRequest(in, out, s) +} + +func autoConvert_v1alpha1_AfterClusterUpgradeResponse_To_v1alpha2_AfterClusterUpgradeResponse(in *AfterClusterUpgradeResponse, out *v1alpha2.AfterClusterUpgradeResponse, s conversion.Scope) error { + if err := Convert_v1alpha1_CommonResponse_To_v1alpha2_CommonResponse(&in.CommonResponse, &out.CommonResponse, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_AfterClusterUpgradeResponse_To_v1alpha2_AfterClusterUpgradeResponse is an autogenerated conversion function. +func Convert_v1alpha1_AfterClusterUpgradeResponse_To_v1alpha2_AfterClusterUpgradeResponse(in *AfterClusterUpgradeResponse, out *v1alpha2.AfterClusterUpgradeResponse, s conversion.Scope) error { + return autoConvert_v1alpha1_AfterClusterUpgradeResponse_To_v1alpha2_AfterClusterUpgradeResponse(in, out, s) +} + +func autoConvert_v1alpha2_AfterClusterUpgradeResponse_To_v1alpha1_AfterClusterUpgradeResponse(in *v1alpha2.AfterClusterUpgradeResponse, out *AfterClusterUpgradeResponse, s conversion.Scope) error { + if err := Convert_v1alpha2_CommonResponse_To_v1alpha1_CommonResponse(&in.CommonResponse, &out.CommonResponse, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha2_AfterClusterUpgradeResponse_To_v1alpha1_AfterClusterUpgradeResponse is an autogenerated conversion function. +func Convert_v1alpha2_AfterClusterUpgradeResponse_To_v1alpha1_AfterClusterUpgradeResponse(in *v1alpha2.AfterClusterUpgradeResponse, out *AfterClusterUpgradeResponse, s conversion.Scope) error { + return autoConvert_v1alpha2_AfterClusterUpgradeResponse_To_v1alpha1_AfterClusterUpgradeResponse(in, out, s) +} + +func autoConvert_v1alpha1_AfterControlPlaneInitializedRequest_To_v1alpha2_AfterControlPlaneInitializedRequest(in *AfterControlPlaneInitializedRequest, out *v1alpha2.AfterControlPlaneInitializedRequest, s conversion.Scope) error { + if err := Convert_v1alpha4_Cluster_To_v1beta1_Cluster(&in.Cluster, &out.Cluster, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_AfterControlPlaneInitializedRequest_To_v1alpha2_AfterControlPlaneInitializedRequest is an autogenerated conversion function. +func Convert_v1alpha1_AfterControlPlaneInitializedRequest_To_v1alpha2_AfterControlPlaneInitializedRequest(in *AfterControlPlaneInitializedRequest, out *v1alpha2.AfterControlPlaneInitializedRequest, s conversion.Scope) error { + return autoConvert_v1alpha1_AfterControlPlaneInitializedRequest_To_v1alpha2_AfterControlPlaneInitializedRequest(in, out, s) +} + +func autoConvert_v1alpha2_AfterControlPlaneInitializedRequest_To_v1alpha1_AfterControlPlaneInitializedRequest(in *v1alpha2.AfterControlPlaneInitializedRequest, out *AfterControlPlaneInitializedRequest, s conversion.Scope) error { + if err := Convert_v1beta1_Cluster_To_v1alpha4_Cluster(&in.Cluster, &out.Cluster, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha2_AfterControlPlaneInitializedRequest_To_v1alpha1_AfterControlPlaneInitializedRequest is an autogenerated conversion function. +func Convert_v1alpha2_AfterControlPlaneInitializedRequest_To_v1alpha1_AfterControlPlaneInitializedRequest(in *v1alpha2.AfterControlPlaneInitializedRequest, out *AfterControlPlaneInitializedRequest, s conversion.Scope) error { + return autoConvert_v1alpha2_AfterControlPlaneInitializedRequest_To_v1alpha1_AfterControlPlaneInitializedRequest(in, out, s) +} + +func autoConvert_v1alpha1_AfterControlPlaneInitializedResponse_To_v1alpha2_AfterControlPlaneInitializedResponse(in *AfterControlPlaneInitializedResponse, out *v1alpha2.AfterControlPlaneInitializedResponse, s conversion.Scope) error { + if err := Convert_v1alpha1_CommonResponse_To_v1alpha2_CommonResponse(&in.CommonResponse, &out.CommonResponse, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_AfterControlPlaneInitializedResponse_To_v1alpha2_AfterControlPlaneInitializedResponse is an autogenerated conversion function. +func Convert_v1alpha1_AfterControlPlaneInitializedResponse_To_v1alpha2_AfterControlPlaneInitializedResponse(in *AfterControlPlaneInitializedResponse, out *v1alpha2.AfterControlPlaneInitializedResponse, s conversion.Scope) error { + return autoConvert_v1alpha1_AfterControlPlaneInitializedResponse_To_v1alpha2_AfterControlPlaneInitializedResponse(in, out, s) +} + +func autoConvert_v1alpha2_AfterControlPlaneInitializedResponse_To_v1alpha1_AfterControlPlaneInitializedResponse(in *v1alpha2.AfterControlPlaneInitializedResponse, out *AfterControlPlaneInitializedResponse, s conversion.Scope) error { + if err := Convert_v1alpha2_CommonResponse_To_v1alpha1_CommonResponse(&in.CommonResponse, &out.CommonResponse, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha2_AfterControlPlaneInitializedResponse_To_v1alpha1_AfterControlPlaneInitializedResponse is an autogenerated conversion function. +func Convert_v1alpha2_AfterControlPlaneInitializedResponse_To_v1alpha1_AfterControlPlaneInitializedResponse(in *v1alpha2.AfterControlPlaneInitializedResponse, out *AfterControlPlaneInitializedResponse, s conversion.Scope) error { + return autoConvert_v1alpha2_AfterControlPlaneInitializedResponse_To_v1alpha1_AfterControlPlaneInitializedResponse(in, out, s) +} + +func autoConvert_v1alpha1_AfterControlPlaneUpgradeRequest_To_v1alpha2_AfterControlPlaneUpgradeRequest(in *AfterControlPlaneUpgradeRequest, out *v1alpha2.AfterControlPlaneUpgradeRequest, s conversion.Scope) error { + if err := Convert_v1alpha4_Cluster_To_v1beta1_Cluster(&in.Cluster, &out.Cluster, s); err != nil { + return err + } + out.KubernetesVersion = in.KubernetesVersion + return nil +} + +// Convert_v1alpha1_AfterControlPlaneUpgradeRequest_To_v1alpha2_AfterControlPlaneUpgradeRequest is an autogenerated conversion function. +func Convert_v1alpha1_AfterControlPlaneUpgradeRequest_To_v1alpha2_AfterControlPlaneUpgradeRequest(in *AfterControlPlaneUpgradeRequest, out *v1alpha2.AfterControlPlaneUpgradeRequest, s conversion.Scope) error { + return autoConvert_v1alpha1_AfterControlPlaneUpgradeRequest_To_v1alpha2_AfterControlPlaneUpgradeRequest(in, out, s) +} + +func autoConvert_v1alpha2_AfterControlPlaneUpgradeRequest_To_v1alpha1_AfterControlPlaneUpgradeRequest(in *v1alpha2.AfterControlPlaneUpgradeRequest, out *AfterControlPlaneUpgradeRequest, s conversion.Scope) error { + if err := Convert_v1beta1_Cluster_To_v1alpha4_Cluster(&in.Cluster, &out.Cluster, s); err != nil { + return err + } + out.KubernetesVersion = in.KubernetesVersion + return nil +} + +// Convert_v1alpha2_AfterControlPlaneUpgradeRequest_To_v1alpha1_AfterControlPlaneUpgradeRequest is an autogenerated conversion function. +func Convert_v1alpha2_AfterControlPlaneUpgradeRequest_To_v1alpha1_AfterControlPlaneUpgradeRequest(in *v1alpha2.AfterControlPlaneUpgradeRequest, out *AfterControlPlaneUpgradeRequest, s conversion.Scope) error { + return autoConvert_v1alpha2_AfterControlPlaneUpgradeRequest_To_v1alpha1_AfterControlPlaneUpgradeRequest(in, out, s) +} + +func autoConvert_v1alpha1_AfterControlPlaneUpgradeResponse_To_v1alpha2_AfterControlPlaneUpgradeResponse(in *AfterControlPlaneUpgradeResponse, out *v1alpha2.AfterControlPlaneUpgradeResponse, s conversion.Scope) error { + if err := Convert_v1alpha1_CommonRetryResponse_To_v1alpha2_CommonRetryResponse(&in.CommonRetryResponse, &out.CommonRetryResponse, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_AfterControlPlaneUpgradeResponse_To_v1alpha2_AfterControlPlaneUpgradeResponse is an autogenerated conversion function. +func Convert_v1alpha1_AfterControlPlaneUpgradeResponse_To_v1alpha2_AfterControlPlaneUpgradeResponse(in *AfterControlPlaneUpgradeResponse, out *v1alpha2.AfterControlPlaneUpgradeResponse, s conversion.Scope) error { + return autoConvert_v1alpha1_AfterControlPlaneUpgradeResponse_To_v1alpha2_AfterControlPlaneUpgradeResponse(in, out, s) +} + +func autoConvert_v1alpha2_AfterControlPlaneUpgradeResponse_To_v1alpha1_AfterControlPlaneUpgradeResponse(in *v1alpha2.AfterControlPlaneUpgradeResponse, out *AfterControlPlaneUpgradeResponse, s conversion.Scope) error { + if err := Convert_v1alpha2_CommonRetryResponse_To_v1alpha1_CommonRetryResponse(&in.CommonRetryResponse, &out.CommonRetryResponse, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha2_AfterControlPlaneUpgradeResponse_To_v1alpha1_AfterControlPlaneUpgradeResponse is an autogenerated conversion function. +func Convert_v1alpha2_AfterControlPlaneUpgradeResponse_To_v1alpha1_AfterControlPlaneUpgradeResponse(in *v1alpha2.AfterControlPlaneUpgradeResponse, out *AfterControlPlaneUpgradeResponse, s conversion.Scope) error { + return autoConvert_v1alpha2_AfterControlPlaneUpgradeResponse_To_v1alpha1_AfterControlPlaneUpgradeResponse(in, out, s) +} + +func autoConvert_v1alpha1_BeforeClusterCreateRequest_To_v1alpha2_BeforeClusterCreateRequest(in *BeforeClusterCreateRequest, out *v1alpha2.BeforeClusterCreateRequest, s conversion.Scope) error { + if err := Convert_v1alpha4_Cluster_To_v1beta1_Cluster(&in.Cluster, &out.Cluster, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_BeforeClusterCreateRequest_To_v1alpha2_BeforeClusterCreateRequest is an autogenerated conversion function. +func Convert_v1alpha1_BeforeClusterCreateRequest_To_v1alpha2_BeforeClusterCreateRequest(in *BeforeClusterCreateRequest, out *v1alpha2.BeforeClusterCreateRequest, s conversion.Scope) error { + return autoConvert_v1alpha1_BeforeClusterCreateRequest_To_v1alpha2_BeforeClusterCreateRequest(in, out, s) +} + +func autoConvert_v1alpha2_BeforeClusterCreateRequest_To_v1alpha1_BeforeClusterCreateRequest(in *v1alpha2.BeforeClusterCreateRequest, out *BeforeClusterCreateRequest, s conversion.Scope) error { + if err := Convert_v1beta1_Cluster_To_v1alpha4_Cluster(&in.Cluster, &out.Cluster, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha2_BeforeClusterCreateRequest_To_v1alpha1_BeforeClusterCreateRequest is an autogenerated conversion function. +func Convert_v1alpha2_BeforeClusterCreateRequest_To_v1alpha1_BeforeClusterCreateRequest(in *v1alpha2.BeforeClusterCreateRequest, out *BeforeClusterCreateRequest, s conversion.Scope) error { + return autoConvert_v1alpha2_BeforeClusterCreateRequest_To_v1alpha1_BeforeClusterCreateRequest(in, out, s) +} + +func autoConvert_v1alpha1_BeforeClusterCreateResponse_To_v1alpha2_BeforeClusterCreateResponse(in *BeforeClusterCreateResponse, out *v1alpha2.BeforeClusterCreateResponse, s conversion.Scope) error { + if err := Convert_v1alpha1_CommonRetryResponse_To_v1alpha2_CommonRetryResponse(&in.CommonRetryResponse, &out.CommonRetryResponse, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_BeforeClusterCreateResponse_To_v1alpha2_BeforeClusterCreateResponse is an autogenerated conversion function. +func Convert_v1alpha1_BeforeClusterCreateResponse_To_v1alpha2_BeforeClusterCreateResponse(in *BeforeClusterCreateResponse, out *v1alpha2.BeforeClusterCreateResponse, s conversion.Scope) error { + return autoConvert_v1alpha1_BeforeClusterCreateResponse_To_v1alpha2_BeforeClusterCreateResponse(in, out, s) +} + +func autoConvert_v1alpha2_BeforeClusterCreateResponse_To_v1alpha1_BeforeClusterCreateResponse(in *v1alpha2.BeforeClusterCreateResponse, out *BeforeClusterCreateResponse, s conversion.Scope) error { + if err := Convert_v1alpha2_CommonRetryResponse_To_v1alpha1_CommonRetryResponse(&in.CommonRetryResponse, &out.CommonRetryResponse, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha2_BeforeClusterCreateResponse_To_v1alpha1_BeforeClusterCreateResponse is an autogenerated conversion function. +func Convert_v1alpha2_BeforeClusterCreateResponse_To_v1alpha1_BeforeClusterCreateResponse(in *v1alpha2.BeforeClusterCreateResponse, out *BeforeClusterCreateResponse, s conversion.Scope) error { + return autoConvert_v1alpha2_BeforeClusterCreateResponse_To_v1alpha1_BeforeClusterCreateResponse(in, out, s) +} + +func autoConvert_v1alpha1_BeforeClusterDeleteRequest_To_v1alpha2_BeforeClusterDeleteRequest(in *BeforeClusterDeleteRequest, out *v1alpha2.BeforeClusterDeleteRequest, s conversion.Scope) error { + if err := Convert_v1alpha4_Cluster_To_v1beta1_Cluster(&in.Cluster, &out.Cluster, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_BeforeClusterDeleteRequest_To_v1alpha2_BeforeClusterDeleteRequest is an autogenerated conversion function. +func Convert_v1alpha1_BeforeClusterDeleteRequest_To_v1alpha2_BeforeClusterDeleteRequest(in *BeforeClusterDeleteRequest, out *v1alpha2.BeforeClusterDeleteRequest, s conversion.Scope) error { + return autoConvert_v1alpha1_BeforeClusterDeleteRequest_To_v1alpha2_BeforeClusterDeleteRequest(in, out, s) +} + +func autoConvert_v1alpha2_BeforeClusterDeleteRequest_To_v1alpha1_BeforeClusterDeleteRequest(in *v1alpha2.BeforeClusterDeleteRequest, out *BeforeClusterDeleteRequest, s conversion.Scope) error { + if err := Convert_v1beta1_Cluster_To_v1alpha4_Cluster(&in.Cluster, &out.Cluster, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha2_BeforeClusterDeleteRequest_To_v1alpha1_BeforeClusterDeleteRequest is an autogenerated conversion function. +func Convert_v1alpha2_BeforeClusterDeleteRequest_To_v1alpha1_BeforeClusterDeleteRequest(in *v1alpha2.BeforeClusterDeleteRequest, out *BeforeClusterDeleteRequest, s conversion.Scope) error { + return autoConvert_v1alpha2_BeforeClusterDeleteRequest_To_v1alpha1_BeforeClusterDeleteRequest(in, out, s) +} + +func autoConvert_v1alpha1_BeforeClusterDeleteResponse_To_v1alpha2_BeforeClusterDeleteResponse(in *BeforeClusterDeleteResponse, out *v1alpha2.BeforeClusterDeleteResponse, s conversion.Scope) error { + if err := Convert_v1alpha1_CommonRetryResponse_To_v1alpha2_CommonRetryResponse(&in.CommonRetryResponse, &out.CommonRetryResponse, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_BeforeClusterDeleteResponse_To_v1alpha2_BeforeClusterDeleteResponse is an autogenerated conversion function. +func Convert_v1alpha1_BeforeClusterDeleteResponse_To_v1alpha2_BeforeClusterDeleteResponse(in *BeforeClusterDeleteResponse, out *v1alpha2.BeforeClusterDeleteResponse, s conversion.Scope) error { + return autoConvert_v1alpha1_BeforeClusterDeleteResponse_To_v1alpha2_BeforeClusterDeleteResponse(in, out, s) +} + +func autoConvert_v1alpha2_BeforeClusterDeleteResponse_To_v1alpha1_BeforeClusterDeleteResponse(in *v1alpha2.BeforeClusterDeleteResponse, out *BeforeClusterDeleteResponse, s conversion.Scope) error { + if err := Convert_v1alpha2_CommonRetryResponse_To_v1alpha1_CommonRetryResponse(&in.CommonRetryResponse, &out.CommonRetryResponse, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha2_BeforeClusterDeleteResponse_To_v1alpha1_BeforeClusterDeleteResponse is an autogenerated conversion function. +func Convert_v1alpha2_BeforeClusterDeleteResponse_To_v1alpha1_BeforeClusterDeleteResponse(in *v1alpha2.BeforeClusterDeleteResponse, out *BeforeClusterDeleteResponse, s conversion.Scope) error { + return autoConvert_v1alpha2_BeforeClusterDeleteResponse_To_v1alpha1_BeforeClusterDeleteResponse(in, out, s) +} + +func autoConvert_v1alpha1_BeforeClusterUpgradeRequest_To_v1alpha2_BeforeClusterUpgradeRequest(in *BeforeClusterUpgradeRequest, out *v1alpha2.BeforeClusterUpgradeRequest, s conversion.Scope) error { + if err := Convert_v1alpha4_Cluster_To_v1beta1_Cluster(&in.Cluster, &out.Cluster, s); err != nil { + return err + } + out.FromKubernetesVersion = in.FromKubernetesVersion + out.ToKubernetesVersion = in.ToKubernetesVersion + return nil +} + +// Convert_v1alpha1_BeforeClusterUpgradeRequest_To_v1alpha2_BeforeClusterUpgradeRequest is an autogenerated conversion function. +func Convert_v1alpha1_BeforeClusterUpgradeRequest_To_v1alpha2_BeforeClusterUpgradeRequest(in *BeforeClusterUpgradeRequest, out *v1alpha2.BeforeClusterUpgradeRequest, s conversion.Scope) error { + return autoConvert_v1alpha1_BeforeClusterUpgradeRequest_To_v1alpha2_BeforeClusterUpgradeRequest(in, out, s) +} + +func autoConvert_v1alpha2_BeforeClusterUpgradeRequest_To_v1alpha1_BeforeClusterUpgradeRequest(in *v1alpha2.BeforeClusterUpgradeRequest, out *BeforeClusterUpgradeRequest, s conversion.Scope) error { + if err := Convert_v1beta1_Cluster_To_v1alpha4_Cluster(&in.Cluster, &out.Cluster, s); err != nil { + return err + } + out.FromKubernetesVersion = in.FromKubernetesVersion + out.ToKubernetesVersion = in.ToKubernetesVersion + return nil +} + +// Convert_v1alpha2_BeforeClusterUpgradeRequest_To_v1alpha1_BeforeClusterUpgradeRequest is an autogenerated conversion function. +func Convert_v1alpha2_BeforeClusterUpgradeRequest_To_v1alpha1_BeforeClusterUpgradeRequest(in *v1alpha2.BeforeClusterUpgradeRequest, out *BeforeClusterUpgradeRequest, s conversion.Scope) error { + return autoConvert_v1alpha2_BeforeClusterUpgradeRequest_To_v1alpha1_BeforeClusterUpgradeRequest(in, out, s) +} + +func autoConvert_v1alpha1_BeforeClusterUpgradeResponse_To_v1alpha2_BeforeClusterUpgradeResponse(in *BeforeClusterUpgradeResponse, out *v1alpha2.BeforeClusterUpgradeResponse, s conversion.Scope) error { + if err := Convert_v1alpha1_CommonRetryResponse_To_v1alpha2_CommonRetryResponse(&in.CommonRetryResponse, &out.CommonRetryResponse, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_BeforeClusterUpgradeResponse_To_v1alpha2_BeforeClusterUpgradeResponse is an autogenerated conversion function. +func Convert_v1alpha1_BeforeClusterUpgradeResponse_To_v1alpha2_BeforeClusterUpgradeResponse(in *BeforeClusterUpgradeResponse, out *v1alpha2.BeforeClusterUpgradeResponse, s conversion.Scope) error { + return autoConvert_v1alpha1_BeforeClusterUpgradeResponse_To_v1alpha2_BeforeClusterUpgradeResponse(in, out, s) +} + +func autoConvert_v1alpha2_BeforeClusterUpgradeResponse_To_v1alpha1_BeforeClusterUpgradeResponse(in *v1alpha2.BeforeClusterUpgradeResponse, out *BeforeClusterUpgradeResponse, s conversion.Scope) error { + if err := Convert_v1alpha2_CommonRetryResponse_To_v1alpha1_CommonRetryResponse(&in.CommonRetryResponse, &out.CommonRetryResponse, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha2_BeforeClusterUpgradeResponse_To_v1alpha1_BeforeClusterUpgradeResponse is an autogenerated conversion function. +func Convert_v1alpha2_BeforeClusterUpgradeResponse_To_v1alpha1_BeforeClusterUpgradeResponse(in *v1alpha2.BeforeClusterUpgradeResponse, out *BeforeClusterUpgradeResponse, s conversion.Scope) error { + return autoConvert_v1alpha2_BeforeClusterUpgradeResponse_To_v1alpha1_BeforeClusterUpgradeResponse(in, out, s) +} + +func autoConvert_v1alpha1_CommonResponse_To_v1alpha2_CommonResponse(in *CommonResponse, out *v1alpha2.CommonResponse, s conversion.Scope) error { + out.Status = v1alpha2.ResponseStatus(in.Status) + out.Message = in.Message + return nil +} + +// Convert_v1alpha1_CommonResponse_To_v1alpha2_CommonResponse is an autogenerated conversion function. +func Convert_v1alpha1_CommonResponse_To_v1alpha2_CommonResponse(in *CommonResponse, out *v1alpha2.CommonResponse, s conversion.Scope) error { + return autoConvert_v1alpha1_CommonResponse_To_v1alpha2_CommonResponse(in, out, s) +} + +func autoConvert_v1alpha2_CommonResponse_To_v1alpha1_CommonResponse(in *v1alpha2.CommonResponse, out *CommonResponse, s conversion.Scope) error { + out.Status = ResponseStatus(in.Status) + out.Message = in.Message + return nil +} + +// Convert_v1alpha2_CommonResponse_To_v1alpha1_CommonResponse is an autogenerated conversion function. +func Convert_v1alpha2_CommonResponse_To_v1alpha1_CommonResponse(in *v1alpha2.CommonResponse, out *CommonResponse, s conversion.Scope) error { + return autoConvert_v1alpha2_CommonResponse_To_v1alpha1_CommonResponse(in, out, s) +} + +func autoConvert_v1alpha1_CommonRetryResponse_To_v1alpha2_CommonRetryResponse(in *CommonRetryResponse, out *v1alpha2.CommonRetryResponse, s conversion.Scope) error { + if err := Convert_v1alpha1_CommonResponse_To_v1alpha2_CommonResponse(&in.CommonResponse, &out.CommonResponse, s); err != nil { + return err + } + out.RetryAfterSeconds = in.RetryAfterSeconds + return nil +} + +// Convert_v1alpha1_CommonRetryResponse_To_v1alpha2_CommonRetryResponse is an autogenerated conversion function. +func Convert_v1alpha1_CommonRetryResponse_To_v1alpha2_CommonRetryResponse(in *CommonRetryResponse, out *v1alpha2.CommonRetryResponse, s conversion.Scope) error { + return autoConvert_v1alpha1_CommonRetryResponse_To_v1alpha2_CommonRetryResponse(in, out, s) +} + +func autoConvert_v1alpha2_CommonRetryResponse_To_v1alpha1_CommonRetryResponse(in *v1alpha2.CommonRetryResponse, out *CommonRetryResponse, s conversion.Scope) error { + if err := Convert_v1alpha2_CommonResponse_To_v1alpha1_CommonResponse(&in.CommonResponse, &out.CommonResponse, s); err != nil { + return err + } + out.RetryAfterSeconds = in.RetryAfterSeconds + return nil +} + +// Convert_v1alpha2_CommonRetryResponse_To_v1alpha1_CommonRetryResponse is an autogenerated conversion function. +func Convert_v1alpha2_CommonRetryResponse_To_v1alpha1_CommonRetryResponse(in *v1alpha2.CommonRetryResponse, out *CommonRetryResponse, s conversion.Scope) error { + return autoConvert_v1alpha2_CommonRetryResponse_To_v1alpha1_CommonRetryResponse(in, out, s) +} + +func autoConvert_v1alpha1_DiscoveryRequest_To_v1alpha2_DiscoveryRequest(in *DiscoveryRequest, out *v1alpha2.DiscoveryRequest, s conversion.Scope) error { + return nil +} + +// Convert_v1alpha1_DiscoveryRequest_To_v1alpha2_DiscoveryRequest is an autogenerated conversion function. +func Convert_v1alpha1_DiscoveryRequest_To_v1alpha2_DiscoveryRequest(in *DiscoveryRequest, out *v1alpha2.DiscoveryRequest, s conversion.Scope) error { + return autoConvert_v1alpha1_DiscoveryRequest_To_v1alpha2_DiscoveryRequest(in, out, s) +} + +func autoConvert_v1alpha2_DiscoveryRequest_To_v1alpha1_DiscoveryRequest(in *v1alpha2.DiscoveryRequest, out *DiscoveryRequest, s conversion.Scope) error { + return nil +} + +// Convert_v1alpha2_DiscoveryRequest_To_v1alpha1_DiscoveryRequest is an autogenerated conversion function. +func Convert_v1alpha2_DiscoveryRequest_To_v1alpha1_DiscoveryRequest(in *v1alpha2.DiscoveryRequest, out *DiscoveryRequest, s conversion.Scope) error { + return autoConvert_v1alpha2_DiscoveryRequest_To_v1alpha1_DiscoveryRequest(in, out, s) +} + +func autoConvert_v1alpha1_DiscoveryResponse_To_v1alpha2_DiscoveryResponse(in *DiscoveryResponse, out *v1alpha2.DiscoveryResponse, s conversion.Scope) error { + if err := Convert_v1alpha1_CommonResponse_To_v1alpha2_CommonResponse(&in.CommonResponse, &out.CommonResponse, s); err != nil { + return err + } + out.Handlers = *(*[]v1alpha2.ExtensionHandler)(unsafe.Pointer(&in.Handlers)) + return nil +} + +// Convert_v1alpha1_DiscoveryResponse_To_v1alpha2_DiscoveryResponse is an autogenerated conversion function. +func Convert_v1alpha1_DiscoveryResponse_To_v1alpha2_DiscoveryResponse(in *DiscoveryResponse, out *v1alpha2.DiscoveryResponse, s conversion.Scope) error { + return autoConvert_v1alpha1_DiscoveryResponse_To_v1alpha2_DiscoveryResponse(in, out, s) +} + +func autoConvert_v1alpha2_DiscoveryResponse_To_v1alpha1_DiscoveryResponse(in *v1alpha2.DiscoveryResponse, out *DiscoveryResponse, s conversion.Scope) error { + if err := Convert_v1alpha2_CommonResponse_To_v1alpha1_CommonResponse(&in.CommonResponse, &out.CommonResponse, s); err != nil { + return err + } + out.Handlers = *(*[]ExtensionHandler)(unsafe.Pointer(&in.Handlers)) + return nil +} + +// Convert_v1alpha2_DiscoveryResponse_To_v1alpha1_DiscoveryResponse is an autogenerated conversion function. +func Convert_v1alpha2_DiscoveryResponse_To_v1alpha1_DiscoveryResponse(in *v1alpha2.DiscoveryResponse, out *DiscoveryResponse, s conversion.Scope) error { + return autoConvert_v1alpha2_DiscoveryResponse_To_v1alpha1_DiscoveryResponse(in, out, s) +} + +func autoConvert_v1alpha1_ExtensionHandler_To_v1alpha2_ExtensionHandler(in *ExtensionHandler, out *v1alpha2.ExtensionHandler, s conversion.Scope) error { + out.Name = in.Name + if err := Convert_v1alpha1_GroupVersionHook_To_v1alpha2_GroupVersionHook(&in.RequestHook, &out.RequestHook, s); err != nil { + return err + } + out.TimeoutSeconds = (*int32)(unsafe.Pointer(in.TimeoutSeconds)) + out.FailurePolicy = (*v1alpha2.FailurePolicy)(unsafe.Pointer(in.FailurePolicy)) + return nil +} + +// Convert_v1alpha1_ExtensionHandler_To_v1alpha2_ExtensionHandler is an autogenerated conversion function. +func Convert_v1alpha1_ExtensionHandler_To_v1alpha2_ExtensionHandler(in *ExtensionHandler, out *v1alpha2.ExtensionHandler, s conversion.Scope) error { + return autoConvert_v1alpha1_ExtensionHandler_To_v1alpha2_ExtensionHandler(in, out, s) +} + +func autoConvert_v1alpha2_ExtensionHandler_To_v1alpha1_ExtensionHandler(in *v1alpha2.ExtensionHandler, out *ExtensionHandler, s conversion.Scope) error { + out.Name = in.Name + if err := Convert_v1alpha2_GroupVersionHook_To_v1alpha1_GroupVersionHook(&in.RequestHook, &out.RequestHook, s); err != nil { + return err + } + out.TimeoutSeconds = (*int32)(unsafe.Pointer(in.TimeoutSeconds)) + out.FailurePolicy = (*FailurePolicy)(unsafe.Pointer(in.FailurePolicy)) + return nil +} + +// Convert_v1alpha2_ExtensionHandler_To_v1alpha1_ExtensionHandler is an autogenerated conversion function. +func Convert_v1alpha2_ExtensionHandler_To_v1alpha1_ExtensionHandler(in *v1alpha2.ExtensionHandler, out *ExtensionHandler, s conversion.Scope) error { + return autoConvert_v1alpha2_ExtensionHandler_To_v1alpha1_ExtensionHandler(in, out, s) +} + +func autoConvert_v1alpha1_GeneratePatchesRequest_To_v1alpha2_GeneratePatchesRequest(in *GeneratePatchesRequest, out *v1alpha2.GeneratePatchesRequest, s conversion.Scope) error { + out.Variables = *(*[]v1alpha2.Variable)(unsafe.Pointer(&in.Variables)) + out.Items = *(*[]v1alpha2.GeneratePatchesRequestItem)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha1_GeneratePatchesRequest_To_v1alpha2_GeneratePatchesRequest is an autogenerated conversion function. +func Convert_v1alpha1_GeneratePatchesRequest_To_v1alpha2_GeneratePatchesRequest(in *GeneratePatchesRequest, out *v1alpha2.GeneratePatchesRequest, s conversion.Scope) error { + return autoConvert_v1alpha1_GeneratePatchesRequest_To_v1alpha2_GeneratePatchesRequest(in, out, s) +} + +func autoConvert_v1alpha2_GeneratePatchesRequest_To_v1alpha1_GeneratePatchesRequest(in *v1alpha2.GeneratePatchesRequest, out *GeneratePatchesRequest, s conversion.Scope) error { + out.Variables = *(*[]Variable)(unsafe.Pointer(&in.Variables)) + out.Items = *(*[]GeneratePatchesRequestItem)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha2_GeneratePatchesRequest_To_v1alpha1_GeneratePatchesRequest is an autogenerated conversion function. +func Convert_v1alpha2_GeneratePatchesRequest_To_v1alpha1_GeneratePatchesRequest(in *v1alpha2.GeneratePatchesRequest, out *GeneratePatchesRequest, s conversion.Scope) error { + return autoConvert_v1alpha2_GeneratePatchesRequest_To_v1alpha1_GeneratePatchesRequest(in, out, s) +} + +func autoConvert_v1alpha1_GeneratePatchesRequestItem_To_v1alpha2_GeneratePatchesRequestItem(in *GeneratePatchesRequestItem, out *v1alpha2.GeneratePatchesRequestItem, s conversion.Scope) error { + out.UID = types.UID(in.UID) + if err := Convert_v1alpha1_HolderReference_To_v1alpha2_HolderReference(&in.HolderReference, &out.HolderReference, s); err != nil { + return err + } + out.Object = in.Object + out.Variables = *(*[]v1alpha2.Variable)(unsafe.Pointer(&in.Variables)) + return nil +} + +// Convert_v1alpha1_GeneratePatchesRequestItem_To_v1alpha2_GeneratePatchesRequestItem is an autogenerated conversion function. +func Convert_v1alpha1_GeneratePatchesRequestItem_To_v1alpha2_GeneratePatchesRequestItem(in *GeneratePatchesRequestItem, out *v1alpha2.GeneratePatchesRequestItem, s conversion.Scope) error { + return autoConvert_v1alpha1_GeneratePatchesRequestItem_To_v1alpha2_GeneratePatchesRequestItem(in, out, s) +} + +func autoConvert_v1alpha2_GeneratePatchesRequestItem_To_v1alpha1_GeneratePatchesRequestItem(in *v1alpha2.GeneratePatchesRequestItem, out *GeneratePatchesRequestItem, s conversion.Scope) error { + out.UID = types.UID(in.UID) + if err := Convert_v1alpha2_HolderReference_To_v1alpha1_HolderReference(&in.HolderReference, &out.HolderReference, s); err != nil { + return err + } + out.Object = in.Object + out.Variables = *(*[]Variable)(unsafe.Pointer(&in.Variables)) + return nil +} + +// Convert_v1alpha2_GeneratePatchesRequestItem_To_v1alpha1_GeneratePatchesRequestItem is an autogenerated conversion function. +func Convert_v1alpha2_GeneratePatchesRequestItem_To_v1alpha1_GeneratePatchesRequestItem(in *v1alpha2.GeneratePatchesRequestItem, out *GeneratePatchesRequestItem, s conversion.Scope) error { + return autoConvert_v1alpha2_GeneratePatchesRequestItem_To_v1alpha1_GeneratePatchesRequestItem(in, out, s) +} + +func autoConvert_v1alpha1_GeneratePatchesResponse_To_v1alpha2_GeneratePatchesResponse(in *GeneratePatchesResponse, out *v1alpha2.GeneratePatchesResponse, s conversion.Scope) error { + if err := Convert_v1alpha1_CommonResponse_To_v1alpha2_CommonResponse(&in.CommonResponse, &out.CommonResponse, s); err != nil { + return err + } + out.Items = *(*[]v1alpha2.GeneratePatchesResponseItem)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha1_GeneratePatchesResponse_To_v1alpha2_GeneratePatchesResponse is an autogenerated conversion function. +func Convert_v1alpha1_GeneratePatchesResponse_To_v1alpha2_GeneratePatchesResponse(in *GeneratePatchesResponse, out *v1alpha2.GeneratePatchesResponse, s conversion.Scope) error { + return autoConvert_v1alpha1_GeneratePatchesResponse_To_v1alpha2_GeneratePatchesResponse(in, out, s) +} + +func autoConvert_v1alpha2_GeneratePatchesResponse_To_v1alpha1_GeneratePatchesResponse(in *v1alpha2.GeneratePatchesResponse, out *GeneratePatchesResponse, s conversion.Scope) error { + if err := Convert_v1alpha2_CommonResponse_To_v1alpha1_CommonResponse(&in.CommonResponse, &out.CommonResponse, s); err != nil { + return err + } + out.Items = *(*[]GeneratePatchesResponseItem)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha2_GeneratePatchesResponse_To_v1alpha1_GeneratePatchesResponse is an autogenerated conversion function. +func Convert_v1alpha2_GeneratePatchesResponse_To_v1alpha1_GeneratePatchesResponse(in *v1alpha2.GeneratePatchesResponse, out *GeneratePatchesResponse, s conversion.Scope) error { + return autoConvert_v1alpha2_GeneratePatchesResponse_To_v1alpha1_GeneratePatchesResponse(in, out, s) +} + +func autoConvert_v1alpha1_GeneratePatchesResponseItem_To_v1alpha2_GeneratePatchesResponseItem(in *GeneratePatchesResponseItem, out *v1alpha2.GeneratePatchesResponseItem, s conversion.Scope) error { + out.UID = types.UID(in.UID) + out.PatchType = v1alpha2.PatchType(in.PatchType) + out.Patch = *(*[]byte)(unsafe.Pointer(&in.Patch)) + return nil +} + +// Convert_v1alpha1_GeneratePatchesResponseItem_To_v1alpha2_GeneratePatchesResponseItem is an autogenerated conversion function. +func Convert_v1alpha1_GeneratePatchesResponseItem_To_v1alpha2_GeneratePatchesResponseItem(in *GeneratePatchesResponseItem, out *v1alpha2.GeneratePatchesResponseItem, s conversion.Scope) error { + return autoConvert_v1alpha1_GeneratePatchesResponseItem_To_v1alpha2_GeneratePatchesResponseItem(in, out, s) +} + +func autoConvert_v1alpha2_GeneratePatchesResponseItem_To_v1alpha1_GeneratePatchesResponseItem(in *v1alpha2.GeneratePatchesResponseItem, out *GeneratePatchesResponseItem, s conversion.Scope) error { + out.UID = types.UID(in.UID) + out.PatchType = PatchType(in.PatchType) + out.Patch = *(*[]byte)(unsafe.Pointer(&in.Patch)) + return nil +} + +// Convert_v1alpha2_GeneratePatchesResponseItem_To_v1alpha1_GeneratePatchesResponseItem is an autogenerated conversion function. +func Convert_v1alpha2_GeneratePatchesResponseItem_To_v1alpha1_GeneratePatchesResponseItem(in *v1alpha2.GeneratePatchesResponseItem, out *GeneratePatchesResponseItem, s conversion.Scope) error { + return autoConvert_v1alpha2_GeneratePatchesResponseItem_To_v1alpha1_GeneratePatchesResponseItem(in, out, s) +} + +func autoConvert_v1alpha1_GroupVersionHook_To_v1alpha2_GroupVersionHook(in *GroupVersionHook, out *v1alpha2.GroupVersionHook, s conversion.Scope) error { + out.APIVersion = in.APIVersion + out.Hook = in.Hook + return nil +} + +// Convert_v1alpha1_GroupVersionHook_To_v1alpha2_GroupVersionHook is an autogenerated conversion function. +func Convert_v1alpha1_GroupVersionHook_To_v1alpha2_GroupVersionHook(in *GroupVersionHook, out *v1alpha2.GroupVersionHook, s conversion.Scope) error { + return autoConvert_v1alpha1_GroupVersionHook_To_v1alpha2_GroupVersionHook(in, out, s) +} + +func autoConvert_v1alpha2_GroupVersionHook_To_v1alpha1_GroupVersionHook(in *v1alpha2.GroupVersionHook, out *GroupVersionHook, s conversion.Scope) error { + out.APIVersion = in.APIVersion + out.Hook = in.Hook + return nil +} + +// Convert_v1alpha2_GroupVersionHook_To_v1alpha1_GroupVersionHook is an autogenerated conversion function. +func Convert_v1alpha2_GroupVersionHook_To_v1alpha1_GroupVersionHook(in *v1alpha2.GroupVersionHook, out *GroupVersionHook, s conversion.Scope) error { + return autoConvert_v1alpha2_GroupVersionHook_To_v1alpha1_GroupVersionHook(in, out, s) +} + +func autoConvert_v1alpha1_HolderReference_To_v1alpha2_HolderReference(in *HolderReference, out *v1alpha2.HolderReference, s conversion.Scope) error { + out.APIVersion = in.APIVersion + out.Kind = in.Kind + out.Namespace = in.Namespace + out.Name = in.Name + out.FieldPath = in.FieldPath + return nil +} + +// Convert_v1alpha1_HolderReference_To_v1alpha2_HolderReference is an autogenerated conversion function. +func Convert_v1alpha1_HolderReference_To_v1alpha2_HolderReference(in *HolderReference, out *v1alpha2.HolderReference, s conversion.Scope) error { + return autoConvert_v1alpha1_HolderReference_To_v1alpha2_HolderReference(in, out, s) +} + +func autoConvert_v1alpha2_HolderReference_To_v1alpha1_HolderReference(in *v1alpha2.HolderReference, out *HolderReference, s conversion.Scope) error { + out.APIVersion = in.APIVersion + out.Kind = in.Kind + out.Namespace = in.Namespace + out.Name = in.Name + out.FieldPath = in.FieldPath + return nil +} + +// Convert_v1alpha2_HolderReference_To_v1alpha1_HolderReference is an autogenerated conversion function. +func Convert_v1alpha2_HolderReference_To_v1alpha1_HolderReference(in *v1alpha2.HolderReference, out *HolderReference, s conversion.Scope) error { + return autoConvert_v1alpha2_HolderReference_To_v1alpha1_HolderReference(in, out, s) +} + +func autoConvert_v1alpha1_ValidateTopologyRequest_To_v1alpha2_ValidateTopologyRequest(in *ValidateTopologyRequest, out *v1alpha2.ValidateTopologyRequest, s conversion.Scope) error { + out.Variables = *(*[]v1alpha2.Variable)(unsafe.Pointer(&in.Variables)) + out.Items = *(*[]*v1alpha2.ValidateTopologyRequestItem)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha1_ValidateTopologyRequest_To_v1alpha2_ValidateTopologyRequest is an autogenerated conversion function. +func Convert_v1alpha1_ValidateTopologyRequest_To_v1alpha2_ValidateTopologyRequest(in *ValidateTopologyRequest, out *v1alpha2.ValidateTopologyRequest, s conversion.Scope) error { + return autoConvert_v1alpha1_ValidateTopologyRequest_To_v1alpha2_ValidateTopologyRequest(in, out, s) +} + +func autoConvert_v1alpha2_ValidateTopologyRequest_To_v1alpha1_ValidateTopologyRequest(in *v1alpha2.ValidateTopologyRequest, out *ValidateTopologyRequest, s conversion.Scope) error { + out.Variables = *(*[]Variable)(unsafe.Pointer(&in.Variables)) + out.Items = *(*[]*ValidateTopologyRequestItem)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha2_ValidateTopologyRequest_To_v1alpha1_ValidateTopologyRequest is an autogenerated conversion function. +func Convert_v1alpha2_ValidateTopologyRequest_To_v1alpha1_ValidateTopologyRequest(in *v1alpha2.ValidateTopologyRequest, out *ValidateTopologyRequest, s conversion.Scope) error { + return autoConvert_v1alpha2_ValidateTopologyRequest_To_v1alpha1_ValidateTopologyRequest(in, out, s) +} + +func autoConvert_v1alpha1_ValidateTopologyRequestItem_To_v1alpha2_ValidateTopologyRequestItem(in *ValidateTopologyRequestItem, out *v1alpha2.ValidateTopologyRequestItem, s conversion.Scope) error { + if err := Convert_v1alpha1_HolderReference_To_v1alpha2_HolderReference(&in.HolderReference, &out.HolderReference, s); err != nil { + return err + } + out.Object = in.Object + out.Variables = *(*[]v1alpha2.Variable)(unsafe.Pointer(&in.Variables)) + return nil +} + +// Convert_v1alpha1_ValidateTopologyRequestItem_To_v1alpha2_ValidateTopologyRequestItem is an autogenerated conversion function. +func Convert_v1alpha1_ValidateTopologyRequestItem_To_v1alpha2_ValidateTopologyRequestItem(in *ValidateTopologyRequestItem, out *v1alpha2.ValidateTopologyRequestItem, s conversion.Scope) error { + return autoConvert_v1alpha1_ValidateTopologyRequestItem_To_v1alpha2_ValidateTopologyRequestItem(in, out, s) +} + +func autoConvert_v1alpha2_ValidateTopologyRequestItem_To_v1alpha1_ValidateTopologyRequestItem(in *v1alpha2.ValidateTopologyRequestItem, out *ValidateTopologyRequestItem, s conversion.Scope) error { + if err := Convert_v1alpha2_HolderReference_To_v1alpha1_HolderReference(&in.HolderReference, &out.HolderReference, s); err != nil { + return err + } + out.Object = in.Object + out.Variables = *(*[]Variable)(unsafe.Pointer(&in.Variables)) + return nil +} + +// Convert_v1alpha2_ValidateTopologyRequestItem_To_v1alpha1_ValidateTopologyRequestItem is an autogenerated conversion function. +func Convert_v1alpha2_ValidateTopologyRequestItem_To_v1alpha1_ValidateTopologyRequestItem(in *v1alpha2.ValidateTopologyRequestItem, out *ValidateTopologyRequestItem, s conversion.Scope) error { + return autoConvert_v1alpha2_ValidateTopologyRequestItem_To_v1alpha1_ValidateTopologyRequestItem(in, out, s) +} + +func autoConvert_v1alpha1_ValidateTopologyResponse_To_v1alpha2_ValidateTopologyResponse(in *ValidateTopologyResponse, out *v1alpha2.ValidateTopologyResponse, s conversion.Scope) error { + if err := Convert_v1alpha1_CommonResponse_To_v1alpha2_CommonResponse(&in.CommonResponse, &out.CommonResponse, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_ValidateTopologyResponse_To_v1alpha2_ValidateTopologyResponse is an autogenerated conversion function. +func Convert_v1alpha1_ValidateTopologyResponse_To_v1alpha2_ValidateTopologyResponse(in *ValidateTopologyResponse, out *v1alpha2.ValidateTopologyResponse, s conversion.Scope) error { + return autoConvert_v1alpha1_ValidateTopologyResponse_To_v1alpha2_ValidateTopologyResponse(in, out, s) +} + +func autoConvert_v1alpha2_ValidateTopologyResponse_To_v1alpha1_ValidateTopologyResponse(in *v1alpha2.ValidateTopologyResponse, out *ValidateTopologyResponse, s conversion.Scope) error { + if err := Convert_v1alpha2_CommonResponse_To_v1alpha1_CommonResponse(&in.CommonResponse, &out.CommonResponse, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha2_ValidateTopologyResponse_To_v1alpha1_ValidateTopologyResponse is an autogenerated conversion function. +func Convert_v1alpha2_ValidateTopologyResponse_To_v1alpha1_ValidateTopologyResponse(in *v1alpha2.ValidateTopologyResponse, out *ValidateTopologyResponse, s conversion.Scope) error { + return autoConvert_v1alpha2_ValidateTopologyResponse_To_v1alpha1_ValidateTopologyResponse(in, out, s) +} + +func autoConvert_v1alpha1_Variable_To_v1alpha2_Variable(in *Variable, out *v1alpha2.Variable, s conversion.Scope) error { + out.Name = in.Name + out.Value = in.Value + return nil +} + +// Convert_v1alpha1_Variable_To_v1alpha2_Variable is an autogenerated conversion function. +func Convert_v1alpha1_Variable_To_v1alpha2_Variable(in *Variable, out *v1alpha2.Variable, s conversion.Scope) error { + return autoConvert_v1alpha1_Variable_To_v1alpha2_Variable(in, out, s) +} + +func autoConvert_v1alpha2_Variable_To_v1alpha1_Variable(in *v1alpha2.Variable, out *Variable, s conversion.Scope) error { + out.Name = in.Name + out.Value = in.Value + return nil +} + +// Convert_v1alpha2_Variable_To_v1alpha1_Variable is an autogenerated conversion function. +func Convert_v1alpha2_Variable_To_v1alpha1_Variable(in *v1alpha2.Variable, out *Variable, s conversion.Scope) error { + return autoConvert_v1alpha2_Variable_To_v1alpha1_Variable(in, out, s) +} diff --git a/exp/runtime/hooks/api/v1alpha1/zz_generated.openapi.go b/exp/runtime/hooks/api/v1alpha1/zz_generated.openapi.go index 46e9a40de661..f33d0cbfc084 100644 --- a/exp/runtime/hooks/api/v1alpha1/zz_generated.openapi.go +++ b/exp/runtime/hooks/api/v1alpha1/zz_generated.openapi.go @@ -85,7 +85,7 @@ func schema_runtime_hooks_api_v1alpha1_AfterClusterUpgradeRequest(ref common.Ref SchemaProps: spec.SchemaProps{ Description: "The cluster object the lifecycle hook corresponds to.", Default: map[string]interface{}{}, - Ref: ref("sigs.k8s.io/cluster-api/api/v1beta1.Cluster"), + Ref: ref("sigs.k8s.io/cluster-api/api/v1alpha4.Cluster"), }, }, "kubernetesVersion": { @@ -101,7 +101,7 @@ func schema_runtime_hooks_api_v1alpha1_AfterClusterUpgradeRequest(ref common.Ref }, }, Dependencies: []string{ - "sigs.k8s.io/cluster-api/api/v1beta1.Cluster"}, + "sigs.k8s.io/cluster-api/api/v1alpha4.Cluster"}, } } @@ -174,7 +174,7 @@ func schema_runtime_hooks_api_v1alpha1_AfterControlPlaneInitializedRequest(ref c SchemaProps: spec.SchemaProps{ Description: "The cluster object the lifecycle hook corresponds to.", Default: map[string]interface{}{}, - Ref: ref("sigs.k8s.io/cluster-api/api/v1beta1.Cluster"), + Ref: ref("sigs.k8s.io/cluster-api/api/v1alpha4.Cluster"), }, }, }, @@ -182,7 +182,7 @@ func schema_runtime_hooks_api_v1alpha1_AfterControlPlaneInitializedRequest(ref c }, }, Dependencies: []string{ - "sigs.k8s.io/cluster-api/api/v1beta1.Cluster"}, + "sigs.k8s.io/cluster-api/api/v1alpha4.Cluster"}, } } @@ -255,7 +255,7 @@ func schema_runtime_hooks_api_v1alpha1_AfterControlPlaneUpgradeRequest(ref commo SchemaProps: spec.SchemaProps{ Description: "The cluster object the lifecycle hook corresponds to.", Default: map[string]interface{}{}, - Ref: ref("sigs.k8s.io/cluster-api/api/v1beta1.Cluster"), + Ref: ref("sigs.k8s.io/cluster-api/api/v1alpha4.Cluster"), }, }, "kubernetesVersion": { @@ -271,7 +271,7 @@ func schema_runtime_hooks_api_v1alpha1_AfterControlPlaneUpgradeRequest(ref commo }, }, Dependencies: []string{ - "sigs.k8s.io/cluster-api/api/v1beta1.Cluster"}, + "sigs.k8s.io/cluster-api/api/v1alpha4.Cluster"}, } } @@ -352,7 +352,7 @@ func schema_runtime_hooks_api_v1alpha1_BeforeClusterCreateRequest(ref common.Ref SchemaProps: spec.SchemaProps{ Description: "The cluster object the lifecycle hook corresponds to.", Default: map[string]interface{}{}, - Ref: ref("sigs.k8s.io/cluster-api/api/v1beta1.Cluster"), + Ref: ref("sigs.k8s.io/cluster-api/api/v1alpha4.Cluster"), }, }, }, @@ -360,7 +360,7 @@ func schema_runtime_hooks_api_v1alpha1_BeforeClusterCreateRequest(ref common.Ref }, }, Dependencies: []string{ - "sigs.k8s.io/cluster-api/api/v1beta1.Cluster"}, + "sigs.k8s.io/cluster-api/api/v1alpha4.Cluster"}, } } @@ -441,7 +441,7 @@ func schema_runtime_hooks_api_v1alpha1_BeforeClusterDeleteRequest(ref common.Ref SchemaProps: spec.SchemaProps{ Description: "The cluster object the lifecycle hook corresponds to.", Default: map[string]interface{}{}, - Ref: ref("sigs.k8s.io/cluster-api/api/v1beta1.Cluster"), + Ref: ref("sigs.k8s.io/cluster-api/api/v1alpha4.Cluster"), }, }, }, @@ -449,7 +449,7 @@ func schema_runtime_hooks_api_v1alpha1_BeforeClusterDeleteRequest(ref common.Ref }, }, Dependencies: []string{ - "sigs.k8s.io/cluster-api/api/v1beta1.Cluster"}, + "sigs.k8s.io/cluster-api/api/v1alpha4.Cluster"}, } } @@ -530,7 +530,7 @@ func schema_runtime_hooks_api_v1alpha1_BeforeClusterUpgradeRequest(ref common.Re SchemaProps: spec.SchemaProps{ Description: "The cluster object the lifecycle hook corresponds to.", Default: map[string]interface{}{}, - Ref: ref("sigs.k8s.io/cluster-api/api/v1beta1.Cluster"), + Ref: ref("sigs.k8s.io/cluster-api/api/v1alpha4.Cluster"), }, }, "fromKubernetesVersion": { @@ -554,7 +554,7 @@ func schema_runtime_hooks_api_v1alpha1_BeforeClusterUpgradeRequest(ref common.Re }, }, Dependencies: []string{ - "sigs.k8s.io/cluster-api/api/v1beta1.Cluster"}, + "sigs.k8s.io/cluster-api/api/v1alpha4.Cluster"}, } } diff --git a/exp/runtime/hooks/api/v1alpha2/common_types.go b/exp/runtime/hooks/api/v1alpha2/common_types.go new file mode 100644 index 000000000000..d04670772079 --- /dev/null +++ b/exp/runtime/hooks/api/v1alpha2/common_types.go @@ -0,0 +1,102 @@ +/* +Copyright 2022 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "k8s.io/apimachinery/pkg/runtime" +) + +// ResponseObject is a runtime object extended with methods to handle response-specific fields. +// +kubebuilder:object:generate=false +type ResponseObject interface { + runtime.Object + GetMessage() string + GetStatus() ResponseStatus + SetMessage(message string) + SetStatus(status ResponseStatus) +} + +// RetryResponseObject is a ResponseObject which additionally defines the functionality +// for a response to signal a retry. +// +kubebuilder:object:generate=false +type RetryResponseObject interface { + ResponseObject + GetRetryAfterSeconds() int32 + SetRetryAfterSeconds(retryAfterSeconds int32) +} + +// CommonResponse is the data structure common to all response types. +type CommonResponse struct { + // Status of the call. One of "Success" or "Failure". + Status ResponseStatus `json:"status"` + + // A human-readable description of the status of the call. + Message string `json:"message"` +} + +// SetMessage sets the message field for the CommonResponse. +func (r *CommonResponse) SetMessage(message string) { + r.Message = message +} + +// SetStatus sets the status field for the CommonResponse. +func (r *CommonResponse) SetStatus(status ResponseStatus) { + r.Status = status +} + +// GetMessage returns the Message field for the CommonResponse. +func (r *CommonResponse) GetMessage() string { + return r.Message +} + +// GetStatus returns the Status field for the CommonResponse. +func (r *CommonResponse) GetStatus() ResponseStatus { + return r.Status +} + +// ResponseStatus represents the status of the hook response. +// +enum +type ResponseStatus string + +const ( + // ResponseStatusSuccess represents the success response. + ResponseStatusSuccess ResponseStatus = "Success" + + // ResponseStatusFailure represents a failure response. + ResponseStatusFailure ResponseStatus = "Failure" +) + +// CommonRetryResponse is the data structure which contains all +// common retry fields. +type CommonRetryResponse struct { + // CommonResponse contains Status and Message fields common to all response types. + CommonResponse `json:",inline"` + + // RetryAfterSeconds when set to a non-zero value signifies that the hook + // will be called again at a future time. + RetryAfterSeconds int32 `json:"retryAfterSeconds"` +} + +// GetRetryAfterSeconds sets the RetryAfterSeconds value. +func (r *CommonRetryResponse) GetRetryAfterSeconds() int32 { + return r.RetryAfterSeconds +} + +// SetRetryAfterSeconds returns the RetryAfterSeconds value. +func (r *CommonRetryResponse) SetRetryAfterSeconds(retryAfterSeconds int32) { + r.RetryAfterSeconds = retryAfterSeconds +} diff --git a/exp/runtime/hooks/api/v1alpha2/discovery_types.go b/exp/runtime/hooks/api/v1alpha2/discovery_types.go new file mode 100644 index 000000000000..3c914516391e --- /dev/null +++ b/exp/runtime/hooks/api/v1alpha2/discovery_types.go @@ -0,0 +1,99 @@ +/* +Copyright 2022 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + runtimecatalog "sigs.k8s.io/cluster-api/internal/runtime/catalog" +) + +// DiscoveryRequest represents the object of a discovery request. +// +kubebuilder:object:root=true +type DiscoveryRequest struct { + metav1.TypeMeta `json:",inline"` +} + +var _ ResponseObject = &DiscoveryResponse{} + +// DiscoveryResponse represents the object received as a discovery response. +// +kubebuilder:object:root=true +type DiscoveryResponse struct { + metav1.TypeMeta `json:",inline"` + + // CommonResponse contains Status and Message fields common to all response types. + CommonResponse `json:",inline"` + + // Handlers defines the current ExtensionHandlers supported by an Extension. + // +listType=map + // +listMapKey=name + Handlers []ExtensionHandler `json:"handlers"` +} + +// ExtensionHandler represents the discovery information of the extension which includes +// the hook it supports. +type ExtensionHandler struct { + // Name is the name of the ExtensionHandler. + Name string `json:"name"` + + // RequestHook defines the versioned runtime hook which this ExtensionHandler serves. + RequestHook GroupVersionHook `json:"requestHook"` + + // TimeoutSeconds defines the timeout duration for client calls to the ExtensionHandler. + // This is defaulted to 10 if left undefined. + TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"` + + // FailurePolicy defines how failures in calls to the ExtensionHandler should be handled by a client. + // This is defaulted to FailurePolicyFail if not defined. + FailurePolicy *FailurePolicy `json:"failurePolicy,omitempty"` +} + +// GroupVersionHook defines the runtime hook when the ExtensionHandler is called. +type GroupVersionHook struct { + // APIVersion is the Version of the Hook + APIVersion string `json:"apiVersion"` + + // Hook is the name of the hook + Hook string `json:"hook"` +} + +// FailurePolicy specifies how unrecognized errors from the admission endpoint are handled. +// FailurePolicy helps with extensions not working consistently, e.g. due to an intermittent network issue. +// The following type of errors are always considered blocking Failures: +// - Misconfigurations (e.g. incompatible types) +// - Extension explicitly reports a Status Failure. +type FailurePolicy string + +const ( + // FailurePolicyIgnore means that an error calling the extension is ignored. + FailurePolicyIgnore FailurePolicy = "Ignore" + + // FailurePolicyFail means that an error calling the extension is not ignored. + FailurePolicyFail FailurePolicy = "Fail" +) + +// Discovery represents the discovery hook. +func Discovery(*DiscoveryRequest, *DiscoveryResponse) {} + +func init() { + catalogBuilder.RegisterHook(Discovery, &runtimecatalog.HookMeta{ + Tags: []string{"Discovery"}, + Summary: "Discovery endpoint", + Description: "Discovery endpoint discovers the supported hooks of a RuntimeExtension", + Singleton: true, + }) +} diff --git a/exp/runtime/hooks/api/v1alpha2/doc.go b/exp/runtime/hooks/api/v1alpha2/doc.go new file mode 100644 index 000000000000..a7156477c4b1 --- /dev/null +++ b/exp/runtime/hooks/api/v1alpha2/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2022 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package v1alpha2 contains the v1alpha1 RuntimeHooks. +// +kubebuilder:object:generate=true +// +k8s:openapi-gen=true +package v1alpha2 diff --git a/exp/runtime/hooks/api/v1alpha2/groupversion_info.go b/exp/runtime/hooks/api/v1alpha2/groupversion_info.go new file mode 100644 index 000000000000..689bbe42d893 --- /dev/null +++ b/exp/runtime/hooks/api/v1alpha2/groupversion_info.go @@ -0,0 +1,43 @@ +/* +Copyright 2022 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + + runtimecatalog "sigs.k8s.io/cluster-api/internal/runtime/catalog" +) + +var ( + // GroupVersion is group version identifying RuntimeHooks defined in this package + // and their request and response types. + GroupVersion = schema.GroupVersion{Group: "hooks.runtime.cluster.x-k8s.io", Version: "v1alpha2"} + + // catalogBuilder is used to add RuntimeHooks and their request and response types + // to a Catalog. + catalogBuilder = &runtimecatalog.Builder{GroupVersion: GroupVersion} + + // AddToCatalog adds RuntimeHooks defined in this package and their request and + // response types to a catalog. + AddToCatalog = catalogBuilder.AddToCatalog +) + +func init() { + // Add Open API definitions for RuntimeHooks request and response types in this package + // NOTE: the GetOpenAPIDefinitions func is automatically generated by openapi-gen. + catalogBuilder.RegisterOpenAPIDefinitions(GetOpenAPIDefinitions) +} diff --git a/exp/runtime/hooks/api/v1alpha2/lifecyclehooks_types.go b/exp/runtime/hooks/api/v1alpha2/lifecyclehooks_types.go new file mode 100644 index 000000000000..351a178df199 --- /dev/null +++ b/exp/runtime/hooks/api/v1alpha2/lifecyclehooks_types.go @@ -0,0 +1,217 @@ +/* +Copyright 2022 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" + runtimecatalog "sigs.k8s.io/cluster-api/internal/runtime/catalog" +) + +// BeforeClusterCreateRequest is the request of the BeforeClusterCreate hook. +// +kubebuilder:object:root=true +type BeforeClusterCreateRequest struct { + metav1.TypeMeta `json:",inline"` + + // The cluster object the lifecycle hook corresponds to. + Cluster clusterv1.Cluster `json:"cluster"` +} + +var _ RetryResponseObject = &BeforeClusterCreateResponse{} + +// BeforeClusterCreateResponse is the response of the BeforeClusterCreate hook. +// +kubebuilder:object:root=true +type BeforeClusterCreateResponse struct { + metav1.TypeMeta `json:",inline"` + + // CommonRetryResponse contains RetryAfterSeconds field common to all retry response types. + CommonRetryResponse `json:",inline"` +} + +// BeforeClusterCreate is the runtime hook that will be called right before a Cluster is created. +func BeforeClusterCreate(*BeforeClusterCreateRequest, *BeforeClusterCreateResponse) {} + +// AfterControlPlaneInitializedRequest is the request of the AfterControlPlaneInitialized hook. +// +kubebuilder:object:root=true +type AfterControlPlaneInitializedRequest struct { + metav1.TypeMeta `json:",inline"` + + // The cluster object the lifecycle hook corresponds to. + Cluster clusterv1.Cluster `json:"cluster"` +} + +var _ ResponseObject = &AfterControlPlaneInitializedResponse{} + +// AfterControlPlaneInitializedResponse is the response of the AfterControlPlaneInitialized hook. +// +kubebuilder:object:root=true +type AfterControlPlaneInitializedResponse struct { + metav1.TypeMeta `json:",inline"` + + // CommonResponse contains Status and Message fields common to all response types. + CommonResponse `json:",inline"` +} + +// AfterControlPlaneInitialized is the runtime hook that will be called after the control plane is available for the first time. +func AfterControlPlaneInitialized(*AfterControlPlaneInitializedRequest, *AfterControlPlaneInitializedResponse) { +} + +// BeforeClusterUpgradeRequest is the request of the BeforeClusterUpgrade hook. +// +kubebuilder:object:root=true +type BeforeClusterUpgradeRequest struct { + metav1.TypeMeta `json:",inline"` + + // The cluster object the lifecycle hook corresponds to. + Cluster clusterv1.Cluster `json:"cluster"` + + // The current Kubernetes version of the cluster. + FromKubernetesVersion string `json:"fromKubernetesVersion"` + + // The target Kubernetes version of upgrade. + ToKubernetesVersion string `json:"toKubernetesVersion"` +} + +var _ RetryResponseObject = &BeforeClusterUpgradeResponse{} + +// BeforeClusterUpgradeResponse is the response of the BeforeClusterUpgrade hook. +// +kubebuilder:object:root=true +type BeforeClusterUpgradeResponse struct { + metav1.TypeMeta `json:",inline"` + + // CommonRetryResponse contains RetryAfterSeconds field common to all retry response types. + CommonRetryResponse `json:",inline"` +} + +// BeforeClusterUpgrade is the runtime hook that will be called after a cluster.spec.version is upgraded and +// before the updated version is propagated to the underlying objects. +func BeforeClusterUpgrade(*BeforeClusterUpgradeRequest, *BeforeClusterUpgradeResponse) {} + +// AfterControlPlaneUpgradeRequest is the request of the AfterControlPlaneUpgrade hook. +// +kubebuilder:object:root=true +type AfterControlPlaneUpgradeRequest struct { + metav1.TypeMeta `json:",inline"` + + // The cluster object the lifecycle hook corresponds to. + Cluster clusterv1.Cluster `json:"cluster"` + + // The Kubernetes version after upgrade. + KubernetesVersion string `json:"kubernetesVersion"` +} + +var _ RetryResponseObject = &AfterControlPlaneUpgradeResponse{} + +// AfterControlPlaneUpgradeResponse is the response of the AfterControlPlaneUpgrade hook. +// +kubebuilder:object:root=true +type AfterControlPlaneUpgradeResponse struct { + metav1.TypeMeta `json:",inline"` + + // CommonRetryResponse contains RetryAfterSeconds field common to all retry response types. + CommonRetryResponse `json:",inline"` +} + +// AfterControlPlaneUpgrade is the runtime hook called after the control plane is successfully upgraded to the target +// Kubernetes version and before the target version is propagated to the workload machines. +func AfterControlPlaneUpgrade(*AfterControlPlaneUpgradeRequest, *AfterControlPlaneUpgradeResponse) {} + +// AfterClusterUpgradeRequest is the request of the AfterClusterUpgrade hook. +// +kubebuilder:object:root=true +type AfterClusterUpgradeRequest struct { + metav1.TypeMeta `json:",inline"` + + // The cluster object the lifecycle hook corresponds to. + Cluster clusterv1.Cluster `json:"cluster"` + + // The Kubernetes version after upgrade. + KubernetesVersion string `json:"kubernetesVersion"` +} + +var _ ResponseObject = &AfterClusterUpgradeResponse{} + +// AfterClusterUpgradeResponse is the response of the AfterClusterUpgrade hook. +// +kubebuilder:object:root=true +type AfterClusterUpgradeResponse struct { + metav1.TypeMeta `json:",inline"` + + // CommonResponse contains Status and Message fields common to all response types. + CommonResponse `json:",inline"` +} + +// AfterClusterUpgrade is the runtime hook that is called after all of the cluster is updated +// to the target kubernetes version. +func AfterClusterUpgrade(*AfterClusterUpgradeRequest, *AfterClusterUpgradeResponse) {} + +// BeforeClusterDeleteRequest is the request of the BeforeClusterDelete hook. +// +kubebuilder:object:root=true +type BeforeClusterDeleteRequest struct { + metav1.TypeMeta `json:",inline"` + + // The cluster object the lifecycle hook corresponds to. + Cluster clusterv1.Cluster `json:"cluster"` +} + +var _ RetryResponseObject = &BeforeClusterDeleteResponse{} + +// BeforeClusterDeleteResponse is the response of the BeforeClusterDelete hook. +// +kubebuilder:object:root=true +type BeforeClusterDeleteResponse struct { + metav1.TypeMeta `json:",inline"` + + // CommonRetryResponse contains RetryAfterSeconds field common to all retry response types. + CommonRetryResponse `json:",inline"` +} + +// BeforeClusterDelete is the runtime hook that is called after a delete is issued on a cluster +// and before the cluster and its underlying objects are deleted. +func BeforeClusterDelete(*BeforeClusterDeleteRequest, *BeforeClusterDeleteResponse) {} + +func init() { + catalogBuilder.RegisterHook(BeforeClusterCreate, &runtimecatalog.HookMeta{ + Tags: []string{"Lifecycle Hooks"}, + Summary: "Called before Cluster topology is created", + Description: "This blocking hook is called after the Cluster is created by the user and immediately before all the objects which are part of a Cluster topology are going to be created", + }) + + catalogBuilder.RegisterHook(AfterControlPlaneInitialized, &runtimecatalog.HookMeta{ + Tags: []string{"Lifecycle Hooks"}, + Summary: "Called after the Control Plane is available for the first time", + Description: "This non-blocking hook is called after the ControlPlane for the Cluster reachable for the first time", + }) + + catalogBuilder.RegisterHook(BeforeClusterUpgrade, &runtimecatalog.HookMeta{ + Tags: []string{"Lifecycle Hooks"}, + Summary: "Called before the Cluster begins upgrade", + Description: "This blocking hook is called after the Cluster object has been updated with a new spec.topology.version by the user, and immediately before the new version is propagated to the Control Plane", + }) + + catalogBuilder.RegisterHook(AfterControlPlaneUpgrade, &runtimecatalog.HookMeta{ + Tags: []string{"Lifecycle Hooks"}, + Summary: "Called after the Control Plane finished upgrade", + Description: "This blocking hook is called after the Control Plane has been upgraded to the version specified in spec.topology.version, and immediately before the new version is propagated to the MachineDeployments of the Cluster", + }) + + catalogBuilder.RegisterHook(AfterClusterUpgrade, &runtimecatalog.HookMeta{ + Tags: []string{"Lifecycle Hooks"}, + Summary: "Called after the Cluster finished upgrade", + Description: "This non-blocking hook is called after the Cluster, Control Plane and Workers have been upgraded to the version specified in spec.topology.version", + }) + + catalogBuilder.RegisterHook(BeforeClusterDelete, &runtimecatalog.HookMeta{ + Tags: []string{"Lifecycle Hooks"}, + Summary: "Called before the Cluster is deleted", + Description: "This blocking hook is called after the Cluster has been deleted by the user, and immediately before objects of the Cluster are going to be deleted", + }) +} diff --git a/exp/runtime/hooks/api/v1alpha2/topologymutation_types.go b/exp/runtime/hooks/api/v1alpha2/topologymutation_types.go new file mode 100644 index 000000000000..bd7a5bc550c9 --- /dev/null +++ b/exp/runtime/hooks/api/v1alpha2/topologymutation_types.go @@ -0,0 +1,188 @@ +/* +Copyright 2022 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" + + runtimecatalog "sigs.k8s.io/cluster-api/internal/runtime/catalog" +) + +// GeneratePatchesRequest is the request of the GeneratePatches hook. +// +kubebuilder:object:root=true +type GeneratePatchesRequest struct { + metav1.TypeMeta `json:",inline"` + + // Variables are global variables for all templates. + Variables []Variable `json:"variables"` + + // Items is the list of templates to generate patches for. + Items []GeneratePatchesRequestItem `json:"items"` +} + +// GeneratePatchesRequestItem represents a template to generate patches for. +type GeneratePatchesRequestItem struct { + // UID is an identifier for this template. It allows us to correlate the template in the request + // with the corresponding generates patches in the response. + UID types.UID `json:"uid"` + + // HolderReference is a reference to the object where the template is used. + HolderReference HolderReference `json:"holderReference"` + + // Object contains the template as a raw object. + Object runtime.RawExtension `json:"object"` + + // Variables are variables specific for the current template. + // For example some builtin variables like MachineDeployment replicas and version are context-sensitive + // and thus are only added to templates for MachineDeployments and with values which correspond to the + // current MachineDeployment. + Variables []Variable `json:"variables"` +} + +var _ ResponseObject = &GeneratePatchesResponse{} + +// GeneratePatchesResponse is the response of the GeneratePatches hook. +// NOTE: The patches in GeneratePatchesResponse will be applied in the order in which they are defined to the +// templates of the request. Thus applying changes consecutively when iterating through internal and external patches. +// +kubebuilder:object:root=true +type GeneratePatchesResponse struct { + metav1.TypeMeta `json:",inline"` + + // CommonResponse contains Status and Message fields common to all response types. + CommonResponse `json:",inline"` + + // Items is the list of generated patches. + Items []GeneratePatchesResponseItem `json:"items"` +} + +// GeneratePatchesResponseItem is a generated patch. +type GeneratePatchesResponseItem struct { + // UID identifies the corresponding template in the request on which + // the patch should be applied. + UID types.UID `json:"uid"` + + // PatchType defines the type of the patch. + // One of: "JSONPatch" or "JSONMergePatch". + PatchType PatchType `json:"patchType"` + + // Patch contains the patch which should be applied to the template. + // It must be of the corresponding PatchType. + Patch []byte `json:"patch"` +} + +// PatchType defines the supported patch types. +// +enum +type PatchType string + +const ( + // JSONPatchType identifies a https://datatracker.ietf.org/doc/html/rfc6902 JSON patch. + JSONPatchType PatchType = "JSONPatch" + + // JSONMergePatchType identifies a https://datatracker.ietf.org/doc/html/rfc7386 JSON merge patch. + JSONMergePatchType PatchType = "JSONMergePatch" +) + +// GeneratePatches generates patches during topology reconciliation for the entire Cluster topology. +func GeneratePatches(*GeneratePatchesRequest, *GeneratePatchesResponse) {} + +// ValidateTopologyRequest is the request of the ValidateTopology hook. +// +kubebuilder:object:root=true +type ValidateTopologyRequest struct { + metav1.TypeMeta `json:",inline"` + + // Variables are global variables for all templates. + Variables []Variable `json:"variables"` + + // Items is the list of templates to validate. + Items []*ValidateTopologyRequestItem `json:"items"` +} + +// ValidateTopologyRequestItem represents a template to validate. +type ValidateTopologyRequestItem struct { + // HolderReference is a reference to the object where the template is used. + HolderReference HolderReference `json:"holderReference"` + + // Object contains the template as a raw object. + Object runtime.RawExtension `json:"object"` + + // Variables are variables specific for the current template. + // For example some builtin variables like MachineDeployment replicas and version are context-sensitive + // and thus are only added to templates for MachineDeployments and with values which correspond to the + // current MachineDeployment. + Variables []Variable `json:"variables"` +} + +var _ ResponseObject = &ValidateTopologyResponse{} + +// ValidateTopologyResponse is the response of the ValidateTopology hook. +// +kubebuilder:object:root=true +type ValidateTopologyResponse struct { + metav1.TypeMeta `json:",inline"` + + // CommonResponse contains Status and Message fields common to all response types. + CommonResponse `json:",inline"` +} + +// Variable represents a variable value. +type Variable struct { + // Name of the variable. + Name string `json:"name"` + + // Value of the variable. + Value apiextensionsv1.JSON `json:"value"` +} + +// HolderReference represents a reference to an object which holds a template. +type HolderReference struct { + // API version of the referent. + APIVersion string `json:"apiVersion"` + + // Kind of the referent. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + Kind string `json:"kind"` + + // Namespace of the referent. + // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ + Namespace string `json:"namespace"` + + // Name of the referent. + // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + Name string `json:"name"` + + // FieldPath is the path to the field of the object which references the template. + FieldPath string `json:"fieldPath"` +} + +// ValidateTopology validates the Cluster topology after all patches have been applied. +func ValidateTopology(*ValidateTopologyRequest, *ValidateTopologyResponse) {} + +func init() { + catalogBuilder.RegisterHook(GeneratePatches, &runtimecatalog.HookMeta{ + Tags: []string{"Topology Mutation Hook"}, + Summary: "GeneratePatches generates patches during topology reconciliation for the entire Cluster topology.", + Description: "A GeneratePatches call generates patches for the entire Cluster topology. Accordingly the request contains all templates, the global variables and the template-specific variables. The response contains generated patches.", + }) + + catalogBuilder.RegisterHook(ValidateTopology, &runtimecatalog.HookMeta{ + Tags: []string{"Topology Mutation Hook"}, + Summary: "ValidateTopology validates the Cluster topology after all patches have been applied.", + Description: "A ValidateTopology call validates the Cluster topology after all patches have been applied. The request contains all templates of the Cluster topology, the global variables and the template-specific variables. The response contains the result of the validation.", + }) +} diff --git a/exp/runtime/hooks/api/v1alpha2/zz_generated.deepcopy.go b/exp/runtime/hooks/api/v1alpha2/zz_generated.deepcopy.go new file mode 100644 index 000000000000..6712620a2e62 --- /dev/null +++ b/exp/runtime/hooks/api/v1alpha2/zz_generated.deepcopy.go @@ -0,0 +1,690 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by controller-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AfterClusterUpgradeRequest) DeepCopyInto(out *AfterClusterUpgradeRequest) { + *out = *in + out.TypeMeta = in.TypeMeta + in.Cluster.DeepCopyInto(&out.Cluster) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AfterClusterUpgradeRequest. +func (in *AfterClusterUpgradeRequest) DeepCopy() *AfterClusterUpgradeRequest { + if in == nil { + return nil + } + out := new(AfterClusterUpgradeRequest) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AfterClusterUpgradeRequest) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AfterClusterUpgradeResponse) DeepCopyInto(out *AfterClusterUpgradeResponse) { + *out = *in + out.TypeMeta = in.TypeMeta + out.CommonResponse = in.CommonResponse +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AfterClusterUpgradeResponse. +func (in *AfterClusterUpgradeResponse) DeepCopy() *AfterClusterUpgradeResponse { + if in == nil { + return nil + } + out := new(AfterClusterUpgradeResponse) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AfterClusterUpgradeResponse) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AfterControlPlaneInitializedRequest) DeepCopyInto(out *AfterControlPlaneInitializedRequest) { + *out = *in + out.TypeMeta = in.TypeMeta + in.Cluster.DeepCopyInto(&out.Cluster) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AfterControlPlaneInitializedRequest. +func (in *AfterControlPlaneInitializedRequest) DeepCopy() *AfterControlPlaneInitializedRequest { + if in == nil { + return nil + } + out := new(AfterControlPlaneInitializedRequest) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AfterControlPlaneInitializedRequest) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AfterControlPlaneInitializedResponse) DeepCopyInto(out *AfterControlPlaneInitializedResponse) { + *out = *in + out.TypeMeta = in.TypeMeta + out.CommonResponse = in.CommonResponse +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AfterControlPlaneInitializedResponse. +func (in *AfterControlPlaneInitializedResponse) DeepCopy() *AfterControlPlaneInitializedResponse { + if in == nil { + return nil + } + out := new(AfterControlPlaneInitializedResponse) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AfterControlPlaneInitializedResponse) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AfterControlPlaneUpgradeRequest) DeepCopyInto(out *AfterControlPlaneUpgradeRequest) { + *out = *in + out.TypeMeta = in.TypeMeta + in.Cluster.DeepCopyInto(&out.Cluster) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AfterControlPlaneUpgradeRequest. +func (in *AfterControlPlaneUpgradeRequest) DeepCopy() *AfterControlPlaneUpgradeRequest { + if in == nil { + return nil + } + out := new(AfterControlPlaneUpgradeRequest) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AfterControlPlaneUpgradeRequest) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AfterControlPlaneUpgradeResponse) DeepCopyInto(out *AfterControlPlaneUpgradeResponse) { + *out = *in + out.TypeMeta = in.TypeMeta + out.CommonRetryResponse = in.CommonRetryResponse +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AfterControlPlaneUpgradeResponse. +func (in *AfterControlPlaneUpgradeResponse) DeepCopy() *AfterControlPlaneUpgradeResponse { + if in == nil { + return nil + } + out := new(AfterControlPlaneUpgradeResponse) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AfterControlPlaneUpgradeResponse) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BeforeClusterCreateRequest) DeepCopyInto(out *BeforeClusterCreateRequest) { + *out = *in + out.TypeMeta = in.TypeMeta + in.Cluster.DeepCopyInto(&out.Cluster) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BeforeClusterCreateRequest. +func (in *BeforeClusterCreateRequest) DeepCopy() *BeforeClusterCreateRequest { + if in == nil { + return nil + } + out := new(BeforeClusterCreateRequest) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BeforeClusterCreateRequest) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BeforeClusterCreateResponse) DeepCopyInto(out *BeforeClusterCreateResponse) { + *out = *in + out.TypeMeta = in.TypeMeta + out.CommonRetryResponse = in.CommonRetryResponse +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BeforeClusterCreateResponse. +func (in *BeforeClusterCreateResponse) DeepCopy() *BeforeClusterCreateResponse { + if in == nil { + return nil + } + out := new(BeforeClusterCreateResponse) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BeforeClusterCreateResponse) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BeforeClusterDeleteRequest) DeepCopyInto(out *BeforeClusterDeleteRequest) { + *out = *in + out.TypeMeta = in.TypeMeta + in.Cluster.DeepCopyInto(&out.Cluster) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BeforeClusterDeleteRequest. +func (in *BeforeClusterDeleteRequest) DeepCopy() *BeforeClusterDeleteRequest { + if in == nil { + return nil + } + out := new(BeforeClusterDeleteRequest) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BeforeClusterDeleteRequest) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BeforeClusterDeleteResponse) DeepCopyInto(out *BeforeClusterDeleteResponse) { + *out = *in + out.TypeMeta = in.TypeMeta + out.CommonRetryResponse = in.CommonRetryResponse +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BeforeClusterDeleteResponse. +func (in *BeforeClusterDeleteResponse) DeepCopy() *BeforeClusterDeleteResponse { + if in == nil { + return nil + } + out := new(BeforeClusterDeleteResponse) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BeforeClusterDeleteResponse) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BeforeClusterUpgradeRequest) DeepCopyInto(out *BeforeClusterUpgradeRequest) { + *out = *in + out.TypeMeta = in.TypeMeta + in.Cluster.DeepCopyInto(&out.Cluster) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BeforeClusterUpgradeRequest. +func (in *BeforeClusterUpgradeRequest) DeepCopy() *BeforeClusterUpgradeRequest { + if in == nil { + return nil + } + out := new(BeforeClusterUpgradeRequest) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BeforeClusterUpgradeRequest) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BeforeClusterUpgradeResponse) DeepCopyInto(out *BeforeClusterUpgradeResponse) { + *out = *in + out.TypeMeta = in.TypeMeta + out.CommonRetryResponse = in.CommonRetryResponse +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BeforeClusterUpgradeResponse. +func (in *BeforeClusterUpgradeResponse) DeepCopy() *BeforeClusterUpgradeResponse { + if in == nil { + return nil + } + out := new(BeforeClusterUpgradeResponse) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BeforeClusterUpgradeResponse) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CommonResponse) DeepCopyInto(out *CommonResponse) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommonResponse. +func (in *CommonResponse) DeepCopy() *CommonResponse { + if in == nil { + return nil + } + out := new(CommonResponse) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CommonRetryResponse) DeepCopyInto(out *CommonRetryResponse) { + *out = *in + out.CommonResponse = in.CommonResponse +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommonRetryResponse. +func (in *CommonRetryResponse) DeepCopy() *CommonRetryResponse { + if in == nil { + return nil + } + out := new(CommonRetryResponse) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DiscoveryRequest) DeepCopyInto(out *DiscoveryRequest) { + *out = *in + out.TypeMeta = in.TypeMeta +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiscoveryRequest. +func (in *DiscoveryRequest) DeepCopy() *DiscoveryRequest { + if in == nil { + return nil + } + out := new(DiscoveryRequest) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DiscoveryRequest) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DiscoveryResponse) DeepCopyInto(out *DiscoveryResponse) { + *out = *in + out.TypeMeta = in.TypeMeta + out.CommonResponse = in.CommonResponse + if in.Handlers != nil { + in, out := &in.Handlers, &out.Handlers + *out = make([]ExtensionHandler, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiscoveryResponse. +func (in *DiscoveryResponse) DeepCopy() *DiscoveryResponse { + if in == nil { + return nil + } + out := new(DiscoveryResponse) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DiscoveryResponse) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExtensionHandler) DeepCopyInto(out *ExtensionHandler) { + *out = *in + out.RequestHook = in.RequestHook + if in.TimeoutSeconds != nil { + in, out := &in.TimeoutSeconds, &out.TimeoutSeconds + *out = new(int32) + **out = **in + } + if in.FailurePolicy != nil { + in, out := &in.FailurePolicy, &out.FailurePolicy + *out = new(FailurePolicy) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExtensionHandler. +func (in *ExtensionHandler) DeepCopy() *ExtensionHandler { + if in == nil { + return nil + } + out := new(ExtensionHandler) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GeneratePatchesRequest) DeepCopyInto(out *GeneratePatchesRequest) { + *out = *in + out.TypeMeta = in.TypeMeta + if in.Variables != nil { + in, out := &in.Variables, &out.Variables + *out = make([]Variable, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]GeneratePatchesRequestItem, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GeneratePatchesRequest. +func (in *GeneratePatchesRequest) DeepCopy() *GeneratePatchesRequest { + if in == nil { + return nil + } + out := new(GeneratePatchesRequest) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GeneratePatchesRequest) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GeneratePatchesRequestItem) DeepCopyInto(out *GeneratePatchesRequestItem) { + *out = *in + out.HolderReference = in.HolderReference + in.Object.DeepCopyInto(&out.Object) + if in.Variables != nil { + in, out := &in.Variables, &out.Variables + *out = make([]Variable, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GeneratePatchesRequestItem. +func (in *GeneratePatchesRequestItem) DeepCopy() *GeneratePatchesRequestItem { + if in == nil { + return nil + } + out := new(GeneratePatchesRequestItem) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GeneratePatchesResponse) DeepCopyInto(out *GeneratePatchesResponse) { + *out = *in + out.TypeMeta = in.TypeMeta + out.CommonResponse = in.CommonResponse + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]GeneratePatchesResponseItem, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GeneratePatchesResponse. +func (in *GeneratePatchesResponse) DeepCopy() *GeneratePatchesResponse { + if in == nil { + return nil + } + out := new(GeneratePatchesResponse) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GeneratePatchesResponse) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GeneratePatchesResponseItem) DeepCopyInto(out *GeneratePatchesResponseItem) { + *out = *in + if in.Patch != nil { + in, out := &in.Patch, &out.Patch + *out = make([]byte, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GeneratePatchesResponseItem. +func (in *GeneratePatchesResponseItem) DeepCopy() *GeneratePatchesResponseItem { + if in == nil { + return nil + } + out := new(GeneratePatchesResponseItem) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GroupVersionHook) DeepCopyInto(out *GroupVersionHook) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GroupVersionHook. +func (in *GroupVersionHook) DeepCopy() *GroupVersionHook { + if in == nil { + return nil + } + out := new(GroupVersionHook) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HolderReference) DeepCopyInto(out *HolderReference) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HolderReference. +func (in *HolderReference) DeepCopy() *HolderReference { + if in == nil { + return nil + } + out := new(HolderReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ValidateTopologyRequest) DeepCopyInto(out *ValidateTopologyRequest) { + *out = *in + out.TypeMeta = in.TypeMeta + if in.Variables != nil { + in, out := &in.Variables, &out.Variables + *out = make([]Variable, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]*ValidateTopologyRequestItem, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(ValidateTopologyRequestItem) + (*in).DeepCopyInto(*out) + } + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ValidateTopologyRequest. +func (in *ValidateTopologyRequest) DeepCopy() *ValidateTopologyRequest { + if in == nil { + return nil + } + out := new(ValidateTopologyRequest) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ValidateTopologyRequest) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ValidateTopologyRequestItem) DeepCopyInto(out *ValidateTopologyRequestItem) { + *out = *in + out.HolderReference = in.HolderReference + in.Object.DeepCopyInto(&out.Object) + if in.Variables != nil { + in, out := &in.Variables, &out.Variables + *out = make([]Variable, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ValidateTopologyRequestItem. +func (in *ValidateTopologyRequestItem) DeepCopy() *ValidateTopologyRequestItem { + if in == nil { + return nil + } + out := new(ValidateTopologyRequestItem) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ValidateTopologyResponse) DeepCopyInto(out *ValidateTopologyResponse) { + *out = *in + out.TypeMeta = in.TypeMeta + out.CommonResponse = in.CommonResponse +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ValidateTopologyResponse. +func (in *ValidateTopologyResponse) DeepCopy() *ValidateTopologyResponse { + if in == nil { + return nil + } + out := new(ValidateTopologyResponse) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ValidateTopologyResponse) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Variable) DeepCopyInto(out *Variable) { + *out = *in + in.Value.DeepCopyInto(&out.Value) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Variable. +func (in *Variable) DeepCopy() *Variable { + if in == nil { + return nil + } + out := new(Variable) + in.DeepCopyInto(out) + return out +} diff --git a/exp/runtime/hooks/api/v1alpha2/zz_generated.openapi.go b/exp/runtime/hooks/api/v1alpha2/zz_generated.openapi.go new file mode 100644 index 000000000000..c2ee3b6e93a3 --- /dev/null +++ b/exp/runtime/hooks/api/v1alpha2/zz_generated.openapi.go @@ -0,0 +1,1286 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by openapi-gen. DO NOT EDIT. + +// This file was autogenerated by openapi-gen. Do not edit it manually! + +package v1alpha2 + +import ( + common "k8s.io/kube-openapi/pkg/common" + spec "k8s.io/kube-openapi/pkg/validation/spec" +) + +func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { + return map[string]common.OpenAPIDefinition{ + "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.AfterClusterUpgradeRequest": schema_runtime_hooks_api_v1alpha1_AfterClusterUpgradeRequest(ref), + "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.AfterClusterUpgradeResponse": schema_runtime_hooks_api_v1alpha1_AfterClusterUpgradeResponse(ref), + "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.AfterControlPlaneInitializedRequest": schema_runtime_hooks_api_v1alpha1_AfterControlPlaneInitializedRequest(ref), + "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.AfterControlPlaneInitializedResponse": schema_runtime_hooks_api_v1alpha1_AfterControlPlaneInitializedResponse(ref), + "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.AfterControlPlaneUpgradeRequest": schema_runtime_hooks_api_v1alpha1_AfterControlPlaneUpgradeRequest(ref), + "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.AfterControlPlaneUpgradeResponse": schema_runtime_hooks_api_v1alpha1_AfterControlPlaneUpgradeResponse(ref), + "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.BeforeClusterCreateRequest": schema_runtime_hooks_api_v1alpha1_BeforeClusterCreateRequest(ref), + "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.BeforeClusterCreateResponse": schema_runtime_hooks_api_v1alpha1_BeforeClusterCreateResponse(ref), + "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.BeforeClusterDeleteRequest": schema_runtime_hooks_api_v1alpha1_BeforeClusterDeleteRequest(ref), + "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.BeforeClusterDeleteResponse": schema_runtime_hooks_api_v1alpha1_BeforeClusterDeleteResponse(ref), + "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.BeforeClusterUpgradeRequest": schema_runtime_hooks_api_v1alpha1_BeforeClusterUpgradeRequest(ref), + "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.BeforeClusterUpgradeResponse": schema_runtime_hooks_api_v1alpha1_BeforeClusterUpgradeResponse(ref), + "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.CommonResponse": schema_runtime_hooks_api_v1alpha1_CommonResponse(ref), + "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.CommonRetryResponse": schema_runtime_hooks_api_v1alpha1_CommonRetryResponse(ref), + "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.DiscoveryRequest": schema_runtime_hooks_api_v1alpha1_DiscoveryRequest(ref), + "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.DiscoveryResponse": schema_runtime_hooks_api_v1alpha1_DiscoveryResponse(ref), + "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.ExtensionHandler": schema_runtime_hooks_api_v1alpha1_ExtensionHandler(ref), + "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.GeneratePatchesRequest": schema_runtime_hooks_api_v1alpha1_GeneratePatchesRequest(ref), + "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.GeneratePatchesRequestItem": schema_runtime_hooks_api_v1alpha1_GeneratePatchesRequestItem(ref), + "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.GeneratePatchesResponse": schema_runtime_hooks_api_v1alpha1_GeneratePatchesResponse(ref), + "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.GeneratePatchesResponseItem": schema_runtime_hooks_api_v1alpha1_GeneratePatchesResponseItem(ref), + "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.GroupVersionHook": schema_runtime_hooks_api_v1alpha1_GroupVersionHook(ref), + "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.HolderReference": schema_runtime_hooks_api_v1alpha1_HolderReference(ref), + "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.ValidateTopologyRequest": schema_runtime_hooks_api_v1alpha1_ValidateTopologyRequest(ref), + "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.ValidateTopologyRequestItem": schema_runtime_hooks_api_v1alpha1_ValidateTopologyRequestItem(ref), + "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.ValidateTopologyResponse": schema_runtime_hooks_api_v1alpha1_ValidateTopologyResponse(ref), + "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.Variable": schema_runtime_hooks_api_v1alpha1_Variable(ref), + } +} + +func schema_runtime_hooks_api_v1alpha1_AfterClusterUpgradeRequest(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "AfterClusterUpgradeRequest is the request of the AfterClusterUpgrade hook.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "cluster": { + SchemaProps: spec.SchemaProps{ + Description: "The cluster object the lifecycle hook corresponds to.", + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/api/v1beta1.Cluster"), + }, + }, + "kubernetesVersion": { + SchemaProps: spec.SchemaProps{ + Description: "The Kubernetes version after upgrade.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"cluster", "kubernetesVersion"}, + }, + }, + Dependencies: []string{ + "sigs.k8s.io/cluster-api/api/v1beta1.Cluster"}, + } +} + +func schema_runtime_hooks_api_v1alpha1_AfterClusterUpgradeResponse(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "AfterClusterUpgradeResponse is the response of the AfterClusterUpgrade hook.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Status of the call. One of \"Success\" or \"Failure\".\n\nPossible enum values:\n - `\"Failure\"` represents a failure response.\n - `\"Success\"` represents the success response.", + Default: "", + Type: []string{"string"}, + Format: "", + Enum: []interface{}{"Failure", "Success"}}, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "A human-readable description of the status of the call.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"status", "message"}, + }, + }, + } +} + +func schema_runtime_hooks_api_v1alpha1_AfterControlPlaneInitializedRequest(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "AfterControlPlaneInitializedRequest is the request of the AfterControlPlaneInitialized hook.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "cluster": { + SchemaProps: spec.SchemaProps{ + Description: "The cluster object the lifecycle hook corresponds to.", + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/api/v1beta1.Cluster"), + }, + }, + }, + Required: []string{"cluster"}, + }, + }, + Dependencies: []string{ + "sigs.k8s.io/cluster-api/api/v1beta1.Cluster"}, + } +} + +func schema_runtime_hooks_api_v1alpha1_AfterControlPlaneInitializedResponse(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "AfterControlPlaneInitializedResponse is the response of the AfterControlPlaneInitialized hook.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Status of the call. One of \"Success\" or \"Failure\".\n\nPossible enum values:\n - `\"Failure\"` represents a failure response.\n - `\"Success\"` represents the success response.", + Default: "", + Type: []string{"string"}, + Format: "", + Enum: []interface{}{"Failure", "Success"}}, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "A human-readable description of the status of the call.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"status", "message"}, + }, + }, + } +} + +func schema_runtime_hooks_api_v1alpha1_AfterControlPlaneUpgradeRequest(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "AfterControlPlaneUpgradeRequest is the request of the AfterControlPlaneUpgrade hook.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "cluster": { + SchemaProps: spec.SchemaProps{ + Description: "The cluster object the lifecycle hook corresponds to.", + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/api/v1beta1.Cluster"), + }, + }, + "kubernetesVersion": { + SchemaProps: spec.SchemaProps{ + Description: "The Kubernetes version after upgrade.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"cluster", "kubernetesVersion"}, + }, + }, + Dependencies: []string{ + "sigs.k8s.io/cluster-api/api/v1beta1.Cluster"}, + } +} + +func schema_runtime_hooks_api_v1alpha1_AfterControlPlaneUpgradeResponse(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "AfterControlPlaneUpgradeResponse is the response of the AfterControlPlaneUpgrade hook.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Status of the call. One of \"Success\" or \"Failure\".\n\nPossible enum values:\n - `\"Failure\"` represents a failure response.\n - `\"Success\"` represents the success response.", + Default: "", + Type: []string{"string"}, + Format: "", + Enum: []interface{}{"Failure", "Success"}}, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "A human-readable description of the status of the call.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "retryAfterSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "RetryAfterSeconds when set to a non-zero value signifies that the hook will be called again at a future time.", + Default: 0, + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + Required: []string{"status", "message", "retryAfterSeconds"}, + }, + }, + } +} + +func schema_runtime_hooks_api_v1alpha1_BeforeClusterCreateRequest(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "BeforeClusterCreateRequest is the request of the BeforeClusterCreate hook.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "cluster": { + SchemaProps: spec.SchemaProps{ + Description: "The cluster object the lifecycle hook corresponds to.", + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/api/v1beta1.Cluster"), + }, + }, + }, + Required: []string{"cluster"}, + }, + }, + Dependencies: []string{ + "sigs.k8s.io/cluster-api/api/v1beta1.Cluster"}, + } +} + +func schema_runtime_hooks_api_v1alpha1_BeforeClusterCreateResponse(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "BeforeClusterCreateResponse is the response of the BeforeClusterCreate hook.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Status of the call. One of \"Success\" or \"Failure\".\n\nPossible enum values:\n - `\"Failure\"` represents a failure response.\n - `\"Success\"` represents the success response.", + Default: "", + Type: []string{"string"}, + Format: "", + Enum: []interface{}{"Failure", "Success"}}, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "A human-readable description of the status of the call.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "retryAfterSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "RetryAfterSeconds when set to a non-zero value signifies that the hook will be called again at a future time.", + Default: 0, + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + Required: []string{"status", "message", "retryAfterSeconds"}, + }, + }, + } +} + +func schema_runtime_hooks_api_v1alpha1_BeforeClusterDeleteRequest(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "BeforeClusterDeleteRequest is the request of the BeforeClusterDelete hook.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "cluster": { + SchemaProps: spec.SchemaProps{ + Description: "The cluster object the lifecycle hook corresponds to.", + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/api/v1beta1.Cluster"), + }, + }, + }, + Required: []string{"cluster"}, + }, + }, + Dependencies: []string{ + "sigs.k8s.io/cluster-api/api/v1beta1.Cluster"}, + } +} + +func schema_runtime_hooks_api_v1alpha1_BeforeClusterDeleteResponse(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "BeforeClusterDeleteResponse is the response of the BeforeClusterDelete hook.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Status of the call. One of \"Success\" or \"Failure\".\n\nPossible enum values:\n - `\"Failure\"` represents a failure response.\n - `\"Success\"` represents the success response.", + Default: "", + Type: []string{"string"}, + Format: "", + Enum: []interface{}{"Failure", "Success"}}, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "A human-readable description of the status of the call.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "retryAfterSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "RetryAfterSeconds when set to a non-zero value signifies that the hook will be called again at a future time.", + Default: 0, + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + Required: []string{"status", "message", "retryAfterSeconds"}, + }, + }, + } +} + +func schema_runtime_hooks_api_v1alpha1_BeforeClusterUpgradeRequest(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "BeforeClusterUpgradeRequest is the request of the BeforeClusterUpgrade hook.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "cluster": { + SchemaProps: spec.SchemaProps{ + Description: "The cluster object the lifecycle hook corresponds to.", + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/api/v1beta1.Cluster"), + }, + }, + "fromKubernetesVersion": { + SchemaProps: spec.SchemaProps{ + Description: "The current Kubernetes version of the cluster.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "toKubernetesVersion": { + SchemaProps: spec.SchemaProps{ + Description: "The target Kubernetes version of upgrade.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"cluster", "fromKubernetesVersion", "toKubernetesVersion"}, + }, + }, + Dependencies: []string{ + "sigs.k8s.io/cluster-api/api/v1beta1.Cluster"}, + } +} + +func schema_runtime_hooks_api_v1alpha1_BeforeClusterUpgradeResponse(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "BeforeClusterUpgradeResponse is the response of the BeforeClusterUpgrade hook.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Status of the call. One of \"Success\" or \"Failure\".\n\nPossible enum values:\n - `\"Failure\"` represents a failure response.\n - `\"Success\"` represents the success response.", + Default: "", + Type: []string{"string"}, + Format: "", + Enum: []interface{}{"Failure", "Success"}}, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "A human-readable description of the status of the call.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "retryAfterSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "RetryAfterSeconds when set to a non-zero value signifies that the hook will be called again at a future time.", + Default: 0, + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + Required: []string{"status", "message", "retryAfterSeconds"}, + }, + }, + } +} + +func schema_runtime_hooks_api_v1alpha1_CommonResponse(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "CommonResponse is the data structure common to all response types.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Status of the call. One of \"Success\" or \"Failure\".\n\nPossible enum values:\n - `\"Failure\"` represents a failure response.\n - `\"Success\"` represents the success response.", + Default: "", + Type: []string{"string"}, + Format: "", + Enum: []interface{}{"Failure", "Success"}}, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "A human-readable description of the status of the call.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"status", "message"}, + }, + }, + } +} + +func schema_runtime_hooks_api_v1alpha1_CommonRetryResponse(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "CommonRetryResponse is the data structure which contains all common retry fields.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Status of the call. One of \"Success\" or \"Failure\".\n\nPossible enum values:\n - `\"Failure\"` represents a failure response.\n - `\"Success\"` represents the success response.", + Default: "", + Type: []string{"string"}, + Format: "", + Enum: []interface{}{"Failure", "Success"}}, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "A human-readable description of the status of the call.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "retryAfterSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "RetryAfterSeconds when set to a non-zero value signifies that the hook will be called again at a future time.", + Default: 0, + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + Required: []string{"status", "message", "retryAfterSeconds"}, + }, + }, + } +} + +func schema_runtime_hooks_api_v1alpha1_DiscoveryRequest(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "DiscoveryRequest represents the object of a discovery request.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_runtime_hooks_api_v1alpha1_DiscoveryResponse(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "DiscoveryResponse represents the object received as a discovery response.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Status of the call. One of \"Success\" or \"Failure\".\n\nPossible enum values:\n - `\"Failure\"` represents a failure response.\n - `\"Success\"` represents the success response.", + Default: "", + Type: []string{"string"}, + Format: "", + Enum: []interface{}{"Failure", "Success"}}, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "A human-readable description of the status of the call.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "handlers": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "name", + }, + "x-kubernetes-list-type": "map", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "Handlers defines the current ExtensionHandlers supported by an Extension.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.ExtensionHandler"), + }, + }, + }, + }, + }, + }, + Required: []string{"status", "message", "handlers"}, + }, + }, + Dependencies: []string{ + "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.ExtensionHandler"}, + } +} + +func schema_runtime_hooks_api_v1alpha1_ExtensionHandler(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ExtensionHandler represents the discovery information of the extension which includes the hook it supports.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name is the name of the ExtensionHandler.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "requestHook": { + SchemaProps: spec.SchemaProps{ + Description: "RequestHook defines the versioned runtime hook which this ExtensionHandler serves.", + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.GroupVersionHook"), + }, + }, + "timeoutSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "TimeoutSeconds defines the timeout duration for client calls to the ExtensionHandler. This is defaulted to 10 if left undefined.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "failurePolicy": { + SchemaProps: spec.SchemaProps{ + Description: "FailurePolicy defines how failures in calls to the ExtensionHandler should be handled by a client. This is defaulted to FailurePolicyFail if not defined.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"name", "requestHook"}, + }, + }, + Dependencies: []string{ + "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.GroupVersionHook"}, + } +} + +func schema_runtime_hooks_api_v1alpha1_GeneratePatchesRequest(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GeneratePatchesRequest is the request of the GeneratePatches hook.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "variables": { + SchemaProps: spec.SchemaProps{ + Description: "Variables are global variables for all templates.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.Variable"), + }, + }, + }, + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "Items is the list of templates to generate patches for.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.GeneratePatchesRequestItem"), + }, + }, + }, + }, + }, + }, + Required: []string{"variables", "items"}, + }, + }, + Dependencies: []string{ + "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.GeneratePatchesRequestItem", "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.Variable"}, + } +} + +func schema_runtime_hooks_api_v1alpha1_GeneratePatchesRequestItem(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GeneratePatchesRequestItem represents a template to generate patches for.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "uid": { + SchemaProps: spec.SchemaProps{ + Description: "UID is an identifier for this template. It allows us to correlate the template in the request with the corresponding generates patches in the response.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "holderReference": { + SchemaProps: spec.SchemaProps{ + Description: "HolderReference is a reference to the object where the template is used.", + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.HolderReference"), + }, + }, + "object": { + SchemaProps: spec.SchemaProps{ + Description: "Object contains the template as a raw object.", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"), + }, + }, + "variables": { + SchemaProps: spec.SchemaProps{ + Description: "Variables are variables specific for the current template. For example some builtin variables like MachineDeployment replicas and version are context-sensitive and thus are only added to templates for MachineDeployments and with values which correspond to the current MachineDeployment.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.Variable"), + }, + }, + }, + }, + }, + }, + Required: []string{"uid", "holderReference", "object", "variables"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/runtime.RawExtension", "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.HolderReference", "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.Variable"}, + } +} + +func schema_runtime_hooks_api_v1alpha1_GeneratePatchesResponse(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GeneratePatchesResponse is the response of the GeneratePatches hook. NOTE: The patches in GeneratePatchesResponse will be applied in the order in which they are defined to the templates of the request. Thus applying changes consecutively when iterating through internal and external patches.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Status of the call. One of \"Success\" or \"Failure\".\n\nPossible enum values:\n - `\"Failure\"` represents a failure response.\n - `\"Success\"` represents the success response.", + Default: "", + Type: []string{"string"}, + Format: "", + Enum: []interface{}{"Failure", "Success"}}, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "A human-readable description of the status of the call.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "Items is the list of generated patches.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.GeneratePatchesResponseItem"), + }, + }, + }, + }, + }, + }, + Required: []string{"status", "message", "items"}, + }, + }, + Dependencies: []string{ + "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.GeneratePatchesResponseItem"}, + } +} + +func schema_runtime_hooks_api_v1alpha1_GeneratePatchesResponseItem(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GeneratePatchesResponseItem is a generated patch.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "uid": { + SchemaProps: spec.SchemaProps{ + Description: "UID identifies the corresponding template in the request on which the patch should be applied.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "patchType": { + SchemaProps: spec.SchemaProps{ + Description: "PatchType defines the type of the patch. One of: \"JSONPatch\" or \"JSONMergePatch\".\n\nPossible enum values:\n - `\"JSONMergePatch\"` identifies a https://datatracker.ietf.org/doc/html/rfc7386 JSON merge patch.\n - `\"JSONPatch\"` identifies a https://datatracker.ietf.org/doc/html/rfc6902 JSON patch.", + Default: "", + Type: []string{"string"}, + Format: "", + Enum: []interface{}{"JSONMergePatch", "JSONPatch"}}, + }, + "patch": { + SchemaProps: spec.SchemaProps{ + Description: "Patch contains the patch which should be applied to the template. It must be of the corresponding PatchType.", + Type: []string{"string"}, + Format: "byte", + }, + }, + }, + Required: []string{"uid", "patchType", "patch"}, + }, + }, + } +} + +func schema_runtime_hooks_api_v1alpha1_GroupVersionHook(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GroupVersionHook defines the runtime hook when the ExtensionHandler is called.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion is the Version of the Hook", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "hook": { + SchemaProps: spec.SchemaProps{ + Description: "Hook is the name of the hook", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"apiVersion", "hook"}, + }, + }, + } +} + +func schema_runtime_hooks_api_v1alpha1_HolderReference(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "HolderReference represents a reference to an object which holds a template.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "API version of the referent.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "namespace": { + SchemaProps: spec.SchemaProps{ + Description: "Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "fieldPath": { + SchemaProps: spec.SchemaProps{ + Description: "FieldPath is the path to the field of the object which references the template.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"apiVersion", "kind", "namespace", "name", "fieldPath"}, + }, + }, + } +} + +func schema_runtime_hooks_api_v1alpha1_ValidateTopologyRequest(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ValidateTopologyRequest is the request of the ValidateTopology hook.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "variables": { + SchemaProps: spec.SchemaProps{ + Description: "Variables are global variables for all templates.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.Variable"), + }, + }, + }, + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "Items is the list of templates to validate.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.ValidateTopologyRequestItem"), + }, + }, + }, + }, + }, + }, + Required: []string{"variables", "items"}, + }, + }, + Dependencies: []string{ + "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.ValidateTopologyRequestItem", "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.Variable"}, + } +} + +func schema_runtime_hooks_api_v1alpha1_ValidateTopologyRequestItem(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ValidateTopologyRequestItem represents a template to validate.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "holderReference": { + SchemaProps: spec.SchemaProps{ + Description: "HolderReference is a reference to the object where the template is used.", + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.HolderReference"), + }, + }, + "object": { + SchemaProps: spec.SchemaProps{ + Description: "Object contains the template as a raw object.", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"), + }, + }, + "variables": { + SchemaProps: spec.SchemaProps{ + Description: "Variables are variables specific for the current template. For example some builtin variables like MachineDeployment replicas and version are context-sensitive and thus are only added to templates for MachineDeployments and with values which correspond to the current MachineDeployment.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.Variable"), + }, + }, + }, + }, + }, + }, + Required: []string{"holderReference", "object", "variables"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/runtime.RawExtension", "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.HolderReference", "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1.Variable"}, + } +} + +func schema_runtime_hooks_api_v1alpha1_ValidateTopologyResponse(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ValidateTopologyResponse is the response of the ValidateTopology hook.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Status of the call. One of \"Success\" or \"Failure\".\n\nPossible enum values:\n - `\"Failure\"` represents a failure response.\n - `\"Success\"` represents the success response.", + Default: "", + Type: []string{"string"}, + Format: "", + Enum: []interface{}{"Failure", "Success"}}, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "A human-readable description of the status of the call.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"status", "message"}, + }, + }, + } +} + +func schema_runtime_hooks_api_v1alpha1_Variable(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Variable represents a variable value.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name of the variable.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "value": { + SchemaProps: spec.SchemaProps{ + Description: "Value of the variable.", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1.JSON"), + }, + }, + }, + Required: []string{"name", "value"}, + }, + }, + Dependencies: []string{ + "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1.JSON"}, + } +} diff --git a/exp/runtime/internal/controllers/extensionconfig_controller_test.go b/exp/runtime/internal/controllers/extensionconfig_controller_test.go index b9ef308c6127..15f5cdcb5520 100644 --- a/exp/runtime/internal/controllers/extensionconfig_controller_test.go +++ b/exp/runtime/internal/controllers/extensionconfig_controller_test.go @@ -38,7 +38,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client/fake" runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" - runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha2" "sigs.k8s.io/cluster-api/feature" runtimecatalog "sigs.k8s.io/cluster-api/internal/runtime/catalog" runtimeclient "sigs.k8s.io/cluster-api/internal/runtime/client" diff --git a/exp/runtime/internal/controllers/warmup_test.go b/exp/runtime/internal/controllers/warmup_test.go index f31393dca378..27fa7d4074a3 100644 --- a/exp/runtime/internal/controllers/warmup_test.go +++ b/exp/runtime/internal/controllers/warmup_test.go @@ -28,7 +28,7 @@ import ( utilfeature "k8s.io/component-base/featuregate/testing" runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" - runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha2" "sigs.k8s.io/cluster-api/feature" runtimecatalog "sigs.k8s.io/cluster-api/internal/runtime/catalog" runtimeclient "sigs.k8s.io/cluster-api/internal/runtime/client" diff --git a/hack/tools/runtime-openapi-gen/main.go b/hack/tools/runtime-openapi-gen/main.go index b9b39ad12c2d..85a5adbd275c 100644 --- a/hack/tools/runtime-openapi-gen/main.go +++ b/hack/tools/runtime-openapi-gen/main.go @@ -26,7 +26,8 @@ import ( "sigs.k8s.io/yaml" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" - runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1alpha1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha2" runtimecatalog "sigs.k8s.io/cluster-api/internal/runtime/catalog" ) @@ -51,6 +52,7 @@ func main() { } c := runtimecatalog.New() + _ = runtimehooksv1alpha1.AddToCatalog(c) _ = runtimehooksv1.AddToCatalog(c) c.AddOpenAPIDefinitions(clusterv1.GetOpenAPIDefinitions) diff --git a/internal/controllers/topology/cluster/cluster_controller.go b/internal/controllers/topology/cluster/cluster_controller.go index a40862b12106..bbad1fa4a5ea 100644 --- a/internal/controllers/topology/cluster/cluster_controller.go +++ b/internal/controllers/topology/cluster/cluster_controller.go @@ -37,7 +37,7 @@ import ( clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/cluster-api/api/v1beta1/index" "sigs.k8s.io/cluster-api/controllers/external" - runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha2" "sigs.k8s.io/cluster-api/feature" "sigs.k8s.io/cluster-api/internal/controllers/topology/cluster/patches" "sigs.k8s.io/cluster-api/internal/controllers/topology/cluster/scope" diff --git a/internal/controllers/topology/cluster/cluster_controller_test.go b/internal/controllers/topology/cluster/cluster_controller_test.go index d0b534e44b17..08036a4da84d 100644 --- a/internal/controllers/topology/cluster/cluster_controller_test.go +++ b/internal/controllers/topology/cluster/cluster_controller_test.go @@ -31,7 +31,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/reconcile" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" - runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha2" "sigs.k8s.io/cluster-api/feature" "sigs.k8s.io/cluster-api/internal/contract" "sigs.k8s.io/cluster-api/internal/controllers/topology/cluster/scope" diff --git a/internal/controllers/topology/cluster/conditions_test.go b/internal/controllers/topology/cluster/conditions_test.go index dbd6d9cce998..c54e12e776a3 100644 --- a/internal/controllers/topology/cluster/conditions_test.go +++ b/internal/controllers/topology/cluster/conditions_test.go @@ -24,7 +24,7 @@ import ( corev1 "k8s.io/api/core/v1" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" - runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha2" "sigs.k8s.io/cluster-api/internal/controllers/topology/cluster/scope" "sigs.k8s.io/cluster-api/internal/test/builder" "sigs.k8s.io/cluster-api/util/conditions" diff --git a/internal/controllers/topology/cluster/desired_state.go b/internal/controllers/topology/cluster/desired_state.go index d6fe1e20579b..25da2659e37f 100644 --- a/internal/controllers/topology/cluster/desired_state.go +++ b/internal/controllers/topology/cluster/desired_state.go @@ -31,7 +31,7 @@ import ( clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/cluster-api/controllers/external" - runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha2" "sigs.k8s.io/cluster-api/feature" "sigs.k8s.io/cluster-api/internal/contract" "sigs.k8s.io/cluster-api/internal/controllers/topology/cluster/scope" diff --git a/internal/controllers/topology/cluster/desired_state_test.go b/internal/controllers/topology/cluster/desired_state_test.go index d714fbfbb50e..9b4742254b3d 100644 --- a/internal/controllers/topology/cluster/desired_state_test.go +++ b/internal/controllers/topology/cluster/desired_state_test.go @@ -35,7 +35,7 @@ import ( clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" - runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha2" "sigs.k8s.io/cluster-api/feature" "sigs.k8s.io/cluster-api/internal/contract" "sigs.k8s.io/cluster-api/internal/controllers/topology/cluster/scope" diff --git a/internal/controllers/topology/cluster/patches/api/interface.go b/internal/controllers/topology/cluster/patches/api/interface.go index b1cbfba42a76..7b3af27491d9 100644 --- a/internal/controllers/topology/cluster/patches/api/interface.go +++ b/internal/controllers/topology/cluster/patches/api/interface.go @@ -26,7 +26,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" - runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha2" ) // Generator defines a component that can generate patches for ClusterClass templates. diff --git a/internal/controllers/topology/cluster/patches/engine.go b/internal/controllers/topology/cluster/patches/engine.go index 8c4f85e828a6..8e13052bec1c 100644 --- a/internal/controllers/topology/cluster/patches/engine.go +++ b/internal/controllers/topology/cluster/patches/engine.go @@ -25,7 +25,7 @@ import ( "github.com/pkg/errors" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" - runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha2" "sigs.k8s.io/cluster-api/feature" "sigs.k8s.io/cluster-api/internal/contract" "sigs.k8s.io/cluster-api/internal/controllers/topology/cluster/patches/api" diff --git a/internal/controllers/topology/cluster/patches/engine_test.go b/internal/controllers/topology/cluster/patches/engine_test.go index 252b02209a19..fe9aeddad8a6 100644 --- a/internal/controllers/topology/cluster/patches/engine_test.go +++ b/internal/controllers/topology/cluster/patches/engine_test.go @@ -32,7 +32,7 @@ import ( "k8s.io/utils/pointer" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" - runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha2" "sigs.k8s.io/cluster-api/feature" "sigs.k8s.io/cluster-api/internal/controllers/topology/cluster/scope" runtimecatalog "sigs.k8s.io/cluster-api/internal/runtime/catalog" diff --git a/internal/controllers/topology/cluster/patches/external/external_patch_generator.go b/internal/controllers/topology/cluster/patches/external/external_patch_generator.go index 7da6cef2c8fb..5d0a8893e89c 100644 --- a/internal/controllers/topology/cluster/patches/external/external_patch_generator.go +++ b/internal/controllers/topology/cluster/patches/external/external_patch_generator.go @@ -24,7 +24,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" - runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha2" "sigs.k8s.io/cluster-api/feature" "sigs.k8s.io/cluster-api/internal/controllers/topology/cluster/patches/api" runtimeclient "sigs.k8s.io/cluster-api/internal/runtime/client" diff --git a/internal/controllers/topology/cluster/patches/external/external_validator.go b/internal/controllers/topology/cluster/patches/external/external_validator.go index c238de0503e9..9b29199e6aa3 100644 --- a/internal/controllers/topology/cluster/patches/external/external_validator.go +++ b/internal/controllers/topology/cluster/patches/external/external_validator.go @@ -24,7 +24,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" - runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha2" "sigs.k8s.io/cluster-api/feature" "sigs.k8s.io/cluster-api/internal/controllers/topology/cluster/patches/api" runtimeclient "sigs.k8s.io/cluster-api/internal/runtime/client" diff --git a/internal/controllers/topology/cluster/patches/inline/json_patch_generator.go b/internal/controllers/topology/cluster/patches/inline/json_patch_generator.go index 71decbea10de..7ba7fdd2ccb1 100644 --- a/internal/controllers/topology/cluster/patches/inline/json_patch_generator.go +++ b/internal/controllers/topology/cluster/patches/inline/json_patch_generator.go @@ -33,7 +33,7 @@ import ( "sigs.k8s.io/yaml" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" - runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha2" "sigs.k8s.io/cluster-api/internal/contract" "sigs.k8s.io/cluster-api/internal/controllers/topology/cluster/patches/api" patchvariables "sigs.k8s.io/cluster-api/internal/controllers/topology/cluster/patches/variables" diff --git a/internal/controllers/topology/cluster/patches/inline/json_patch_generator_test.go b/internal/controllers/topology/cluster/patches/inline/json_patch_generator_test.go index 9aa7f2f0444b..8afb4499b6c2 100644 --- a/internal/controllers/topology/cluster/patches/inline/json_patch_generator_test.go +++ b/internal/controllers/topology/cluster/patches/inline/json_patch_generator_test.go @@ -30,7 +30,7 @@ import ( "k8s.io/utils/pointer" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" - runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha2" patchvariables "sigs.k8s.io/cluster-api/internal/controllers/topology/cluster/patches/variables" ) diff --git a/internal/controllers/topology/cluster/patches/template.go b/internal/controllers/topology/cluster/patches/template.go index d2a5e1d3dbfd..89634bb97dce 100644 --- a/internal/controllers/topology/cluster/patches/template.go +++ b/internal/controllers/topology/cluster/patches/template.go @@ -28,7 +28,7 @@ import ( "k8s.io/apimachinery/pkg/util/uuid" "sigs.k8s.io/controller-runtime/pkg/client" - runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha2" "sigs.k8s.io/cluster-api/internal/controllers/topology/cluster/patches/variables" ) diff --git a/internal/controllers/topology/cluster/patches/variables/variables.go b/internal/controllers/topology/cluster/patches/variables/variables.go index fe618e1475f3..d8727995d615 100644 --- a/internal/controllers/topology/cluster/patches/variables/variables.go +++ b/internal/controllers/topology/cluster/patches/variables/variables.go @@ -26,7 +26,7 @@ import ( "k8s.io/utils/pointer" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" - runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha2" "sigs.k8s.io/cluster-api/internal/contract" ) diff --git a/internal/controllers/topology/cluster/patches/variables/variables_test.go b/internal/controllers/topology/cluster/patches/variables/variables_test.go index f20f40c454c8..8d1df1c8fd3e 100644 --- a/internal/controllers/topology/cluster/patches/variables/variables_test.go +++ b/internal/controllers/topology/cluster/patches/variables/variables_test.go @@ -28,7 +28,7 @@ import ( "k8s.io/utils/pointer" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" - runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha2" "sigs.k8s.io/cluster-api/internal/test/builder" ) diff --git a/internal/controllers/topology/cluster/reconcile_state.go b/internal/controllers/topology/cluster/reconcile_state.go index 9b4dbadca441..f233959da150 100644 --- a/internal/controllers/topology/cluster/reconcile_state.go +++ b/internal/controllers/topology/cluster/reconcile_state.go @@ -32,7 +32,7 @@ import ( clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/cluster-api/controllers/external" - runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha2" "sigs.k8s.io/cluster-api/feature" "sigs.k8s.io/cluster-api/internal/contract" "sigs.k8s.io/cluster-api/internal/controllers/topology/cluster/scope" diff --git a/internal/controllers/topology/cluster/reconcile_state_test.go b/internal/controllers/topology/cluster/reconcile_state_test.go index a129309e5efb..a829fb046f0a 100644 --- a/internal/controllers/topology/cluster/reconcile_state_test.go +++ b/internal/controllers/topology/cluster/reconcile_state_test.go @@ -37,7 +37,7 @@ import ( clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" - runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha2" "sigs.k8s.io/cluster-api/internal/contract" "sigs.k8s.io/cluster-api/internal/controllers/topology/cluster/scope" "sigs.k8s.io/cluster-api/internal/controllers/topology/cluster/structuredmerge" diff --git a/internal/controllers/topology/cluster/scope/hookresponsetracker.go b/internal/controllers/topology/cluster/scope/hookresponsetracker.go index 2ba4316daac3..edea94cda4c1 100644 --- a/internal/controllers/topology/cluster/scope/hookresponsetracker.go +++ b/internal/controllers/topology/cluster/scope/hookresponsetracker.go @@ -21,7 +21,7 @@ import ( "strings" "time" - runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha2" runtimecatalog "sigs.k8s.io/cluster-api/internal/runtime/catalog" ) diff --git a/internal/controllers/topology/cluster/scope/hookresponsetracker_test.go b/internal/controllers/topology/cluster/scope/hookresponsetracker_test.go index 5ff76e2794af..ee3c5401a990 100644 --- a/internal/controllers/topology/cluster/scope/hookresponsetracker_test.go +++ b/internal/controllers/topology/cluster/scope/hookresponsetracker_test.go @@ -22,7 +22,7 @@ import ( . "github.com/onsi/gomega" - runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha2" runtimecatalog "sigs.k8s.io/cluster-api/internal/runtime/catalog" ) diff --git a/internal/hooks/tracking_test.go b/internal/hooks/tracking_test.go index 54457f17c6a8..83d9729ad72d 100644 --- a/internal/hooks/tracking_test.go +++ b/internal/hooks/tracking_test.go @@ -27,7 +27,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client/fake" runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" - runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha2" runtimecatalog "sigs.k8s.io/cluster-api/internal/runtime/catalog" ) diff --git a/internal/runtime/client/client.go b/internal/runtime/client/client.go index 10a3f798c1a1..356ab2400c48 100644 --- a/internal/runtime/client/client.go +++ b/internal/runtime/client/client.go @@ -21,6 +21,7 @@ import ( "bytes" "context" "encoding/json" + "io/ioutil" "net" "net/http" "net/url" @@ -42,7 +43,8 @@ import ( ctrlclient "sigs.k8s.io/controller-runtime/pkg/client" runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" - runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1alpha1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha2" runtimecatalog "sigs.k8s.io/cluster-api/internal/runtime/catalog" runtimeregistry "sigs.k8s.io/cluster-api/internal/runtime/registry" "sigs.k8s.io/cluster-api/util" @@ -118,20 +120,38 @@ func (c *client) Discover(ctx context.Context, extensionConfig *runtimev1.Extens hookGVH, err := c.catalog.GroupVersionHook(runtimehooksv1.Discovery) if err != nil { return nil, errors.Wrap(err, "failed to compute GVH of hook") - } + } request := &runtimehooksv1.DiscoveryRequest{} response := &runtimehooksv1.DiscoveryResponse{} - opts := &httpCallOptions{ - catalog: c.catalog, - config: extensionConfig.Spec.ClientConfig, - registrationGVH: hookGVH, - hookGVH: hookGVH, - timeout: defaultDiscoveryTimeout, + var errs []error + var discoverySucceeded bool + for _, discoveryHookFunc := range []interface{}{runtimehooksv1.Discovery, runtimehooksv1alpha1.Discovery} { + registrationGVH, err := c.catalog.GroupVersionHook(discoveryHookFunc) + if err != nil { + return nil, errors.Wrap(err, "failed to compute GVH of hook") + } + + opts := &httpCallOptions{ + catalog: c.catalog, + config: extensionConfig.Spec.ClientConfig, + registrationGVH: registrationGVH, + hookGVH: hookGVH, + timeout: defaultDiscoveryTimeout, + } + if err := httpCall(ctx, request, response, opts); err != nil { + errs = append(errs, errors.Wrap(err, "failed to call the Discovery endpoint")) + continue + } + + discoverySucceeded = true + break } - if err := httpCall(ctx, request, response, opts); err != nil { - return nil, errors.Wrap(err, "failed to call the Discovery endpoint") + + if !discoverySucceeded { + return nil, kerrors.NewAggregate(errs) } + // Check to see if the response is a failure and handle the failure accordingly. if response.GetStatus() == runtimehooksv1.ResponseStatusFailure { return nil, errors.Errorf("discovery failed with %v", response.GetMessage()) @@ -452,14 +472,21 @@ func httpCall(ctx context.Context, request, response runtime.Object, opts *httpC errors.Wrapf(err, "failed to call ExtensionHandler: %q", opts.name), ) } + defer resp.Body.Close() if resp.StatusCode != http.StatusOK { + respBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return errCallingExtensionHandler( + errors.Errorf("failed to call ExtensionHandler: failed to read response body (status code: %d)", resp.StatusCode), + ) + } + return errCallingExtensionHandler( - errors.Errorf("non 200 response code, %q, not accepted", resp.StatusCode), + errors.Errorf("failed to call ExtensionHandler: response: %q (status code: %d)", string(respBody), resp.StatusCode), ) } - defer resp.Body.Close() if err := json.NewDecoder(resp.Body).Decode(responseLocal); err != nil { return errCallingExtensionHandler( errors.Wrap(err, "failed to decode message"), diff --git a/internal/runtime/client/client_test.go b/internal/runtime/client/client_test.go index 589742d21de8..a464316a4271 100644 --- a/internal/runtime/client/client_test.go +++ b/internal/runtime/client/client_test.go @@ -40,7 +40,7 @@ import ( clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" - runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha2" runtimecatalog "sigs.k8s.io/cluster-api/internal/runtime/catalog" runtimeregistry "sigs.k8s.io/cluster-api/internal/runtime/registry" fakev1alpha1 "sigs.k8s.io/cluster-api/internal/runtime/test/v1alpha1" diff --git a/internal/runtime/client/fake/fake_client.go b/internal/runtime/client/fake/fake_client.go index 2c0aec5ca01d..1c989304f8b8 100644 --- a/internal/runtime/client/fake/fake_client.go +++ b/internal/runtime/client/fake/fake_client.go @@ -26,7 +26,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" - runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha2" runtimecatalog "sigs.k8s.io/cluster-api/internal/runtime/catalog" runtimeclient "sigs.k8s.io/cluster-api/internal/runtime/client" ) diff --git a/internal/runtime/test/v1alpha1/fake_types.go b/internal/runtime/test/v1alpha1/fake_types.go index 5d9d5e090674..899100faf386 100644 --- a/internal/runtime/test/v1alpha1/fake_types.go +++ b/internal/runtime/test/v1alpha1/fake_types.go @@ -23,7 +23,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" clusterv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" - runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha2" runtimecatalog "sigs.k8s.io/cluster-api/internal/runtime/catalog" ) diff --git a/internal/runtime/test/v1alpha2/fake_types.go b/internal/runtime/test/v1alpha2/fake_types.go index 6d772393f7e2..56a673f9a5a0 100644 --- a/internal/runtime/test/v1alpha2/fake_types.go +++ b/internal/runtime/test/v1alpha2/fake_types.go @@ -23,7 +23,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" - runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha2" runtimecatalog "sigs.k8s.io/cluster-api/internal/runtime/catalog" ) diff --git a/main.go b/main.go index 21bff37b63cf..2588267fe59b 100644 --- a/main.go +++ b/main.go @@ -56,7 +56,8 @@ import ( expcontrollers "sigs.k8s.io/cluster-api/exp/controllers" runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" runtimecontrollers "sigs.k8s.io/cluster-api/exp/runtime/controllers" - runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1alpha1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha2" "sigs.k8s.io/cluster-api/feature" runtimecatalog "sigs.k8s.io/cluster-api/internal/runtime/catalog" runtimeclient "sigs.k8s.io/cluster-api/internal/runtime/client" @@ -117,6 +118,7 @@ func init() { // +kubebuilder:scaffold:scheme // Register the RuntimeHook types into the catalog. + _ = runtimehooksv1alpha1.AddToCatalog(catalog) _ = runtimehooksv1.AddToCatalog(catalog) } diff --git a/test/e2e/cluster_upgrade_runtimesdk.go b/test/e2e/cluster_upgrade_runtimesdk.go index 3444644e0ddc..d8f38456ccf5 100644 --- a/test/e2e/cluster_upgrade_runtimesdk.go +++ b/test/e2e/cluster_upgrade_runtimesdk.go @@ -124,7 +124,7 @@ func clusterUpgradeWithRuntimeSDKSpec(ctx context.Context, inputGetter func() cl // Set the SERVICE_NAMESPACE, which is used in the cert-manager Certificate CR. // We have to dynamically set the namespace here, because it depends on the test run and thus // cannot be set when rendering the test extension YAML with kustomize. - testExtensionDeployment := strings.ReplaceAll(string(testExtensionDeploymentTemplate), "${SERVICE_NAMESPACE}", namespace.Name) + testExtensionDeployment := strings.ReplaceAll(string(testExtensionDeploymentTemplate), "${TEST_NAMESPACE}", namespace.Name) Expect(testExtensionDeployment).ToNot(BeEmpty(), "Test Extension deployment manifest file should not be empty") Expect(input.BootstrapClusterProxy.Apply(ctx, []byte(testExtensionDeployment), "--namespace", namespace.Name)).To(Succeed()) diff --git a/test/extension/config/certmanager/certificate.yaml b/test/extension/config/certmanager/certificate.yaml index c35b393de38d..bd07cbdc1302 100644 --- a/test/extension/config/certmanager/certificate.yaml +++ b/test/extension/config/certmanager/certificate.yaml @@ -13,10 +13,10 @@ metadata: name: serving-cert # this name should match the one appeared in kustomizeconfig.yaml spec: # $(SERVICE_NAME) will be substituted by kustomize - # $(SERVICE_NAMESPACE) will be substituted on deployment + # $(TEST_NAMESPACE) will be substituted on deployment dnsNames: - - $(SERVICE_NAME).${SERVICE_NAMESPACE}.svc - - $(SERVICE_NAME).${SERVICE_NAMESPACE}.svc.cluster.local + - $(SERVICE_NAME).${TEST_NAMESPACE}.svc + - $(SERVICE_NAME).${TEST_NAMESPACE}.svc.cluster.local # for local testing. - localhost issuerRef: diff --git a/test/extension/config/default/extension.yaml b/test/extension/config/default/extension.yaml index 9601638bb808..512891a50859 100644 --- a/test/extension/config/default/extension.yaml +++ b/test/extension/config/default/extension.yaml @@ -19,6 +19,7 @@ spec: image: controller:latest name: extension terminationGracePeriodSeconds: 10 + serviceAccountName: test-extension tolerations: - effect: NoSchedule key: node-role.kubernetes.io/master diff --git a/test/extension/config/default/kustomization.yaml b/test/extension/config/default/kustomization.yaml index 9f3c7b4d1ef2..ce3406f97555 100644 --- a/test/extension/config/default/kustomization.yaml +++ b/test/extension/config/default/kustomization.yaml @@ -6,6 +6,7 @@ resources: bases: - ../certmanager +- ../rbac patchesStrategicMerge: # Provide customizable hook for make targets. diff --git a/test/extension/config/rbac/kustomization.yaml b/test/extension/config/rbac/kustomization.yaml new file mode 100644 index 000000000000..c0da68bcb480 --- /dev/null +++ b/test/extension/config/rbac/kustomization.yaml @@ -0,0 +1,6 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: +- role_binding.yaml +- role.yaml +- service_account.yaml diff --git a/test/extension/config/rbac/role.yaml b/test/extension/config/rbac/role.yaml new file mode 100644 index 000000000000..5a926d3490a5 --- /dev/null +++ b/test/extension/config/rbac/role.yaml @@ -0,0 +1,14 @@ +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: test-extension-role +rules: +- apiGroups: + - "" + resources: + - configmaps + verbs: + - get + - list + - watch diff --git a/test/extension/config/rbac/role_binding.yaml b/test/extension/config/rbac/role_binding.yaml new file mode 100644 index 000000000000..79c7e16c54ba --- /dev/null +++ b/test/extension/config/rbac/role_binding.yaml @@ -0,0 +1,12 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: test-extension-rolebinding +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: test-extension-role +subjects: +- kind: ServiceAccount + name: test-extension + namespace: ${TEST_NAMESPACE} diff --git a/test/extension/config/rbac/service_account.yaml b/test/extension/config/rbac/service_account.yaml new file mode 100644 index 000000000000..88e2aaa77dea --- /dev/null +++ b/test/extension/config/rbac/service_account.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: test-extension diff --git a/test/extension/handlers/lifecycle/handler.go b/test/extension/handlers/lifecycle/handler.go new file mode 100644 index 000000000000..d47590fddeff --- /dev/null +++ b/test/extension/handlers/lifecycle/handler.go @@ -0,0 +1,141 @@ +/* +Copyright 2022 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package lifecycle contains the handlers for the lifecycle hooks. +package lifecycle + +import ( + "context" + "fmt" + + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/client" + + runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimecatalog "sigs.k8s.io/cluster-api/internal/runtime/catalog" +) + +// Handler is the handler for the lifecycle hooks. +type Handler struct { + Client client.Client +} + +// DoBeforeClusterCreate implements the BeforeClusterCreate hook. +func (h *Handler) DoBeforeClusterCreate(ctx context.Context, request *runtimehooksv1.BeforeClusterCreateRequest, response *runtimehooksv1.BeforeClusterCreateResponse) { + log := ctrl.LoggerFrom(ctx) + log.Info("BeforeClusterCreate is called", "cluster", fmt.Sprintf("%#v", request.Cluster), "clusterType", fmt.Sprintf("%T", request.Cluster)) + cluster := request.Cluster + err := h.updateResponseFromConfigMap(cluster.Name, cluster.Namespace, runtimehooksv1.BeforeClusterCreate, response) + if err != nil { + response.Status = runtimehooksv1.ResponseStatusFailure + response.Message = err.Error() + return + } + log.Info(fmt.Sprintf("BeforeClusterCreate responding RetryAfterSeconds: %v\n", response.RetryAfterSeconds)) +} + +// DoBeforeClusterUpgrade implements the BeforeClusterUpgrade hook. +func (h *Handler) DoBeforeClusterUpgrade(ctx context.Context, request *runtimehooksv1.BeforeClusterUpgradeRequest, response *runtimehooksv1.BeforeClusterUpgradeResponse) { + log := ctrl.LoggerFrom(ctx) + log.Info("BeforeClusterUpgrade is called", "cluster", fmt.Sprintf("%#v", request.Cluster), "clusterType", fmt.Sprintf("%T", request.Cluster)) + cluster := request.Cluster + err := h.updateResponseFromConfigMap(cluster.Name, cluster.Namespace, runtimehooksv1.BeforeClusterUpgrade, response) + if err != nil { + response.Status = runtimehooksv1.ResponseStatusFailure + response.Message = err.Error() + return + } + log.Info(fmt.Sprintf("BeforeClusterUpgrade responding RetryAfterSeconds: %v\n", response.RetryAfterSeconds)) +} + +// DoAfterControlPlaneInitialized implements the AfterControlPlaneInitialized hook. +func (h *Handler) DoAfterControlPlaneInitialized(ctx context.Context, request *runtimehooksv1.AfterControlPlaneInitializedRequest, response *runtimehooksv1.AfterControlPlaneInitializedResponse) { + log := ctrl.LoggerFrom(ctx) + log.Info("AfterControlPlaneInitialized is called", "cluster", fmt.Sprintf("%#v", request.Cluster), "clusterType", fmt.Sprintf("%T", request.Cluster)) + cluster := request.Cluster + err := h.updateResponseFromConfigMap(cluster.Name, cluster.Namespace, runtimehooksv1.AfterControlPlaneInitialized, response) + if err != nil { + response.Status = runtimehooksv1.ResponseStatusFailure + response.Message = err.Error() + return + } +} + +// DoAfterControlPlaneUpgrade implements the AfterControlPlaneUpgrade hook. +func (h *Handler) DoAfterControlPlaneUpgrade(ctx context.Context, request *runtimehooksv1.AfterControlPlaneUpgradeRequest, response *runtimehooksv1.AfterControlPlaneUpgradeResponse) { + log := ctrl.LoggerFrom(ctx) + log.Info("AfterControlPlaneUpgrade is called", "cluster", fmt.Sprintf("%#v", request.Cluster), "clusterType", fmt.Sprintf("%T", request.Cluster)) + cluster := request.Cluster + err := h.updateResponseFromConfigMap(cluster.Name, cluster.Namespace, runtimehooksv1.AfterControlPlaneUpgrade, response) + if err != nil { + response.Status = runtimehooksv1.ResponseStatusFailure + response.Message = err.Error() + return + } + log.Info(fmt.Sprintf("AfterControlPlaneUpgrade responding RetryAfterSeconds: %v\n", response.RetryAfterSeconds)) +} + +// DoAfterClusterUpgrade implements the AfterClusterUpgrade hook. +func (h *Handler) DoAfterClusterUpgrade(ctx context.Context, request *runtimehooksv1.AfterClusterUpgradeRequest, response *runtimehooksv1.AfterClusterUpgradeResponse) { + log := ctrl.LoggerFrom(ctx) + log.Info("AfterClusterUpgrade is called", "cluster", fmt.Sprintf("%#v", request.Cluster), "clusterType", fmt.Sprintf("%T", request.Cluster)) + cluster := request.Cluster + err := h.updateResponseFromConfigMap(cluster.Name, cluster.Namespace, runtimehooksv1.AfterClusterUpgrade, response) + if err != nil { + response.Status = runtimehooksv1.ResponseStatusFailure + response.Message = err.Error() + return + } +} + +// DoBeforeClusterDelete implements the BeforeClusterDelete hook. +func (h *Handler) DoBeforeClusterDelete(ctx context.Context, request *runtimehooksv1.BeforeClusterDeleteRequest, response *runtimehooksv1.BeforeClusterDeleteResponse) { + log := ctrl.LoggerFrom(ctx) + log.Info("BeforeClusterDelete is called", "cluster", fmt.Sprintf("%#v", request.Cluster), "clusterType", fmt.Sprintf("%T", request.Cluster)) + cluster := request.Cluster + err := h.updateResponseFromConfigMap(cluster.Name, cluster.Namespace, runtimehooksv1.BeforeClusterDelete, response) + if err != nil { + response.Status = runtimehooksv1.ResponseStatusFailure + response.Message = err.Error() + return + } + log.Info(fmt.Sprintf("BeforeClusterDelete responding RetryAfterSeconds: %v\n", response.RetryAfterSeconds)) +} + +func (h *Handler) updateResponseFromConfigMap(name, namespace string, hook runtimecatalog.Hook, response runtimehooksv1.ResponseObject) error { + response.SetStatus(runtimehooksv1.ResponseStatusSuccess) + return nil + + //hookName := runtimecatalog.HookName(hook) + //configMap := &corev1.ConfigMap{} + //configMapName := name + "-hookresponses" + //if err := h.Client.Get(context.Background(), client.ObjectKey{Namespace: namespace, Name: configMapName}, configMap); err != nil { + // return errors.Wrapf(err, "failed to read the ConfigMap %s/%s", namespace, configMapName) + //} + //m := map[string]string{} + //if err := yaml.Unmarshal([]byte(configMap.Data[hookName]), m); err != nil { + // return errors.Wrapf(err, "failed to read %q response information from ConfigMap", hook) + //} + //response.SetMessage(m["Status"]) + //if retryResponse, ok := response.(runtimehooksv1.RetryResponseObject); ok { + // retryAfterSeconds, err := strconv.Atoi(m["RetryAfterSeconds"]) //nolint:gosec + // if err != nil { + // return err + // } + // retryResponse.SetRetryAfterSeconds(int32(retryAfterSeconds)) + //} + //return nil +} diff --git a/test/extension/handlers/topologymutation/handler.go b/test/extension/handlers/topologymutation/handler.go index 805adc47e5c4..70f8e9bcb9b6 100644 --- a/test/extension/handlers/topologymutation/handler.go +++ b/test/extension/handlers/topologymutation/handler.go @@ -26,7 +26,7 @@ import ( "k8s.io/apimachinery/pkg/runtime/serializer" ctrl "sigs.k8s.io/controller-runtime" - runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1alpha1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" patchvariables "sigs.k8s.io/cluster-api/internal/controllers/topology/cluster/patches/variables" infrav1 "sigs.k8s.io/cluster-api/test/infrastructure/docker/api/v1beta1" ) @@ -46,7 +46,7 @@ type Handler struct { } // GeneratePatches returns a function that generates patches for the given request. -func (h *Handler) GeneratePatches(ctx context.Context, req *runtimehooksv1.GeneratePatchesRequest, resp *runtimehooksv1.GeneratePatchesResponse) { +func (h *Handler) GeneratePatches(ctx context.Context, req *runtimehooksv1alpha1.GeneratePatchesRequest, resp *runtimehooksv1alpha1.GeneratePatchesResponse) { log := ctrl.LoggerFrom(ctx) log.Info("GeneratePatches called") @@ -80,9 +80,9 @@ func patchDockerClusterTemplate(dockerClusterTemplate *infrav1.DockerClusterTemp } // ValidateTopology returns a function that validates the given request. -func (h *Handler) ValidateTopology(ctx context.Context, _ *runtimehooksv1.ValidateTopologyRequest, resp *runtimehooksv1.ValidateTopologyResponse) { +func (h *Handler) ValidateTopology(ctx context.Context, _ *runtimehooksv1alpha1.ValidateTopologyRequest, resp *runtimehooksv1alpha1.ValidateTopologyResponse) { log := ctrl.LoggerFrom(ctx) log.Info("ValidateTopology called") - resp.Status = runtimehooksv1.ResponseStatusSuccess + resp.Status = runtimehooksv1alpha1.ResponseStatusSuccess } diff --git a/test/extension/handlers/topologymutation/lib.go b/test/extension/handlers/topologymutation/lib.go index 66f7eac31305..1c358f1f3390 100644 --- a/test/extension/handlers/topologymutation/lib.go +++ b/test/extension/handlers/topologymutation/lib.go @@ -25,18 +25,19 @@ import ( apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" "k8s.io/apimachinery/pkg/runtime" - runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1alpha1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha2" patchvariables "sigs.k8s.io/cluster-api/internal/controllers/topology/cluster/patches/variables" ) // walkTemplates walks through all templates of a GeneratePatchesRequest and calls the mutateFunc. -func walkTemplates(decoder runtime.Decoder, req *runtimehooksv1.GeneratePatchesRequest, resp *runtimehooksv1.GeneratePatchesResponse, mutateFunc func(obj runtime.Object, variables map[string]apiextensionsv1.JSON) error) { - globalVariables := patchvariables.ToMap(req.Variables) +func walkTemplates(decoder runtime.Decoder, req *runtimehooksv1alpha1.GeneratePatchesRequest, resp *runtimehooksv1alpha1.GeneratePatchesResponse, mutateFunc func(obj runtime.Object, variables map[string]apiextensionsv1.JSON) error) { + globalVariables := patchvariables.ToMap(convert(req.Variables)) for _, requestItem := range req.Items { - templateVariables, err := patchvariables.MergeVariableMaps(globalVariables, patchvariables.ToMap(requestItem.Variables)) + templateVariables, err := patchvariables.MergeVariableMaps(globalVariables, patchvariables.ToMap(convert(requestItem.Variables))) if err != nil { - resp.Status = runtimehooksv1.ResponseStatusFailure + resp.Status = runtimehooksv1alpha1.ResponseStatusFailure resp.Message = err.Error() return } @@ -50,28 +51,39 @@ func walkTemplates(decoder runtime.Decoder, req *runtimehooksv1.GeneratePatchesR original := obj.DeepCopyObject() if err := mutateFunc(obj, templateVariables); err != nil { - resp.Status = runtimehooksv1.ResponseStatusFailure + resp.Status = runtimehooksv1alpha1.ResponseStatusFailure resp.Message = err.Error() return } patch, err := createPatch(original, obj) if err != nil { - resp.Status = runtimehooksv1.ResponseStatusFailure + resp.Status = runtimehooksv1alpha1.ResponseStatusFailure resp.Message = err.Error() return } - resp.Items = append(resp.Items, runtimehooksv1.GeneratePatchesResponseItem{ + resp.Items = append(resp.Items, runtimehooksv1alpha1.GeneratePatchesResponseItem{ UID: requestItem.UID, - PatchType: runtimehooksv1.JSONPatchType, + PatchType: runtimehooksv1alpha1.JSONPatchType, Patch: patch, }) fmt.Printf("Generated patch (uid: %q): %q\n", requestItem.UID, string(patch)) } - resp.Status = runtimehooksv1.ResponseStatusSuccess + resp.Status = runtimehooksv1alpha1.ResponseStatusSuccess +} + +func convert(variables []runtimehooksv1alpha1.Variable) []runtimehooksv1.Variable { + result := []runtimehooksv1.Variable{} + for _, v := range variables { + result = append(result, runtimehooksv1.Variable{ + Name: v.Name, + Value: v.Value, + }) + } + return result } // createPatch creates a JSON patch from the original and the modified object. diff --git a/test/extension/main.go b/test/extension/main.go index 3aa9571d829b..29c2433dfea6 100644 --- a/test/extension/main.go +++ b/test/extension/main.go @@ -28,9 +28,11 @@ import ( "k8s.io/klog/v2" "k8s.io/utils/pointer" ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/client" - runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1alpha1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" runtimecatalog "sigs.k8s.io/cluster-api/internal/runtime/catalog" + "sigs.k8s.io/cluster-api/test/extension/handlers/lifecycle" "sigs.k8s.io/cluster-api/test/extension/handlers/topologymutation" "sigs.k8s.io/cluster-api/test/extension/server" infrav1 "sigs.k8s.io/cluster-api/test/infrastructure/docker/api/v1beta1" @@ -54,7 +56,7 @@ func init() { _ = infrav1.AddToScheme(scheme) // Register the RuntimeHook types into the catalog. - _ = runtimehooksv1.AddToCatalog(catalog) + _ = runtimehooksv1alpha1.AddToCatalog(catalog) } // InitFlags initializes the flags. @@ -95,6 +97,19 @@ func main() { ctx := ctrl.SetupSignalHandler() + restConfig, err := ctrl.GetConfig() + if err != nil { + setupLog.Error(err, "error getting config for the cluster") + os.Exit(1) + } + c, err := client.New(restConfig, client.Options{}) + if err != nil { + setupLog.Error(err, "error creating client to the cluster") + os.Exit(1) + } + + lifecycleHandler := lifecycle.Handler{Client: c} + webhookServer, err := server.NewServer(server.Options{ Catalog: catalog, Port: webhookPort, @@ -105,25 +120,89 @@ func main() { os.Exit(1) } + // Mutation Hooks topologyMutationHandler := topologymutation.NewHandler(scheme) if err := webhookServer.AddExtensionHandler(server.ExtensionHandler{ - Hook: runtimehooksv1.GeneratePatches, + Hook: runtimehooksv1alpha1.GeneratePatches, Name: "generate-patches", HandlerFunc: topologyMutationHandler.GeneratePatches, TimeoutSeconds: pointer.Int32(5), - FailurePolicy: toPtr(runtimehooksv1.FailurePolicyFail), + FailurePolicy: toPtr(runtimehooksv1alpha1.FailurePolicyFail), }); err != nil { setupLog.Error(err, "error adding handler") os.Exit(1) } if err := webhookServer.AddExtensionHandler(server.ExtensionHandler{ - Hook: runtimehooksv1.ValidateTopology, + Hook: runtimehooksv1alpha1.ValidateTopology, Name: "validate-topology", HandlerFunc: topologyMutationHandler.ValidateTopology, TimeoutSeconds: pointer.Int32(5), - FailurePolicy: toPtr(runtimehooksv1.FailurePolicyFail), + FailurePolicy: toPtr(runtimehooksv1alpha1.FailurePolicyFail), + }); err != nil { + setupLog.Error(err, "error adding handler") + os.Exit(1) + } + + // Lifecycle Hooks + if err := webhookServer.AddExtensionHandler(server.ExtensionHandler{ + Hook: runtimehooksv1alpha1.BeforeClusterCreate, + Name: "before-cluster-create", + HandlerFunc: lifecycleHandler.DoBeforeClusterCreate, + TimeoutSeconds: pointer.Int32(5), + FailurePolicy: toPtr(runtimehooksv1alpha1.FailurePolicyFail), + }); err != nil { + setupLog.Error(err, "error adding handler") + os.Exit(1) + } + if err := webhookServer.AddExtensionHandler(server.ExtensionHandler{ + Hook: runtimehooksv1alpha1.AfterControlPlaneInitialized, + Name: "after-control-plane-initialized", + HandlerFunc: lifecycleHandler.DoAfterControlPlaneInitialized, + TimeoutSeconds: pointer.Int32(5), + FailurePolicy: toPtr(runtimehooksv1alpha1.FailurePolicyFail), + }); err != nil { + setupLog.Error(err, "error adding handler") + os.Exit(1) + } + if err := webhookServer.AddExtensionHandler(server.ExtensionHandler{ + Hook: runtimehooksv1alpha1.BeforeClusterUpgrade, + Name: "before-cluster-upgrade", + HandlerFunc: lifecycleHandler.DoBeforeClusterUpgrade, + TimeoutSeconds: pointer.Int32(5), + FailurePolicy: toPtr(runtimehooksv1alpha1.FailurePolicyFail), + }); err != nil { + setupLog.Error(err, "error adding handler") + os.Exit(1) + } + + if err := webhookServer.AddExtensionHandler(server.ExtensionHandler{ + Hook: runtimehooksv1alpha1.AfterControlPlaneUpgrade, + Name: "after-control-plane-upgrade", + HandlerFunc: lifecycleHandler.DoAfterControlPlaneUpgrade, + TimeoutSeconds: pointer.Int32(5), + FailurePolicy: toPtr(runtimehooksv1alpha1.FailurePolicyFail), + }); err != nil { + setupLog.Error(err, "error adding handler") + os.Exit(1) + } + if err := webhookServer.AddExtensionHandler(server.ExtensionHandler{ + Hook: runtimehooksv1alpha1.AfterClusterUpgrade, + Name: "after-cluster-upgrade", + HandlerFunc: lifecycleHandler.DoAfterClusterUpgrade, + TimeoutSeconds: pointer.Int32(5), + FailurePolicy: toPtr(runtimehooksv1alpha1.FailurePolicyFail), + }); err != nil { + setupLog.Error(err, "error adding handler") + os.Exit(1) + } + if err := webhookServer.AddExtensionHandler(server.ExtensionHandler{ + Hook: runtimehooksv1alpha1.BeforeClusterDelete, + Name: "before-cluster-delete", + HandlerFunc: lifecycleHandler.DoBeforeClusterDelete, + TimeoutSeconds: pointer.Int32(5), + FailurePolicy: toPtr(runtimehooksv1alpha1.FailurePolicyFail), }); err != nil { setupLog.Error(err, "error adding handler") os.Exit(1) @@ -136,6 +215,6 @@ func main() { } } -func toPtr(f runtimehooksv1.FailurePolicy) *runtimehooksv1.FailurePolicy { +func toPtr(f runtimehooksv1alpha1.FailurePolicy) *runtimehooksv1alpha1.FailurePolicy { return &f } diff --git a/test/extension/server/server.go b/test/extension/server/server.go index 3c4c5e397ea3..99807968a1de 100644 --- a/test/extension/server/server.go +++ b/test/extension/server/server.go @@ -33,7 +33,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/webhook" - runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" + runtimehooksv1alpha1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" runtimecatalog "sigs.k8s.io/cluster-api/internal/runtime/catalog" ) @@ -121,7 +121,7 @@ type ExtensionHandler struct { TimeoutSeconds *int32 // FailurePolicy is the failure policy of the extension handler - FailurePolicy *runtimehooksv1.FailurePolicy + FailurePolicy *runtimehooksv1alpha1.FailurePolicy } // AddExtensionHandler adds an extension handler to the server. @@ -210,7 +210,7 @@ func (s *Server) validateHandler(handler ExtensionHandler) error { func (s *Server) Start(ctx context.Context) error { // Add discovery handler. err := s.AddExtensionHandler(ExtensionHandler{ - Hook: runtimehooksv1.Discovery, + Hook: runtimehooksv1alpha1.Discovery, HandlerFunc: discoveryHandler(s.handlers), }) if err != nil { @@ -229,12 +229,12 @@ func (s *Server) Start(ctx context.Context) error { } // discoveryHandler generates a discovery handler based on a list of handlers. -func discoveryHandler(handlers map[string]ExtensionHandler) func(context.Context, *runtimehooksv1.DiscoveryRequest, *runtimehooksv1.DiscoveryResponse) { - cachedHandlers := []runtimehooksv1.ExtensionHandler{} +func discoveryHandler(handlers map[string]ExtensionHandler) func(context.Context, *runtimehooksv1alpha1.DiscoveryRequest, *runtimehooksv1alpha1.DiscoveryResponse) { + cachedHandlers := []runtimehooksv1alpha1.ExtensionHandler{} for _, handler := range handlers { - cachedHandlers = append(cachedHandlers, runtimehooksv1.ExtensionHandler{ + cachedHandlers = append(cachedHandlers, runtimehooksv1alpha1.ExtensionHandler{ Name: handler.Name, - RequestHook: runtimehooksv1.GroupVersionHook{ + RequestHook: runtimehooksv1alpha1.GroupVersionHook{ APIVersion: handler.gvh.GroupVersion().String(), Hook: handler.gvh.Hook, }, @@ -243,8 +243,8 @@ func discoveryHandler(handlers map[string]ExtensionHandler) func(context.Context }) } - return func(_ context.Context, _ *runtimehooksv1.DiscoveryRequest, response *runtimehooksv1.DiscoveryResponse) { - response.SetStatus(runtimehooksv1.ResponseStatusSuccess) + return func(_ context.Context, _ *runtimehooksv1alpha1.DiscoveryRequest, response *runtimehooksv1alpha1.DiscoveryResponse) { + response.SetStatus(runtimehooksv1alpha1.ResponseStatusSuccess) response.Handlers = cachedHandlers } } @@ -265,19 +265,19 @@ func (s *Server) wrapHandler(handler ExtensionHandler) func(w http.ResponseWrite } } -func (s *Server) callHandler(handler ExtensionHandler, r *http.Request) runtimehooksv1.ResponseObject { +func (s *Server) callHandler(handler ExtensionHandler, r *http.Request) runtimehooksv1alpha1.ResponseObject { request := handler.requestObject.DeepCopyObject() - response := handler.responseObject.DeepCopyObject().(runtimehooksv1.ResponseObject) + response := handler.responseObject.DeepCopyObject().(runtimehooksv1alpha1.ResponseObject) requestBody, err := io.ReadAll(r.Body) if err != nil { - response.SetStatus(runtimehooksv1.ResponseStatusFailure) + response.SetStatus(runtimehooksv1alpha1.ResponseStatusFailure) response.SetMessage(fmt.Sprintf("error reading request: %v", err)) return response } if err := json.Unmarshal(requestBody, request); err != nil { - response.SetStatus(runtimehooksv1.ResponseStatusFailure) + response.SetStatus(runtimehooksv1alpha1.ResponseStatusFailure) response.SetMessage(fmt.Sprintf("error unmarshalling request: %v", err)) return response }