From f6485cad8e6a1365d2f4f7ae0af8e40cbfc5b512 Mon Sep 17 00:00:00 2001 From: Christian Schlotter Date: Tue, 13 May 2025 11:26:53 +0200 Subject: [PATCH 01/13] Introduce ExtensionConfig v1beta2 --- Makefile | 6 + ...ime.cluster.x-k8s.io_extensionconfigs.yaml | 341 +++++++++++++++++ config/crd/kustomization.yaml | 1 + .../patches/webhook_in_extensionconfigs.yaml | 16 + config/default/kustomization.yaml | 4 - exp/runtime/api/v1alpha1/conversion.go | 35 ++ exp/runtime/api/v1alpha1/conversion_test.go | 43 +++ exp/runtime/api/v1alpha1/doc.go | 1 + .../api/v1alpha1/extensionconfig_types.go | 1 - exp/runtime/api/v1alpha1/groupversion_info.go | 3 + .../api/v1alpha1/zz_generated.conversion.go | 360 ++++++++++++++++++ exp/runtime/api/v1beta2/.import-restrictions | 5 + exp/runtime/api/v1beta2/conversion.go | 19 + exp/runtime/api/v1beta2/doc.go | 18 + .../api/v1beta2/extensionconfig_types.go | 301 +++++++++++++++ exp/runtime/api/v1beta2/groupversion_info.go | 45 +++ .../api/v1beta2/zz_generated.deepcopy.go | 266 +++++++++++++ main.go | 4 +- 18 files changed, 1463 insertions(+), 6 deletions(-) create mode 100644 config/crd/patches/webhook_in_extensionconfigs.yaml create mode 100644 exp/runtime/api/v1alpha1/conversion.go create mode 100644 exp/runtime/api/v1alpha1/conversion_test.go create mode 100644 exp/runtime/api/v1alpha1/zz_generated.conversion.go create mode 100644 exp/runtime/api/v1beta2/.import-restrictions create mode 100644 exp/runtime/api/v1beta2/conversion.go create mode 100644 exp/runtime/api/v1beta2/doc.go create mode 100644 exp/runtime/api/v1beta2/extensionconfig_types.go create mode 100644 exp/runtime/api/v1beta2/groupversion_info.go create mode 100644 exp/runtime/api/v1beta2/zz_generated.deepcopy.go diff --git a/Makefile b/Makefile index a65d8051a937..ac21ff89cc12 100644 --- a/Makefile +++ b/Makefile @@ -494,6 +494,12 @@ generate-go-conversions-core-runtime: $(CONVERSION_GEN) ## Generate conversions --go-header-file=./hack/boilerplate/boilerplate.generatego.txt \ ./internal/runtime/test/v1alpha1 \ ./internal/runtime/test/v1alpha2 + $(MAKE) clean-generated-conversions SRC_DIRS="./$(EXP_DIR)/runtime/api/v1alpha1,./$(EXP_DIR)/runtime/api/v1beta2" + $(CONVERSION_GEN) \ + --output-file=zz_generated.conversion.go \ + --go-header-file=./hack/boilerplate/boilerplate.generatego.txt \ + ./$(EXP_DIR)/runtime/api/v1alpha1 \ + ./$(EXP_DIR)/runtime/api/v1beta2 .PHONY: generate-go-conversions-kubeadm-bootstrap generate-go-conversions-kubeadm-bootstrap: $(CONVERSION_GEN) ## Generate conversions go code for kubeadm bootstrap diff --git a/config/crd/bases/runtime.cluster.x-k8s.io_extensionconfigs.yaml b/config/crd/bases/runtime.cluster.x-k8s.io_extensionconfigs.yaml index 4fae4f2ebc88..7c2796c15908 100644 --- a/config/crd/bases/runtime.cluster.x-k8s.io_extensionconfigs.yaml +++ b/config/crd/bases/runtime.cluster.x-k8s.io_extensionconfigs.yaml @@ -356,6 +356,347 @@ spec: type: object type: object served: true + storage: false + subresources: + status: {} + - additionalPrinterColumns: + - description: Time duration since creation of ExtensionConfig + jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1beta2 + schema: + openAPIV3Schema: + description: ExtensionConfig is the Schema for the ExtensionConfig API. + properties: + apiVersion: + 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 + kind: + 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 + metadata: + type: object + spec: + description: spec is the desired state of the ExtensionConfig. + properties: + clientConfig: + description: clientConfig defines how to communicate with the Extension + server. + properties: + caBundle: + description: caBundle is a PEM encoded CA bundle which will be + used to validate the Extension server's server certificate. + format: byte + maxLength: 51200 + minLength: 1 + type: string + service: + description: |- + service is a reference to the Kubernetes service for the Extension server. + Note: Exactly one of `url` or `service` must be specified. + + If the Extension server is running within a cluster, then you should use `service`. + properties: + name: + description: name is the name of the service. + maxLength: 63 + minLength: 1 + type: string + namespace: + description: namespace is the namespace of the service. + maxLength: 63 + minLength: 1 + type: string + path: + description: |- + path is an optional URL path and if present may be any string permissible in + a URL. If a path is set it will be used as prefix to the hook-specific path. + maxLength: 512 + minLength: 1 + type: string + port: + description: |- + port is the port on the service that's hosting the Extension server. + Defaults to 443. + Port should be a valid port number (1-65535, inclusive). + format: int32 + type: integer + required: + - name + - namespace + type: object + url: + description: |- + url gives the location of the Extension server, in standard URL form + (`scheme://host:port/path`). + Note: Exactly one of `url` or `service` must be specified. + + The scheme must be "https". + + The `host` should not refer to a service running in the cluster; use + the `service` field instead. + + A path is optional, and if present may be any string permissible in + a URL. If a path is set it will be used as prefix to the hook-specific path. + + Attempting to use a user or basic auth e.g. "user:password@" is not + allowed. Fragments ("#...") and query parameters ("?...") are not + allowed either. + maxLength: 512 + minLength: 1 + type: string + type: object + namespaceSelector: + description: |- + namespaceSelector decides whether to call the hook for an object based + on whether the namespace for that object matches the selector. + Defaults to the empty LabelSelector, which matches all objects. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. + The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector applies + to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + settings: + additionalProperties: + type: string + description: |- + settings defines key value pairs to be passed to all calls + to all supported RuntimeExtensions. + Note: Settings can be overridden on the ClusterClass. + type: object + required: + - clientConfig + type: object + status: + description: status is the current state of the ExtensionConfig + properties: + conditions: + description: conditions define the current service state of the ExtensionConfig. + items: + description: Condition defines an observation of a Cluster API resource + operational state. + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when + the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This field may be empty. + maxLength: 10240 + minLength: 1 + type: string + reason: + description: |- + reason is the reason for the condition's last transition in CamelCase. + The specific API may choose whether or not this field is considered a guaranteed API. + This field may be empty. + maxLength: 256 + minLength: 1 + type: string + severity: + description: |- + severity provides an explicit classification of Reason code, so the users or machines can immediately + understand the current situation and act accordingly. + The Severity field MUST be set only when Status=False. + maxLength: 32 + type: string + status: + description: status of the condition, one of True, False, Unknown. + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions + can be useful (see .node.status.conditions), the ability to deconflict is important. + maxLength: 256 + minLength: 1 + type: string + required: + - lastTransitionTime + - status + - type + type: object + type: array + handlers: + description: handlers defines the current ExtensionHandlers supported + by an Extension. + items: + description: ExtensionHandler specifies the details of a handler + for a particular runtime hook registered by an Extension server. + properties: + failurePolicy: + description: |- + failurePolicy defines how failures in calls to the ExtensionHandler should be handled by a client. + Defaults to Fail if not set. + enum: + - Ignore + - Fail + type: string + name: + description: name is the unique name of the ExtensionHandler. + maxLength: 512 + minLength: 1 + type: string + requestHook: + description: requestHook defines the versioned runtime hook + which this ExtensionHandler serves. + properties: + apiVersion: + description: apiVersion is the group and version of the + Hook. + maxLength: 512 + minLength: 1 + type: string + hook: + description: hook is the name of the hook. + maxLength: 256 + minLength: 1 + type: string + required: + - apiVersion + - hook + type: object + timeoutSeconds: + description: |- + timeoutSeconds defines the timeout duration for client calls to the ExtensionHandler. + Defaults to 10 is not set. + format: int32 + type: integer + required: + - name + - requestHook + type: object + maxItems: 512 + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + v1beta2: + description: v1beta2 groups all the fields that will be added or modified + in ExtensionConfig's status with the V1Beta2 version. + properties: + conditions: + description: |- + conditions represents the observations of a ExtensionConfig's current state. + Known condition types are Discovered, Paused. + items: + description: Condition contains details for one aspect of the + current state of this API Resource. + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, + Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + maxItems: 32 + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + type: object + served: true storage: true subresources: status: {} diff --git a/config/crd/kustomization.yaml b/config/crd/kustomization.yaml index 49b91562584a..29940577a2b3 100644 --- a/config/crd/kustomization.yaml +++ b/config/crd/kustomization.yaml @@ -32,6 +32,7 @@ patches: - path: patches/webhook_in_clusterresourcesetbindings.yaml - path: patches/webhook_in_ipaddresses.yaml - path: patches/webhook_in_ipaddressclaims.yaml +- path: patches/webhook_in_extensionconfigs.yaml # +kubebuilder:scaffold:crdkustomizewebhookpatch # the following config is for teaching kustomize how to do kustomization for CRDs. diff --git a/config/crd/patches/webhook_in_extensionconfigs.yaml b/config/crd/patches/webhook_in_extensionconfigs.yaml new file mode 100644 index 000000000000..74ba33f0f13a --- /dev/null +++ b/config/crd/patches/webhook_in_extensionconfigs.yaml @@ -0,0 +1,16 @@ +# The following patch enables conversion webhook for CRD +# CRD conversion requires k8s 1.13 or later. +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: extensionconfigs.runtime.cluster.x-k8s.io +spec: + conversion: + strategy: Webhook + webhook: + conversionReviewVersions: ["v1", "v1beta1"] + clientConfig: + service: + namespace: system + name: webhook-service + path: /convert diff --git a/config/default/kustomization.yaml b/config/default/kustomization.yaml index dce17953de8f..09367f8194b9 100644 --- a/config/default/kustomization.yaml +++ b/config/default/kustomization.yaml @@ -57,8 +57,6 @@ replacements: delimiter: / select: kind: CustomResourceDefinition - reject: - - name: extensionconfigs.runtime.cluster.x-k8s.io - source: fieldPath: .metadata.name group: cert-manager.io @@ -90,8 +88,6 @@ replacements: index: 1 select: kind: CustomResourceDefinition - reject: - - name: extensionconfigs.runtime.cluster.x-k8s.io - source: fieldPath: .metadata.name kind: Service diff --git a/exp/runtime/api/v1alpha1/conversion.go b/exp/runtime/api/v1alpha1/conversion.go new file mode 100644 index 000000000000..e48be732558e --- /dev/null +++ b/exp/runtime/api/v1alpha1/conversion.go @@ -0,0 +1,35 @@ +/* +Copyright 2025 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 ( + "sigs.k8s.io/controller-runtime/pkg/conversion" + + runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2" +) + +func (src *ExtensionConfig) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*runtimev1.ExtensionConfig) + + return Convert_v1alpha1_ExtensionConfig_To_v1beta2_ExtensionConfig(src, dst, nil) +} + +func (dst *ExtensionConfig) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*runtimev1.ExtensionConfig) + + return Convert_v1beta2_ExtensionConfig_To_v1alpha1_ExtensionConfig(src, dst, nil) +} diff --git a/exp/runtime/api/v1alpha1/conversion_test.go b/exp/runtime/api/v1alpha1/conversion_test.go new file mode 100644 index 000000000000..ed2fe27f322c --- /dev/null +++ b/exp/runtime/api/v1alpha1/conversion_test.go @@ -0,0 +1,43 @@ +//go:build !race + +/* +Copyright 2025 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 ( + "testing" + + "k8s.io/apimachinery/pkg/api/apitesting/fuzzer" + runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer" + + runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2" + utilconversion "sigs.k8s.io/cluster-api/util/conversion" +) + +// Test is disabled when the race detector is enabled (via "//go:build !race" above) because otherwise the fuzz tests would just time out. + +func TestFuzzyConversion(t *testing.T) { + t.Run("for ExtensionConfig", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ + Hub: &runtimev1.ExtensionConfig{}, + Spoke: &ExtensionConfig{}, + FuzzerFuncs: []fuzzer.FuzzerFuncs{ExtensionConfigFuzzFuncs}, + })) +} + +func ExtensionConfigFuzzFuncs(_ runtimeserializer.CodecFactory) []interface{} { + return []interface{}{} +} diff --git a/exp/runtime/api/v1alpha1/doc.go b/exp/runtime/api/v1alpha1/doc.go index d7778dadc9ba..b2a519fa274e 100644 --- a/exp/runtime/api/v1alpha1/doc.go +++ b/exp/runtime/api/v1alpha1/doc.go @@ -15,4 +15,5 @@ limitations under the License. */ // Package v1alpha1 contains the v1alpha1 implementation of ExtensionConfig. +// +k8s:conversion-gen=sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2 package v1alpha1 diff --git a/exp/runtime/api/v1alpha1/extensionconfig_types.go b/exp/runtime/api/v1alpha1/extensionconfig_types.go index 87de848ae3c8..6388cbd2528f 100644 --- a/exp/runtime/api/v1alpha1/extensionconfig_types.go +++ b/exp/runtime/api/v1alpha1/extensionconfig_types.go @@ -203,7 +203,6 @@ const ( // +kubebuilder:object:root=true // +kubebuilder:resource:path=extensionconfigs,shortName=ext,scope=Cluster,categories=cluster-api // +kubebuilder:subresource:status -// +kubebuilder:storageversion // +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time duration since creation of ExtensionConfig" // ExtensionConfig is the Schema for the ExtensionConfig API. diff --git a/exp/runtime/api/v1alpha1/groupversion_info.go b/exp/runtime/api/v1alpha1/groupversion_info.go index 856a1ef0bd79..25f27d0e8869 100644 --- a/exp/runtime/api/v1alpha1/groupversion_info.go +++ b/exp/runtime/api/v1alpha1/groupversion_info.go @@ -35,6 +35,9 @@ var ( // AddToScheme adds the types in this group-version to the given scheme. AddToScheme = schemeBuilder.AddToScheme + // localSchemeBuilder is used for type conversions. + localSchemeBuilder = schemeBuilder + objectTypes = []runtime.Object{} ) diff --git a/exp/runtime/api/v1alpha1/zz_generated.conversion.go b/exp/runtime/api/v1alpha1/zz_generated.conversion.go new file mode 100644 index 000000000000..3af06300d6fc --- /dev/null +++ b/exp/runtime/api/v1alpha1/zz_generated.conversion.go @@ -0,0 +1,360 @@ +//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 conversion-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + unsafe "unsafe" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" + apiv1beta2 "sigs.k8s.io/cluster-api/api/v1beta2" + v1beta2 "sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2" +) + +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((*ClientConfig)(nil), (*v1beta2.ClientConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ClientConfig_To_v1beta2_ClientConfig(a.(*ClientConfig), b.(*v1beta2.ClientConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.ClientConfig)(nil), (*ClientConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_ClientConfig_To_v1alpha1_ClientConfig(a.(*v1beta2.ClientConfig), b.(*ClientConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ExtensionConfig)(nil), (*v1beta2.ExtensionConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ExtensionConfig_To_v1beta2_ExtensionConfig(a.(*ExtensionConfig), b.(*v1beta2.ExtensionConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.ExtensionConfig)(nil), (*ExtensionConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_ExtensionConfig_To_v1alpha1_ExtensionConfig(a.(*v1beta2.ExtensionConfig), b.(*ExtensionConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ExtensionConfigList)(nil), (*v1beta2.ExtensionConfigList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ExtensionConfigList_To_v1beta2_ExtensionConfigList(a.(*ExtensionConfigList), b.(*v1beta2.ExtensionConfigList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.ExtensionConfigList)(nil), (*ExtensionConfigList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_ExtensionConfigList_To_v1alpha1_ExtensionConfigList(a.(*v1beta2.ExtensionConfigList), b.(*ExtensionConfigList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ExtensionConfigSpec)(nil), (*v1beta2.ExtensionConfigSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ExtensionConfigSpec_To_v1beta2_ExtensionConfigSpec(a.(*ExtensionConfigSpec), b.(*v1beta2.ExtensionConfigSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.ExtensionConfigSpec)(nil), (*ExtensionConfigSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_ExtensionConfigSpec_To_v1alpha1_ExtensionConfigSpec(a.(*v1beta2.ExtensionConfigSpec), b.(*ExtensionConfigSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ExtensionConfigStatus)(nil), (*v1beta2.ExtensionConfigStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ExtensionConfigStatus_To_v1beta2_ExtensionConfigStatus(a.(*ExtensionConfigStatus), b.(*v1beta2.ExtensionConfigStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.ExtensionConfigStatus)(nil), (*ExtensionConfigStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_ExtensionConfigStatus_To_v1alpha1_ExtensionConfigStatus(a.(*v1beta2.ExtensionConfigStatus), b.(*ExtensionConfigStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ExtensionConfigV1Beta2Status)(nil), (*v1beta2.ExtensionConfigV1Beta2Status)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ExtensionConfigV1Beta2Status_To_v1beta2_ExtensionConfigV1Beta2Status(a.(*ExtensionConfigV1Beta2Status), b.(*v1beta2.ExtensionConfigV1Beta2Status), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.ExtensionConfigV1Beta2Status)(nil), (*ExtensionConfigV1Beta2Status)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_ExtensionConfigV1Beta2Status_To_v1alpha1_ExtensionConfigV1Beta2Status(a.(*v1beta2.ExtensionConfigV1Beta2Status), b.(*ExtensionConfigV1Beta2Status), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ExtensionHandler)(nil), (*v1beta2.ExtensionHandler)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ExtensionHandler_To_v1beta2_ExtensionHandler(a.(*ExtensionHandler), b.(*v1beta2.ExtensionHandler), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.ExtensionHandler)(nil), (*ExtensionHandler)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_ExtensionHandler_To_v1alpha1_ExtensionHandler(a.(*v1beta2.ExtensionHandler), b.(*ExtensionHandler), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*GroupVersionHook)(nil), (*v1beta2.GroupVersionHook)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_GroupVersionHook_To_v1beta2_GroupVersionHook(a.(*GroupVersionHook), b.(*v1beta2.GroupVersionHook), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.GroupVersionHook)(nil), (*GroupVersionHook)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_GroupVersionHook_To_v1alpha1_GroupVersionHook(a.(*v1beta2.GroupVersionHook), b.(*GroupVersionHook), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ServiceReference)(nil), (*v1beta2.ServiceReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ServiceReference_To_v1beta2_ServiceReference(a.(*ServiceReference), b.(*v1beta2.ServiceReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.ServiceReference)(nil), (*ServiceReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_ServiceReference_To_v1alpha1_ServiceReference(a.(*v1beta2.ServiceReference), b.(*ServiceReference), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1alpha1_ClientConfig_To_v1beta2_ClientConfig(in *ClientConfig, out *v1beta2.ClientConfig, s conversion.Scope) error { + out.URL = (*string)(unsafe.Pointer(in.URL)) + out.Service = (*v1beta2.ServiceReference)(unsafe.Pointer(in.Service)) + out.CABundle = *(*[]byte)(unsafe.Pointer(&in.CABundle)) + return nil +} + +// Convert_v1alpha1_ClientConfig_To_v1beta2_ClientConfig is an autogenerated conversion function. +func Convert_v1alpha1_ClientConfig_To_v1beta2_ClientConfig(in *ClientConfig, out *v1beta2.ClientConfig, s conversion.Scope) error { + return autoConvert_v1alpha1_ClientConfig_To_v1beta2_ClientConfig(in, out, s) +} + +func autoConvert_v1beta2_ClientConfig_To_v1alpha1_ClientConfig(in *v1beta2.ClientConfig, out *ClientConfig, s conversion.Scope) error { + out.URL = (*string)(unsafe.Pointer(in.URL)) + out.Service = (*ServiceReference)(unsafe.Pointer(in.Service)) + out.CABundle = *(*[]byte)(unsafe.Pointer(&in.CABundle)) + return nil +} + +// Convert_v1beta2_ClientConfig_To_v1alpha1_ClientConfig is an autogenerated conversion function. +func Convert_v1beta2_ClientConfig_To_v1alpha1_ClientConfig(in *v1beta2.ClientConfig, out *ClientConfig, s conversion.Scope) error { + return autoConvert_v1beta2_ClientConfig_To_v1alpha1_ClientConfig(in, out, s) +} + +func autoConvert_v1alpha1_ExtensionConfig_To_v1beta2_ExtensionConfig(in *ExtensionConfig, out *v1beta2.ExtensionConfig, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_ExtensionConfigSpec_To_v1beta2_ExtensionConfigSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_ExtensionConfigStatus_To_v1beta2_ExtensionConfigStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_ExtensionConfig_To_v1beta2_ExtensionConfig is an autogenerated conversion function. +func Convert_v1alpha1_ExtensionConfig_To_v1beta2_ExtensionConfig(in *ExtensionConfig, out *v1beta2.ExtensionConfig, s conversion.Scope) error { + return autoConvert_v1alpha1_ExtensionConfig_To_v1beta2_ExtensionConfig(in, out, s) +} + +func autoConvert_v1beta2_ExtensionConfig_To_v1alpha1_ExtensionConfig(in *v1beta2.ExtensionConfig, out *ExtensionConfig, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1beta2_ExtensionConfigSpec_To_v1alpha1_ExtensionConfigSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1beta2_ExtensionConfigStatus_To_v1alpha1_ExtensionConfigStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta2_ExtensionConfig_To_v1alpha1_ExtensionConfig is an autogenerated conversion function. +func Convert_v1beta2_ExtensionConfig_To_v1alpha1_ExtensionConfig(in *v1beta2.ExtensionConfig, out *ExtensionConfig, s conversion.Scope) error { + return autoConvert_v1beta2_ExtensionConfig_To_v1alpha1_ExtensionConfig(in, out, s) +} + +func autoConvert_v1alpha1_ExtensionConfigList_To_v1beta2_ExtensionConfigList(in *ExtensionConfigList, out *v1beta2.ExtensionConfigList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]v1beta2.ExtensionConfig)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha1_ExtensionConfigList_To_v1beta2_ExtensionConfigList is an autogenerated conversion function. +func Convert_v1alpha1_ExtensionConfigList_To_v1beta2_ExtensionConfigList(in *ExtensionConfigList, out *v1beta2.ExtensionConfigList, s conversion.Scope) error { + return autoConvert_v1alpha1_ExtensionConfigList_To_v1beta2_ExtensionConfigList(in, out, s) +} + +func autoConvert_v1beta2_ExtensionConfigList_To_v1alpha1_ExtensionConfigList(in *v1beta2.ExtensionConfigList, out *ExtensionConfigList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]ExtensionConfig)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1beta2_ExtensionConfigList_To_v1alpha1_ExtensionConfigList is an autogenerated conversion function. +func Convert_v1beta2_ExtensionConfigList_To_v1alpha1_ExtensionConfigList(in *v1beta2.ExtensionConfigList, out *ExtensionConfigList, s conversion.Scope) error { + return autoConvert_v1beta2_ExtensionConfigList_To_v1alpha1_ExtensionConfigList(in, out, s) +} + +func autoConvert_v1alpha1_ExtensionConfigSpec_To_v1beta2_ExtensionConfigSpec(in *ExtensionConfigSpec, out *v1beta2.ExtensionConfigSpec, s conversion.Scope) error { + if err := Convert_v1alpha1_ClientConfig_To_v1beta2_ClientConfig(&in.ClientConfig, &out.ClientConfig, s); err != nil { + return err + } + out.NamespaceSelector = (*v1.LabelSelector)(unsafe.Pointer(in.NamespaceSelector)) + out.Settings = *(*map[string]string)(unsafe.Pointer(&in.Settings)) + return nil +} + +// Convert_v1alpha1_ExtensionConfigSpec_To_v1beta2_ExtensionConfigSpec is an autogenerated conversion function. +func Convert_v1alpha1_ExtensionConfigSpec_To_v1beta2_ExtensionConfigSpec(in *ExtensionConfigSpec, out *v1beta2.ExtensionConfigSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_ExtensionConfigSpec_To_v1beta2_ExtensionConfigSpec(in, out, s) +} + +func autoConvert_v1beta2_ExtensionConfigSpec_To_v1alpha1_ExtensionConfigSpec(in *v1beta2.ExtensionConfigSpec, out *ExtensionConfigSpec, s conversion.Scope) error { + if err := Convert_v1beta2_ClientConfig_To_v1alpha1_ClientConfig(&in.ClientConfig, &out.ClientConfig, s); err != nil { + return err + } + out.NamespaceSelector = (*v1.LabelSelector)(unsafe.Pointer(in.NamespaceSelector)) + out.Settings = *(*map[string]string)(unsafe.Pointer(&in.Settings)) + return nil +} + +// Convert_v1beta2_ExtensionConfigSpec_To_v1alpha1_ExtensionConfigSpec is an autogenerated conversion function. +func Convert_v1beta2_ExtensionConfigSpec_To_v1alpha1_ExtensionConfigSpec(in *v1beta2.ExtensionConfigSpec, out *ExtensionConfigSpec, s conversion.Scope) error { + return autoConvert_v1beta2_ExtensionConfigSpec_To_v1alpha1_ExtensionConfigSpec(in, out, s) +} + +func autoConvert_v1alpha1_ExtensionConfigStatus_To_v1beta2_ExtensionConfigStatus(in *ExtensionConfigStatus, out *v1beta2.ExtensionConfigStatus, s conversion.Scope) error { + out.Handlers = *(*[]v1beta2.ExtensionHandler)(unsafe.Pointer(&in.Handlers)) + out.Conditions = *(*apiv1beta2.Conditions)(unsafe.Pointer(&in.Conditions)) + out.V1Beta2 = (*v1beta2.ExtensionConfigV1Beta2Status)(unsafe.Pointer(in.V1Beta2)) + return nil +} + +// Convert_v1alpha1_ExtensionConfigStatus_To_v1beta2_ExtensionConfigStatus is an autogenerated conversion function. +func Convert_v1alpha1_ExtensionConfigStatus_To_v1beta2_ExtensionConfigStatus(in *ExtensionConfigStatus, out *v1beta2.ExtensionConfigStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_ExtensionConfigStatus_To_v1beta2_ExtensionConfigStatus(in, out, s) +} + +func autoConvert_v1beta2_ExtensionConfigStatus_To_v1alpha1_ExtensionConfigStatus(in *v1beta2.ExtensionConfigStatus, out *ExtensionConfigStatus, s conversion.Scope) error { + out.Handlers = *(*[]ExtensionHandler)(unsafe.Pointer(&in.Handlers)) + out.Conditions = *(*apiv1beta2.Conditions)(unsafe.Pointer(&in.Conditions)) + out.V1Beta2 = (*ExtensionConfigV1Beta2Status)(unsafe.Pointer(in.V1Beta2)) + return nil +} + +// Convert_v1beta2_ExtensionConfigStatus_To_v1alpha1_ExtensionConfigStatus is an autogenerated conversion function. +func Convert_v1beta2_ExtensionConfigStatus_To_v1alpha1_ExtensionConfigStatus(in *v1beta2.ExtensionConfigStatus, out *ExtensionConfigStatus, s conversion.Scope) error { + return autoConvert_v1beta2_ExtensionConfigStatus_To_v1alpha1_ExtensionConfigStatus(in, out, s) +} + +func autoConvert_v1alpha1_ExtensionConfigV1Beta2Status_To_v1beta2_ExtensionConfigV1Beta2Status(in *ExtensionConfigV1Beta2Status, out *v1beta2.ExtensionConfigV1Beta2Status, s conversion.Scope) error { + out.Conditions = *(*[]v1.Condition)(unsafe.Pointer(&in.Conditions)) + return nil +} + +// Convert_v1alpha1_ExtensionConfigV1Beta2Status_To_v1beta2_ExtensionConfigV1Beta2Status is an autogenerated conversion function. +func Convert_v1alpha1_ExtensionConfigV1Beta2Status_To_v1beta2_ExtensionConfigV1Beta2Status(in *ExtensionConfigV1Beta2Status, out *v1beta2.ExtensionConfigV1Beta2Status, s conversion.Scope) error { + return autoConvert_v1alpha1_ExtensionConfigV1Beta2Status_To_v1beta2_ExtensionConfigV1Beta2Status(in, out, s) +} + +func autoConvert_v1beta2_ExtensionConfigV1Beta2Status_To_v1alpha1_ExtensionConfigV1Beta2Status(in *v1beta2.ExtensionConfigV1Beta2Status, out *ExtensionConfigV1Beta2Status, s conversion.Scope) error { + out.Conditions = *(*[]v1.Condition)(unsafe.Pointer(&in.Conditions)) + return nil +} + +// Convert_v1beta2_ExtensionConfigV1Beta2Status_To_v1alpha1_ExtensionConfigV1Beta2Status is an autogenerated conversion function. +func Convert_v1beta2_ExtensionConfigV1Beta2Status_To_v1alpha1_ExtensionConfigV1Beta2Status(in *v1beta2.ExtensionConfigV1Beta2Status, out *ExtensionConfigV1Beta2Status, s conversion.Scope) error { + return autoConvert_v1beta2_ExtensionConfigV1Beta2Status_To_v1alpha1_ExtensionConfigV1Beta2Status(in, out, s) +} + +func autoConvert_v1alpha1_ExtensionHandler_To_v1beta2_ExtensionHandler(in *ExtensionHandler, out *v1beta2.ExtensionHandler, s conversion.Scope) error { + out.Name = in.Name + if err := Convert_v1alpha1_GroupVersionHook_To_v1beta2_GroupVersionHook(&in.RequestHook, &out.RequestHook, s); err != nil { + return err + } + out.TimeoutSeconds = (*int32)(unsafe.Pointer(in.TimeoutSeconds)) + out.FailurePolicy = (*v1beta2.FailurePolicy)(unsafe.Pointer(in.FailurePolicy)) + return nil +} + +// Convert_v1alpha1_ExtensionHandler_To_v1beta2_ExtensionHandler is an autogenerated conversion function. +func Convert_v1alpha1_ExtensionHandler_To_v1beta2_ExtensionHandler(in *ExtensionHandler, out *v1beta2.ExtensionHandler, s conversion.Scope) error { + return autoConvert_v1alpha1_ExtensionHandler_To_v1beta2_ExtensionHandler(in, out, s) +} + +func autoConvert_v1beta2_ExtensionHandler_To_v1alpha1_ExtensionHandler(in *v1beta2.ExtensionHandler, out *ExtensionHandler, s conversion.Scope) error { + out.Name = in.Name + if err := Convert_v1beta2_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_v1beta2_ExtensionHandler_To_v1alpha1_ExtensionHandler is an autogenerated conversion function. +func Convert_v1beta2_ExtensionHandler_To_v1alpha1_ExtensionHandler(in *v1beta2.ExtensionHandler, out *ExtensionHandler, s conversion.Scope) error { + return autoConvert_v1beta2_ExtensionHandler_To_v1alpha1_ExtensionHandler(in, out, s) +} + +func autoConvert_v1alpha1_GroupVersionHook_To_v1beta2_GroupVersionHook(in *GroupVersionHook, out *v1beta2.GroupVersionHook, s conversion.Scope) error { + out.APIVersion = in.APIVersion + out.Hook = in.Hook + return nil +} + +// Convert_v1alpha1_GroupVersionHook_To_v1beta2_GroupVersionHook is an autogenerated conversion function. +func Convert_v1alpha1_GroupVersionHook_To_v1beta2_GroupVersionHook(in *GroupVersionHook, out *v1beta2.GroupVersionHook, s conversion.Scope) error { + return autoConvert_v1alpha1_GroupVersionHook_To_v1beta2_GroupVersionHook(in, out, s) +} + +func autoConvert_v1beta2_GroupVersionHook_To_v1alpha1_GroupVersionHook(in *v1beta2.GroupVersionHook, out *GroupVersionHook, s conversion.Scope) error { + out.APIVersion = in.APIVersion + out.Hook = in.Hook + return nil +} + +// Convert_v1beta2_GroupVersionHook_To_v1alpha1_GroupVersionHook is an autogenerated conversion function. +func Convert_v1beta2_GroupVersionHook_To_v1alpha1_GroupVersionHook(in *v1beta2.GroupVersionHook, out *GroupVersionHook, s conversion.Scope) error { + return autoConvert_v1beta2_GroupVersionHook_To_v1alpha1_GroupVersionHook(in, out, s) +} + +func autoConvert_v1alpha1_ServiceReference_To_v1beta2_ServiceReference(in *ServiceReference, out *v1beta2.ServiceReference, s conversion.Scope) error { + out.Namespace = in.Namespace + out.Name = in.Name + out.Path = (*string)(unsafe.Pointer(in.Path)) + out.Port = (*int32)(unsafe.Pointer(in.Port)) + return nil +} + +// Convert_v1alpha1_ServiceReference_To_v1beta2_ServiceReference is an autogenerated conversion function. +func Convert_v1alpha1_ServiceReference_To_v1beta2_ServiceReference(in *ServiceReference, out *v1beta2.ServiceReference, s conversion.Scope) error { + return autoConvert_v1alpha1_ServiceReference_To_v1beta2_ServiceReference(in, out, s) +} + +func autoConvert_v1beta2_ServiceReference_To_v1alpha1_ServiceReference(in *v1beta2.ServiceReference, out *ServiceReference, s conversion.Scope) error { + out.Namespace = in.Namespace + out.Name = in.Name + out.Path = (*string)(unsafe.Pointer(in.Path)) + out.Port = (*int32)(unsafe.Pointer(in.Port)) + return nil +} + +// Convert_v1beta2_ServiceReference_To_v1alpha1_ServiceReference is an autogenerated conversion function. +func Convert_v1beta2_ServiceReference_To_v1alpha1_ServiceReference(in *v1beta2.ServiceReference, out *ServiceReference, s conversion.Scope) error { + return autoConvert_v1beta2_ServiceReference_To_v1alpha1_ServiceReference(in, out, s) +} diff --git a/exp/runtime/api/v1beta2/.import-restrictions b/exp/runtime/api/v1beta2/.import-restrictions new file mode 100644 index 000000000000..a2e1dfd08133 --- /dev/null +++ b/exp/runtime/api/v1beta2/.import-restrictions @@ -0,0 +1,5 @@ +rules: + - selectorRegexp: sigs[.]k8s[.]io/controller-runtime + allowedPrefixes: [] + forbiddenPrefixes: + - "sigs.k8s.io/controller-runtime" diff --git a/exp/runtime/api/v1beta2/conversion.go b/exp/runtime/api/v1beta2/conversion.go new file mode 100644 index 000000000000..df9c0f8a8e6f --- /dev/null +++ b/exp/runtime/api/v1beta2/conversion.go @@ -0,0 +1,19 @@ +/* +Copyright 2025 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 v1beta2 + +func (*ExtensionConfig) Hub() {} diff --git a/exp/runtime/api/v1beta2/doc.go b/exp/runtime/api/v1beta2/doc.go new file mode 100644 index 000000000000..3daf4aa0e29b --- /dev/null +++ b/exp/runtime/api/v1beta2/doc.go @@ -0,0 +1,18 @@ +/* +Copyright 2025 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 v1beta2 contains the v1beta2 implementation of ExtensionConfig. +package v1beta2 diff --git a/exp/runtime/api/v1beta2/extensionconfig_types.go b/exp/runtime/api/v1beta2/extensionconfig_types.go new file mode 100644 index 000000000000..576b90536e7f --- /dev/null +++ b/exp/runtime/api/v1beta2/extensionconfig_types.go @@ -0,0 +1,301 @@ +/* +Copyright 2025 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 v1beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + clusterv1 "sigs.k8s.io/cluster-api/api/v1beta2" +) + +// ANCHOR: ExtensionConfigSpec + +// ExtensionConfigSpec defines the desired state of ExtensionConfig. +type ExtensionConfigSpec struct { + // clientConfig defines how to communicate with the Extension server. + // +required + ClientConfig ClientConfig `json:"clientConfig"` + + // namespaceSelector decides whether to call the hook for an object based + // on whether the namespace for that object matches the selector. + // Defaults to the empty LabelSelector, which matches all objects. + // +optional + NamespaceSelector *metav1.LabelSelector `json:"namespaceSelector,omitempty"` + + // settings defines key value pairs to be passed to all calls + // to all supported RuntimeExtensions. + // Note: Settings can be overridden on the ClusterClass. + // +optional + Settings map[string]string `json:"settings,omitempty"` +} + +// ClientConfig contains the information to make a client +// connection with an Extension server. +type ClientConfig struct { + // url gives the location of the Extension server, in standard URL form + // (`scheme://host:port/path`). + // Note: Exactly one of `url` or `service` must be specified. + // + // The scheme must be "https". + // + // The `host` should not refer to a service running in the cluster; use + // the `service` field instead. + // + // A path is optional, and if present may be any string permissible in + // a URL. If a path is set it will be used as prefix to the hook-specific path. + // + // Attempting to use a user or basic auth e.g. "user:password@" is not + // allowed. Fragments ("#...") and query parameters ("?...") are not + // allowed either. + // + // +optional + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:MaxLength=512 + URL *string `json:"url,omitempty"` + + // service is a reference to the Kubernetes service for the Extension server. + // Note: Exactly one of `url` or `service` must be specified. + // + // If the Extension server is running within a cluster, then you should use `service`. + // + // +optional + Service *ServiceReference `json:"service,omitempty"` + + // caBundle is a PEM encoded CA bundle which will be used to validate the Extension server's server certificate. + // +optional + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:MaxLength=51200 + CABundle []byte `json:"caBundle,omitempty"` +} + +// ServiceReference holds a reference to a Kubernetes Service of an Extension server. +type ServiceReference struct { + // namespace is the namespace of the service. + // +required + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:MaxLength=63 + Namespace string `json:"namespace"` + + // name is the name of the service. + // +required + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:MaxLength=63 + Name string `json:"name"` + + // path is an optional URL path and if present may be any string permissible in + // a URL. If a path is set it will be used as prefix to the hook-specific path. + // +optional + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:MaxLength=512 + Path *string `json:"path,omitempty"` + + // port is the port on the service that's hosting the Extension server. + // Defaults to 443. + // Port should be a valid port number (1-65535, inclusive). + // +optional + Port *int32 `json:"port,omitempty"` +} + +// ANCHOR_END: ExtensionConfigSpec + +// ANCHOR: ExtensionConfigStatus + +// ExtensionConfigStatus defines the observed state of ExtensionConfig. +type ExtensionConfigStatus struct { + // handlers defines the current ExtensionHandlers supported by an Extension. + // +optional + // +listType=map + // +listMapKey=name + // +kubebuilder:validation:MaxItems=512 + Handlers []ExtensionHandler `json:"handlers,omitempty"` + + // conditions define the current service state of the ExtensionConfig. + // +optional + Conditions clusterv1.Conditions `json:"conditions,omitempty"` + + // v1beta2 groups all the fields that will be added or modified in ExtensionConfig's status with the V1Beta2 version. + // +optional + V1Beta2 *ExtensionConfigV1Beta2Status `json:"v1beta2,omitempty"` +} + +// ExtensionConfigV1Beta2Status groups all the fields that will be added or modified in ExtensionConfig with the V1Beta2 version. +// See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context. +type ExtensionConfigV1Beta2Status struct { + // conditions represents the observations of a ExtensionConfig's current state. + // Known condition types are Discovered, Paused. + // +optional + // +listType=map + // +listMapKey=type + // +kubebuilder:validation:MaxItems=32 + Conditions []metav1.Condition `json:"conditions,omitempty"` +} + +// ExtensionHandler specifies the details of a handler for a particular runtime hook registered by an Extension server. +type ExtensionHandler struct { + // name is the unique name of the ExtensionHandler. + // +required + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:MaxLength=512 + Name string `json:"name"` + + // requestHook defines the versioned runtime hook which this ExtensionHandler serves. + // +required + RequestHook GroupVersionHook `json:"requestHook"` + + // timeoutSeconds defines the timeout duration for client calls to the ExtensionHandler. + // Defaults to 10 is not set. + // +optional + TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"` + + // failurePolicy defines how failures in calls to the ExtensionHandler should be handled by a client. + // Defaults to Fail if not set. + // +optional + // +kubebuilder:validation:Enum=Ignore;Fail + FailurePolicy *FailurePolicy `json:"failurePolicy,omitempty"` +} + +// GroupVersionHook defines the runtime hook when the ExtensionHandler is called. +type GroupVersionHook struct { + // apiVersion is the group and version of the Hook. + // +required + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:MaxLength=512 + APIVersion string `json:"apiVersion"` + + // hook is the name of the hook. + // +required + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:MaxLength=256 + Hook string `json:"hook"` +} + +// FailurePolicy specifies how unrecognized errors when calling the ExtensionHandler are handled. +// FailurePolicy helps with extensions not working consistently, e.g. due to an intermittent network issue. +// The following type of errors are never ignored by FailurePolicy Ignore: +// - Misconfigurations (e.g. incompatible types) +// - Extension explicitly returns a Status Failure. +type FailurePolicy string + +const ( + // FailurePolicyIgnore means that an error when calling the extension is ignored. + FailurePolicyIgnore FailurePolicy = "Ignore" + + // FailurePolicyFail means that an error when calling the extension is propagated as an error. + FailurePolicyFail FailurePolicy = "Fail" +) + +// ANCHOR_END: ExtensionConfigStatus + +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=extensionconfigs,shortName=ext,scope=Cluster,categories=cluster-api +// +kubebuilder:subresource:status +// +kubebuilder:storageversion +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time duration since creation of ExtensionConfig" + +// ExtensionConfig is the Schema for the ExtensionConfig API. +type ExtensionConfig struct { + metav1.TypeMeta `json:",inline"` + // metadata is the standard object's metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // spec is the desired state of the ExtensionConfig. + // +optional + Spec ExtensionConfigSpec `json:"spec,omitempty"` + + // status is the current state of the ExtensionConfig + // +optional + Status ExtensionConfigStatus `json:"status,omitempty"` +} + +// GetV1Beta1Conditions returns the set of conditions for this object. +func (e *ExtensionConfig) GetV1Beta1Conditions() clusterv1.Conditions { + return e.Status.Conditions +} + +// SetV1Beta1Conditions sets the conditions on this object. +func (e *ExtensionConfig) SetV1Beta1Conditions(conditions clusterv1.Conditions) { + e.Status.Conditions = conditions +} + +// GetConditions returns the set of conditions for this object. +func (e *ExtensionConfig) GetConditions() []metav1.Condition { + if e.Status.V1Beta2 == nil { + return nil + } + return e.Status.V1Beta2.Conditions +} + +// SetConditions sets conditions for an API object. +func (e *ExtensionConfig) SetConditions(conditions []metav1.Condition) { + if e.Status.V1Beta2 == nil { + e.Status.V1Beta2 = &ExtensionConfigV1Beta2Status{} + } + e.Status.V1Beta2.Conditions = conditions +} + +// +kubebuilder:object:root=true + +// ExtensionConfigList contains a list of ExtensionConfig. +type ExtensionConfigList struct { + metav1.TypeMeta `json:",inline"` + // metadata is the standard list's metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#lists-and-simple-kinds + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + // items is the list of ExtensionConfigs. + Items []ExtensionConfig `json:"items"` +} + +func init() { + objectTypes = append(objectTypes, &ExtensionConfig{}, &ExtensionConfigList{}) +} + +// ExtensionConfig's Discovered conditions and corresponding reasons that will be used in v1Beta2 API version. +const ( + // ExtensionConfigDiscoveredCondition is true if the runtime extension has been successfully discovered. + ExtensionConfigDiscoveredCondition = "Discovered" + + // ExtensionConfigDiscoveredReason surfaces that the runtime extension has been successfully discovered. + ExtensionConfigDiscoveredReason = "Discovered" + + // ExtensionConfigNotDiscoveredReason surfaces that the runtime extension has not been successfully discovered. + ExtensionConfigNotDiscoveredReason = "NotDiscovered" +) + +const ( + // RuntimeExtensionDiscoveredV1Beta1Condition is a condition set on an ExtensionConfig object once it has been discovered by the Runtime SDK client. + RuntimeExtensionDiscoveredV1Beta1Condition clusterv1.ConditionType = "Discovered" + + // DiscoveryFailedV1Beta1Reason documents failure of a Discovery call. + DiscoveryFailedV1Beta1Reason string = "DiscoveryFailed" + + // InjectCAFromSecretAnnotation is the annotation that specifies that an ExtensionConfig + // object wants injection of CAs. The value is a reference to a Secret + // as /. + InjectCAFromSecretAnnotation string = "runtime.cluster.x-k8s.io/inject-ca-from-secret" + + // PendingHooksAnnotation is the annotation used to keep track of pending runtime hooks. + // The annotation will be used to track the intent to call a hook as soon as an operation completes; + // the intent will be removed as soon as the hook call completes successfully. + PendingHooksAnnotation string = "runtime.cluster.x-k8s.io/pending-hooks" + + // OkToDeleteAnnotation is the annotation used to indicate if a cluster is ready to be fully deleted. + // This annotation is added to the cluster after the BeforeClusterDelete hook has passed. + OkToDeleteAnnotation string = "runtime.cluster.x-k8s.io/ok-to-delete" +) diff --git a/exp/runtime/api/v1beta2/groupversion_info.go b/exp/runtime/api/v1beta2/groupversion_info.go new file mode 100644 index 000000000000..2a7b4eb2dfbb --- /dev/null +++ b/exp/runtime/api/v1beta2/groupversion_info.go @@ -0,0 +1,45 @@ +/* +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. +*/ + +// +kubebuilder:object:generate=true +// +groupName=runtime.cluster.x-k8s.io + +package v1beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +var ( + // GroupVersion is group version used to register these objects. + GroupVersion = schema.GroupVersion{Group: "runtime.cluster.x-k8s.io", Version: "v1beta2"} + + // schemeBuilder is used to add go types to the GroupVersionKind scheme. + schemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + + // AddToScheme adds the types in this group-version to the given scheme. + AddToScheme = schemeBuilder.AddToScheme + + objectTypes = []runtime.Object{} +) + +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(GroupVersion, objectTypes...) + metav1.AddToGroupVersion(scheme, GroupVersion) + return nil +} diff --git a/exp/runtime/api/v1beta2/zz_generated.deepcopy.go b/exp/runtime/api/v1beta2/zz_generated.deepcopy.go new file mode 100644 index 000000000000..313d33b454b2 --- /dev/null +++ b/exp/runtime/api/v1beta2/zz_generated.deepcopy.go @@ -0,0 +1,266 @@ +//go: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 v1beta2 + +import ( + "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + apiv1beta2 "sigs.k8s.io/cluster-api/api/v1beta2" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClientConfig) DeepCopyInto(out *ClientConfig) { + *out = *in + if in.URL != nil { + in, out := &in.URL, &out.URL + *out = new(string) + **out = **in + } + if in.Service != nil { + in, out := &in.Service, &out.Service + *out = new(ServiceReference) + (*in).DeepCopyInto(*out) + } + if in.CABundle != nil { + in, out := &in.CABundle, &out.CABundle + *out = make([]byte, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientConfig. +func (in *ClientConfig) DeepCopy() *ClientConfig { + if in == nil { + return nil + } + out := new(ClientConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExtensionConfig) DeepCopyInto(out *ExtensionConfig) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExtensionConfig. +func (in *ExtensionConfig) DeepCopy() *ExtensionConfig { + if in == nil { + return nil + } + out := new(ExtensionConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ExtensionConfig) 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 *ExtensionConfigList) DeepCopyInto(out *ExtensionConfigList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ExtensionConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExtensionConfigList. +func (in *ExtensionConfigList) DeepCopy() *ExtensionConfigList { + if in == nil { + return nil + } + out := new(ExtensionConfigList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ExtensionConfigList) 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 *ExtensionConfigSpec) DeepCopyInto(out *ExtensionConfigSpec) { + *out = *in + in.ClientConfig.DeepCopyInto(&out.ClientConfig) + if in.NamespaceSelector != nil { + in, out := &in.NamespaceSelector, &out.NamespaceSelector + *out = new(v1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.Settings != nil { + in, out := &in.Settings, &out.Settings + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExtensionConfigSpec. +func (in *ExtensionConfigSpec) DeepCopy() *ExtensionConfigSpec { + if in == nil { + return nil + } + out := new(ExtensionConfigSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExtensionConfigStatus) DeepCopyInto(out *ExtensionConfigStatus) { + *out = *in + if in.Handlers != nil { + in, out := &in.Handlers, &out.Handlers + *out = make([]ExtensionHandler, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make(apiv1beta2.Conditions, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.V1Beta2 != nil { + in, out := &in.V1Beta2, &out.V1Beta2 + *out = new(ExtensionConfigV1Beta2Status) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExtensionConfigStatus. +func (in *ExtensionConfigStatus) DeepCopy() *ExtensionConfigStatus { + if in == nil { + return nil + } + out := new(ExtensionConfigStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExtensionConfigV1Beta2Status) DeepCopyInto(out *ExtensionConfigV1Beta2Status) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]v1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExtensionConfigV1Beta2Status. +func (in *ExtensionConfigV1Beta2Status) DeepCopy() *ExtensionConfigV1Beta2Status { + if in == nil { + return nil + } + out := new(ExtensionConfigV1Beta2Status) + in.DeepCopyInto(out) + return out +} + +// 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 *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 *ServiceReference) DeepCopyInto(out *ServiceReference) { + *out = *in + if in.Path != nil { + in, out := &in.Path, &out.Path + *out = new(string) + **out = **in + } + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(int32) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceReference. +func (in *ServiceReference) DeepCopy() *ServiceReference { + if in == nil { + return nil + } + out := new(ServiceReference) + in.DeepCopyInto(out) + return out +} diff --git a/main.go b/main.go index 9f52c7dcd621..4160b0bac875 100644 --- a/main.go +++ b/main.go @@ -69,7 +69,8 @@ import ( ipamv1beta1 "sigs.k8s.io/cluster-api/exp/ipam/api/v1beta1" ipamv1 "sigs.k8s.io/cluster-api/exp/ipam/api/v1beta2" expipamwebhooks "sigs.k8s.io/cluster-api/exp/ipam/webhooks" - runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" + runtimev1alpha1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" + runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2" runtimecatalog "sigs.k8s.io/cluster-api/exp/runtime/catalog" runtimeclient "sigs.k8s.io/cluster-api/exp/runtime/client" runtimecontrollers "sigs.k8s.io/cluster-api/exp/runtime/controllers" @@ -159,6 +160,7 @@ func init() { _ = expv1.AddToScheme(scheme) _ = runtimev1.AddToScheme(scheme) + _ = runtimev1alpha1.AddToScheme(scheme) _ = ipamv1alpha1.AddToScheme(scheme) _ = ipamv1beta1.AddToScheme(scheme) From ff246a39b311d6fae40fa3d35d768ee11d6daf03 Mon Sep 17 00:00:00 2001 From: Christian Schlotter Date: Tue, 13 May 2025 11:42:39 +0200 Subject: [PATCH 02/13] change import to v1beta2 --- .golangci.yml | 2 +- exp/runtime/client/client.go | 2 +- exp/runtime/internal/controllers/extensionconfig_controller.go | 2 +- .../internal/controllers/extensionconfig_controller_test.go | 2 +- exp/runtime/internal/controllers/index.go | 2 +- exp/runtime/internal/controllers/index_test.go | 2 +- exp/runtime/internal/controllers/warmup.go | 2 +- exp/runtime/internal/controllers/warmup_test.go | 2 +- exp/topology/desiredstate/desired_state_test.go | 2 +- internal/controllers/cluster/cluster_controller_test.go | 2 +- internal/controllers/clusterclass/clusterclass_controller.go | 2 +- .../controllers/clusterclass/clusterclass_controller_test.go | 2 +- .../controllers/topology/cluster/cluster_controller_test.go | 2 +- .../cluster/patches/external/external_patch_generator_test.go | 2 +- internal/controllers/topology/cluster/reconcile_state_test.go | 2 +- internal/hooks/tracking.go | 2 +- internal/hooks/tracking_test.go | 2 +- internal/runtime/client/client.go | 2 +- internal/runtime/client/client_test.go | 2 +- internal/runtime/client/fake/fake_client.go | 2 +- internal/runtime/registry/registry.go | 2 +- internal/runtime/registry/registry_test.go | 2 +- internal/test/envtest/environment.go | 2 +- internal/webhooks/runtime/extensionconfig_webhook.go | 2 +- internal/webhooks/runtime/extensionconfig_webhook_test.go | 2 +- main.go | 2 +- test/e2e/__debug_bin2715288203 | 0 test/e2e/cluster_upgrade_runtimesdk.go | 2 +- .../handlers/topologymutation/handler_integration_test.go | 2 +- test/framework/convenience.go | 2 +- 30 files changed, 29 insertions(+), 29 deletions(-) create mode 100644 test/e2e/__debug_bin2715288203 diff --git a/.golangci.yml b/.golangci.yml index 997567c07f92..aa1a2c451407 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -156,7 +156,7 @@ linters: - pkg: sigs.k8s.io/cluster-api/exp/ipam/api/v1beta2 alias: ipamv1 # CAPI exp runtime - - pkg: sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1 + - pkg: sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2 alias: runtimev1 - pkg: sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1 alias: runtimehooksv1 diff --git a/exp/runtime/client/client.go b/exp/runtime/client/client.go index 705c7a7ef0fa..7bc0120cb8a1 100644 --- a/exp/runtime/client/client.go +++ b/exp/runtime/client/client.go @@ -22,7 +22,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" + runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2" runtimecatalog "sigs.k8s.io/cluster-api/exp/runtime/catalog" runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" "sigs.k8s.io/cluster-api/util/cache" diff --git a/exp/runtime/internal/controllers/extensionconfig_controller.go b/exp/runtime/internal/controllers/extensionconfig_controller.go index f243ceba1178..bb43bbaa4c64 100644 --- a/exp/runtime/internal/controllers/extensionconfig_controller.go +++ b/exp/runtime/internal/controllers/extensionconfig_controller.go @@ -37,7 +37,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/source" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta2" - runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" + runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2" runtimeclient "sigs.k8s.io/cluster-api/exp/runtime/client" "sigs.k8s.io/cluster-api/util/conditions" v1beta1conditions "sigs.k8s.io/cluster-api/util/conditions/deprecated/v1beta1" diff --git a/exp/runtime/internal/controllers/extensionconfig_controller_test.go b/exp/runtime/internal/controllers/extensionconfig_controller_test.go index a15c4bc7b257..9066bdefa01a 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" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta2" - runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" + runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2" runtimecatalog "sigs.k8s.io/cluster-api/exp/runtime/catalog" runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" "sigs.k8s.io/cluster-api/feature" diff --git a/exp/runtime/internal/controllers/index.go b/exp/runtime/internal/controllers/index.go index 45a2a7341835..944375c3208f 100644 --- a/exp/runtime/internal/controllers/index.go +++ b/exp/runtime/internal/controllers/index.go @@ -24,7 +24,7 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" - runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" + runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2" ) const ( diff --git a/exp/runtime/internal/controllers/index_test.go b/exp/runtime/internal/controllers/index_test.go index 7582153efabd..9fec2ee2029b 100644 --- a/exp/runtime/internal/controllers/index_test.go +++ b/exp/runtime/internal/controllers/index_test.go @@ -23,7 +23,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/controller-runtime/pkg/client" - runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" + runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2" ) func TestExtensionConfigByInjectCAFromSecretName(t *testing.T) { diff --git a/exp/runtime/internal/controllers/warmup.go b/exp/runtime/internal/controllers/warmup.go index 001c92d8a524..4298c58365d6 100644 --- a/exp/runtime/internal/controllers/warmup.go +++ b/exp/runtime/internal/controllers/warmup.go @@ -28,7 +28,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/manager" - runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" + runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2" runtimeclient "sigs.k8s.io/cluster-api/exp/runtime/client" ) diff --git a/exp/runtime/internal/controllers/warmup_test.go b/exp/runtime/internal/controllers/warmup_test.go index b20d7cec5868..d4df2b770dc0 100644 --- a/exp/runtime/internal/controllers/warmup_test.go +++ b/exp/runtime/internal/controllers/warmup_test.go @@ -27,7 +27,7 @@ import ( "k8s.io/apiserver/pkg/admission/plugin/webhook/testcerts" utilfeature "k8s.io/component-base/featuregate/testing" - runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" + runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2" runtimecatalog "sigs.k8s.io/cluster-api/exp/runtime/catalog" runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" "sigs.k8s.io/cluster-api/feature" diff --git a/exp/topology/desiredstate/desired_state_test.go b/exp/topology/desiredstate/desired_state_test.go index 0badc4dab66e..3b1fc5d1d3ae 100644 --- a/exp/topology/desiredstate/desired_state_test.go +++ b/exp/topology/desiredstate/desired_state_test.go @@ -38,7 +38,7 @@ import ( clusterv1 "sigs.k8s.io/cluster-api/api/v1beta2" expv1 "sigs.k8s.io/cluster-api/exp/api/v1beta2" - runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" + runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2" runtimecatalog "sigs.k8s.io/cluster-api/exp/runtime/catalog" runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" "sigs.k8s.io/cluster-api/exp/topology/scope" diff --git a/internal/controllers/cluster/cluster_controller_test.go b/internal/controllers/cluster/cluster_controller_test.go index 3cb412a7b01f..b09df8cea213 100644 --- a/internal/controllers/cluster/cluster_controller_test.go +++ b/internal/controllers/cluster/cluster_controller_test.go @@ -32,7 +32,7 @@ import ( clusterv1 "sigs.k8s.io/cluster-api/api/v1beta2" expv1 "sigs.k8s.io/cluster-api/exp/api/v1beta2" - runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" + runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2" "sigs.k8s.io/cluster-api/feature" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/collections" diff --git a/internal/controllers/clusterclass/clusterclass_controller.go b/internal/controllers/clusterclass/clusterclass_controller.go index 05636b33552d..c2b61d5a5d29 100644 --- a/internal/controllers/clusterclass/clusterclass_controller.go +++ b/internal/controllers/clusterclass/clusterclass_controller.go @@ -44,7 +44,7 @@ import ( clusterv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta2" "sigs.k8s.io/cluster-api/controllers/external" - runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" + runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2" runtimeclient "sigs.k8s.io/cluster-api/exp/runtime/client" runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" "sigs.k8s.io/cluster-api/feature" diff --git a/internal/controllers/clusterclass/clusterclass_controller_test.go b/internal/controllers/clusterclass/clusterclass_controller_test.go index 5d627907cfdc..f385b2a7e3f5 100644 --- a/internal/controllers/clusterclass/clusterclass_controller_test.go +++ b/internal/controllers/clusterclass/clusterclass_controller_test.go @@ -41,7 +41,7 @@ import ( clusterv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta2" - runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" + runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2" runtimecatalog "sigs.k8s.io/cluster-api/exp/runtime/catalog" runtimeclient "sigs.k8s.io/cluster-api/exp/runtime/client" runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" diff --git a/internal/controllers/topology/cluster/cluster_controller_test.go b/internal/controllers/topology/cluster/cluster_controller_test.go index 8c4ecc4ee491..626ddbc939cb 100644 --- a/internal/controllers/topology/cluster/cluster_controller_test.go +++ b/internal/controllers/topology/cluster/cluster_controller_test.go @@ -35,7 +35,7 @@ import ( clusterv1 "sigs.k8s.io/cluster-api/api/v1beta2" expv1 "sigs.k8s.io/cluster-api/exp/api/v1beta2" - runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" + runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2" runtimecatalog "sigs.k8s.io/cluster-api/exp/runtime/catalog" runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" "sigs.k8s.io/cluster-api/exp/topology/scope" diff --git a/internal/controllers/topology/cluster/patches/external/external_patch_generator_test.go b/internal/controllers/topology/cluster/patches/external/external_patch_generator_test.go index 3af76af157fc..200fa8f27857 100644 --- a/internal/controllers/topology/cluster/patches/external/external_patch_generator_test.go +++ b/internal/controllers/topology/cluster/patches/external/external_patch_generator_test.go @@ -26,7 +26,7 @@ import ( "k8s.io/utils/ptr" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta2" - runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" + runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2" runtimecatalog "sigs.k8s.io/cluster-api/exp/runtime/catalog" runtimeclient "sigs.k8s.io/cluster-api/exp/runtime/client" runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" diff --git a/internal/controllers/topology/cluster/reconcile_state_test.go b/internal/controllers/topology/cluster/reconcile_state_test.go index e7bd386b2030..ac8397bce6b9 100644 --- a/internal/controllers/topology/cluster/reconcile_state_test.go +++ b/internal/controllers/topology/cluster/reconcile_state_test.go @@ -41,7 +41,7 @@ import ( clusterv1 "sigs.k8s.io/cluster-api/api/v1beta2" expv1 "sigs.k8s.io/cluster-api/exp/api/v1beta2" - runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" + runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2" runtimecatalog "sigs.k8s.io/cluster-api/exp/runtime/catalog" runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" "sigs.k8s.io/cluster-api/exp/topology/desiredstate" diff --git a/internal/hooks/tracking.go b/internal/hooks/tracking.go index 99a885940adf..6a02ce1c31df 100644 --- a/internal/hooks/tracking.go +++ b/internal/hooks/tracking.go @@ -27,7 +27,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/apiutil" - runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" + runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2" runtimecatalog "sigs.k8s.io/cluster-api/exp/runtime/catalog" "sigs.k8s.io/cluster-api/util/patch" ) diff --git a/internal/hooks/tracking_test.go b/internal/hooks/tracking_test.go index 8f6e5ef17944..3f2170e37d62 100644 --- a/internal/hooks/tracking_test.go +++ b/internal/hooks/tracking_test.go @@ -26,7 +26,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" - runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" + runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2" runtimecatalog "sigs.k8s.io/cluster-api/exp/runtime/catalog" runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" ) diff --git a/internal/runtime/client/client.go b/internal/runtime/client/client.go index 3d4619feda93..a2e4eed78781 100644 --- a/internal/runtime/client/client.go +++ b/internal/runtime/client/client.go @@ -45,7 +45,7 @@ import ( ctrl "sigs.k8s.io/controller-runtime" ctrlclient "sigs.k8s.io/controller-runtime/pkg/client" - runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" + runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2" runtimecatalog "sigs.k8s.io/cluster-api/exp/runtime/catalog" runtimeclient "sigs.k8s.io/cluster-api/exp/runtime/client" runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" diff --git a/internal/runtime/client/client_test.go b/internal/runtime/client/client_test.go index 1795f79eff11..9e7687c35af5 100644 --- a/internal/runtime/client/client_test.go +++ b/internal/runtime/client/client_test.go @@ -38,7 +38,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client/fake" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta2" - runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" + runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2" runtimecatalog "sigs.k8s.io/cluster-api/exp/runtime/catalog" runtimeclient "sigs.k8s.io/cluster-api/exp/runtime/client" runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" diff --git a/internal/runtime/client/fake/fake_client.go b/internal/runtime/client/fake/fake_client.go index 114eb261260c..c8e7273e438d 100644 --- a/internal/runtime/client/fake/fake_client.go +++ b/internal/runtime/client/fake/fake_client.go @@ -24,7 +24,7 @@ import ( "github.com/pkg/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" + runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2" runtimecatalog "sigs.k8s.io/cluster-api/exp/runtime/catalog" runtimeclient "sigs.k8s.io/cluster-api/exp/runtime/client" runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" diff --git a/internal/runtime/registry/registry.go b/internal/runtime/registry/registry.go index 1de4c1eebcfa..a04826d7161c 100644 --- a/internal/runtime/registry/registry.go +++ b/internal/runtime/registry/registry.go @@ -25,7 +25,7 @@ import ( "k8s.io/apimachinery/pkg/runtime/schema" kerrors "k8s.io/apimachinery/pkg/util/errors" - runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" + runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2" runtimecatalog "sigs.k8s.io/cluster-api/exp/runtime/catalog" ) diff --git a/internal/runtime/registry/registry_test.go b/internal/runtime/registry/registry_test.go index bc9de5140288..ca5d659c090a 100644 --- a/internal/runtime/registry/registry_test.go +++ b/internal/runtime/registry/registry_test.go @@ -26,7 +26,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/utils/ptr" - runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" + runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2" runtimecatalog "sigs.k8s.io/cluster-api/exp/runtime/catalog" ) diff --git a/internal/test/envtest/environment.go b/internal/test/envtest/environment.go index d90e1bec1bb0..f865a7b7865d 100644 --- a/internal/test/envtest/environment.go +++ b/internal/test/envtest/environment.go @@ -65,7 +65,7 @@ import ( expv1 "sigs.k8s.io/cluster-api/exp/api/v1beta2" ipamv1 "sigs.k8s.io/cluster-api/exp/ipam/api/v1beta2" expipamwebhooks "sigs.k8s.io/cluster-api/exp/ipam/webhooks" - runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" + runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2" expapiwebhooks "sigs.k8s.io/cluster-api/exp/webhooks" "sigs.k8s.io/cluster-api/feature" internalwebhooks "sigs.k8s.io/cluster-api/internal/webhooks" diff --git a/internal/webhooks/runtime/extensionconfig_webhook.go b/internal/webhooks/runtime/extensionconfig_webhook.go index 5d8b65d9bb58..b6f329f1619f 100644 --- a/internal/webhooks/runtime/extensionconfig_webhook.go +++ b/internal/webhooks/runtime/extensionconfig_webhook.go @@ -32,7 +32,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/webhook" "sigs.k8s.io/controller-runtime/pkg/webhook/admission" - runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" + runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2" "sigs.k8s.io/cluster-api/feature" ) diff --git a/internal/webhooks/runtime/extensionconfig_webhook_test.go b/internal/webhooks/runtime/extensionconfig_webhook_test.go index 04b00b00c2ad..101eda6dbfa4 100644 --- a/internal/webhooks/runtime/extensionconfig_webhook_test.go +++ b/internal/webhooks/runtime/extensionconfig_webhook_test.go @@ -27,7 +27,7 @@ import ( "k8s.io/utils/ptr" ctrl "sigs.k8s.io/controller-runtime" - runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" + runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2" "sigs.k8s.io/cluster-api/feature" "sigs.k8s.io/cluster-api/internal/webhooks/util" ) diff --git a/main.go b/main.go index 4160b0bac875..c4d4c830696c 100644 --- a/main.go +++ b/main.go @@ -159,8 +159,8 @@ func init() { _ = expv1beta1.AddToScheme(scheme) _ = expv1.AddToScheme(scheme) - _ = runtimev1.AddToScheme(scheme) _ = runtimev1alpha1.AddToScheme(scheme) + _ = runtimev1.AddToScheme(scheme) _ = ipamv1alpha1.AddToScheme(scheme) _ = ipamv1beta1.AddToScheme(scheme) diff --git a/test/e2e/__debug_bin2715288203 b/test/e2e/__debug_bin2715288203 new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/test/e2e/cluster_upgrade_runtimesdk.go b/test/e2e/cluster_upgrade_runtimesdk.go index cf3dbe79bc10..2d047628be63 100644 --- a/test/e2e/cluster_upgrade_runtimesdk.go +++ b/test/e2e/cluster_upgrade_runtimesdk.go @@ -37,7 +37,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta2" - runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" + runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2" "sigs.k8s.io/cluster-api/test/e2e/internal/log" "sigs.k8s.io/cluster-api/test/framework" "sigs.k8s.io/cluster-api/test/framework/clusterctl" diff --git a/test/extension/handlers/topologymutation/handler_integration_test.go b/test/extension/handlers/topologymutation/handler_integration_test.go index 1627fc74c40e..9299b8adc3e1 100644 --- a/test/extension/handlers/topologymutation/handler_integration_test.go +++ b/test/extension/handlers/topologymutation/handler_integration_test.go @@ -48,7 +48,7 @@ import ( clusterv1 "sigs.k8s.io/cluster-api/api/v1beta2" "sigs.k8s.io/cluster-api/controllers" - runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" + runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2" runtimecatalog "sigs.k8s.io/cluster-api/exp/runtime/catalog" runtimeclient "sigs.k8s.io/cluster-api/exp/runtime/client" runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" diff --git a/test/framework/convenience.go b/test/framework/convenience.go index a38d7d67d369..c7c24f98bc57 100644 --- a/test/framework/convenience.go +++ b/test/framework/convenience.go @@ -36,7 +36,7 @@ import ( controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1beta2" expv1 "sigs.k8s.io/cluster-api/exp/api/v1beta2" ipamv1 "sigs.k8s.io/cluster-api/exp/ipam/api/v1beta2" - runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" + runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2" ) // TryAddDefaultSchemes tries to add the following schemes: From f90a0e52298603147e4501bf0311ea1e3c4a3d14 Mon Sep 17 00:00:00 2001 From: Christian Schlotter Date: Tue, 13 May 2025 12:31:48 +0200 Subject: [PATCH 03/13] implement conversion --- ...ime.cluster.x-k8s.io_extensionconfigs.yaml | 198 +++++++++--------- exp/runtime/api/v1alpha1/conversion.go | 69 ++++++ .../api/v1alpha1/zz_generated.conversion.go | 122 ++++++----- .../api/v1beta2/extensionconfig_types.go | 68 +++--- .../api/v1beta2/zz_generated.deepcopy.go | 38 +++- 5 files changed, 310 insertions(+), 185 deletions(-) diff --git a/config/crd/bases/runtime.cluster.x-k8s.io_extensionconfigs.yaml b/config/crd/bases/runtime.cluster.x-k8s.io_extensionconfigs.yaml index 7c2796c15908..2367ef3c0a9b 100644 --- a/config/crd/bases/runtime.cluster.x-k8s.io_extensionconfigs.yaml +++ b/config/crd/bases/runtime.cluster.x-k8s.io_extensionconfigs.yaml @@ -520,57 +520,136 @@ spec: description: status is the current state of the ExtensionConfig properties: conditions: - description: conditions define the current service state of the ExtensionConfig. + description: |- + conditions represents the observations of a ExtensionConfig's current state. + Known condition types are Discovered, Paused. items: - description: Condition defines an observation of a Cluster API resource - operational state. + description: Condition contains details for one aspect of the current + state of this API Resource. properties: lastTransitionTime: description: |- lastTransitionTime is the last time the condition transitioned from one status to another. - This should be when the underlying condition changed. If that is not known, then using the time when - the API field changed is acceptable. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. format: date-time type: string message: description: |- message is a human readable message indicating details about the transition. - This field may be empty. - maxLength: 10240 - minLength: 1 + This may be an empty string. + maxLength: 32768 type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer reason: description: |- - reason is the reason for the condition's last transition in CamelCase. - The specific API may choose whether or not this field is considered a guaranteed API. - This field may be empty. - maxLength: 256 + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 minLength: 1 - type: string - severity: - description: |- - severity provides an explicit classification of Reason code, so the users or machines can immediately - understand the current situation and act accordingly. - The Severity field MUST be set only when Status=False. - maxLength: 32 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ type: string status: description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown type: string type: - description: |- - type of condition in CamelCase or in foo.example.com/CamelCase. - Many .condition.type values are consistent across resources like Available, but because arbitrary conditions - can be useful (see .node.status.conditions), the ability to deconflict is important. - maxLength: 256 - minLength: 1 + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string required: - lastTransitionTime + - message + - reason - status - type type: object + maxItems: 32 type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + deprecated: + description: deprecated groups all the status fields that are deprecated + and will be removed when all the nested field are removed. + properties: + v1alpha1: + description: |- + v1alpha1 groups all the status fields that are deprecated and will be removed when support for v1alpha1 will be dropped. + + Deprecated: This field is deprecated and is going to be removed when support for v1alpha1 will be dropped. Please see https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more details. + properties: + conditions: + description: |- + conditions defines current service state of the Machine. + + Deprecated: This field is deprecated and is going to be removed when support for v1alpha1 will be dropped. Please see https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more details. + items: + description: Condition defines an observation of a Cluster + API resource operational state. + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when + the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This field may be empty. + maxLength: 10240 + minLength: 1 + type: string + reason: + description: |- + reason is the reason for the condition's last transition in CamelCase. + The specific API may choose whether or not this field is considered a guaranteed API. + This field may be empty. + maxLength: 256 + minLength: 1 + type: string + severity: + description: |- + severity provides an explicit classification of Reason code, so the users or machines can immediately + understand the current situation and act accordingly. + The Severity field MUST be set only when Status=False. + maxLength: 32 + type: string + status: + description: status of the condition, one of True, False, + Unknown. + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions + can be useful (see .node.status.conditions), the ability to deconflict is important. + maxLength: 256 + minLength: 1 + type: string + required: + - lastTransitionTime + - status + - type + type: object + type: array + type: object + type: object handlers: description: handlers defines the current ExtensionHandlers supported by an Extension. @@ -625,75 +704,6 @@ spec: x-kubernetes-list-map-keys: - name x-kubernetes-list-type: map - v1beta2: - description: v1beta2 groups all the fields that will be added or modified - in ExtensionConfig's status with the V1Beta2 version. - properties: - conditions: - description: |- - conditions represents the observations of a ExtensionConfig's current state. - Known condition types are Discovered, Paused. - items: - description: Condition contains details for one aspect of the - current state of this API Resource. - properties: - lastTransitionTime: - description: |- - lastTransitionTime is the last time the condition transitioned from one status to another. - This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. - format: date-time - type: string - message: - description: |- - message is a human readable message indicating details about the transition. - This may be an empty string. - maxLength: 32768 - type: string - observedGeneration: - description: |- - observedGeneration represents the .metadata.generation that the condition was set based upon. - For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date - with respect to the current state of the instance. - format: int64 - minimum: 0 - type: integer - reason: - description: |- - reason contains a programmatic identifier indicating the reason for the condition's last transition. - Producers of specific condition types may define expected values and meanings for this field, - and whether the values are considered a guaranteed API. - The value should be a CamelCase string. - This field may not be empty. - maxLength: 1024 - minLength: 1 - pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ - type: string - status: - description: status of the condition, one of True, False, - Unknown. - enum: - - "True" - - "False" - - Unknown - type: string - type: - description: type of condition in CamelCase or in foo.example.com/CamelCase. - maxLength: 316 - pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ - type: string - required: - - lastTransitionTime - - message - - reason - - status - - type - type: object - maxItems: 32 - type: array - x-kubernetes-list-map-keys: - - type - x-kubernetes-list-type: map - type: object type: object type: object served: true diff --git a/exp/runtime/api/v1alpha1/conversion.go b/exp/runtime/api/v1alpha1/conversion.go index e48be732558e..4ffb37da4b8d 100644 --- a/exp/runtime/api/v1alpha1/conversion.go +++ b/exp/runtime/api/v1alpha1/conversion.go @@ -17,8 +17,11 @@ limitations under the License. package v1alpha1 import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + apimachineryconversion "k8s.io/apimachinery/pkg/conversion" "sigs.k8s.io/controller-runtime/pkg/conversion" + clusterv1 "sigs.k8s.io/cluster-api/api/v1beta2" runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2" ) @@ -33,3 +36,69 @@ func (dst *ExtensionConfig) ConvertFrom(srcRaw conversion.Hub) error { return Convert_v1beta2_ExtensionConfig_To_v1alpha1_ExtensionConfig(src, dst, nil) } + +func Convert_v1beta2_ExtensionConfigStatus_To_v1alpha1_ExtensionConfigStatus(in *runtimev1.ExtensionConfigStatus, out *ExtensionConfigStatus, s apimachineryconversion.Scope) error { + if err := autoConvert_v1beta2_ExtensionConfigStatus_To_v1alpha1_ExtensionConfigStatus(in, out, s); err != nil { + return err + } + + // Reset conditions from autogenerated conversions + // NOTE: v1beta2 conditions should not be automatically be converted into legacy conditions (v1alpha1). + out.Conditions = nil + + // Retrieve legacy conditions (v1alpha1) from the deprecated field. + if in.Deprecated != nil && in.Deprecated.V1Alpha1 != nil { + if in.Deprecated.V1Alpha1.Conditions != nil { + out.Conditions = in.Deprecated.V1Alpha1.Conditions + } + } + + // Move new conditions (v1beta2) to the v1beta2 field. + if in.Conditions == nil { + return nil + } + out.V1Beta2 = &ExtensionConfigV1Beta2Status{} + out.V1Beta2.Conditions = in.Conditions + return nil +} + +func Convert_v1alpha1_ExtensionConfigStatus_To_v1beta2_ExtensionConfigStatus(in *ExtensionConfigStatus, out *runtimev1.ExtensionConfigStatus, s apimachineryconversion.Scope) error { + if err := autoConvert_v1alpha1_ExtensionConfigStatus_To_v1beta2_ExtensionConfigStatus(in, out, s); err != nil { + return err + } + + // Reset conditions from autogenerated conversions + // NOTE: v1alpha1 conditions should not be automatically be converted into v1beta2 conditions. + out.Conditions = nil + + // Retrieve new conditions (v1beta2) from the v1beta2 field. + if in.V1Beta2 != nil { + out.Conditions = in.V1Beta2.Conditions + } + + // Move legacy conditions (v1alpha1) to the deprecated field. + if in.Conditions == nil { + return nil + } + + if out.Deprecated == nil { + out.Deprecated = &runtimev1.ExtensionConfigDeprecatedStatus{} + } + if out.Deprecated.V1Alpha1 == nil { + out.Deprecated.V1Alpha1 = &runtimev1.ExtensionConfigV1Alpha1DeprecatedStatus{} + } + if in.Conditions != nil { + out.Deprecated.V1Alpha1.Conditions = in.Conditions + } + return nil +} + +func Convert_v1_Condition_To_v1beta2_Condition(_ *metav1.Condition, _ *clusterv1.Condition, _ apimachineryconversion.Scope) error { + // NOTE: v1beta2 conditions should not be automatically converted into legacy (v1beta2) conditions. + return nil +} + +func Convert_v1beta2_Condition_To_v1_Condition(_ *clusterv1.Condition, _ *metav1.Condition, _ apimachineryconversion.Scope) error { + // NOTE: legacy (v1beta2) conditions should not be automatically converted into v1beta2 conditions. + return nil +} diff --git a/exp/runtime/api/v1alpha1/zz_generated.conversion.go b/exp/runtime/api/v1alpha1/zz_generated.conversion.go index 3af06300d6fc..b3729de323c6 100644 --- a/exp/runtime/api/v1alpha1/zz_generated.conversion.go +++ b/exp/runtime/api/v1alpha1/zz_generated.conversion.go @@ -78,26 +78,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*ExtensionConfigStatus)(nil), (*v1beta2.ExtensionConfigStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha1_ExtensionConfigStatus_To_v1beta2_ExtensionConfigStatus(a.(*ExtensionConfigStatus), b.(*v1beta2.ExtensionConfigStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta2.ExtensionConfigStatus)(nil), (*ExtensionConfigStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta2_ExtensionConfigStatus_To_v1alpha1_ExtensionConfigStatus(a.(*v1beta2.ExtensionConfigStatus), b.(*ExtensionConfigStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*ExtensionConfigV1Beta2Status)(nil), (*v1beta2.ExtensionConfigV1Beta2Status)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha1_ExtensionConfigV1Beta2Status_To_v1beta2_ExtensionConfigV1Beta2Status(a.(*ExtensionConfigV1Beta2Status), b.(*v1beta2.ExtensionConfigV1Beta2Status), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta2.ExtensionConfigV1Beta2Status)(nil), (*ExtensionConfigV1Beta2Status)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta2_ExtensionConfigV1Beta2Status_To_v1alpha1_ExtensionConfigV1Beta2Status(a.(*v1beta2.ExtensionConfigV1Beta2Status), b.(*ExtensionConfigV1Beta2Status), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*ExtensionHandler)(nil), (*v1beta2.ExtensionHandler)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_ExtensionHandler_To_v1beta2_ExtensionHandler(a.(*ExtensionHandler), b.(*v1beta2.ExtensionHandler), scope) }); err != nil { @@ -128,6 +108,26 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*v1.Condition)(nil), (*apiv1beta2.Condition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_Condition_To_v1beta2_Condition(a.(*v1.Condition), b.(*apiv1beta2.Condition), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*ExtensionConfigStatus)(nil), (*v1beta2.ExtensionConfigStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ExtensionConfigStatus_To_v1beta2_ExtensionConfigStatus(a.(*ExtensionConfigStatus), b.(*v1beta2.ExtensionConfigStatus), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*apiv1beta2.Condition)(nil), (*v1.Condition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_Condition_To_v1_Condition(a.(*apiv1beta2.Condition), b.(*v1.Condition), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*v1beta2.ExtensionConfigStatus)(nil), (*ExtensionConfigStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_ExtensionConfigStatus_To_v1alpha1_ExtensionConfigStatus(a.(*v1beta2.ExtensionConfigStatus), b.(*ExtensionConfigStatus), scope) + }); err != nil { + return err + } return nil } @@ -189,7 +189,17 @@ func Convert_v1beta2_ExtensionConfig_To_v1alpha1_ExtensionConfig(in *v1beta2.Ext func autoConvert_v1alpha1_ExtensionConfigList_To_v1beta2_ExtensionConfigList(in *ExtensionConfigList, out *v1beta2.ExtensionConfigList, s conversion.Scope) error { out.ListMeta = in.ListMeta - out.Items = *(*[]v1beta2.ExtensionConfig)(unsafe.Pointer(&in.Items)) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]v1beta2.ExtensionConfig, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_ExtensionConfig_To_v1beta2_ExtensionConfig(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } return nil } @@ -200,7 +210,17 @@ func Convert_v1alpha1_ExtensionConfigList_To_v1beta2_ExtensionConfigList(in *Ext func autoConvert_v1beta2_ExtensionConfigList_To_v1alpha1_ExtensionConfigList(in *v1beta2.ExtensionConfigList, out *ExtensionConfigList, s conversion.Scope) error { out.ListMeta = in.ListMeta - out.Items = *(*[]ExtensionConfig)(unsafe.Pointer(&in.Items)) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ExtensionConfig, len(*in)) + for i := range *in { + if err := Convert_v1beta2_ExtensionConfig_To_v1alpha1_ExtensionConfig(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } return nil } @@ -239,48 +259,38 @@ func Convert_v1beta2_ExtensionConfigSpec_To_v1alpha1_ExtensionConfigSpec(in *v1b func autoConvert_v1alpha1_ExtensionConfigStatus_To_v1beta2_ExtensionConfigStatus(in *ExtensionConfigStatus, out *v1beta2.ExtensionConfigStatus, s conversion.Scope) error { out.Handlers = *(*[]v1beta2.ExtensionHandler)(unsafe.Pointer(&in.Handlers)) - out.Conditions = *(*apiv1beta2.Conditions)(unsafe.Pointer(&in.Conditions)) - out.V1Beta2 = (*v1beta2.ExtensionConfigV1Beta2Status)(unsafe.Pointer(in.V1Beta2)) + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]v1.Condition, len(*in)) + for i := range *in { + if err := Convert_v1beta2_Condition_To_v1_Condition(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Conditions = nil + } + // WARNING: in.V1Beta2 requires manual conversion: does not exist in peer-type return nil } -// Convert_v1alpha1_ExtensionConfigStatus_To_v1beta2_ExtensionConfigStatus is an autogenerated conversion function. -func Convert_v1alpha1_ExtensionConfigStatus_To_v1beta2_ExtensionConfigStatus(in *ExtensionConfigStatus, out *v1beta2.ExtensionConfigStatus, s conversion.Scope) error { - return autoConvert_v1alpha1_ExtensionConfigStatus_To_v1beta2_ExtensionConfigStatus(in, out, s) -} - func autoConvert_v1beta2_ExtensionConfigStatus_To_v1alpha1_ExtensionConfigStatus(in *v1beta2.ExtensionConfigStatus, out *ExtensionConfigStatus, s conversion.Scope) error { out.Handlers = *(*[]ExtensionHandler)(unsafe.Pointer(&in.Handlers)) - out.Conditions = *(*apiv1beta2.Conditions)(unsafe.Pointer(&in.Conditions)) - out.V1Beta2 = (*ExtensionConfigV1Beta2Status)(unsafe.Pointer(in.V1Beta2)) - return nil -} - -// Convert_v1beta2_ExtensionConfigStatus_To_v1alpha1_ExtensionConfigStatus is an autogenerated conversion function. -func Convert_v1beta2_ExtensionConfigStatus_To_v1alpha1_ExtensionConfigStatus(in *v1beta2.ExtensionConfigStatus, out *ExtensionConfigStatus, s conversion.Scope) error { - return autoConvert_v1beta2_ExtensionConfigStatus_To_v1alpha1_ExtensionConfigStatus(in, out, s) -} - -func autoConvert_v1alpha1_ExtensionConfigV1Beta2Status_To_v1beta2_ExtensionConfigV1Beta2Status(in *ExtensionConfigV1Beta2Status, out *v1beta2.ExtensionConfigV1Beta2Status, s conversion.Scope) error { - out.Conditions = *(*[]v1.Condition)(unsafe.Pointer(&in.Conditions)) - return nil -} - -// Convert_v1alpha1_ExtensionConfigV1Beta2Status_To_v1beta2_ExtensionConfigV1Beta2Status is an autogenerated conversion function. -func Convert_v1alpha1_ExtensionConfigV1Beta2Status_To_v1beta2_ExtensionConfigV1Beta2Status(in *ExtensionConfigV1Beta2Status, out *v1beta2.ExtensionConfigV1Beta2Status, s conversion.Scope) error { - return autoConvert_v1alpha1_ExtensionConfigV1Beta2Status_To_v1beta2_ExtensionConfigV1Beta2Status(in, out, s) -} - -func autoConvert_v1beta2_ExtensionConfigV1Beta2Status_To_v1alpha1_ExtensionConfigV1Beta2Status(in *v1beta2.ExtensionConfigV1Beta2Status, out *ExtensionConfigV1Beta2Status, s conversion.Scope) error { - out.Conditions = *(*[]v1.Condition)(unsafe.Pointer(&in.Conditions)) + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make(apiv1beta2.Conditions, len(*in)) + for i := range *in { + if err := Convert_v1_Condition_To_v1beta2_Condition(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Conditions = nil + } + // WARNING: in.Deprecated requires manual conversion: does not exist in peer-type return nil } -// Convert_v1beta2_ExtensionConfigV1Beta2Status_To_v1alpha1_ExtensionConfigV1Beta2Status is an autogenerated conversion function. -func Convert_v1beta2_ExtensionConfigV1Beta2Status_To_v1alpha1_ExtensionConfigV1Beta2Status(in *v1beta2.ExtensionConfigV1Beta2Status, out *ExtensionConfigV1Beta2Status, s conversion.Scope) error { - return autoConvert_v1beta2_ExtensionConfigV1Beta2Status_To_v1alpha1_ExtensionConfigV1Beta2Status(in, out, s) -} - func autoConvert_v1alpha1_ExtensionHandler_To_v1beta2_ExtensionHandler(in *ExtensionHandler, out *v1beta2.ExtensionHandler, s conversion.Scope) error { out.Name = in.Name if err := Convert_v1alpha1_GroupVersionHook_To_v1beta2_GroupVersionHook(&in.RequestHook, &out.RequestHook, s); err != nil { diff --git a/exp/runtime/api/v1beta2/extensionconfig_types.go b/exp/runtime/api/v1beta2/extensionconfig_types.go index 576b90536e7f..3a2c301ad11b 100644 --- a/exp/runtime/api/v1beta2/extensionconfig_types.go +++ b/exp/runtime/api/v1beta2/extensionconfig_types.go @@ -123,18 +123,6 @@ type ExtensionConfigStatus struct { // +kubebuilder:validation:MaxItems=512 Handlers []ExtensionHandler `json:"handlers,omitempty"` - // conditions define the current service state of the ExtensionConfig. - // +optional - Conditions clusterv1.Conditions `json:"conditions,omitempty"` - - // v1beta2 groups all the fields that will be added or modified in ExtensionConfig's status with the V1Beta2 version. - // +optional - V1Beta2 *ExtensionConfigV1Beta2Status `json:"v1beta2,omitempty"` -} - -// ExtensionConfigV1Beta2Status groups all the fields that will be added or modified in ExtensionConfig with the V1Beta2 version. -// See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context. -type ExtensionConfigV1Beta2Status struct { // conditions represents the observations of a ExtensionConfig's current state. // Known condition types are Discovered, Paused. // +optional @@ -142,6 +130,31 @@ type ExtensionConfigV1Beta2Status struct { // +listMapKey=type // +kubebuilder:validation:MaxItems=32 Conditions []metav1.Condition `json:"conditions,omitempty"` + + // deprecated groups all the status fields that are deprecated and will be removed when all the nested field are removed. + // +optional + Deprecated *ExtensionConfigDeprecatedStatus `json:"deprecated,omitempty"` +} + +// ExtensionConfigDeprecatedStatus groups all the status fields that are deprecated and will be removed in a future version. +type ExtensionConfigDeprecatedStatus struct { + // v1alpha1 groups all the status fields that are deprecated and will be removed when support for v1alpha1 will be dropped. + // + // Deprecated: This field is deprecated and is going to be removed when support for v1alpha1 will be dropped. Please see https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more details. + // + // +optional + V1Alpha1 *ExtensionConfigV1Alpha1DeprecatedStatus `json:"v1alpha1,omitempty"` +} + +// ExtensionConfigV1Alpha1DeprecatedStatus groups all the status fields that are deprecated and will be removed when support for v1alpha1 will be dropped. +// See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context. +type ExtensionConfigV1Alpha1DeprecatedStatus struct { + // conditions defines current service state of the Machine. + // + // Deprecated: This field is deprecated and is going to be removed when support for v1alpha1 will be dropped. Please see https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more details. + // + // +optional + Conditions clusterv1.Conditions `json:"conditions,omitempty"` } // ExtensionHandler specifies the details of a handler for a particular runtime hook registered by an Extension server. @@ -224,29 +237,32 @@ type ExtensionConfig struct { } // GetV1Beta1Conditions returns the set of conditions for this object. -func (e *ExtensionConfig) GetV1Beta1Conditions() clusterv1.Conditions { - return e.Status.Conditions +func (m *ExtensionConfig) GetV1Beta1Conditions() clusterv1.Conditions { + if m.Status.Deprecated == nil || m.Status.Deprecated.V1Alpha1 == nil { + return nil + } + return m.Status.Deprecated.V1Alpha1.Conditions } // SetV1Beta1Conditions sets the conditions on this object. -func (e *ExtensionConfig) SetV1Beta1Conditions(conditions clusterv1.Conditions) { - e.Status.Conditions = conditions +func (m *ExtensionConfig) SetV1Beta1Conditions(conditions clusterv1.Conditions) { + if m.Status.Deprecated == nil { + m.Status.Deprecated = &ExtensionConfigDeprecatedStatus{} + } + if m.Status.Deprecated.V1Alpha1 == nil { + m.Status.Deprecated.V1Alpha1 = &ExtensionConfigV1Alpha1DeprecatedStatus{} + } + m.Status.Deprecated.V1Alpha1.Conditions = conditions } // GetConditions returns the set of conditions for this object. -func (e *ExtensionConfig) GetConditions() []metav1.Condition { - if e.Status.V1Beta2 == nil { - return nil - } - return e.Status.V1Beta2.Conditions +func (m *ExtensionConfig) GetConditions() []metav1.Condition { + return m.Status.Conditions } // SetConditions sets conditions for an API object. -func (e *ExtensionConfig) SetConditions(conditions []metav1.Condition) { - if e.Status.V1Beta2 == nil { - e.Status.V1Beta2 = &ExtensionConfigV1Beta2Status{} - } - e.Status.V1Beta2.Conditions = conditions +func (m *ExtensionConfig) SetConditions(conditions []metav1.Condition) { + m.Status.Conditions = conditions } // +kubebuilder:object:root=true diff --git a/exp/runtime/api/v1beta2/zz_generated.deepcopy.go b/exp/runtime/api/v1beta2/zz_generated.deepcopy.go index 313d33b454b2..33e2dc38417a 100644 --- a/exp/runtime/api/v1beta2/zz_generated.deepcopy.go +++ b/exp/runtime/api/v1beta2/zz_generated.deepcopy.go @@ -83,6 +83,26 @@ func (in *ExtensionConfig) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExtensionConfigDeprecatedStatus) DeepCopyInto(out *ExtensionConfigDeprecatedStatus) { + *out = *in + if in.V1Alpha1 != nil { + in, out := &in.V1Alpha1, &out.V1Alpha1 + *out = new(ExtensionConfigV1Alpha1DeprecatedStatus) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExtensionConfigDeprecatedStatus. +func (in *ExtensionConfigDeprecatedStatus) DeepCopy() *ExtensionConfigDeprecatedStatus { + if in == nil { + return nil + } + out := new(ExtensionConfigDeprecatedStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ExtensionConfigList) DeepCopyInto(out *ExtensionConfigList) { *out = *in @@ -155,14 +175,14 @@ func (in *ExtensionConfigStatus) DeepCopyInto(out *ExtensionConfigStatus) { } if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions - *out = make(apiv1beta2.Conditions, len(*in)) + *out = make([]v1.Condition, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } - if in.V1Beta2 != nil { - in, out := &in.V1Beta2, &out.V1Beta2 - *out = new(ExtensionConfigV1Beta2Status) + if in.Deprecated != nil { + in, out := &in.Deprecated, &out.Deprecated + *out = new(ExtensionConfigDeprecatedStatus) (*in).DeepCopyInto(*out) } } @@ -178,23 +198,23 @@ func (in *ExtensionConfigStatus) DeepCopy() *ExtensionConfigStatus { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ExtensionConfigV1Beta2Status) DeepCopyInto(out *ExtensionConfigV1Beta2Status) { +func (in *ExtensionConfigV1Alpha1DeprecatedStatus) DeepCopyInto(out *ExtensionConfigV1Alpha1DeprecatedStatus) { *out = *in if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions - *out = make([]v1.Condition, len(*in)) + *out = make(apiv1beta2.Conditions, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExtensionConfigV1Beta2Status. -func (in *ExtensionConfigV1Beta2Status) DeepCopy() *ExtensionConfigV1Beta2Status { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExtensionConfigV1Alpha1DeprecatedStatus. +func (in *ExtensionConfigV1Alpha1DeprecatedStatus) DeepCopy() *ExtensionConfigV1Alpha1DeprecatedStatus { if in == nil { return nil } - out := new(ExtensionConfigV1Beta2Status) + out := new(ExtensionConfigV1Alpha1DeprecatedStatus) in.DeepCopyInto(out) return out } From 943695e91b913e2e86e78e7ad88e5bbea9fd236b Mon Sep 17 00:00:00 2001 From: Christian Schlotter Date: Tue, 13 May 2025 12:50:31 +0200 Subject: [PATCH 04/13] fixup webhook --- config/webhook/manifests.yaml | 8 ++++---- internal/webhooks/runtime/extensionconfig_webhook.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/config/webhook/manifests.yaml b/config/webhook/manifests.yaml index 56e53cade5e3..e401b4926966 100644 --- a/config/webhook/manifests.yaml +++ b/config/webhook/manifests.yaml @@ -165,7 +165,7 @@ webhooks: service: name: webhook-service namespace: system - path: /mutate-runtime-cluster-x-k8s-io-v1alpha1-extensionconfig + path: /mutate-runtime-cluster-x-k8s-io-v1beta2-extensionconfig failurePolicy: Fail matchPolicy: Equivalent name: default.extensionconfig.runtime.addons.cluster.x-k8s.io @@ -173,7 +173,7 @@ webhooks: - apiGroups: - runtime.cluster.x-k8s.io apiVersions: - - v1alpha1 + - v1beta2 operations: - CREATE - UPDATE @@ -415,7 +415,7 @@ webhooks: service: name: webhook-service namespace: system - path: /validate-runtime-cluster-x-k8s-io-v1alpha1-extensionconfig + path: /validate-runtime-cluster-x-k8s-io-v1beta2-extensionconfig failurePolicy: Fail matchPolicy: Equivalent name: validation.extensionconfig.runtime.cluster.x-k8s.io @@ -423,7 +423,7 @@ webhooks: - apiGroups: - runtime.cluster.x-k8s.io apiVersions: - - v1alpha1 + - v1beta2 operations: - CREATE - UPDATE diff --git a/internal/webhooks/runtime/extensionconfig_webhook.go b/internal/webhooks/runtime/extensionconfig_webhook.go index b6f329f1619f..ce0b1a436dbc 100644 --- a/internal/webhooks/runtime/extensionconfig_webhook.go +++ b/internal/webhooks/runtime/extensionconfig_webhook.go @@ -47,8 +47,8 @@ func (webhook *ExtensionConfig) SetupWebhookWithManager(mgr ctrl.Manager) error Complete() } -// +kubebuilder:webhook:verbs=create;update,path=/validate-runtime-cluster-x-k8s-io-v1alpha1-extensionconfig,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=runtime.cluster.x-k8s.io,resources=extensionconfigs,versions=v1alpha1,name=validation.extensionconfig.runtime.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1;v1beta1 -// +kubebuilder:webhook:verbs=create;update,path=/mutate-runtime-cluster-x-k8s-io-v1alpha1-extensionconfig,mutating=true,failurePolicy=fail,matchPolicy=Equivalent,groups=runtime.cluster.x-k8s.io,resources=extensionconfigs,versions=v1alpha1,name=default.extensionconfig.runtime.addons.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1;v1beta1 +// +kubebuilder:webhook:verbs=create;update,path=/validate-runtime-cluster-x-k8s-io-v1beta2-extensionconfig,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=runtime.cluster.x-k8s.io,resources=extensionconfigs,versions=v1beta2,name=validation.extensionconfig.runtime.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1;v1beta1 +// +kubebuilder:webhook:verbs=create;update,path=/mutate-runtime-cluster-x-k8s-io-v1beta2-extensionconfig,mutating=true,failurePolicy=fail,matchPolicy=Equivalent,groups=runtime.cluster.x-k8s.io,resources=extensionconfigs,versions=v1beta2,name=default.extensionconfig.runtime.addons.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1;v1beta1 var _ webhook.CustomValidator = &ExtensionConfig{} var _ webhook.CustomDefaulter = &ExtensionConfig{} From ab29912b0256398446cc289ae6b5ed5f31eea3da Mon Sep 17 00:00:00 2001 From: Christian Schlotter Date: Tue, 13 May 2025 12:51:33 +0200 Subject: [PATCH 05/13] rename deprecated status to v1beta1 --- ...ime.cluster.x-k8s.io_extensionconfigs.yaml | 8 +++---- exp/runtime/api/v1alpha1/conversion.go | 20 ++++++++--------- .../api/v1beta2/extensionconfig_types.go | 22 +++++++++---------- .../api/v1beta2/zz_generated.deepcopy.go | 14 ++++++------ 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/config/crd/bases/runtime.cluster.x-k8s.io_extensionconfigs.yaml b/config/crd/bases/runtime.cluster.x-k8s.io_extensionconfigs.yaml index 2367ef3c0a9b..99973063b5c7 100644 --- a/config/crd/bases/runtime.cluster.x-k8s.io_extensionconfigs.yaml +++ b/config/crd/bases/runtime.cluster.x-k8s.io_extensionconfigs.yaml @@ -586,17 +586,17 @@ spec: description: deprecated groups all the status fields that are deprecated and will be removed when all the nested field are removed. properties: - v1alpha1: + v1beta1: description: |- - v1alpha1 groups all the status fields that are deprecated and will be removed when support for v1alpha1 will be dropped. + v1beta1 groups all the status fields that are deprecated and will be removed when support for v1beta1 will be dropped. - Deprecated: This field is deprecated and is going to be removed when support for v1alpha1 will be dropped. Please see https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more details. + Deprecated: This field is deprecated and is going to be removed when support for v1beta1 will be dropped. Please see https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more details. properties: conditions: description: |- conditions defines current service state of the Machine. - Deprecated: This field is deprecated and is going to be removed when support for v1alpha1 will be dropped. Please see https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more details. + Deprecated: This field is deprecated and is going to be removed when support for v1beta1 will be dropped. Please see https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more details. items: description: Condition defines an observation of a Cluster API resource operational state. diff --git a/exp/runtime/api/v1alpha1/conversion.go b/exp/runtime/api/v1alpha1/conversion.go index 4ffb37da4b8d..a5b2e8762b09 100644 --- a/exp/runtime/api/v1alpha1/conversion.go +++ b/exp/runtime/api/v1alpha1/conversion.go @@ -43,13 +43,13 @@ func Convert_v1beta2_ExtensionConfigStatus_To_v1alpha1_ExtensionConfigStatus(in } // Reset conditions from autogenerated conversions - // NOTE: v1beta2 conditions should not be automatically be converted into legacy conditions (v1alpha1). + // NOTE: v1beta2 conditions should not be automatically be converted into legacy conditions (v1beta1). out.Conditions = nil - // Retrieve legacy conditions (v1alpha1) from the deprecated field. - if in.Deprecated != nil && in.Deprecated.V1Alpha1 != nil { - if in.Deprecated.V1Alpha1.Conditions != nil { - out.Conditions = in.Deprecated.V1Alpha1.Conditions + // Retrieve legacy conditions (v1beta1) from the deprecated field. + if in.Deprecated != nil && in.Deprecated.V1Beta1 != nil { + if in.Deprecated.V1Beta1.Conditions != nil { + out.Conditions = in.Deprecated.V1Beta1.Conditions } } @@ -68,7 +68,7 @@ func Convert_v1alpha1_ExtensionConfigStatus_To_v1beta2_ExtensionConfigStatus(in } // Reset conditions from autogenerated conversions - // NOTE: v1alpha1 conditions should not be automatically be converted into v1beta2 conditions. + // NOTE: v1beta1 conditions should not be automatically be converted into v1beta2 conditions. out.Conditions = nil // Retrieve new conditions (v1beta2) from the v1beta2 field. @@ -76,7 +76,7 @@ func Convert_v1alpha1_ExtensionConfigStatus_To_v1beta2_ExtensionConfigStatus(in out.Conditions = in.V1Beta2.Conditions } - // Move legacy conditions (v1alpha1) to the deprecated field. + // Move legacy conditions (v1beta1) to the deprecated field. if in.Conditions == nil { return nil } @@ -84,11 +84,11 @@ func Convert_v1alpha1_ExtensionConfigStatus_To_v1beta2_ExtensionConfigStatus(in if out.Deprecated == nil { out.Deprecated = &runtimev1.ExtensionConfigDeprecatedStatus{} } - if out.Deprecated.V1Alpha1 == nil { - out.Deprecated.V1Alpha1 = &runtimev1.ExtensionConfigV1Alpha1DeprecatedStatus{} + if out.Deprecated.V1Beta1 == nil { + out.Deprecated.V1Beta1 = &runtimev1.ExtensionConfigV1Beta1DeprecatedStatus{} } if in.Conditions != nil { - out.Deprecated.V1Alpha1.Conditions = in.Conditions + out.Deprecated.V1Beta1.Conditions = in.Conditions } return nil } diff --git a/exp/runtime/api/v1beta2/extensionconfig_types.go b/exp/runtime/api/v1beta2/extensionconfig_types.go index 3a2c301ad11b..8cbe759f37ca 100644 --- a/exp/runtime/api/v1beta2/extensionconfig_types.go +++ b/exp/runtime/api/v1beta2/extensionconfig_types.go @@ -138,20 +138,20 @@ type ExtensionConfigStatus struct { // ExtensionConfigDeprecatedStatus groups all the status fields that are deprecated and will be removed in a future version. type ExtensionConfigDeprecatedStatus struct { - // v1alpha1 groups all the status fields that are deprecated and will be removed when support for v1alpha1 will be dropped. + // v1beta1 groups all the status fields that are deprecated and will be removed when support for v1beta1 will be dropped. // - // Deprecated: This field is deprecated and is going to be removed when support for v1alpha1 will be dropped. Please see https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more details. + // Deprecated: This field is deprecated and is going to be removed when support for v1beta1 will be dropped. Please see https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more details. // // +optional - V1Alpha1 *ExtensionConfigV1Alpha1DeprecatedStatus `json:"v1alpha1,omitempty"` + V1Beta1 *ExtensionConfigV1Beta1DeprecatedStatus `json:"v1beta1,omitempty"` } -// ExtensionConfigV1Alpha1DeprecatedStatus groups all the status fields that are deprecated and will be removed when support for v1alpha1 will be dropped. +// ExtensionConfigV1Beta1DeprecatedStatus groups all the status fields that are deprecated and will be removed when support for v1beta1 will be dropped. // See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context. -type ExtensionConfigV1Alpha1DeprecatedStatus struct { +type ExtensionConfigV1Beta1DeprecatedStatus struct { // conditions defines current service state of the Machine. // - // Deprecated: This field is deprecated and is going to be removed when support for v1alpha1 will be dropped. Please see https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more details. + // Deprecated: This field is deprecated and is going to be removed when support for v1beta1 will be dropped. Please see https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more details. // // +optional Conditions clusterv1.Conditions `json:"conditions,omitempty"` @@ -238,10 +238,10 @@ type ExtensionConfig struct { // GetV1Beta1Conditions returns the set of conditions for this object. func (m *ExtensionConfig) GetV1Beta1Conditions() clusterv1.Conditions { - if m.Status.Deprecated == nil || m.Status.Deprecated.V1Alpha1 == nil { + if m.Status.Deprecated == nil || m.Status.Deprecated.V1Beta1 == nil { return nil } - return m.Status.Deprecated.V1Alpha1.Conditions + return m.Status.Deprecated.V1Beta1.Conditions } // SetV1Beta1Conditions sets the conditions on this object. @@ -249,10 +249,10 @@ func (m *ExtensionConfig) SetV1Beta1Conditions(conditions clusterv1.Conditions) if m.Status.Deprecated == nil { m.Status.Deprecated = &ExtensionConfigDeprecatedStatus{} } - if m.Status.Deprecated.V1Alpha1 == nil { - m.Status.Deprecated.V1Alpha1 = &ExtensionConfigV1Alpha1DeprecatedStatus{} + if m.Status.Deprecated.V1Beta1 == nil { + m.Status.Deprecated.V1Beta1 = &ExtensionConfigV1Beta1DeprecatedStatus{} } - m.Status.Deprecated.V1Alpha1.Conditions = conditions + m.Status.Deprecated.V1Beta1.Conditions = conditions } // GetConditions returns the set of conditions for this object. diff --git a/exp/runtime/api/v1beta2/zz_generated.deepcopy.go b/exp/runtime/api/v1beta2/zz_generated.deepcopy.go index 33e2dc38417a..02985cf1691b 100644 --- a/exp/runtime/api/v1beta2/zz_generated.deepcopy.go +++ b/exp/runtime/api/v1beta2/zz_generated.deepcopy.go @@ -86,9 +86,9 @@ func (in *ExtensionConfig) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ExtensionConfigDeprecatedStatus) DeepCopyInto(out *ExtensionConfigDeprecatedStatus) { *out = *in - if in.V1Alpha1 != nil { - in, out := &in.V1Alpha1, &out.V1Alpha1 - *out = new(ExtensionConfigV1Alpha1DeprecatedStatus) + if in.V1Beta1 != nil { + in, out := &in.V1Beta1, &out.V1Beta1 + *out = new(ExtensionConfigV1Beta1DeprecatedStatus) (*in).DeepCopyInto(*out) } } @@ -198,7 +198,7 @@ func (in *ExtensionConfigStatus) DeepCopy() *ExtensionConfigStatus { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ExtensionConfigV1Alpha1DeprecatedStatus) DeepCopyInto(out *ExtensionConfigV1Alpha1DeprecatedStatus) { +func (in *ExtensionConfigV1Beta1DeprecatedStatus) DeepCopyInto(out *ExtensionConfigV1Beta1DeprecatedStatus) { *out = *in if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions @@ -209,12 +209,12 @@ func (in *ExtensionConfigV1Alpha1DeprecatedStatus) DeepCopyInto(out *ExtensionCo } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExtensionConfigV1Alpha1DeprecatedStatus. -func (in *ExtensionConfigV1Alpha1DeprecatedStatus) DeepCopy() *ExtensionConfigV1Alpha1DeprecatedStatus { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExtensionConfigV1Beta1DeprecatedStatus. +func (in *ExtensionConfigV1Beta1DeprecatedStatus) DeepCopy() *ExtensionConfigV1Beta1DeprecatedStatus { if in == nil { return nil } - out := new(ExtensionConfigV1Alpha1DeprecatedStatus) + out := new(ExtensionConfigV1Beta1DeprecatedStatus) in.DeepCopyInto(out) return out } From ed71966e60087576d6cbf063b606219a60a8e246 Mon Sep 17 00:00:00 2001 From: Christian Schlotter Date: Tue, 13 May 2025 13:32:22 +0200 Subject: [PATCH 06/13] fixup linter --- .../api/v1alpha1/zz_generated.conversion.go | 2 +- exp/runtime/api/v1beta2/extensionconfig_types.go | 14 +++++++------- exp/runtime/api/v1beta2/zz_generated.deepcopy.go | 12 ++++++------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/exp/runtime/api/v1alpha1/zz_generated.conversion.go b/exp/runtime/api/v1alpha1/zz_generated.conversion.go index b3729de323c6..09e8320bdc4d 100644 --- a/exp/runtime/api/v1alpha1/zz_generated.conversion.go +++ b/exp/runtime/api/v1alpha1/zz_generated.conversion.go @@ -275,7 +275,6 @@ func autoConvert_v1alpha1_ExtensionConfigStatus_To_v1beta2_ExtensionConfigStatus } func autoConvert_v1beta2_ExtensionConfigStatus_To_v1alpha1_ExtensionConfigStatus(in *v1beta2.ExtensionConfigStatus, out *ExtensionConfigStatus, s conversion.Scope) error { - out.Handlers = *(*[]ExtensionHandler)(unsafe.Pointer(&in.Handlers)) if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions *out = make(apiv1beta2.Conditions, len(*in)) @@ -287,6 +286,7 @@ func autoConvert_v1beta2_ExtensionConfigStatus_To_v1alpha1_ExtensionConfigStatus } else { out.Conditions = nil } + out.Handlers = *(*[]ExtensionHandler)(unsafe.Pointer(&in.Handlers)) // WARNING: in.Deprecated requires manual conversion: does not exist in peer-type return nil } diff --git a/exp/runtime/api/v1beta2/extensionconfig_types.go b/exp/runtime/api/v1beta2/extensionconfig_types.go index 8cbe759f37ca..eee589e8e979 100644 --- a/exp/runtime/api/v1beta2/extensionconfig_types.go +++ b/exp/runtime/api/v1beta2/extensionconfig_types.go @@ -116,13 +116,6 @@ type ServiceReference struct { // ExtensionConfigStatus defines the observed state of ExtensionConfig. type ExtensionConfigStatus struct { - // handlers defines the current ExtensionHandlers supported by an Extension. - // +optional - // +listType=map - // +listMapKey=name - // +kubebuilder:validation:MaxItems=512 - Handlers []ExtensionHandler `json:"handlers,omitempty"` - // conditions represents the observations of a ExtensionConfig's current state. // Known condition types are Discovered, Paused. // +optional @@ -131,6 +124,13 @@ type ExtensionConfigStatus struct { // +kubebuilder:validation:MaxItems=32 Conditions []metav1.Condition `json:"conditions,omitempty"` + // handlers defines the current ExtensionHandlers supported by an Extension. + // +optional + // +listType=map + // +listMapKey=name + // +kubebuilder:validation:MaxItems=512 + Handlers []ExtensionHandler `json:"handlers,omitempty"` + // deprecated groups all the status fields that are deprecated and will be removed when all the nested field are removed. // +optional Deprecated *ExtensionConfigDeprecatedStatus `json:"deprecated,omitempty"` diff --git a/exp/runtime/api/v1beta2/zz_generated.deepcopy.go b/exp/runtime/api/v1beta2/zz_generated.deepcopy.go index 02985cf1691b..af6348193e98 100644 --- a/exp/runtime/api/v1beta2/zz_generated.deepcopy.go +++ b/exp/runtime/api/v1beta2/zz_generated.deepcopy.go @@ -166,16 +166,16 @@ func (in *ExtensionConfigSpec) DeepCopy() *ExtensionConfigSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ExtensionConfigStatus) DeepCopyInto(out *ExtensionConfigStatus) { *out = *in - if in.Handlers != nil { - in, out := &in.Handlers, &out.Handlers - *out = make([]ExtensionHandler, len(*in)) + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]v1.Condition, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]v1.Condition, len(*in)) + if in.Handlers != nil { + in, out := &in.Handlers, &out.Handlers + *out = make([]ExtensionHandler, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } From b214359f4a51fec7133073af400735d0dbb91f22 Mon Sep 17 00:00:00 2001 From: Christian Schlotter Date: Tue, 13 May 2025 13:45:39 +0200 Subject: [PATCH 07/13] fixup conversion tests --- exp/runtime/api/v1alpha1/conversion_test.go | 27 ++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/exp/runtime/api/v1alpha1/conversion_test.go b/exp/runtime/api/v1alpha1/conversion_test.go index ed2fe27f322c..9a9e66d9c91b 100644 --- a/exp/runtime/api/v1alpha1/conversion_test.go +++ b/exp/runtime/api/v1alpha1/conversion_test.go @@ -19,8 +19,10 @@ limitations under the License. package v1alpha1 import ( + "reflect" "testing" + fuzz "github.com/google/gofuzz" "k8s.io/apimachinery/pkg/api/apitesting/fuzzer" runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer" @@ -39,5 +41,28 @@ func TestFuzzyConversion(t *testing.T) { } func ExtensionConfigFuzzFuncs(_ runtimeserializer.CodecFactory) []interface{} { - return []interface{}{} + return []interface{}{ + hubExtensionConfigStatus, + spokeExtensionConfigStatus, + } +} + +func hubExtensionConfigStatus(in *addonsv1.ExtensionConfigStatus, c fuzz.Continue) { + c.FuzzNoCustom(in) + // Drop empty structs with only omit empty fields. + if in.Deprecated != nil { + if in.Deprecated.V1Beta1 == nil || reflect.DeepEqual(in.Deprecated.V1Beta1, &addonsv1.ExtensionConfigV1Beta1DeprecatedStatus{}) { + in.Deprecated = nil + } + } +} + +func spokeExtensionConfigStatus(in *ExtensionConfigStatus, c fuzz.Continue) { + c.FuzzNoCustom(in) + // Drop empty structs with only omit empty fields. + if in.V1Beta2 != nil { + if reflect.DeepEqual(in.V1Beta2, &ExtensionConfigV1Beta2Status{}) { + in.V1Beta2 = nil + } + } } From 4c5aa21144f8e4f14aa13a0f8375b018496acd6b Mon Sep 17 00:00:00 2001 From: Christian Schlotter Date: Tue, 13 May 2025 13:46:33 +0200 Subject: [PATCH 08/13] remove again binary --- test/e2e/__debug_bin2715288203 | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 test/e2e/__debug_bin2715288203 diff --git a/test/e2e/__debug_bin2715288203 b/test/e2e/__debug_bin2715288203 deleted file mode 100644 index e69de29bb2d1..000000000000 From ceae2bb2e6ef718d253d990e8f23634102cefe10 Mon Sep 17 00:00:00 2001 From: Christian Schlotter Date: Tue, 13 May 2025 13:57:06 +0200 Subject: [PATCH 09/13] fixup --- exp/runtime/api/v1alpha1/conversion_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exp/runtime/api/v1alpha1/conversion_test.go b/exp/runtime/api/v1alpha1/conversion_test.go index 9a9e66d9c91b..b831e29bbfe9 100644 --- a/exp/runtime/api/v1alpha1/conversion_test.go +++ b/exp/runtime/api/v1alpha1/conversion_test.go @@ -47,11 +47,11 @@ func ExtensionConfigFuzzFuncs(_ runtimeserializer.CodecFactory) []interface{} { } } -func hubExtensionConfigStatus(in *addonsv1.ExtensionConfigStatus, c fuzz.Continue) { +func hubExtensionConfigStatus(in *runtimev1.ExtensionConfigStatus, c fuzz.Continue) { c.FuzzNoCustom(in) // Drop empty structs with only omit empty fields. if in.Deprecated != nil { - if in.Deprecated.V1Beta1 == nil || reflect.DeepEqual(in.Deprecated.V1Beta1, &addonsv1.ExtensionConfigV1Beta1DeprecatedStatus{}) { + if in.Deprecated.V1Beta1 == nil || reflect.DeepEqual(in.Deprecated.V1Beta1, &runtimev1.ExtensionConfigV1Beta1DeprecatedStatus{}) { in.Deprecated = nil } } From 95f2916b38432610f358d7f0cd68d58635f4edb4 Mon Sep 17 00:00:00 2001 From: Christian Schlotter Date: Tue, 13 May 2025 14:14:52 +0200 Subject: [PATCH 10/13] delete import restrictions for runtime v1alpha1 --- exp/runtime/api/v1alpha1/.import-restrictions | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 exp/runtime/api/v1alpha1/.import-restrictions diff --git a/exp/runtime/api/v1alpha1/.import-restrictions b/exp/runtime/api/v1alpha1/.import-restrictions deleted file mode 100644 index a2e1dfd08133..000000000000 --- a/exp/runtime/api/v1alpha1/.import-restrictions +++ /dev/null @@ -1,5 +0,0 @@ -rules: - - selectorRegexp: sigs[.]k8s[.]io/controller-runtime - allowedPrefixes: [] - forbiddenPrefixes: - - "sigs.k8s.io/controller-runtime" From b88fd90c8d48aaee7801b9f95840e06d7711f7ec Mon Sep 17 00:00:00 2001 From: Christian Schlotter Date: Fri, 16 May 2025 07:45:55 +0200 Subject: [PATCH 11/13] fix --- exp/runtime/api/v1beta2/extensionconfig_types.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp/runtime/api/v1beta2/extensionconfig_types.go b/exp/runtime/api/v1beta2/extensionconfig_types.go index eee589e8e979..64a378c4b919 100644 --- a/exp/runtime/api/v1beta2/extensionconfig_types.go +++ b/exp/runtime/api/v1beta2/extensionconfig_types.go @@ -149,7 +149,7 @@ type ExtensionConfigDeprecatedStatus struct { // ExtensionConfigV1Beta1DeprecatedStatus groups all the status fields that are deprecated and will be removed when support for v1beta1 will be dropped. // See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context. type ExtensionConfigV1Beta1DeprecatedStatus struct { - // conditions defines current service state of the Machine. + // conditions defines current service state of the ExtensionConfig. // // Deprecated: This field is deprecated and is going to be removed when support for v1beta1 will be dropped. Please see https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more details. // From d26616991cc178f43eb561e2587bd96a9097d9e4 Mon Sep 17 00:00:00 2001 From: Christian Schlotter Date: Fri, 16 May 2025 09:41:08 +0200 Subject: [PATCH 12/13] generate --- config/crd/bases/runtime.cluster.x-k8s.io_extensionconfigs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/crd/bases/runtime.cluster.x-k8s.io_extensionconfigs.yaml b/config/crd/bases/runtime.cluster.x-k8s.io_extensionconfigs.yaml index 99973063b5c7..1dba2619925b 100644 --- a/config/crd/bases/runtime.cluster.x-k8s.io_extensionconfigs.yaml +++ b/config/crd/bases/runtime.cluster.x-k8s.io_extensionconfigs.yaml @@ -594,7 +594,7 @@ spec: properties: conditions: description: |- - conditions defines current service state of the Machine. + conditions defines current service state of the ExtensionConfig. Deprecated: This field is deprecated and is going to be removed when support for v1beta1 will be dropped. Please see https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more details. items: From 6f7a122ba3a97eb097e1bb5cdea07cc0ad3810c5 Mon Sep 17 00:00:00 2001 From: Christian Schlotter Date: Fri, 16 May 2025 14:15:33 +0200 Subject: [PATCH 13/13] extensionconfig: fixes and revert v1beta1 related changes suited only for v1beta2 api package --- .golangci.yml | 2 + ...ime.cluster.x-k8s.io_extensionconfigs.yaml | 1 + exp/runtime/api/v1alpha1/conversion.go | 16 ++++---- .../api/v1alpha1/extensionconfig_types.go | 41 ++++++++++--------- .../api/v1alpha1/zz_generated.conversion.go | 16 ++++---- .../api/v1alpha1/zz_generated.deepcopy.go | 4 +- 6 files changed, 41 insertions(+), 39 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index aa1a2c451407..ed01cfbc786e 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -156,6 +156,8 @@ linters: - pkg: sigs.k8s.io/cluster-api/exp/ipam/api/v1beta2 alias: ipamv1 # CAPI exp runtime + - pkg: sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1 + alias: runtimev1alpha1 - pkg: sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2 alias: runtimev1 - pkg: sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1 diff --git a/config/crd/bases/runtime.cluster.x-k8s.io_extensionconfigs.yaml b/config/crd/bases/runtime.cluster.x-k8s.io_extensionconfigs.yaml index 1dba2619925b..fff3f9dc6958 100644 --- a/config/crd/bases/runtime.cluster.x-k8s.io_extensionconfigs.yaml +++ b/config/crd/bases/runtime.cluster.x-k8s.io_extensionconfigs.yaml @@ -23,6 +23,7 @@ spec: jsonPath: .metadata.creationTimestamp name: Age type: date + deprecated: true name: v1alpha1 schema: openAPIV3Schema: diff --git a/exp/runtime/api/v1alpha1/conversion.go b/exp/runtime/api/v1alpha1/conversion.go index a5b2e8762b09..1adc124fe551 100644 --- a/exp/runtime/api/v1alpha1/conversion.go +++ b/exp/runtime/api/v1alpha1/conversion.go @@ -21,7 +21,7 @@ import ( apimachineryconversion "k8s.io/apimachinery/pkg/conversion" "sigs.k8s.io/controller-runtime/pkg/conversion" - clusterv1 "sigs.k8s.io/cluster-api/api/v1beta2" + clusterv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2" ) @@ -49,7 +49,7 @@ func Convert_v1beta2_ExtensionConfigStatus_To_v1alpha1_ExtensionConfigStatus(in // Retrieve legacy conditions (v1beta1) from the deprecated field. if in.Deprecated != nil && in.Deprecated.V1Beta1 != nil { if in.Deprecated.V1Beta1.Conditions != nil { - out.Conditions = in.Deprecated.V1Beta1.Conditions + clusterv1beta1.Convert_v1beta2_Deprecated_V1Beta1_Conditions_To_v1beta1_Conditions(&in.Deprecated.V1Beta1.Conditions, &out.Conditions) } } @@ -88,17 +88,15 @@ func Convert_v1alpha1_ExtensionConfigStatus_To_v1beta2_ExtensionConfigStatus(in out.Deprecated.V1Beta1 = &runtimev1.ExtensionConfigV1Beta1DeprecatedStatus{} } if in.Conditions != nil { - out.Deprecated.V1Beta1.Conditions = in.Conditions + clusterv1beta1.Convert_v1beta1_Conditions_To_v1beta2_Deprecated_V1Beta1_Conditions(&in.Conditions, &out.Deprecated.V1Beta1.Conditions) } return nil } -func Convert_v1_Condition_To_v1beta2_Condition(_ *metav1.Condition, _ *clusterv1.Condition, _ apimachineryconversion.Scope) error { - // NOTE: v1beta2 conditions should not be automatically converted into legacy (v1beta2) conditions. - return nil +func Convert_v1_Condition_To_v1beta1_Condition(in *metav1.Condition, out *clusterv1beta1.Condition, s apimachineryconversion.Scope) error { + return clusterv1beta1.Convert_v1_Condition_To_v1beta1_Condition(in, out, s) } -func Convert_v1beta2_Condition_To_v1_Condition(_ *clusterv1.Condition, _ *metav1.Condition, _ apimachineryconversion.Scope) error { - // NOTE: legacy (v1beta2) conditions should not be automatically converted into v1beta2 conditions. - return nil +func Convert_v1beta1_Condition_To_v1_Condition(in *clusterv1beta1.Condition, out *metav1.Condition, s apimachineryconversion.Scope) error { + return clusterv1beta1.Convert_v1beta1_Condition_To_v1_Condition(in, out, s) } diff --git a/exp/runtime/api/v1alpha1/extensionconfig_types.go b/exp/runtime/api/v1alpha1/extensionconfig_types.go index 6388cbd2528f..0ed3745dafdb 100644 --- a/exp/runtime/api/v1alpha1/extensionconfig_types.go +++ b/exp/runtime/api/v1alpha1/extensionconfig_types.go @@ -19,7 +19,7 @@ package v1alpha1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1 "sigs.k8s.io/cluster-api/api/v1beta2" + clusterv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" ) // ANCHOR: ExtensionConfigSpec @@ -125,7 +125,7 @@ type ExtensionConfigStatus struct { // conditions define the current service state of the ExtensionConfig. // +optional - Conditions clusterv1.Conditions `json:"conditions,omitempty"` + Conditions clusterv1beta1.Conditions `json:"conditions,omitempty"` // v1beta2 groups all the fields that will be added or modified in ExtensionConfig's status with the V1Beta2 version. // +optional @@ -203,6 +203,7 @@ const ( // +kubebuilder:object:root=true // +kubebuilder:resource:path=extensionconfigs,shortName=ext,scope=Cluster,categories=cluster-api // +kubebuilder:subresource:status +// +kubebuilder:deprecatedversion // +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time duration since creation of ExtensionConfig" // ExtensionConfig is the Schema for the ExtensionConfig API. @@ -222,26 +223,26 @@ type ExtensionConfig struct { Status ExtensionConfigStatus `json:"status,omitempty"` } -// GetV1Beta1Conditions returns the set of conditions for this object. -func (e *ExtensionConfig) GetV1Beta1Conditions() clusterv1.Conditions { +// GetConditions returns the set of conditions for this object. +func (e *ExtensionConfig) GetConditions() clusterv1beta1.Conditions { return e.Status.Conditions } -// SetV1Beta1Conditions sets the conditions on this object. -func (e *ExtensionConfig) SetV1Beta1Conditions(conditions clusterv1.Conditions) { +// SetConditions sets the conditions on this object. +func (e *ExtensionConfig) SetConditions(conditions clusterv1beta1.Conditions) { e.Status.Conditions = conditions } -// GetConditions returns the set of conditions for this object. -func (e *ExtensionConfig) GetConditions() []metav1.Condition { +// GetV1Beta2Conditions returns the set of conditions for this object. +func (e *ExtensionConfig) GetV1Beta2Conditions() []metav1.Condition { if e.Status.V1Beta2 == nil { return nil } return e.Status.V1Beta2.Conditions } -// SetConditions sets conditions for an API object. -func (e *ExtensionConfig) SetConditions(conditions []metav1.Condition) { +// SetV1Beta2Conditions sets conditions for an API object. +func (e *ExtensionConfig) SetV1Beta2Conditions(conditions []metav1.Condition) { if e.Status.V1Beta2 == nil { e.Status.V1Beta2 = &ExtensionConfigV1Beta2Status{} } @@ -267,22 +268,22 @@ func init() { // ExtensionConfig's Discovered conditions and corresponding reasons that will be used in v1Beta2 API version. const ( - // ExtensionConfigDiscoveredCondition is true if the runtime extension has been successfully discovered. - ExtensionConfigDiscoveredCondition = "Discovered" + // ExtensionConfigDiscoveredV1Beta2Condition is true if the runtime extension has been successfully discovered. + ExtensionConfigDiscoveredV1Beta2Condition = "Discovered" - // ExtensionConfigDiscoveredReason surfaces that the runtime extension has been successfully discovered. - ExtensionConfigDiscoveredReason = "Discovered" + // ExtensionConfigDiscoveredV1Beta2Reason surfaces that the runtime extension has been successfully discovered. + ExtensionConfigDiscoveredV1Beta2Reason = "Discovered" - // ExtensionConfigNotDiscoveredReason surfaces that the runtime extension has not been successfully discovered. - ExtensionConfigNotDiscoveredReason = "NotDiscovered" + // ExtensionConfigNotDiscoveredV1Beta2Reason surfaces that the runtime extension has not been successfully discovered. + ExtensionConfigNotDiscoveredV1Beta2Reason = "NotDiscovered" ) const ( - // RuntimeExtensionDiscoveredV1Beta1Condition is a condition set on an ExtensionConfig object once it has been discovered by the Runtime SDK client. - RuntimeExtensionDiscoveredV1Beta1Condition clusterv1.ConditionType = "Discovered" + // RuntimeExtensionDiscoveredCondition is a condition set on an ExtensionConfig object once it has been discovered by the Runtime SDK client. + RuntimeExtensionDiscoveredCondition clusterv1beta1.ConditionType = "Discovered" - // DiscoveryFailedV1Beta1Reason documents failure of a Discovery call. - DiscoveryFailedV1Beta1Reason string = "DiscoveryFailed" + // DiscoveryFailedReason documents failure of a Discovery call. + DiscoveryFailedReason string = "DiscoveryFailed" // InjectCAFromSecretAnnotation is the annotation that specifies that an ExtensionConfig // object wants injection of CAs. The value is a reference to a Secret diff --git a/exp/runtime/api/v1alpha1/zz_generated.conversion.go b/exp/runtime/api/v1alpha1/zz_generated.conversion.go index 09e8320bdc4d..54d3ff1c1af6 100644 --- a/exp/runtime/api/v1alpha1/zz_generated.conversion.go +++ b/exp/runtime/api/v1alpha1/zz_generated.conversion.go @@ -27,7 +27,7 @@ import ( v1 "k8s.io/apimachinery/pkg/apis/meta/v1" conversion "k8s.io/apimachinery/pkg/conversion" runtime "k8s.io/apimachinery/pkg/runtime" - apiv1beta2 "sigs.k8s.io/cluster-api/api/v1beta2" + v1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" v1beta2 "sigs.k8s.io/cluster-api/exp/runtime/api/v1beta2" ) @@ -108,8 +108,8 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddConversionFunc((*v1.Condition)(nil), (*apiv1beta2.Condition)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1_Condition_To_v1beta2_Condition(a.(*v1.Condition), b.(*apiv1beta2.Condition), scope) + if err := s.AddConversionFunc((*v1.Condition)(nil), (*v1beta1.Condition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_Condition_To_v1beta1_Condition(a.(*v1.Condition), b.(*v1beta1.Condition), scope) }); err != nil { return err } @@ -118,8 +118,8 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddConversionFunc((*apiv1beta2.Condition)(nil), (*v1.Condition)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta2_Condition_To_v1_Condition(a.(*apiv1beta2.Condition), b.(*v1.Condition), scope) + if err := s.AddConversionFunc((*v1beta1.Condition)(nil), (*v1.Condition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_Condition_To_v1_Condition(a.(*v1beta1.Condition), b.(*v1.Condition), scope) }); err != nil { return err } @@ -263,7 +263,7 @@ func autoConvert_v1alpha1_ExtensionConfigStatus_To_v1beta2_ExtensionConfigStatus in, out := &in.Conditions, &out.Conditions *out = make([]v1.Condition, len(*in)) for i := range *in { - if err := Convert_v1beta2_Condition_To_v1_Condition(&(*in)[i], &(*out)[i], s); err != nil { + if err := Convert_v1beta1_Condition_To_v1_Condition(&(*in)[i], &(*out)[i], s); err != nil { return err } } @@ -277,9 +277,9 @@ func autoConvert_v1alpha1_ExtensionConfigStatus_To_v1beta2_ExtensionConfigStatus func autoConvert_v1beta2_ExtensionConfigStatus_To_v1alpha1_ExtensionConfigStatus(in *v1beta2.ExtensionConfigStatus, out *ExtensionConfigStatus, s conversion.Scope) error { if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions - *out = make(apiv1beta2.Conditions, len(*in)) + *out = make(v1beta1.Conditions, len(*in)) for i := range *in { - if err := Convert_v1_Condition_To_v1beta2_Condition(&(*in)[i], &(*out)[i], s); err != nil { + if err := Convert_v1_Condition_To_v1beta1_Condition(&(*in)[i], &(*out)[i], s); err != nil { return err } } diff --git a/exp/runtime/api/v1alpha1/zz_generated.deepcopy.go b/exp/runtime/api/v1alpha1/zz_generated.deepcopy.go index 48181bdf01da..332b048343f3 100644 --- a/exp/runtime/api/v1alpha1/zz_generated.deepcopy.go +++ b/exp/runtime/api/v1alpha1/zz_generated.deepcopy.go @@ -23,7 +23,7 @@ package v1alpha1 import ( "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - "sigs.k8s.io/cluster-api/api/v1beta2" + "sigs.k8s.io/cluster-api/api/v1beta1" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -155,7 +155,7 @@ func (in *ExtensionConfigStatus) DeepCopyInto(out *ExtensionConfigStatus) { } if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions - *out = make(v1beta2.Conditions, len(*in)) + *out = make(v1beta1.Conditions, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) }