diff --git a/.golangci.yml b/.golangci.yml index 997567c07f92..ed01cfbc786e 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -157,6 +157,8 @@ linters: 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 alias: runtimehooksv1 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..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: @@ -356,6 +357,357 @@ 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 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 + deprecated: + description: deprecated groups all the status fields that are deprecated + and will be removed when all the nested field are removed. + properties: + v1beta1: + description: |- + 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 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 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: + 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. + 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 + 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/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/exp/runtime/api/v1alpha1/conversion.go b/exp/runtime/api/v1alpha1/conversion.go new file mode 100644 index 000000000000..1adc124fe551 --- /dev/null +++ b/exp/runtime/api/v1alpha1/conversion.go @@ -0,0 +1,102 @@ +/* +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 ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + apimachineryconversion "k8s.io/apimachinery/pkg/conversion" + "sigs.k8s.io/controller-runtime/pkg/conversion" + + clusterv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" + 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) +} + +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 (v1beta1). + out.Conditions = nil + + // Retrieve legacy conditions (v1beta1) from the deprecated field. + if in.Deprecated != nil && in.Deprecated.V1Beta1 != nil { + if in.Deprecated.V1Beta1.Conditions != nil { + clusterv1beta1.Convert_v1beta2_Deprecated_V1Beta1_Conditions_To_v1beta1_Conditions(&in.Deprecated.V1Beta1.Conditions, &out.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: v1beta1 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 (v1beta1) to the deprecated field. + if in.Conditions == nil { + return nil + } + + if out.Deprecated == nil { + out.Deprecated = &runtimev1.ExtensionConfigDeprecatedStatus{} + } + if out.Deprecated.V1Beta1 == nil { + out.Deprecated.V1Beta1 = &runtimev1.ExtensionConfigV1Beta1DeprecatedStatus{} + } + if in.Conditions != nil { + clusterv1beta1.Convert_v1beta1_Conditions_To_v1beta2_Deprecated_V1Beta1_Conditions(&in.Conditions, &out.Deprecated.V1Beta1.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_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/conversion_test.go b/exp/runtime/api/v1alpha1/conversion_test.go new file mode 100644 index 000000000000..b831e29bbfe9 --- /dev/null +++ b/exp/runtime/api/v1alpha1/conversion_test.go @@ -0,0 +1,68 @@ +//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 ( + "reflect" + "testing" + + fuzz "github.com/google/gofuzz" + "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{}{ + hubExtensionConfigStatus, + spokeExtensionConfigStatus, + } +} + +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, &runtimev1.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 + } + } +} 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..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,7 +203,7 @@ const ( // +kubebuilder:object:root=true // +kubebuilder:resource:path=extensionconfigs,shortName=ext,scope=Cluster,categories=cluster-api // +kubebuilder:subresource:status -// +kubebuilder:storageversion +// +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. @@ -223,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{} } @@ -268,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/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..54d3ff1c1af6 --- /dev/null +++ b/exp/runtime/api/v1alpha1/zz_generated.conversion.go @@ -0,0 +1,370 @@ +//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" + v1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" + 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((*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 + } + 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 + } + 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((*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 + } + 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 +} + +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 + 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 +} + +// 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 + 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 +} + +// 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)) + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]v1.Condition, len(*in)) + for i := range *in { + if err := Convert_v1beta1_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 +} + +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(v1beta1.Conditions, len(*in)) + for i := range *in { + if err := Convert_v1_Condition_To_v1beta1_Condition(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } 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 +} + +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/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]) } diff --git a/exp/runtime/api/v1alpha1/.import-restrictions b/exp/runtime/api/v1beta2/.import-restrictions similarity index 100% rename from exp/runtime/api/v1alpha1/.import-restrictions rename to exp/runtime/api/v1beta2/.import-restrictions 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..64a378c4b919 --- /dev/null +++ b/exp/runtime/api/v1beta2/extensionconfig_types.go @@ -0,0 +1,317 @@ +/* +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 { + // 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"` + + // 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"` +} + +// ExtensionConfigDeprecatedStatus groups all the status fields that are deprecated and will be removed in a future version. +type ExtensionConfigDeprecatedStatus struct { + // 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 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 + V1Beta1 *ExtensionConfigV1Beta1DeprecatedStatus `json:"v1beta1,omitempty"` +} + +// 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 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. + // + // +optional + Conditions clusterv1.Conditions `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 (m *ExtensionConfig) GetV1Beta1Conditions() clusterv1.Conditions { + if m.Status.Deprecated == nil || m.Status.Deprecated.V1Beta1 == nil { + return nil + } + return m.Status.Deprecated.V1Beta1.Conditions +} + +// SetV1Beta1Conditions sets the conditions on this object. +func (m *ExtensionConfig) SetV1Beta1Conditions(conditions clusterv1.Conditions) { + if m.Status.Deprecated == nil { + m.Status.Deprecated = &ExtensionConfigDeprecatedStatus{} + } + if m.Status.Deprecated.V1Beta1 == nil { + m.Status.Deprecated.V1Beta1 = &ExtensionConfigV1Beta1DeprecatedStatus{} + } + m.Status.Deprecated.V1Beta1.Conditions = conditions +} + +// GetConditions returns the set of conditions for this object. +func (m *ExtensionConfig) GetConditions() []metav1.Condition { + return m.Status.Conditions +} + +// SetConditions sets conditions for an API object. +func (m *ExtensionConfig) SetConditions(conditions []metav1.Condition) { + m.Status.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..af6348193e98 --- /dev/null +++ b/exp/runtime/api/v1beta2/zz_generated.deepcopy.go @@ -0,0 +1,286 @@ +//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 *ExtensionConfigDeprecatedStatus) DeepCopyInto(out *ExtensionConfigDeprecatedStatus) { + *out = *in + if in.V1Beta1 != nil { + in, out := &in.V1Beta1, &out.V1Beta1 + *out = new(ExtensionConfigV1Beta1DeprecatedStatus) + (*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 + 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.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.Handlers != nil { + in, out := &in.Handlers, &out.Handlers + *out = make([]ExtensionHandler, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Deprecated != nil { + in, out := &in.Deprecated, &out.Deprecated + *out = new(ExtensionConfigDeprecatedStatus) + (*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 *ExtensionConfigV1Beta1DeprecatedStatus) DeepCopyInto(out *ExtensionConfigV1Beta1DeprecatedStatus) { + *out = *in + 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]) + } + } +} + +// 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(ExtensionConfigV1Beta1DeprecatedStatus) + 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/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..ce0b1a436dbc 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" ) @@ -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{} 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 9f52c7dcd621..c4d4c830696c 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" @@ -158,6 +159,7 @@ func init() { _ = expv1beta1.AddToScheme(scheme) _ = expv1.AddToScheme(scheme) + _ = runtimev1alpha1.AddToScheme(scheme) _ = runtimev1.AddToScheme(scheme) _ = ipamv1alpha1.AddToScheme(scheme) 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: