diff --git a/.golangci.yml b/.golangci.yml index 3cec9310f388..893844696265 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -129,6 +129,11 @@ linters: alias: clusterv1beta1 - pkg: sigs.k8s.io/cluster-api/api/core/v1beta2 alias: clusterv1 + # CAPI contract + - pkg: sigs.k8s.io/cluster-api/api/contract/v1beta1 + alias: contractv1beta1 + - pkg: sigs.k8s.io/cluster-api/api/contract/v1beta2 + alias: contractv1 # CAPI exp addons - pkg: sigs.k8s.io/cluster-api/api/addons/v1beta1 alias: addonsv1beta1 diff --git a/Makefile b/Makefile index 6460c6df86e5..472af5c61352 100644 --- a/Makefile +++ b/Makefile @@ -120,7 +120,8 @@ SETUP_ENVTEST_BIN := setup-envtest SETUP_ENVTEST := $(abspath $(TOOLS_BIN_DIR)/$(SETUP_ENVTEST_BIN)-$(SETUP_ENVTEST_VER)) SETUP_ENVTEST_PKG := sigs.k8s.io/controller-runtime/tools/setup-envtest -CONTROLLER_GEN_VER := v0.20.0 +CONTROLLER_GEN_VER := v0.20.1-0.20260223155536-6e1b49198dff +#CONTROLLER_GEN_VER := v0.20.0 CONTROLLER_GEN_BIN := controller-gen CONTROLLER_GEN := $(abspath $(TOOLS_BIN_DIR)/$(CONTROLLER_GEN_BIN)-$(CONTROLLER_GEN_VER)) CONTROLLER_GEN_PKG := sigs.k8s.io/controller-tools/cmd/controller-gen @@ -281,8 +282,8 @@ help: # Display this help ALL_GENERATE_MODULES = core kubeadm-bootstrap kubeadm-control-plane docker-infrastructure test-extension .PHONY: generate -generate: ## Run all generate-manifests-*, generate-go-deepcopy-*, generate-go-conversions-* and generate-go-openapi targets - $(MAKE) generate-modules generate-manifests generate-go-deepcopy generate-go-conversions generate-go-openapi +generate: ## Run all generate-manifests-*, generate-go-deepcopy-*, generate-go-conversions-*, generate-go-applyconfigurations and generate-go-openapi targets + $(MAKE) generate-modules generate-manifests generate-go-deepcopy generate-go-conversions generate-go-applyconfigurations generate-go-openapi .PHONY: generate-manifests generate-manifests: $(addprefix generate-manifests-,$(ALL_GENERATE_MODULES)) ## Run all generate-manifests-* targets @@ -402,6 +403,7 @@ generate-go-deepcopy-core: $(CONTROLLER_GEN) ## Generate deepcopy go code for co $(CONTROLLER_GEN) \ object:headerFile=./hack/boilerplate/boilerplate.generatego.txt \ paths=./api/addons/... \ + paths=./api/contract/... \ paths=./api/core/... \ paths=./api/ipam/... \ paths=./api/runtime/... \ @@ -528,6 +530,15 @@ generate-go-conversions-docker-infrastructure: $(CONVERSION_GEN) ## Generate con .PHONY: generate-go-conversions-test-extension generate-go-conversions-test-extension: $(CONVERSION_GEN) ## Generate conversions go code for test runtime extension provider +.PHONY: generate-go-applyconfigurations +generate-go-applyconfigurations: $(CONTROLLER_GEN) ## Generate applyconfigurations go code for core + rm -rf ./util/applyconfigurations + $(CONTROLLER_GEN) \ + object:headerFile=./hack/boilerplate/boilerplate.generatego.txt \ + paths=./api/core/... \ + paths=./api/contract/... \ + applyconfiguration + # The tmp/sigs.k8s.io/cluster-api symlink is a workaround to make this target run outside of GOPATH .PHONY: generate-go-openapi generate-go-openapi: $(OPENAPI_GEN) ## Generate openapi go code for runtime SDK diff --git a/Tiltfile b/Tiltfile index e95c63f8935c..3e8e48657e68 100644 --- a/Tiltfile +++ b/Tiltfile @@ -111,6 +111,7 @@ providers = { "../../go.mod", "../../go.sum", "../container", + "../inmemory", "api", "controllers", "docker", diff --git a/api/contract/v1beta2/bootstrapconfig_types.go b/api/contract/v1beta2/bootstrapconfig_types.go new file mode 100644 index 000000000000..fe20edb0b4ae --- /dev/null +++ b/api/contract/v1beta2/bootstrapconfig_types.go @@ -0,0 +1,175 @@ +/* +Copyright 2026 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/core/v1beta2" + "sigs.k8s.io/cluster-api/errors" +) + +// BootstrapConfigSpec defines the desired state of BootstrapConfig. +type BootstrapConfigSpec struct { +} + +// BootstrapConfigStatus defines the observed state of BootstrapConfig. +// +kubebuilder:validation:MinProperties=1 +type BootstrapConfigStatus struct { + // conditions represents the observations of a BootstrapConfig's current state. + // +optional + // +listType=map + // +listMapKey=type + // +kubebuilder:validation:MaxItems=32 + Conditions []metav1.Condition `json:"conditions,omitempty"` + + // initialization provides observations of the BootstrapConfig initialization process. + // NOTE: Fields in this struct are part of the Cluster API contract and are used to orchestrate initial Machine provisioning. + // +optional + Initialization BootstrapConfigInitializationStatus `json:"initialization,omitempty,omitzero"` + + // dataSecretName is the name of the secret that stores the bootstrap data script. + // +optional + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:MaxLength=253 + DataSecretName string `json:"dataSecretName,omitempty"` + + // deprecated groups all the status fields that are deprecated and will be removed when all the nested field are removed. + // +optional + Deprecated *BootstrapConfigDeprecatedStatus `json:"deprecated,omitempty"` +} + +// BootstrapConfigInitializationStatus provides observations of the BootstrapConfig initialization process. +// +kubebuilder:validation:MinProperties=1 +type BootstrapConfigInitializationStatus struct { + // dataSecretCreated is true when the Machine's boostrap secret is created. + // NOTE: this field is part of the Cluster API contract, and it is used to orchestrate initial Machine provisioning. + // +optional + DataSecretCreated *bool `json:"dataSecretCreated,omitempty"` +} + +// BootstrapConfigDeprecatedStatus groups all the status fields that are deprecated and will be removed in a future version. +// See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context. +type BootstrapConfigDeprecatedStatus struct { + // v1beta1 groups all the status fields that are deprecated and will be removed when support for v1beta1 will be dropped. + // +optional + V1Beta1 *BootstrapConfigV1Beta1DeprecatedStatus `json:"v1beta1,omitempty"` +} + +// BootstrapConfigV1Beta1DeprecatedStatus 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 BootstrapConfigV1Beta1DeprecatedStatus struct { + // conditions defines current service state of the BootstrapConfig. + // + // 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"` + + // failureReason will be set in the event that there is a terminal problem + // reconciling the Machine and will contain a succinct value suitable + // for machine interpretation. + // + // This field should not be set for transitive errors that a controller + // faces that are expected to be fixed automatically over + // time (like service outages), but instead indicate that something is + // fundamentally wrong with the Machine's spec or the configuration of + // the controller, and that manual intervention is required. Examples + // of terminal errors would be invalid combinations of settings in the + // spec, values that are unsupported by the controller, or the + // responsible controller itself being critically misconfigured. + // + // Any transient errors that occur during the reconciliation of Machines + // can be added as events to the Machine object and/or logged in the + // controller's output. + // + // 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 + FailureReason *errors.MachineStatusError `json:"failureReason,omitempty"` + + // failureMessage will be set in the event that there is a terminal problem + // reconciling the Machine and will contain a more verbose string suitable + // for logging and human consumption. + // + // This field should not be set for transitive errors that a controller + // faces that are expected to be fixed automatically over + // time (like service outages), but instead indicate that something is + // fundamentally wrong with the Machine's spec or the configuration of + // the controller, and that manual intervention is required. Examples + // of terminal errors would be invalid combinations of settings in the + // spec, values that are unsupported by the controller, or the + // responsible controller itself being critically misconfigured. + // + // Any transient errors that occur during the reconciliation of Machines + // can be added as events to the Machine object and/or logged in the + // controller's output. + // + // 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 + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:MaxLength=10240 + FailureMessage *string `json:"failureMessage,omitempty"` //nolint:kubeapilinter // field will be removed when v1beta1 is removed +} + +// +kubebuilder:resource:path=BootstrapConfigs,scope=Namespaced,categories=cluster-api +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status + +// BootstrapConfig is the Schema for the BootstrapConfigs API. +type BootstrapConfig 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 BootstrapConfig. + // +optional + Spec BootstrapConfigSpec `json:"spec,omitempty,omitzero"` + // status is the observed state of BootstrapConfig. + // +optional + Status BootstrapConfigStatus `json:"status,omitempty,omitzero"` +} + +// GetV1Beta1Conditions returns the set of conditions for this object. +func (c *BootstrapConfig) GetV1Beta1Conditions() clusterv1.Conditions { + if c.Status.Deprecated == nil || c.Status.Deprecated.V1Beta1 == nil { + return nil + } + return c.Status.Deprecated.V1Beta1.Conditions +} + +// GetConditions returns the set of conditions for this object. +func (c *BootstrapConfig) GetConditions() []metav1.Condition { + return c.Status.Conditions +} + +// +kubebuilder:object:root=true + +// BootstrapConfigList contains a list of BootstrapConfig. +type BootstrapConfigList 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 BootstrapConfigs. + Items []BootstrapConfig `json:"items"` +} diff --git a/api/contract/v1beta2/doc.go b/api/contract/v1beta2/doc.go new file mode 100644 index 000000000000..51b30d3b2f76 --- /dev/null +++ b/api/contract/v1beta2/doc.go @@ -0,0 +1,23 @@ +/* +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 API Schema definitions for the v1beta2 contract. +// +kubebuilder:object:generate=true +// +groupName=cluster.x-k8s.io +// +disabled-kubebuilder:ac:generate=true +// +disabled-kubebuilder:ac:output:package="./../../../util/applyconfigurations" +// FIXME: looks like if applyconfiguration gen is enabled util/applyconfigurations/utils.go overwrites the one from the core group => report to CT repo +package v1beta2 diff --git a/api/contract/v1beta2/groupversion_info.go b/api/contract/v1beta2/groupversion_info.go new file mode 100644 index 000000000000..e3248eef0a8f --- /dev/null +++ b/api/contract/v1beta2/groupversion_info.go @@ -0,0 +1,49 @@ +/* +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" + "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: "contract.cluster.x-k8s.io", Version: "v1beta2"} + + // SchemeGroupVersion is an alias to GroupVersion, e.g. needed for applyconfigurations. + SchemeGroupVersion = GroupVersion + + // 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 +) + +func addKnownTypes(scheme *runtime.Scheme) error { + metav1.AddToGroupVersion(scheme, schema.GroupVersion{Group: "vmware.infrastructure.cluster.x-k8s.io", Version: "v1beta2"}) + scheme.AddKnownTypeWithName(schema.GroupVersionKind{Group: "vmware.infrastructure.cluster.x-k8s.io", Version: "v1beta2", Kind: "VSphereMachine"}, &InfraMachine{}) + scheme.AddKnownTypeWithName(schema.GroupVersionKind{Group: "vmware.infrastructure.cluster.x-k8s.io", Version: "v1beta2", Kind: "VSphereMachineList"}, &InfraMachineList{}) + + metav1.AddToGroupVersion(scheme, schema.GroupVersion{Group: "bootstrap.cluster.x-k8s.io", Version: "v1beta2"}) + scheme.AddKnownTypeWithName(schema.GroupVersionKind{Group: "bootstrap.cluster.x-k8s.io", Version: "v1beta2", Kind: "KubeadmConfig"}, &BootstrapConfig{}) + scheme.AddKnownTypeWithName(schema.GroupVersionKind{Group: "bootstrap.cluster.x-k8s.io", Version: "v1beta2", Kind: "KubeadmConfigList"}, &BootstrapConfigList{}) + + return nil +} diff --git a/api/contract/v1beta2/inframachine_types.go b/api/contract/v1beta2/inframachine_types.go new file mode 100644 index 000000000000..b46083c9449f --- /dev/null +++ b/api/contract/v1beta2/inframachine_types.go @@ -0,0 +1,191 @@ +/* +Copyright 2026 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/core/v1beta2" + "sigs.k8s.io/cluster-api/errors" +) + +// InfraMachineSpec defines the desired state of a v1beta2 InfraMachine. +type InfraMachineSpec struct { + // ProviderID will be the container name in ProviderID format (docker:////) + // +optional + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:MaxLength=512 + ProviderID string `json:"providerID,omitempty"` + + // FailureDomain is the failure domain unique identifier this Machine should be attached to, as defined in Cluster API. + // For this infrastructure provider, the name is equivalent to the name of the VSphereDeploymentZone. + // + // Deprecated: will be removed with v1beta1. + FailureDomain *string `json:"failureDomain,omitempty"` +} + +// InfraMachineStatus defines the observed state of InfraMachine. +type InfraMachineStatus struct { + // conditions represents the observations of a InfraMachine's current state. + // +optional + // +listType=map + // +listMapKey=type + // +kubebuilder:validation:MaxItems=32 + Conditions []metav1.Condition `json:"conditions,omitempty"` + + // initialization provides observations of the InfraMachine initialization process. + // NOTE: Fields in this struct are part of the Cluster API contract and are used to orchestrate initial Machine provisioning. + // +optional + Initialization InfraMachineInitializationStatus `json:"initialization,omitempty,omitzero"` + + // Addresses contains the associated addresses for the docker machine. + // +optional + Addresses []clusterv1.MachineAddress `json:"addresses,omitempty"` + + // failureDomain is the unique identifier of the failure domain where this Machine has been placed in. + // +optional + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:MaxLength=256 + FailureDomain string `json:"failureDomain,omitempty"` + + // deprecated groups all the status fields that are deprecated and will be removed when all the nested field are removed. + // +optional + Deprecated *InfraMachineDeprecatedStatus `json:"deprecated,omitempty"` +} + +// InfraMachineInitializationStatus provides observations of the InfraMachine initialization process. +// +kubebuilder:validation:MinProperties=1 +type InfraMachineInitializationStatus struct { + // provisioned is true when the infrastructure provider reports that the Machine's infrastructure is fully provisioned. + // NOTE: this field is part of the Cluster API contract, and it is used to orchestrate initial Machine provisioning. + // +optional + Provisioned *bool `json:"provisioned,omitempty"` +} + + +// InfraMachineDeprecatedStatus 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 InfraMachineDeprecatedStatus struct { + // v1beta1 groups all the status fields that are deprecated and will be removed when support for v1beta1 will be dropped. + // +optional + V1Beta1 *InfraMachineV1Beta1DeprecatedStatus `json:"v1beta1,omitempty"` +} + + +// InfraMachineV1Beta1DeprecatedStatus 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 InfraMachineV1Beta1DeprecatedStatus struct { + // conditions defines current service state of the DockerMachine. + // + // +optional + // + // Deprecated: This field is deprecated and is going to be removed when support for v1beta1 is dropped. + Conditions clusterv1.Conditions `json:"conditions,omitempty"` + + // failureReason will be set in the event that there is a terminal problem + // reconciling the Machine and will contain a succinct value suitable + // for machine interpretation. + // + // This field should not be set for transitive errors that a controller + // faces that are expected to be fixed automatically over + // time (like service outages), but instead indicate that something is + // fundamentally wrong with the Machine's spec or the configuration of + // the controller, and that manual intervention is required. Examples + // of terminal errors would be invalid combinations of settings in the + // spec, values that are unsupported by the controller, or the + // responsible controller itself being critically misconfigured. + // + // Any transient errors that occur during the reconciliation of Machines + // can be added as events to the Machine object and/or logged in the + // controller's output. + // + // 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 + FailureReason *errors.MachineStatusError `json:"failureReason,omitempty"` + + // failureMessage will be set in the event that there is a terminal problem + // reconciling the Machine and will contain a more verbose string suitable + // for logging and human consumption. + // + // This field should not be set for transitive errors that a controller + // faces that are expected to be fixed automatically over + // time (like service outages), but instead indicate that something is + // fundamentally wrong with the Machine's spec or the configuration of + // the controller, and that manual intervention is required. Examples + // of terminal errors would be invalid combinations of settings in the + // spec, values that are unsupported by the controller, or the + // responsible controller itself being critically misconfigured. + // + // Any transient errors that occur during the reconciliation of Machines + // can be added as events to the Machine object and/or logged in the + // controller's output. + // + // 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 + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:MaxLength=10240 + FailureMessage *string `json:"failureMessage,omitempty"` //nolint:kubeapilinter // field will be removed when v1beta1 is removed +} + +// +kubebuilder:resource:path=inframachines,scope=Namespaced,categories=cluster-api +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status + +// InfraMachine is the Schema for the InfraMachines API. +type InfraMachine 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 InfraMachine. + // +optional + Spec InfraMachineSpec `json:"spec,omitempty"` + // status is the observed state of InfraMachine. + // +optional + Status InfraMachineStatus `json:"status,omitempty"` +} + +// GetV1Beta1Conditions returns the set of conditions for this object. +func (c *InfraMachine) GetV1Beta1Conditions() clusterv1.Conditions { + if c.Status.Deprecated == nil || c.Status.Deprecated.V1Beta1 == nil { + return nil + } + return c.Status.Deprecated.V1Beta1.Conditions +} + +// GetConditions returns the set of conditions for this object. +func (c *InfraMachine) GetConditions() []metav1.Condition { + return c.Status.Conditions +} + +// +kubebuilder:object:root=true + +// InfraMachineList contains a list of InfraMachine. +type InfraMachineList 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 InfraMachines. + Items []InfraMachine `json:"items"` +} diff --git a/api/contract/v1beta2/zz_generated.deepcopy.go b/api/contract/v1beta2/zz_generated.deepcopy.go new file mode 100644 index 000000000000..51654c4d17ae --- /dev/null +++ b/api/contract/v1beta2/zz_generated.deepcopy.go @@ -0,0 +1,386 @@ +//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" + corev1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2" + "sigs.k8s.io/cluster-api/errors" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BootstrapConfig) DeepCopyInto(out *BootstrapConfig) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BootstrapConfig. +func (in *BootstrapConfig) DeepCopy() *BootstrapConfig { + if in == nil { + return nil + } + out := new(BootstrapConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BootstrapConfig) 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 *BootstrapConfigDeprecatedStatus) DeepCopyInto(out *BootstrapConfigDeprecatedStatus) { + *out = *in + if in.V1Beta1 != nil { + in, out := &in.V1Beta1, &out.V1Beta1 + *out = new(BootstrapConfigV1Beta1DeprecatedStatus) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BootstrapConfigDeprecatedStatus. +func (in *BootstrapConfigDeprecatedStatus) DeepCopy() *BootstrapConfigDeprecatedStatus { + if in == nil { + return nil + } + out := new(BootstrapConfigDeprecatedStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BootstrapConfigInitializationStatus) DeepCopyInto(out *BootstrapConfigInitializationStatus) { + *out = *in + if in.DataSecretCreated != nil { + in, out := &in.DataSecretCreated, &out.DataSecretCreated + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BootstrapConfigInitializationStatus. +func (in *BootstrapConfigInitializationStatus) DeepCopy() *BootstrapConfigInitializationStatus { + if in == nil { + return nil + } + out := new(BootstrapConfigInitializationStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BootstrapConfigList) DeepCopyInto(out *BootstrapConfigList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]BootstrapConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BootstrapConfigList. +func (in *BootstrapConfigList) DeepCopy() *BootstrapConfigList { + if in == nil { + return nil + } + out := new(BootstrapConfigList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BootstrapConfigList) 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 *BootstrapConfigSpec) DeepCopyInto(out *BootstrapConfigSpec) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BootstrapConfigSpec. +func (in *BootstrapConfigSpec) DeepCopy() *BootstrapConfigSpec { + if in == nil { + return nil + } + out := new(BootstrapConfigSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BootstrapConfigStatus) DeepCopyInto(out *BootstrapConfigStatus) { + *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]) + } + } + in.Initialization.DeepCopyInto(&out.Initialization) + if in.Deprecated != nil { + in, out := &in.Deprecated, &out.Deprecated + *out = new(BootstrapConfigDeprecatedStatus) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BootstrapConfigStatus. +func (in *BootstrapConfigStatus) DeepCopy() *BootstrapConfigStatus { + if in == nil { + return nil + } + out := new(BootstrapConfigStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BootstrapConfigV1Beta1DeprecatedStatus) DeepCopyInto(out *BootstrapConfigV1Beta1DeprecatedStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make(corev1beta2.Conditions, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.FailureReason != nil { + in, out := &in.FailureReason, &out.FailureReason + *out = new(errors.MachineStatusError) + **out = **in + } + if in.FailureMessage != nil { + in, out := &in.FailureMessage, &out.FailureMessage + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BootstrapConfigV1Beta1DeprecatedStatus. +func (in *BootstrapConfigV1Beta1DeprecatedStatus) DeepCopy() *BootstrapConfigV1Beta1DeprecatedStatus { + if in == nil { + return nil + } + out := new(BootstrapConfigV1Beta1DeprecatedStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InfraMachine) DeepCopyInto(out *InfraMachine) { + *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 InfraMachine. +func (in *InfraMachine) DeepCopy() *InfraMachine { + if in == nil { + return nil + } + out := new(InfraMachine) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *InfraMachine) 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 *InfraMachineDeprecatedStatus) DeepCopyInto(out *InfraMachineDeprecatedStatus) { + *out = *in + if in.V1Beta1 != nil { + in, out := &in.V1Beta1, &out.V1Beta1 + *out = new(InfraMachineV1Beta1DeprecatedStatus) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InfraMachineDeprecatedStatus. +func (in *InfraMachineDeprecatedStatus) DeepCopy() *InfraMachineDeprecatedStatus { + if in == nil { + return nil + } + out := new(InfraMachineDeprecatedStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InfraMachineInitializationStatus) DeepCopyInto(out *InfraMachineInitializationStatus) { + *out = *in + if in.Provisioned != nil { + in, out := &in.Provisioned, &out.Provisioned + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InfraMachineInitializationStatus. +func (in *InfraMachineInitializationStatus) DeepCopy() *InfraMachineInitializationStatus { + if in == nil { + return nil + } + out := new(InfraMachineInitializationStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InfraMachineList) DeepCopyInto(out *InfraMachineList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]InfraMachine, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InfraMachineList. +func (in *InfraMachineList) DeepCopy() *InfraMachineList { + if in == nil { + return nil + } + out := new(InfraMachineList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *InfraMachineList) 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 *InfraMachineSpec) DeepCopyInto(out *InfraMachineSpec) { + *out = *in + if in.FailureDomain != nil { + in, out := &in.FailureDomain, &out.FailureDomain + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InfraMachineSpec. +func (in *InfraMachineSpec) DeepCopy() *InfraMachineSpec { + if in == nil { + return nil + } + out := new(InfraMachineSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InfraMachineStatus) DeepCopyInto(out *InfraMachineStatus) { + *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]) + } + } + in.Initialization.DeepCopyInto(&out.Initialization) + if in.Addresses != nil { + in, out := &in.Addresses, &out.Addresses + *out = make([]corev1beta2.MachineAddress, len(*in)) + copy(*out, *in) + } + if in.Deprecated != nil { + in, out := &in.Deprecated, &out.Deprecated + *out = new(InfraMachineDeprecatedStatus) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InfraMachineStatus. +func (in *InfraMachineStatus) DeepCopy() *InfraMachineStatus { + if in == nil { + return nil + } + out := new(InfraMachineStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InfraMachineV1Beta1DeprecatedStatus) DeepCopyInto(out *InfraMachineV1Beta1DeprecatedStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make(corev1beta2.Conditions, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.FailureReason != nil { + in, out := &in.FailureReason, &out.FailureReason + *out = new(errors.MachineStatusError) + **out = **in + } + if in.FailureMessage != nil { + in, out := &in.FailureMessage, &out.FailureMessage + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InfraMachineV1Beta1DeprecatedStatus. +func (in *InfraMachineV1Beta1DeprecatedStatus) DeepCopy() *InfraMachineV1Beta1DeprecatedStatus { + if in == nil { + return nil + } + out := new(InfraMachineV1Beta1DeprecatedStatus) + in.DeepCopyInto(out) + return out +} diff --git a/api/core/v1beta1/conversion.go b/api/core/v1beta1/conversion.go index 8dd69676ae0f..59da71ee9532 100644 --- a/api/core/v1beta1/conversion.go +++ b/api/core/v1beta1/conversion.go @@ -464,6 +464,17 @@ func (dst *Machine) ConvertFrom(srcRaw conversion.Hub) error { dropEmptyStringsMachineSpec(&dst.Spec) + src = &clusterv1.Machine{ + Spec: clusterv1.MachineSpec{ + MinReadySeconds: src.Spec.MinReadySeconds, + Taints: src.Spec.Taints, + }, + Status: clusterv1.MachineStatus{ + Phase: src.Status.Phase, + FailureDomain: src.Status.FailureDomain, + Initialization: src.Status.Initialization, + }, + } return utilconversion.MarshalDataUnsafeNoCopy(src, dst) } diff --git a/api/core/v1beta2/doc.go b/api/core/v1beta2/doc.go index 504212fb6dea..509e9ab5fe6d 100644 --- a/api/core/v1beta2/doc.go +++ b/api/core/v1beta2/doc.go @@ -18,4 +18,6 @@ limitations under the License. // +k8s:openapi-gen=true // +kubebuilder:object:generate=true // +groupName=cluster.x-k8s.io +// +kubebuilder:ac:generate=true +// +kubebuilder:ac:output:package="./../../../util/applyconfigurations" package v1beta2 diff --git a/api/core/v1beta2/groupversion_info.go b/api/core/v1beta2/groupversion_info.go index 3695797c119a..d0aaaa17a02e 100644 --- a/api/core/v1beta2/groupversion_info.go +++ b/api/core/v1beta2/groupversion_info.go @@ -26,6 +26,9 @@ var ( // GroupVersion is group version used to register these objects. GroupVersion = schema.GroupVersion{Group: "cluster.x-k8s.io", Version: "v1beta2"} + // SchemeGroupVersion is an alias to GroupVersion, e.g. needed for applyconfigurations. + SchemeGroupVersion = GroupVersion + // schemeBuilder is used to add go types to the GroupVersionKind scheme. schemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) diff --git a/bootstrap/kubeadm/internal/controllers/kubeadmconfig_controller.go b/bootstrap/kubeadm/internal/controllers/kubeadmconfig_controller.go index 5634dca1c7c7..39befba026ed 100644 --- a/bootstrap/kubeadm/internal/controllers/kubeadmconfig_controller.go +++ b/bootstrap/kubeadm/internal/controllers/kubeadmconfig_controller.go @@ -368,6 +368,13 @@ func (r *KubeadmConfigReconciler) refreshBootstrapTokenIfNeeded(ctx context.Cont remoteClient, err := r.ClusterCache.GetClient(ctx, util.ObjectKey(cluster)) if err != nil { + // If connection is down, ignore the error (there is nothing we can do, the token might expire before connection is back up). + // Note: when connection state will change, a reconcile will be triggered automatically. + // FIXME: log (without making it noisy) + // if errors.Is(err, clustercache.ErrClusterNotConnected) { + // return ctrl.Result{}, nil + // } + return ctrl.Result{}, err } @@ -440,6 +447,13 @@ func (r *KubeadmConfigReconciler) rotateMachinePoolBootstrapToken(ctx context.Co log.V(2).Info("Config is owned by a MachinePool, checking if token should be rotated") remoteClient, err := r.ClusterCache.GetClient(ctx, util.ObjectKey(cluster)) if err != nil { + // If connection is down, ignore the error (there is nothing we can do, the token might expire before connection is back up). + // Note: when connection state will change, a reconcile will be triggered automatically. + // FIXME: log (without making it noisy) + // if errors.Is(err, clustercache.ErrClusterNotConnected) { + // return ctrl.Result{}, nil + // } + return ctrl.Result{}, err } @@ -684,7 +698,17 @@ func (r *KubeadmConfigReconciler) joinWorker(ctx context.Context, scope *Scope) } else if !res.IsZero() { return res, nil } - + // + // if res, err := r.reconcileDiscovery(ctx, scope.Cluster, scope.Config, certificates); err != nil || !res.IsZero() { + // return res, err + // } + // + // // If at this point there is not a discovery configuration, it does not make sense to continue. + // if !(scope.Config.Spec.JoinConfiguration.Discovery.File.KubeConfig.IsDefined() || scope.Config.Spec.JoinConfiguration.Discovery.BootstrapToken.Token != "") { + // // FIXME: log (without making it noisy) + // return ctrl.Result{}, nil + // } + // kubernetesVersion := scope.ConfigOwner.KubernetesVersion() parsedVersion, err := semver.ParseTolerant(kubernetesVersion) if err != nil { @@ -860,6 +884,16 @@ func (r *KubeadmConfigReconciler) joinControlplane(ctx context.Context, scope *S return res, nil } + // if res, err := r.reconcileDiscovery(ctx, scope.Cluster, scope.Config, certificates); err != nil || !res.IsZero() { + // return res, err + // } + // + // // If at this point there is not a discovery configuration, it does not make sense to continue. + // if !(scope.Config.Spec.JoinConfiguration.Discovery.File.KubeConfig.IsDefined() || scope.Config.Spec.JoinConfiguration.Discovery.BootstrapToken.Token != "") { + // // FIXME: log (without making it noisy) + // return ctrl.Result{}, nil + // } + // kubernetesVersion := scope.ConfigOwner.KubernetesVersion() parsedVersion, err := semver.ParseTolerant(kubernetesVersion) if err != nil { @@ -1246,6 +1280,13 @@ func (r *KubeadmConfigReconciler) reconcileDiscovery(ctx context.Context, cluste if config.Spec.JoinConfiguration.Discovery.BootstrapToken.Token == "" { remoteClient, err := r.ClusterCache.GetClient(ctx, util.ObjectKey(cluster)) if err != nil { + // If connection is down, ignore the error (the token will be created as soon as connection is up again). + // Note: when connection state will change, a reconcile will be triggered automatically. + // FIXME: log (without making it noisy) + if errors.Is(err, clustercache.ErrClusterNotConnected) { + return ctrl.Result{}, nil + } + return ctrl.Result{}, err } diff --git a/bootstrap/kubeadm/internal/locking/control_plane_init_mutex.go b/bootstrap/kubeadm/internal/locking/control_plane_init_mutex.go index 761766898323..07285536da9e 100644 --- a/bootstrap/kubeadm/internal/locking/control_plane_init_mutex.go +++ b/bootstrap/kubeadm/internal/locking/control_plane_init_mutex.go @@ -83,7 +83,9 @@ func (c *ControlPlaneInitMutex) Lock(ctx context.Context, cluster *clusterv1.Clu c.Unlock(ctx, cluster) } } - log.Info(fmt.Sprintf("Waiting for Machine %s to initialize", info.MachineName)) + + // FIXME: exponential slow down + log.Info(fmt.Sprintf("Waiting for Machine %s to initialize", klog.KRef(cluster.Namespace, info.MachineName))) return false } diff --git a/bootstrap/kubeadm/main.go b/bootstrap/kubeadm/main.go index f1cddf17621f..e289bb3a6dbf 100644 --- a/bootstrap/kubeadm/main.go +++ b/bootstrap/kubeadm/main.go @@ -226,6 +226,7 @@ func main() { ctrlOptions := ctrl.Options{ Controller: config.Controller{ + CacheSyncTimeout: 10 * time.Minute, // FIXME UsePriorityQueue: ptr.To[bool](feature.Gates.Enabled(feature.PriorityQueue)), }, Scheme: scheme, diff --git a/config/metrics/crd-metrics-config.yaml b/config/metrics/crd-metrics-config.yaml index 3a5ffce48bef..857bfec86f72 100644 --- a/config/metrics/crd-metrics-config.yaml +++ b/config/metrics/crd-metrics-config.yaml @@ -109,23 +109,6 @@ spec: type: Info help: Information about a kubeadmconfig. name: info - - each: - info: - labelsFromPath: - owner_is_controller: - - controller - owner_kind: - - kind - owner_name: - - name - owner_uid: - - uid - path: - - metadata - - ownerReferences - type: Info - help: Owner references. - name: owner - each: stateSet: labelName: status @@ -357,23 +340,6 @@ spec: type: Info help: Information about a clusterclass. name: info - - each: - info: - labelsFromPath: - owner_is_controller: - - controller - owner_kind: - - kind - owner_name: - - name - owner_uid: - - uid - path: - - metadata - - ownerReferences - type: Info - help: Owner references. - name: owner - each: stateSet: labelName: status @@ -522,23 +488,6 @@ spec: type: Info help: Information about a machine. name: info - - each: - info: - labelsFromPath: - owner_is_controller: - - controller - owner_kind: - - kind - owner_name: - - name - owner_uid: - - uid - path: - - metadata - - ownerReferences - type: Info - help: Owner references. - name: owner - each: gauge: nilIsZero: true @@ -695,23 +644,6 @@ spec: type: Info help: Information about a machinedeployment. name: info - - each: - info: - labelsFromPath: - owner_is_controller: - - controller - owner_kind: - - kind - owner_name: - - name - owner_uid: - - uid - path: - - metadata - - ownerReferences - type: Info - help: Owner references. - name: owner - each: gauge: nilIsZero: true @@ -896,6 +828,9 @@ spec: - each: info: labelsFromPath: + cluster_name: # Verify this does not lead to a duplicate metrics label + it is enough so that info metric shows up even if the two fields below don't exist + - spec + - clusterName remediation_triggerif_unhealthyinrange: - spec - remediation @@ -910,23 +845,6 @@ spec: type: Info help: Information about a machinehealthcheck. name: info - - each: - info: - labelsFromPath: - owner_is_controller: - - controller - owner_kind: - - kind - owner_name: - - name - owner_uid: - - uid - path: - - metadata - - ownerReferences - type: Info - help: Owner references. - name: owner - each: stateSet: labelName: status @@ -1077,23 +995,6 @@ spec: type: Info help: Information about a machinepool. name: info - - each: - info: - labelsFromPath: - owner_is_controller: - - controller - owner_kind: - - kind - owner_name: - - name - owner_uid: - - uid - path: - - metadata - - ownerReferences - type: Info - help: Owner references. - name: owner - each: gauge: nilIsZero: false @@ -1275,23 +1176,6 @@ spec: type: Info help: Information about a machineset. name: info - - each: - info: - labelsFromPath: - owner_is_controller: - - controller - owner_kind: - - kind - owner_name: - - name - owner_uid: - - uid - path: - - metadata - - ownerReferences - type: Info - help: Owner references. - name: owner - each: gauge: nilIsZero: true @@ -1431,23 +1315,6 @@ spec: type: Info help: Information about a kubeadmcontrolplane. name: info - - each: - info: - labelsFromPath: - owner_is_controller: - - controller - owner_kind: - - kind - owner_name: - - name - owner_uid: - - uid - path: - - metadata - - ownerReferences - type: Info - help: Owner references. - name: owner - each: gauge: nilIsZero: false diff --git a/controllers/clustercache/cluster_cache.go b/controllers/clustercache/cluster_cache.go index cceb8b1dd133..e1cb41ff04d0 100644 --- a/controllers/clustercache/cluster_cache.go +++ b/controllers/clustercache/cluster_cache.go @@ -521,6 +521,9 @@ func (cc *clusterCache) Reconcile(ctx context.Context, req reconcile.Request) (r if connected { healthCheckingState := accessor.GetHealthCheckingState(ctx) + // FIXME: "exponential slow down" + // e.g. 10 tries at accessor.config.HealthProbe.Interval (30 sec each, 5m) --> (# of tries % 10) 2 * interval + // Requeue, if health probe was already run within the HealthProbe.Interval. if requeueAfter, requeue := shouldRequeue(time.Now(), healthCheckingState.LastProbeTime, accessor.config.HealthProbe.Interval); requeue { log.V(6).Info(fmt.Sprintf("Requeuing after %s as health probe was already run within the last %s", diff --git a/controllers/external/util.go b/controllers/external/util.go index d2bc13244e82..d3ceb33ba941 100644 --- a/controllers/external/util.go +++ b/controllers/external/util.go @@ -28,8 +28,10 @@ import ( "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apiserver/pkg/storage/names" "k8s.io/klog/v2" + "k8s.io/utils/ptr" "sigs.k8s.io/controller-runtime/pkg/client" + contractv1 "sigs.k8s.io/cluster-api/api/contract/v1beta2" clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2" "sigs.k8s.io/cluster-api/internal/contract" ) @@ -81,6 +83,55 @@ func GetObjectFromContractVersionedRef(ctx context.Context, c client.Reader, ref return obj, nil } + +type ExternalType string + +var ( + ExternalTypeInfraMachine ExternalType = "InfraMachine" + + ExternalTypeBootstrapConfig ExternalType = "BootstrapConfig" +) + +// GetContractObjectFromContractVersionedRef TODO. +func GetContractObjectFromContractVersionedRef(ctx context.Context, c client.Client, ref clusterv1.ContractVersionedObjectReference, namespace string, eType ExternalType) (client.Object, error) { + if !ref.IsDefined() { + return nil, errors.Errorf("cannot get object - object reference not set") + } + + metadata, err := contract.GetGKMetadata(ctx, c, schema.GroupKind{Group: ref.APIGroup, Kind: ref.Kind}) + if err != nil { + if apierrors.IsNotFound(err) { + // We want to surface the NotFound error only for the referenced object, so we use a generic error in case CRD is not found. + return nil, errors.Errorf("failed to get object from ref: %v", err.Error()) + } + return nil, errors.Wrapf(err, "failed to get object from ref") + } + contractVersion, latestAPIVersion, err := contract.GetLatestContractAndAPIVersionFromContract(metadata, contract.Version) + if err != nil { + return nil, errors.Wrapf(err, "failed to get object from ref") + } + gvk := schema.GroupVersionKind{Group: ref.APIGroup, Version: latestAPIVersion, Kind: ref.Kind} + + var obj client.Object + switch { + case contractVersion == "v1beta2" && eType == ExternalTypeInfraMachine: + obj = &contractv1.InfraMachine{} + case contractVersion == "v1beta2" && eType == ExternalTypeBootstrapConfig: + obj = &contractv1.BootstrapConfig{} + // FIXME: implement other code paths + default: + return nil, errors.New("Unknown contract version or external type") + } + obj.GetObjectKind().SetGroupVersionKind(gvk) + obj.SetName(ref.Name) + obj.SetNamespace(namespace) + + if err := c.Get(ctx, client.ObjectKeyFromObject(obj), obj); err != nil { + return nil, errors.Wrapf(err, "failed to retrieve %s %s", gvk.Kind, klog.KRef(namespace, ref.Name)) + } + return obj, nil +} + // Delete uses the client and reference to delete an external, unstructured object. func Delete(ctx context.Context, c client.Writer, ref *corev1.ObjectReference) error { obj := new(unstructured.Unstructured) @@ -253,18 +304,35 @@ func GenerateTemplate(in *GenerateTemplateInput) (*unstructured.Unstructured, er } // FailuresFrom returns the FailureReason and FailureMessage fields from the external object status. -func FailuresFrom(obj *unstructured.Unstructured) (string, string, error) { - failureReason, _, err := unstructured.NestedString(obj.Object, "status", "failureReason") - if err != nil { - return "", "", errors.Wrapf(err, "failed to determine failureReason on %v %q", - obj.GroupVersionKind(), obj.GetName()) +func FailuresFrom(obj client.Object) (string, string, error) { + if obj, ok := obj.(*unstructured.Unstructured); ok { + failureReason, _, err := unstructured.NestedString(obj.Object, "status", "failureReason") + if err != nil { + return "", "", errors.Wrapf(err, "failed to determine failureReason on %v %q", + obj.GroupVersionKind(), obj.GetName()) + } + failureMessage, _, err := unstructured.NestedString(obj.Object, "status", "failureMessage") + if err != nil { + return "", "", errors.Wrapf(err, "failed to determine failureMessage on %v %q", + obj.GroupVersionKind(), obj.GetName()) + } + return failureReason, failureMessage, nil } - failureMessage, _, err := unstructured.NestedString(obj.Object, "status", "failureMessage") - if err != nil { - return "", "", errors.Wrapf(err, "failed to determine failureMessage on %v %q", - obj.GroupVersionKind(), obj.GetName()) + + if obj, ok := obj.(*contractv1.InfraMachine); ok { + if obj.Status.Deprecated != nil && obj.Status.Deprecated.V1Beta1 != nil { + return string(ptr.Deref(obj.Status.Deprecated.V1Beta1.FailureReason, "")), ptr.Deref(obj.Status.Deprecated.V1Beta1.FailureMessage, ""), nil + } + return "", "", nil } - return failureReason, failureMessage, nil + if obj, ok := obj.(*contractv1.BootstrapConfig); ok { + if obj.Status.Deprecated != nil && obj.Status.Deprecated.V1Beta1 != nil { + return string(ptr.Deref(obj.Status.Deprecated.V1Beta1.FailureReason, "")), ptr.Deref(obj.Status.Deprecated.V1Beta1.FailureMessage, ""), nil + } + return "", "", nil + } + + return "", "", errors.New("Unknown object type") } // IsReady returns true if the Status.Ready field on an external object is true. diff --git a/controlplane/kubeadm/internal/controllers/controller.go b/controlplane/kubeadm/internal/controllers/controller.go index 66f37d6aad22..4fc9b11499ae 100644 --- a/controlplane/kubeadm/internal/controllers/controller.go +++ b/controlplane/kubeadm/internal/controllers/controller.go @@ -203,6 +203,7 @@ func (r *KubeadmControlPlaneReconciler) Reconcile(ctx context.Context, req ctrl. return ctrl.Result{}, errors.Wrapf(err, "failed to retrieve owner Cluster") } if cluster == nil { + // FIXME: wait some time after creation before starting logging + exponential slow down log.Info("Cluster Controller has not yet set OwnerRef") return ctrl.Result{}, nil } @@ -235,6 +236,8 @@ func (r *KubeadmControlPlaneReconciler) Reconcile(ctx context.Context, req ctrl. defer func() { // Always attempt to update status. if err := r.updateStatus(ctx, controlPlane); err != nil { + // FIXME: check this. + // var connFailure *internal.RemoteClusterConnectionError if errors.As(err, &connFailure) { log.Info(fmt.Sprintf("Could not connect to workload cluster to fetch status: %s", err.Error())) @@ -244,6 +247,7 @@ func (r *KubeadmControlPlaneReconciler) Reconcile(ctx context.Context, req ctrl. } if err := r.updateV1Beta1Status(ctx, controlPlane); err != nil { + // FIXME: check this. var connFailure *internal.RemoteClusterConnectionError if errors.As(err, &connFailure) { log.Info(fmt.Sprintf("Could not connect to workload cluster to fetch deprecated v1beta1 status: %s", err.Error())) @@ -308,7 +312,7 @@ func (r *KubeadmControlPlaneReconciler) initControlPlaneScope(ctx context.Contex } // Read control plane machines - controlPlaneMachines, err := r.managementClusterUncached.GetMachinesForCluster(ctx, cluster, collections.ControlPlaneMachines(cluster.Name)) + controlPlaneMachines, err := r.managementCluster.GetMachinesForCluster(ctx, cluster, collections.ControlPlaneMachines(cluster.Name)) if err != nil { log.Error(err, "Failed to retrieve control plane machines for cluster") return nil, false, err @@ -411,6 +415,7 @@ func (r *KubeadmControlPlaneReconciler) reconcile(ctx context.Context, controlPl Message: "Waiting for Cluster status.infrastructureReady to be true", }) + // FIXME: exponential slow down log.Info("Cluster infrastructure is not ready yet") return ctrl.Result{}, nil } @@ -1030,6 +1035,7 @@ func (r *KubeadmControlPlaneReconciler) reconcileControlPlaneAndMachinesConditio EtcdMemberHealthyReason: controlplanev1.KubeadmControlPlaneMachineEtcdMemberConnectionDownReason, Message: "Remote connection not established yet", }) + // FIXME: What to do here? (is this an error?) return errors.Errorf("connection to the workload cluster not established yet") } @@ -1045,6 +1051,7 @@ func (r *KubeadmControlPlaneReconciler) reconcileControlPlaneAndMachinesConditio EtcdMemberHealthyReason: controlplanev1.KubeadmControlPlaneMachineEtcdMemberConnectionDownReason, Message: lastProbeSuccessMessage(healthCheckingState.LastProbeSuccessTime), }) + // FIXME: What to do here? return errors.Errorf("connection to the workload cluster is down") } diff --git a/controlplane/kubeadm/internal/controllers/controller_test.go b/controlplane/kubeadm/internal/controllers/controller_test.go index f6fea59c57d3..674377a2e843 100644 --- a/controlplane/kubeadm/internal/controllers/controller_test.go +++ b/controlplane/kubeadm/internal/controllers/controller_test.go @@ -2073,6 +2073,9 @@ func TestKubeadmControlPlaneReconciler_syncMachines(t *testing.T) { stopReconcile, err := reconciler.syncMachines(ctx, controlPlane) g.Expect(err).ToNot(HaveOccurred()) g.Expect(stopReconcile).To(BeFalse()) + stopReconcile, err = reconciler.syncMachines(ctx, controlPlane) + g.Expect(err).ToNot(HaveOccurred()) + g.Expect(stopReconcile).To(BeFalse()) updatedInPlaceMutatingMachine := inPlaceMutatingMachine.DeepCopy() g.Eventually(func(g Gomega) { diff --git a/controlplane/kubeadm/internal/controllers/helpers.go b/controlplane/kubeadm/internal/controllers/helpers.go index 0cbf38b57206..13f904ff76f5 100644 --- a/controlplane/kubeadm/internal/controllers/helpers.go +++ b/controlplane/kubeadm/internal/controllers/helpers.go @@ -18,7 +18,12 @@ package controllers import ( "context" + "encoding/json" + "fmt" + "maps" + "reflect" "strings" + "sync" "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" @@ -27,8 +32,11 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime/schema" kerrors "k8s.io/apimachinery/pkg/util/errors" + "k8s.io/apimachinery/pkg/util/managedfields" + "k8s.io/utils/ptr" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/structured-merge-diff/v6/typed" bootstrapv1 "sigs.k8s.io/cluster-api/api/bootstrap/kubeadm/v1beta2" controlplanev1 "sigs.k8s.io/cluster-api/api/controlplane/kubeadm/v1beta2" @@ -36,8 +44,10 @@ import ( "sigs.k8s.io/cluster-api/controllers/external" "sigs.k8s.io/cluster-api/controlplane/kubeadm/internal" "sigs.k8s.io/cluster-api/controlplane/kubeadm/internal/desiredstate" + clientutil "sigs.k8s.io/cluster-api/internal/util/client" "sigs.k8s.io/cluster-api/internal/util/ssa" "sigs.k8s.io/cluster-api/util" + acclusterv1 "sigs.k8s.io/cluster-api/util/applyconfigurations/core/v1beta2" "sigs.k8s.io/cluster-api/util/certs" v1beta1conditions "sigs.k8s.io/cluster-api/util/conditions/deprecated/v1beta1" "sigs.k8s.io/cluster-api/util/kubeconfig" @@ -291,9 +301,115 @@ func (r *KubeadmControlPlaneReconciler) updateLabelsAndAnnotations(ctx context.C updatedObject.SetLabels(desiredstate.ControlPlaneMachineLabels(kcp, cluster.Name)) updatedObject.SetAnnotations(desiredstate.ControlPlaneMachineAnnotations(kcp)) + currentPartialObjectMetadata := &metav1.PartialObjectMetadata{} + currentPartialObjectMetadata.SetGroupVersionKind(objGVK) + currentPartialObjectMetadata.SetLabels(obj.GetLabels()) + currentPartialObjectMetadata.SetAnnotations(obj.GetAnnotations()) + var managedFields []metav1.ManagedFieldsEntry + if u, ok := obj.(*unstructured.Unstructured); ok { + var err error + managedFields, err = ssa.GetUnstructuredManagedFields(u, kcpMetadataManagerName) + if err != nil { + return err + } + } else { + managedFields = obj.GetManagedFields() + } + currentPartialObjectMetadata.SetManagedFields(managedFields) + + currentPartialObjectMetaOwnedByFieldManager := &metav1.PartialObjectMetadata{} + currentPartialObjectMetaOwnedByFieldManager.SetGroupVersionKind(objGVK) + err := managedfields.ExtractInto(currentPartialObjectMetadata, Parser().Type("io.k8s.apimachinery.pkg.apis.meta.v1.PartialObjectMeta"), kcpMetadataManagerName, currentPartialObjectMetaOwnedByFieldManager, "") + if err != nil { + return err // FIXME: decide what to do on errors + } + + if maps.Equal(currentPartialObjectMetaOwnedByFieldManager.Labels, updatedObject.GetLabels()) && + maps.Equal(currentPartialObjectMetaOwnedByFieldManager.Annotations, updatedObject.GetAnnotations()) { + return nil + } + return ssa.Patch(ctx, r.Client, kcpMetadataManagerName, updatedObject, ssa.WithCachingProxy{Cache: r.ssaCache, Original: obj}) } +var parserOnce sync.Once +var parser *typed.Parser + +func Parser() *typed.Parser { + parserOnce.Do(func() { + var err error + parser, err = typed.NewParser(schemaYAML) + if err != nil { + panic(fmt.Sprintf("Failed to parse schema: %v", err)) + } + }) + return parser +} + +var schemaYAML = typed.YAMLObject(`types: +- name: io.k8s.apimachinery.pkg.apis.meta.v1.PartialObjectMeta + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta +- name: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + map: + fields: + - name: annotations + type: + map: + elementType: + scalar: string + - name: labels + type: + map: + elementType: + scalar: string + - name: managedFields + type: + list: + elementType: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ManagedFieldsEntry + elementRelationship: atomic +- name: io.k8s.apimachinery.pkg.apis.meta.v1.ManagedFieldsEntry + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +- name: __untyped_atomic_ + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic +- name: __untyped_deduced_ + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +`) + func (r *KubeadmControlPlaneReconciler) createMachine(ctx context.Context, kcp *controlplanev1.KubeadmControlPlane, machine *clusterv1.Machine) error { if err := ssa.Patch(ctx, r.Client, kcpManagerName, machine); err != nil { return err @@ -301,7 +417,8 @@ func (r *KubeadmControlPlaneReconciler) createMachine(ctx context.Context, kcp * // Remove the annotation tracking that a remediation is in progress (the remediation completed when // the replacement machine has been created above). delete(kcp.Annotations, controlplanev1.RemediationInProgressAnnotation) - return nil + + return clientutil.WaitForObjectsToBeAddedToTheCache(ctx, r.Client, "Machine creation", machine) } func (r *KubeadmControlPlaneReconciler) updateMachine(ctx context.Context, machine *clusterv1.Machine, kcp *controlplanev1.KubeadmControlPlane, cluster *clusterv1.Cluster) (*clusterv1.Machine, error) { @@ -310,9 +427,27 @@ func (r *KubeadmControlPlaneReconciler) updateMachine(ctx context.Context, machi return nil, errors.Wrap(err, "failed to apply Machine") } - err = ssa.Patch(ctx, r.Client, kcpManagerName, updatedMachine, ssa.WithCachingProxy{Cache: r.ssaCache, Original: machine}) + updatedMachineApplyConfiguration := &acclusterv1.MachineApplyConfiguration{} + updatedMachineBytes, err := json.Marshal(updatedMachine) if err != nil { return nil, err } - return updatedMachine, nil + if err := json.Unmarshal(updatedMachineBytes, updatedMachineApplyConfiguration); err != nil { + return nil, err + } + + currentMachineApplyConfiguration, err := acclusterv1.ExtractMachine(machine, kcpManagerName) + if err != nil { + return nil, err // FIXME: decide what to do on errors + } + currentMachineApplyConfiguration.UID = ptr.To(machine.UID) // FIXME: why does Extract not set UID? (probably no ownership, but we need it in updateMachine) + + if !reflect.DeepEqual(currentMachineApplyConfiguration, updatedMachineApplyConfiguration) { + err = ssa.Patch(ctx, r.Client, kcpManagerName, updatedMachine, ssa.WithCachingProxy{Cache: r.ssaCache, Original: machine}) + if err != nil { + return nil, err + } + return updatedMachine, nil + } + return machine, nil } diff --git a/controlplane/kubeadm/internal/controllers/remediation.go b/controlplane/kubeadm/internal/controllers/remediation.go index 9977c6dcecdc..4434df53fe60 100644 --- a/controlplane/kubeadm/internal/controllers/remediation.go +++ b/controlplane/kubeadm/internal/controllers/remediation.go @@ -42,6 +42,7 @@ import ( "sigs.k8s.io/cluster-api/controlplane/kubeadm/internal/etcd/util" "sigs.k8s.io/cluster-api/feature" "sigs.k8s.io/cluster-api/internal/contract" + clientutil "sigs.k8s.io/cluster-api/internal/util/client" "sigs.k8s.io/cluster-api/util/annotations" "sigs.k8s.io/cluster-api/util/collections" "sigs.k8s.io/cluster-api/util/conditions" @@ -372,6 +373,10 @@ func (r *KubeadmControlPlaneReconciler) reconcileUnhealthyMachines(ctx context.C controlplanev1.RemediationInProgressAnnotation: remediationInProgressValue, }) + if err := clientutil.WaitForObjectsToBeDeletedFromTheCache(ctx, r.Client, "Machine deletion (remediating unhealthy Machine)", machineToBeRemediated); err != nil { + return ctrl.Result{}, err + } + return ctrl.Result{RequeueAfter: time.Millisecond}, nil // Technically there is no need to requeue here. Machine deletion above triggers reconciliation. But we have to return a non-zero Result so reconcile above returns. } diff --git a/controlplane/kubeadm/internal/controllers/scale.go b/controlplane/kubeadm/internal/controllers/scale.go index 6d1e59aaf6e7..f44def5ad525 100644 --- a/controlplane/kubeadm/internal/controllers/scale.go +++ b/controlplane/kubeadm/internal/controllers/scale.go @@ -35,6 +35,7 @@ import ( clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2" "sigs.k8s.io/cluster-api/controlplane/kubeadm/internal" "sigs.k8s.io/cluster-api/feature" + clientutil "sigs.k8s.io/cluster-api/internal/util/client" "sigs.k8s.io/cluster-api/util/collections" "sigs.k8s.io/cluster-api/util/conditions" ) @@ -159,6 +160,10 @@ func (r *KubeadmControlPlaneReconciler) scaleDownControlPlane( log.WithValues(controlPlane.StatusToLogKeyAndValues(nil, machineToDelete)...). Info(fmt.Sprintf("Machine %s deleting (scale down)", klog.KObj(machineToDelete)), "Machine", klog.KObj(machineToDelete), "desiredReplicas", ptr.Deref(controlPlane.KCP.Spec.Replicas, 0), "replicas", len(controlPlane.Machines)) + if err := clientutil.WaitForObjectsToBeDeletedFromTheCache(ctx, r.Client, "Machine deletion (scale down)", machineToDelete); err != nil { + return ctrl.Result{}, err + } + return ctrl.Result{}, nil // No need to requeue here. Machine deletion above triggers reconciliation. } @@ -208,6 +213,8 @@ func (r *KubeadmControlPlaneReconciler) preflightChecks(ctx context.Context, con controlPlane.PreflightCheckResults.TopologyVersionMismatch = true // Slow down reconcile frequency, as deferring a version upgrade waits for slow processes, // e.g. workers are completing a previous upgrade step. + + // FIXME: "exponential slow down" (same below) r.controller.DeferNextReconcileForObject(controlPlane.KCP, time.Now().Add(5*time.Second)) return ctrl.Result{RequeueAfter: preflightFailedRequeueAfter} } @@ -251,6 +258,7 @@ func (r *KubeadmControlPlaneReconciler) preflightChecks(ctx context.Context, con } if err != nil { + // FIXME: exponential slow down r.recorder.Eventf(controlPlane.KCP, corev1.EventTypeWarning, "ControlPlaneUnhealthy", "Waiting for control plane to pass preflight checks to continue reconciliation: %v", err) log.Info("Waiting for control plane to pass preflight checks", "failures", err.Error()) diff --git a/controlplane/kubeadm/internal/workload_cluster_rbac.go b/controlplane/kubeadm/internal/workload_cluster_rbac.go index d7fc8b28c9d3..a5a0fbb77b15 100644 --- a/controlplane/kubeadm/internal/workload_cluster_rbac.go +++ b/controlplane/kubeadm/internal/workload_cluster_rbac.go @@ -25,8 +25,6 @@ import ( apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/controller-runtime/pkg/client" - - "sigs.k8s.io/cluster-api/util/version" ) const ( @@ -57,24 +55,23 @@ func (w *Workload) EnsureResource(ctx context.Context, obj client.Object) error // AllowClusterAdminPermissions creates ClusterRoleBinding rules to use the kubeadm:cluster-admins Cluster Role created in Kubeadm v1.29. func (w *Workload) AllowClusterAdminPermissions(ctx context.Context, targetVersion semver.Version) error { // Do nothing for Kubernetes < 1.29. - if version.Compare(targetVersion, semver.Version{Major: 1, Minor: 29, Patch: 0}, version.WithoutPreReleases()) < 0 { - return nil - } - return w.EnsureResource(ctx, &rbacv1.ClusterRoleBinding{ - ObjectMeta: metav1.ObjectMeta{ - Name: ClusterAdminsGroupAndClusterRoleBinding, - }, - RoleRef: rbacv1.RoleRef{ - APIGroup: rbacv1.GroupName, - Kind: "ClusterRole", - Name: "cluster-admin", - }, - Subjects: []rbacv1.Subject{ - { - Kind: rbacv1.GroupKind, + if targetVersion.Major == 1 && targetVersion.Minor == 29 { + return w.EnsureResource(ctx, &rbacv1.ClusterRoleBinding{ + ObjectMeta: metav1.ObjectMeta{ Name: ClusterAdminsGroupAndClusterRoleBinding, }, - }, - }, - ) + RoleRef: rbacv1.RoleRef{ + APIGroup: rbacv1.GroupName, + Kind: "ClusterRole", + Name: "cluster-admin", + }, + Subjects: []rbacv1.Subject{ + { + Kind: rbacv1.GroupKind, + Name: ClusterAdminsGroupAndClusterRoleBinding, + }, + }, + }) + } + return nil } diff --git a/controlplane/kubeadm/main.go b/controlplane/kubeadm/main.go index b4e29b7bc411..8e021a02b0d7 100644 --- a/controlplane/kubeadm/main.go +++ b/controlplane/kubeadm/main.go @@ -33,6 +33,7 @@ import ( corev1 "k8s.io/api/core/v1" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" @@ -72,8 +73,10 @@ import ( "sigs.k8s.io/cluster-api/internal/contract" internalruntimeclient "sigs.k8s.io/cluster-api/internal/runtime/client" runtimeregistry "sigs.k8s.io/cluster-api/internal/runtime/registry" + "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/apiwarnings" "sigs.k8s.io/cluster-api/util/flags" + "sigs.k8s.io/cluster-api/util/secret" "sigs.k8s.io/cluster-api/version" ) @@ -291,8 +294,92 @@ func main() { req, _ := labels.NewRequirement(clusterv1.ClusterNameLabel, selection.Exists, nil) clusterSecretCacheSelector := labels.NewSelector().Add(*req) + req, _ = labels.NewRequirement(clusterv1.MachineControlPlaneLabel, selection.Exists, nil) + controlPlaneMachineSelector := labels.NewSelector().Add(*req) + + cacheOptions := cache.Options{ + DefaultNamespaces: watchNamespaces, + SyncPeriod: &syncPeriod, + ByObject: map[client.Object]cache.ByObject{ + // Note: Only Secrets with the cluster name label are cached. + // The default client of the manager won't use the cache for secrets at all (see Client.Cache.DisableFor). + // The cached secrets will only be used by the secretCachingClient we create below. + &corev1.Secret{}: { + Label: clusterSecretCacheSelector, + // Drop data of secrets that we don't use. + Transform: func(in any) (any, error) { + if s, ok := in.(*corev1.Secret); ok { + s.SetManagedFields(nil) + if !secret.HasPurposeSuffix(s.Name) { + s.Data = nil + } + } + return in, nil + }, + }, + &clusterv1.Machine{}: { + // Drop data of worker Machines. + Transform: func(in any) (any, error) { + if m, ok := in.(*clusterv1.Machine); ok && !util.IsControlPlaneMachine(m) { + m.SetManagedFields(nil) + m.Spec = clusterv1.MachineSpec{} + m.Status = clusterv1.MachineStatus{} + } + return in, nil + }, + }, + &bootstrapv1.KubeadmConfig{}: { + // Only cache CP Machine KubeadmConfigs. + Label: controlPlaneMachineSelector, + }, + }, + } + + // FIXME: Instead of using a command-line arg here we can consider starting caches dynamically on demand and then specify the cache configuration there + infraMachineGVKs := []schema.GroupVersionKind{ + { + Group: "vmware.infrastructure.cluster.x-k8s.io", + Version: "v1beta2", + Kind: "VSphereMachine", + }, + } + for _, infraMachineGVK := range infraMachineGVKs { + im := &unstructured.Unstructured{} + im.SetGroupVersionKind(infraMachineGVK) + cacheOptions.ByObject[im] = cache.ByObject{ + // Only cache CP Machine InfraMachines. + Label: controlPlaneMachineSelector, + } + } + + infraMachineTemplateGVKs := []schema.GroupVersionKind{ + { + Group: "vmware.infrastructure.cluster.x-k8s.io", + Version: "v1beta2", + Kind: "VSphereMachineTemplate", + }, + } + for _, infraMachineTemplateGVK := range infraMachineTemplateGVKs { + u := &unstructured.Unstructured{} + u.SetGroupVersionKind(infraMachineTemplateGVK) + cacheOptions.ByObject[u] = cache.ByObject{ + // Drop data of MD InfraMachineTemplates. + Transform: func(in any) (any, error) { + if imt, ok := in.(*unstructured.Unstructured); ok { + imt.SetManagedFields(nil) + if _, ok := imt.GetLabels()[clusterv1.ClusterTopologyMachineDeploymentNameLabel]; ok { + delete(imt.Object, "spec") + delete(imt.Object, "status") + } + } + return in, nil + }, + } + } + ctrlOptions := ctrl.Options{ Controller: config.Controller{ + CacheSyncTimeout: 10 * time.Minute, // FIXME UsePriorityQueue: ptr.To[bool](feature.Gates.Enabled(feature.PriorityQueue)), }, Scheme: scheme, @@ -305,18 +392,7 @@ func main() { HealthProbeBindAddress: healthAddr, PprofBindAddress: profilerAddress, Metrics: *metricsOptions, - Cache: cache.Options{ - DefaultNamespaces: watchNamespaces, - SyncPeriod: &syncPeriod, - ByObject: map[client.Object]cache.ByObject{ - // Note: Only Secrets with the cluster name label are cached. - // The default client of the manager won't use the cache for secrets at all (see Client.Cache.DisableFor). - // The cached secrets will only be used by the secretCachingClient we create below. - &corev1.Secret{}: { - Label: clusterSecretCacheSelector, - }, - }, - }, + Cache: cacheOptions, Client: client.Options{ Cache: &client.CacheOptions{ DisableFor: []client.Object{ @@ -405,9 +481,29 @@ func setupReconcilers(ctx context.Context, mgr ctrl.Manager) { Namespaces: map[string]cache.Config{ metav1.NamespaceSystem: { LabelSelector: podSelector, + Transform: func(in any) (any, error) { + if p, ok := in.(*corev1.Pod); ok { + p.SetManagedFields(nil) + p.Spec = corev1.PodSpec{} + } + return in, nil + }, }, }, }, + &corev1.Node{}: { + Transform: func(in any) (any, error) { + if n, ok := in.(*corev1.Node); ok { + n.SetManagedFields(nil) + n.Spec = corev1.NodeSpec{ + ProviderID: n.Spec.ProviderID, + Taints: n.Spec.Taints, + } + n.Status = corev1.NodeStatus{} + } + return in, nil + }, + }, }, }, Client: clustercache.ClientOptions{ diff --git a/go.mod b/go.mod index 4b6619e83cb2..4b9e8099cddf 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,8 @@ module sigs.k8s.io/cluster-api go 1.25.0 +replace sigs.k8s.io/controller-runtime => ../controller-runtime + require ( github.com/MakeNowJust/heredoc v1.0.0 github.com/Masterminds/sprig/v3 v3.3.0 @@ -35,22 +37,22 @@ require ( go.etcd.io/etcd/client/pkg/v3 v3.6.8 go.etcd.io/etcd/client/v3 v3.6.8 go.uber.org/zap v1.27.1 - golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect - golang.org/x/oauth2 v0.36.0 + golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93 // indirect + golang.org/x/oauth2 v0.35.0 golang.org/x/text v0.34.0 gomodules.xyz/jsonpatch/v2 v2.5.0 google.golang.org/grpc v1.78.0 - k8s.io/api v0.35.2 - k8s.io/apiextensions-apiserver v0.35.2 - k8s.io/apimachinery v0.35.2 - k8s.io/apiserver v0.35.2 - k8s.io/client-go v0.35.2 - k8s.io/cluster-bootstrap v0.35.2 - k8s.io/component-base v0.35.2 + k8s.io/api v0.36.0-alpha.2 + k8s.io/apiextensions-apiserver v0.36.0-alpha.2 + k8s.io/apimachinery v0.36.0-alpha.2 + k8s.io/apiserver v0.36.0-alpha.2 + k8s.io/client-go v0.36.0-alpha.2 + k8s.io/cluster-bootstrap v0.35.1 + k8s.io/component-base v0.36.0-alpha.2 k8s.io/klog/v2 v2.130.1 - k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 - k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 - sigs.k8s.io/controller-runtime v0.23.3 + k8s.io/kube-openapi v0.0.0-20260127142750-a19766b6e2d4 + k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2 + sigs.k8s.io/controller-runtime v0.23.1 sigs.k8s.io/randfill v1.0.0 sigs.k8s.io/structured-merge-diff/v6 v6.3.2 sigs.k8s.io/yaml v1.6.0 @@ -63,7 +65,7 @@ require ( github.com/Masterminds/semver/v3 v3.4.0 // indirect github.com/NYTimes/gziphandler v1.1.1 // indirect github.com/ajeddeloh/go-json v0.0.0-20200220154158-5ae607161559 // indirect - github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect + github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b // indirect github.com/antlr4-go/antlr/v4 v4.13.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cenkalti/backoff/v5 v5.0.3 // indirect @@ -71,7 +73,7 @@ require ( github.com/coredns/caddy v1.1.1 // indirect github.com/coreos/go-semver v0.3.1 // indirect github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf // indirect - github.com/coreos/go-systemd/v22 v22.5.0 // indirect + github.com/coreos/go-systemd/v22 v22.7.0 // indirect github.com/emicklei/go-restful/v3 v3.13.0 // indirect github.com/evanphx/json-patch v5.7.0+incompatible // indirect github.com/felixge/httpsnoop v1.0.4 // indirect @@ -86,7 +88,6 @@ require ( github.com/go-viper/mapstructure/v2 v2.4.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.4 // indirect - github.com/google/btree v1.1.3 // indirect github.com/google/gnostic-models v0.7.0 // indirect github.com/google/go-querystring v1.2.0 // indirect github.com/google/pprof v0.0.0-20260115054156-294ebfa9ad83 // indirect @@ -114,9 +115,9 @@ require ( github.com/olekukonko/ll v0.1.1 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/pelletier/go-toml/v2 v2.2.4 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/common v0.66.1 // indirect - github.com/prometheus/procfs v0.16.1 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/prometheus/common v0.67.5 // indirect + github.com/prometheus/procfs v0.19.2 // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/sagikazarmark/locafero v0.11.0 // indirect github.com/shopspring/decimal v1.4.0 // indirect @@ -146,7 +147,7 @@ require ( golang.org/x/sync v0.19.0 // indirect golang.org/x/sys v0.41.0 // indirect golang.org/x/term v0.40.0 // indirect - golang.org/x/time v0.9.0 // indirect + golang.org/x/time v0.14.0 // indirect golang.org/x/tools v0.41.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 // indirect @@ -154,6 +155,6 @@ require ( gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 // indirect + sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.34.0 // indirect sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect ) diff --git a/go.sum b/go.sum index 66d083732195..1c4681f76b65 100644 --- a/go.sum +++ b/go.sum @@ -37,8 +37,8 @@ github.com/ajeddeloh/go-json v0.0.0-20160803184958-73d058cf8437/go.mod h1:otnto4 github.com/ajeddeloh/go-json v0.0.0-20200220154158-5ae607161559 h1:4SPQljF/GJ8Q+QlCWMWxRBepub4DresnOm4eI2ebFGc= github.com/ajeddeloh/go-json v0.0.0-20200220154158-5ae607161559/go.mod h1:otnto4/Icqn88WCcM4bhIJNSgsh9VLBuspyyCfvof9c= github.com/alecthomas/units v0.0.0-20210208195552-ff826a37aa15/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= -github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 h1:s6gZFSlWYmbqAuRjVTiNNhvNRfY2Wxp9nhfyel4rklc= -github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= +github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b h1:mimo19zliBX/vSQ6PWWSL9lK8qwHozUj03+zLoEB8O0= +github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b/go.mod h1:fvzegU4vN3H1qMT+8wDmzjAcDONcgo2/SZ/TyfdUOFs= github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8TVTI= github.com/antlr4-go/antlr/v4 v4.13.0/go.mod h1:pfChB/xh/Unjila75QW7+VU4TSnWnnk9UTnmpPaOR2g= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= @@ -68,8 +68,8 @@ github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03V github.com/coreos/go-systemd v0.0.0-20181031085051-9002847aa142/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf h1:iW4rZ826su+pqaw19uhpSCzhj44qo35pNgKFGqzDKkU= github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= -github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/coreos/go-systemd/v22 v22.7.0 h1:LAEzFkke61DFROc7zNLX/WA2i5J8gYqe0rSj9KI28KA= +github.com/coreos/go-systemd/v22 v22.7.0/go.mod h1:xNUYtjHu2EDXbsxz1i41wouACIwT7Ybq9o0BQhMwD0w= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -136,7 +136,6 @@ github.com/gobuffalo/flect v1.0.3/go.mod h1:A5msMlrHtLqh9umBSnvabjsMrCcCpAyzglnD github.com/goccy/go-yaml v1.18.0 h1:8W7wMFS12Pcas7KU+VVkaiCng+kG8QiFeFwzFb+rwuw= github.com/goccy/go-yaml v1.18.0/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA= github.com/godbus/dbus v0.0.0-20181025153459-66d97aec3384/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= -github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -155,8 +154,6 @@ github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= -github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= github.com/google/cel-go v0.26.0 h1:DPGjXackMpJWH680oGY4lZhYjIameYmR+/6RBdDGmaI= github.com/google/cel-go v0.26.0/go.mod h1:A9O8OU9rdvrK5MQyrqfIxo1a0u4g3sF8KB6PUIaryMM= github.com/google/gnostic-models v0.7.0 h1:qwTtogB15McXDaNqTZdzPJRHvaVJlAl+HVQnLmJEJxo= @@ -190,8 +187,10 @@ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5m github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 h1:JeSE6pjso5THxAzdVpqr6/geYxZytqFMBCOtn/ujyeo= github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674/go.mod h1:r4w70xmWCQKmi1ONH4KIaBptdivuRPyosB9RmPlGEwA= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0 h1:QGLs/O40yoNK9vmy4rhUGBVyMf1lISBGtXRpsu/Qu/o= +github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0/go.mod h1:hM2alZsMUni80N33RBe6J0e423LB+odMj7d3EMP9l20= +github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3 h1:B+8ClL/kCQkRiU82d9xajRPKYMrB7E0MbtzWVi1K4ns= +github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3/go.mod h1:NbCUVmiS4foBGBHOYlCT25+YmGpJ32dZPi75pGEUpj4= github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7 h1:X+2YciYSxvMQK0UZ7sg45ZVabVZBeBuvMkmuI2V3Fak= github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7/go.mod h1:lW34nIZuQ8UDPdkon5fmfp2l3+ZkQ2me/+oecHYLOII= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= @@ -273,17 +272,18 @@ github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8 github.com/pin/tftp v2.1.0+incompatible/go.mod h1:xVpZOMCXTy+A5QMjEVN0Glwa1sUvaJhFXbr/aAxuxGY= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= -github.com/prometheus/common v0.66.1 h1:h5E0h5/Y8niHc5DlaLlWLArTQI7tMrsfQjHV+d9ZoGs= -github.com/prometheus/common v0.66.1/go.mod h1:gcaUsgf3KfRSwHY4dIMXLPV0K/Wg1oZ8+SbZk/HH/dA= -github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= -github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= +github.com/prometheus/common v0.67.5 h1:pIgK94WWlQt1WLwAC5j2ynLaBRDiinoAb86HZHTUGI4= +github.com/prometheus/common v0.67.5/go.mod h1:SjE/0MzDEEAyrdr5Gqc6G+sXI67maCxzaT3A2+HqjUw= +github.com/prometheus/procfs v0.19.2 h1:zUMhqEW66Ex7OXIiDkll3tl9a1ZdilUOd/F6ZXw4Vws= +github.com/prometheus/procfs v0.19.2/go.mod h1:M0aotyiemPhBCM0z5w87kL22CxfcH05ZpYlu+b4J7mw= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= @@ -326,6 +326,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= @@ -360,8 +362,8 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0 h1:x7wzEgXfnzJcHDwStJT+mxOz4etr2EcexjqhBvmoakw= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0/go.mod h1:rg+RlpR5dKwaS95IyyZqj5Wd4E13lk/msnTS0Xl9lJM= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.65.0 h1:XmiuHzgJt067+a6kwyAzkhXooYVv3/TOw9cM2VfJgUM= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.65.0/go.mod h1:KDgtbWKTQs4bM+VPUr6WlL9m/WXcmkCcBlIzqxPGzmI= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.65.0 h1:7iP2uCb7sGddAr30RRS6xjKy7AZ2JtTOPA3oolgVSw8= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.65.0/go.mod h1:c7hN3ddxs/z6q9xwvfLPk+UHlWRQyaeR1LdgfL/66l0= go.opentelemetry.io/otel v1.40.0 h1:oA5YeOcpRTXq6NN7frwmwFR0Cn3RhTVZvXsP4duvCms= @@ -408,8 +410,8 @@ golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8= -golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY= +golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93 h1:fQsdNF2N+/YewlRZiricy4P1iimyPKZ/xwniHj8Q2a0= +golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93/go.mod h1:EPRbTFwzwjXj9NpYyyrvenVh9Y+GFeEvMNh7Xuz7xgU= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -454,8 +456,8 @@ golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4Iltr golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs= -golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q= +golang.org/x/oauth2 v0.35.0 h1:Mv2mzuHuZuY2+bkyWXIHMfhNdJAdwW3FuWeCPYN5GVQ= +golang.org/x/oauth2 v0.35.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -494,8 +496,8 @@ golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk= golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.9.0 h1:EsRrnYcQiGH+5FfbgvV4AP7qEZstoyrHB0DzarOQ4ZY= -golang.org/x/time v0.9.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI= +golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= @@ -594,33 +596,31 @@ honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -k8s.io/api v0.35.2 h1:tW7mWc2RpxW7HS4CoRXhtYHSzme1PN1UjGHJ1bdrtdw= -k8s.io/api v0.35.2/go.mod h1:7AJfqGoAZcwSFhOjcGM7WV05QxMMgUaChNfLTXDRE60= -k8s.io/apiextensions-apiserver v0.35.2 h1:iyStXHoJZsUXPh/nFAsjC29rjJWdSgUmG1XpApE29c0= -k8s.io/apiextensions-apiserver v0.35.2/go.mod h1:OdyGvcO1FtMDWQ+rRh/Ei3b6X3g2+ZDHd0MSRGeS8rU= -k8s.io/apimachinery v0.35.2 h1:NqsM/mmZA7sHW02JZ9RTtk3wInRgbVxL8MPfzSANAK8= -k8s.io/apimachinery v0.35.2/go.mod h1:jQCgFZFR1F4Ik7hvr2g84RTJSZegBc8yHgFWKn//hns= -k8s.io/apiserver v0.35.2 h1:rb52v0CZGEL0FkhjS+I6jHflAp7fZ4MIaKcEHX7wmDk= -k8s.io/apiserver v0.35.2/go.mod h1:CROJUAu0tfjZLyYgSeBsBan2T7LUJGh0ucWwTCSSk7g= -k8s.io/client-go v0.35.2 h1:YUfPefdGJA4aljDdayAXkc98DnPkIetMl4PrKX97W9o= -k8s.io/client-go v0.35.2/go.mod h1:4QqEwh4oQpeK8AaefZ0jwTFJw/9kIjdQi0jpKeYvz7g= -k8s.io/cluster-bootstrap v0.35.2 h1:6qGTBbRabtK3NU42fVdeKsWQy5yT7RPyqn5RmXTlGXk= -k8s.io/cluster-bootstrap v0.35.2/go.mod h1:dWypJ4l++6TDt+zJOr3aog2cOZ4kWDAnkcDdsc1vW8Q= -k8s.io/component-base v0.35.2 h1:btgR+qNrpWuRSuvWSnQYsZy88yf5gVwemvz0yw79pGc= -k8s.io/component-base v0.35.2/go.mod h1:B1iBJjooe6xIJYUucAxb26RwhAjzx0gHnqO9htWIX+0= +k8s.io/api v0.36.0-alpha.2 h1:5VQ17JO0v+9X/meq70nUzb6Ec7zuAfP+izKiJMeu9zM= +k8s.io/api v0.36.0-alpha.2/go.mod h1:VrBGsSGpBoBDkL0gV2hd11bLXcW3xX0/dg352BZthWs= +k8s.io/apiextensions-apiserver v0.36.0-alpha.2 h1:YkcqeHkx+cX/Qk9kH/IH88F0gkNIFLqVQeIG2FOyDKQ= +k8s.io/apiextensions-apiserver v0.36.0-alpha.2/go.mod h1:88Ee1E7oqcG1VwCpi0DPD8qIVX7sSz7MNLyVsZMQLl0= +k8s.io/apimachinery v0.36.0-alpha.2 h1:I3A/nvRsgV/j/AX7VXDn8XjuDz2gsfcdOTVCkKMRLsQ= +k8s.io/apimachinery v0.36.0-alpha.2/go.mod h1:7mgr/dli8ofwAbcIQXetFVX1fbOYsOYojq3AUbybVmQ= +k8s.io/apiserver v0.36.0-alpha.2 h1:7IS97LYVQ9zk6Fhykrljpn7De4VAEamR2lL/t1eWzfI= +k8s.io/apiserver v0.36.0-alpha.2/go.mod h1:jVN5pyVw9YSo5ZpmerTTAQaX2RcluD5CI2Ezyb2z4cU= +k8s.io/client-go v0.36.0-alpha.2 h1:Tk1GnYEd9KjzRG9QN84DWghJ4I91Cy5pbxSyffEZlhw= +k8s.io/client-go v0.36.0-alpha.2/go.mod h1:exn5BZg49XPJN4xNe18t4O3LJah8seb2Fxl7IyUJ6jY= +k8s.io/cluster-bootstrap v0.35.1 h1:QVqt6xak8UPa2z+Fxc52lREc6kK+3qT0nFjXZSUpo8Q= +k8s.io/cluster-bootstrap v0.35.1/go.mod h1:gfcOtdu7BmK71xdEm57MkRO3g76TzBsQsPj8pqojseA= +k8s.io/component-base v0.36.0-alpha.2 h1:V2jcC1cWxdWfLvWZ1tRv+9C9844zfJtzKE2bsltaAuI= +k8s.io/component-base v0.36.0-alpha.2/go.mod h1:0BDaTMFJnMBD+wSUbfQ/2azaNn9gx+/PzE21NPrYKhM= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= -k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 h1:Y3gxNAuB0OBLImH611+UDZcmKS3g6CthxToOb37KgwE= -k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912/go.mod h1:kdmbQkyfwUagLfXIad1y2TdrjPFWp2Q89B3qkRwf/pQ= -k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 h1:SjGebBtkBqHFOli+05xYbK8YF1Dzkbzn+gDM4X9T4Ck= -k8s.io/utils v0.0.0-20251002143259-bc988d571ff4/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/kube-openapi v0.0.0-20260127142750-a19766b6e2d4 h1:HhDfevmPS+OalTjQRKbTHppRIz01AWi8s45TMXStgYY= +k8s.io/kube-openapi v0.0.0-20260127142750-a19766b6e2d4/go.mod h1:kdmbQkyfwUagLfXIad1y2TdrjPFWp2Q89B3qkRwf/pQ= +k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2 h1:AZYQSJemyQB5eRxqcPky+/7EdBj0xi3g0ZcxxJ7vbWU= +k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 h1:jpcvIRr3GLoUoEKRkHKSmGjxb6lWwrBlJsXc+eUYQHM= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw= -sigs.k8s.io/controller-runtime v0.23.3 h1:VjB/vhoPoA9l1kEKZHBMnQF33tdCLQKJtydy4iqwZ80= -sigs.k8s.io/controller-runtime v0.23.3/go.mod h1:B6COOxKptp+YaUT5q4l6LqUJTRpizbgf9KSRNdQGns0= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.34.0 h1:hSfpvjjTQXQY2Fol2CS0QHMNs/WI1MOSGzCm1KhM5ec= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.34.0/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw= sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg= sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg= sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU= diff --git a/hack/observability/grafana/dashboards/cluster-api-logs.json b/hack/observability/grafana/dashboards/cluster-api-logs.json new file mode 100644 index 000000000000..62f2264823b9 --- /dev/null +++ b/hack/observability/grafana/dashboards/cluster-api-logs.json @@ -0,0 +1,312 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": 0, + "links": [], + "panels": [ + { + "datasource": { + "type": "loki", + "uid": "loki" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "showValues": false, + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 12, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 1, + "options": { + "legend": { + "calcs": [ + "max" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.3.0", + "targets": [ + { + "datasource": { + "type": "loki", + "uid": "loki" + }, + "direction": "backward", + "editorMode": "code", + "expr": "sum by (controller, level, msg_reducted) (count_over_time({controller=~\"$Controller\"} | json | label_format level=`{{ replace \"unknown\" \"info\" .detected_level }}` | level=~\"$Level\" | label_format msg_reducted=`{{ regexReplaceAll \"(Machine|MachineSet)\\\\s[\\\\w-]+\" .msg \"${1} REDACTED\" }}`| label_format msg_reducted=`{{ regexReplaceAll \"\\\\s[\\\\w-]*\\\\/[\\\\w-]+\" .msg_reducted \" REDACTED\" }}` | label_format msg_reducted=`{{ regexReplaceAll \"\\\\d+ (of|to) \\\\d+\" .msg_reducted \"X ${1} Y\" }}` | label_format msg_reducted=`{{ regexReplaceAll \"\\\\d+ (replicas|Machines)\" .msg_reducted \"X ${1}\" }}` | label_format msg_reducted=`{{ regexReplaceAll \"replicas \\\\(.+\\\\)\" .msg_reducted \"replicas (D)\" }}` | msg_reducted=~\"(?i)$Message.*\" [$__range]))", + "queryType": "range", + "refId": "A" + } + ], + "title": "Count over time", + "type": "timeseries" + }, + { + "datasource": { + "type": "loki", + "uid": "loki" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "showValues": false, + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 13, + "w": 24, + "x": 0, + "y": 12 + }, + "id": 3, + "options": { + "legend": { + "calcs": [ + "mean" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.3.0", + "targets": [ + { + "datasource": { + "type": "loki", + "uid": "loki" + }, + "direction": "backward", + "editorMode": "code", + "expr": "sum by (controller, level, msg_reducted) (rate({controller=~\"$Controller\"} | json | label_format level=`{{ replace \"unknown\" \"info\" .detected_level }}` | level=~\"$Level\" | label_format msg_reducted=`{{ regexReplaceAll \"(Machine|MachineSet)\\\\s[\\\\w-]+\" .msg \"${1} REDACTED\" }}`| label_format msg_reducted=`{{ regexReplaceAll \"\\\\s[\\\\w-]*\\\\/[\\\\w-]+\" .msg_reducted \" REDACTED\" }}` | label_format msg_reducted=`{{ regexReplaceAll \"\\\\d+ (of|to) \\\\d+\" .msg_reducted \"X ${1} Y\" }}` | label_format msg_reducted=`{{ regexReplaceAll \"\\\\d+ (replicas|Machines)\" .msg_reducted \"X ${1}\" }}` | label_format msg_reducted=`{{ regexReplaceAll \"replicas \\\\(.+\\\\)\" .msg_reducted \"replicas (D)\" }}` | msg_reducted=~\"(?i)$Message.*\" [1m]))", + "queryType": "range", + "refId": "A" + } + ], + "title": "Rate", + "type": "timeseries" + } + ], + "preload": false, + "schemaVersion": 42, + "tags": [], + "templating": { + "list": [ + { + "current": { + "text": [ + "All" + ], + "value": [ + "$__all" + ] + }, + "definition": "", + "includeAll": true, + "label": "Controller", + "multi": true, + "name": "Controller", + "options": [], + "query": { + "label": "controller", + "refId": "LokiVariableQueryEditor-VariableQuery", + "stream": "", + "type": 1 + }, + "refresh": 1, + "regex": "", + "type": "query" + }, + { + "allValue": ".+", + "current": { + "text": [ + "$__all" + ], + "value": [ + "$__all" + ] + }, + "includeAll": true, + "label": "Level", + "multi": true, + "name": "Level", + "options": [ + { + "selected": false, + "text": "info", + "value": "info" + }, + { + "selected": false, + "text": "error", + "value": "error" + } + ], + "query": "info,error", + "type": "custom" + }, + { + "current": { + "text": "", + "value": "" + }, + "label": "Message", + "name": "Message", + "options": [ + { + "selected": true, + "text": "", + "value": "" + } + ], + "query": "", + "type": "textbox" + } + ] + }, + "time": { + "from": "now-15m", + "to": "now" + }, + "timepicker": {}, + "timezone": "browser", + "title": "Cluster API logs", + "uid": "gzmgj7", + "version": 3 +} \ No newline at end of file diff --git a/hack/observability/loki/values.yaml b/hack/observability/loki/values.yaml index 143d92cc33bd..a0b0db2bb677 100644 --- a/hack/observability/loki/values.yaml +++ b/hack/observability/loki/values.yaml @@ -25,6 +25,8 @@ deploymentMode: SingleBinary singleBinary: replicas: 1 + persistence: + size: 256Gi gateway: enabled: false diff --git a/hack/observability/parca/values.yaml b/hack/observability/parca/values.yaml index 65f37210d086..96040a9e4730 100644 --- a/hack/observability/parca/values.yaml +++ b/hack/observability/parca/values.yaml @@ -7,6 +7,9 @@ object_storage: directory: "./tmp" server: + image: + repository: docker.io/stefanburinger405/parca + tag: v0.25.0 scrapeConfigs: - job_name: 'capi-providers' scrape_interval: 1m @@ -41,6 +44,9 @@ server: - source_labels: [__meta_kubernetes_pod_name] action: replace target_label: pod + - source_labels: [__meta_kubernetes_pod_container_port_name] + action: keep + regex: metrics # All pprof endpoints are served on the diagnostics endpoint agent: # Doesn't seem to work in kind, not sure why. diff --git a/hack/observability/prometheus/values.yaml b/hack/observability/prometheus/values.yaml index eed7ed6abefe..44c7011315c7 100644 --- a/hack/observability/prometheus/values.yaml +++ b/hack/observability/prometheus/values.yaml @@ -19,7 +19,10 @@ server: - "web.enable-remote-write-receiver" persistentVolume: # Give Prometheus more space to store metrics. - size: 20Gi + size: 256Gi + global: + scrape_interval: 60s + scrape_timeout: 59s scrapeConfigs: kubernetes-nodes: @@ -33,7 +36,8 @@ scrapeConfigs: extraScrapeConfigs: | - job_name: 'capi-providers' # 15s is a bit often for production but helps to get metrics quicker for development. - scrape_interval: 15s + scrape_interval: 30s + scrape_timeout: 29s scrape_native_histograms: true always_scrape_classic_histograms: true metrics_path: /metrics diff --git a/hack/tools/go.mod b/hack/tools/go.mod index ab0e854892e7..d856a65a77c9 100644 --- a/hack/tools/go.mod +++ b/hack/tools/go.mod @@ -6,6 +6,8 @@ replace sigs.k8s.io/cluster-api => ../../ replace sigs.k8s.io/cluster-api/test => ../../test +replace sigs.k8s.io/controller-runtime => ../../../controller-runtime + require ( cloud.google.com/go/storage v1.60.0 github.com/blang/semver/v4 v4.0.0 @@ -16,14 +18,14 @@ require ( github.com/spf13/pflag v1.0.10 github.com/valyala/fastjson v1.6.10 golang.org/x/oauth2 v0.36.0 - google.golang.org/api v0.270.0 - k8s.io/api v0.35.2 - k8s.io/apiextensions-apiserver v0.35.2 - k8s.io/apimachinery v0.35.2 - k8s.io/client-go v0.35.2 + google.golang.org/api v0.268.0 + k8s.io/api v0.36.0-alpha.2 + k8s.io/apiextensions-apiserver v0.36.0-alpha.2 + k8s.io/apimachinery v0.36.0-alpha.2 + k8s.io/client-go v0.36.0-alpha.2 k8s.io/klog/v2 v2.130.1 - k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 - k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 + k8s.io/kube-openapi v0.0.0-20260127142750-a19766b6e2d4 + k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2 sigs.k8s.io/cluster-api v0.0.0-00010101000000-000000000000 sigs.k8s.io/cluster-api/test v0.0.0-00010101000000-000000000000 sigs.k8s.io/controller-runtime v0.23.3 @@ -49,7 +51,6 @@ require ( github.com/fxamacker/cbor/v2 v2.9.0 // indirect github.com/go-jose/go-jose/v4 v4.1.3 // indirect github.com/go-viper/mapstructure/v2 v2.4.0 // indirect - github.com/google/btree v1.1.3 // indirect github.com/moby/docker-image-spec v1.3.1 // indirect github.com/moby/sys/sequential v0.6.0 // indirect github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect @@ -130,8 +131,8 @@ require ( github.com/pjbgf/sha1cd v0.3.0 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.66.1 // indirect - github.com/prometheus/procfs v0.16.1 // indirect + github.com/prometheus/common v0.67.5 // indirect + github.com/prometheus/procfs v0.19.2 // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/sagikazarmark/locafero v0.11.0 // indirect github.com/saschagrunert/go-modiff v1.3.5 // indirect @@ -168,9 +169,9 @@ require ( gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/apiserver v0.35.2 // indirect - k8s.io/cluster-bootstrap v0.35.2 // indirect - k8s.io/component-base v0.35.2 // indirect + k8s.io/apiserver v0.36.0-alpha.2 // indirect + k8s.io/cluster-bootstrap v0.35.1 // indirect + k8s.io/component-base v0.36.0-alpha.2 // indirect k8s.io/release v0.16.9 sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect sigs.k8s.io/kustomize/kyaml v0.17.2 // indirect diff --git a/hack/tools/go.sum b/hack/tools/go.sum index 739de21f5cf8..c1c3bf1f2a21 100644 --- a/hack/tools/go.sum +++ b/hack/tools/go.sum @@ -156,8 +156,6 @@ github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= -github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= -github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= github.com/google/gnostic-models v0.7.0 h1:qwTtogB15McXDaNqTZdzPJRHvaVJlAl+HVQnLmJEJxo= github.com/google/gnostic-models v0.7.0/go.mod h1:whL5G0m6dmc5cPxKc5bdKdEN3UjI7OUGxBlw57miDrQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -262,10 +260,10 @@ github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= -github.com/prometheus/common v0.66.1 h1:h5E0h5/Y8niHc5DlaLlWLArTQI7tMrsfQjHV+d9ZoGs= -github.com/prometheus/common v0.66.1/go.mod h1:gcaUsgf3KfRSwHY4dIMXLPV0K/Wg1oZ8+SbZk/HH/dA= -github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= -github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= +github.com/prometheus/common v0.67.5 h1:pIgK94WWlQt1WLwAC5j2ynLaBRDiinoAb86HZHTUGI4= +github.com/prometheus/common v0.67.5/go.mod h1:SjE/0MzDEEAyrdr5Gqc6G+sXI67maCxzaT3A2+HqjUw= +github.com/prometheus/procfs v0.19.2 h1:zUMhqEW66Ex7OXIiDkll3tl9a1ZdilUOd/F6ZXw4Vws= +github.com/prometheus/procfs v0.19.2/go.mod h1:M0aotyiemPhBCM0z5w87kL22CxfcH05ZpYlu+b4J7mw= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= @@ -428,8 +426,8 @@ gomodules.xyz/jsonpatch/v2 v2.5.0 h1:JELs8RLM12qJGXU4u/TO3V25KW8GreMKl9pdkk14RM0 gomodules.xyz/jsonpatch/v2 v2.5.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY= gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= -google.golang.org/api v0.270.0 h1:4rJZbIuWSTohczG9mG2ukSDdt9qKx4sSSHIydTN26L4= -google.golang.org/api v0.270.0/go.mod h1:5+H3/8DlXpQWrSz4RjGGwz5HfJAQSEI8Bc6JqQNH77U= +google.golang.org/api v0.268.0 h1:hgA3aS4lt9rpF5RCCkX0Q2l7DvHgvlb53y4T4u6iKkA= +google.golang.org/api v0.268.0/go.mod h1:HXMyMH496wz+dAJwD/GkAPLd3ZL33Kh0zEG32eNvy9w= google.golang.org/genproto v0.0.0-20260128011058-8636f8732409 h1:VQZ/yAbAtjkHgH80teYd2em3xtIkkHd7ZhqfH2N9CsM= google.golang.org/genproto v0.0.0-20260128011058-8636f8732409/go.mod h1:rxKD3IEILWEu3P44seeNOAwZN4SaoKaQ/2eTg4mM6EM= google.golang.org/genproto/googleapis/api v0.0.0-20260203192932-546029d2fa20 h1:7ei4lp52gK1uSejlA8AZl5AJjeLUOHBQscRQZUgAcu0= @@ -460,30 +458,28 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o= gotest.tools/v3 v3.4.0/go.mod h1:CtbdzLSsqVhDgMtKsx03ird5YTGB3ar27v0u/yKBW5g= -k8s.io/api v0.35.2 h1:tW7mWc2RpxW7HS4CoRXhtYHSzme1PN1UjGHJ1bdrtdw= -k8s.io/api v0.35.2/go.mod h1:7AJfqGoAZcwSFhOjcGM7WV05QxMMgUaChNfLTXDRE60= -k8s.io/apiextensions-apiserver v0.35.2 h1:iyStXHoJZsUXPh/nFAsjC29rjJWdSgUmG1XpApE29c0= -k8s.io/apiextensions-apiserver v0.35.2/go.mod h1:OdyGvcO1FtMDWQ+rRh/Ei3b6X3g2+ZDHd0MSRGeS8rU= -k8s.io/apimachinery v0.35.2 h1:NqsM/mmZA7sHW02JZ9RTtk3wInRgbVxL8MPfzSANAK8= -k8s.io/apimachinery v0.35.2/go.mod h1:jQCgFZFR1F4Ik7hvr2g84RTJSZegBc8yHgFWKn//hns= -k8s.io/apiserver v0.35.2 h1:rb52v0CZGEL0FkhjS+I6jHflAp7fZ4MIaKcEHX7wmDk= -k8s.io/apiserver v0.35.2/go.mod h1:CROJUAu0tfjZLyYgSeBsBan2T7LUJGh0ucWwTCSSk7g= -k8s.io/client-go v0.35.2 h1:YUfPefdGJA4aljDdayAXkc98DnPkIetMl4PrKX97W9o= -k8s.io/client-go v0.35.2/go.mod h1:4QqEwh4oQpeK8AaefZ0jwTFJw/9kIjdQi0jpKeYvz7g= -k8s.io/cluster-bootstrap v0.35.2 h1:6qGTBbRabtK3NU42fVdeKsWQy5yT7RPyqn5RmXTlGXk= -k8s.io/cluster-bootstrap v0.35.2/go.mod h1:dWypJ4l++6TDt+zJOr3aog2cOZ4kWDAnkcDdsc1vW8Q= -k8s.io/component-base v0.35.2 h1:btgR+qNrpWuRSuvWSnQYsZy88yf5gVwemvz0yw79pGc= -k8s.io/component-base v0.35.2/go.mod h1:B1iBJjooe6xIJYUucAxb26RwhAjzx0gHnqO9htWIX+0= +k8s.io/api v0.36.0-alpha.2 h1:5VQ17JO0v+9X/meq70nUzb6Ec7zuAfP+izKiJMeu9zM= +k8s.io/api v0.36.0-alpha.2/go.mod h1:VrBGsSGpBoBDkL0gV2hd11bLXcW3xX0/dg352BZthWs= +k8s.io/apiextensions-apiserver v0.36.0-alpha.2 h1:YkcqeHkx+cX/Qk9kH/IH88F0gkNIFLqVQeIG2FOyDKQ= +k8s.io/apiextensions-apiserver v0.36.0-alpha.2/go.mod h1:88Ee1E7oqcG1VwCpi0DPD8qIVX7sSz7MNLyVsZMQLl0= +k8s.io/apimachinery v0.36.0-alpha.2 h1:I3A/nvRsgV/j/AX7VXDn8XjuDz2gsfcdOTVCkKMRLsQ= +k8s.io/apimachinery v0.36.0-alpha.2/go.mod h1:7mgr/dli8ofwAbcIQXetFVX1fbOYsOYojq3AUbybVmQ= +k8s.io/apiserver v0.36.0-alpha.2 h1:7IS97LYVQ9zk6Fhykrljpn7De4VAEamR2lL/t1eWzfI= +k8s.io/apiserver v0.36.0-alpha.2/go.mod h1:jVN5pyVw9YSo5ZpmerTTAQaX2RcluD5CI2Ezyb2z4cU= +k8s.io/client-go v0.36.0-alpha.2 h1:Tk1GnYEd9KjzRG9QN84DWghJ4I91Cy5pbxSyffEZlhw= +k8s.io/client-go v0.36.0-alpha.2/go.mod h1:exn5BZg49XPJN4xNe18t4O3LJah8seb2Fxl7IyUJ6jY= +k8s.io/cluster-bootstrap v0.35.1 h1:QVqt6xak8UPa2z+Fxc52lREc6kK+3qT0nFjXZSUpo8Q= +k8s.io/cluster-bootstrap v0.35.1/go.mod h1:gfcOtdu7BmK71xdEm57MkRO3g76TzBsQsPj8pqojseA= +k8s.io/component-base v0.36.0-alpha.2 h1:V2jcC1cWxdWfLvWZ1tRv+9C9844zfJtzKE2bsltaAuI= +k8s.io/component-base v0.36.0-alpha.2/go.mod h1:0BDaTMFJnMBD+wSUbfQ/2azaNn9gx+/PzE21NPrYKhM= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= -k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 h1:Y3gxNAuB0OBLImH611+UDZcmKS3g6CthxToOb37KgwE= -k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912/go.mod h1:kdmbQkyfwUagLfXIad1y2TdrjPFWp2Q89B3qkRwf/pQ= +k8s.io/kube-openapi v0.0.0-20260127142750-a19766b6e2d4 h1:HhDfevmPS+OalTjQRKbTHppRIz01AWi8s45TMXStgYY= +k8s.io/kube-openapi v0.0.0-20260127142750-a19766b6e2d4/go.mod h1:kdmbQkyfwUagLfXIad1y2TdrjPFWp2Q89B3qkRwf/pQ= k8s.io/release v0.16.9 h1:CDqFlNmckqtXEn+YPVbDoUbnmqf1Y2R9BkHBC2vgMGo= k8s.io/release v0.16.9/go.mod h1:iRTTQYssZDVke2X7bqhdbi3cPjdmRqZXpIJsp2IRDyM= -k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 h1:SjGebBtkBqHFOli+05xYbK8YF1Dzkbzn+gDM4X9T4Ck= -k8s.io/utils v0.0.0-20251002143259-bc988d571ff4/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -sigs.k8s.io/controller-runtime v0.23.3 h1:VjB/vhoPoA9l1kEKZHBMnQF33tdCLQKJtydy4iqwZ80= -sigs.k8s.io/controller-runtime v0.23.3/go.mod h1:B6COOxKptp+YaUT5q4l6LqUJTRpizbgf9KSRNdQGns0= +k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2 h1:AZYQSJemyQB5eRxqcPky+/7EdBj0xi3g0ZcxxJ7vbWU= +k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk= sigs.k8s.io/controller-tools v0.20.1 h1:gkfMt9YodI0K85oT8rVi80NTXO/kDmabKR5Ajn5GYxs= sigs.k8s.io/controller-tools v0.20.1/go.mod h1:b4qPmjGU3iZwqn34alUU5tILhNa9+VXK+J3QV0fT/uU= sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg= diff --git a/internal/contract/version.go b/internal/contract/version.go index a5faae795719..bdbc6fb2ba71 100644 --- a/internal/contract/version.go +++ b/internal/contract/version.go @@ -174,7 +174,8 @@ func GetGKMetadata(ctx context.Context, c client.Reader, gk schema.GroupKind) (* meta := &metav1.PartialObjectMetadata{} meta.SetName(contract.CalculateCRDName(gk.Group, gk.Kind)) meta.SetGroupVersionKind(apiextensionsv1.SchemeGroupVersion.WithKind("CustomResourceDefinition")) - if err := c.Get(ctx, client.ObjectKeyFromObject(meta), meta); err != nil { + // Reading CRDs allocated a lot of memory, disabling deep copy here as we are only reading and not mutating the CRD. // FIXME: only return labels or whatever we need and clone the label map + if err := c.Get(ctx, client.ObjectKeyFromObject(meta), meta, client.UnsafeDisableDeepCopyOption(true)); err != nil { return meta, errors.Wrap(err, "failed to get CustomResourceDefinition metadata") } return meta, nil diff --git a/internal/controllers/cluster/cluster_controller.go b/internal/controllers/cluster/cluster_controller.go index 7ae57aa135e4..6c41912f39fd 100644 --- a/internal/controllers/cluster/cluster_controller.go +++ b/internal/controllers/cluster/cluster_controller.go @@ -212,6 +212,8 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (retRes ct if cluster.Spec.Topology.IsDefined() { if !cluster.Spec.ControlPlaneRef.IsDefined() || !cluster.Spec.InfrastructureRef.IsDefined() { // TODO: add a condition to surface this scenario + + // FIXME: Delay this message after x seconds from creation. log.Info("Waiting for the topology to be generated") return ctrl.Result{}, nil } diff --git a/internal/controllers/machine/machine_controller.go b/internal/controllers/machine/machine_controller.go index a19f2d8282d7..8bab20417625 100644 --- a/internal/controllers/machine/machine_controller.go +++ b/internal/controllers/machine/machine_controller.go @@ -30,7 +30,6 @@ import ( storagev1 "k8s.io/api/storage/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/types" kerrors "k8s.io/apimachinery/pkg/util/errors" "k8s.io/apimachinery/pkg/util/sets" @@ -46,6 +45,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/predicate" "sigs.k8s.io/controller-runtime/pkg/reconcile" + contractv1 "sigs.k8s.io/cluster-api/api/contract/v1beta2" clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2" "sigs.k8s.io/cluster-api/api/core/v1beta2/index" "sigs.k8s.io/cluster-api/controllers/clustercache" @@ -53,7 +53,6 @@ import ( "sigs.k8s.io/cluster-api/controllers/noderefutil" runtimeclient "sigs.k8s.io/cluster-api/exp/runtime/client" "sigs.k8s.io/cluster-api/feature" - "sigs.k8s.io/cluster-api/internal/contract" "sigs.k8s.io/cluster-api/internal/controllers/machine/drain" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/annotations" @@ -161,6 +160,7 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, opt predicates.ClusterControlPlaneInitialized(mgr.GetScheme(), *r.predicateLog), predicates.ResourceHasFilterLabel(mgr.GetScheme(), *r.predicateLog, r.WatchFilterValue), ). + // FIXME: Check WatchForProbeFailure WatchesRawSource(r.ClusterCache.GetClusterSource("machine", clusterToMachines, clustercache.WatchForProbeFailure(r.RemoteConditionsGracePeriod))). Watches( &clusterv1.MachineSet{}, @@ -410,14 +410,14 @@ type scope struct { // infraMachine is the Infrastructure Machine object that is referenced by the // Machine. It is set after reconcileInfrastructure is called. - infraMachine *unstructured.Unstructured + infraMachine *contractv1.InfraMachine // infraMachineNotFound is true if getting the infra machine object failed with an NotFound err infraMachineIsNotFound bool // bootstrapConfig is the BootstrapConfig object that is referenced by the // Machine. It is set after reconcileBootstrap is called. - bootstrapConfig *unstructured.Unstructured + bootstrapConfig *contractv1.BootstrapConfig // bootstrapConfigNotFound is true if getting the BootstrapConfig object failed with an NotFound err bootstrapConfigIsNotFound bool @@ -746,7 +746,7 @@ func (r *Reconciler) nodeVolumeDetachTimeoutExceeded(machine *clusterv1.Machine) // isDeleteNodeAllowed returns nil only if the Machine's NodeRef is not nil // and if the Machine is not the last control plane node in the cluster. -func (r *Reconciler) isDeleteNodeAllowed(ctx context.Context, cluster *clusterv1.Cluster, machine *clusterv1.Machine, infraMachine *unstructured.Unstructured) error { +func (r *Reconciler) isDeleteNodeAllowed(ctx context.Context, cluster *clusterv1.Cluster, machine *clusterv1.Machine, infraMachine *contractv1.InfraMachine) error { log := ctrl.LoggerFrom(ctx) // Return early if the cluster is being deleted. if !cluster.DeletionTimestamp.IsZero() { @@ -756,11 +756,9 @@ func (r *Reconciler) isDeleteNodeAllowed(ctx context.Context, cluster *clusterv1 var providerID string if machine.Spec.ProviderID != "" { providerID = machine.Spec.ProviderID - } else if infraMachine != nil { + } else if infraMachine != nil && infraMachine.Spec.ProviderID != "" { // Fallback to retrieve from infraMachine. - if providerIDFromInfraMachine, err := contract.InfrastructureMachine().ProviderID().Get(infraMachine); err == nil { - providerID = *providerIDFromInfraMachine - } + providerID = infraMachine.Spec.ProviderID } if !machine.Status.NodeRef.IsDefined() && providerID != "" { @@ -772,7 +770,9 @@ func (r *Reconciler) isDeleteNodeAllowed(ctx context.Context, cluster *clusterv1 // even if the node cannot be retrieved. remoteClient, err := r.ClusterCache.GetClient(ctx, util.ObjectKey(cluster)) if err != nil { + // if !errors.Is(err, clustercache.ErrClusterNotConnected) { log.Error(err, "Failed to get cluster client while deleting Machine and checking for nodes") + // } } else { node, err := r.getNode(ctx, remoteClient, providerID) if err != nil && err != ErrNodeNotFound { @@ -847,8 +847,12 @@ func (r *Reconciler) drainNode(ctx context.Context, s *scope) (ctrl.Result, erro ctx = ctrl.LoggerInto(ctx, log) remoteClient, err := r.ClusterCache.GetClient(ctx, util.ObjectKey(cluster)) + // FIXME: what we do if connection is down? + // - Keep logging error + wait for drain timeout (if set) + // - Slow down reconcile + // - ?? if err != nil { - return ctrl.Result{}, errors.Wrapf(err, "failed to drain Node %s", nodeName) + return ctrl.Result{}, errors.WithMessagef(err, "failed to drain Node %s", nodeName) } node := &corev1.Node{} @@ -950,6 +954,10 @@ func (r *Reconciler) shouldWaitForNodeVolumes(ctx context.Context, s *scope) (ct machine := s.machine remoteClient, err := r.ClusterCache.GetClient(ctx, util.ObjectKey(cluster)) + // FIXME: what we do if connection is down? + // - Keep logging error + wait for volume detach timeout (if set) + // - Slow down reconcile + // - ?? if err != nil { return ctrl.Result{}, err } @@ -1015,6 +1023,10 @@ func (r *Reconciler) shouldWaitForNodeVolumes(ctx context.Context, s *scope) (ct func (r *Reconciler) deleteNode(ctx context.Context, cluster *clusterv1.Cluster, name string) error { remoteClient, err := r.ClusterCache.GetClient(ctx, util.ObjectKey(cluster)) + // FIXME: what we do if connection is down? + // - Keep logging error + wait for timeout (if set) + // - Slow down reconcile + // - ?? if err != nil { return errors.Wrapf(err, "failed deleting Node because connection to the workload cluster is down") } @@ -1100,13 +1112,20 @@ func (r *Reconciler) watchClusterNodes(ctx context.Context, cluster *clusterv1.C return nil } - return r.ClusterCache.Watch(ctx, util.ObjectKey(cluster), clustercache.NewWatcher(clustercache.WatcherOptions{ + err := r.ClusterCache.Watch(ctx, util.ObjectKey(cluster), clustercache.NewWatcher(clustercache.WatcherOptions{ Name: "machine-watchNodes", Watcher: r.controller, Kind: &corev1.Node{}, EventHandler: handler.EnqueueRequestsFromMapFunc(r.nodeToMachine), Predicates: []predicate.TypedPredicate[client.Object]{predicates.TypedResourceIsChanged[client.Object](r.Client.Scheme(), *r.predicateLog)}, })) + + // If connection is down, ignore the error (the watch will be created as soon as connection is up again). + // Note: when connection state will change, a reconcile will be triggered automatically. + //if errors.Is(err, clustercache.ErrClusterNotConnected) { + // return nil + //} + return err } func (r *Reconciler) nodeToMachine(ctx context.Context, o client.Object) []reconcile.Request { diff --git a/internal/controllers/machine/machine_controller_inplace_update.go b/internal/controllers/machine/machine_controller_inplace_update.go index beea663b27c6..964c47a130ad 100644 --- a/internal/controllers/machine/machine_controller_inplace_update.go +++ b/internal/controllers/machine/machine_controller_inplace_update.go @@ -25,7 +25,6 @@ import ( "github.com/pkg/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - "k8s.io/apimachinery/pkg/runtime" "k8s.io/klog/v2" "k8s.io/utils/ptr" ctrl "sigs.k8s.io/controller-runtime" @@ -167,13 +166,13 @@ func (r *Reconciler) callUpdateMachineHook(ctx context.Context, s *scope) (ctrl. // requests as desired state; it is up to them to compare with current state and perform necessary actions. request := &runtimehooksv1.UpdateMachineRequest{ Desired: runtimehooksv1.UpdateMachineRequestObjects{ - Machine: *cleanupMachine(s.machine), - InfrastructureMachine: runtime.RawExtension{Object: cleanupUnstructured(s.infraMachine)}, + Machine: *cleanupMachine(s.machine), + //InfrastructureMachine: runtime.RawExtension{Object: cleanupUnstructured(s.infraMachine)}, FIXME: use cache with TTL with refresh on cache hit + based on resourceVersion => then live read }, } if s.bootstrapConfig != nil { - request.Desired.BootstrapConfig = runtime.RawExtension{Object: cleanupUnstructured(s.bootstrapConfig)} + //request.Desired.BootstrapConfig = runtime.RawExtension{Object: cleanupUnstructured(s.bootstrapConfig)} FIXME: use cache with TTL with refresh on cache hit + based on resourceVersion => then live read } response := &runtimehooksv1.UpdateMachineResponse{} diff --git a/internal/controllers/machine/machine_controller_noderef.go b/internal/controllers/machine/machine_controller_noderef.go index 04683f6d6ed2..74c327513710 100644 --- a/internal/controllers/machine/machine_controller_noderef.go +++ b/internal/controllers/machine/machine_controller_noderef.go @@ -25,10 +25,10 @@ import ( "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/klog/v2" + "sigs.k8s.io/cluster-api/controllers/clustercache" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" @@ -76,6 +76,15 @@ func (r *Reconciler) reconcileNode(ctx context.Context, s *scope) (ctrl.Result, remoteClient, err := r.ClusterCache.GetClient(ctx, util.ObjectKey(cluster)) if err != nil { + // FIXME: think a little bit more about this. + // it is probably ok to do nothing when node ref is not set (it will pop up when connection is back) + // when node ref is set, we should probably set node MachineNodeHealthy / MachineNodeReady to unknown after some time -> May be it is ok to ignore here, because it is handled when we compute tstatus + // If connection is down, ignore the error (the node ref will be read as soon as connection is up again). + // Note: when connection state will change, a reconcile will be triggered automatically. + //if errors.Is(err, clustercache.ErrClusterNotConnected) { + // return ctrl.Result{}, nil + //} + s.nodeGetError = err return ctrl.Result{}, err } @@ -95,6 +104,7 @@ func (r *Reconciler) reconcileNode(ctx context.Context, s *scope) (ctrl.Result, return ctrl.Result{}, errors.Wrapf(err, "no matching Node for Machine %q in namespace %q", machine.Name, machine.Namespace) } v1beta1conditions.MarkFalse(machine, clusterv1.MachineNodeHealthyV1Beta1Condition, clusterv1.NodeProvisioningV1Beta1Reason, clusterv1.ConditionSeverityWarning, "Waiting for a node with matching ProviderID to exist") + // FIXME: exponential slow down log.Info("Infrastructure provider reporting spec.providerID, matching Kubernetes Node is not yet available", machine.Spec.InfrastructureRef.Kind, klog.KRef(machine.Namespace, machine.Spec.InfrastructureRef.Name), "providerID", machine.Spec.ProviderID) // No need to requeue here. Nodes emit an event that triggers reconciliation. return ctrl.Result{}, nil @@ -111,6 +121,7 @@ func (r *Reconciler) reconcileNode(ctx context.Context, s *scope) (ctrl.Result, machine.Status.NodeRef = clusterv1.MachineNodeReference{ Name: s.node.Name, } + // FIXME: exponential slow down log.Info("Infrastructure provider reporting spec.providerID, Kubernetes Node is now available", machine.Spec.InfrastructureRef.Kind, klog.KRef(machine.Namespace, machine.Spec.InfrastructureRef.Name), "providerID", machine.Spec.ProviderID, "Node", klog.KRef("", machine.Status.NodeRef.Name)) r.recorder.Event(machine, corev1.EventTypeNormal, "SuccessfulSetNodeRef", machine.Status.NodeRef.Name) } @@ -128,16 +139,16 @@ func (r *Reconciler) reconcileNode(ctx context.Context, s *scope) (ctrl.Result, // Get interruptible instance status from the infrastructure provider and set the interruptible label on the node. interruptible := false - found := false + //found := false // FIXME: add this field to the InfraMachine type + update contract if necesary if infraMachine != nil { - interruptible, found, err = unstructured.NestedBool(infraMachine.Object, "status", "interruptible") - if err != nil { - return ctrl.Result{}, errors.Wrapf(err, "failed to get status interruptible from infra machine %s", klog.KObj(infraMachine)) - } - // If interruptible is set and is true add the interruptible label to the node labels. - if found && interruptible { - nodeLabels[clusterv1.InterruptibleLabel] = "" - } + //interruptible, found, err = unstructured.NestedBool(infraMachine.Object, "status", "interruptible") + //if err != nil { + // return ctrl.Result{}, errors.Wrapf(err, "failed to get status interruptible from infra machine %s", klog.KObj(infraMachine)) + //} + //// If interruptible is set and is true add the interruptible label to the node labels. + //if found && interruptible { + // nodeLabels[clusterv1.InterruptibleLabel] = "" + //} } _, nodeHadInterruptibleLabel := s.node.Labels[clusterv1.InterruptibleLabel] diff --git a/internal/controllers/machine/machine_controller_phases.go b/internal/controllers/machine/machine_controller_phases.go index b3094348fadf..d9ddea12fada 100644 --- a/internal/controllers/machine/machine_controller_phases.go +++ b/internal/controllers/machine/machine_controller_phases.go @@ -24,7 +24,6 @@ import ( "github.com/pkg/errors" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/klog/v2" "k8s.io/utils/ptr" @@ -33,6 +32,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" "sigs.k8s.io/controller-runtime/pkg/handler" + contractv1 "sigs.k8s.io/cluster-api/api/contract/v1beta2" clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2" "sigs.k8s.io/cluster-api/controllers/external" capierrors "sigs.k8s.io/cluster-api/errors" @@ -46,8 +46,8 @@ import ( var externalReadyWait = 30 * time.Second // reconcileExternal handles generic unstructured objects referenced by a Machine. -func (r *Reconciler) reconcileExternal(ctx context.Context, cluster *clusterv1.Cluster, m *clusterv1.Machine, ref clusterv1.ContractVersionedObjectReference) (*unstructured.Unstructured, error) { - obj, err := r.ensureExternalOwnershipAndWatch(ctx, cluster, m, ref) +func (r *Reconciler) reconcileExternal(ctx context.Context, cluster *clusterv1.Cluster, m *clusterv1.Machine, ref clusterv1.ContractVersionedObjectReference, eType ExternalType) (client.Object, error) { + obj, err := r.ensureExternalOwnershipAndWatch(ctx, cluster, m, ref, eType) if err != nil { return nil, err } @@ -75,20 +75,28 @@ func (r *Reconciler) reconcileExternal(ctx context.Context, cluster *clusterv1.C m.Status.Deprecated.V1Beta1 = &clusterv1.MachineV1Beta1DeprecatedStatus{} } m.Status.Deprecated.V1Beta1.FailureMessage = ptr.To( - fmt.Sprintf("Failure detected from referenced resource %v with name %q: %s", - obj.GroupVersionKind(), obj.GetName(), failureMessage), + fmt.Sprintf("Failure detected from %v %s: %s", + obj.GetObjectKind().GroupVersionKind().Kind, obj.GetName(), failureMessage), ) } return obj, nil } +type ExternalType string + +var ( + ExternalTypeInfraMachine ExternalType = "InfraMachine" + + ExternalTypeBootstrapConfig ExternalType = "BootstrapConfig" +) + // ensureExternalOwnershipAndWatch ensures that only the Machine owns the external object, // adds a watch to the external object if one does not already exist and adds the necessary labels. -func (r *Reconciler) ensureExternalOwnershipAndWatch(ctx context.Context, cluster *clusterv1.Cluster, m *clusterv1.Machine, ref clusterv1.ContractVersionedObjectReference) (*unstructured.Unstructured, error) { +func (r *Reconciler) ensureExternalOwnershipAndWatch(ctx context.Context, cluster *clusterv1.Cluster, m *clusterv1.Machine, ref clusterv1.ContractVersionedObjectReference, eType ExternalType) (client.Object, error) { log := ctrl.LoggerFrom(ctx) - obj, err := external.GetObjectFromContractVersionedRef(ctx, r.Client, ref, m.Namespace) + obj, err := external.GetContractObjectFromContractVersionedRef(ctx, r.Client, ref, m.Namespace, external.ExternalType(eType)) if err != nil { return nil, err } @@ -156,7 +164,7 @@ func (r *Reconciler) reconcileBootstrap(ctx context.Context, s *scope) (ctrl.Res } // Call generic external reconciler if we have an external reference. - obj, err := r.reconcileExternal(ctx, cluster, m, m.Spec.Bootstrap.ConfigRef) + obj, err := r.reconcileExternal(ctx, cluster, m, m.Spec.Bootstrap.ConfigRef, ExternalTypeBootstrapConfig) if err != nil { if apierrors.IsNotFound(err) { s.bootstrapConfigIsNotFound = true @@ -172,7 +180,12 @@ func (r *Reconciler) reconcileBootstrap(ctx context.Context, s *scope) (ctrl.Res } return ctrl.Result{}, err } - s.bootstrapConfig = obj + + bootstrapConfigV1Beta2, ok := obj.(*contractv1.BootstrapConfig) + if !ok { + return ctrl.Result{}, errors.New("unknown type") // FIXME: implement v1beta1 + } + s.bootstrapConfig = bootstrapConfigV1Beta2 // If the bootstrap data is populated, set ready and return. if m.Spec.Bootstrap.DataSecretName != nil { @@ -188,21 +201,14 @@ func (r *Reconciler) reconcileBootstrap(ctx context.Context, s *scope) (ctrl.Res } // Determine if the data secret was created. - var dataSecretCreated bool - if dataSecretCreatedPtr, err := contract.Bootstrap().DataSecretCreated(contractVersion).Get(s.bootstrapConfig); err != nil { - if !errors.Is(err, contract.ErrFieldNotFound) { - return ctrl.Result{}, err - } - } else { - dataSecretCreated = *dataSecretCreatedPtr - } + dataSecretCreated := ptr.Deref(s.bootstrapConfig.Status.Initialization.DataSecretCreated, false) // Report a summary of current status of the bootstrap object defined for this machine. fallBack := v1beta1conditions.WithFallbackValue(dataSecretCreated, clusterv1.WaitingForDataSecretFallbackV1Beta1Reason, clusterv1.ConditionSeverityInfo, "") if !s.machine.DeletionTimestamp.IsZero() { fallBack = v1beta1conditions.WithFallbackValue(dataSecretCreated, clusterv1.DeletingV1Beta1Reason, clusterv1.ConditionSeverityInfo, "") } - v1beta1conditions.SetMirror(m, clusterv1.BootstrapReadyV1Beta1Condition, v1beta1conditions.UnstructuredGetter(s.bootstrapConfig), fallBack) + v1beta1conditions.SetMirror(m, clusterv1.BootstrapReadyV1Beta1Condition, s.bootstrapConfig, fallBack) if !s.bootstrapConfig.GetDeletionTimestamp().IsZero() { return ctrl.Result{}, nil @@ -210,31 +216,26 @@ func (r *Reconciler) reconcileBootstrap(ctx context.Context, s *scope) (ctrl.Res // If the data secret was not created yet, return. if !dataSecretCreated { + // FIXME: exponential slow down // Only log if the Machine is a control plane Machine or the Cluster is already initialized to reduce noise. if util.IsControlPlaneMachine(m) || conditions.IsTrue(s.cluster, clusterv1.ClusterControlPlaneInitializedCondition) { log.Info(fmt.Sprintf("Waiting for bootstrap provider to generate data secret and set %s", contract.Bootstrap().DataSecretCreated(contractVersion).Path().String()), - s.bootstrapConfig.GetKind(), klog.KObj(s.bootstrapConfig)) + s.bootstrapConfig.Kind, klog.KObj(s.bootstrapConfig)) } return ctrl.Result{}, nil } // Get and set the dataSecretName containing the bootstrap data. - secretName, err := contract.Bootstrap().DataSecretName().Get(s.bootstrapConfig) - switch { - case err != nil: - return ctrl.Result{}, errors.Wrapf(err, "failed to read dataSecretName from %s %s", - s.bootstrapConfig.GetKind(), klog.KObj(s.bootstrapConfig)) - case *secretName == "": + if s.bootstrapConfig.Status.DataSecretName == "" { return ctrl.Result{}, errors.Errorf("got empty %s field from %s %s", contract.Bootstrap().DataSecretName().Path().String(), - s.bootstrapConfig.GetKind(), klog.KObj(s.bootstrapConfig)) - default: - m.Spec.Bootstrap.DataSecretName = secretName + s.bootstrapConfig.Kind, klog.KObj(s.bootstrapConfig)) } + m.Spec.Bootstrap.DataSecretName = ptr.To(s.bootstrapConfig.Status.DataSecretName) if !ptr.Deref(m.Status.Initialization.BootstrapDataSecretCreated, false) { - log.Info("Bootstrap provider generated data secret", s.bootstrapConfig.GetKind(), klog.KObj(s.bootstrapConfig), "Secret", klog.KRef(m.Namespace, *secretName)) + log.Info("Bootstrap provider generated data secret", s.bootstrapConfig.Kind, klog.KObj(s.bootstrapConfig), "Secret", klog.KRef(m.Namespace, s.bootstrapConfig.Status.DataSecretName)) } m.Status.Initialization.BootstrapDataSecretCreated = ptr.To(true) return ctrl.Result{}, nil @@ -247,7 +248,7 @@ func (r *Reconciler) reconcileInfrastructure(ctx context.Context, s *scope) (ctr m := s.machine // Call generic external reconciler. - obj, err := r.reconcileExternal(ctx, cluster, m, m.Spec.InfrastructureRef) + obj, err := r.reconcileExternal(ctx, cluster, m, m.Spec.InfrastructureRef, ExternalTypeInfraMachine) if err != nil { if apierrors.IsNotFound(err) { s.infraMachineIsNotFound = true @@ -272,29 +273,28 @@ func (r *Reconciler) reconcileInfrastructure(ctx context.Context, s *scope) (ctr return ctrl.Result{}, errors.Errorf("could not find %s %s for Machine %s", m.Spec.InfrastructureRef.Kind, klog.KRef(m.Namespace, m.Spec.InfrastructureRef.Name), klog.KObj(m)) } log.Info("Could not find InfrastructureMachine, requeuing", m.Spec.InfrastructureRef.Kind, klog.KRef(m.Namespace, m.Spec.InfrastructureRef.Name)) + // FIXME Think about dropping this requeue return ctrl.Result{RequeueAfter: externalReadyWait}, nil } return ctrl.Result{}, err } - s.infraMachine = obj + + infraMachineV1Beta2, ok := obj.(*contractv1.InfraMachine) + if !ok { + return ctrl.Result{}, errors.New("unknown type") // FIXME: implement v1beta1 + } + s.infraMachine = infraMachineV1Beta2 // Determine contract version used by the InfraMachine. - contractVersion, err := contract.GetContractVersion(ctx, r.Client, s.infraMachine.GroupVersionKind().GroupKind()) + contractVersion, err := contract.GetContractVersion(ctx, r.Client, s.infraMachine.GroupVersionKind().GroupKind()) // FIXME if err != nil { return ctrl.Result{}, err } // Determine if the InfrastructureMachine is provisioned. - var provisioned bool - if provisionedPtr, err := contract.InfrastructureMachine().Provisioned(contractVersion).Get(s.infraMachine); err != nil { - if !errors.Is(err, contract.ErrFieldNotFound) { - return ctrl.Result{}, err - } - } else { - provisioned = *provisionedPtr - } + provisioned := ptr.Deref(s.infraMachine.Status.Initialization.Provisioned, false) if provisioned && !ptr.Deref(m.Status.Initialization.InfrastructureProvisioned, false) { - log.Info("Infrastructure provider has completed provisioning", s.infraMachine.GetKind(), klog.KObj(s.infraMachine)) + log.Info("Infrastructure provider has completed provisioning", s.infraMachine.Kind, klog.KObj(s.infraMachine)) } // Report a summary of current status of the InfrastructureMachine for this Machine. @@ -302,7 +302,7 @@ func (r *Reconciler) reconcileInfrastructure(ctx context.Context, s *scope) (ctr if !s.machine.DeletionTimestamp.IsZero() { fallBack = v1beta1conditions.WithFallbackValue(provisioned, clusterv1.DeletingV1Beta1Reason, clusterv1.ConditionSeverityInfo, "") } - v1beta1conditions.SetMirror(m, clusterv1.InfrastructureReadyV1Beta1Condition, v1beta1conditions.UnstructuredGetter(s.infraMachine), fallBack) + v1beta1conditions.SetMirror(m, clusterv1.InfrastructureReadyV1Beta1Condition, s.infraMachine, fallBack) if !s.infraMachine.GetDeletionTimestamp().IsZero() { return ctrl.Result{}, nil @@ -310,68 +310,44 @@ func (r *Reconciler) reconcileInfrastructure(ctx context.Context, s *scope) (ctr // If the InfrastructureMachine is not provisioned (and it wasn't already provisioned before), return. if !provisioned && !ptr.Deref(m.Status.Initialization.InfrastructureProvisioned, false) { - // Only log if the Machine is a control plane Machine or the Cluster is already initialized to reduce noise. + // FIXME Exponential slow down + // Only log if the bootstrap secret has been already created, the Machine is a control plane Machine or the Cluster is already initialized to reduce noise. + // if ptr.Deref(m.Status.Initialization.BootstrapDataSecretCreated, false) && (util.IsControlPlaneMachine(m) || conditions.IsTrue(s.cluster, clusterv1.ClusterControlPlaneInitializedCondition)) { if util.IsControlPlaneMachine(m) || conditions.IsTrue(s.cluster, clusterv1.ClusterControlPlaneInitializedCondition) { log.Info(fmt.Sprintf("Waiting for infrastructure provider to set %s on %s", - contract.InfrastructureMachine().Provisioned(contractVersion).Path().String(), s.infraMachine.GetKind()), - s.infraMachine.GetKind(), klog.KObj(s.infraMachine)) + contract.InfrastructureMachine().Provisioned(contractVersion).Path().String(), s.infraMachine.Kind), + s.infraMachine.Kind, klog.KObj(s.infraMachine)) } return ctrl.Result{}, nil } // Get providerID from the InfrastructureMachine (intentionally not setting it on the Machine yet). - providerID, err := contract.InfrastructureMachine().ProviderID().Get(s.infraMachine) - switch { - case err != nil && !errors.Is(err, contract.ErrFieldNotFound): - return ctrl.Result{}, errors.Wrapf(err, "failed to read %s from %s %s", - contract.InfrastructureMachine().ProviderID().Path().String(), - s.infraMachine.GetKind(), klog.KObj(s.infraMachine)) - case ptr.Deref(providerID, "") == "": + providerID := s.infraMachine.Spec.ProviderID + if providerID == "" { + // FIXME Exponential slow down log.Info(fmt.Sprintf("Waiting for infrastructure provider to set %s on %s", - contract.InfrastructureMachine().ProviderID().Path().String(), s.infraMachine.GetKind()), - s.infraMachine.GetKind(), klog.KObj(s.infraMachine)) + contract.InfrastructureMachine().ProviderID().Path().String(), s.infraMachine.Kind), + s.infraMachine.Kind, klog.KObj(s.infraMachine)) // Slow down reconcile frequency, provisioning infrastructure takes some time. r.controller.DeferNextReconcileForObject(s.machine, time.Now().Add(5*time.Second)) return ctrl.Result{}, nil // Note: Requeue is not needed, changes to InfraMachine trigger another reconcile. } // Get and set addresses from the InfrastructureMachine. - addresses, err := contract.InfrastructureMachine().Addresses().Get(s.infraMachine) - switch { - case errors.Is(err, contract.ErrFieldNotFound): // no-op - case err != nil: - return ctrl.Result{}, errors.Wrapf(err, "failed to read addresses from %s %s", - s.infraMachine.GetKind(), klog.KObj(s.infraMachine)) - default: - m.Status.Addresses = *addresses - } - - // Get deprecatedFailureDomain from the InfrastructureMachine. - deprecatedFailureDomain, err := contract.InfrastructureMachine().DeprecatedFailureDomain().Get(s.infraMachine) - switch { - case errors.Is(err, contract.ErrFieldNotFound): // no-op - case err != nil: - return ctrl.Result{}, errors.Wrapf(err, "failed to read spec.failureDomain from %s %s", - s.infraMachine.GetKind(), klog.KObj(s.infraMachine)) - default: - m.Spec.FailureDomain = ptr.Deref(deprecatedFailureDomain, "") - } - - // Get failureDomain from the InfrastructureMachine. - failureDomain, err := contract.InfrastructureMachine().FailureDomain().Get(s.infraMachine) - switch { - case errors.Is(err, contract.ErrFieldNotFound): // no-op - case err != nil: - return ctrl.Result{}, errors.Wrapf(err, "failed to read status.failureDomain from %s %s", - s.infraMachine.GetKind(), klog.KObj(s.infraMachine)) - default: - m.Status.FailureDomain = ptr.Deref(failureDomain, "") + m.Status.Addresses = s.infraMachine.Status.Addresses + + if s.infraMachine.Spec.FailureDomain != nil { + m.Spec.FailureDomain = *s.infraMachine.Spec.FailureDomain + } + + if s.infraMachine.Status.FailureDomain != "" { + m.Spec.FailureDomain = s.infraMachine.Status.FailureDomain } // When we hit this point providerID is set, and either: // - the infra machine is reporting provisioned for the first time // - the infra machine already reported provisioned (and thus m.Status.InfrastructureReady is already true and it should not flip back) - m.Spec.ProviderID = *providerID + m.Spec.ProviderID = providerID m.Status.Initialization.InfrastructureProvisioned = ptr.To(true) return ctrl.Result{}, nil } @@ -423,12 +399,12 @@ func (r *Reconciler) reconcileCertificateExpiry(_ context.Context, s *scope) (ct } // removeOnCreateOwnerRefs will remove any MachineSet or control plane owner references from passed objects. -func removeOnCreateOwnerRefs(cluster *clusterv1.Cluster, m *clusterv1.Machine, obj *unstructured.Unstructured) error { +func removeOnCreateOwnerRefs(cluster *clusterv1.Cluster, m *clusterv1.Machine, obj client.Object) error { cpGK := getControlPlaneGKForMachine(cluster, m) for _, owner := range obj.GetOwnerReferences() { ownerGV, err := schema.ParseGroupVersion(owner.APIVersion) if err != nil { - return errors.Wrapf(err, "could not remove ownerReference %v from object %s/%s", owner.String(), obj.GetKind(), obj.GetName()) + return errors.Wrapf(err, "could not remove ownerReference %v from object %s/%s", owner.String(), obj.GetObjectKind().GroupVersionKind().Kind, obj.GetName()) } if (ownerGV.Group == clusterv1.GroupVersion.Group && owner.Kind == "MachineSet") || (cpGK != nil && ownerGV.Group == cpGK.Group && owner.Kind == cpGK.Kind) { @@ -440,12 +416,12 @@ func removeOnCreateOwnerRefs(cluster *clusterv1.Cluster, m *clusterv1.Machine, o } // hasOnCreateOwnerRefs will check if any MachineSet or control plane owner references from passed objects are set. -func hasOnCreateOwnerRefs(cluster *clusterv1.Cluster, m *clusterv1.Machine, obj *unstructured.Unstructured) (bool, error) { +func hasOnCreateOwnerRefs(cluster *clusterv1.Cluster, m *clusterv1.Machine, obj client.Object) (bool, error) { cpGK := getControlPlaneGKForMachine(cluster, m) for _, owner := range obj.GetOwnerReferences() { ownerGV, err := schema.ParseGroupVersion(owner.APIVersion) if err != nil { - return false, errors.Wrapf(err, "could not remove ownerReference %v from object %s/%s", owner.String(), obj.GetKind(), obj.GetName()) + return false, errors.Wrapf(err, "could not remove ownerReference %v from object %s/%s", owner.String(), obj.GetObjectKind().GroupVersionKind().Kind, obj.GetName()) } if (ownerGV.Group == clusterv1.GroupVersion.Group && owner.Kind == "MachineSet") || (cpGK != nil && ownerGV.Group == cpGK.Group && owner.Kind == cpGK.Kind) { diff --git a/internal/controllers/machine/machine_controller_status.go b/internal/controllers/machine/machine_controller_status.go index 8f2ef002a792..c5936fa87298 100644 --- a/internal/controllers/machine/machine_controller_status.go +++ b/internal/controllers/machine/machine_controller_status.go @@ -25,12 +25,12 @@ import ( "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/utils/ptr" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" + contractv1 "sigs.k8s.io/cluster-api/api/contract/v1beta2" clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2" "sigs.k8s.io/cluster-api/controllers/clustercache" "sigs.k8s.io/cluster-api/internal/contract" @@ -75,7 +75,7 @@ func (r *Reconciler) updateStatus(ctx context.Context, s *scope) ctrl.Result { return setAvailableCondition(ctx, s.machine) } -func setBootstrapReadyCondition(_ context.Context, machine *clusterv1.Machine, bootstrapConfig *unstructured.Unstructured, bootstrapConfigIsNotFound bool) { +func setBootstrapReadyCondition(_ context.Context, machine *clusterv1.Machine, bootstrapConfig *contractv1.BootstrapConfig, bootstrapConfigIsNotFound bool) { if !machine.Spec.Bootstrap.ConfigRef.IsDefined() { conditions.Set(machine, metav1.Condition{ Type: clusterv1.MachineBootstrapConfigReadyCondition, @@ -87,7 +87,7 @@ func setBootstrapReadyCondition(_ context.Context, machine *clusterv1.Machine, b if bootstrapConfig != nil { dataSecretCreated := ptr.Deref(machine.Status.Initialization.BootstrapDataSecretCreated, false) - ready, err := conditions.NewMirrorConditionFromUnstructured( + ready := conditions.NewMirrorCondition( bootstrapConfig, contract.Bootstrap().ReadyConditionType(), conditions.TargetConditionType(clusterv1.MachineBootstrapConfigReadyCondition), conditions.FallbackCondition{ @@ -96,15 +96,6 @@ func setBootstrapReadyCondition(_ context.Context, machine *clusterv1.Machine, b Message: bootstrapConfigReadyFallBackMessage(machine.Spec.Bootstrap.ConfigRef.Kind, dataSecretCreated), }, ) - if err != nil { - conditions.Set(machine, metav1.Condition{ - Type: clusterv1.MachineBootstrapConfigReadyCondition, - Status: metav1.ConditionUnknown, - Reason: clusterv1.MachineBootstrapConfigInvalidConditionReportedReason, - Message: err.Error(), - }) - return - } // In case condition has NoReasonReported and status true, we assume it is a v1beta1 condition // and replace the reason with something less confusing. @@ -164,10 +155,10 @@ func bootstrapConfigReadyFallBackMessage(kind string, ready bool) string { return fmt.Sprintf("%s status.initialization.dataSecretCreated is %t", kind, ready) } -func setInfrastructureReadyCondition(_ context.Context, machine *clusterv1.Machine, infraMachine *unstructured.Unstructured, infraMachineIsNotFound bool) { +func setInfrastructureReadyCondition(_ context.Context, machine *clusterv1.Machine, infraMachine *contractv1.InfraMachine, infraMachineIsNotFound bool) { if infraMachine != nil { infrastructureProvisioned := ptr.Deref(machine.Status.Initialization.InfrastructureProvisioned, false) - ready, err := conditions.NewMirrorConditionFromUnstructured( + ready := conditions.NewMirrorCondition( infraMachine, contract.InfrastructureMachine().ReadyConditionType(), conditions.TargetConditionType(clusterv1.MachineInfrastructureReadyCondition), conditions.FallbackCondition{ @@ -176,15 +167,6 @@ func setInfrastructureReadyCondition(_ context.Context, machine *clusterv1.Machi Message: infrastructureReadyFallBackMessage(machine.Spec.InfrastructureRef.Kind, infrastructureProvisioned), }, ) - if err != nil { - conditions.Set(machine, metav1.Condition{ - Type: clusterv1.MachineInfrastructureReadyCondition, - Status: metav1.ConditionUnknown, - Reason: clusterv1.MachineInfrastructureInvalidConditionReportedReason, - Message: err.Error(), - }) - return - } // In case condition has NoReasonReported and status true, we assume it is a v1beta1 condition // and replace the reason with something less confusing. diff --git a/internal/controllers/machinedeployment/machinedeployment_controller.go b/internal/controllers/machinedeployment/machinedeployment_controller.go index 933551c095bc..e17d411c9220 100644 --- a/internal/controllers/machinedeployment/machinedeployment_controller.go +++ b/internal/controllers/machinedeployment/machinedeployment_controller.go @@ -18,7 +18,9 @@ package machinedeployment import ( "context" + "encoding/json" "fmt" + "reflect" "sort" "strings" @@ -44,6 +46,7 @@ import ( clientutil "sigs.k8s.io/cluster-api/internal/util/client" "sigs.k8s.io/cluster-api/internal/util/ssa" "sigs.k8s.io/cluster-api/util" + acclusterv1 "sigs.k8s.io/cluster-api/util/applyconfigurations/core/v1beta2" "sigs.k8s.io/cluster-api/util/cache" "sigs.k8s.io/cluster-api/util/collections" v1beta1conditions "sigs.k8s.io/cluster-api/util/conditions/deprecated/v1beta1" @@ -81,8 +84,9 @@ type Reconciler struct { // WatchFilterValue is the label value used to filter events prior to reconciliation. WatchFilterValue string - recorder record.EventRecorder - ssaCache ssa.Cache + recorder record.EventRecorder + ssaCache ssa.Cache + ssaApplyConfigurationCache ssa.Cache canUpdateMachineSetCache cache.Cache[CanUpdateMachineSetCacheEntry] } @@ -124,6 +128,7 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, opt r.canUpdateMachineSetCache = cache.New[CanUpdateMachineSetCacheEntry](cache.HookCacheDefaultTTL) r.recorder = mgr.GetEventRecorderFor("machinedeployment-controller") r.ssaCache = ssa.NewCache("machinedeployment") + r.ssaApplyConfigurationCache = ssa.NewCache("machinedeployment-applyconfiguration") return nil } @@ -396,6 +401,45 @@ func (r *Reconciler) createOrUpdateMachineSetsAndSyncMachineDeploymentRevision(c continue } + requestIdentifier, err := ssa.ComputeRequestIdentifier(r.Client.Scheme(), diff.OriginalMS.ResourceVersion, ms) + if err != nil { + return errors.Wrapf(err, "failed to apply MachineSet") + } + + if r.ssaApplyConfigurationCache.Has(requestIdentifier, "MachineSet") { + // Nothing to do + // FIXME: check if we have to update ms with originalMS like ssa.Patch would do even for no-ops (not sure if we depend on that later) + // Refresh the cache + r.ssaApplyConfigurationCache.Add(requestIdentifier) + continue + } + + updatedMachineSetApplyConfiguration := &acclusterv1.MachineSetApplyConfiguration{} + updatedMachineSetBytes, err := json.Marshal(ms) + if err != nil { + return err + } + if err := json.Unmarshal(updatedMachineSetBytes, updatedMachineSetApplyConfiguration); err != nil { + return err + } + updatedMachineSetApplyConfiguration.Status = nil // FIXME: Cleanup status, not sure why there is a status in the first place + updatedMachineSetApplyConfiguration.CreationTimestamp = nil // cleanup creationTimestamp as it is not present incurrentMachineSetApplyConfiguration + updatedMachineSetApplyConfiguration.Finalizers = nil // cleanup creationTimestamp, we sort of adopt it today, maybe we should stop doing that? + + currentMachineSetApplyConfiguration, err := acclusterv1.ExtractMachineSet(diff.OriginalMS, machineDeploymentManagerName) + if err != nil { + return err // FIXME: decide what to do on errors + } + currentMachineSetApplyConfiguration.UID = ptr.To(diff.OriginalMS.UID) // FIXME: why does Extract not set UID? (probably no ownership, but we need it in updateMachine) + currentMachineSetApplyConfiguration.Finalizers = nil // cleanup creationTimestamp, we sort of adopt it today, maybe we should stop doing that? + + if reflect.DeepEqual(currentMachineSetApplyConfiguration, updatedMachineSetApplyConfiguration) { + // Nothing to do + // FIXME: check if we have to update ms with originalMS like ssa.Patch would do even for no-ops (not sure if we depend on that later) + r.ssaApplyConfigurationCache.Add(requestIdentifier) + continue + } + // Add to the log kv pairs providing context and details about changes in this MachineSet (reason, diff) // Note: Those values should not be added to the context to prevent propagation to other func. statusToLogKeyAndValues := []any{ @@ -410,7 +454,7 @@ func (r *Reconciler) createOrUpdateMachineSetsAndSyncMachineDeploymentRevision(c } log = log.WithValues(statusToLogKeyAndValues...) - err := ssa.Patch(ctx, r.Client, machineDeploymentManagerName, ms, ssa.WithCachingProxy{Cache: r.ssaCache, Original: diff.OriginalMS}) + err = ssa.Patch(ctx, r.Client, machineDeploymentManagerName, ms, ssa.WithCachingProxy{Cache: r.ssaCache, Original: diff.OriginalMS}) if err != nil { // Note: If we are Applying a MachineSet with UID set and the MachineSet does not exist anymore, the // kube-apiserver returns a conflict error. diff --git a/internal/controllers/machinehealthcheck/machinehealthcheck_targets.go b/internal/controllers/machinehealthcheck/machinehealthcheck_targets.go index b2e08ed8c1d0..231ab8286060 100644 --- a/internal/controllers/machinehealthcheck/machinehealthcheck_targets.go +++ b/internal/controllers/machinehealthcheck/machinehealthcheck_targets.go @@ -400,6 +400,7 @@ func (r *Reconciler) healthCheckTargets(targets []healthCheckTarget, logger logr } if nextCheck > 0 { + // FIXME: Log once. logger.V(2).Info("Target is likely to go unhealthy", "timeUntilUnhealthy", nextCheck.Truncate(time.Second).String()) nextCheckTimes = append(nextCheckTimes, nextCheck) continue diff --git a/internal/controllers/machineset/machineset_controller.go b/internal/controllers/machineset/machineset_controller.go index a9a9c6cd8ff8..2603826cbe5e 100644 --- a/internal/controllers/machineset/machineset_controller.go +++ b/internal/controllers/machineset/machineset_controller.go @@ -19,10 +19,14 @@ package machineset import ( "cmp" "context" + "encoding/json" "fmt" + "maps" "math" + "reflect" "sort" "strings" + "sync" "time" "github.com/pkg/errors" @@ -33,6 +37,7 @@ import ( "k8s.io/apimachinery/pkg/labels" kerrors "k8s.io/apimachinery/pkg/util/errors" "k8s.io/apimachinery/pkg/util/intstr" + "k8s.io/apimachinery/pkg/util/managedfields" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/client-go/tools/record" "k8s.io/klog/v2" @@ -42,6 +47,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/controller" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" "sigs.k8s.io/controller-runtime/pkg/handler" + "sigs.k8s.io/structured-merge-diff/v6/typed" clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2" runtimehooksv1 "sigs.k8s.io/cluster-api/api/runtime/hooks/v1alpha1" @@ -58,6 +64,7 @@ import ( "sigs.k8s.io/cluster-api/internal/webhooks" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/annotations" + acclusterv1 "sigs.k8s.io/cluster-api/util/applyconfigurations/core/v1beta2" "sigs.k8s.io/cluster-api/util/collections" "sigs.k8s.io/cluster-api/util/conditions" v1beta1conditions "sigs.k8s.io/cluster-api/util/conditions/deprecated/v1beta1" @@ -99,8 +106,9 @@ type Reconciler struct { // WatchFilterValue is the label value used to filter events prior to reconciliation. WatchFilterValue string - ssaCache ssa.Cache - recorder record.EventRecorder + ssaCache ssa.Cache + ssaApplyConfigurationCache ssa.Cache + recorder record.EventRecorder // Note: This field is only used for unit tests that use fake client because the fake client does not properly set resourceVersion // on BootstrapConfig/InfraMachine after ssa.Patch and then ssa.RemoveManagedFieldsForLabelsAndAnnotations would fail. @@ -156,6 +164,7 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, opt r.recorder = mgr.GetEventRecorderFor("machineset-controller") r.ssaCache = ssa.NewCache("machineset") + r.ssaApplyConfigurationCache = ssa.NewCache("machineset-applyconfiguration") return nil } @@ -439,7 +448,7 @@ func (r *Reconciler) completeMoveMachine(ctx context.Context, s *scope, currentM desiredMachine.Spec.FailureDomain = s.machineSet.Spec.Template.Spec.FailureDomain // Compute desiredInfraMachine. - currentInfraMachine, err := external.GetObjectFromContractVersionedRef(ctx, r.Client, currentMachine.Spec.InfrastructureRef, currentMachine.Namespace) + currentInfraMachine, err := external.GetContractObjectFromContractVersionedRef(ctx, r.Client, currentMachine.Spec.InfrastructureRef, currentMachine.Namespace, external.ExternalTypeInfraMachine) if err != nil { return errors.Wrapf(err, "failed to get InfraMachine %s", klog.KRef(currentMachine.Namespace, currentMachine.Spec.InfrastructureRef.Name)) } @@ -458,10 +467,10 @@ func (r *Reconciler) completeMoveMachine(ctx context.Context, s *scope, currentM clusterv1.UpdateInProgressAnnotation: "", }) - var desiredBootstrapConfig, currentBootstrapConfig *unstructured.Unstructured + var desiredBootstrapConfig *unstructured.Unstructured if currentMachine.Spec.Bootstrap.ConfigRef.IsDefined() { // Compute desiredBootstrapConfig. - currentBootstrapConfig, err = external.GetObjectFromContractVersionedRef(ctx, r.Client, currentMachine.Spec.Bootstrap.ConfigRef, currentMachine.Namespace) + currentBootstrapConfig, err := external.GetContractObjectFromContractVersionedRef(ctx, r.Client, currentMachine.Spec.Bootstrap.ConfigRef, currentMachine.Namespace, external.ExternalTypeBootstrapConfig) if err != nil { return errors.Wrapf(err, "failed to get BootstrapConfig %s", klog.KRef(currentMachine.Namespace, currentMachine.Spec.Bootstrap.ConfigRef.Name)) } @@ -685,15 +694,51 @@ func (r *Reconciler) syncMachines(ctx context.Context, s *scope) (ctrl.Result, b if err != nil { return ctrl.Result{}, true, errors.Wrap(err, "failed to update Machine: failed to compute desired Machine") } - err = ssa.Patch(ctx, r.Client, machineSetManagerName, updatedMachine, ssa.WithCachingProxy{Cache: r.ssaCache, Original: m}) + + // CHECK VIA Applyconfiguration IF WE HAVE TO CALL ssa.Patch + // FIXME: this should be all moved into a new SSA util and used for Machine, labels/annotations, MS, topology: MHC, MD, MP + // FIXME: The new util should probably used in all cases where ssa.Cache is used today with ssa.Patch and ssa.Cache can maybe then be removed from ssa.Patch + + requestIdentifier, err := ssa.ComputeRequestIdentifier(r.Client.Scheme(), m.ResourceVersion, updatedMachine) if err != nil { - log.Error(err, "Failed to update Machine", "Machine", klog.KObj(updatedMachine)) - return ctrl.Result{}, true, errors.Wrapf(err, "failed to update Machine %q", klog.KObj(updatedMachine)) + return ctrl.Result{}, true, errors.Wrapf(err, "failed to apply Machine") + } + if r.ssaApplyConfigurationCache.Has(requestIdentifier, "Machine") { + // Nothing to do + machines[i] = m + // Refresh the cache + r.ssaApplyConfigurationCache.Add(requestIdentifier) + } else { + updatedMachineApplyConfiguration := &acclusterv1.MachineApplyConfiguration{} + updatedMachineBytes, err := json.Marshal(updatedMachine) + if err != nil { + return ctrl.Result{}, true, err + } + if err := json.Unmarshal(updatedMachineBytes, updatedMachineApplyConfiguration); err != nil { + return ctrl.Result{}, true, err + } + currentMachineApplyConfiguration, err := acclusterv1.ExtractMachine(m, machineSetManagerName) + if err != nil { + return ctrl.Result{}, true, err // FIXME: decide what to do on errors + } + currentMachineApplyConfiguration.UID = ptr.To(m.UID) // FIXME: why does Extract not set UID? (probably no ownership, but we need it in updateMachine) + + if reflect.DeepEqual(currentMachineApplyConfiguration, updatedMachineApplyConfiguration) { + // Nothing to do + machines[i] = m + r.ssaApplyConfigurationCache.Add(requestIdentifier) + } else { + err = ssa.Patch(ctx, r.Client, machineSetManagerName, updatedMachine, ssa.WithCachingProxy{Cache: r.ssaCache, Original: m}) + if err != nil { + log.Error(err, "Failed to update Machine", "Machine", klog.KObj(updatedMachine)) + return ctrl.Result{}, true, errors.Wrapf(err, "failed to update Machine %q", klog.KObj(updatedMachine)) + } + machines[i] = updatedMachine + } } - machines[i] = updatedMachine } - infraMachine, err := external.GetObjectFromContractVersionedRef(ctx, r.Client, m.Spec.InfrastructureRef, m.Namespace) + infraMachine, err := external.GetContractObjectFromContractVersionedRef(ctx, r.Client, m.Spec.InfrastructureRef, m.Namespace, external.ExternalTypeInfraMachine) if err != nil { return ctrl.Result{}, true, errors.Wrapf(err, "failed to get InfrastructureMachine %s %s", m.Spec.InfrastructureRef.Kind, klog.KRef(m.Namespace, m.Spec.InfrastructureRef.Name)) @@ -720,7 +765,7 @@ func (r *Reconciler) syncMachines(ctx context.Context, s *scope) (ctrl.Result, b } if m.Spec.Bootstrap.ConfigRef.IsDefined() { - bootstrapConfig, err := external.GetObjectFromContractVersionedRef(ctx, r.Client, m.Spec.Bootstrap.ConfigRef, m.Namespace) + bootstrapConfig, err := external.GetContractObjectFromContractVersionedRef(ctx, r.Client, m.Spec.Bootstrap.ConfigRef, m.Namespace, external.ExternalTypeBootstrapConfig) if err != nil { return ctrl.Result{}, true, errors.Wrapf(err, "failed to get BootstrapConfig %s %s", m.Spec.Bootstrap.ConfigRef.Kind, klog.KRef(m.Namespace, m.Spec.Bootstrap.ConfigRef.Name)) @@ -1187,7 +1232,7 @@ func (r *Reconciler) computeDesiredMachine(machineSet *clusterv1.MachineSet, exi // updateLabelsAndAnnotations updates the external object passed in with the // updated labels and annotations from the MachineSet. -func (r *Reconciler) updateLabelsAndAnnotations(ctx context.Context, obj client.Object, machineSet *clusterv1.MachineSet) error { +func (r *Reconciler) updateLabelsAndAnnotations(ctx context.Context, obj client.Object, machineSet *clusterv1.MachineSet) error { // FIXME: consider moving this func into the ssa package and reuse with KCP updatedObject := &unstructured.Unstructured{} updatedObject.SetGroupVersionKind(obj.GetObjectKind().GroupVersionKind()) updatedObject.SetNamespace(obj.GetNamespace()) @@ -1199,9 +1244,119 @@ func (r *Reconciler) updateLabelsAndAnnotations(ctx context.Context, obj client. updatedObject.SetLabels(machineLabelsFromMachineSet(machineSet)) updatedObject.SetAnnotations(machineAnnotationsFromMachineSet(machineSet)) + requestIdentifier, err := ssa.ComputeRequestIdentifier(r.Client.Scheme(), obj.GetResourceVersion(), updatedObject) + if err != nil { + return errors.Wrapf(err, "failed to apply labels/annotations of %s", obj.GetObjectKind().GroupVersionKind().Kind) + } + if r.ssaApplyConfigurationCache.Has(requestIdentifier, obj.GetObjectKind().GroupVersionKind().Kind) { + // Nothing to do + // Refresh the cache + r.ssaApplyConfigurationCache.Add(requestIdentifier) + return nil + } + + currentPartialObjectMetadata := &metav1.PartialObjectMetadata{} + currentPartialObjectMetadata.SetGroupVersionKind(obj.GetObjectKind().GroupVersionKind()) + currentPartialObjectMetadata.SetLabels(obj.GetLabels()) + currentPartialObjectMetadata.SetAnnotations(obj.GetAnnotations()) + currentPartialObjectMetadata.SetManagedFields(obj.GetManagedFields()) + + // FIXME: Optimize all cases where we call Unstructured.GetManagedFields and try to block further usage with forbidigo + // FIXME: use a custom type + applyconfiguration gen here instead of writing a schema manually + currentPartialObjectMetaOwnedByFieldManager := &metav1.PartialObjectMetadata{} + currentPartialObjectMetaOwnedByFieldManager.SetGroupVersionKind(obj.GetObjectKind().GroupVersionKind()) + err = managedfields.ExtractInto(currentPartialObjectMetadata, Parser().Type("io.k8s.apimachinery.pkg.apis.meta.v1.PartialObjectMeta"), machineSetMetadataManagerName, currentPartialObjectMetaOwnedByFieldManager, "") + if err != nil { + return err // FIXME: decide what to do on errors + } + + if maps.Equal(currentPartialObjectMetaOwnedByFieldManager.Labels, updatedObject.GetLabels()) && + maps.Equal(currentPartialObjectMetaOwnedByFieldManager.Annotations, updatedObject.GetAnnotations()) { + r.ssaApplyConfigurationCache.Add(requestIdentifier) + return nil + } + return ssa.Patch(ctx, r.Client, machineSetMetadataManagerName, updatedObject, ssa.WithCachingProxy{Cache: r.ssaCache, Original: obj}) } +var parserOnce sync.Once +var parser *typed.Parser + +func Parser() *typed.Parser { + parserOnce.Do(func() { + var err error + parser, err = typed.NewParser(schemaYAML) + if err != nil { + panic(fmt.Sprintf("Failed to parse schema: %v", err)) + } + }) + return parser +} + +var schemaYAML = typed.YAMLObject(`types: +- name: io.k8s.apimachinery.pkg.apis.meta.v1.PartialObjectMeta + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta +- name: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + map: + fields: + - name: annotations + type: + map: + elementType: + scalar: string + - name: labels + type: + map: + elementType: + scalar: string + - name: managedFields + type: + list: + elementType: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ManagedFieldsEntry + elementRelationship: atomic +- name: io.k8s.apimachinery.pkg.apis.meta.v1.ManagedFieldsEntry + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +- name: __untyped_atomic_ + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic +- name: __untyped_deduced_ + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +`) + func (r *Reconciler) getOwnerMachineDeployment(ctx context.Context, machineSet *clusterv1.MachineSet) (*clusterv1.MachineDeployment, error) { mdName := machineSet.Labels[clusterv1.MachineDeploymentNameLabel] if mdName == "" { @@ -1394,6 +1549,10 @@ func (r *Reconciler) reconcileV1Beta1Status(ctx context.Context, s *scope) error node, err := r.getMachineNode(ctx, cluster, machine) if err != nil && machine.GetDeletionTimestamp().IsZero() { + + //if errors.Is(err, clustercache.ErrClusterNotConnected) { + // continue + //} log.Error(err, "Unable to retrieve Node status", "Node", klog.KObj(node)) continue } @@ -1802,7 +1961,7 @@ func (r *Reconciler) createBootstrapConfig(ctx context.Context, ms *clusterv1.Ma }, nil } -func (r *Reconciler) computeDesiredBootstrapConfig(ctx context.Context, ms *clusterv1.MachineSet, machine *clusterv1.Machine, existingBootstrapConfig *unstructured.Unstructured) (*unstructured.Unstructured, error) { +func (r *Reconciler) computeDesiredBootstrapConfig(ctx context.Context, ms *clusterv1.MachineSet, machine *clusterv1.Machine, existingBootstrapConfig client.Object) (*unstructured.Unstructured, error) { var ownerReference *metav1.OwnerReference if existingBootstrapConfig == nil || !util.HasOwner(existingBootstrapConfig.GetOwnerReferences(), clusterv1.GroupVersion.String(), []string{"Machine"}) { ownerReference = &metav1.OwnerReference{ @@ -1880,7 +2039,7 @@ func (r *Reconciler) createInfraMachine(ctx context.Context, ms *clusterv1.Machi }, nil } -func (r *Reconciler) computeDesiredInfraMachine(ctx context.Context, ms *clusterv1.MachineSet, machine *clusterv1.Machine, existingInfraMachine *unstructured.Unstructured) (*unstructured.Unstructured, error) { +func (r *Reconciler) computeDesiredInfraMachine(ctx context.Context, ms *clusterv1.MachineSet, machine *clusterv1.Machine, existingInfraMachine client.Object) (*unstructured.Unstructured, error) { var ownerReference *metav1.OwnerReference if existingInfraMachine == nil || !util.HasOwner(existingInfraMachine.GetOwnerReferences(), clusterv1.GroupVersion.String(), []string{"Machine"}) { ownerReference = &metav1.OwnerReference{ diff --git a/internal/controllers/machineset/machineset_controller_test.go b/internal/controllers/machineset/machineset_controller_test.go index 91e403063d28..edff85932fa7 100644 --- a/internal/controllers/machineset/machineset_controller_test.go +++ b/internal/controllers/machineset/machineset_controller_test.go @@ -1488,6 +1488,9 @@ func TestMachineSetReconciler_syncMachines(t *testing.T) { _, stopReconcile, err := reconciler.syncMachines(ctx, s) g.Expect(err).ToNot(HaveOccurred()) g.Expect(stopReconcile).To(BeFalse()) + _, stopReconcile, err = reconciler.syncMachines(ctx, s) + g.Expect(err).ToNot(HaveOccurred()) + g.Expect(stopReconcile).To(BeFalse()) updatedInPlaceMutatingMachine := inPlaceMutatingMachine.DeepCopy() g.Eventually(func(g Gomega) { diff --git a/internal/controllers/machineset/machineset_preflight.go b/internal/controllers/machineset/machineset_preflight.go index 6b2fd13bbdaf..ab14f5448d2f 100644 --- a/internal/controllers/machineset/machineset_preflight.go +++ b/internal/controllers/machineset/machineset_preflight.go @@ -135,6 +135,7 @@ func (r *Reconciler) runPreflightChecks(ctx context.Context, cluster *clusterv1. for _, v := range preflightCheckErrs { preflightCheckErrStrings = append(preflightCheckErrStrings, *v) } + // FIXME: Exponential slow down log.Info(fmt.Sprintf("%s on hold because %s. The operation will continue after the preflight check(s) pass", action, strings.Join(preflightCheckErrStrings, "; "))) return preflightCheckErrStrings, nil } diff --git a/internal/controllers/topology/cluster/cluster_controller.go b/internal/controllers/topology/cluster/cluster_controller.go index fb465ab90cd2..a9acda9d0686 100644 --- a/internal/controllers/topology/cluster/cluster_controller.go +++ b/internal/controllers/topology/cluster/cluster_controller.go @@ -96,7 +96,8 @@ type Reconciler struct { // desiredStateGenerator is used to generate the desired state. desiredStateGenerator desiredstate.Generator - ssaCache ssa.Cache + ssaCache ssa.Cache + ssaApplyConfigurationCache ssa.Cache } func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error { @@ -166,6 +167,7 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, opt r.recorder = mgr.GetEventRecorderFor("topology/cluster-controller") r.ssaCache = ssa.NewCache("topology/cluster") + r.ssaApplyConfigurationCache = ssa.NewCache("topology/cluster-applyconfiguration") return nil } diff --git a/internal/controllers/topology/cluster/reconcile_state.go b/internal/controllers/topology/cluster/reconcile_state.go index 89e1790de7ef..eef52c603620 100644 --- a/internal/controllers/topology/cluster/reconcile_state.go +++ b/internal/controllers/topology/cluster/reconcile_state.go @@ -18,7 +18,9 @@ package cluster import ( "context" + "encoding/json" "fmt" + "reflect" "strings" "time" @@ -48,7 +50,9 @@ import ( topologynames "sigs.k8s.io/cluster-api/internal/topology/names" "sigs.k8s.io/cluster-api/internal/topology/ownerrefs" clientutil "sigs.k8s.io/cluster-api/internal/util/client" + "sigs.k8s.io/cluster-api/internal/util/ssa" "sigs.k8s.io/cluster-api/util" + acclusterv1 "sigs.k8s.io/cluster-api/util/applyconfigurations/core/v1beta2" "sigs.k8s.io/cluster-api/util/cache" ) @@ -474,6 +478,36 @@ func (r *Reconciler) reconcileMachineHealthCheck(ctx context.Context, current, d log = log.WithValues("MachineHealthCheck", klog.KObj(current)) ctx = ctrl.LoggerInto(ctx, log) + requestIdentifier, err := ssa.ComputeRequestIdentifier(r.Client.Scheme(), current.ResourceVersion, desired) + if err != nil { + return errors.Wrapf(err, "failed to apply MachineHealthCheck") + } + if r.ssaApplyConfigurationCache.Has(requestIdentifier, "MachineHealthCheck") { + // Nothing to do + // Refresh the cache + r.ssaApplyConfigurationCache.Add(requestIdentifier) + return nil + } + + updatedMachineHealthCheckApplyConfiguration := &acclusterv1.MachineHealthCheckApplyConfiguration{} + updatedMachineHealthCheckBytes, err := json.Marshal(desired) + if err != nil { + return err + } + if err := json.Unmarshal(updatedMachineHealthCheckBytes, updatedMachineHealthCheckApplyConfiguration); err != nil { + return err + } + currentMachineHealthCheckApplyConfiguration, err := acclusterv1.ExtractMachineHealthCheck(current, structuredmerge.TopologyManagerName) + if err != nil { + return err // FIXME: decide what to do on errors + } + if reflect.DeepEqual(updatedMachineHealthCheckApplyConfiguration, currentMachineHealthCheckApplyConfiguration) { + log.V(3).Info("No changes for MachineHealthCheck (based on ApplyConfiguration comparison)") + // Nothing to do + r.ssaApplyConfigurationCache.Add(requestIdentifier) + return nil + } + // Check differences between current and desired MachineHealthChecks, and patch if required. // NOTE: we want to be authoritative on the entire spec because the users are // expected to change MHC fields from the ClusterClass only. @@ -499,38 +533,31 @@ func (r *Reconciler) reconcileMachineHealthCheck(ctx context.Context, current, d // most specifically, after a Cluster is created it is assumed that the reference to the InfrastructureCluster / // ControlPlane objects should never change (only the content of the objects can change). func (r *Reconciler) reconcileCluster(ctx context.Context, s *scope.Scope) error { - log := ctrl.LoggerFrom(ctx) + // FIXME: This needs proper cleanup of previous capi-topology managedFields + cluster := s.Current.Cluster.DeepCopy() + original := cluster.DeepCopy() - // Check differences between current and desired state, and eventually patch the current object. - patchHelper, err := structuredmerge.NewServerSidePatchHelper(ctx, s.Current.Cluster, s.Desired.Cluster, r.Client, r.ssaCache) - if err != nil { - return errors.Wrapf(err, "failed to create patch helper for Cluster %s", klog.KObj(s.Current.Cluster)) + if cluster.Labels == nil { + cluster.Labels = map[string]string{} } - if !patchHelper.HasChanges() { - log.V(3).Info("No changes for Cluster") - return nil + cluster.Labels[clusterv1.ClusterNameLabel] = s.Desired.Cluster.Labels[clusterv1.ClusterNameLabel] + cluster.Labels[clusterv1.ClusterTopologyOwnedLabel] = s.Desired.Cluster.Labels[clusterv1.ClusterTopologyOwnedLabel] + if cluster.Annotations == nil { + cluster.Annotations = map[string]string{} } + // FIXME: we should not set the empty annotation if not necessary (also cleanup desired_state.go computeCluster) + cluster.Annotations[clusterv1.ClusterTopologyUpgradeStepAnnotation] = s.Desired.Cluster.Annotations[clusterv1.ClusterTopologyUpgradeStepAnnotation] + cluster.Spec.InfrastructureRef = s.Desired.Cluster.Spec.InfrastructureRef + cluster.Spec.ControlPlaneRef = s.Desired.Cluster.Spec.ControlPlaneRef - diff := patchHelper.Diff() - patchData := patchHelper.PatchData() - if diff == "" && patchData == "" { - log.Info("Patching Cluster") - } else { - log.Info("Patching Cluster", "diff", diff, "patch", patchData) - } - modifiedResourceVersion, err := patchHelper.Patch(ctx) - if err != nil { - return errors.Wrapf(err, "failed to patch Cluster %s", klog.KObj(s.Current.Cluster)) + if reflect.DeepEqual(cluster, original) { + return nil } - r.recorder.Eventf(s.Current.Cluster, corev1.EventTypeNormal, updateEventReason, "Updated Cluster %q", klog.KObj(s.Current.Cluster)) - // Wait until Cluster is updated in the cache. - // Note: We have to do this because otherwise using a cached client in the Reconcile func could - // return a stale state of the Cluster we just patched (because the cache might be stale). - // Note: Using DeepCopy to not modify s.Current.Cluster as it's not trivial to figure out what impact that would have. - cluster := s.Current.Cluster.DeepCopy() - cluster.ResourceVersion = modifiedResourceVersion - return clientutil.WaitForCacheToBeUpToDate(ctx, r.Client, "Cluster update", cluster) + if err := r.Client.Patch(ctx, cluster, client.MergeFrom(original)); err != nil { + return err + } + return nil } // reconcileMachineDeployments reconciles the desired state of the MachineDeployment objects. @@ -783,6 +810,36 @@ func (r *Reconciler) updateMachineDeployment(ctx context.Context, s *scope.Scope } } + requestIdentifier, err := ssa.ComputeRequestIdentifier(r.Client.Scheme(), currentMD.Object.ResourceVersion, desiredMD.Object) + if err != nil { + return errors.Wrapf(err, "failed to apply MachineDeployment") + } + if r.ssaApplyConfigurationCache.Has(requestIdentifier, "MachineDeployment") { + // Nothing to do + // Refresh the cache + r.ssaApplyConfigurationCache.Add(requestIdentifier) + return nil + } + + updatedMachineDeploymentApplyConfiguration := &acclusterv1.MachineDeploymentApplyConfiguration{} + updatedMachineDeploymentBytes, err := json.Marshal(desiredMD.Object) + if err != nil { + return err + } + if err := json.Unmarshal(updatedMachineDeploymentBytes, updatedMachineDeploymentApplyConfiguration); err != nil { + return err + } + currentMachineDeploymentApplyConfiguration, err := acclusterv1.ExtractMachineDeployment(currentMD.Object, structuredmerge.TopologyManagerName) + if err != nil { + return err // FIXME: decide what to do on errors + } + if reflect.DeepEqual(updatedMachineDeploymentApplyConfiguration, currentMachineDeploymentApplyConfiguration) { + log.V(3).Info("No changes for MachineDeployment (based on ApplyConfiguration comparison)") + // Nothing to do + r.ssaApplyConfigurationCache.Add(requestIdentifier) + return nil + } + // Check differences between current and desired MachineDeployment, and eventually patch the current object. patchHelper, err := structuredmerge.NewServerSidePatchHelper(ctx, currentMD.Object, desiredMD.Object, r.Client, r.ssaCache) if err != nil { diff --git a/internal/controllers/topology/cluster/structuredmerge/dryrun.go b/internal/controllers/topology/cluster/structuredmerge/dryrun.go index f478ee87e6d2..cf1bf8176217 100644 --- a/internal/controllers/topology/cluster/structuredmerge/dryrun.go +++ b/internal/controllers/topology/cluster/structuredmerge/dryrun.go @@ -65,6 +65,8 @@ func dryRunSSAPatch(ctx context.Context, dryRunCtx *dryRunSSAPatchInput) (bool, // Check if we already ran this request before by checking if the cache already contains this identifier. // Note: We only add an identifier to the cache if the result of the dry run was no diff. if exists := dryRunCtx.ssaCache.Has(requestIdentifier, dryRunCtx.originalUnstructured.GetKind()); exists { + // Refresh the cache entry so we don't have to re-run the dry-runs after the cache TTL + dryRunCtx.ssaCache.Add(requestIdentifier) return false, false, "", "", nil } @@ -105,7 +107,7 @@ func dryRunSSAPatch(ctx context.Context, dryRunCtx *dryRunSSAPatchInput) (bool, // error: "the object has been modified; please apply your changes to the latest version and try again" ssa.FilterObject(dryRunCtx.originalUnstructured, filterObjectInput) // Backup managed fields. - originalUnstructuredManagedFieldsBeforeSSA := dryRunCtx.originalUnstructured.GetManagedFields() + originalUnstructuredManagedFieldsBeforeSSA := dryRunCtx.originalUnstructured.GetManagedFields() // FIXME use util instead // Set managed fields to nil. // Note: Otherwise we would get the following error: // "failed to request dry-run server side apply: metadata.managedFields must be nil" @@ -235,7 +237,7 @@ func cleanupManagedFieldsAndAnnotation(obj *unstructured.Unstructured) error { // Adjust the managed field for Manager=TopologyManagerName, Subresource="", Operation="Apply" and // drop managed fields of other controllers. - oldManagedFields := obj.GetManagedFields() + oldManagedFields := obj.GetManagedFields() // FIXME use util instead newManagedFields := []metav1.ManagedFieldsEntry{} for _, managedField := range oldManagedFields { if managedField.Manager != TopologyManagerName { diff --git a/internal/util/ssa/cache.go b/internal/util/ssa/cache.go index e8bf7e89971e..37f17eeeae02 100644 --- a/internal/util/ssa/cache.go +++ b/internal/util/ssa/cache.go @@ -31,8 +31,8 @@ import ( ) const ( - // ttl is the duration for which we keep the keys in the cache. - ttl = 10 * time.Minute + // ttl is the duration for which we keep the keys in the cache. (multiple of syncPeriod) + ttl = 30 * time.Minute // expirationInterval is the interval in which we will remove expired keys // from the cache. diff --git a/internal/util/ssa/getmanagedfields.go b/internal/util/ssa/getmanagedfields.go new file mode 100644 index 000000000000..75fe88039d05 --- /dev/null +++ b/internal/util/ssa/getmanagedfields.go @@ -0,0 +1,107 @@ +/* +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 ssa + +import ( + "encoding/json" + "errors" + "slices" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/utils/ptr" + "sigs.k8s.io/controller-runtime/pkg/client" +) + +func needsManagedFieldsMitigation(obj client.Object) (bool, error) { + if u, ok := obj.(*unstructured.Unstructured); ok { + field, ok, err := unstructured.NestedFieldNoCopy(u.Object, "metadata", "managedFields") + if err != nil || !ok { // FIXME: fix the ok handling (same below + return false, err + } + fieldArray, ok := field.([]any) + if !ok { + return false, errors.New("error") + } + + if len(fieldArray) == 0 { + return true, nil + } + for _, fieldInterface := range fieldArray { + field := fieldInterface.(map[string]any) + manager := field["manager"].(string) + if manager == beforeFirstApplyManager { + return true, nil + } + } + return false, nil + } + + managedFields := obj.GetManagedFields() + if len(managedFields) == 0 { + return true, nil + } + if slices.ContainsFunc(managedFields, isManager(beforeFirstApplyManager)) { + return true, nil + } + return false, nil +} + +func GetUnstructuredManagedFields(u *unstructured.Unstructured, fieldManager string) ([]metav1.ManagedFieldsEntry, error) { + // FIXME: looks like this function is mostly more efficient if we only want one specific managedField entry instead of all of them + + field, ok, err := unstructured.NestedFieldNoCopy(u.Object, "metadata", "managedFields") + if err != nil || !ok { // FIXME: fix the ok handling (same below + return nil, err + } + fieldArray, ok := field.([]any) + if !ok { + return nil, errors.New("error") + } + managedFields := make([]metav1.ManagedFieldsEntry, 0, len(fieldArray)) + for _, fieldInterface := range fieldArray { + field := fieldInterface.(map[string]any) + + manager := field["manager"].(string) + if fieldManager != "" && manager != fieldManager { + continue + } + + var subresource string + if subresourceAny, ok := field["subresource"]; ok { + subresource = subresourceAny.(string) + } + + fieldsV1Raw, err := json.Marshal(field["fieldsV1"]) + if err != nil { + return nil, err + } + + managedFields = append(managedFields, metav1.ManagedFieldsEntry{ + Manager: manager, + Operation: metav1.ManagedFieldsOperationType(field["operation"].(string)), + APIVersion: field["apiVersion"].(string), + FieldsType: field["fieldsType"].(string), + Subresource: subresource, + Time: ptr.To(metav1.Now()), + FieldsV1: &metav1.FieldsV1{ + Raw: fieldsV1Raw, + }, + }) + } + return managedFields, nil +} diff --git a/internal/util/ssa/managedfields.go b/internal/util/ssa/managedfields.go index b41a04620f43..7412ab6f4ac4 100644 --- a/internal/util/ssa/managedfields.go +++ b/internal/util/ssa/managedfields.go @@ -75,7 +75,16 @@ func RemoveManagedFieldsForLabelsAndAnnotations(ctx context.Context, c client.Cl base := object.DeepCopyObject().(client.Object) // Modify managedFields for manager=fieldManager and operation=Apply to drop ownership for labels and annotations. - originalManagedFields := object.GetManagedFields() + var originalManagedFields []metav1.ManagedFieldsEntry + if u, ok := object.(*unstructured.Unstructured); ok { + originalManagedFields, err = GetUnstructuredManagedFields(u, "") + if err != nil { + return err + } + } else { + originalManagedFields = object.GetManagedFields() + } + managedFields := make([]metav1.ManagedFieldsEntry, 0, len(originalManagedFields)) for _, managedField := range originalManagedFields { if managedField.Manager == fieldManager && @@ -145,8 +154,19 @@ func MigrateManagedFields(ctx context.Context, c client.Client, object client.Ob klog.KRef(objectKey.Namespace, objectKey.Name)) } + var managedFieldsFromObject []metav1.ManagedFieldsEntry + if u, ok := object.(*unstructured.Unstructured); ok { + managedFieldsFromObject, err = GetUnstructuredManagedFields(u, fieldManager) + if err != nil { + return err + } + } else { + managedFieldsFromObject = object.GetManagedFields() + } + // Check if a migration is still needed. This should be only done once per object. - needsMigration, err := needsMigration(object, fieldManager) + // FIXME: Move GetUnstructuredManagedFields into needsMigration + needsMigration, err := needsMigration(managedFieldsFromObject, fieldManager) if err != nil { return errors.Wrapf(err, "failed to migrate managedFields for %s %s", objectGVK.Kind, klog.KRef(objectKey.Namespace, objectKey.Name)) @@ -158,9 +178,8 @@ func MigrateManagedFields(ctx context.Context, c client.Client, object client.Ob base := object.DeepCopyObject().(client.Object) // Remove managedFields for fieldManager:Apply and manager:Update. - originalManagedFields := object.GetManagedFields() - managedFields := make([]metav1.ManagedFieldsEntry, 0, len(originalManagedFields)) - for _, managedField := range originalManagedFields { + managedFields := []metav1.ManagedFieldsEntry{} + for _, managedField := range object.GetManagedFields() { if managedField.Manager == fieldManager && managedField.Operation == metav1.ManagedFieldsOperationApply && managedField.Subresource == "" { @@ -201,8 +220,8 @@ func MigrateManagedFields(ctx context.Context, c client.Client, object client.Ob } // needsMigration returns true if fieldManager:Apply owns the clusterv1.ClusterNameLabel. -func needsMigration(object client.Object, fieldManager string) (bool, error) { - for _, managedField := range object.GetManagedFields() { +func needsMigration(managedFields []metav1.ManagedFieldsEntry, fieldManager string) (bool, error) { + for _, managedField := range managedFields { //nolint:gocritic // much easier to read this way, not going to use continue instead if managedField.Manager == fieldManager && managedField.Operation == metav1.ManagedFieldsOperationApply && diff --git a/internal/util/ssa/managedfieldsmitigation.go b/internal/util/ssa/managedfieldsmitigation.go index c5a45df80a84..2904cf25a7bf 100644 --- a/internal/util/ssa/managedfieldsmitigation.go +++ b/internal/util/ssa/managedfieldsmitigation.go @@ -23,6 +23,7 @@ import ( "github.com/pkg/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" @@ -88,11 +89,27 @@ func MitigateManagedFieldsIssue(ctx context.Context, c client.Client, obj client return false, nil } - if len(obj.GetManagedFields()) > 0 && !slices.ContainsFunc(obj.GetManagedFields(), isManager(beforeFirstApplyManager)) { + needsMitigation, err := needsManagedFieldsMitigation(obj) + if err != nil { + return false, err + } + + if !needsMitigation { // Return if object has managedFields and no before-first-apply entry. return false, nil } + var managedFields []metav1.ManagedFieldsEntry + if u, ok := obj.(*unstructured.Unstructured); ok { + var err error + managedFields, err = GetUnstructuredManagedFields(u, "") + if err != nil { + return false, err + } + } else { + managedFields = obj.GetManagedFields() + } + log := ctrl.LoggerFrom(ctx) objGVK, err := apiutil.GVKForObject(obj, c.Scheme()) if err != nil { @@ -100,10 +117,10 @@ func MitigateManagedFieldsIssue(ctx context.Context, c client.Client, obj client } // Remove before-first-apply entry if it exists. - managedFields := slices.DeleteFunc(obj.GetManagedFields(), isManager(beforeFirstApplyManager)) + managedFields = slices.DeleteFunc(managedFields, isManager(beforeFirstApplyManager)) // Add fieldManager entry if it does not exist. - if !slices.ContainsFunc(obj.GetManagedFields(), isManager(fieldManager)) { + if !slices.ContainsFunc(managedFields, isManager(fieldManager)) { fieldsV1, err := computeManagedFields(obj, objGVK) if err != nil { return false, errors.Wrapf(err, "failed to mitigate managedFields issue: failed to compute managedFields entry") diff --git a/main.go b/main.go index 13682756b590..26faf8ae4eb8 100644 --- a/main.go +++ b/main.go @@ -24,6 +24,7 @@ import ( "os" "regexp" goruntime "runtime" + "strings" "time" "github.com/pkg/errors" @@ -57,6 +58,7 @@ import ( addonsv1beta1 "sigs.k8s.io/cluster-api/api/addons/v1beta1" addonsv1 "sigs.k8s.io/cluster-api/api/addons/v1beta2" + contractv1 "sigs.k8s.io/cluster-api/api/contract/v1beta2" clusterv1beta1 "sigs.k8s.io/cluster-api/api/core/v1beta1" clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2" "sigs.k8s.io/cluster-api/api/core/v1beta2/index" @@ -78,6 +80,7 @@ import ( runtimeregistry "sigs.k8s.io/cluster-api/internal/runtime/registry" "sigs.k8s.io/cluster-api/util/apiwarnings" "sigs.k8s.io/cluster-api/util/flags" + "sigs.k8s.io/cluster-api/util/secret" "sigs.k8s.io/cluster-api/version" "sigs.k8s.io/cluster-api/webhooks" ) @@ -149,6 +152,10 @@ func init() { _ = ipamv1beta1.AddToScheme(scheme) _ = ipamv1.AddToScheme(scheme) + // FIXME: Add object to the scheme so the controller can work, we might be able to get rid of the dependency on the scheme as this is not concurrency safe + // and would require us to create a new cache with a new scheme when we find a new object / GVK + _ = contractv1.AddToScheme(scheme) + // Register the RuntimeHook types into the catalog. _ = runtimehooksv1.AddToCatalog(catalog) } @@ -235,10 +242,10 @@ func InitFlags(fs *pflag.FlagSet) { fs.DurationVar(&syncPeriod, "sync-period", 10*time.Minute, "The minimum interval at which watched resources are reconciled (e.g. 15m)") - fs.Float32Var(&restConfigQPS, "kube-api-qps", 100, + fs.Float32Var(&restConfigQPS, "kube-api-qps", 1000, "Maximum queries per second from the controller client to the Kubernetes API server.") - fs.IntVar(&restConfigBurst, "kube-api-burst", 200, + fs.IntVar(&restConfigBurst, "kube-api-burst", 1000, "Maximum number of queries that should be allowed in one burst from the controller client to the Kubernetes API server.") fs.Float32Var(&clusterCacheClientQPS, "clustercache-client-qps", 20, @@ -367,6 +374,7 @@ func main() { ctrlOptions := ctrl.Options{ Controller: config.Controller{ + CacheSyncTimeout: 10 * time.Minute, // FIXME UsePriorityQueue: ptr.To[bool](feature.Gates.Enabled(feature.PriorityQueue)), }, Scheme: scheme, @@ -388,6 +396,16 @@ func main() { // The cached secrets will only be used by the secretCachingClient we create below. &corev1.Secret{}: { Label: clusterSecretCacheSelector, + Transform: func(in any) (any, error) { + if s, ok := in.(*corev1.Secret); ok { + s.SetManagedFields(nil) + if !strings.HasSuffix(s.Name, fmt.Sprintf("-%s", secret.Kubeconfig)) || + !strings.HasSuffix(s.Name, fmt.Sprintf("-%s", secret.ClusterCA)) { + s.Data = nil + } + } + return in, nil + }, }, }, }, @@ -468,6 +486,16 @@ func setupReconcilers(ctx context.Context, mgr ctrl.Manager, watchNamespaces map SecretClient: secretCachingClient, Cache: clustercache.CacheOptions{ Indexes: []clustercache.CacheOptionsIndex{clustercache.NodeProviderIDIndex}, + ByObject: map[client.Object]cache.ByObject{ + &corev1.Node{}: { + Transform: func(in any) (any, error) { + if n, ok := in.(*corev1.Node); ok { + n.SetManagedFields(nil) + } + return in, nil + }, + }, + }, }, Client: clustercache.ClientOptions{ QPS: clusterCacheClientQPS, diff --git a/test/e2e/scale.go b/test/e2e/scale.go index 40d9fbb3df8f..7de42768ef26 100644 --- a/test/e2e/scale.go +++ b/test/e2e/scale.go @@ -312,8 +312,8 @@ func ScaleSpec(ctx context.Context, inputGetter func() ScaleSpecInput) { }, } } - Expect(input.BootstrapClusterProxy.GetClient().Create(ctx, - extensionConfig)). + Expect(client.IgnoreAlreadyExists(input.BootstrapClusterProxy.GetClient().Create(ctx, + extensionConfig))). To(Succeed(), "Failed to create the ExtensionConfig") } @@ -681,7 +681,7 @@ outer: for _, result := range results { if result.err != nil { if e, ok := result.err.(types.GinkgoError); ok { - errs = append(errs, errors.Errorf("[clusterName: %q] Stack trace: \n %s", result.clusterName, e.CodeLocation.FullStackTrace)) + errs = append(errs, errors.Errorf("[clusterName: %q] Error: %v Stack trace: \n %s", result.clusterName, result.err, e.CodeLocation.FullStackTrace)) } else { errs = append(errs, errors.Errorf("[clusterName: %q] Error: %v", result.clusterName, result.err)) } @@ -741,7 +741,6 @@ func createClusterWorker(ctx context.Context, clusterProxy framework.ClusterProx if !open { return true } - log.Logf("Creating cluster %s", clusterName) // This defer will catch ginkgo failures and record them. // The recorded panics are then handled by the parent goroutine. @@ -763,13 +762,17 @@ func createClusterWorker(ctx context.Context, clusterProxy framework.ClusterProx // * Adjust namespace in ClusterClass YAML. // * Create new namespace. if deployClusterInSeparateNamespaces { - log.Logf("Create namespace %s", namespaceName) - _ = framework.CreateNamespace(ctx, framework.CreateNamespaceInput{ - Creator: clusterProxy.GetClient(), - Name: namespaceName, - IgnoreAlreadyExists: true, - Labels: map[string]string{"e2e-test": specName}, - }, "40s", "10s") + if err := clusterProxy.GetClient().Get(ctx, client.ObjectKey{Name: namespaceName}, &corev1.Namespace{}); err != nil { + log.Logf("Create namespace %s", namespaceName) + _ = framework.CreateNamespace(ctx, framework.CreateNamespaceInput{ + Creator: clusterProxy.GetClient(), + Name: namespaceName, + IgnoreAlreadyExists: true, + Labels: map[string]string{"e2e-test": specName}, + }, "40s", "10s") + } else { + return false // Skipping this namespace/cluster if the namespace already exists + } } // Call postScaleClusterNamespaceCreated hook to apply custom requirements based on the cluster name and namespace @@ -815,8 +818,11 @@ func createClusterWorker(ctx context.Context, clusterProxy framework.ClusterProx clusterTemplateYAML = bytes.ReplaceAll(clusterTemplateYAML, []byte(scaleClusterNamespacePlaceholder), []byte(namespaceName)) clusterTemplateYAML = bytes.ReplaceAll(clusterTemplateYAML, []byte(scaleClusterNamePlaceholder), []byte(clusterName)) - // Deploy Cluster. - create(ctx, namespaceName, clusterName, clusterTemplateYAML) + if err := clusterProxy.GetClient().Get(ctx, client.ObjectKey{Namespace: namespaceName, Name: clusterName}, &clusterv1.Cluster{}); err != nil { + log.Logf("Creating cluster %s", clusterName) + create(ctx, namespaceName, clusterName, clusterTemplateYAML) + } + return false } }() diff --git a/test/e2ectl/.gitignore b/test/e2ectl/.gitignore new file mode 100644 index 000000000000..c0943836b37f --- /dev/null +++ b/test/e2ectl/.gitignore @@ -0,0 +1 @@ +test.yaml \ No newline at end of file diff --git a/test/e2ectl/cmd/root.go b/test/e2ectl/cmd/root.go new file mode 100644 index 000000000000..b8fa6b076e91 --- /dev/null +++ b/test/e2ectl/cmd/root.go @@ -0,0 +1,145 @@ +/* +Copyright 2026 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 cmd + +import ( + "fmt" + "os" + + "github.com/pkg/errors" + "github.com/spf13/cobra" + "k8s.io/apimachinery/pkg/runtime" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" + "k8s.io/client-go/tools/clientcmd" + "k8s.io/component-base/logs" + logsv1 "k8s.io/component-base/logs/api/v1" + "k8s.io/klog/v2" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/client" + + controlplanev1 "sigs.k8s.io/cluster-api/api/controlplane/kubeadm/v1beta2" + clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2" + "sigs.k8s.io/cluster-api/test/e2ectl/test" +) + +var ( + logOptions = logs.NewOptions() + scheme = runtime.NewScheme() + rc = runOptions{} +) + +type stackTracer interface { + StackTrace() errors.StackTrace +} + +// Execute executes the root command. +func Execute() { + if err := RootCmd.Execute(); err != nil { + if err, ok := err.(stackTracer); ok { + for _, f := range err.StackTrace() { + fmt.Fprintf(os.Stderr, "%+s:%d\n", f, f) + } + } + os.Exit(1) + } +} + +// RootCmd is clusterctl root CLI command. +var RootCmd = &cobra.Command{ + Use: "e2ectl", + SilenceUsage: true, + Short: "e2ectl runs Cluster API e2e scenarios", + RunE: runE2E, +} + +type runOptions struct { + kubeconfig string + kubeconfigContext string + config string + dryRun bool +} + +func init() { + utilruntime.Must(clusterv1.AddToScheme(scheme)) + utilruntime.Must(controlplanev1.AddToScheme(scheme)) + + logsv1.AddFlags(logOptions, RootCmd.Flags()) + + RootCmd.Flags().StringVar(&rc.kubeconfig, "kubeconfig", "", + "Path to a kubeconfig file to use for the management cluster. If empty, default discovery rules apply.") + RootCmd.Flags().StringVar(&rc.kubeconfigContext, "kubeconfig-context", "", + "Context to be used within the kubeconfig file. If empty, current context will be used.") + RootCmd.Flags().StringVarP(&rc.config, "config", "c", "", + "The config file with the e2e test sequence to be run.") + RootCmd.Flags().BoolVar(&rc.dryRun, "dry-run", false, "Dry run the e2e test") +} + +func runE2E(_ *cobra.Command, _ []string) error { + if err := logsv1.ValidateAndApply(logOptions, nil); err != nil { + return err + } + + // TODO: Validate other flags + + ctrl.SetLogger(klog.Background()) + ctx := ctrl.SetupSignalHandler() + + configLoadingRules := clientcmd.NewDefaultClientConfigLoadingRules() + if rc.kubeconfig != "" { + configLoadingRules.ExplicitPath = rc.kubeconfig + } + + config, err := configLoadingRules.Load() + if err != nil { + return errors.Wrap(err, "failed to load Kubeconfig") + } + + contextName := config.CurrentContext + if rc.kubeconfigContext != "" { + contextName = rc.kubeconfigContext + } + + context, ok := config.Contexts[contextName] + if !ok { + if rc.kubeconfig != "" { + return errors.Errorf("failed to get context %q from %q", contextName, configLoadingRules.GetExplicitFile()) + } + return errors.Errorf("failed to get context %q from %q", contextName, configLoadingRules.GetLoadingPrecedence()) + } + + restConfig, err := clientcmd.NewDefaultClientConfig(*config, &clientcmd.ConfigOverrides{ + Context: *context, + }).ClientConfig() + if err != nil { + return errors.Wrapf(err, "failed to create rest config from %q", configLoadingRules.GetExplicitFile()) + } + restConfig.UserAgent = "e2ectl" + restConfig.QPS = 20 + restConfig.Burst = 100 + + c, err := client.New(restConfig, client.Options{Scheme: scheme}) + if err != nil { + return errors.Wrapf(err, "failed to create client from %q", configLoadingRules.GetExplicitFile()) + } + + testConfig, err := test.ReadConfig(rc.config) + if err != nil { + return errors.Wrapf(err, "failed to read test config file %s", rc.config) + } + + return test.Run(ctx, c, testConfig, rc.dryRun) +} diff --git a/test/e2ectl/main.go b/test/e2ectl/main.go new file mode 100644 index 000000000000..d5b2e6af7127 --- /dev/null +++ b/test/e2ectl/main.go @@ -0,0 +1,26 @@ +/* +Copyright 2026 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. +*/ + +// main is the main package for e2ectl. +package main + +import ( + "sigs.k8s.io/cluster-api/test/e2ectl/cmd" +) + +func main() { + cmd.Execute() +} diff --git a/test/e2ectl/test/actions_cluster.go b/test/e2ectl/test/actions_cluster.go new file mode 100644 index 000000000000..a77b6c379ee4 --- /dev/null +++ b/test/e2ectl/test/actions_cluster.go @@ -0,0 +1,225 @@ +/* +Copyright 2026 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 test + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/pkg/errors" + apierrors "k8s.io/apimachinery/pkg/api/errors" + kerrors "k8s.io/apimachinery/pkg/util/errors" + "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/klog/v2" + "k8s.io/utils/ptr" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/client" + + clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2" +) + +func runClusterActions(ctx context.Context, c client.Client, input runClusterActionsInput, dryRun bool) (*runClusterActionsOutput, error) { + log := ctrl.LoggerFrom(ctx).WithValues("Cluster", klog.KObj(input.cluster)) + ctx = ctrl.LoggerInto(ctx, log) + + if !input.cluster.Spec.Topology.IsDefined() { + panic("Support for clusters without spec.topology not implemented yet") + } + + for i, s := range input.actions { + log := ctrl.LoggerFrom(ctx).WithValues("step", i) + ctx = ctrl.LoggerInto(ctx, log) + + if s.Cluster != nil { + if s.Cluster.Upgrade != nil { + if err := runClusterUpgradeAction(ctx, c, input.cluster, s.Cluster.Upgrade.Version, ptr.Deref(s.SkipWait, false), dryRun); err != nil { + return nil, errors.Wrapf(err, "failed to run Cluster %s upgrade action", klog.KObj(input.cluster)) + } + } + + if s.Cluster.ControlPlaneEndpoint != nil { + up := true + if ptr.Deref(s.Cluster.ControlPlaneEndpoint.Stop, false) { + up = false + } + if err := runClusterControlPlaneEndpointAction(ctx, input.cluster, up, ptr.Deref(s.SkipWait, false), dryRun); err != nil { + return nil, errors.Wrapf(err, "failed to run Cluster %s upgrade action", klog.KObj(input.cluster)) + } + } + + if s.Cluster.Delete != nil { + if err := runClusterDeleteAction(ctx, c, input.cluster, ptr.Deref(s.SkipWait, false), dryRun); err != nil { + return nil, errors.Wrapf(err, "failed to run Cluster %s delete action", klog.KObj(input.cluster)) + } + } + } + + if s.ControlPlane != nil { + if err := runControlPlaneAction(ctx, c, input.cluster, *s.ControlPlane, ptr.Deref(s.SkipWait, false), dryRun); err != nil { + return nil, errors.Wrapf(err, "failed to run Cluster %s control plane action", klog.KObj(input.cluster)) + } + } + + if s.MachineDeployments != nil { + if err := runMachineDeploymentsAction(ctx, c, input.cluster, *s.MachineDeployments, ptr.Deref(s.SkipWait, false), dryRun); err != nil { + return nil, errors.Wrapf(err, "failed to run Cluster %s MachineDeployments action", klog.KObj(input.cluster)) + } + } + + if s.debug != nil { + s.debug.f(ctx, input.cluster) + } + } + return nil, nil +} + +func runClusterUpgradeAction(ctx context.Context, c client.Client, cluster *clusterv1.Cluster, version string, skipWait, dryRun bool) error { + log := ctrl.LoggerFrom(ctx) + + currentVersion := cluster.Spec.Topology.Version + if currentVersion == version { + log.Info(fmt.Sprintf("Upgrade Cluster action skipped, Cluster already have version %s", version)) + return nil + } + + log.Info(fmt.Sprintf("Upgrading Cluster from version %s to %s", currentVersion, version)) + if dryRun { + return nil + } + + original := cluster.DeepCopy() + cluster.Spec.Topology.Version = version + if err := c.Patch(ctx, cluster, client.MergeFrom(original)); err != nil { + return errors.Wrapf(err, "failed to patch Cluster %s", klog.KObj(cluster)) + } + + if skipWait { + return nil + } + + log.Info(fmt.Sprintf("Waiting for Cluster to have version %s", version)) + controlPlane, err := getControlPlane(ctx, c, cluster) + if err != nil { + return err + } + machineDeployments, err := getMachineDeployments(ctx, c, cluster, "", nil) + if err != nil { + return err + } + var retryErr error + if err := wait.PollUntilContextTimeout(ctx, 5*time.Second, 5*time.Minute, false, func(ctx context.Context) (done bool, err error) { + done, err, retryErr = waitForControlPlaneMachines(ctx, c, cluster, controlPlane, ptr.Deref(controlPlane.Spec.Replicas, 0), cluster.Spec.Topology.Version) + if err != nil { + return done, err + } + if retryErr != nil { + return false, nil //nolint:nilerr + } + + for _, machineDeployment := range machineDeployments { + done, err, retryErr = waitForMachineDeploymentMachines(ctx, c, cluster, machineDeployment, ptr.Deref(machineDeployment.Spec.Replicas, 0), cluster.Spec.Topology.Version) + if err != nil { + return done, err + } + if retryErr != nil { + return false, nil //nolint:nilerr + } + } + return true, nil + }); err != nil || retryErr != nil { + return kerrors.NewAggregate([]error{retryErr, err}) + } + + log.Info(fmt.Sprintf("Upgrade Cluster from version %s to %s completed", currentVersion, version)) + return nil +} + +func runClusterControlPlaneEndpointAction(ctx context.Context, cluster *clusterv1.Cluster, up bool, _, dryRun bool) error { + log := ctrl.LoggerFrom(ctx) + + action := "start" + logAction := "Starting" + if !up { + action = "stop" + logAction = "Stopping" + } + + log.Info(fmt.Sprintf("%s listener for the Cluster control plane endpoint", logAction)) + if dryRun { + return nil + } + + // FIXME: make ip and port configurable + req, err := http.NewRequestWithContext(ctx, http.MethodGet, fmt.Sprintf("http://127.0.0.1:19000/clusters/%s/%s/listener/%s", cluster.Namespace, cluster.Name, action), http.NoBody) + if err != nil { + return errors.Wrapf(err, "failed to create request to call the endpoint to %s listener for Cluster %s", action, klog.KObj(cluster)) + } + resp, err := http.DefaultClient.Do(req) + if err != nil { + return errors.Wrapf(err, "failed to call the endpoint to %s listener for Cluster %s", action, klog.KObj(cluster)) + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return errors.Wrapf(err, "failed %s listener for Cluster %s", action, klog.KObj(cluster)) + } + + log.Info(fmt.Sprintf("%s listener for Cluster control plane endpoint completed", action)) + return nil +} + +func runClusterDeleteAction(ctx context.Context, c client.Client, cluster *clusterv1.Cluster, skipWait, dryRun bool) error { + log := ctrl.LoggerFrom(ctx) + + if !cluster.DeletionTimestamp.IsZero() { + log.Info("Upgrade Cluster action skipped, Cluster already is deleting") + return nil + } + + log.Info("Deleting Cluster") + if dryRun { + return nil + } + + if err := c.Delete(ctx, cluster); err != nil { + return errors.Wrapf(err, "failed to delete Cluster %s", klog.KObj(cluster)) + } + + if skipWait { + return nil + } + + log.Info("Waiting for Cluster to be deleted") + var retryErr error + if err := wait.PollUntilContextTimeout(ctx, 5*time.Second, 5*time.Minute, false, func(ctx context.Context) (done bool, err error) { + tmpCluster := &clusterv1.Cluster{} + if err := c.Get(ctx, client.ObjectKeyFromObject(cluster), tmpCluster); err != nil { + if apierrors.IsNotFound(err) { + return true, nil + } + return false, err + } + return false, nil + }); err != nil || retryErr != nil { + return kerrors.NewAggregate([]error{retryErr, err}) + } + + log.Info("Deleted Cluster") + return nil +} diff --git a/test/e2ectl/test/actions_controlplane.go b/test/e2ectl/test/actions_controlplane.go new file mode 100644 index 000000000000..1a1377585281 --- /dev/null +++ b/test/e2ectl/test/actions_controlplane.go @@ -0,0 +1,149 @@ +/* +Copyright 2026 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 test + +import ( + "context" + "fmt" + "time" + + "github.com/pkg/errors" + kerrors "k8s.io/apimachinery/pkg/util/errors" + "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/klog/v2" + "k8s.io/utils/ptr" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/client" + + controlplanev1 "sigs.k8s.io/cluster-api/api/controlplane/kubeadm/v1beta2" + clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2" + "sigs.k8s.io/cluster-api/util/conditions" +) + +func runControlPlaneAction(ctx context.Context, c client.Client, cluster *clusterv1.Cluster, input ControlPlaneActionConfig, skipWait, dryRun bool) error { + if cluster.Spec.ControlPlaneRef.Kind != "KubeadmControlPlane" { + panic("Support for control plane with kind different than KubeadmControlPlane not implemented yet") + } + + controlPlane, err := getControlPlane(ctx, c, cluster) + if err != nil { + return err + } + + log := ctrl.LoggerFrom(ctx).WithValues(cluster.Spec.ControlPlaneRef.Kind, klog.KObj(controlPlane)) + ctx = ctrl.LoggerInto(ctx, log) + + if input.Scale != nil { + if err := runControlPlaneScaleAction(ctx, c, cluster, controlPlane, input.Scale.Replicas, skipWait, dryRun); err != nil { + return errors.Wrapf(err, "failed to run %s %s scale action", cluster.Spec.ControlPlaneRef.Kind, klog.KObj(controlPlane)) + } + } + + return nil +} + +func runControlPlaneScaleAction(ctx context.Context, c client.Client, cluster *clusterv1.Cluster, controlPlane *controlplanev1.KubeadmControlPlane, replicas int32, skipWait, dryRun bool) error { + log := ctrl.LoggerFrom(ctx) + + currentReplicas := ptr.Deref(controlPlane.Status.Replicas, 0) + if currentReplicas == replicas && ptr.Deref(cluster.Spec.Topology.ControlPlane.Replicas, 0) == replicas { + log.Info(fmt.Sprintf("Scaling KubeadmControlPlane action skipped, KubeadmControlPlane already have %d replicas", replicas)) + return nil + } + + log.Info(fmt.Sprintf("Scaling KubeadmControlPlane from %d to %d replicas", currentReplicas, replicas)) + if dryRun { + return nil + } + + original := cluster.DeepCopy() + cluster.Spec.Topology.ControlPlane.Replicas = ptr.To(replicas) + if err := c.Patch(ctx, cluster, client.MergeFrom(original)); err != nil { + return errors.Wrapf(err, "failed to patch %s %s", cluster.Spec.ControlPlaneRef.Kind, klog.KObj(controlPlane)) + } + + if skipWait { + return nil + } + + log.Info(fmt.Sprintf("Waiting for KubeadmControlPlane to have %d replicas", replicas)) + var retryErr error + if err := wait.PollUntilContextTimeout(ctx, 5*time.Second, 5*time.Minute, false, func(ctx context.Context) (done bool, err error) { + done, err, retryErr = waitForControlPlaneMachines(ctx, c, cluster, controlPlane, replicas, cluster.Spec.Topology.Version) + return done, err + }); err != nil || retryErr != nil { + return kerrors.NewAggregate([]error{retryErr, err}) + } + + log.Info(fmt.Sprintf("Scale KubeadmControlPlane from %d to %d replicas completed", currentReplicas, replicas)) + return nil +} + +func getControlPlane(ctx context.Context, c client.Client, cluster *clusterv1.Cluster) (*controlplanev1.KubeadmControlPlane, error) { + controlPlane := &controlplanev1.KubeadmControlPlane{} + key := client.ObjectKey{ + Namespace: cluster.Namespace, + Name: cluster.Spec.ControlPlaneRef.Name, + } + if err := c.Get(ctx, key, controlPlane); err != nil { + return nil, errors.Wrapf(err, "failed to get %s %s for Cluster %s", cluster.Spec.ControlPlaneRef.Kind, klog.KObj(controlPlane), klog.KObj(cluster)) + } + return controlPlane, nil +} + +func getControlPlaneMachines(ctx context.Context, c client.Client, cluster *clusterv1.Cluster, controlPlane *controlplanev1.KubeadmControlPlane) ([]*clusterv1.Machine, error) { + machineList := &clusterv1.MachineList{} + + listOptions := []client.ListOption{ + client.InNamespace(cluster.Namespace), + client.MatchingLabels{ + clusterv1.MachineControlPlaneLabel: "", + clusterv1.ClusterNameLabel: cluster.Name, + }, + } + if err := c.List(ctx, machineList, listOptions...); err != nil { + return nil, errors.Wrapf(err, "failed to list Machines for KubeadmControlPlane %s", klog.KObj(controlPlane)) + } + + machines := []*clusterv1.Machine{} + for _, machine := range machineList.Items { + machines = append(machines, &machine) + } + return machines, nil +} + +func waitForControlPlaneMachines(ctx context.Context, c client.Client, cluster *clusterv1.Cluster, controlPlane *controlplanev1.KubeadmControlPlane, replicas int32, version string) (done bool, err error, retryErr error) { + machines, err := getControlPlaneMachines(ctx, c, cluster, controlPlane) + if err != nil { + return false, err, nil + } + + if int32(len(machines)) != replicas { + return false, nil, errors.Errorf("waiting for %d KubeadmControlPlane machines to exist, found %d", replicas, len(machines)) + } + + for _, m := range machines { + if m.Spec.Version != version { + return false, nil, errors.Errorf("waiting for %d KubeadmControlPlane machines to have version %s", replicas, version) + } + + if !conditions.IsTrue(m, clusterv1.MachineAvailableCondition) { + return false, nil, errors.Errorf("waiting for %d KubeadmControlPlane machines to have Available condition True", replicas) + } + } + return true, nil, retryErr +} diff --git a/test/e2ectl/test/actions_machinedeployments.go b/test/e2ectl/test/actions_machinedeployments.go new file mode 100644 index 000000000000..42b23d187fdb --- /dev/null +++ b/test/e2ectl/test/actions_machinedeployments.go @@ -0,0 +1,360 @@ +/* +Copyright 2026 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 test + +import ( + "context" + "fmt" + "regexp" + "slices" + "sort" + "time" + + "github.com/pkg/errors" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + kerrors "k8s.io/apimachinery/pkg/util/errors" + "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/klog/v2" + "k8s.io/utils/ptr" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/client" + + clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2" + "sigs.k8s.io/cluster-api/util/conditions" +) + +func runMachineDeploymentsAction(ctx context.Context, c client.Client, cluster *clusterv1.Cluster, input MachineDeploymentActionConfig, skipWait, dryRun bool) error { + var machineDeployments []*clusterv1.MachineDeployment + if input.Create != nil { + for i := int32(0); i <= input.Create.Count; i++ { + name := input.Create.Template.Name + if name == "" { + name = fmt.Sprintf("%s%d", input.Create.GenerateName, len(cluster.Spec.Topology.Workers.MachineDeployments)+1) + } + + md := &clusterv1.MachineDeployment{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: cluster.Namespace, + Name: name, + Labels: map[string]string{ + clusterv1.ClusterTopologyMachineDeploymentNameLabel: name, + }, + }, + } + machineDeployments = append(machineDeployments, md) + } + } else { + var err error + machineDeployments, err = getMachineDeployments(ctx, c, cluster, input.TopologyNameRegex, input.Limit) + if err != nil { + return err + } + } + + _, err := newTaskRunner[runMachineDeploymentActionsInput, runMachineDeploymentActionsOutput]( + 1, // Always edit one MachineDeployment at time + false, // Always try to modify all the MachineDeployments, no matter if one fails + runMachineDeploymentAction, + ).Run(ctx, c, newMachineDeploymentActionInputs(cluster, machineDeployments, input, skipWait), dryRun) + + return err +} + +type runMachineDeploymentActionsInput struct { + cluster *clusterv1.Cluster + machineDeployment *clusterv1.MachineDeployment + action MachineDeploymentActionConfig + skipWait bool +} + +type runMachineDeploymentActionsOutput struct{} + +func newMachineDeploymentActionInputs(cluster *clusterv1.Cluster, machineDeployments []*clusterv1.MachineDeployment, action MachineDeploymentActionConfig, skipWait bool) (r []runMachineDeploymentActionsInput) { + for _, machineDeployment := range machineDeployments { + r = append(r, runMachineDeploymentActionsInput{ + cluster: cluster, + machineDeployment: machineDeployment, + action: action, + skipWait: skipWait, + }) + } + return +} + +func runMachineDeploymentAction(ctx context.Context, c client.Client, input runMachineDeploymentActionsInput, dryRun bool) (*runMachineDeploymentActionsOutput, error) { + log := ctrl.LoggerFrom(ctx).WithValues("MachineDeployment", klog.KObj(input.machineDeployment)) + ctx = ctrl.LoggerInto(ctx, log) + + mdTopologyName, ok := input.machineDeployment.Labels[clusterv1.ClusterTopologyMachineDeploymentNameLabel] + if !ok { + return nil, errors.Errorf("MachineDeployment doesn't have the %s label", clusterv1.ClusterTopologyMachineDeploymentNameLabel) + } + mdTopologyIndex := -1 + for i := range input.cluster.Spec.Topology.Workers.MachineDeployments { + if input.cluster.Spec.Topology.Workers.MachineDeployments[i].Name == mdTopologyName { + mdTopologyIndex = i + break + } + } + if mdTopologyIndex == -1 { + if input.action.Delete != nil { + // TODO: Log? MD CR still exists, but it has been already removed from the cluster. + return nil, nil + } + if input.action.Scale != nil { + return nil, errors.Errorf("Cannot file a MachineDeployment with name %s in cluster.spec.topology.workers.machineDeployments", clusterv1.ClusterTopologyMachineDeploymentNameLabel) + } + } + + if input.action.Scale != nil { + replicas := ptr.Deref(input.cluster.Spec.Topology.Workers.MachineDeployments[mdTopologyIndex].Replicas, 0) + if input.action.Scale.ReplicasDiff != nil { + replicas += *input.action.Scale.ReplicasDiff + } + if input.action.Scale.Replicas != nil { + replicas = *input.action.Scale.Replicas + } + + if err := runMachineDeploymentScaleAction(ctx, c, input.cluster, input.machineDeployment, mdTopologyIndex, replicas, input.skipWait, dryRun); err != nil { + return nil, errors.Wrapf(err, "failed to run MachineDeployment %s scale action", klog.KObj(input.machineDeployment)) + } + } + if input.action.Create != nil { + mdTopology := input.action.Create.Template + mdTopology.Name = input.machineDeployment.Name + if err := runMachineDeploymentCreateAction(ctx, c, input.cluster, input.machineDeployment, mdTopologyIndex, mdTopology, input.skipWait, dryRun); err != nil { + return nil, errors.Wrapf(err, "failed to run MachineDeployment %s create action", klog.KObj(input.machineDeployment)) + } + } + if input.action.Delete != nil { + if err := runMachineDeploymentDeleteAction(ctx, c, input.cluster, input.machineDeployment, mdTopologyIndex, input.skipWait, dryRun); err != nil { + return nil, errors.Wrapf(err, "failed to run MachineDeployment %s delete action", klog.KObj(input.machineDeployment)) + } + } + return nil, nil +} + +func runMachineDeploymentScaleAction(ctx context.Context, c client.Client, cluster *clusterv1.Cluster, machineDeployment *clusterv1.MachineDeployment, mdTopologyIndex int, replicas int32, skipWait, dryRun bool) error { + log := ctrl.LoggerFrom(ctx) + + currentReplicas := ptr.Deref(machineDeployment.Status.Replicas, 0) + if currentReplicas == replicas && ptr.Deref(cluster.Spec.Topology.Workers.MachineDeployments[mdTopologyIndex].Replicas, 0) == replicas { + log.Info(fmt.Sprintf("Scaling MachineDeployment action skipped, MachineDeployment already have %d replicas", replicas)) + return nil + } + + log.Info(fmt.Sprintf("Scaling MachineDeployment from %d to %d replicas", currentReplicas, replicas)) + if dryRun { + return nil + } + + original := cluster.DeepCopy() + cluster.Spec.Topology.Workers.MachineDeployments[mdTopologyIndex].Replicas = ptr.To(replicas) + if err := c.Patch(ctx, cluster, client.MergeFrom(original)); err != nil { + return errors.Wrapf(err, "failed to patch %s %s", cluster.Spec.ControlPlaneRef.Kind, klog.KObj(machineDeployment)) + } + + if skipWait { + return nil + } + + log.Info(fmt.Sprintf("Waiting for MachineDeployment to have %d replicas", replicas)) + var retryErr error + if err := wait.PollUntilContextTimeout(ctx, 5*time.Second, 5*time.Minute, false, func(ctx context.Context) (done bool, err error) { + done, err, retryErr = waitForMachineDeploymentMachines(ctx, c, cluster, machineDeployment, replicas, cluster.Spec.Topology.Version) + return done, err + }); err != nil || retryErr != nil { + return kerrors.NewAggregate([]error{retryErr, err}) + } + + log.Info(fmt.Sprintf("Scale MachineDeployment from %d to %d replicas completed", currentReplicas, replicas)) + return nil +} + +func runMachineDeploymentCreateAction(ctx context.Context, c client.Client, cluster *clusterv1.Cluster, machineDeployment *clusterv1.MachineDeployment, mdTopologyIndex int, mdTopology clusterv1.MachineDeploymentTopology, skipWait, dryRun bool) error { + log := ctrl.LoggerFrom(ctx) + + if mdTopologyIndex >= 0 { + log.Info("Creating MachineDeployment action skipped, MachineDeployment already exists") + return nil + } + + log.Info("Creating MachineDeployment") + if dryRun { + return nil + } + + original := cluster.DeepCopy() + cluster.Spec.Topology.Workers.MachineDeployments = append(cluster.Spec.Topology.Workers.MachineDeployments, mdTopology) + if err := c.Patch(ctx, cluster, client.MergeFrom(original)); err != nil { + return errors.Wrapf(err, "failed to patch %s %s", cluster.Spec.ControlPlaneRef.Kind, klog.KObj(machineDeployment)) + } + + if skipWait { + return nil + } + + log.Info("Waiting for MachineDeployment to be created") + var retryErr error + if err := wait.PollUntilContextTimeout(ctx, 5*time.Second, 5*time.Minute, false, func(ctx context.Context) (done bool, err error) { + machineDeploymentList := &clusterv1.MachineDeploymentList{} + listOptions := []client.ListOption{ + client.InNamespace(cluster.Namespace), + client.MatchingLabels{ + clusterv1.ClusterNameLabel: cluster.Name, + clusterv1.ClusterTopologyMachineDeploymentNameLabel: mdTopology.Name, + }, + } + if err := c.List(ctx, machineDeploymentList, listOptions...); err != nil { + return false, err + } + if len(machineDeploymentList.Items) != 1 { + retryErr = errors.New("waiting for MachineDeployment be created") + return false, nil + } + + done, err, retryErr = waitForMachineDeploymentMachines(ctx, c, cluster, &machineDeploymentList.Items[0], ptr.Deref(mdTopology.Replicas, 0), cluster.Spec.Topology.Version) + return done, err + }); err != nil || retryErr != nil { + return kerrors.NewAggregate([]error{retryErr, err}) + } + + log.Info("Create MachineDeployment completed") + return nil +} + +func runMachineDeploymentDeleteAction(ctx context.Context, c client.Client, cluster *clusterv1.Cluster, machineDeployment *clusterv1.MachineDeployment, mdTopologyIndex int, skipWait, dryRun bool) error { + log := ctrl.LoggerFrom(ctx) + + log.Info("Deleting MachineDeployment") + if dryRun { + return nil + } + + original := cluster.DeepCopy() + cluster.Spec.Topology.Workers.MachineDeployments = slices.Delete(cluster.Spec.Topology.Workers.MachineDeployments, mdTopologyIndex, mdTopologyIndex+1) + if err := c.Patch(ctx, cluster, client.MergeFrom(original)); err != nil { + return errors.Wrapf(err, "failed to patch %s %s", cluster.Spec.ControlPlaneRef.Kind, klog.KObj(machineDeployment)) + } + + if skipWait { + return nil + } + + log.Info("Waiting for MachineDeployment to be deleted") + var retryErr error + if err := wait.PollUntilContextTimeout(ctx, 5*time.Second, 5*time.Minute, false, func(ctx context.Context) (done bool, err error) { + md := &clusterv1.MachineDeployment{} + if err := c.Get(ctx, client.ObjectKeyFromObject(machineDeployment), md); err != nil { + if apierrors.IsNotFound(err) { + return true, nil + } + return false, err + } + retryErr = errors.New("waiting for MachineDeployment be deleted") + return false, nil + }); err != nil || retryErr != nil { + return kerrors.NewAggregate([]error{retryErr, err}) + } + + log.Info("Delete MachineDeployment completed") + return nil +} + +func getMachineDeployments(ctx context.Context, c client.Client, cluster *clusterv1.Cluster, topologyNameRegEx string, limit *int) ([]*clusterv1.MachineDeployment, error) { + machineDeploymentList := &clusterv1.MachineDeploymentList{} + + listOptions := []client.ListOption{ + client.InNamespace(cluster.Namespace), + client.MatchingLabels{clusterv1.ClusterNameLabel: cluster.Name}, + } + if err := c.List(ctx, machineDeploymentList, listOptions...); err != nil { + return nil, errors.Wrapf(err, "failed to list MachineDeployments for Cluster %s", klog.KObj(cluster)) + } + + var regex *regexp.Regexp + if topologyNameRegEx != "" { + var err error + regex, err = regexp.Compile(topologyNameRegEx) + if err != nil { + return nil, errors.Wrapf(err, "failed to parse nameRegex %s", topologyNameRegEx) + } + } + + machineDeployments := make([]*clusterv1.MachineDeployment, 0, len(machineDeploymentList.Items)) + for _, machineDeployment := range machineDeploymentList.Items { + if topologyName, ok := machineDeployment.Labels[clusterv1.ClusterTopologyMachineDeploymentNameLabel]; ok && regex != nil { + if !regex.MatchString(topologyName) { + continue + } + } + + machineDeployments = append(machineDeployments, &machineDeployment) + if limit != nil && len(machineDeployments) >= ptr.Deref(limit, 0) { + break + } + } + + sort.Slice(machineDeployments, func(i, j int) bool { + return klog.KObj(machineDeployments[i]).String() < klog.KObj(machineDeployments[j]).String() + }) + return machineDeployments, nil +} + +func getMachineDeploymentMachines(ctx context.Context, c client.Client, cluster *clusterv1.Cluster, machineDeployment *clusterv1.MachineDeployment) ([]*clusterv1.Machine, error) { + machineList := &clusterv1.MachineList{} + + listOptions := []client.ListOption{ + client.InNamespace(cluster.Namespace), + client.MatchingLabels{ + clusterv1.ClusterNameLabel: cluster.Name, + }, + client.MatchingLabels(machineDeployment.Spec.Selector.MatchLabels), + } + if err := c.List(ctx, machineList, listOptions...); err != nil { + return nil, errors.Wrapf(err, "failed to list Machines for MachineDeployment %s", klog.KObj(machineDeployment)) + } + + machines := []*clusterv1.Machine{} + for _, machine := range machineList.Items { + machines = append(machines, &machine) + } + return machines, nil +} + +func waitForMachineDeploymentMachines(ctx context.Context, c client.Client, cluster *clusterv1.Cluster, machineDeployment *clusterv1.MachineDeployment, replicas int32, version string) (done bool, err error, retryErr error) { + machines, err := getMachineDeploymentMachines(ctx, c, cluster, machineDeployment) + if err != nil { + return false, err, nil + } + + if int32(len(machines)) != replicas { + return false, nil, errors.Errorf("waiting for %d MachineDeployment machines to exist, found %d", replicas, len(machines)) + } + + for _, m := range machines { + if m.Spec.Version != version { + return false, nil, errors.Errorf("waiting for %d KubeadmControlPlane machines to have version %s", replicas, version) + } + + if !conditions.IsTrue(m, clusterv1.MachineAvailableCondition) { + return false, nil, errors.Errorf("waiting for %d MachineDeployment machines to have Available condition True", replicas) + } + } + return true, nil, retryErr +} diff --git a/test/e2ectl/test/config.go b/test/e2ectl/test/config.go new file mode 100644 index 000000000000..72d838512f0b --- /dev/null +++ b/test/e2ectl/test/config.go @@ -0,0 +1,167 @@ +/* +Copyright 2026 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 test + +import ( + "context" + "os" + + "github.com/pkg/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "sigs.k8s.io/yaml" + + clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2" +) + +// Config define the configuration for a sequence of test actions. +type Config struct { + // tests defines a list of test sequences. + // tests are run in parallel. + Tests []ActionList `json:"tests"` +} + +// ActionList define a sequence of test actions to be run on a selected group of Clusters. +type ActionList struct { + Name string `json:"name"` + Description string `json:"description,omitempty"` + + // clusterSelectors defines the list of Clusters which are candidate for this test. + // + // If clusterSelectors is not set, the test applies to all Clusters. + // If clusterSelectors contains multiple selectors, the results are ORed. + ClusterSelectors []metav1.LabelSelector `json:"clusterSelectors,omitempty"` + + // clusterNameRegex defines a regex used to select among the list of Clusters which are candidate. + // If clusterNameRegex is not set, all candidate Clusters will be considered. + ClusterNameRegex string `json:"clusterNameRegex,omitempty"` + + // limitClusters defines the max number of Clusters that will be considered for this test. + // If limitClusters is not set, all candidate Clusters will be considered. + LimitClusters *int32 `json:"limitClusters,omitempty"` + + // concurrency defines the number of Clusters to be tested in parallel. + // If not set, it defaults to 1. + Concurrency *int32 `json:"concurrency,omitempty"` + + // failFast defines the behavior in case a test action fails for a Cluster. + // If not set, it defaults to false. + // Note that in case concurrency is greater than 1, the system will try to + // complete other tests running in parallel before exit, + FailFast *bool `json:"failFast,omitempty"` + + // FIXME: Add timeout per action (here or at lower levels) + sane defaults, e.g. X times replicas / operation. + + // Actions defines the list of test actions to be performed on a Cluster. + Actions []ClusterTestActionConfig `json:"actions"` +} + +// ClusterTestActionConfig defines a test action to be performed on a Cluster. +type ClusterTestActionConfig struct { + Cluster *ClusterActionConfig `json:"cluster,omitempty"` + ControlPlane *ControlPlaneActionConfig `json:"controlPlane,omitempty"` + MachineDeployments *MachineDeploymentActionConfig `json:"machineDeployments,omitempty"` + + SkipWait *bool `json:"skipWait,omitempty"` + + debug *debugStepConfig +} + +// ClusterActionConfig defines configuration for a Cluster test action. +type ClusterActionConfig struct { + Upgrade *ClusterUpgradeActionConfig `json:"upgrade,omitempty"` + ControlPlaneEndpoint *ControlPlaneEndpointActionConfig `json:"controlPlaneEndpoint,omitempty"` + Delete *ClusterDeleteActionConfig `json:"delete,omitempty"` +} + +// ClusterUpgradeActionConfig defines configuration for a Cluster upgrade action. +type ClusterUpgradeActionConfig struct { + Version string `json:"version"` +} + +// ControlPlaneEndpointActionConfig defines configuration for a Cluster control plane endpoint action. +type ControlPlaneEndpointActionConfig struct { + Start *bool `json:"start,omitempty"` + Stop *bool `json:"stop,omitempty"` +} + +// ClusterDeleteActionConfig defines configuration for a Cluster delete action. +type ClusterDeleteActionConfig struct { + // FIXME: add option to delete ns +} + +// ControlPlaneActionConfig defines configuration for a control plane test action. +type ControlPlaneActionConfig struct { + Scale *ControlPlaneScaleActionConfig `json:"scale,omitempty"` +} + +// ControlPlaneScaleActionConfig defines configuration for a control plane scale action. +type ControlPlaneScaleActionConfig struct { + Replicas int32 `json:"replicas"` +} + +// MachineDeploymentActionConfig defines configuration for a test action to be run on a selected group of MachineDeployments. +type MachineDeploymentActionConfig struct { + TopologyNameRegex string `json:"topologyNameRegex,omitempty"` + Limit *int `json:"limit,omitempty"` + + Scale *MachineDeploymentScaleActionConfig `json:"scale,omitempty"` + Create *MachineDeploymentCreateActionConfig `json:"create,omitempty"` + Delete *MachineDeploymentDeleteActionConfig `json:"delete,omitempty"` +} + +// MachineDeploymentScaleActionConfig defines configuration for a MachineDeployment scale action. +type MachineDeploymentScaleActionConfig struct { + Replicas *int32 `json:"replicas,omitempty"` + ReplicasDiff *int32 `json:"replicasDiff,omitempty"` +} + +// MachineDeploymentCreateActionConfig defines configuration for a MachineDeployment create action. +type MachineDeploymentCreateActionConfig struct { + Count int32 `json:"count"` + + // GenerateName is an optional prefix, used by the server, to generate a unique + // name ONLY IF the template.name field has not been provided. + GenerateName string `json:"generateName,omitempty"` + Template clusterv1.MachineDeploymentTopology `json:"template,omitempty"` +} + +// MachineDeploymentDeleteActionConfig defines configuration for a MachineDeployment delete action. +type MachineDeploymentDeleteActionConfig struct { +} + +type debugStepConfig struct { + f func(ctx context.Context, i *clusterv1.Cluster) +} + +// ReadConfig reads the configuration for tests to be run on CAPI Clusters. +func ReadConfig(file string) (*Config, error) { + _, err := os.Stat(file) + if errors.Is(err, os.ErrNotExist) { + return nil, errors.Errorf("file %s does not exist", file) + } + configData, err := os.ReadFile(file) //nolint:gosec + if err != nil { + return nil, errors.Wrapf(err, "failed to read file %s", file) + } + + config := &Config{} + if err := yaml.Unmarshal(configData, config); err != nil { + return nil, errors.Wrapf(err, "failed to unmarshal file %s", file) + } + + return config, nil +} diff --git a/test/e2ectl/test/runner.go b/test/e2ectl/test/runner.go new file mode 100644 index 000000000000..bac0e8d3b77a --- /dev/null +++ b/test/e2ectl/test/runner.go @@ -0,0 +1,242 @@ +/* +Copyright 2026 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 test + +import ( + "context" + "fmt" + "regexp" + "sort" + "sync" + + "github.com/pkg/errors" + kerrors "k8s.io/apimachinery/pkg/util/errors" + "k8s.io/klog/v2" + "k8s.io/utils/ptr" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/client" + + clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2" +) + +// Run tests on CAPI Clusters.. +func Run(ctx context.Context, c client.Client, testConfig *Config, dryRun bool) error { + // TODO: validate options + + if len(testConfig.Tests) == 0 { + return nil + } + + _, err := newTaskRunner[testClustersInput, testClusterOutput]( + int32(len(testConfig.Tests)), // All tests must be processed in parallel, setting concurrency accordingly. + false, // Always try to complete all tests, no matter if one fails. + runTestCluster, + ).Run(ctx, c, newTestClustersInputs(testConfig), dryRun) + + return err +} + +type testClustersInput struct { + config ActionList +} + +type testClusterOutput struct{} + +func newTestClustersInputs(testConfig *Config) (r []testClustersInput) { + for _, c := range testConfig.Tests { + r = append(r, testClustersInput{config: c}) + } + return +} + +func runTestCluster(ctx context.Context, c client.Client, input testClustersInput, dryRun bool) (*testClusterOutput, error) { + log := ctrl.LoggerFrom(ctx).WithValues("test", input.config.Name) + ctx = ctrl.LoggerInto(ctx, log) + + clusters, err := getClusters(ctx, c, input.config.ClusterNameRegex, input.config.LimitClusters) + if err != nil { + return nil, err + } + + log.Info(fmt.Sprintf("Test case %s, %d candidate clusters", input.config.Name, len(clusters))) + + if _, err := newTaskRunner[runClusterActionsInput, runClusterActionsOutput]( + ptr.Deref(input.config.Concurrency, 1), + ptr.Deref(input.config.FailFast, false), + runClusterActions, + ).Run(ctx, c, newRunClusterActionInputs(clusters, input.config.Actions), dryRun); err != nil { + return nil, errors.Wrapf(err, "failed to run test case %s", input.config.Name) + } + + log.Info(fmt.Sprintf("Test case %s completed on %d clusters", input.config.Name, len(clusters))) + + return nil, nil +} + +func getClusters(ctx context.Context, c client.Client, nameRegEx string, limit *int32) ([]*clusterv1.Cluster, error) { + clusterList := &clusterv1.ClusterList{} + if err := c.List(ctx, clusterList); err != nil { + return nil, errors.Wrap(err, "failed to list Clusters") + } + + var regex *regexp.Regexp + if nameRegEx != "" { + var err error + regex, err = regexp.Compile(nameRegEx) + if err != nil { + return nil, errors.Wrapf(err, "failed to parse nameRegex %s", nameRegEx) + } + } + + clusters := make([]*clusterv1.Cluster, 0, len(clusterList.Items)) + for _, cluster := range clusterList.Items { + if regex != nil && !regex.MatchString(cluster.Name) { + continue + } + + clusters = append(clusters, &cluster) + if limit != nil && len(clusters) >= int(ptr.Deref(limit, 0)) { + break + } + } + + sort.Slice(clusters, func(i, j int) bool { + return klog.KObj(clusters[i]).String() < klog.KObj(clusters[j]).String() + }) + return clusters, nil +} + +type runClusterActionsInput struct { + cluster *clusterv1.Cluster + actions []ClusterTestActionConfig +} + +type runClusterActionsOutput struct{} + +func newRunClusterActionInputs(clusters []*clusterv1.Cluster, actions []ClusterTestActionConfig) (r []runClusterActionsInput) { + for _, cluster := range clusters { + r = append(r, runClusterActionsInput{ + cluster: cluster, + actions: actions, + }) + } + return +} + +type taskProcessingFunc[T, R any] func(context.Context, client.Client, T, bool) (*R, error) + +func newTaskRunner[T, R any](concurrency int32, failFast bool, f taskProcessingFunc[T, R]) taskRunner[T, R] { + return taskRunner[T, R]{ + concurrency: concurrency, + failFast: failFast, + f: f, + } +} + +type taskRunner[T, R any] struct { + concurrency int32 + failFast bool + f taskProcessingFunc[T, R] +} + +type taskResult[R any] struct { + Error error + Value *R +} + +func (r taskRunner[T, R]) Run(ctx context.Context, c client.Client, input []T, dryRun bool) ([]*R, error) { + // Start a channel. This channel will be used to coordinate work with the workers. + // The channel is used to communicate the value to be processed by each task. + inputChan := make(chan T) + wg := &sync.WaitGroup{} + doneChan := make(chan bool) + resultChan := make(chan taskResult[R]) + + ctx, cancel := context.WithCancel(ctx) + defer cancel() + + // Start the workers. + for range r.concurrency { + wg.Add(1) + go func(ctx context.Context, inputChan chan T, errChan chan taskResult[R], wg *sync.WaitGroup) { + defer wg.Done() + + for { + done := func() bool { + select { + case <-ctx.Done(): + // If the context is canceled, return and shutdown the worker. + return true + case i, open := <-inputChan: + // If the channel is closed it implies there is no more work to be done. return and shutdown the worker.. + if !open { + return true + } + + value, err := r.f(ctx, c, i, dryRun) + errChan <- taskResult[R]{ + Value: value, + Error: err, + } + return false + } + }() + if done { + break + } + } + }(ctx, inputChan, resultChan, wg) + } + + // Adding the value into the input channel. + go func() { + for _, v := range input { + inputChan <- v + } + close(inputChan) + }() + + // Wait for processing to complete. + go func() { + wg.Wait() + close(doneChan) + }() + + results := []*R{} + errs := []error{} + +outer: + for { + select { + case result := <-resultChan: + results = append(results, result.Value) + if result.Error != nil { + errs = append(errs, result.Error) + if r.failFast { + cancel() + } + } + case <-doneChan: + break outer + } + } + + // Close the result channel. + close(resultChan) + + return results, kerrors.NewAggregate(errs) +} diff --git a/test/go.mod b/test/go.mod index 8525ffbc43fb..ad23182a3d8c 100644 --- a/test/go.mod +++ b/test/go.mod @@ -4,6 +4,8 @@ go 1.25.0 replace sigs.k8s.io/cluster-api => ../ +replace sigs.k8s.io/controller-runtime => ../../controller-runtime + require ( github.com/blang/semver/v4 v4.0.0 github.com/docker/docker v28.5.2+incompatible @@ -17,7 +19,7 @@ require ( github.com/onsi/gomega v1.39.1 github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.23.2 - github.com/prometheus/common v0.66.1 + github.com/prometheus/common v0.67.5 github.com/spf13/pflag v1.0.10 github.com/vincent-petithory/dataurl v1.0.0 go.etcd.io/etcd/api/v3 v3.6.8 @@ -25,14 +27,14 @@ require ( golang.org/x/net v0.51.0 gomodules.xyz/jsonpatch/v2 v2.5.0 google.golang.org/grpc v1.78.0 - k8s.io/api v0.35.2 - k8s.io/apiextensions-apiserver v0.35.2 - k8s.io/apimachinery v0.35.2 - k8s.io/apiserver v0.35.2 - k8s.io/client-go v0.35.2 - k8s.io/component-base v0.35.2 + k8s.io/api v0.36.0-alpha.2 + k8s.io/apiextensions-apiserver v0.36.0-alpha.2 + k8s.io/apimachinery v0.36.0-alpha.2 + k8s.io/apiserver v0.36.0-alpha.2 + k8s.io/client-go v0.36.0-alpha.2 + k8s.io/component-base v0.36.0-alpha.2 k8s.io/klog/v2 v2.130.1 - k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 + k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2 sigs.k8s.io/cluster-api v0.0.0-00010101000000-000000000000 sigs.k8s.io/controller-runtime v0.23.3 sigs.k8s.io/kind v0.31.0 @@ -61,7 +63,7 @@ require ( github.com/containerd/log v0.1.0 // indirect github.com/coreos/go-semver v0.3.1 // indirect github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf // indirect - github.com/coreos/go-systemd/v22 v22.5.0 // indirect + github.com/coreos/go-systemd/v22 v22.7.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/distribution/reference v0.6.0 // indirect github.com/docker/go-units v0.4.0 // indirect @@ -80,7 +82,6 @@ require ( github.com/gobuffalo/flect v1.0.3 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.4 // indirect - github.com/google/btree v1.1.3 // indirect github.com/google/cel-go v0.26.0 // indirect github.com/google/gnostic-models v0.7.0 // indirect github.com/google/go-github/v82 v82.0.0 // indirect @@ -88,7 +89,8 @@ require ( github.com/google/pprof v0.0.0-20260115054156-294ebfa9ad83 // indirect github.com/google/uuid v1.6.0 // indirect github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 // indirect - github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect + github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0 // indirect + github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7 // indirect github.com/huandu/xstrings v1.5.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect @@ -117,9 +119,9 @@ require ( github.com/opencontainers/image-spec v1.0.2 // indirect github.com/pelletier/go-toml v1.9.5 // indirect github.com/pelletier/go-toml/v2 v2.2.4 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/procfs v0.16.1 // indirect + github.com/prometheus/procfs v0.19.2 // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/sagikazarmark/locafero v0.11.0 // indirect github.com/shopspring/decimal v1.4.0 // indirect @@ -149,14 +151,14 @@ require ( go.yaml.in/yaml/v2 v2.4.3 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/crypto v0.48.0 // indirect - golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect + golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93 // indirect golang.org/x/mod v0.32.0 // indirect golang.org/x/oauth2 v0.36.0 // indirect golang.org/x/sync v0.19.0 // indirect golang.org/x/sys v0.41.0 // indirect golang.org/x/term v0.40.0 // indirect golang.org/x/text v0.34.0 // indirect - golang.org/x/time v0.9.0 // indirect + golang.org/x/time v0.14.0 // indirect golang.org/x/tools v0.41.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 // indirect @@ -165,9 +167,9 @@ require ( gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.4.0 // indirect - k8s.io/cluster-bootstrap v0.35.2 // indirect - k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 // indirect - sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 // indirect + k8s.io/cluster-bootstrap v0.35.1 // indirect + k8s.io/kube-openapi v0.0.0-20260127142750-a19766b6e2d4 // indirect + sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.34.0 // indirect sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect sigs.k8s.io/structured-merge-diff/v6 v6.3.2 // indirect ) diff --git a/test/go.sum b/test/go.sum index d27dc04636f6..2ff2c095be37 100644 --- a/test/go.sum +++ b/test/go.sum @@ -52,8 +52,8 @@ github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03V github.com/coreos/go-systemd v0.0.0-20181031085051-9002847aa142/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf h1:iW4rZ826su+pqaw19uhpSCzhj44qo35pNgKFGqzDKkU= github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= -github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/coreos/go-systemd/v22 v22.7.0 h1:LAEzFkke61DFROc7zNLX/WA2i5J8gYqe0rSj9KI28KA= +github.com/coreos/go-systemd/v22 v22.7.0/go.mod h1:xNUYtjHu2EDXbsxz1i41wouACIwT7Ybq9o0BQhMwD0w= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -121,11 +121,10 @@ github.com/gobuffalo/flect v1.0.3/go.mod h1:A5msMlrHtLqh9umBSnvabjsMrCcCpAyzglnD github.com/goccy/go-yaml v1.18.0 h1:8W7wMFS12Pcas7KU+VVkaiCng+kG8QiFeFwzFb+rwuw= github.com/goccy/go-yaml v1.18.0/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA= github.com/godbus/dbus v0.0.0-20181025153459-66d97aec3384/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= -github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8= -github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/golang-jwt/jwt/v5 v5.3.0 h1:pv4AsKCKKZuqlgs5sUmn4x8UlGa0kEVt/puTpKx9vvo= +github.com/golang-jwt/jwt/v5 v5.3.0/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= @@ -155,12 +154,10 @@ github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 h1:JeSE6pjso5THxAzdVpqr6/geYxZytqFMBCOtn/ujyeo= github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674/go.mod h1:r4w70xmWCQKmi1ONH4KIaBptdivuRPyosB9RmPlGEwA= -github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.1 h1:qnpSQwGEnkcRpTqNOIR6bJbR0gAorgP9CSALpRcKoAA= -github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.1/go.mod h1:lXGCsh6c22WGtjr+qGHj1otzZpV/1kwTMAqkwZsnWRU= -github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.0 h1:FbSCl+KggFl+Ocym490i/EyXF4lPgLoUtcSWquBM0Rs= -github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.0/go.mod h1:qOchhhIlmRcqk/O9uCo/puJlyo07YINaIqdZfZG3Jkc= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0 h1:QGLs/O40yoNK9vmy4rhUGBVyMf1lISBGtXRpsu/Qu/o= +github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0/go.mod h1:hM2alZsMUni80N33RBe6J0e423LB+odMj7d3EMP9l20= +github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3 h1:B+8ClL/kCQkRiU82d9xajRPKYMrB7E0MbtzWVi1K4ns= +github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3/go.mod h1:NbCUVmiS4foBGBHOYlCT25+YmGpJ32dZPi75pGEUpj4= github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7 h1:X+2YciYSxvMQK0UZ7sg45ZVabVZBeBuvMkmuI2V3Fak= github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7/go.mod h1:lW34nIZuQ8UDPdkon5fmfp2l3+ZkQ2me/+oecHYLOII= github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI= @@ -252,16 +249,17 @@ github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8 github.com/pin/tftp v2.1.0+incompatible/go.mod h1:xVpZOMCXTy+A5QMjEVN0Glwa1sUvaJhFXbr/aAxuxGY= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= -github.com/prometheus/common v0.66.1 h1:h5E0h5/Y8niHc5DlaLlWLArTQI7tMrsfQjHV+d9ZoGs= -github.com/prometheus/common v0.66.1/go.mod h1:gcaUsgf3KfRSwHY4dIMXLPV0K/Wg1oZ8+SbZk/HH/dA= -github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= -github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= +github.com/prometheus/common v0.67.5 h1:pIgK94WWlQt1WLwAC5j2ynLaBRDiinoAb86HZHTUGI4= +github.com/prometheus/common v0.67.5/go.mod h1:SjE/0MzDEEAyrdr5Gqc6G+sXI67maCxzaT3A2+HqjUw= +github.com/prometheus/procfs v0.19.2 h1:zUMhqEW66Ex7OXIiDkll3tl9a1ZdilUOd/F6ZXw4Vws= +github.com/prometheus/procfs v0.19.2/go.mod h1:M0aotyiemPhBCM0z5w87kL22CxfcH05ZpYlu+b4J7mw= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= @@ -341,10 +339,10 @@ go.etcd.io/etcd/client/pkg/v3 v3.6.8 h1:Qs/5C0LNFiqXxYf2GU8MVjYUEXJ6sZaYOz0zEqQg go.etcd.io/etcd/client/pkg/v3 v3.6.8/go.mod h1:GsiTRUZE2318PggZkAo6sWb6l8JLVrnckTNfbG8PWtw= go.etcd.io/etcd/client/v3 v3.6.8 h1:B3G76t1UykqAOrbio7s/EPatixQDkQBevN8/mwiplrY= go.etcd.io/etcd/client/v3 v3.6.8/go.mod h1:MVG4BpSIuumPi+ELF7wYtySETmoTWBHVcDoHdVupwt8= -go.etcd.io/etcd/pkg/v3 v3.6.5 h1:byxWB4AqIKI4SBmquZUG1WGtvMfMaorXFoCcFbVeoxM= -go.etcd.io/etcd/pkg/v3 v3.6.5/go.mod h1:uqrXrzmMIJDEy5j00bCqhVLzR5jEJIwDp5wTlLwPGOU= -go.etcd.io/etcd/server/v3 v3.6.5 h1:4RbUb1Bd4y1WkBHmuF+cZII83JNQMuNXzyjwigQ06y0= -go.etcd.io/etcd/server/v3 v3.6.5/go.mod h1:PLuhyVXz8WWRhzXDsl3A3zv/+aK9e4A9lpQkqawIaH0= +go.etcd.io/etcd/pkg/v3 v3.6.8 h1:Xe+LIL974spy8b4nEx3H0KMr1ofq3r0kh6FbU3aw4es= +go.etcd.io/etcd/pkg/v3 v3.6.8/go.mod h1:TRibVNe+FqJIe1abOAA1PsuQ4wqO87ZaOoprg09Tn8c= +go.etcd.io/etcd/server/v3 v3.6.8 h1:U2strdSEy1U8qcSzRIdkYpvOPtBy/9i/IfaaCI9flZ4= +go.etcd.io/etcd/server/v3 v3.6.8/go.mod h1:88dCtwUnSirkUoJbflQxxWXqtBSZa6lSG0Kuej+dois= go.etcd.io/raft/v3 v3.6.0 h1:5NtvbDVYpnfZWcIHgGRk9DyzkBIXOi8j+DDp1IcnUWQ= go.etcd.io/raft/v3 v3.6.0/go.mod h1:nLvLevg6+xrVtHUmVaTcTz603gQPHfh7kUAwV6YpfGo= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= @@ -387,8 +385,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.48.0 h1:/VRzVqiRSggnhY7gNRxPauEQ5Drw9haKdM0jqfcCFts= golang.org/x/crypto v0.48.0/go.mod h1:r0kV5h3qnFPlQnBSrULhlsRfryS2pmewsg+XfMgkVos= -golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8= -golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY= +golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93 h1:fQsdNF2N+/YewlRZiricy4P1iimyPKZ/xwniHj8Q2a0= +golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93/go.mod h1:EPRbTFwzwjXj9NpYyyrvenVh9Y+GFeEvMNh7Xuz7xgU= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.32.0 h1:9F4d3PHLljb6x//jOyokMv3eX+YDeepZSEo3mFJy93c= @@ -424,8 +422,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk= golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA= -golang.org/x/time v0.9.0 h1:EsRrnYcQiGH+5FfbgvV4AP7qEZstoyrHB0DzarOQ4ZY= -golang.org/x/time v0.9.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI= +golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -465,30 +463,28 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o= gotest.tools/v3 v3.4.0/go.mod h1:CtbdzLSsqVhDgMtKsx03ird5YTGB3ar27v0u/yKBW5g= -k8s.io/api v0.35.2 h1:tW7mWc2RpxW7HS4CoRXhtYHSzme1PN1UjGHJ1bdrtdw= -k8s.io/api v0.35.2/go.mod h1:7AJfqGoAZcwSFhOjcGM7WV05QxMMgUaChNfLTXDRE60= -k8s.io/apiextensions-apiserver v0.35.2 h1:iyStXHoJZsUXPh/nFAsjC29rjJWdSgUmG1XpApE29c0= -k8s.io/apiextensions-apiserver v0.35.2/go.mod h1:OdyGvcO1FtMDWQ+rRh/Ei3b6X3g2+ZDHd0MSRGeS8rU= -k8s.io/apimachinery v0.35.2 h1:NqsM/mmZA7sHW02JZ9RTtk3wInRgbVxL8MPfzSANAK8= -k8s.io/apimachinery v0.35.2/go.mod h1:jQCgFZFR1F4Ik7hvr2g84RTJSZegBc8yHgFWKn//hns= -k8s.io/apiserver v0.35.2 h1:rb52v0CZGEL0FkhjS+I6jHflAp7fZ4MIaKcEHX7wmDk= -k8s.io/apiserver v0.35.2/go.mod h1:CROJUAu0tfjZLyYgSeBsBan2T7LUJGh0ucWwTCSSk7g= -k8s.io/client-go v0.35.2 h1:YUfPefdGJA4aljDdayAXkc98DnPkIetMl4PrKX97W9o= -k8s.io/client-go v0.35.2/go.mod h1:4QqEwh4oQpeK8AaefZ0jwTFJw/9kIjdQi0jpKeYvz7g= -k8s.io/cluster-bootstrap v0.35.2 h1:6qGTBbRabtK3NU42fVdeKsWQy5yT7RPyqn5RmXTlGXk= -k8s.io/cluster-bootstrap v0.35.2/go.mod h1:dWypJ4l++6TDt+zJOr3aog2cOZ4kWDAnkcDdsc1vW8Q= -k8s.io/component-base v0.35.2 h1:btgR+qNrpWuRSuvWSnQYsZy88yf5gVwemvz0yw79pGc= -k8s.io/component-base v0.35.2/go.mod h1:B1iBJjooe6xIJYUucAxb26RwhAjzx0gHnqO9htWIX+0= +k8s.io/api v0.36.0-alpha.2 h1:5VQ17JO0v+9X/meq70nUzb6Ec7zuAfP+izKiJMeu9zM= +k8s.io/api v0.36.0-alpha.2/go.mod h1:VrBGsSGpBoBDkL0gV2hd11bLXcW3xX0/dg352BZthWs= +k8s.io/apiextensions-apiserver v0.36.0-alpha.2 h1:YkcqeHkx+cX/Qk9kH/IH88F0gkNIFLqVQeIG2FOyDKQ= +k8s.io/apiextensions-apiserver v0.36.0-alpha.2/go.mod h1:88Ee1E7oqcG1VwCpi0DPD8qIVX7sSz7MNLyVsZMQLl0= +k8s.io/apimachinery v0.36.0-alpha.2 h1:I3A/nvRsgV/j/AX7VXDn8XjuDz2gsfcdOTVCkKMRLsQ= +k8s.io/apimachinery v0.36.0-alpha.2/go.mod h1:7mgr/dli8ofwAbcIQXetFVX1fbOYsOYojq3AUbybVmQ= +k8s.io/apiserver v0.36.0-alpha.2 h1:7IS97LYVQ9zk6Fhykrljpn7De4VAEamR2lL/t1eWzfI= +k8s.io/apiserver v0.36.0-alpha.2/go.mod h1:jVN5pyVw9YSo5ZpmerTTAQaX2RcluD5CI2Ezyb2z4cU= +k8s.io/client-go v0.36.0-alpha.2 h1:Tk1GnYEd9KjzRG9QN84DWghJ4I91Cy5pbxSyffEZlhw= +k8s.io/client-go v0.36.0-alpha.2/go.mod h1:exn5BZg49XPJN4xNe18t4O3LJah8seb2Fxl7IyUJ6jY= +k8s.io/cluster-bootstrap v0.35.1 h1:QVqt6xak8UPa2z+Fxc52lREc6kK+3qT0nFjXZSUpo8Q= +k8s.io/cluster-bootstrap v0.35.1/go.mod h1:gfcOtdu7BmK71xdEm57MkRO3g76TzBsQsPj8pqojseA= +k8s.io/component-base v0.36.0-alpha.2 h1:V2jcC1cWxdWfLvWZ1tRv+9C9844zfJtzKE2bsltaAuI= +k8s.io/component-base v0.36.0-alpha.2/go.mod h1:0BDaTMFJnMBD+wSUbfQ/2azaNn9gx+/PzE21NPrYKhM= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= -k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 h1:Y3gxNAuB0OBLImH611+UDZcmKS3g6CthxToOb37KgwE= -k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912/go.mod h1:kdmbQkyfwUagLfXIad1y2TdrjPFWp2Q89B3qkRwf/pQ= -k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 h1:SjGebBtkBqHFOli+05xYbK8YF1Dzkbzn+gDM4X9T4Ck= -k8s.io/utils v0.0.0-20251002143259-bc988d571ff4/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 h1:jpcvIRr3GLoUoEKRkHKSmGjxb6lWwrBlJsXc+eUYQHM= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw= -sigs.k8s.io/controller-runtime v0.23.3 h1:VjB/vhoPoA9l1kEKZHBMnQF33tdCLQKJtydy4iqwZ80= -sigs.k8s.io/controller-runtime v0.23.3/go.mod h1:B6COOxKptp+YaUT5q4l6LqUJTRpizbgf9KSRNdQGns0= +k8s.io/kube-openapi v0.0.0-20260127142750-a19766b6e2d4 h1:HhDfevmPS+OalTjQRKbTHppRIz01AWi8s45TMXStgYY= +k8s.io/kube-openapi v0.0.0-20260127142750-a19766b6e2d4/go.mod h1:kdmbQkyfwUagLfXIad1y2TdrjPFWp2Q89B3qkRwf/pQ= +k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2 h1:AZYQSJemyQB5eRxqcPky+/7EdBj0xi3g0ZcxxJ7vbWU= +k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.34.0 h1:hSfpvjjTQXQY2Fol2CS0QHMNs/WI1MOSGzCm1KhM5ec= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.34.0/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw= sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg= sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg= sigs.k8s.io/kind v0.31.0 h1:UcT4nzm+YM7YEbqiAKECk+b6dsvc/HRZZu9U0FolL1g= diff --git a/util/applyconfigurations/core/v1beta2/apiendpoint.go b/util/applyconfigurations/core/v1beta2/apiendpoint.go new file mode 100644 index 000000000000..581c1a59764a --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/apiendpoint.go @@ -0,0 +1,36 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// APIEndpointApplyConfiguration represents a declarative configuration of the APIEndpoint type for use +// with apply. +// +// APIEndpoint represents a reachable Kubernetes API endpoint. +type APIEndpointApplyConfiguration struct { + // host is the hostname on which the API server is serving. + Host *string `json:"host,omitempty"` + // port is the port on which the API server is serving. + Port *int32 `json:"port,omitempty"` +} + +// APIEndpointApplyConfiguration constructs a declarative configuration of the APIEndpoint type for use with +// apply. +func APIEndpoint() *APIEndpointApplyConfiguration { + return &APIEndpointApplyConfiguration{} +} + +// WithHost sets the Host field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Host field is set to the value of the last call. +func (b *APIEndpointApplyConfiguration) WithHost(value string) *APIEndpointApplyConfiguration { + b.Host = &value + return b +} + +// WithPort sets the Port field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Port field is set to the value of the last call. +func (b *APIEndpointApplyConfiguration) WithPort(value int32) *APIEndpointApplyConfiguration { + b.Port = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/bootstrap.go b/util/applyconfigurations/core/v1beta2/bootstrap.go new file mode 100644 index 000000000000..a8de6cc8a76c --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/bootstrap.go @@ -0,0 +1,40 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// BootstrapApplyConfiguration represents a declarative configuration of the Bootstrap type for use +// with apply. +// +// Bootstrap encapsulates fields to configure the Machine’s bootstrapping mechanism. +type BootstrapApplyConfiguration struct { + // configRef is a reference to a bootstrap provider-specific resource + // that holds configuration details. The reference is optional to + // allow users/operators to specify Bootstrap.DataSecretName without + // the need of a controller. + ConfigRef *ContractVersionedObjectReferenceApplyConfiguration `json:"configRef,omitempty"` + // dataSecretName is the name of the secret that stores the bootstrap data script. + // If nil, the Machine should remain in the Pending state. + DataSecretName *string `json:"dataSecretName,omitempty"` +} + +// BootstrapApplyConfiguration constructs a declarative configuration of the Bootstrap type for use with +// apply. +func Bootstrap() *BootstrapApplyConfiguration { + return &BootstrapApplyConfiguration{} +} + +// WithConfigRef sets the ConfigRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ConfigRef field is set to the value of the last call. +func (b *BootstrapApplyConfiguration) WithConfigRef(value *ContractVersionedObjectReferenceApplyConfiguration) *BootstrapApplyConfiguration { + b.ConfigRef = value + return b +} + +// WithDataSecretName sets the DataSecretName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DataSecretName field is set to the value of the last call. +func (b *BootstrapApplyConfiguration) WithDataSecretName(value string) *BootstrapApplyConfiguration { + b.DataSecretName = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/cluster.go b/util/applyconfigurations/core/v1beta2/cluster.go new file mode 100644 index 000000000000..3aaaf56c9778 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/cluster.go @@ -0,0 +1,277 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" + corev1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2" + internal "sigs.k8s.io/cluster-api/util/applyconfigurations/internal" +) + +// ClusterApplyConfiguration represents a declarative configuration of the Cluster type for use +// with apply. +// +// Cluster is the Schema for the clusters API. +type ClusterApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + // metadata is the standard object's metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + // spec is the desired state of Cluster. + Spec *ClusterSpecApplyConfiguration `json:"spec,omitempty"` + // status is the observed state of Cluster. + Status *ClusterStatusApplyConfiguration `json:"status,omitempty"` +} + +// Cluster constructs a declarative configuration of the Cluster type for use with +// apply. +func Cluster(name, namespace string) *ClusterApplyConfiguration { + b := &ClusterApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Cluster") + b.WithAPIVersion("cluster.x-k8s.io/v1beta2") + return b +} + +// ExtractClusterFrom extracts the applied configuration owned by fieldManager from +// cluster for the specified subresource. Pass an empty string for subresource to extract +// the main resource. Common subresources include "status", "scale", etc. +// cluster must be a unmodified Cluster API object that was retrieved from the Kubernetes API. +// ExtractClusterFrom provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractClusterFrom(cluster *corev1beta2.Cluster, fieldManager string, subresource string) (*ClusterApplyConfiguration, error) { + b := &ClusterApplyConfiguration{} + err := managedfields.ExtractInto(cluster, internal.Parser().Type("io.k8s.sigs.cluster-api.api.core.v1beta2.Cluster"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(cluster.Name) + b.WithNamespace(cluster.Namespace) + + b.WithKind("Cluster") + b.WithAPIVersion("cluster.x-k8s.io/v1beta2") + return b, nil +} + +// ExtractCluster extracts the applied configuration owned by fieldManager from +// cluster. If no managedFields are found in cluster for fieldManager, a +// ClusterApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// cluster must be a unmodified Cluster API object that was retrieved from the Kubernetes API. +// ExtractCluster provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractCluster(cluster *corev1beta2.Cluster, fieldManager string) (*ClusterApplyConfiguration, error) { + return ExtractClusterFrom(cluster, fieldManager, "") +} + +// ExtractClusterStatus extracts the applied configuration owned by fieldManager from +// cluster for the status subresource. +func ExtractClusterStatus(cluster *corev1beta2.Cluster, fieldManager string) (*ClusterApplyConfiguration, error) { + return ExtractClusterFrom(cluster, fieldManager, "status") +} + +func (b ClusterApplyConfiguration) IsApplyConfiguration() {} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *ClusterApplyConfiguration) WithKind(value string) *ClusterApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ClusterApplyConfiguration) WithAPIVersion(value string) *ClusterApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ClusterApplyConfiguration) WithName(value string) *ClusterApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *ClusterApplyConfiguration) WithGenerateName(value string) *ClusterApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ClusterApplyConfiguration) WithNamespace(value string) *ClusterApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *ClusterApplyConfiguration) WithUID(value types.UID) *ClusterApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ClusterApplyConfiguration) WithResourceVersion(value string) *ClusterApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *ClusterApplyConfiguration) WithGeneration(value int64) *ClusterApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *ClusterApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ClusterApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *ClusterApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ClusterApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ClusterApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ClusterApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ClusterApplyConfiguration) WithLabels(entries map[string]string) *ClusterApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ClusterApplyConfiguration) WithAnnotations(entries map[string]string) *ClusterApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ClusterApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ClusterApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ClusterApplyConfiguration) WithFinalizers(values ...string) *ClusterApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *ClusterApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *ClusterApplyConfiguration) WithSpec(value *ClusterSpecApplyConfiguration) *ClusterApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *ClusterApplyConfiguration) WithStatus(value *ClusterStatusApplyConfiguration) *ClusterApplyConfiguration { + b.Status = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *ClusterApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *ClusterApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *ClusterApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *ClusterApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/util/applyconfigurations/core/v1beta2/clusteravailabilitygate.go b/util/applyconfigurations/core/v1beta2/clusteravailabilitygate.go new file mode 100644 index 000000000000..2deff4cc0437 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/clusteravailabilitygate.go @@ -0,0 +1,46 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + corev1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2" +) + +// ClusterAvailabilityGateApplyConfiguration represents a declarative configuration of the ClusterAvailabilityGate type for use +// with apply. +// +// ClusterAvailabilityGate contains the type of a Cluster condition to be used as availability gate. +type ClusterAvailabilityGateApplyConfiguration struct { + // conditionType refers to a condition with matching type in the Cluster's condition list. + // If the conditions doesn't exist, it will be treated as unknown. + // Note: Both Cluster API conditions or conditions added by 3rd party controllers can be used as availability gates. + ConditionType *string `json:"conditionType,omitempty"` + // polarity of the conditionType specified in this availabilityGate. + // Valid values are Positive, Negative and omitted. + // When omitted, the default behaviour will be Positive. + // A positive polarity means that the condition should report a true status under normal conditions. + // A negative polarity means that the condition should report a false status under normal conditions. + Polarity *corev1beta2.ConditionPolarity `json:"polarity,omitempty"` +} + +// ClusterAvailabilityGateApplyConfiguration constructs a declarative configuration of the ClusterAvailabilityGate type for use with +// apply. +func ClusterAvailabilityGate() *ClusterAvailabilityGateApplyConfiguration { + return &ClusterAvailabilityGateApplyConfiguration{} +} + +// WithConditionType sets the ConditionType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ConditionType field is set to the value of the last call. +func (b *ClusterAvailabilityGateApplyConfiguration) WithConditionType(value string) *ClusterAvailabilityGateApplyConfiguration { + b.ConditionType = &value + return b +} + +// WithPolarity sets the Polarity field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Polarity field is set to the value of the last call. +func (b *ClusterAvailabilityGateApplyConfiguration) WithPolarity(value corev1beta2.ConditionPolarity) *ClusterAvailabilityGateApplyConfiguration { + b.Polarity = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/clusterclass.go b/util/applyconfigurations/core/v1beta2/clusterclass.go new file mode 100644 index 000000000000..0ebebe5777d8 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/clusterclass.go @@ -0,0 +1,278 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" + corev1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2" + internal "sigs.k8s.io/cluster-api/util/applyconfigurations/internal" +) + +// ClusterClassApplyConfiguration represents a declarative configuration of the ClusterClass type for use +// with apply. +// +// ClusterClass is a template which can be used to create managed topologies. +// NOTE: This CRD can only be used if the ClusterTopology feature gate is enabled. +type ClusterClassApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + // metadata is the standard object's metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + // spec is the desired state of ClusterClass. + Spec *ClusterClassSpecApplyConfiguration `json:"spec,omitempty"` + // status is the observed state of ClusterClass. + Status *ClusterClassStatusApplyConfiguration `json:"status,omitempty"` +} + +// ClusterClass constructs a declarative configuration of the ClusterClass type for use with +// apply. +func ClusterClass(name, namespace string) *ClusterClassApplyConfiguration { + b := &ClusterClassApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("ClusterClass") + b.WithAPIVersion("cluster.x-k8s.io/v1beta2") + return b +} + +// ExtractClusterClassFrom extracts the applied configuration owned by fieldManager from +// clusterClass for the specified subresource. Pass an empty string for subresource to extract +// the main resource. Common subresources include "status", "scale", etc. +// clusterClass must be a unmodified ClusterClass API object that was retrieved from the Kubernetes API. +// ExtractClusterClassFrom provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractClusterClassFrom(clusterClass *corev1beta2.ClusterClass, fieldManager string, subresource string) (*ClusterClassApplyConfiguration, error) { + b := &ClusterClassApplyConfiguration{} + err := managedfields.ExtractInto(clusterClass, internal.Parser().Type("io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterClass"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(clusterClass.Name) + b.WithNamespace(clusterClass.Namespace) + + b.WithKind("ClusterClass") + b.WithAPIVersion("cluster.x-k8s.io/v1beta2") + return b, nil +} + +// ExtractClusterClass extracts the applied configuration owned by fieldManager from +// clusterClass. If no managedFields are found in clusterClass for fieldManager, a +// ClusterClassApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// clusterClass must be a unmodified ClusterClass API object that was retrieved from the Kubernetes API. +// ExtractClusterClass provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractClusterClass(clusterClass *corev1beta2.ClusterClass, fieldManager string) (*ClusterClassApplyConfiguration, error) { + return ExtractClusterClassFrom(clusterClass, fieldManager, "") +} + +// ExtractClusterClassStatus extracts the applied configuration owned by fieldManager from +// clusterClass for the status subresource. +func ExtractClusterClassStatus(clusterClass *corev1beta2.ClusterClass, fieldManager string) (*ClusterClassApplyConfiguration, error) { + return ExtractClusterClassFrom(clusterClass, fieldManager, "status") +} + +func (b ClusterClassApplyConfiguration) IsApplyConfiguration() {} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *ClusterClassApplyConfiguration) WithKind(value string) *ClusterClassApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ClusterClassApplyConfiguration) WithAPIVersion(value string) *ClusterClassApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ClusterClassApplyConfiguration) WithName(value string) *ClusterClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *ClusterClassApplyConfiguration) WithGenerateName(value string) *ClusterClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ClusterClassApplyConfiguration) WithNamespace(value string) *ClusterClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *ClusterClassApplyConfiguration) WithUID(value types.UID) *ClusterClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ClusterClassApplyConfiguration) WithResourceVersion(value string) *ClusterClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *ClusterClassApplyConfiguration) WithGeneration(value int64) *ClusterClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *ClusterClassApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ClusterClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *ClusterClassApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ClusterClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ClusterClassApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ClusterClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ClusterClassApplyConfiguration) WithLabels(entries map[string]string) *ClusterClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ClusterClassApplyConfiguration) WithAnnotations(entries map[string]string) *ClusterClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ClusterClassApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ClusterClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ClusterClassApplyConfiguration) WithFinalizers(values ...string) *ClusterClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *ClusterClassApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *ClusterClassApplyConfiguration) WithSpec(value *ClusterClassSpecApplyConfiguration) *ClusterClassApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *ClusterClassApplyConfiguration) WithStatus(value *ClusterClassStatusApplyConfiguration) *ClusterClassApplyConfiguration { + b.Status = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *ClusterClassApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *ClusterClassApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *ClusterClassApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *ClusterClassApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/util/applyconfigurations/core/v1beta2/clusterclassdeprecatedstatus.go b/util/applyconfigurations/core/v1beta2/clusterclassdeprecatedstatus.go new file mode 100644 index 000000000000..a9b704e3f6cb --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/clusterclassdeprecatedstatus.go @@ -0,0 +1,27 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// ClusterClassDeprecatedStatusApplyConfiguration represents a declarative configuration of the ClusterClassDeprecatedStatus type for use +// with apply. +// +// ClusterClassDeprecatedStatus groups all the status fields that are deprecated and will be removed in a future version. +// See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context. +type ClusterClassDeprecatedStatusApplyConfiguration struct { + // v1beta1 groups all the status fields that are deprecated and will be removed when support for v1beta1 will be dropped. + V1Beta1 *ClusterClassV1Beta1DeprecatedStatusApplyConfiguration `json:"v1beta1,omitempty"` +} + +// ClusterClassDeprecatedStatusApplyConfiguration constructs a declarative configuration of the ClusterClassDeprecatedStatus type for use with +// apply. +func ClusterClassDeprecatedStatus() *ClusterClassDeprecatedStatusApplyConfiguration { + return &ClusterClassDeprecatedStatusApplyConfiguration{} +} + +// WithV1Beta1 sets the V1Beta1 field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the V1Beta1 field is set to the value of the last call. +func (b *ClusterClassDeprecatedStatusApplyConfiguration) WithV1Beta1(value *ClusterClassV1Beta1DeprecatedStatusApplyConfiguration) *ClusterClassDeprecatedStatusApplyConfiguration { + b.V1Beta1 = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/clusterclasspatch.go b/util/applyconfigurations/core/v1beta2/clusterclasspatch.go new file mode 100644 index 000000000000..0ef2e19cb4d2 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/clusterclasspatch.go @@ -0,0 +1,78 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// ClusterClassPatchApplyConfiguration represents a declarative configuration of the ClusterClassPatch type for use +// with apply. +// +// ClusterClassPatch defines a patch which is applied to customize the referenced templates. +type ClusterClassPatchApplyConfiguration struct { + // name of the patch. + Name *string `json:"name,omitempty"` + // description is a human-readable description of this patch. + Description *string `json:"description,omitempty"` + // enabledIf is a Go template to be used to calculate if a patch should be enabled. + // It can reference variables defined in .spec.variables and builtin variables. + // The patch will be enabled if the template evaluates to `true`, otherwise it will + // be disabled. + // If EnabledIf is not set, the patch will be enabled per default. + EnabledIf *string `json:"enabledIf,omitempty"` + // definitions define inline patches. + // Note: Patches will be applied in the order of the array. + // Note: Exactly one of Definitions or External must be set. + Definitions []PatchDefinitionApplyConfiguration `json:"definitions,omitempty"` + // external defines an external patch. + // Note: Exactly one of Definitions or External must be set. + External *ExternalPatchDefinitionApplyConfiguration `json:"external,omitempty"` +} + +// ClusterClassPatchApplyConfiguration constructs a declarative configuration of the ClusterClassPatch type for use with +// apply. +func ClusterClassPatch() *ClusterClassPatchApplyConfiguration { + return &ClusterClassPatchApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ClusterClassPatchApplyConfiguration) WithName(value string) *ClusterClassPatchApplyConfiguration { + b.Name = &value + return b +} + +// WithDescription sets the Description field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Description field is set to the value of the last call. +func (b *ClusterClassPatchApplyConfiguration) WithDescription(value string) *ClusterClassPatchApplyConfiguration { + b.Description = &value + return b +} + +// WithEnabledIf sets the EnabledIf field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the EnabledIf field is set to the value of the last call. +func (b *ClusterClassPatchApplyConfiguration) WithEnabledIf(value string) *ClusterClassPatchApplyConfiguration { + b.EnabledIf = &value + return b +} + +// WithDefinitions adds the given value to the Definitions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Definitions field. +func (b *ClusterClassPatchApplyConfiguration) WithDefinitions(values ...*PatchDefinitionApplyConfiguration) *ClusterClassPatchApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithDefinitions") + } + b.Definitions = append(b.Definitions, *values[i]) + } + return b +} + +// WithExternal sets the External field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the External field is set to the value of the last call. +func (b *ClusterClassPatchApplyConfiguration) WithExternal(value *ExternalPatchDefinitionApplyConfiguration) *ClusterClassPatchApplyConfiguration { + b.External = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/clusterclassref.go b/util/applyconfigurations/core/v1beta2/clusterclassref.go new file mode 100644 index 000000000000..c23a5a9e13a3 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/clusterclassref.go @@ -0,0 +1,43 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// ClusterClassRefApplyConfiguration represents a declarative configuration of the ClusterClassRef type for use +// with apply. +// +// ClusterClassRef is the ref to the ClusterClass that should be used for the topology. +type ClusterClassRefApplyConfiguration struct { + // name is the name of the ClusterClass that should be used for the topology. + // name must be a valid ClusterClass name and because of that be at most 253 characters in length + // and it must consist only of lower case alphanumeric characters, hyphens (-) and periods (.), and must start + // and end with an alphanumeric character. + Name *string `json:"name,omitempty"` + // namespace is the namespace of the ClusterClass that should be used for the topology. + // If namespace is empty or not set, it is defaulted to the namespace of the Cluster object. + // namespace must be a valid namespace name and because of that be at most 63 characters in length + // and it must consist only of lower case alphanumeric characters or hyphens (-), and must start + // and end with an alphanumeric character. + Namespace *string `json:"namespace,omitempty"` +} + +// ClusterClassRefApplyConfiguration constructs a declarative configuration of the ClusterClassRef type for use with +// apply. +func ClusterClassRef() *ClusterClassRefApplyConfiguration { + return &ClusterClassRefApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ClusterClassRefApplyConfiguration) WithName(value string) *ClusterClassRefApplyConfiguration { + b.Name = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ClusterClassRefApplyConfiguration) WithNamespace(value string) *ClusterClassRefApplyConfiguration { + b.Namespace = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/clusterclassspec.go b/util/applyconfigurations/core/v1beta2/clusterclassspec.go new file mode 100644 index 000000000000..a85389bdc74a --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/clusterclassspec.go @@ -0,0 +1,126 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// ClusterClassSpecApplyConfiguration represents a declarative configuration of the ClusterClassSpec type for use +// with apply. +// +// ClusterClassSpec describes the desired state of the ClusterClass. +type ClusterClassSpecApplyConfiguration struct { + // availabilityGates specifies additional conditions to include when evaluating Cluster Available condition. + // + // NOTE: If a Cluster is using this ClusterClass, and this Cluster defines a custom list of availabilityGates, + // such list overrides availabilityGates defined in this field. + AvailabilityGates []ClusterAvailabilityGateApplyConfiguration `json:"availabilityGates,omitempty"` + // infrastructure is a reference to a local struct that holds the details + // for provisioning the infrastructure cluster for the Cluster. + Infrastructure *InfrastructureClassApplyConfiguration `json:"infrastructure,omitempty"` + // controlPlane is a reference to a local struct that holds the details + // for provisioning the Control Plane for the Cluster. + ControlPlane *ControlPlaneClassApplyConfiguration `json:"controlPlane,omitempty"` + // workers describes the worker nodes for the cluster. + // It is a collection of node types which can be used to create + // the worker nodes of the cluster. + Workers *WorkersClassApplyConfiguration `json:"workers,omitempty"` + // variables defines the variables which can be configured + // in the Cluster topology and are then used in patches. + Variables []ClusterClassVariableApplyConfiguration `json:"variables,omitempty"` + // patches defines the patches which are applied to customize + // referenced templates of a ClusterClass. + // Note: Patches will be applied in the order of the array. + Patches []ClusterClassPatchApplyConfiguration `json:"patches,omitempty"` + // upgrade defines the upgrade configuration for clusters using this ClusterClass. + Upgrade *ClusterClassUpgradeApplyConfiguration `json:"upgrade,omitempty"` + // kubernetesVersions is the list of Kubernetes versions that can be + // used for clusters using this ClusterClass. + // The list of version must be ordered from the older to the newer version, and there should be + // at least one version for every minor in between the first and the last version. + KubernetesVersions []string `json:"kubernetesVersions,omitempty"` +} + +// ClusterClassSpecApplyConfiguration constructs a declarative configuration of the ClusterClassSpec type for use with +// apply. +func ClusterClassSpec() *ClusterClassSpecApplyConfiguration { + return &ClusterClassSpecApplyConfiguration{} +} + +// WithAvailabilityGates adds the given value to the AvailabilityGates field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the AvailabilityGates field. +func (b *ClusterClassSpecApplyConfiguration) WithAvailabilityGates(values ...*ClusterAvailabilityGateApplyConfiguration) *ClusterClassSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithAvailabilityGates") + } + b.AvailabilityGates = append(b.AvailabilityGates, *values[i]) + } + return b +} + +// WithInfrastructure sets the Infrastructure field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Infrastructure field is set to the value of the last call. +func (b *ClusterClassSpecApplyConfiguration) WithInfrastructure(value *InfrastructureClassApplyConfiguration) *ClusterClassSpecApplyConfiguration { + b.Infrastructure = value + return b +} + +// WithControlPlane sets the ControlPlane field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ControlPlane field is set to the value of the last call. +func (b *ClusterClassSpecApplyConfiguration) WithControlPlane(value *ControlPlaneClassApplyConfiguration) *ClusterClassSpecApplyConfiguration { + b.ControlPlane = value + return b +} + +// WithWorkers sets the Workers field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Workers field is set to the value of the last call. +func (b *ClusterClassSpecApplyConfiguration) WithWorkers(value *WorkersClassApplyConfiguration) *ClusterClassSpecApplyConfiguration { + b.Workers = value + return b +} + +// WithVariables adds the given value to the Variables field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Variables field. +func (b *ClusterClassSpecApplyConfiguration) WithVariables(values ...*ClusterClassVariableApplyConfiguration) *ClusterClassSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithVariables") + } + b.Variables = append(b.Variables, *values[i]) + } + return b +} + +// WithPatches adds the given value to the Patches field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Patches field. +func (b *ClusterClassSpecApplyConfiguration) WithPatches(values ...*ClusterClassPatchApplyConfiguration) *ClusterClassSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithPatches") + } + b.Patches = append(b.Patches, *values[i]) + } + return b +} + +// WithUpgrade sets the Upgrade field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Upgrade field is set to the value of the last call. +func (b *ClusterClassSpecApplyConfiguration) WithUpgrade(value *ClusterClassUpgradeApplyConfiguration) *ClusterClassSpecApplyConfiguration { + b.Upgrade = value + return b +} + +// WithKubernetesVersions adds the given value to the KubernetesVersions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the KubernetesVersions field. +func (b *ClusterClassSpecApplyConfiguration) WithKubernetesVersions(values ...string) *ClusterClassSpecApplyConfiguration { + for i := range values { + b.KubernetesVersions = append(b.KubernetesVersions, values[i]) + } + return b +} diff --git a/util/applyconfigurations/core/v1beta2/clusterclassstatus.go b/util/applyconfigurations/core/v1beta2/clusterclassstatus.go new file mode 100644 index 000000000000..7ceae71d6caf --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/clusterclassstatus.go @@ -0,0 +1,71 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ClusterClassStatusApplyConfiguration represents a declarative configuration of the ClusterClassStatus type for use +// with apply. +// +// ClusterClassStatus defines the observed state of the ClusterClass. +type ClusterClassStatusApplyConfiguration struct { + // conditions represents the observations of a ClusterClass's current state. + // Known condition types are VariablesReady, RefVersionsUpToDate, Paused. + Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"` + // variables is a list of ClusterClassStatusVariable that are defined for the ClusterClass. + Variables []ClusterClassStatusVariableApplyConfiguration `json:"variables,omitempty"` + // observedGeneration is the latest generation observed by the controller. + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` + // deprecated groups all the status fields that are deprecated and will be removed when all the nested field are removed. + Deprecated *ClusterClassDeprecatedStatusApplyConfiguration `json:"deprecated,omitempty"` +} + +// ClusterClassStatusApplyConfiguration constructs a declarative configuration of the ClusterClassStatus type for use with +// apply. +func ClusterClassStatus() *ClusterClassStatusApplyConfiguration { + return &ClusterClassStatusApplyConfiguration{} +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *ClusterClassStatusApplyConfiguration) WithConditions(values ...*v1.ConditionApplyConfiguration) *ClusterClassStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithVariables adds the given value to the Variables field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Variables field. +func (b *ClusterClassStatusApplyConfiguration) WithVariables(values ...*ClusterClassStatusVariableApplyConfiguration) *ClusterClassStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithVariables") + } + b.Variables = append(b.Variables, *values[i]) + } + return b +} + +// WithObservedGeneration sets the ObservedGeneration field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ObservedGeneration field is set to the value of the last call. +func (b *ClusterClassStatusApplyConfiguration) WithObservedGeneration(value int64) *ClusterClassStatusApplyConfiguration { + b.ObservedGeneration = &value + return b +} + +// WithDeprecated sets the Deprecated field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Deprecated field is set to the value of the last call. +func (b *ClusterClassStatusApplyConfiguration) WithDeprecated(value *ClusterClassDeprecatedStatusApplyConfiguration) *ClusterClassStatusApplyConfiguration { + b.Deprecated = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/clusterclassstatusvariable.go b/util/applyconfigurations/core/v1beta2/clusterclassstatusvariable.go new file mode 100644 index 000000000000..289bf6682d16 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/clusterclassstatusvariable.go @@ -0,0 +1,51 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// ClusterClassStatusVariableApplyConfiguration represents a declarative configuration of the ClusterClassStatusVariable type for use +// with apply. +// +// ClusterClassStatusVariable defines a variable which appears in the status of a ClusterClass. +type ClusterClassStatusVariableApplyConfiguration struct { + // name is the name of the variable. + Name *string `json:"name,omitempty"` + // definitionsConflict specifies whether or not there are conflicting definitions for a single variable name. + DefinitionsConflict *bool `json:"definitionsConflict,omitempty"` + // definitions is a list of definitions for a variable. + Definitions []ClusterClassStatusVariableDefinitionApplyConfiguration `json:"definitions,omitempty"` +} + +// ClusterClassStatusVariableApplyConfiguration constructs a declarative configuration of the ClusterClassStatusVariable type for use with +// apply. +func ClusterClassStatusVariable() *ClusterClassStatusVariableApplyConfiguration { + return &ClusterClassStatusVariableApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ClusterClassStatusVariableApplyConfiguration) WithName(value string) *ClusterClassStatusVariableApplyConfiguration { + b.Name = &value + return b +} + +// WithDefinitionsConflict sets the DefinitionsConflict field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DefinitionsConflict field is set to the value of the last call. +func (b *ClusterClassStatusVariableApplyConfiguration) WithDefinitionsConflict(value bool) *ClusterClassStatusVariableApplyConfiguration { + b.DefinitionsConflict = &value + return b +} + +// WithDefinitions adds the given value to the Definitions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Definitions field. +func (b *ClusterClassStatusVariableApplyConfiguration) WithDefinitions(values ...*ClusterClassStatusVariableDefinitionApplyConfiguration) *ClusterClassStatusVariableApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithDefinitions") + } + b.Definitions = append(b.Definitions, *values[i]) + } + return b +} diff --git a/util/applyconfigurations/core/v1beta2/clusterclassstatusvariabledefinition.go b/util/applyconfigurations/core/v1beta2/clusterclassstatusvariabledefinition.go new file mode 100644 index 000000000000..abf8e959e264 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/clusterclassstatusvariabledefinition.go @@ -0,0 +1,65 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// ClusterClassStatusVariableDefinitionApplyConfiguration represents a declarative configuration of the ClusterClassStatusVariableDefinition type for use +// with apply. +// +// ClusterClassStatusVariableDefinition defines a variable which appears in the status of a ClusterClass. +type ClusterClassStatusVariableDefinitionApplyConfiguration struct { + // from specifies the origin of the variable definition. + // This will be `inline` for variables defined in the ClusterClass or the name of a patch defined in the ClusterClass + // for variables discovered from a DiscoverVariables runtime extensions. + From *string `json:"from,omitempty"` + // required specifies if the variable is required. + // Note: this applies to the variable as a whole and thus the + // top-level object defined in the schema. If nested fields are + // required, this will be specified inside the schema. + Required *bool `json:"required,omitempty"` + // deprecatedV1Beta1Metadata is the metadata of a variable. + // It can be used to add additional data for higher level tools to + // a ClusterClassVariable. + // + // Deprecated: This field is deprecated and will be removed when support for v1beta1 will be dropped. Please use XMetadata in JSONSchemaProps instead. + DeprecatedV1Beta1Metadata *ClusterClassVariableMetadataApplyConfiguration `json:"deprecatedV1Beta1Metadata,omitempty"` + // schema defines the schema of the variable. + Schema *VariableSchemaApplyConfiguration `json:"schema,omitempty"` +} + +// ClusterClassStatusVariableDefinitionApplyConfiguration constructs a declarative configuration of the ClusterClassStatusVariableDefinition type for use with +// apply. +func ClusterClassStatusVariableDefinition() *ClusterClassStatusVariableDefinitionApplyConfiguration { + return &ClusterClassStatusVariableDefinitionApplyConfiguration{} +} + +// WithFrom sets the From field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the From field is set to the value of the last call. +func (b *ClusterClassStatusVariableDefinitionApplyConfiguration) WithFrom(value string) *ClusterClassStatusVariableDefinitionApplyConfiguration { + b.From = &value + return b +} + +// WithRequired sets the Required field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Required field is set to the value of the last call. +func (b *ClusterClassStatusVariableDefinitionApplyConfiguration) WithRequired(value bool) *ClusterClassStatusVariableDefinitionApplyConfiguration { + b.Required = &value + return b +} + +// WithDeprecatedV1Beta1Metadata sets the DeprecatedV1Beta1Metadata field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeprecatedV1Beta1Metadata field is set to the value of the last call. +func (b *ClusterClassStatusVariableDefinitionApplyConfiguration) WithDeprecatedV1Beta1Metadata(value *ClusterClassVariableMetadataApplyConfiguration) *ClusterClassStatusVariableDefinitionApplyConfiguration { + b.DeprecatedV1Beta1Metadata = value + return b +} + +// WithSchema sets the Schema field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Schema field is set to the value of the last call. +func (b *ClusterClassStatusVariableDefinitionApplyConfiguration) WithSchema(value *VariableSchemaApplyConfiguration) *ClusterClassStatusVariableDefinitionApplyConfiguration { + b.Schema = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/clusterclasstemplatereference.go b/util/applyconfigurations/core/v1beta2/clusterclasstemplatereference.go new file mode 100644 index 000000000000..8e7ae12484e7 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/clusterclasstemplatereference.go @@ -0,0 +1,49 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// ClusterClassTemplateReferenceApplyConfiguration represents a declarative configuration of the ClusterClassTemplateReference type for use +// with apply. +// +// ClusterClassTemplateReference is a reference to a ClusterClass template. +type ClusterClassTemplateReferenceApplyConfiguration struct { + // kind of the template. + // kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character. + Kind *string `json:"kind,omitempty"` + // name of the template. + // name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character. + Name *string `json:"name,omitempty"` + // apiVersion of the template. + // apiVersion must be fully qualified domain name followed by / and a version. + APIVersion *string `json:"apiVersion,omitempty"` +} + +// ClusterClassTemplateReferenceApplyConfiguration constructs a declarative configuration of the ClusterClassTemplateReference type for use with +// apply. +func ClusterClassTemplateReference() *ClusterClassTemplateReferenceApplyConfiguration { + return &ClusterClassTemplateReferenceApplyConfiguration{} +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *ClusterClassTemplateReferenceApplyConfiguration) WithKind(value string) *ClusterClassTemplateReferenceApplyConfiguration { + b.Kind = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ClusterClassTemplateReferenceApplyConfiguration) WithName(value string) *ClusterClassTemplateReferenceApplyConfiguration { + b.Name = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ClusterClassTemplateReferenceApplyConfiguration) WithAPIVersion(value string) *ClusterClassTemplateReferenceApplyConfiguration { + b.APIVersion = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/clusterclassupgrade.go b/util/applyconfigurations/core/v1beta2/clusterclassupgrade.go new file mode 100644 index 000000000000..0d26e33b67f2 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/clusterclassupgrade.go @@ -0,0 +1,26 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// ClusterClassUpgradeApplyConfiguration represents a declarative configuration of the ClusterClassUpgrade type for use +// with apply. +// +// ClusterClassUpgrade defines the upgrade configuration for clusters using the ClusterClass. +type ClusterClassUpgradeApplyConfiguration struct { + // external defines external runtime extensions for upgrade operations. + External *ClusterClassUpgradeExternalApplyConfiguration `json:"external,omitempty"` +} + +// ClusterClassUpgradeApplyConfiguration constructs a declarative configuration of the ClusterClassUpgrade type for use with +// apply. +func ClusterClassUpgrade() *ClusterClassUpgradeApplyConfiguration { + return &ClusterClassUpgradeApplyConfiguration{} +} + +// WithExternal sets the External field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the External field is set to the value of the last call. +func (b *ClusterClassUpgradeApplyConfiguration) WithExternal(value *ClusterClassUpgradeExternalApplyConfiguration) *ClusterClassUpgradeApplyConfiguration { + b.External = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/clusterclassupgradeexternal.go b/util/applyconfigurations/core/v1beta2/clusterclassupgradeexternal.go new file mode 100644 index 000000000000..c06ae54e79b1 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/clusterclassupgradeexternal.go @@ -0,0 +1,26 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// ClusterClassUpgradeExternalApplyConfiguration represents a declarative configuration of the ClusterClassUpgradeExternal type for use +// with apply. +// +// ClusterClassUpgradeExternal defines external runtime extensions for upgrade operations. +type ClusterClassUpgradeExternalApplyConfiguration struct { + // generateUpgradePlanExtension references an extension which is called to generate upgrade plan. + GenerateUpgradePlanExtension *string `json:"generateUpgradePlanExtension,omitempty"` +} + +// ClusterClassUpgradeExternalApplyConfiguration constructs a declarative configuration of the ClusterClassUpgradeExternal type for use with +// apply. +func ClusterClassUpgradeExternal() *ClusterClassUpgradeExternalApplyConfiguration { + return &ClusterClassUpgradeExternalApplyConfiguration{} +} + +// WithGenerateUpgradePlanExtension sets the GenerateUpgradePlanExtension field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateUpgradePlanExtension field is set to the value of the last call. +func (b *ClusterClassUpgradeExternalApplyConfiguration) WithGenerateUpgradePlanExtension(value string) *ClusterClassUpgradeExternalApplyConfiguration { + b.GenerateUpgradePlanExtension = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/clusterclassv1beta1deprecatedstatus.go b/util/applyconfigurations/core/v1beta2/clusterclassv1beta1deprecatedstatus.go new file mode 100644 index 000000000000..f30f6da6a6aa --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/clusterclassv1beta1deprecatedstatus.go @@ -0,0 +1,33 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + corev1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2" +) + +// ClusterClassV1Beta1DeprecatedStatusApplyConfiguration represents a declarative configuration of the ClusterClassV1Beta1DeprecatedStatus type for use +// with apply. +// +// ClusterClassV1Beta1DeprecatedStatus 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 ClusterClassV1Beta1DeprecatedStatusApplyConfiguration struct { + // conditions defines current observed state of the ClusterClass. + // + // 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. + Conditions *corev1beta2.Conditions `json:"conditions,omitempty"` +} + +// ClusterClassV1Beta1DeprecatedStatusApplyConfiguration constructs a declarative configuration of the ClusterClassV1Beta1DeprecatedStatus type for use with +// apply. +func ClusterClassV1Beta1DeprecatedStatus() *ClusterClassV1Beta1DeprecatedStatusApplyConfiguration { + return &ClusterClassV1Beta1DeprecatedStatusApplyConfiguration{} +} + +// WithConditions sets the Conditions field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Conditions field is set to the value of the last call. +func (b *ClusterClassV1Beta1DeprecatedStatusApplyConfiguration) WithConditions(value corev1beta2.Conditions) *ClusterClassV1Beta1DeprecatedStatusApplyConfiguration { + b.Conditions = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/clusterclassvariable.go b/util/applyconfigurations/core/v1beta2/clusterclassvariable.go new file mode 100644 index 000000000000..b53e24bb1232 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/clusterclassvariable.go @@ -0,0 +1,64 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// ClusterClassVariableApplyConfiguration represents a declarative configuration of the ClusterClassVariable type for use +// with apply. +// +// ClusterClassVariable defines a variable which can +// be configured in the Cluster topology and used in patches. +type ClusterClassVariableApplyConfiguration struct { + // name of the variable. + Name *string `json:"name,omitempty"` + // required specifies if the variable is required. + // Note: this applies to the variable as a whole and thus the + // top-level object defined in the schema. If nested fields are + // required, this will be specified inside the schema. + Required *bool `json:"required,omitempty"` + // deprecatedV1Beta1Metadata is the metadata of a variable. + // It can be used to add additional data for higher level tools to + // a ClusterClassVariable. + // + // Deprecated: This field is deprecated and will be removed when support for v1beta1 will be dropped. Please use XMetadata in JSONSchemaProps instead. + DeprecatedV1Beta1Metadata *ClusterClassVariableMetadataApplyConfiguration `json:"deprecatedV1Beta1Metadata,omitempty"` + // schema defines the schema of the variable. + Schema *VariableSchemaApplyConfiguration `json:"schema,omitempty"` +} + +// ClusterClassVariableApplyConfiguration constructs a declarative configuration of the ClusterClassVariable type for use with +// apply. +func ClusterClassVariable() *ClusterClassVariableApplyConfiguration { + return &ClusterClassVariableApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ClusterClassVariableApplyConfiguration) WithName(value string) *ClusterClassVariableApplyConfiguration { + b.Name = &value + return b +} + +// WithRequired sets the Required field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Required field is set to the value of the last call. +func (b *ClusterClassVariableApplyConfiguration) WithRequired(value bool) *ClusterClassVariableApplyConfiguration { + b.Required = &value + return b +} + +// WithDeprecatedV1Beta1Metadata sets the DeprecatedV1Beta1Metadata field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeprecatedV1Beta1Metadata field is set to the value of the last call. +func (b *ClusterClassVariableApplyConfiguration) WithDeprecatedV1Beta1Metadata(value *ClusterClassVariableMetadataApplyConfiguration) *ClusterClassVariableApplyConfiguration { + b.DeprecatedV1Beta1Metadata = value + return b +} + +// WithSchema sets the Schema field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Schema field is set to the value of the last call. +func (b *ClusterClassVariableApplyConfiguration) WithSchema(value *VariableSchemaApplyConfiguration) *ClusterClassVariableApplyConfiguration { + b.Schema = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/clusterclassvariablemetadata.go b/util/applyconfigurations/core/v1beta2/clusterclassvariablemetadata.go new file mode 100644 index 000000000000..5b37887822eb --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/clusterclassvariablemetadata.go @@ -0,0 +1,55 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// ClusterClassVariableMetadataApplyConfiguration represents a declarative configuration of the ClusterClassVariableMetadata type for use +// with apply. +// +// ClusterClassVariableMetadata is the metadata of a variable. +// It can be used to add additional data for higher level tools to +// a ClusterClassVariable. +// +// Deprecated: This struct is deprecated and is going to be removed in the next apiVersion. +type ClusterClassVariableMetadataApplyConfiguration struct { + // labels is a map of string keys and values that can be used to organize and categorize + // (scope and select) variables. + Labels map[string]string `json:"labels,omitempty"` + // annotations is an unstructured key value map that can be used to store and + // retrieve arbitrary metadata. + // They are not queryable. + Annotations map[string]string `json:"annotations,omitempty"` +} + +// ClusterClassVariableMetadataApplyConfiguration constructs a declarative configuration of the ClusterClassVariableMetadata type for use with +// apply. +func ClusterClassVariableMetadata() *ClusterClassVariableMetadataApplyConfiguration { + return &ClusterClassVariableMetadataApplyConfiguration{} +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ClusterClassVariableMetadataApplyConfiguration) WithLabels(entries map[string]string) *ClusterClassVariableMetadataApplyConfiguration { + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ClusterClassVariableMetadataApplyConfiguration) WithAnnotations(entries map[string]string) *ClusterClassVariableMetadataApplyConfiguration { + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} diff --git a/util/applyconfigurations/core/v1beta2/clustercontrolplanestatus.go b/util/applyconfigurations/core/v1beta2/clustercontrolplanestatus.go new file mode 100644 index 000000000000..b9eb7df6676c --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/clustercontrolplanestatus.go @@ -0,0 +1,67 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// ClusterControlPlaneStatusApplyConfiguration represents a declarative configuration of the ClusterControlPlaneStatus type for use +// with apply. +// +// ClusterControlPlaneStatus groups all the observations about control plane current state. +type ClusterControlPlaneStatusApplyConfiguration struct { + // desiredReplicas is the total number of desired control plane machines in this cluster. + DesiredReplicas *int32 `json:"desiredReplicas,omitempty"` + // replicas is the total number of control plane machines in this cluster. + // NOTE: replicas also includes machines still being provisioned or being deleted. + Replicas *int32 `json:"replicas,omitempty"` + // upToDateReplicas is the number of up-to-date control plane machines in this cluster. A machine is considered up-to-date when Machine's UpToDate condition is true. + UpToDateReplicas *int32 `json:"upToDateReplicas,omitempty"` + // readyReplicas is the total number of ready control plane machines in this cluster. A machine is considered ready when Machine's Ready condition is true. + ReadyReplicas *int32 `json:"readyReplicas,omitempty"` + // availableReplicas is the total number of available control plane machines in this cluster. A machine is considered available when Machine's Available condition is true. + AvailableReplicas *int32 `json:"availableReplicas,omitempty"` +} + +// ClusterControlPlaneStatusApplyConfiguration constructs a declarative configuration of the ClusterControlPlaneStatus type for use with +// apply. +func ClusterControlPlaneStatus() *ClusterControlPlaneStatusApplyConfiguration { + return &ClusterControlPlaneStatusApplyConfiguration{} +} + +// WithDesiredReplicas sets the DesiredReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DesiredReplicas field is set to the value of the last call. +func (b *ClusterControlPlaneStatusApplyConfiguration) WithDesiredReplicas(value int32) *ClusterControlPlaneStatusApplyConfiguration { + b.DesiredReplicas = &value + return b +} + +// WithReplicas sets the Replicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Replicas field is set to the value of the last call. +func (b *ClusterControlPlaneStatusApplyConfiguration) WithReplicas(value int32) *ClusterControlPlaneStatusApplyConfiguration { + b.Replicas = &value + return b +} + +// WithUpToDateReplicas sets the UpToDateReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UpToDateReplicas field is set to the value of the last call. +func (b *ClusterControlPlaneStatusApplyConfiguration) WithUpToDateReplicas(value int32) *ClusterControlPlaneStatusApplyConfiguration { + b.UpToDateReplicas = &value + return b +} + +// WithReadyReplicas sets the ReadyReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadyReplicas field is set to the value of the last call. +func (b *ClusterControlPlaneStatusApplyConfiguration) WithReadyReplicas(value int32) *ClusterControlPlaneStatusApplyConfiguration { + b.ReadyReplicas = &value + return b +} + +// WithAvailableReplicas sets the AvailableReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AvailableReplicas field is set to the value of the last call. +func (b *ClusterControlPlaneStatusApplyConfiguration) WithAvailableReplicas(value int32) *ClusterControlPlaneStatusApplyConfiguration { + b.AvailableReplicas = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/clusterdeprecatedstatus.go b/util/applyconfigurations/core/v1beta2/clusterdeprecatedstatus.go new file mode 100644 index 000000000000..8997112f66df --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/clusterdeprecatedstatus.go @@ -0,0 +1,27 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// ClusterDeprecatedStatusApplyConfiguration represents a declarative configuration of the ClusterDeprecatedStatus type for use +// with apply. +// +// ClusterDeprecatedStatus groups all the status fields that are deprecated and will be removed in a future version. +// See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context. +type ClusterDeprecatedStatusApplyConfiguration struct { + // v1beta1 groups all the status fields that are deprecated and will be removed when support for v1beta1 will be dropped. + V1Beta1 *ClusterV1Beta1DeprecatedStatusApplyConfiguration `json:"v1beta1,omitempty"` +} + +// ClusterDeprecatedStatusApplyConfiguration constructs a declarative configuration of the ClusterDeprecatedStatus type for use with +// apply. +func ClusterDeprecatedStatus() *ClusterDeprecatedStatusApplyConfiguration { + return &ClusterDeprecatedStatusApplyConfiguration{} +} + +// WithV1Beta1 sets the V1Beta1 field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the V1Beta1 field is set to the value of the last call. +func (b *ClusterDeprecatedStatusApplyConfiguration) WithV1Beta1(value *ClusterV1Beta1DeprecatedStatusApplyConfiguration) *ClusterDeprecatedStatusApplyConfiguration { + b.V1Beta1 = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/clusterinitializationstatus.go b/util/applyconfigurations/core/v1beta2/clusterinitializationstatus.go new file mode 100644 index 000000000000..637852521f89 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/clusterinitializationstatus.go @@ -0,0 +1,44 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// ClusterInitializationStatusApplyConfiguration represents a declarative configuration of the ClusterInitializationStatus type for use +// with apply. +// +// ClusterInitializationStatus provides observations of the Cluster initialization process. +// NOTE: Fields in this struct are part of the Cluster API contract and are used to orchestrate initial Cluster provisioning. +type ClusterInitializationStatusApplyConfiguration struct { + // infrastructureProvisioned is true when the infrastructure provider reports that Cluster's infrastructure is fully provisioned. + // NOTE: this field is part of the Cluster API contract, and it is used to orchestrate provisioning. + // The value of this field is never updated after provisioning is completed. + InfrastructureProvisioned *bool `json:"infrastructureProvisioned,omitempty"` + // controlPlaneInitialized denotes when the control plane is functional enough to accept requests. + // This information is usually used as a signal for starting all the provisioning operations that depends on + // a functional API server, but do not require a full HA control plane to exists, like e.g. join worker Machines, + // install core addons like CNI, CPI, CSI etc. + // NOTE: this field is part of the Cluster API contract, and it is used to orchestrate provisioning. + // The value of this field is never updated after initialization is completed. + ControlPlaneInitialized *bool `json:"controlPlaneInitialized,omitempty"` +} + +// ClusterInitializationStatusApplyConfiguration constructs a declarative configuration of the ClusterInitializationStatus type for use with +// apply. +func ClusterInitializationStatus() *ClusterInitializationStatusApplyConfiguration { + return &ClusterInitializationStatusApplyConfiguration{} +} + +// WithInfrastructureProvisioned sets the InfrastructureProvisioned field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the InfrastructureProvisioned field is set to the value of the last call. +func (b *ClusterInitializationStatusApplyConfiguration) WithInfrastructureProvisioned(value bool) *ClusterInitializationStatusApplyConfiguration { + b.InfrastructureProvisioned = &value + return b +} + +// WithControlPlaneInitialized sets the ControlPlaneInitialized field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ControlPlaneInitialized field is set to the value of the last call. +func (b *ClusterInitializationStatusApplyConfiguration) WithControlPlaneInitialized(value bool) *ClusterInitializationStatusApplyConfiguration { + b.ControlPlaneInitialized = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/clusternetwork.go b/util/applyconfigurations/core/v1beta2/clusternetwork.go new file mode 100644 index 000000000000..f52abac1e757 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/clusternetwork.go @@ -0,0 +1,58 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// ClusterNetworkApplyConfiguration represents a declarative configuration of the ClusterNetwork type for use +// with apply. +// +// ClusterNetwork specifies the different networking +// parameters for a cluster. +type ClusterNetworkApplyConfiguration struct { + // apiServerPort specifies the port the API Server should bind to. + // Defaults to 6443. + APIServerPort *int32 `json:"apiServerPort,omitempty"` + // services is the network ranges from which service VIPs are allocated. + Services *NetworkRangesApplyConfiguration `json:"services,omitempty"` + // pods is the network ranges from which Pod networks are allocated. + Pods *NetworkRangesApplyConfiguration `json:"pods,omitempty"` + // serviceDomain is the domain name for services. + ServiceDomain *string `json:"serviceDomain,omitempty"` +} + +// ClusterNetworkApplyConfiguration constructs a declarative configuration of the ClusterNetwork type for use with +// apply. +func ClusterNetwork() *ClusterNetworkApplyConfiguration { + return &ClusterNetworkApplyConfiguration{} +} + +// WithAPIServerPort sets the APIServerPort field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIServerPort field is set to the value of the last call. +func (b *ClusterNetworkApplyConfiguration) WithAPIServerPort(value int32) *ClusterNetworkApplyConfiguration { + b.APIServerPort = &value + return b +} + +// WithServices sets the Services field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Services field is set to the value of the last call. +func (b *ClusterNetworkApplyConfiguration) WithServices(value *NetworkRangesApplyConfiguration) *ClusterNetworkApplyConfiguration { + b.Services = value + return b +} + +// WithPods sets the Pods field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Pods field is set to the value of the last call. +func (b *ClusterNetworkApplyConfiguration) WithPods(value *NetworkRangesApplyConfiguration) *ClusterNetworkApplyConfiguration { + b.Pods = value + return b +} + +// WithServiceDomain sets the ServiceDomain field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ServiceDomain field is set to the value of the last call. +func (b *ClusterNetworkApplyConfiguration) WithServiceDomain(value string) *ClusterNetworkApplyConfiguration { + b.ServiceDomain = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/clusterspec.go b/util/applyconfigurations/core/v1beta2/clusterspec.go new file mode 100644 index 000000000000..2a977714a1ad --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/clusterspec.go @@ -0,0 +1,98 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// ClusterSpecApplyConfiguration represents a declarative configuration of the ClusterSpec type for use +// with apply. +// +// ClusterSpec defines the desired state of Cluster. +type ClusterSpecApplyConfiguration struct { + // paused can be used to prevent controllers from processing the Cluster and all its associated objects. + Paused *bool `json:"paused,omitempty"` + // clusterNetwork represents the cluster network configuration. + ClusterNetwork *ClusterNetworkApplyConfiguration `json:"clusterNetwork,omitempty"` + // controlPlaneEndpoint represents the endpoint used to communicate with the control plane. + ControlPlaneEndpoint *APIEndpointApplyConfiguration `json:"controlPlaneEndpoint,omitempty"` + // controlPlaneRef is an optional reference to a provider-specific resource that holds + // the details for provisioning the Control Plane for a Cluster. + ControlPlaneRef *ContractVersionedObjectReferenceApplyConfiguration `json:"controlPlaneRef,omitempty"` + // infrastructureRef is a reference to a provider-specific resource that holds the details + // for provisioning infrastructure for a cluster in said provider. + InfrastructureRef *ContractVersionedObjectReferenceApplyConfiguration `json:"infrastructureRef,omitempty"` + // topology encapsulates the topology for the cluster. + // NOTE: It is required to enable the ClusterTopology + // feature gate flag to activate managed topologies support. + Topology *TopologyApplyConfiguration `json:"topology,omitempty"` + // availabilityGates specifies additional conditions to include when evaluating Cluster Available condition. + // + // If this field is not defined and the Cluster implements a managed topology, availabilityGates + // from the corresponding ClusterClass will be used, if any. + AvailabilityGates []ClusterAvailabilityGateApplyConfiguration `json:"availabilityGates,omitempty"` +} + +// ClusterSpecApplyConfiguration constructs a declarative configuration of the ClusterSpec type for use with +// apply. +func ClusterSpec() *ClusterSpecApplyConfiguration { + return &ClusterSpecApplyConfiguration{} +} + +// WithPaused sets the Paused field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Paused field is set to the value of the last call. +func (b *ClusterSpecApplyConfiguration) WithPaused(value bool) *ClusterSpecApplyConfiguration { + b.Paused = &value + return b +} + +// WithClusterNetwork sets the ClusterNetwork field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ClusterNetwork field is set to the value of the last call. +func (b *ClusterSpecApplyConfiguration) WithClusterNetwork(value *ClusterNetworkApplyConfiguration) *ClusterSpecApplyConfiguration { + b.ClusterNetwork = value + return b +} + +// WithControlPlaneEndpoint sets the ControlPlaneEndpoint field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ControlPlaneEndpoint field is set to the value of the last call. +func (b *ClusterSpecApplyConfiguration) WithControlPlaneEndpoint(value *APIEndpointApplyConfiguration) *ClusterSpecApplyConfiguration { + b.ControlPlaneEndpoint = value + return b +} + +// WithControlPlaneRef sets the ControlPlaneRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ControlPlaneRef field is set to the value of the last call. +func (b *ClusterSpecApplyConfiguration) WithControlPlaneRef(value *ContractVersionedObjectReferenceApplyConfiguration) *ClusterSpecApplyConfiguration { + b.ControlPlaneRef = value + return b +} + +// WithInfrastructureRef sets the InfrastructureRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the InfrastructureRef field is set to the value of the last call. +func (b *ClusterSpecApplyConfiguration) WithInfrastructureRef(value *ContractVersionedObjectReferenceApplyConfiguration) *ClusterSpecApplyConfiguration { + b.InfrastructureRef = value + return b +} + +// WithTopology sets the Topology field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Topology field is set to the value of the last call. +func (b *ClusterSpecApplyConfiguration) WithTopology(value *TopologyApplyConfiguration) *ClusterSpecApplyConfiguration { + b.Topology = value + return b +} + +// WithAvailabilityGates adds the given value to the AvailabilityGates field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the AvailabilityGates field. +func (b *ClusterSpecApplyConfiguration) WithAvailabilityGates(values ...*ClusterAvailabilityGateApplyConfiguration) *ClusterSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithAvailabilityGates") + } + b.AvailabilityGates = append(b.AvailabilityGates, *values[i]) + } + return b +} diff --git a/util/applyconfigurations/core/v1beta2/clusterstatus.go b/util/applyconfigurations/core/v1beta2/clusterstatus.go new file mode 100644 index 000000000000..58be83024fb0 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/clusterstatus.go @@ -0,0 +1,114 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ClusterStatusApplyConfiguration represents a declarative configuration of the ClusterStatus type for use +// with apply. +// +// ClusterStatus defines the observed state of Cluster. +type ClusterStatusApplyConfiguration struct { + // conditions represents the observations of a Cluster's current state. + // Known condition types are Available, InfrastructureReady, ControlPlaneInitialized, ControlPlaneAvailable, WorkersAvailable, MachinesReady + // MachinesUpToDate, RemoteConnectionProbe, ScalingUp, ScalingDown, Remediating, Deleting, Paused. + // Additionally, a TopologyReconciled condition will be added in case the Cluster is referencing a ClusterClass / defining a managed Topology. + Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"` + // initialization provides observations of the Cluster initialization process. + // NOTE: Fields in this struct are part of the Cluster API contract and are used to orchestrate initial Cluster provisioning. + Initialization *ClusterInitializationStatusApplyConfiguration `json:"initialization,omitempty"` + // controlPlane groups all the observations about Cluster's ControlPlane current state. + ControlPlane *ClusterControlPlaneStatusApplyConfiguration `json:"controlPlane,omitempty"` + // workers groups all the observations about Cluster's Workers current state. + Workers *WorkersStatusApplyConfiguration `json:"workers,omitempty"` + // failureDomains is a slice of failure domain objects synced from the infrastructure provider. + FailureDomains []FailureDomainApplyConfiguration `json:"failureDomains,omitempty"` + // phase represents the current phase of cluster actuation. + Phase *string `json:"phase,omitempty"` + // observedGeneration is the latest generation observed by the controller. + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` + // deprecated groups all the status fields that are deprecated and will be removed when all the nested field are removed. + Deprecated *ClusterDeprecatedStatusApplyConfiguration `json:"deprecated,omitempty"` +} + +// ClusterStatusApplyConfiguration constructs a declarative configuration of the ClusterStatus type for use with +// apply. +func ClusterStatus() *ClusterStatusApplyConfiguration { + return &ClusterStatusApplyConfiguration{} +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *ClusterStatusApplyConfiguration) WithConditions(values ...*v1.ConditionApplyConfiguration) *ClusterStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithInitialization sets the Initialization field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Initialization field is set to the value of the last call. +func (b *ClusterStatusApplyConfiguration) WithInitialization(value *ClusterInitializationStatusApplyConfiguration) *ClusterStatusApplyConfiguration { + b.Initialization = value + return b +} + +// WithControlPlane sets the ControlPlane field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ControlPlane field is set to the value of the last call. +func (b *ClusterStatusApplyConfiguration) WithControlPlane(value *ClusterControlPlaneStatusApplyConfiguration) *ClusterStatusApplyConfiguration { + b.ControlPlane = value + return b +} + +// WithWorkers sets the Workers field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Workers field is set to the value of the last call. +func (b *ClusterStatusApplyConfiguration) WithWorkers(value *WorkersStatusApplyConfiguration) *ClusterStatusApplyConfiguration { + b.Workers = value + return b +} + +// WithFailureDomains adds the given value to the FailureDomains field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the FailureDomains field. +func (b *ClusterStatusApplyConfiguration) WithFailureDomains(values ...*FailureDomainApplyConfiguration) *ClusterStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithFailureDomains") + } + b.FailureDomains = append(b.FailureDomains, *values[i]) + } + return b +} + +// WithPhase sets the Phase field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Phase field is set to the value of the last call. +func (b *ClusterStatusApplyConfiguration) WithPhase(value string) *ClusterStatusApplyConfiguration { + b.Phase = &value + return b +} + +// WithObservedGeneration sets the ObservedGeneration field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ObservedGeneration field is set to the value of the last call. +func (b *ClusterStatusApplyConfiguration) WithObservedGeneration(value int64) *ClusterStatusApplyConfiguration { + b.ObservedGeneration = &value + return b +} + +// WithDeprecated sets the Deprecated field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Deprecated field is set to the value of the last call. +func (b *ClusterStatusApplyConfiguration) WithDeprecated(value *ClusterDeprecatedStatusApplyConfiguration) *ClusterStatusApplyConfiguration { + b.Deprecated = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/clusterv1beta1deprecatedstatus.go b/util/applyconfigurations/core/v1beta2/clusterv1beta1deprecatedstatus.go new file mode 100644 index 000000000000..8b0f731e1b30 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/clusterv1beta1deprecatedstatus.go @@ -0,0 +1,61 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + corev1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2" + errors "sigs.k8s.io/cluster-api/errors" +) + +// ClusterV1Beta1DeprecatedStatusApplyConfiguration represents a declarative configuration of the ClusterV1Beta1DeprecatedStatus type for use +// with apply. +// +// ClusterV1Beta1DeprecatedStatus 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 ClusterV1Beta1DeprecatedStatusApplyConfiguration struct { + // conditions defines current service state of the cluster. + // + // 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. + Conditions *corev1beta2.Conditions `json:"conditions,omitempty"` + // failureReason indicates that there is a fatal problem reconciling the + // state, and will be set to a token value suitable for + // programmatic interpretation. + // + // 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. + FailureReason *errors.ClusterStatusError `json:"failureReason,omitempty"` + // failureMessage indicates that there is a fatal problem reconciling the + // state, and will be set to a descriptive error message. + // + // 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. + FailureMessage *string `json:"failureMessage,omitempty"` +} + +// ClusterV1Beta1DeprecatedStatusApplyConfiguration constructs a declarative configuration of the ClusterV1Beta1DeprecatedStatus type for use with +// apply. +func ClusterV1Beta1DeprecatedStatus() *ClusterV1Beta1DeprecatedStatusApplyConfiguration { + return &ClusterV1Beta1DeprecatedStatusApplyConfiguration{} +} + +// WithConditions sets the Conditions field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Conditions field is set to the value of the last call. +func (b *ClusterV1Beta1DeprecatedStatusApplyConfiguration) WithConditions(value corev1beta2.Conditions) *ClusterV1Beta1DeprecatedStatusApplyConfiguration { + b.Conditions = &value + return b +} + +// WithFailureReason sets the FailureReason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FailureReason field is set to the value of the last call. +func (b *ClusterV1Beta1DeprecatedStatusApplyConfiguration) WithFailureReason(value errors.ClusterStatusError) *ClusterV1Beta1DeprecatedStatusApplyConfiguration { + b.FailureReason = &value + return b +} + +// WithFailureMessage sets the FailureMessage field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FailureMessage field is set to the value of the last call. +func (b *ClusterV1Beta1DeprecatedStatusApplyConfiguration) WithFailureMessage(value string) *ClusterV1Beta1DeprecatedStatusApplyConfiguration { + b.FailureMessage = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/clustervariable.go b/util/applyconfigurations/core/v1beta2/clustervariable.go new file mode 100644 index 000000000000..a3731c16f27c --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/clustervariable.go @@ -0,0 +1,47 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" +) + +// ClusterVariableApplyConfiguration represents a declarative configuration of the ClusterVariable type for use +// with apply. +// +// ClusterVariable can be used to customize the Cluster through patches. Each ClusterVariable is associated with a +// Variable definition in the ClusterClass `status` variables. +type ClusterVariableApplyConfiguration struct { + // name of the variable. + Name *string `json:"name,omitempty"` + // value of the variable. + // Note: the value will be validated against the schema of the corresponding ClusterClassVariable + // from the ClusterClass. + // Note: We have to use apiextensionsv1.JSON instead of a custom JSON type, because controller-tools has a + // hard-coded schema for apiextensionsv1.JSON which cannot be produced by another type via controller-tools, + // i.e. it is not possible to have no type field. + // Ref: https://github.com/kubernetes-sigs/controller-tools/blob/d0e03a142d0ecdd5491593e941ee1d6b5d91dba6/pkg/crd/known_types.go#L106-L111 + Value *v1.JSON `json:"value,omitempty"` +} + +// ClusterVariableApplyConfiguration constructs a declarative configuration of the ClusterVariable type for use with +// apply. +func ClusterVariable() *ClusterVariableApplyConfiguration { + return &ClusterVariableApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ClusterVariableApplyConfiguration) WithName(value string) *ClusterVariableApplyConfiguration { + b.Name = &value + return b +} + +// WithValue sets the Value field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Value field is set to the value of the last call. +func (b *ClusterVariableApplyConfiguration) WithValue(value v1.JSON) *ClusterVariableApplyConfiguration { + b.Value = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/condition.go b/util/applyconfigurations/core/v1beta2/condition.go new file mode 100644 index 000000000000..2ef9848983a7 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/condition.go @@ -0,0 +1,93 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + corev1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2" +) + +// ConditionApplyConfiguration represents a declarative configuration of the Condition type for use +// with apply. +// +// Condition defines an observation of a Cluster API resource operational state. +// +// Deprecated: This type 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. +type ConditionApplyConfiguration struct { + // 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. + Type *corev1beta2.ConditionType `json:"type,omitempty"` + // status of the condition, one of True, False, Unknown. + Status *v1.ConditionStatus `json:"status,omitempty"` + // 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. + Severity *corev1beta2.ConditionSeverity `json:"severity,omitempty"` + // 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. + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` + // 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. + Reason *string `json:"reason,omitempty"` + // message is a human readable message indicating details about the transition. + // This field may be empty. + Message *string `json:"message,omitempty"` +} + +// ConditionApplyConfiguration constructs a declarative configuration of the Condition type for use with +// apply. +func Condition() *ConditionApplyConfiguration { + return &ConditionApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *ConditionApplyConfiguration) WithType(value corev1beta2.ConditionType) *ConditionApplyConfiguration { + b.Type = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *ConditionApplyConfiguration) WithStatus(value v1.ConditionStatus) *ConditionApplyConfiguration { + b.Status = &value + return b +} + +// WithSeverity sets the Severity field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Severity field is set to the value of the last call. +func (b *ConditionApplyConfiguration) WithSeverity(value corev1beta2.ConditionSeverity) *ConditionApplyConfiguration { + b.Severity = &value + return b +} + +// WithLastTransitionTime sets the LastTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastTransitionTime field is set to the value of the last call. +func (b *ConditionApplyConfiguration) WithLastTransitionTime(value metav1.Time) *ConditionApplyConfiguration { + b.LastTransitionTime = &value + return b +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *ConditionApplyConfiguration) WithReason(value string) *ConditionApplyConfiguration { + b.Reason = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *ConditionApplyConfiguration) WithMessage(value string) *ConditionApplyConfiguration { + b.Message = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/contractversionedobjectreference.go b/util/applyconfigurations/core/v1beta2/contractversionedobjectreference.go new file mode 100644 index 000000000000..c042f10a5fe1 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/contractversionedobjectreference.go @@ -0,0 +1,51 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// ContractVersionedObjectReferenceApplyConfiguration represents a declarative configuration of the ContractVersionedObjectReference type for use +// with apply. +// +// ContractVersionedObjectReference is a reference to a resource for which the version is inferred from contract labels. +type ContractVersionedObjectReferenceApplyConfiguration struct { + // kind of the resource being referenced. + // kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character. + Kind *string `json:"kind,omitempty"` + // name of the resource being referenced. + // name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character. + Name *string `json:"name,omitempty"` + // apiGroup is the group of the resource being referenced. + // apiGroup must be fully qualified domain name. + // The corresponding version for this reference will be looked up from the contract + // labels of the corresponding CRD of the resource being referenced. + APIGroup *string `json:"apiGroup,omitempty"` +} + +// ContractVersionedObjectReferenceApplyConfiguration constructs a declarative configuration of the ContractVersionedObjectReference type for use with +// apply. +func ContractVersionedObjectReference() *ContractVersionedObjectReferenceApplyConfiguration { + return &ContractVersionedObjectReferenceApplyConfiguration{} +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *ContractVersionedObjectReferenceApplyConfiguration) WithKind(value string) *ContractVersionedObjectReferenceApplyConfiguration { + b.Kind = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ContractVersionedObjectReferenceApplyConfiguration) WithName(value string) *ContractVersionedObjectReferenceApplyConfiguration { + b.Name = &value + return b +} + +// WithAPIGroup sets the APIGroup field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIGroup field is set to the value of the last call. +func (b *ContractVersionedObjectReferenceApplyConfiguration) WithAPIGroup(value string) *ContractVersionedObjectReferenceApplyConfiguration { + b.APIGroup = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/controlplaneclass.go b/util/applyconfigurations/core/v1beta2/controlplaneclass.go new file mode 100644 index 000000000000..95d2424265e7 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/controlplaneclass.go @@ -0,0 +1,111 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// ControlPlaneClassApplyConfiguration represents a declarative configuration of the ControlPlaneClass type for use +// with apply. +// +// ControlPlaneClass defines the class for the control plane. +type ControlPlaneClassApplyConfiguration struct { + // metadata is the metadata applied to the ControlPlane and the Machines of the ControlPlane + // if the ControlPlaneTemplate referenced is machine based. If not, it is applied only to the + // ControlPlane. + // At runtime this metadata is merged with the corresponding metadata from the topology. + // + // This field is supported if and only if the control plane provider template + // referenced is Machine based. + Metadata *ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + // templateRef contains the reference to a provider-specific control plane template. + TemplateRef *ClusterClassTemplateReferenceApplyConfiguration `json:"templateRef,omitempty"` + // machineInfrastructure defines the metadata and infrastructure information + // for control plane machines. + // + // This field is supported if and only if the control plane provider template + // referenced above is Machine based and supports setting replicas. + MachineInfrastructure *ControlPlaneClassMachineInfrastructureTemplateApplyConfiguration `json:"machineInfrastructure,omitempty"` + // healthCheck defines a MachineHealthCheck for this ControlPlaneClass. + // This field is supported if and only if the ControlPlane provider template + // referenced above is Machine based and supports setting replicas. + HealthCheck *ControlPlaneClassHealthCheckApplyConfiguration `json:"healthCheck,omitempty"` + // naming allows changing the naming pattern used when creating the control plane provider object. + Naming *ControlPlaneClassNamingSpecApplyConfiguration `json:"naming,omitempty"` + // deletion contains configuration options for Machine deletion. + Deletion *ControlPlaneClassMachineDeletionSpecApplyConfiguration `json:"deletion,omitempty"` + // readinessGates specifies additional conditions to include when evaluating Machine Ready condition. + // + // This field can be used e.g. to instruct the machine controller to include in the computation for Machine's ready + // computation a condition, managed by an external controllers, reporting the status of special software/hardware installed on the Machine. + // + // NOTE: If a Cluster defines a custom list of readinessGates for the control plane, + // such list overrides readinessGates defined in this field. + // NOTE: Specific control plane provider implementations might automatically extend the list of readinessGates; + // e.g. the kubeadm control provider adds ReadinessGates for the APIServerPodHealthy, SchedulerPodHealthy conditions, etc. + ReadinessGates []MachineReadinessGateApplyConfiguration `json:"readinessGates,omitempty"` +} + +// ControlPlaneClassApplyConfiguration constructs a declarative configuration of the ControlPlaneClass type for use with +// apply. +func ControlPlaneClass() *ControlPlaneClassApplyConfiguration { + return &ControlPlaneClassApplyConfiguration{} +} + +// WithMetadata sets the Metadata field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Metadata field is set to the value of the last call. +func (b *ControlPlaneClassApplyConfiguration) WithMetadata(value *ObjectMetaApplyConfiguration) *ControlPlaneClassApplyConfiguration { + b.Metadata = value + return b +} + +// WithTemplateRef sets the TemplateRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TemplateRef field is set to the value of the last call. +func (b *ControlPlaneClassApplyConfiguration) WithTemplateRef(value *ClusterClassTemplateReferenceApplyConfiguration) *ControlPlaneClassApplyConfiguration { + b.TemplateRef = value + return b +} + +// WithMachineInfrastructure sets the MachineInfrastructure field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MachineInfrastructure field is set to the value of the last call. +func (b *ControlPlaneClassApplyConfiguration) WithMachineInfrastructure(value *ControlPlaneClassMachineInfrastructureTemplateApplyConfiguration) *ControlPlaneClassApplyConfiguration { + b.MachineInfrastructure = value + return b +} + +// WithHealthCheck sets the HealthCheck field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the HealthCheck field is set to the value of the last call. +func (b *ControlPlaneClassApplyConfiguration) WithHealthCheck(value *ControlPlaneClassHealthCheckApplyConfiguration) *ControlPlaneClassApplyConfiguration { + b.HealthCheck = value + return b +} + +// WithNaming sets the Naming field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Naming field is set to the value of the last call. +func (b *ControlPlaneClassApplyConfiguration) WithNaming(value *ControlPlaneClassNamingSpecApplyConfiguration) *ControlPlaneClassApplyConfiguration { + b.Naming = value + return b +} + +// WithDeletion sets the Deletion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Deletion field is set to the value of the last call. +func (b *ControlPlaneClassApplyConfiguration) WithDeletion(value *ControlPlaneClassMachineDeletionSpecApplyConfiguration) *ControlPlaneClassApplyConfiguration { + b.Deletion = value + return b +} + +// WithReadinessGates adds the given value to the ReadinessGates field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ReadinessGates field. +func (b *ControlPlaneClassApplyConfiguration) WithReadinessGates(values ...*MachineReadinessGateApplyConfiguration) *ControlPlaneClassApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithReadinessGates") + } + b.ReadinessGates = append(b.ReadinessGates, *values[i]) + } + return b +} diff --git a/util/applyconfigurations/core/v1beta2/controlplaneclasshealthcheck.go b/util/applyconfigurations/core/v1beta2/controlplaneclasshealthcheck.go new file mode 100644 index 000000000000..bf4982b687f8 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/controlplaneclasshealthcheck.go @@ -0,0 +1,50 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// ControlPlaneClassHealthCheckApplyConfiguration represents a declarative configuration of the ControlPlaneClassHealthCheck type for use +// with apply. +// +// ControlPlaneClassHealthCheck defines a MachineHealthCheck for control plane machines. +type ControlPlaneClassHealthCheckApplyConfiguration struct { + // checks are the checks that are used to evaluate if a Machine is healthy. + // + // Independent of this configuration the MachineHealthCheck controller will always + // flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and + // Machines with deleted Nodes as unhealthy. + // + // Furthermore, if checks.nodeStartupTimeoutSeconds is not set it + // is defaulted to 10 minutes and evaluated accordingly. + Checks *ControlPlaneClassHealthCheckChecksApplyConfiguration `json:"checks,omitempty"` + // remediation configures if and how remediations are triggered if a Machine is unhealthy. + // + // If remediation or remediation.triggerIf is not set, + // remediation will always be triggered for unhealthy Machines. + // + // If remediation or remediation.templateRef is not set, + // the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via + // the owner of the Machines, for example a MachineSet or a KubeadmControlPlane. + Remediation *ControlPlaneClassHealthCheckRemediationApplyConfiguration `json:"remediation,omitempty"` +} + +// ControlPlaneClassHealthCheckApplyConfiguration constructs a declarative configuration of the ControlPlaneClassHealthCheck type for use with +// apply. +func ControlPlaneClassHealthCheck() *ControlPlaneClassHealthCheckApplyConfiguration { + return &ControlPlaneClassHealthCheckApplyConfiguration{} +} + +// WithChecks sets the Checks field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Checks field is set to the value of the last call. +func (b *ControlPlaneClassHealthCheckApplyConfiguration) WithChecks(value *ControlPlaneClassHealthCheckChecksApplyConfiguration) *ControlPlaneClassHealthCheckApplyConfiguration { + b.Checks = value + return b +} + +// WithRemediation sets the Remediation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Remediation field is set to the value of the last call. +func (b *ControlPlaneClassHealthCheckApplyConfiguration) WithRemediation(value *ControlPlaneClassHealthCheckRemediationApplyConfiguration) *ControlPlaneClassHealthCheckApplyConfiguration { + b.Remediation = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/controlplaneclasshealthcheckchecks.go b/util/applyconfigurations/core/v1beta2/controlplaneclasshealthcheckchecks.go new file mode 100644 index 000000000000..01730cd80bce --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/controlplaneclasshealthcheckchecks.go @@ -0,0 +1,71 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// ControlPlaneClassHealthCheckChecksApplyConfiguration represents a declarative configuration of the ControlPlaneClassHealthCheckChecks type for use +// with apply. +// +// ControlPlaneClassHealthCheckChecks are the checks that are used to evaluate if a control plane Machine is healthy. +type ControlPlaneClassHealthCheckChecksApplyConfiguration struct { + // nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck + // to consider a Machine unhealthy if a corresponding Node isn't associated + // through a `Spec.ProviderID` field. + // + // The duration set in this field is compared to the greatest of: + // - Cluster's infrastructure ready condition timestamp (if and when available) + // - Control Plane's initialized condition timestamp (if and when available) + // - Machine's infrastructure ready condition timestamp (if and when available) + // - Machine's metadata creation timestamp + // + // Defaults to 10 minutes. + // If you wish to disable this feature, set the value explicitly to 0. + NodeStartupTimeoutSeconds *int32 `json:"nodeStartupTimeoutSeconds,omitempty"` + // unhealthyNodeConditions contains a list of conditions that determine + // whether a node is considered unhealthy. The conditions are combined in a + // logical OR, i.e. if any of the conditions is met, the node is unhealthy. + UnhealthyNodeConditions []UnhealthyNodeConditionApplyConfiguration `json:"unhealthyNodeConditions,omitempty"` + // unhealthyMachineConditions contains a list of the machine conditions that determine + // whether a machine is considered unhealthy. The conditions are combined in a + // logical OR, i.e. if any of the conditions is met, the machine is unhealthy. + UnhealthyMachineConditions []UnhealthyMachineConditionApplyConfiguration `json:"unhealthyMachineConditions,omitempty"` +} + +// ControlPlaneClassHealthCheckChecksApplyConfiguration constructs a declarative configuration of the ControlPlaneClassHealthCheckChecks type for use with +// apply. +func ControlPlaneClassHealthCheckChecks() *ControlPlaneClassHealthCheckChecksApplyConfiguration { + return &ControlPlaneClassHealthCheckChecksApplyConfiguration{} +} + +// WithNodeStartupTimeoutSeconds sets the NodeStartupTimeoutSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeStartupTimeoutSeconds field is set to the value of the last call. +func (b *ControlPlaneClassHealthCheckChecksApplyConfiguration) WithNodeStartupTimeoutSeconds(value int32) *ControlPlaneClassHealthCheckChecksApplyConfiguration { + b.NodeStartupTimeoutSeconds = &value + return b +} + +// WithUnhealthyNodeConditions adds the given value to the UnhealthyNodeConditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the UnhealthyNodeConditions field. +func (b *ControlPlaneClassHealthCheckChecksApplyConfiguration) WithUnhealthyNodeConditions(values ...*UnhealthyNodeConditionApplyConfiguration) *ControlPlaneClassHealthCheckChecksApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithUnhealthyNodeConditions") + } + b.UnhealthyNodeConditions = append(b.UnhealthyNodeConditions, *values[i]) + } + return b +} + +// WithUnhealthyMachineConditions adds the given value to the UnhealthyMachineConditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the UnhealthyMachineConditions field. +func (b *ControlPlaneClassHealthCheckChecksApplyConfiguration) WithUnhealthyMachineConditions(values ...*UnhealthyMachineConditionApplyConfiguration) *ControlPlaneClassHealthCheckChecksApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithUnhealthyMachineConditions") + } + b.UnhealthyMachineConditions = append(b.UnhealthyMachineConditions, *values[i]) + } + return b +} diff --git a/util/applyconfigurations/core/v1beta2/controlplaneclasshealthcheckremediation.go b/util/applyconfigurations/core/v1beta2/controlplaneclasshealthcheckremediation.go new file mode 100644 index 000000000000..1ec03408809c --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/controlplaneclasshealthcheckremediation.go @@ -0,0 +1,42 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// ControlPlaneClassHealthCheckRemediationApplyConfiguration represents a declarative configuration of the ControlPlaneClassHealthCheckRemediation type for use +// with apply. +// +// ControlPlaneClassHealthCheckRemediation configures if and how remediations are triggered if a control plane Machine is unhealthy. +type ControlPlaneClassHealthCheckRemediationApplyConfiguration struct { + // triggerIf configures if remediations are triggered. + // If this field is not set, remediations are always triggered. + TriggerIf *ControlPlaneClassHealthCheckRemediationTriggerIfApplyConfiguration `json:"triggerIf,omitempty"` + // templateRef is a reference to a remediation template + // provided by an infrastructure provider. + // + // This field is completely optional, when filled, the MachineHealthCheck controller + // creates a new object from the template referenced and hands off remediation of the machine to + // a controller that lives outside of Cluster API. + TemplateRef *MachineHealthCheckRemediationTemplateReferenceApplyConfiguration `json:"templateRef,omitempty"` +} + +// ControlPlaneClassHealthCheckRemediationApplyConfiguration constructs a declarative configuration of the ControlPlaneClassHealthCheckRemediation type for use with +// apply. +func ControlPlaneClassHealthCheckRemediation() *ControlPlaneClassHealthCheckRemediationApplyConfiguration { + return &ControlPlaneClassHealthCheckRemediationApplyConfiguration{} +} + +// WithTriggerIf sets the TriggerIf field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TriggerIf field is set to the value of the last call. +func (b *ControlPlaneClassHealthCheckRemediationApplyConfiguration) WithTriggerIf(value *ControlPlaneClassHealthCheckRemediationTriggerIfApplyConfiguration) *ControlPlaneClassHealthCheckRemediationApplyConfiguration { + b.TriggerIf = value + return b +} + +// WithTemplateRef sets the TemplateRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TemplateRef field is set to the value of the last call. +func (b *ControlPlaneClassHealthCheckRemediationApplyConfiguration) WithTemplateRef(value *MachineHealthCheckRemediationTemplateReferenceApplyConfiguration) *ControlPlaneClassHealthCheckRemediationApplyConfiguration { + b.TemplateRef = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/controlplaneclasshealthcheckremediationtriggerif.go b/util/applyconfigurations/core/v1beta2/controlplaneclasshealthcheckremediationtriggerif.go new file mode 100644 index 000000000000..26519ec2ef0c --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/controlplaneclasshealthcheckremediationtriggerif.go @@ -0,0 +1,47 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// ControlPlaneClassHealthCheckRemediationTriggerIfApplyConfiguration represents a declarative configuration of the ControlPlaneClassHealthCheckRemediationTriggerIf type for use +// with apply. +// +// ControlPlaneClassHealthCheckRemediationTriggerIf configures if remediations are triggered. +type ControlPlaneClassHealthCheckRemediationTriggerIfApplyConfiguration struct { + // unhealthyLessThanOrEqualTo specifies that remediations are only triggered if the number of + // unhealthy Machines is less than or equal to the configured value. + // unhealthyInRange takes precedence if set. + UnhealthyLessThanOrEqualTo *intstr.IntOrString `json:"unhealthyLessThanOrEqualTo,omitempty"` + // unhealthyInRange specifies that remediations are only triggered if the number of + // unhealthy Machines is in the configured range. + // Takes precedence over unhealthyLessThanOrEqualTo. + // Eg. "[3-5]" - This means that remediation will be allowed only when: + // (a) there are at least 3 unhealthy Machines (and) + // (b) there are at most 5 unhealthy Machines + UnhealthyInRange *string `json:"unhealthyInRange,omitempty"` +} + +// ControlPlaneClassHealthCheckRemediationTriggerIfApplyConfiguration constructs a declarative configuration of the ControlPlaneClassHealthCheckRemediationTriggerIf type for use with +// apply. +func ControlPlaneClassHealthCheckRemediationTriggerIf() *ControlPlaneClassHealthCheckRemediationTriggerIfApplyConfiguration { + return &ControlPlaneClassHealthCheckRemediationTriggerIfApplyConfiguration{} +} + +// WithUnhealthyLessThanOrEqualTo sets the UnhealthyLessThanOrEqualTo field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UnhealthyLessThanOrEqualTo field is set to the value of the last call. +func (b *ControlPlaneClassHealthCheckRemediationTriggerIfApplyConfiguration) WithUnhealthyLessThanOrEqualTo(value intstr.IntOrString) *ControlPlaneClassHealthCheckRemediationTriggerIfApplyConfiguration { + b.UnhealthyLessThanOrEqualTo = &value + return b +} + +// WithUnhealthyInRange sets the UnhealthyInRange field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UnhealthyInRange field is set to the value of the last call. +func (b *ControlPlaneClassHealthCheckRemediationTriggerIfApplyConfiguration) WithUnhealthyInRange(value string) *ControlPlaneClassHealthCheckRemediationTriggerIfApplyConfiguration { + b.UnhealthyInRange = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/controlplaneclassmachinedeletionspec.go b/util/applyconfigurations/core/v1beta2/controlplaneclassmachinedeletionspec.go new file mode 100644 index 000000000000..08b58e1b4dea --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/controlplaneclassmachinedeletionspec.go @@ -0,0 +1,54 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// ControlPlaneClassMachineDeletionSpecApplyConfiguration represents a declarative configuration of the ControlPlaneClassMachineDeletionSpec type for use +// with apply. +// +// ControlPlaneClassMachineDeletionSpec contains configuration options for Machine deletion. +type ControlPlaneClassMachineDeletionSpecApplyConfiguration struct { + // nodeDrainTimeoutSeconds is the total amount of time that the controller will spend on draining a node. + // The default value is 0, meaning that the node can be drained without any time limitations. + // NOTE: nodeDrainTimeoutSeconds is different from `kubectl drain --timeout` + // NOTE: This value can be overridden while defining a Cluster.Topology. + NodeDrainTimeoutSeconds *int32 `json:"nodeDrainTimeoutSeconds,omitempty"` + // nodeVolumeDetachTimeoutSeconds is the total amount of time that the controller will spend on waiting for all volumes + // to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations. + // NOTE: This value can be overridden while defining a Cluster.Topology. + NodeVolumeDetachTimeoutSeconds *int32 `json:"nodeVolumeDetachTimeoutSeconds,omitempty"` + // nodeDeletionTimeoutSeconds defines how long the controller will attempt to delete the Node that the Machine + // hosts after the Machine is marked for deletion. A duration of 0 will retry deletion indefinitely. + // Defaults to 10 seconds. + // NOTE: This value can be overridden while defining a Cluster.Topology. + NodeDeletionTimeoutSeconds *int32 `json:"nodeDeletionTimeoutSeconds,omitempty"` +} + +// ControlPlaneClassMachineDeletionSpecApplyConfiguration constructs a declarative configuration of the ControlPlaneClassMachineDeletionSpec type for use with +// apply. +func ControlPlaneClassMachineDeletionSpec() *ControlPlaneClassMachineDeletionSpecApplyConfiguration { + return &ControlPlaneClassMachineDeletionSpecApplyConfiguration{} +} + +// WithNodeDrainTimeoutSeconds sets the NodeDrainTimeoutSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeDrainTimeoutSeconds field is set to the value of the last call. +func (b *ControlPlaneClassMachineDeletionSpecApplyConfiguration) WithNodeDrainTimeoutSeconds(value int32) *ControlPlaneClassMachineDeletionSpecApplyConfiguration { + b.NodeDrainTimeoutSeconds = &value + return b +} + +// WithNodeVolumeDetachTimeoutSeconds sets the NodeVolumeDetachTimeoutSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeVolumeDetachTimeoutSeconds field is set to the value of the last call. +func (b *ControlPlaneClassMachineDeletionSpecApplyConfiguration) WithNodeVolumeDetachTimeoutSeconds(value int32) *ControlPlaneClassMachineDeletionSpecApplyConfiguration { + b.NodeVolumeDetachTimeoutSeconds = &value + return b +} + +// WithNodeDeletionTimeoutSeconds sets the NodeDeletionTimeoutSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeDeletionTimeoutSeconds field is set to the value of the last call. +func (b *ControlPlaneClassMachineDeletionSpecApplyConfiguration) WithNodeDeletionTimeoutSeconds(value int32) *ControlPlaneClassMachineDeletionSpecApplyConfiguration { + b.NodeDeletionTimeoutSeconds = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/controlplaneclassmachineinfrastructuretemplate.go b/util/applyconfigurations/core/v1beta2/controlplaneclassmachineinfrastructuretemplate.go new file mode 100644 index 000000000000..d62e70aed4db --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/controlplaneclassmachineinfrastructuretemplate.go @@ -0,0 +1,26 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// ControlPlaneClassMachineInfrastructureTemplateApplyConfiguration represents a declarative configuration of the ControlPlaneClassMachineInfrastructureTemplate type for use +// with apply. +// +// ControlPlaneClassMachineInfrastructureTemplate defines the template for a MachineInfrastructure of a ControlPlane. +type ControlPlaneClassMachineInfrastructureTemplateApplyConfiguration struct { + // templateRef is a required reference to the template for a MachineInfrastructure of a ControlPlane. + TemplateRef *ClusterClassTemplateReferenceApplyConfiguration `json:"templateRef,omitempty"` +} + +// ControlPlaneClassMachineInfrastructureTemplateApplyConfiguration constructs a declarative configuration of the ControlPlaneClassMachineInfrastructureTemplate type for use with +// apply. +func ControlPlaneClassMachineInfrastructureTemplate() *ControlPlaneClassMachineInfrastructureTemplateApplyConfiguration { + return &ControlPlaneClassMachineInfrastructureTemplateApplyConfiguration{} +} + +// WithTemplateRef sets the TemplateRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TemplateRef field is set to the value of the last call. +func (b *ControlPlaneClassMachineInfrastructureTemplateApplyConfiguration) WithTemplateRef(value *ClusterClassTemplateReferenceApplyConfiguration) *ControlPlaneClassMachineInfrastructureTemplateApplyConfiguration { + b.TemplateRef = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/controlplaneclassnamingspec.go b/util/applyconfigurations/core/v1beta2/controlplaneclassnamingspec.go new file mode 100644 index 000000000000..39ee367bbfe1 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/controlplaneclassnamingspec.go @@ -0,0 +1,32 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// ControlPlaneClassNamingSpecApplyConfiguration represents a declarative configuration of the ControlPlaneClassNamingSpec type for use +// with apply. +// +// ControlPlaneClassNamingSpec defines the naming strategy for control plane objects. +type ControlPlaneClassNamingSpecApplyConfiguration struct { + // template defines the template to use for generating the name of the ControlPlane object. + // If not defined, it will fallback to `{{ .cluster.name }}-{{ .random }}`. + // If the templated string exceeds 63 characters, it will be trimmed to 58 characters and will + // get concatenated with a random suffix of length 5. + // The templating mechanism provides the following arguments: + // * `.cluster.name`: The name of the cluster object. + // * `.random`: A random alphanumeric string, without vowels, of length 5. + Template *string `json:"template,omitempty"` +} + +// ControlPlaneClassNamingSpecApplyConfiguration constructs a declarative configuration of the ControlPlaneClassNamingSpec type for use with +// apply. +func ControlPlaneClassNamingSpec() *ControlPlaneClassNamingSpecApplyConfiguration { + return &ControlPlaneClassNamingSpecApplyConfiguration{} +} + +// WithTemplate sets the Template field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Template field is set to the value of the last call. +func (b *ControlPlaneClassNamingSpecApplyConfiguration) WithTemplate(value string) *ControlPlaneClassNamingSpecApplyConfiguration { + b.Template = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/controlplanetopology.go b/util/applyconfigurations/core/v1beta2/controlplanetopology.go new file mode 100644 index 000000000000..bf2421fa2677 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/controlplanetopology.go @@ -0,0 +1,96 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// ControlPlaneTopologyApplyConfiguration represents a declarative configuration of the ControlPlaneTopology type for use +// with apply. +// +// ControlPlaneTopology specifies the parameters for the control plane nodes in the cluster. +type ControlPlaneTopologyApplyConfiguration struct { + // metadata is the metadata applied to the ControlPlane and the Machines of the ControlPlane + // if the ControlPlaneTemplate referenced by the ClusterClass is machine based. If not, it + // is applied only to the ControlPlane. + // At runtime this metadata is merged with the corresponding metadata from the ClusterClass. + Metadata *ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + // replicas is the number of control plane nodes. + // If the value is not set, the ControlPlane object is created without the number of Replicas + // and it's assumed that the control plane controller does not implement support for this field. + // When specified against a control plane provider that lacks support for this field, this value will be ignored. + Replicas *int32 `json:"replicas,omitempty"` + // healthCheck allows to enable, disable and override control plane health check + // configuration from the ClusterClass for this control plane. + HealthCheck *ControlPlaneTopologyHealthCheckApplyConfiguration `json:"healthCheck,omitempty"` + // deletion contains configuration options for Machine deletion. + Deletion *ControlPlaneTopologyMachineDeletionSpecApplyConfiguration `json:"deletion,omitempty"` + // readinessGates specifies additional conditions to include when evaluating Machine Ready condition. + // + // This field can be used e.g. to instruct the machine controller to include in the computation for Machine's ready + // computation a condition, managed by an external controllers, reporting the status of special software/hardware installed on the Machine. + // + // If this field is not defined, readinessGates from the corresponding ControlPlaneClass will be used, if any. + // + // NOTE: Specific control plane provider implementations might automatically extend the list of readinessGates; + // e.g. the kubeadm control provider adds ReadinessGates for the APIServerPodHealthy, SchedulerPodHealthy conditions, etc. + ReadinessGates []MachineReadinessGateApplyConfiguration `json:"readinessGates,omitempty"` + // variables can be used to customize the ControlPlane through patches. + Variables *ControlPlaneVariablesApplyConfiguration `json:"variables,omitempty"` +} + +// ControlPlaneTopologyApplyConfiguration constructs a declarative configuration of the ControlPlaneTopology type for use with +// apply. +func ControlPlaneTopology() *ControlPlaneTopologyApplyConfiguration { + return &ControlPlaneTopologyApplyConfiguration{} +} + +// WithMetadata sets the Metadata field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Metadata field is set to the value of the last call. +func (b *ControlPlaneTopologyApplyConfiguration) WithMetadata(value *ObjectMetaApplyConfiguration) *ControlPlaneTopologyApplyConfiguration { + b.Metadata = value + return b +} + +// WithReplicas sets the Replicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Replicas field is set to the value of the last call. +func (b *ControlPlaneTopologyApplyConfiguration) WithReplicas(value int32) *ControlPlaneTopologyApplyConfiguration { + b.Replicas = &value + return b +} + +// WithHealthCheck sets the HealthCheck field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the HealthCheck field is set to the value of the last call. +func (b *ControlPlaneTopologyApplyConfiguration) WithHealthCheck(value *ControlPlaneTopologyHealthCheckApplyConfiguration) *ControlPlaneTopologyApplyConfiguration { + b.HealthCheck = value + return b +} + +// WithDeletion sets the Deletion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Deletion field is set to the value of the last call. +func (b *ControlPlaneTopologyApplyConfiguration) WithDeletion(value *ControlPlaneTopologyMachineDeletionSpecApplyConfiguration) *ControlPlaneTopologyApplyConfiguration { + b.Deletion = value + return b +} + +// WithReadinessGates adds the given value to the ReadinessGates field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ReadinessGates field. +func (b *ControlPlaneTopologyApplyConfiguration) WithReadinessGates(values ...*MachineReadinessGateApplyConfiguration) *ControlPlaneTopologyApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithReadinessGates") + } + b.ReadinessGates = append(b.ReadinessGates, *values[i]) + } + return b +} + +// WithVariables sets the Variables field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Variables field is set to the value of the last call. +func (b *ControlPlaneTopologyApplyConfiguration) WithVariables(value *ControlPlaneVariablesApplyConfiguration) *ControlPlaneTopologyApplyConfiguration { + b.Variables = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/controlplanetopologyhealthcheck.go b/util/applyconfigurations/core/v1beta2/controlplanetopologyhealthcheck.go new file mode 100644 index 000000000000..7f51919dcfc9 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/controlplanetopologyhealthcheck.go @@ -0,0 +1,76 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// ControlPlaneTopologyHealthCheckApplyConfiguration represents a declarative configuration of the ControlPlaneTopologyHealthCheck type for use +// with apply. +// +// ControlPlaneTopologyHealthCheck defines a MachineHealthCheck for control plane machines. +type ControlPlaneTopologyHealthCheckApplyConfiguration struct { + // enabled controls if a MachineHealthCheck should be created for the target machines. + // + // If false: No MachineHealthCheck will be created. + // + // If not set(default): A MachineHealthCheck will be created if it is defined here or + // in the associated ClusterClass. If no MachineHealthCheck is defined then none will be created. + // + // If true: A MachineHealthCheck is guaranteed to be created. Cluster validation will + // block if `enable` is true and no MachineHealthCheck definition is available. + Enabled *bool `json:"enabled,omitempty"` + // checks are the checks that are used to evaluate if a Machine is healthy. + // + // If one of checks and remediation fields are set, the system assumes that an healthCheck override is defined, + // and as a consequence the checks and remediation fields from Cluster will be used instead of the + // corresponding fields in ClusterClass. + // + // Independent of this configuration the MachineHealthCheck controller will always + // flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and + // Machines with deleted Nodes as unhealthy. + // + // Furthermore, if checks.nodeStartupTimeoutSeconds is not set it + // is defaulted to 10 minutes and evaluated accordingly. + Checks *ControlPlaneTopologyHealthCheckChecksApplyConfiguration `json:"checks,omitempty"` + // remediation configures if and how remediations are triggered if a Machine is unhealthy. + // + // If one of checks and remediation fields are set, the system assumes that an healthCheck override is defined, + // and as a consequence the checks and remediation fields from cluster will be used instead of the + // corresponding fields in ClusterClass. + // + // If an health check override is defined and remediation or remediation.triggerIf is not set, + // remediation will always be triggered for unhealthy Machines. + // + // If an health check override is defined and remediation or remediation.templateRef is not set, + // the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via + // the owner of the Machines, for example a MachineSet or a KubeadmControlPlane. + Remediation *ControlPlaneTopologyHealthCheckRemediationApplyConfiguration `json:"remediation,omitempty"` +} + +// ControlPlaneTopologyHealthCheckApplyConfiguration constructs a declarative configuration of the ControlPlaneTopologyHealthCheck type for use with +// apply. +func ControlPlaneTopologyHealthCheck() *ControlPlaneTopologyHealthCheckApplyConfiguration { + return &ControlPlaneTopologyHealthCheckApplyConfiguration{} +} + +// WithEnabled sets the Enabled field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Enabled field is set to the value of the last call. +func (b *ControlPlaneTopologyHealthCheckApplyConfiguration) WithEnabled(value bool) *ControlPlaneTopologyHealthCheckApplyConfiguration { + b.Enabled = &value + return b +} + +// WithChecks sets the Checks field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Checks field is set to the value of the last call. +func (b *ControlPlaneTopologyHealthCheckApplyConfiguration) WithChecks(value *ControlPlaneTopologyHealthCheckChecksApplyConfiguration) *ControlPlaneTopologyHealthCheckApplyConfiguration { + b.Checks = value + return b +} + +// WithRemediation sets the Remediation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Remediation field is set to the value of the last call. +func (b *ControlPlaneTopologyHealthCheckApplyConfiguration) WithRemediation(value *ControlPlaneTopologyHealthCheckRemediationApplyConfiguration) *ControlPlaneTopologyHealthCheckApplyConfiguration { + b.Remediation = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/controlplanetopologyhealthcheckchecks.go b/util/applyconfigurations/core/v1beta2/controlplanetopologyhealthcheckchecks.go new file mode 100644 index 000000000000..acb7588c7016 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/controlplanetopologyhealthcheckchecks.go @@ -0,0 +1,71 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// ControlPlaneTopologyHealthCheckChecksApplyConfiguration represents a declarative configuration of the ControlPlaneTopologyHealthCheckChecks type for use +// with apply. +// +// ControlPlaneTopologyHealthCheckChecks are the checks that are used to evaluate if a control plane Machine is healthy. +type ControlPlaneTopologyHealthCheckChecksApplyConfiguration struct { + // nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck + // to consider a Machine unhealthy if a corresponding Node isn't associated + // through a `Spec.ProviderID` field. + // + // The duration set in this field is compared to the greatest of: + // - Cluster's infrastructure ready condition timestamp (if and when available) + // - Control Plane's initialized condition timestamp (if and when available) + // - Machine's infrastructure ready condition timestamp (if and when available) + // - Machine's metadata creation timestamp + // + // Defaults to 10 minutes. + // If you wish to disable this feature, set the value explicitly to 0. + NodeStartupTimeoutSeconds *int32 `json:"nodeStartupTimeoutSeconds,omitempty"` + // unhealthyNodeConditions contains a list of conditions that determine + // whether a node is considered unhealthy. The conditions are combined in a + // logical OR, i.e. if any of the conditions is met, the node is unhealthy. + UnhealthyNodeConditions []UnhealthyNodeConditionApplyConfiguration `json:"unhealthyNodeConditions,omitempty"` + // unhealthyMachineConditions contains a list of the machine conditions that determine + // whether a machine is considered unhealthy. The conditions are combined in a + // logical OR, i.e. if any of the conditions is met, the machine is unhealthy. + UnhealthyMachineConditions []UnhealthyMachineConditionApplyConfiguration `json:"unhealthyMachineConditions,omitempty"` +} + +// ControlPlaneTopologyHealthCheckChecksApplyConfiguration constructs a declarative configuration of the ControlPlaneTopologyHealthCheckChecks type for use with +// apply. +func ControlPlaneTopologyHealthCheckChecks() *ControlPlaneTopologyHealthCheckChecksApplyConfiguration { + return &ControlPlaneTopologyHealthCheckChecksApplyConfiguration{} +} + +// WithNodeStartupTimeoutSeconds sets the NodeStartupTimeoutSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeStartupTimeoutSeconds field is set to the value of the last call. +func (b *ControlPlaneTopologyHealthCheckChecksApplyConfiguration) WithNodeStartupTimeoutSeconds(value int32) *ControlPlaneTopologyHealthCheckChecksApplyConfiguration { + b.NodeStartupTimeoutSeconds = &value + return b +} + +// WithUnhealthyNodeConditions adds the given value to the UnhealthyNodeConditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the UnhealthyNodeConditions field. +func (b *ControlPlaneTopologyHealthCheckChecksApplyConfiguration) WithUnhealthyNodeConditions(values ...*UnhealthyNodeConditionApplyConfiguration) *ControlPlaneTopologyHealthCheckChecksApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithUnhealthyNodeConditions") + } + b.UnhealthyNodeConditions = append(b.UnhealthyNodeConditions, *values[i]) + } + return b +} + +// WithUnhealthyMachineConditions adds the given value to the UnhealthyMachineConditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the UnhealthyMachineConditions field. +func (b *ControlPlaneTopologyHealthCheckChecksApplyConfiguration) WithUnhealthyMachineConditions(values ...*UnhealthyMachineConditionApplyConfiguration) *ControlPlaneTopologyHealthCheckChecksApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithUnhealthyMachineConditions") + } + b.UnhealthyMachineConditions = append(b.UnhealthyMachineConditions, *values[i]) + } + return b +} diff --git a/util/applyconfigurations/core/v1beta2/controlplanetopologyhealthcheckremediation.go b/util/applyconfigurations/core/v1beta2/controlplanetopologyhealthcheckremediation.go new file mode 100644 index 000000000000..3c85a792e415 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/controlplanetopologyhealthcheckremediation.go @@ -0,0 +1,42 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// ControlPlaneTopologyHealthCheckRemediationApplyConfiguration represents a declarative configuration of the ControlPlaneTopologyHealthCheckRemediation type for use +// with apply. +// +// ControlPlaneTopologyHealthCheckRemediation configures if and how remediations are triggered if a control plane Machine is unhealthy. +type ControlPlaneTopologyHealthCheckRemediationApplyConfiguration struct { + // triggerIf configures if remediations are triggered. + // If this field is not set, remediations are always triggered. + TriggerIf *ControlPlaneTopologyHealthCheckRemediationTriggerIfApplyConfiguration `json:"triggerIf,omitempty"` + // templateRef is a reference to a remediation template + // provided by an infrastructure provider. + // + // This field is completely optional, when filled, the MachineHealthCheck controller + // creates a new object from the template referenced and hands off remediation of the machine to + // a controller that lives outside of Cluster API. + TemplateRef *MachineHealthCheckRemediationTemplateReferenceApplyConfiguration `json:"templateRef,omitempty"` +} + +// ControlPlaneTopologyHealthCheckRemediationApplyConfiguration constructs a declarative configuration of the ControlPlaneTopologyHealthCheckRemediation type for use with +// apply. +func ControlPlaneTopologyHealthCheckRemediation() *ControlPlaneTopologyHealthCheckRemediationApplyConfiguration { + return &ControlPlaneTopologyHealthCheckRemediationApplyConfiguration{} +} + +// WithTriggerIf sets the TriggerIf field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TriggerIf field is set to the value of the last call. +func (b *ControlPlaneTopologyHealthCheckRemediationApplyConfiguration) WithTriggerIf(value *ControlPlaneTopologyHealthCheckRemediationTriggerIfApplyConfiguration) *ControlPlaneTopologyHealthCheckRemediationApplyConfiguration { + b.TriggerIf = value + return b +} + +// WithTemplateRef sets the TemplateRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TemplateRef field is set to the value of the last call. +func (b *ControlPlaneTopologyHealthCheckRemediationApplyConfiguration) WithTemplateRef(value *MachineHealthCheckRemediationTemplateReferenceApplyConfiguration) *ControlPlaneTopologyHealthCheckRemediationApplyConfiguration { + b.TemplateRef = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/controlplanetopologyhealthcheckremediationtriggerif.go b/util/applyconfigurations/core/v1beta2/controlplanetopologyhealthcheckremediationtriggerif.go new file mode 100644 index 000000000000..c7264504d97c --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/controlplanetopologyhealthcheckremediationtriggerif.go @@ -0,0 +1,47 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// ControlPlaneTopologyHealthCheckRemediationTriggerIfApplyConfiguration represents a declarative configuration of the ControlPlaneTopologyHealthCheckRemediationTriggerIf type for use +// with apply. +// +// ControlPlaneTopologyHealthCheckRemediationTriggerIf configures if remediations are triggered. +type ControlPlaneTopologyHealthCheckRemediationTriggerIfApplyConfiguration struct { + // unhealthyLessThanOrEqualTo specifies that remediations are only triggered if the number of + // unhealthy Machines is less than or equal to the configured value. + // unhealthyInRange takes precedence if set. + UnhealthyLessThanOrEqualTo *intstr.IntOrString `json:"unhealthyLessThanOrEqualTo,omitempty"` + // unhealthyInRange specifies that remediations are only triggered if the number of + // unhealthy Machines is in the configured range. + // Takes precedence over unhealthyLessThanOrEqualTo. + // Eg. "[3-5]" - This means that remediation will be allowed only when: + // (a) there are at least 3 unhealthy Machines (and) + // (b) there are at most 5 unhealthy Machines + UnhealthyInRange *string `json:"unhealthyInRange,omitempty"` +} + +// ControlPlaneTopologyHealthCheckRemediationTriggerIfApplyConfiguration constructs a declarative configuration of the ControlPlaneTopologyHealthCheckRemediationTriggerIf type for use with +// apply. +func ControlPlaneTopologyHealthCheckRemediationTriggerIf() *ControlPlaneTopologyHealthCheckRemediationTriggerIfApplyConfiguration { + return &ControlPlaneTopologyHealthCheckRemediationTriggerIfApplyConfiguration{} +} + +// WithUnhealthyLessThanOrEqualTo sets the UnhealthyLessThanOrEqualTo field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UnhealthyLessThanOrEqualTo field is set to the value of the last call. +func (b *ControlPlaneTopologyHealthCheckRemediationTriggerIfApplyConfiguration) WithUnhealthyLessThanOrEqualTo(value intstr.IntOrString) *ControlPlaneTopologyHealthCheckRemediationTriggerIfApplyConfiguration { + b.UnhealthyLessThanOrEqualTo = &value + return b +} + +// WithUnhealthyInRange sets the UnhealthyInRange field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UnhealthyInRange field is set to the value of the last call. +func (b *ControlPlaneTopologyHealthCheckRemediationTriggerIfApplyConfiguration) WithUnhealthyInRange(value string) *ControlPlaneTopologyHealthCheckRemediationTriggerIfApplyConfiguration { + b.UnhealthyInRange = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/controlplanetopologymachinedeletionspec.go b/util/applyconfigurations/core/v1beta2/controlplanetopologymachinedeletionspec.go new file mode 100644 index 000000000000..ad1d338a6b3c --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/controlplanetopologymachinedeletionspec.go @@ -0,0 +1,51 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// ControlPlaneTopologyMachineDeletionSpecApplyConfiguration represents a declarative configuration of the ControlPlaneTopologyMachineDeletionSpec type for use +// with apply. +// +// ControlPlaneTopologyMachineDeletionSpec contains configuration options for Machine deletion. +type ControlPlaneTopologyMachineDeletionSpecApplyConfiguration struct { + // nodeDrainTimeoutSeconds is the total amount of time that the controller will spend on draining a node. + // The default value is 0, meaning that the node can be drained without any time limitations. + // NOTE: nodeDrainTimeoutSeconds is different from `kubectl drain --timeout` + NodeDrainTimeoutSeconds *int32 `json:"nodeDrainTimeoutSeconds,omitempty"` + // nodeVolumeDetachTimeoutSeconds is the total amount of time that the controller will spend on waiting for all volumes + // to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations. + NodeVolumeDetachTimeoutSeconds *int32 `json:"nodeVolumeDetachTimeoutSeconds,omitempty"` + // nodeDeletionTimeoutSeconds defines how long the controller will attempt to delete the Node that the Machine + // hosts after the Machine is marked for deletion. A duration of 0 will retry deletion indefinitely. + // Defaults to 10 seconds. + NodeDeletionTimeoutSeconds *int32 `json:"nodeDeletionTimeoutSeconds,omitempty"` +} + +// ControlPlaneTopologyMachineDeletionSpecApplyConfiguration constructs a declarative configuration of the ControlPlaneTopologyMachineDeletionSpec type for use with +// apply. +func ControlPlaneTopologyMachineDeletionSpec() *ControlPlaneTopologyMachineDeletionSpecApplyConfiguration { + return &ControlPlaneTopologyMachineDeletionSpecApplyConfiguration{} +} + +// WithNodeDrainTimeoutSeconds sets the NodeDrainTimeoutSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeDrainTimeoutSeconds field is set to the value of the last call. +func (b *ControlPlaneTopologyMachineDeletionSpecApplyConfiguration) WithNodeDrainTimeoutSeconds(value int32) *ControlPlaneTopologyMachineDeletionSpecApplyConfiguration { + b.NodeDrainTimeoutSeconds = &value + return b +} + +// WithNodeVolumeDetachTimeoutSeconds sets the NodeVolumeDetachTimeoutSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeVolumeDetachTimeoutSeconds field is set to the value of the last call. +func (b *ControlPlaneTopologyMachineDeletionSpecApplyConfiguration) WithNodeVolumeDetachTimeoutSeconds(value int32) *ControlPlaneTopologyMachineDeletionSpecApplyConfiguration { + b.NodeVolumeDetachTimeoutSeconds = &value + return b +} + +// WithNodeDeletionTimeoutSeconds sets the NodeDeletionTimeoutSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeDeletionTimeoutSeconds field is set to the value of the last call. +func (b *ControlPlaneTopologyMachineDeletionSpecApplyConfiguration) WithNodeDeletionTimeoutSeconds(value int32) *ControlPlaneTopologyMachineDeletionSpecApplyConfiguration { + b.NodeDeletionTimeoutSeconds = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/controlplanevariables.go b/util/applyconfigurations/core/v1beta2/controlplanevariables.go new file mode 100644 index 000000000000..b3c8c3e33ef2 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/controlplanevariables.go @@ -0,0 +1,31 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// ControlPlaneVariablesApplyConfiguration represents a declarative configuration of the ControlPlaneVariables type for use +// with apply. +// +// ControlPlaneVariables can be used to provide variables for the ControlPlane. +type ControlPlaneVariablesApplyConfiguration struct { + // overrides can be used to override Cluster level variables. + Overrides []ClusterVariableApplyConfiguration `json:"overrides,omitempty"` +} + +// ControlPlaneVariablesApplyConfiguration constructs a declarative configuration of the ControlPlaneVariables type for use with +// apply. +func ControlPlaneVariables() *ControlPlaneVariablesApplyConfiguration { + return &ControlPlaneVariablesApplyConfiguration{} +} + +// WithOverrides adds the given value to the Overrides field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Overrides field. +func (b *ControlPlaneVariablesApplyConfiguration) WithOverrides(values ...*ClusterVariableApplyConfiguration) *ControlPlaneVariablesApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOverrides") + } + b.Overrides = append(b.Overrides, *values[i]) + } + return b +} diff --git a/util/applyconfigurations/core/v1beta2/externalpatchdefinition.go b/util/applyconfigurations/core/v1beta2/externalpatchdefinition.go new file mode 100644 index 000000000000..d10a26961570 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/externalpatchdefinition.go @@ -0,0 +1,65 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// ExternalPatchDefinitionApplyConfiguration represents a declarative configuration of the ExternalPatchDefinition type for use +// with apply. +// +// ExternalPatchDefinition defines an external patch. +// Note: At least one of GeneratePatchesExtension or ValidateTopologyExtension must be set. +type ExternalPatchDefinitionApplyConfiguration struct { + // generatePatchesExtension references an extension which is called to generate patches. + GeneratePatchesExtension *string `json:"generatePatchesExtension,omitempty"` + // validateTopologyExtension references an extension which is called to validate the topology. + ValidateTopologyExtension *string `json:"validateTopologyExtension,omitempty"` + // discoverVariablesExtension references an extension which is called to discover variables. + DiscoverVariablesExtension *string `json:"discoverVariablesExtension,omitempty"` + // settings defines key value pairs to be passed to the extensions. + // Values defined here take precedence over the values defined in the + // corresponding ExtensionConfig. + Settings map[string]string `json:"settings,omitempty"` +} + +// ExternalPatchDefinitionApplyConfiguration constructs a declarative configuration of the ExternalPatchDefinition type for use with +// apply. +func ExternalPatchDefinition() *ExternalPatchDefinitionApplyConfiguration { + return &ExternalPatchDefinitionApplyConfiguration{} +} + +// WithGeneratePatchesExtension sets the GeneratePatchesExtension field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GeneratePatchesExtension field is set to the value of the last call. +func (b *ExternalPatchDefinitionApplyConfiguration) WithGeneratePatchesExtension(value string) *ExternalPatchDefinitionApplyConfiguration { + b.GeneratePatchesExtension = &value + return b +} + +// WithValidateTopologyExtension sets the ValidateTopologyExtension field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ValidateTopologyExtension field is set to the value of the last call. +func (b *ExternalPatchDefinitionApplyConfiguration) WithValidateTopologyExtension(value string) *ExternalPatchDefinitionApplyConfiguration { + b.ValidateTopologyExtension = &value + return b +} + +// WithDiscoverVariablesExtension sets the DiscoverVariablesExtension field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DiscoverVariablesExtension field is set to the value of the last call. +func (b *ExternalPatchDefinitionApplyConfiguration) WithDiscoverVariablesExtension(value string) *ExternalPatchDefinitionApplyConfiguration { + b.DiscoverVariablesExtension = &value + return b +} + +// WithSettings puts the entries into the Settings field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Settings field, +// overwriting an existing map entries in Settings field with the same key. +func (b *ExternalPatchDefinitionApplyConfiguration) WithSettings(entries map[string]string) *ExternalPatchDefinitionApplyConfiguration { + if b.Settings == nil && len(entries) > 0 { + b.Settings = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Settings[k] = v + } + return b +} diff --git a/util/applyconfigurations/core/v1beta2/failuredomain.go b/util/applyconfigurations/core/v1beta2/failuredomain.go new file mode 100644 index 000000000000..4d8b309a8019 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/failuredomain.go @@ -0,0 +1,53 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// FailureDomainApplyConfiguration represents a declarative configuration of the FailureDomain type for use +// with apply. +// +// FailureDomain is the Schema for Cluster API failure domains. +// It allows controllers to understand how many failure domains a cluster can optionally span across. +type FailureDomainApplyConfiguration struct { + // name is the name of the failure domain. + Name *string `json:"name,omitempty"` + // controlPlane determines if this failure domain is suitable for use by control plane machines. + ControlPlane *bool `json:"controlPlane,omitempty"` + // attributes is a free form map of attributes an infrastructure provider might use or require. + Attributes map[string]string `json:"attributes,omitempty"` +} + +// FailureDomainApplyConfiguration constructs a declarative configuration of the FailureDomain type for use with +// apply. +func FailureDomain() *FailureDomainApplyConfiguration { + return &FailureDomainApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *FailureDomainApplyConfiguration) WithName(value string) *FailureDomainApplyConfiguration { + b.Name = &value + return b +} + +// WithControlPlane sets the ControlPlane field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ControlPlane field is set to the value of the last call. +func (b *FailureDomainApplyConfiguration) WithControlPlane(value bool) *FailureDomainApplyConfiguration { + b.ControlPlane = &value + return b +} + +// WithAttributes puts the entries into the Attributes field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Attributes field, +// overwriting an existing map entries in Attributes field with the same key. +func (b *FailureDomainApplyConfiguration) WithAttributes(entries map[string]string) *FailureDomainApplyConfiguration { + if b.Attributes == nil && len(entries) > 0 { + b.Attributes = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Attributes[k] = v + } + return b +} diff --git a/util/applyconfigurations/core/v1beta2/infrastructureclass.go b/util/applyconfigurations/core/v1beta2/infrastructureclass.go new file mode 100644 index 000000000000..a8b86c86d441 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/infrastructureclass.go @@ -0,0 +1,36 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// InfrastructureClassApplyConfiguration represents a declarative configuration of the InfrastructureClass type for use +// with apply. +// +// InfrastructureClass defines the class for the infrastructure cluster. +type InfrastructureClassApplyConfiguration struct { + // templateRef contains the reference to a provider-specific infrastructure cluster template. + TemplateRef *ClusterClassTemplateReferenceApplyConfiguration `json:"templateRef,omitempty"` + // naming allows changing the naming pattern used when creating the infrastructure cluster object. + Naming *InfrastructureClassNamingSpecApplyConfiguration `json:"naming,omitempty"` +} + +// InfrastructureClassApplyConfiguration constructs a declarative configuration of the InfrastructureClass type for use with +// apply. +func InfrastructureClass() *InfrastructureClassApplyConfiguration { + return &InfrastructureClassApplyConfiguration{} +} + +// WithTemplateRef sets the TemplateRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TemplateRef field is set to the value of the last call. +func (b *InfrastructureClassApplyConfiguration) WithTemplateRef(value *ClusterClassTemplateReferenceApplyConfiguration) *InfrastructureClassApplyConfiguration { + b.TemplateRef = value + return b +} + +// WithNaming sets the Naming field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Naming field is set to the value of the last call. +func (b *InfrastructureClassApplyConfiguration) WithNaming(value *InfrastructureClassNamingSpecApplyConfiguration) *InfrastructureClassApplyConfiguration { + b.Naming = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/infrastructureclassnamingspec.go b/util/applyconfigurations/core/v1beta2/infrastructureclassnamingspec.go new file mode 100644 index 000000000000..3a37fe6141be --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/infrastructureclassnamingspec.go @@ -0,0 +1,32 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// InfrastructureClassNamingSpecApplyConfiguration represents a declarative configuration of the InfrastructureClassNamingSpec type for use +// with apply. +// +// InfrastructureClassNamingSpec defines the naming strategy for infrastructure objects. +type InfrastructureClassNamingSpecApplyConfiguration struct { + // template defines the template to use for generating the name of the Infrastructure object. + // If not defined, it will fallback to `{{ .cluster.name }}-{{ .random }}`. + // If the templated string exceeds 63 characters, it will be trimmed to 58 characters and will + // get concatenated with a random suffix of length 5. + // The templating mechanism provides the following arguments: + // * `.cluster.name`: The name of the cluster object. + // * `.random`: A random alphanumeric string, without vowels, of length 5. + Template *string `json:"template,omitempty"` +} + +// InfrastructureClassNamingSpecApplyConfiguration constructs a declarative configuration of the InfrastructureClassNamingSpec type for use with +// apply. +func InfrastructureClassNamingSpec() *InfrastructureClassNamingSpecApplyConfiguration { + return &InfrastructureClassNamingSpecApplyConfiguration{} +} + +// WithTemplate sets the Template field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Template field is set to the value of the last call. +func (b *InfrastructureClassNamingSpecApplyConfiguration) WithTemplate(value string) *InfrastructureClassNamingSpecApplyConfiguration { + b.Template = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/jsonpatch.go b/util/applyconfigurations/core/v1beta2/jsonpatch.go new file mode 100644 index 000000000000..160dea25f4a3 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/jsonpatch.go @@ -0,0 +1,73 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" +) + +// JSONPatchApplyConfiguration represents a declarative configuration of the JSONPatch type for use +// with apply. +// +// JSONPatch defines a JSON patch. +type JSONPatchApplyConfiguration struct { + // op defines the operation of the patch. + // Note: Only `add`, `replace` and `remove` are supported. + Op *string `json:"op,omitempty"` + // path defines the path of the patch. + // Note: Only the spec of a template can be patched, thus the path has to start with /spec/. + // Note: For now the only allowed array modifications are `append` and `prepend`, i.e.: + // * for op: `add`: only index 0 (prepend) and - (append) are allowed + // * for op: `replace` or `remove`: no indexes are allowed + Path *string `json:"path,omitempty"` + // value defines the value of the patch. + // Note: Either Value or ValueFrom is required for add and replace + // operations. Only one of them is allowed to be set at the same time. + // Note: We have to use apiextensionsv1.JSON instead of our JSON type, + // because controller-tools has a hard-coded schema for apiextensionsv1.JSON + // which cannot be produced by another type (unset type field). + // Ref: https://github.com/kubernetes-sigs/controller-tools/blob/d0e03a142d0ecdd5491593e941ee1d6b5d91dba6/pkg/crd/known_types.go#L106-L111 + Value *v1.JSON `json:"value,omitempty"` + // valueFrom defines the value of the patch. + // Note: Either Value or ValueFrom is required for add and replace + // operations. Only one of them is allowed to be set at the same time. + ValueFrom *JSONPatchValueApplyConfiguration `json:"valueFrom,omitempty"` +} + +// JSONPatchApplyConfiguration constructs a declarative configuration of the JSONPatch type for use with +// apply. +func JSONPatch() *JSONPatchApplyConfiguration { + return &JSONPatchApplyConfiguration{} +} + +// WithOp sets the Op field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Op field is set to the value of the last call. +func (b *JSONPatchApplyConfiguration) WithOp(value string) *JSONPatchApplyConfiguration { + b.Op = &value + return b +} + +// WithPath sets the Path field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Path field is set to the value of the last call. +func (b *JSONPatchApplyConfiguration) WithPath(value string) *JSONPatchApplyConfiguration { + b.Path = &value + return b +} + +// WithValue sets the Value field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Value field is set to the value of the last call. +func (b *JSONPatchApplyConfiguration) WithValue(value v1.JSON) *JSONPatchApplyConfiguration { + b.Value = &value + return b +} + +// WithValueFrom sets the ValueFrom field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ValueFrom field is set to the value of the last call. +func (b *JSONPatchApplyConfiguration) WithValueFrom(value *JSONPatchValueApplyConfiguration) *JSONPatchApplyConfiguration { + b.ValueFrom = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/jsonpatchvalue.go b/util/applyconfigurations/core/v1beta2/jsonpatchvalue.go new file mode 100644 index 000000000000..8922503a4af4 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/jsonpatchvalue.go @@ -0,0 +1,40 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// JSONPatchValueApplyConfiguration represents a declarative configuration of the JSONPatchValue type for use +// with apply. +// +// JSONPatchValue defines the value of a patch. +// Note: Only one of the fields is allowed to be set at the same time. +type JSONPatchValueApplyConfiguration struct { + // variable is the variable to be used as value. + // Variable can be one of the variables defined in .spec.variables or a builtin variable. + Variable *string `json:"variable,omitempty"` + // template is the Go template to be used to calculate the value. + // A template can reference variables defined in .spec.variables and builtin variables. + // Note: The template must evaluate to a valid YAML or JSON value. + Template *string `json:"template,omitempty"` +} + +// JSONPatchValueApplyConfiguration constructs a declarative configuration of the JSONPatchValue type for use with +// apply. +func JSONPatchValue() *JSONPatchValueApplyConfiguration { + return &JSONPatchValueApplyConfiguration{} +} + +// WithVariable sets the Variable field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Variable field is set to the value of the last call. +func (b *JSONPatchValueApplyConfiguration) WithVariable(value string) *JSONPatchValueApplyConfiguration { + b.Variable = &value + return b +} + +// WithTemplate sets the Template field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Template field is set to the value of the last call. +func (b *JSONPatchValueApplyConfiguration) WithTemplate(value string) *JSONPatchValueApplyConfiguration { + b.Template = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/jsonschemaprops.go b/util/applyconfigurations/core/v1beta2/jsonschemaprops.go new file mode 100644 index 000000000000..701c437bef1f --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/jsonschemaprops.go @@ -0,0 +1,410 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" +) + +// JSONSchemaPropsApplyConfiguration represents a declarative configuration of the JSONSchemaProps type for use +// with apply. +// +// Adapted from https://github.com/kubernetes/apiextensions-apiserver/blob/v0.28.5/pkg/apis/apiextensions/v1/types_jsonschema.go#L40 +// JSONSchemaProps is a JSON-Schema following Specification Draft 4 (http://json-schema.org/). +// This struct has been initially copied from apiextensionsv1.JSONSchemaProps, but all fields +// which are not supported in CAPI have been removed. +type JSONSchemaPropsApplyConfiguration struct { + // description is a human-readable description of this variable. + Description *string `json:"description,omitempty"` + // example is an example for this variable. + Example *v1.JSON `json:"example,omitempty"` + // type is the type of the variable. + // Valid values are: object, array, string, integer, number or boolean. + Type *string `json:"type,omitempty"` + // properties specifies fields of an object. + // NOTE: Can only be set if type is object. + // NOTE: Properties is mutually exclusive with AdditionalProperties. + // NOTE: This field uses PreserveUnknownFields and Schemaless, + // because recursive validation is not possible. + Properties map[string]JSONSchemaPropsApplyConfiguration `json:"properties,omitempty"` + // additionalProperties specifies the schema of values in a map (keys are always strings). + // NOTE: Can only be set if type is object. + // NOTE: AdditionalProperties is mutually exclusive with Properties. + // NOTE: This field uses PreserveUnknownFields and Schemaless, + // because recursive validation is not possible. + AdditionalProperties *JSONSchemaPropsApplyConfiguration `json:"additionalProperties,omitempty"` + // maxProperties is the maximum amount of entries in a map or properties in an object. + // NOTE: Can only be set if type is object. + MaxProperties *int64 `json:"maxProperties,omitempty"` + // minProperties is the minimum amount of entries in a map or properties in an object. + // NOTE: Can only be set if type is object. + MinProperties *int64 `json:"minProperties,omitempty"` + // required specifies which fields of an object are required. + // NOTE: Can only be set if type is object. + Required []string `json:"required,omitempty"` + // items specifies fields of an array. + // NOTE: Can only be set if type is array. + // NOTE: This field uses PreserveUnknownFields and Schemaless, + // because recursive validation is not possible. + Items *JSONSchemaPropsApplyConfiguration `json:"items,omitempty"` + // maxItems is the max length of an array variable. + // NOTE: Can only be set if type is array. + MaxItems *int64 `json:"maxItems,omitempty"` + // minItems is the min length of an array variable. + // NOTE: Can only be set if type is array. + MinItems *int64 `json:"minItems,omitempty"` + // uniqueItems specifies if items in an array must be unique. + // NOTE: Can only be set if type is array. + UniqueItems *bool `json:"uniqueItems,omitempty"` + // format is an OpenAPI v3 format string. Unknown formats are ignored. + // For a list of supported formats please see: (of the k8s.io/apiextensions-apiserver version we're currently using) + // https://github.com/kubernetes/apiextensions-apiserver/blob/master/pkg/apiserver/validation/formats.go + // NOTE: Can only be set if type is string. + Format *string `json:"format,omitempty"` + // maxLength is the max length of a string variable. + // NOTE: Can only be set if type is string. + MaxLength *int64 `json:"maxLength,omitempty"` + // minLength is the min length of a string variable. + // NOTE: Can only be set if type is string. + MinLength *int64 `json:"minLength,omitempty"` + // pattern is the regex which a string variable must match. + // NOTE: Can only be set if type is string. + Pattern *string `json:"pattern,omitempty"` + // maximum is the maximum of an integer or number variable. + // If ExclusiveMaximum is false, the variable is valid if it is lower than, or equal to, the value of Maximum. + // If ExclusiveMaximum is true, the variable is valid if it is strictly lower than the value of Maximum. + // NOTE: Can only be set if type is integer or number. + Maximum *int64 `json:"maximum,omitempty"` + // exclusiveMaximum specifies if the Maximum is exclusive. + // NOTE: Can only be set if type is integer or number. + ExclusiveMaximum *bool `json:"exclusiveMaximum,omitempty"` + // minimum is the minimum of an integer or number variable. + // If ExclusiveMinimum is false, the variable is valid if it is greater than, or equal to, the value of Minimum. + // If ExclusiveMinimum is true, the variable is valid if it is strictly greater than the value of Minimum. + // NOTE: Can only be set if type is integer or number. + Minimum *int64 `json:"minimum,omitempty"` + // exclusiveMinimum specifies if the Minimum is exclusive. + // NOTE: Can only be set if type is integer or number. + ExclusiveMinimum *bool `json:"exclusiveMinimum,omitempty"` + // x-kubernetes-preserve-unknown-fields allows setting fields in a variable object + // which are not defined in the variable schema. This affects fields recursively, + // except if nested properties or additionalProperties are specified in the schema. + XPreserveUnknownFields *bool `json:"x-kubernetes-preserve-unknown-fields,omitempty"` + // enum is the list of valid values of the variable. + // NOTE: Can be set for all types. + Enum []v1.JSON `json:"enum,omitempty"` + // default is the default value of the variable. + // NOTE: Can be set for all types. + Default *v1.JSON `json:"default,omitempty"` + // x-kubernetes-validations describes a list of validation rules written in the CEL expression language. + XValidations []ValidationRuleApplyConfiguration `json:"x-kubernetes-validations,omitempty"` + // x-metadata is the metadata of a variable or a nested field within a variable. + // It can be used to add additional data for higher level tools. + XMetadata *VariableSchemaMetadataApplyConfiguration `json:"x-metadata,omitempty"` + // x-kubernetes-int-or-string specifies that this value is + // either an integer or a string. If this is true, an empty + // type is allowed and type as child of anyOf is permitted + // if following one of the following patterns: + // + // 1) anyOf: + // - type: integer + // - type: string + // 2) allOf: + // - anyOf: + // - type: integer + // - type: string + // - ... zero or more + XIntOrString *bool `json:"x-kubernetes-int-or-string,omitempty"` + // allOf specifies that the variable must validate against all of the subschemas in the array. + // NOTE: This field uses PreserveUnknownFields and Schemaless, + // because recursive validation is not possible. + AllOf []JSONSchemaPropsApplyConfiguration `json:"allOf,omitempty"` + // oneOf specifies that the variable must validate against exactly one of the subschemas in the array. + // NOTE: This field uses PreserveUnknownFields and Schemaless, + // because recursive validation is not possible. + OneOf []JSONSchemaPropsApplyConfiguration `json:"oneOf,omitempty"` + // anyOf specifies that the variable must validate against one or more of the subschemas in the array. + // NOTE: This field uses PreserveUnknownFields and Schemaless, + // because recursive validation is not possible. + AnyOf []JSONSchemaPropsApplyConfiguration `json:"anyOf,omitempty"` + // not specifies that the variable must not validate against the subschema. + // NOTE: This field uses PreserveUnknownFields and Schemaless, + // because recursive validation is not possible. + Not *JSONSchemaPropsApplyConfiguration `json:"not,omitempty"` +} + +// JSONSchemaPropsApplyConfiguration constructs a declarative configuration of the JSONSchemaProps type for use with +// apply. +func JSONSchemaProps() *JSONSchemaPropsApplyConfiguration { + return &JSONSchemaPropsApplyConfiguration{} +} + +// WithDescription sets the Description field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Description field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithDescription(value string) *JSONSchemaPropsApplyConfiguration { + b.Description = &value + return b +} + +// WithExample sets the Example field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Example field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithExample(value v1.JSON) *JSONSchemaPropsApplyConfiguration { + b.Example = &value + return b +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithType(value string) *JSONSchemaPropsApplyConfiguration { + b.Type = &value + return b +} + +// WithProperties puts the entries into the Properties field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Properties field, +// overwriting an existing map entries in Properties field with the same key. +func (b *JSONSchemaPropsApplyConfiguration) WithProperties(entries map[string]JSONSchemaPropsApplyConfiguration) *JSONSchemaPropsApplyConfiguration { + if b.Properties == nil && len(entries) > 0 { + b.Properties = make(map[string]JSONSchemaPropsApplyConfiguration, len(entries)) + } + for k, v := range entries { + b.Properties[k] = v + } + return b +} + +// WithAdditionalProperties sets the AdditionalProperties field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AdditionalProperties field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithAdditionalProperties(value *JSONSchemaPropsApplyConfiguration) *JSONSchemaPropsApplyConfiguration { + b.AdditionalProperties = value + return b +} + +// WithMaxProperties sets the MaxProperties field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxProperties field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithMaxProperties(value int64) *JSONSchemaPropsApplyConfiguration { + b.MaxProperties = &value + return b +} + +// WithMinProperties sets the MinProperties field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinProperties field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithMinProperties(value int64) *JSONSchemaPropsApplyConfiguration { + b.MinProperties = &value + return b +} + +// WithRequired adds the given value to the Required field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Required field. +func (b *JSONSchemaPropsApplyConfiguration) WithRequired(values ...string) *JSONSchemaPropsApplyConfiguration { + for i := range values { + b.Required = append(b.Required, values[i]) + } + return b +} + +// WithItems sets the Items field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Items field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithItems(value *JSONSchemaPropsApplyConfiguration) *JSONSchemaPropsApplyConfiguration { + b.Items = value + return b +} + +// WithMaxItems sets the MaxItems field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxItems field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithMaxItems(value int64) *JSONSchemaPropsApplyConfiguration { + b.MaxItems = &value + return b +} + +// WithMinItems sets the MinItems field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinItems field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithMinItems(value int64) *JSONSchemaPropsApplyConfiguration { + b.MinItems = &value + return b +} + +// WithUniqueItems sets the UniqueItems field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UniqueItems field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithUniqueItems(value bool) *JSONSchemaPropsApplyConfiguration { + b.UniqueItems = &value + return b +} + +// WithFormat sets the Format field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Format field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithFormat(value string) *JSONSchemaPropsApplyConfiguration { + b.Format = &value + return b +} + +// WithMaxLength sets the MaxLength field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxLength field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithMaxLength(value int64) *JSONSchemaPropsApplyConfiguration { + b.MaxLength = &value + return b +} + +// WithMinLength sets the MinLength field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinLength field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithMinLength(value int64) *JSONSchemaPropsApplyConfiguration { + b.MinLength = &value + return b +} + +// WithPattern sets the Pattern field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Pattern field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithPattern(value string) *JSONSchemaPropsApplyConfiguration { + b.Pattern = &value + return b +} + +// WithMaximum sets the Maximum field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Maximum field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithMaximum(value int64) *JSONSchemaPropsApplyConfiguration { + b.Maximum = &value + return b +} + +// WithExclusiveMaximum sets the ExclusiveMaximum field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ExclusiveMaximum field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithExclusiveMaximum(value bool) *JSONSchemaPropsApplyConfiguration { + b.ExclusiveMaximum = &value + return b +} + +// WithMinimum sets the Minimum field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Minimum field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithMinimum(value int64) *JSONSchemaPropsApplyConfiguration { + b.Minimum = &value + return b +} + +// WithExclusiveMinimum sets the ExclusiveMinimum field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ExclusiveMinimum field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithExclusiveMinimum(value bool) *JSONSchemaPropsApplyConfiguration { + b.ExclusiveMinimum = &value + return b +} + +// WithXPreserveUnknownFields sets the XPreserveUnknownFields field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the XPreserveUnknownFields field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithXPreserveUnknownFields(value bool) *JSONSchemaPropsApplyConfiguration { + b.XPreserveUnknownFields = &value + return b +} + +// WithEnum adds the given value to the Enum field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Enum field. +func (b *JSONSchemaPropsApplyConfiguration) WithEnum(values ...v1.JSON) *JSONSchemaPropsApplyConfiguration { + for i := range values { + b.Enum = append(b.Enum, values[i]) + } + return b +} + +// WithDefault sets the Default field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Default field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithDefault(value v1.JSON) *JSONSchemaPropsApplyConfiguration { + b.Default = &value + return b +} + +// WithXValidations adds the given value to the XValidations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the XValidations field. +func (b *JSONSchemaPropsApplyConfiguration) WithXValidations(values ...*ValidationRuleApplyConfiguration) *JSONSchemaPropsApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithXValidations") + } + b.XValidations = append(b.XValidations, *values[i]) + } + return b +} + +// WithXMetadata sets the XMetadata field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the XMetadata field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithXMetadata(value *VariableSchemaMetadataApplyConfiguration) *JSONSchemaPropsApplyConfiguration { + b.XMetadata = value + return b +} + +// WithXIntOrString sets the XIntOrString field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the XIntOrString field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithXIntOrString(value bool) *JSONSchemaPropsApplyConfiguration { + b.XIntOrString = &value + return b +} + +// WithAllOf adds the given value to the AllOf field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the AllOf field. +func (b *JSONSchemaPropsApplyConfiguration) WithAllOf(values ...*JSONSchemaPropsApplyConfiguration) *JSONSchemaPropsApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithAllOf") + } + b.AllOf = append(b.AllOf, *values[i]) + } + return b +} + +// WithOneOf adds the given value to the OneOf field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OneOf field. +func (b *JSONSchemaPropsApplyConfiguration) WithOneOf(values ...*JSONSchemaPropsApplyConfiguration) *JSONSchemaPropsApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOneOf") + } + b.OneOf = append(b.OneOf, *values[i]) + } + return b +} + +// WithAnyOf adds the given value to the AnyOf field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the AnyOf field. +func (b *JSONSchemaPropsApplyConfiguration) WithAnyOf(values ...*JSONSchemaPropsApplyConfiguration) *JSONSchemaPropsApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithAnyOf") + } + b.AnyOf = append(b.AnyOf, *values[i]) + } + return b +} + +// WithNot sets the Not field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Not field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithNot(value *JSONSchemaPropsApplyConfiguration) *JSONSchemaPropsApplyConfiguration { + b.Not = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machine.go b/util/applyconfigurations/core/v1beta2/machine.go new file mode 100644 index 000000000000..42989086bcdc --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machine.go @@ -0,0 +1,277 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" + corev1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2" + internal "sigs.k8s.io/cluster-api/util/applyconfigurations/internal" +) + +// MachineApplyConfiguration represents a declarative configuration of the Machine type for use +// with apply. +// +// Machine is the Schema for the machines API. +type MachineApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + // metadata is the standard object's metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + // spec is the desired state of Machine. + Spec *MachineSpecApplyConfiguration `json:"spec,omitempty"` + // status is the observed state of Machine. + Status *MachineStatusApplyConfiguration `json:"status,omitempty"` +} + +// Machine constructs a declarative configuration of the Machine type for use with +// apply. +func Machine(name, namespace string) *MachineApplyConfiguration { + b := &MachineApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Machine") + b.WithAPIVersion("cluster.x-k8s.io/v1beta2") + return b +} + +// ExtractMachineFrom extracts the applied configuration owned by fieldManager from +// machine for the specified subresource. Pass an empty string for subresource to extract +// the main resource. Common subresources include "status", "scale", etc. +// machine must be a unmodified Machine API object that was retrieved from the Kubernetes API. +// ExtractMachineFrom provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractMachineFrom(machine *corev1beta2.Machine, fieldManager string, subresource string) (*MachineApplyConfiguration, error) { + b := &MachineApplyConfiguration{} + err := managedfields.ExtractInto(machine, internal.Parser().Type("io.k8s.sigs.cluster-api.api.core.v1beta2.Machine"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(machine.Name) + b.WithNamespace(machine.Namespace) + + b.WithKind("Machine") + b.WithAPIVersion("cluster.x-k8s.io/v1beta2") + return b, nil +} + +// ExtractMachine extracts the applied configuration owned by fieldManager from +// machine. If no managedFields are found in machine for fieldManager, a +// MachineApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// machine must be a unmodified Machine API object that was retrieved from the Kubernetes API. +// ExtractMachine provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractMachine(machine *corev1beta2.Machine, fieldManager string) (*MachineApplyConfiguration, error) { + return ExtractMachineFrom(machine, fieldManager, "") +} + +// ExtractMachineStatus extracts the applied configuration owned by fieldManager from +// machine for the status subresource. +func ExtractMachineStatus(machine *corev1beta2.Machine, fieldManager string) (*MachineApplyConfiguration, error) { + return ExtractMachineFrom(machine, fieldManager, "status") +} + +func (b MachineApplyConfiguration) IsApplyConfiguration() {} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *MachineApplyConfiguration) WithKind(value string) *MachineApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *MachineApplyConfiguration) WithAPIVersion(value string) *MachineApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *MachineApplyConfiguration) WithName(value string) *MachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *MachineApplyConfiguration) WithGenerateName(value string) *MachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *MachineApplyConfiguration) WithNamespace(value string) *MachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *MachineApplyConfiguration) WithUID(value types.UID) *MachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *MachineApplyConfiguration) WithResourceVersion(value string) *MachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *MachineApplyConfiguration) WithGeneration(value int64) *MachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *MachineApplyConfiguration) WithCreationTimestamp(value metav1.Time) *MachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *MachineApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *MachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *MachineApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *MachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *MachineApplyConfiguration) WithLabels(entries map[string]string) *MachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *MachineApplyConfiguration) WithAnnotations(entries map[string]string) *MachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *MachineApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *MachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *MachineApplyConfiguration) WithFinalizers(values ...string) *MachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *MachineApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *MachineApplyConfiguration) WithSpec(value *MachineSpecApplyConfiguration) *MachineApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *MachineApplyConfiguration) WithStatus(value *MachineStatusApplyConfiguration) *MachineApplyConfiguration { + b.Status = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *MachineApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *MachineApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *MachineApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *MachineApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/util/applyconfigurations/core/v1beta2/machineaddress.go b/util/applyconfigurations/core/v1beta2/machineaddress.go new file mode 100644 index 000000000000..679c4625f6e5 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machineaddress.go @@ -0,0 +1,40 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + corev1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2" +) + +// MachineAddressApplyConfiguration represents a declarative configuration of the MachineAddress type for use +// with apply. +// +// MachineAddress contains information for the node's address. +type MachineAddressApplyConfiguration struct { + // type is the machine address type, one of Hostname, ExternalIP, InternalIP, ExternalDNS or InternalDNS. + Type *corev1beta2.MachineAddressType `json:"type,omitempty"` + // address is the machine address. + Address *string `json:"address,omitempty"` +} + +// MachineAddressApplyConfiguration constructs a declarative configuration of the MachineAddress type for use with +// apply. +func MachineAddress() *MachineAddressApplyConfiguration { + return &MachineAddressApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *MachineAddressApplyConfiguration) WithType(value corev1beta2.MachineAddressType) *MachineAddressApplyConfiguration { + b.Type = &value + return b +} + +// WithAddress sets the Address field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Address field is set to the value of the last call. +func (b *MachineAddressApplyConfiguration) WithAddress(value string) *MachineAddressApplyConfiguration { + b.Address = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedeletionspec.go b/util/applyconfigurations/core/v1beta2/machinedeletionspec.go new file mode 100644 index 000000000000..ce77fea9b097 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedeletionspec.go @@ -0,0 +1,51 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachineDeletionSpecApplyConfiguration represents a declarative configuration of the MachineDeletionSpec type for use +// with apply. +// +// MachineDeletionSpec contains configuration options for Machine deletion. +type MachineDeletionSpecApplyConfiguration struct { + // nodeDrainTimeoutSeconds is the total amount of time that the controller will spend on draining a node. + // The default value is 0, meaning that the node can be drained without any time limitations. + // NOTE: nodeDrainTimeoutSeconds is different from `kubectl drain --timeout` + NodeDrainTimeoutSeconds *int32 `json:"nodeDrainTimeoutSeconds,omitempty"` + // nodeVolumeDetachTimeoutSeconds is the total amount of time that the controller will spend on waiting for all volumes + // to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations. + NodeVolumeDetachTimeoutSeconds *int32 `json:"nodeVolumeDetachTimeoutSeconds,omitempty"` + // nodeDeletionTimeoutSeconds defines how long the controller will attempt to delete the Node that the Machine + // hosts after the Machine is marked for deletion. A duration of 0 will retry deletion indefinitely. + // Defaults to 10 seconds. + NodeDeletionTimeoutSeconds *int32 `json:"nodeDeletionTimeoutSeconds,omitempty"` +} + +// MachineDeletionSpecApplyConfiguration constructs a declarative configuration of the MachineDeletionSpec type for use with +// apply. +func MachineDeletionSpec() *MachineDeletionSpecApplyConfiguration { + return &MachineDeletionSpecApplyConfiguration{} +} + +// WithNodeDrainTimeoutSeconds sets the NodeDrainTimeoutSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeDrainTimeoutSeconds field is set to the value of the last call. +func (b *MachineDeletionSpecApplyConfiguration) WithNodeDrainTimeoutSeconds(value int32) *MachineDeletionSpecApplyConfiguration { + b.NodeDrainTimeoutSeconds = &value + return b +} + +// WithNodeVolumeDetachTimeoutSeconds sets the NodeVolumeDetachTimeoutSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeVolumeDetachTimeoutSeconds field is set to the value of the last call. +func (b *MachineDeletionSpecApplyConfiguration) WithNodeVolumeDetachTimeoutSeconds(value int32) *MachineDeletionSpecApplyConfiguration { + b.NodeVolumeDetachTimeoutSeconds = &value + return b +} + +// WithNodeDeletionTimeoutSeconds sets the NodeDeletionTimeoutSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeDeletionTimeoutSeconds field is set to the value of the last call. +func (b *MachineDeletionSpecApplyConfiguration) WithNodeDeletionTimeoutSeconds(value int32) *MachineDeletionSpecApplyConfiguration { + b.NodeDeletionTimeoutSeconds = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedeletionstatus.go b/util/applyconfigurations/core/v1beta2/machinedeletionstatus.go new file mode 100644 index 000000000000..9fac1806fb1d --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedeletionstatus.go @@ -0,0 +1,46 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// MachineDeletionStatusApplyConfiguration represents a declarative configuration of the MachineDeletionStatus type for use +// with apply. +// +// MachineDeletionStatus is the deletion state of the Machine. +type MachineDeletionStatusApplyConfiguration struct { + // nodeDrainStartTime is the time when the drain of the node started and is used to determine + // if the nodeDrainTimeoutSeconds is exceeded. + // Only present when the Machine has a deletionTimestamp and draining the node had been started. + NodeDrainStartTime *v1.Time `json:"nodeDrainStartTime,omitempty"` + // waitForNodeVolumeDetachStartTime is the time when waiting for volume detachment started + // and is used to determine if the nodeVolumeDetachTimeoutSeconds is exceeded. + // Detaching volumes from nodes is usually done by CSI implementations and the current state + // is observed from the node's `.Status.VolumesAttached` field. + // Only present when the Machine has a deletionTimestamp and waiting for volume detachments had been started. + WaitForNodeVolumeDetachStartTime *v1.Time `json:"waitForNodeVolumeDetachStartTime,omitempty"` +} + +// MachineDeletionStatusApplyConfiguration constructs a declarative configuration of the MachineDeletionStatus type for use with +// apply. +func MachineDeletionStatus() *MachineDeletionStatusApplyConfiguration { + return &MachineDeletionStatusApplyConfiguration{} +} + +// WithNodeDrainStartTime sets the NodeDrainStartTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeDrainStartTime field is set to the value of the last call. +func (b *MachineDeletionStatusApplyConfiguration) WithNodeDrainStartTime(value v1.Time) *MachineDeletionStatusApplyConfiguration { + b.NodeDrainStartTime = &value + return b +} + +// WithWaitForNodeVolumeDetachStartTime sets the WaitForNodeVolumeDetachStartTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the WaitForNodeVolumeDetachStartTime field is set to the value of the last call. +func (b *MachineDeletionStatusApplyConfiguration) WithWaitForNodeVolumeDetachStartTime(value v1.Time) *MachineDeletionStatusApplyConfiguration { + b.WaitForNodeVolumeDetachStartTime = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedeployment.go b/util/applyconfigurations/core/v1beta2/machinedeployment.go new file mode 100644 index 000000000000..c19df626751b --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedeployment.go @@ -0,0 +1,277 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" + corev1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2" + internal "sigs.k8s.io/cluster-api/util/applyconfigurations/internal" +) + +// MachineDeploymentApplyConfiguration represents a declarative configuration of the MachineDeployment type for use +// with apply. +// +// MachineDeployment is the Schema for the machinedeployments API. +type MachineDeploymentApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + // metadata is the standard object's metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + // spec is the desired state of MachineDeployment. + Spec *MachineDeploymentSpecApplyConfiguration `json:"spec,omitempty"` + // status is the observed state of MachineDeployment. + Status *MachineDeploymentStatusApplyConfiguration `json:"status,omitempty"` +} + +// MachineDeployment constructs a declarative configuration of the MachineDeployment type for use with +// apply. +func MachineDeployment(name, namespace string) *MachineDeploymentApplyConfiguration { + b := &MachineDeploymentApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("MachineDeployment") + b.WithAPIVersion("cluster.x-k8s.io/v1beta2") + return b +} + +// ExtractMachineDeploymentFrom extracts the applied configuration owned by fieldManager from +// machineDeployment for the specified subresource. Pass an empty string for subresource to extract +// the main resource. Common subresources include "status", "scale", etc. +// machineDeployment must be a unmodified MachineDeployment API object that was retrieved from the Kubernetes API. +// ExtractMachineDeploymentFrom provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractMachineDeploymentFrom(machineDeployment *corev1beta2.MachineDeployment, fieldManager string, subresource string) (*MachineDeploymentApplyConfiguration, error) { + b := &MachineDeploymentApplyConfiguration{} + err := managedfields.ExtractInto(machineDeployment, internal.Parser().Type("io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeployment"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(machineDeployment.Name) + b.WithNamespace(machineDeployment.Namespace) + + b.WithKind("MachineDeployment") + b.WithAPIVersion("cluster.x-k8s.io/v1beta2") + return b, nil +} + +// ExtractMachineDeployment extracts the applied configuration owned by fieldManager from +// machineDeployment. If no managedFields are found in machineDeployment for fieldManager, a +// MachineDeploymentApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// machineDeployment must be a unmodified MachineDeployment API object that was retrieved from the Kubernetes API. +// ExtractMachineDeployment provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractMachineDeployment(machineDeployment *corev1beta2.MachineDeployment, fieldManager string) (*MachineDeploymentApplyConfiguration, error) { + return ExtractMachineDeploymentFrom(machineDeployment, fieldManager, "") +} + +// ExtractMachineDeploymentStatus extracts the applied configuration owned by fieldManager from +// machineDeployment for the status subresource. +func ExtractMachineDeploymentStatus(machineDeployment *corev1beta2.MachineDeployment, fieldManager string) (*MachineDeploymentApplyConfiguration, error) { + return ExtractMachineDeploymentFrom(machineDeployment, fieldManager, "status") +} + +func (b MachineDeploymentApplyConfiguration) IsApplyConfiguration() {} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *MachineDeploymentApplyConfiguration) WithKind(value string) *MachineDeploymentApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *MachineDeploymentApplyConfiguration) WithAPIVersion(value string) *MachineDeploymentApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *MachineDeploymentApplyConfiguration) WithName(value string) *MachineDeploymentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *MachineDeploymentApplyConfiguration) WithGenerateName(value string) *MachineDeploymentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *MachineDeploymentApplyConfiguration) WithNamespace(value string) *MachineDeploymentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *MachineDeploymentApplyConfiguration) WithUID(value types.UID) *MachineDeploymentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *MachineDeploymentApplyConfiguration) WithResourceVersion(value string) *MachineDeploymentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *MachineDeploymentApplyConfiguration) WithGeneration(value int64) *MachineDeploymentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *MachineDeploymentApplyConfiguration) WithCreationTimestamp(value metav1.Time) *MachineDeploymentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *MachineDeploymentApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *MachineDeploymentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *MachineDeploymentApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *MachineDeploymentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *MachineDeploymentApplyConfiguration) WithLabels(entries map[string]string) *MachineDeploymentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *MachineDeploymentApplyConfiguration) WithAnnotations(entries map[string]string) *MachineDeploymentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *MachineDeploymentApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *MachineDeploymentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *MachineDeploymentApplyConfiguration) WithFinalizers(values ...string) *MachineDeploymentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *MachineDeploymentApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *MachineDeploymentApplyConfiguration) WithSpec(value *MachineDeploymentSpecApplyConfiguration) *MachineDeploymentApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *MachineDeploymentApplyConfiguration) WithStatus(value *MachineDeploymentStatusApplyConfiguration) *MachineDeploymentApplyConfiguration { + b.Status = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *MachineDeploymentApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *MachineDeploymentApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *MachineDeploymentApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *MachineDeploymentApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/util/applyconfigurations/core/v1beta2/machinedeploymentclass.go b/util/applyconfigurations/core/v1beta2/machinedeploymentclass.go new file mode 100644 index 000000000000..e927daccd52b --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedeploymentclass.go @@ -0,0 +1,150 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachineDeploymentClassApplyConfiguration represents a declarative configuration of the MachineDeploymentClass type for use +// with apply. +// +// MachineDeploymentClass serves as a template to define a set of worker nodes of the cluster +// provisioned using the `ClusterClass`. +type MachineDeploymentClassApplyConfiguration struct { + // metadata is the metadata applied to the MachineDeployment and the machines of the MachineDeployment. + // At runtime this metadata is merged with the corresponding metadata from the topology. + Metadata *ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + // class denotes a type of worker node present in the cluster, + // this name MUST be unique within a ClusterClass and can be referenced + // in the Cluster to create a managed MachineDeployment. + Class *string `json:"class,omitempty"` + // bootstrap contains the bootstrap template reference to be used + // for the creation of worker Machines. + Bootstrap *MachineDeploymentClassBootstrapTemplateApplyConfiguration `json:"bootstrap,omitempty"` + // infrastructure contains the infrastructure template reference to be used + // for the creation of worker Machines. + Infrastructure *MachineDeploymentClassInfrastructureTemplateApplyConfiguration `json:"infrastructure,omitempty"` + // healthCheck defines a MachineHealthCheck for this MachineDeploymentClass. + HealthCheck *MachineDeploymentClassHealthCheckApplyConfiguration `json:"healthCheck,omitempty"` + // failureDomain is the failure domain the machines will be created in. + // Must match the name of a FailureDomain from the Cluster status. + // NOTE: This value can be overridden while defining a Cluster.Topology using this MachineDeploymentClass. + FailureDomain *string `json:"failureDomain,omitempty"` + // naming allows changing the naming pattern used when creating the MachineDeployment. + Naming *MachineDeploymentClassNamingSpecApplyConfiguration `json:"naming,omitempty"` + // deletion contains configuration options for Machine deletion. + Deletion *MachineDeploymentClassMachineDeletionSpecApplyConfiguration `json:"deletion,omitempty"` + // minReadySeconds is the minimum number of seconds for which a newly created machine should + // be ready. + // Defaults to 0 (machine will be considered available as soon as it + // is ready) + // NOTE: This value can be overridden while defining a Cluster.Topology using this MachineDeploymentClass. + MinReadySeconds *int32 `json:"minReadySeconds,omitempty"` + // readinessGates specifies additional conditions to include when evaluating Machine Ready condition. + // + // This field can be used e.g. to instruct the machine controller to include in the computation for Machine's ready + // computation a condition, managed by an external controllers, reporting the status of special software/hardware installed on the Machine. + // + // NOTE: If a Cluster defines a custom list of readinessGates for a MachineDeployment using this MachineDeploymentClass, + // such list overrides readinessGates defined in this field. + ReadinessGates []MachineReadinessGateApplyConfiguration `json:"readinessGates,omitempty"` + // rollout allows you to configure the behaviour of rolling updates to the MachineDeployment Machines. + // It allows you to define the strategy used during rolling replacements. + Rollout *MachineDeploymentClassRolloutSpecApplyConfiguration `json:"rollout,omitempty"` +} + +// MachineDeploymentClassApplyConfiguration constructs a declarative configuration of the MachineDeploymentClass type for use with +// apply. +func MachineDeploymentClass() *MachineDeploymentClassApplyConfiguration { + return &MachineDeploymentClassApplyConfiguration{} +} + +// WithMetadata sets the Metadata field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Metadata field is set to the value of the last call. +func (b *MachineDeploymentClassApplyConfiguration) WithMetadata(value *ObjectMetaApplyConfiguration) *MachineDeploymentClassApplyConfiguration { + b.Metadata = value + return b +} + +// WithClass sets the Class field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Class field is set to the value of the last call. +func (b *MachineDeploymentClassApplyConfiguration) WithClass(value string) *MachineDeploymentClassApplyConfiguration { + b.Class = &value + return b +} + +// WithBootstrap sets the Bootstrap field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Bootstrap field is set to the value of the last call. +func (b *MachineDeploymentClassApplyConfiguration) WithBootstrap(value *MachineDeploymentClassBootstrapTemplateApplyConfiguration) *MachineDeploymentClassApplyConfiguration { + b.Bootstrap = value + return b +} + +// WithInfrastructure sets the Infrastructure field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Infrastructure field is set to the value of the last call. +func (b *MachineDeploymentClassApplyConfiguration) WithInfrastructure(value *MachineDeploymentClassInfrastructureTemplateApplyConfiguration) *MachineDeploymentClassApplyConfiguration { + b.Infrastructure = value + return b +} + +// WithHealthCheck sets the HealthCheck field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the HealthCheck field is set to the value of the last call. +func (b *MachineDeploymentClassApplyConfiguration) WithHealthCheck(value *MachineDeploymentClassHealthCheckApplyConfiguration) *MachineDeploymentClassApplyConfiguration { + b.HealthCheck = value + return b +} + +// WithFailureDomain sets the FailureDomain field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FailureDomain field is set to the value of the last call. +func (b *MachineDeploymentClassApplyConfiguration) WithFailureDomain(value string) *MachineDeploymentClassApplyConfiguration { + b.FailureDomain = &value + return b +} + +// WithNaming sets the Naming field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Naming field is set to the value of the last call. +func (b *MachineDeploymentClassApplyConfiguration) WithNaming(value *MachineDeploymentClassNamingSpecApplyConfiguration) *MachineDeploymentClassApplyConfiguration { + b.Naming = value + return b +} + +// WithDeletion sets the Deletion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Deletion field is set to the value of the last call. +func (b *MachineDeploymentClassApplyConfiguration) WithDeletion(value *MachineDeploymentClassMachineDeletionSpecApplyConfiguration) *MachineDeploymentClassApplyConfiguration { + b.Deletion = value + return b +} + +// WithMinReadySeconds sets the MinReadySeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinReadySeconds field is set to the value of the last call. +func (b *MachineDeploymentClassApplyConfiguration) WithMinReadySeconds(value int32) *MachineDeploymentClassApplyConfiguration { + b.MinReadySeconds = &value + return b +} + +// WithReadinessGates adds the given value to the ReadinessGates field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ReadinessGates field. +func (b *MachineDeploymentClassApplyConfiguration) WithReadinessGates(values ...*MachineReadinessGateApplyConfiguration) *MachineDeploymentClassApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithReadinessGates") + } + b.ReadinessGates = append(b.ReadinessGates, *values[i]) + } + return b +} + +// WithRollout sets the Rollout field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Rollout field is set to the value of the last call. +func (b *MachineDeploymentClassApplyConfiguration) WithRollout(value *MachineDeploymentClassRolloutSpecApplyConfiguration) *MachineDeploymentClassApplyConfiguration { + b.Rollout = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedeploymentclassbootstraptemplate.go b/util/applyconfigurations/core/v1beta2/machinedeploymentclassbootstraptemplate.go new file mode 100644 index 000000000000..06ddadc8f2f6 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedeploymentclassbootstraptemplate.go @@ -0,0 +1,26 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachineDeploymentClassBootstrapTemplateApplyConfiguration represents a declarative configuration of the MachineDeploymentClassBootstrapTemplate type for use +// with apply. +// +// MachineDeploymentClassBootstrapTemplate defines the BootstrapTemplate for a MachineDeployment. +type MachineDeploymentClassBootstrapTemplateApplyConfiguration struct { + // templateRef is a required reference to the BootstrapTemplate for a MachineDeployment. + TemplateRef *ClusterClassTemplateReferenceApplyConfiguration `json:"templateRef,omitempty"` +} + +// MachineDeploymentClassBootstrapTemplateApplyConfiguration constructs a declarative configuration of the MachineDeploymentClassBootstrapTemplate type for use with +// apply. +func MachineDeploymentClassBootstrapTemplate() *MachineDeploymentClassBootstrapTemplateApplyConfiguration { + return &MachineDeploymentClassBootstrapTemplateApplyConfiguration{} +} + +// WithTemplateRef sets the TemplateRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TemplateRef field is set to the value of the last call. +func (b *MachineDeploymentClassBootstrapTemplateApplyConfiguration) WithTemplateRef(value *ClusterClassTemplateReferenceApplyConfiguration) *MachineDeploymentClassBootstrapTemplateApplyConfiguration { + b.TemplateRef = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedeploymentclasshealthcheck.go b/util/applyconfigurations/core/v1beta2/machinedeploymentclasshealthcheck.go new file mode 100644 index 000000000000..dd38ea4e07c2 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedeploymentclasshealthcheck.go @@ -0,0 +1,50 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachineDeploymentClassHealthCheckApplyConfiguration represents a declarative configuration of the MachineDeploymentClassHealthCheck type for use +// with apply. +// +// MachineDeploymentClassHealthCheck defines a MachineHealthCheck for MachineDeployment machines. +type MachineDeploymentClassHealthCheckApplyConfiguration struct { + // checks are the checks that are used to evaluate if a Machine is healthy. + // + // Independent of this configuration the MachineHealthCheck controller will always + // flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and + // Machines with deleted Nodes as unhealthy. + // + // Furthermore, if checks.nodeStartupTimeoutSeconds is not set it + // is defaulted to 10 minutes and evaluated accordingly. + Checks *MachineDeploymentClassHealthCheckChecksApplyConfiguration `json:"checks,omitempty"` + // remediation configures if and how remediations are triggered if a Machine is unhealthy. + // + // If remediation or remediation.triggerIf is not set, + // remediation will always be triggered for unhealthy Machines. + // + // If remediation or remediation.templateRef is not set, + // the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via + // the owner of the Machines, for example a MachineSet or a KubeadmControlPlane. + Remediation *MachineDeploymentClassHealthCheckRemediationApplyConfiguration `json:"remediation,omitempty"` +} + +// MachineDeploymentClassHealthCheckApplyConfiguration constructs a declarative configuration of the MachineDeploymentClassHealthCheck type for use with +// apply. +func MachineDeploymentClassHealthCheck() *MachineDeploymentClassHealthCheckApplyConfiguration { + return &MachineDeploymentClassHealthCheckApplyConfiguration{} +} + +// WithChecks sets the Checks field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Checks field is set to the value of the last call. +func (b *MachineDeploymentClassHealthCheckApplyConfiguration) WithChecks(value *MachineDeploymentClassHealthCheckChecksApplyConfiguration) *MachineDeploymentClassHealthCheckApplyConfiguration { + b.Checks = value + return b +} + +// WithRemediation sets the Remediation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Remediation field is set to the value of the last call. +func (b *MachineDeploymentClassHealthCheckApplyConfiguration) WithRemediation(value *MachineDeploymentClassHealthCheckRemediationApplyConfiguration) *MachineDeploymentClassHealthCheckApplyConfiguration { + b.Remediation = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedeploymentclasshealthcheckchecks.go b/util/applyconfigurations/core/v1beta2/machinedeploymentclasshealthcheckchecks.go new file mode 100644 index 000000000000..dab524cd4660 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedeploymentclasshealthcheckchecks.go @@ -0,0 +1,71 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachineDeploymentClassHealthCheckChecksApplyConfiguration represents a declarative configuration of the MachineDeploymentClassHealthCheckChecks type for use +// with apply. +// +// MachineDeploymentClassHealthCheckChecks are the checks that are used to evaluate if a MachineDeployment Machine is healthy. +type MachineDeploymentClassHealthCheckChecksApplyConfiguration struct { + // nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck + // to consider a Machine unhealthy if a corresponding Node isn't associated + // through a `Spec.ProviderID` field. + // + // The duration set in this field is compared to the greatest of: + // - Cluster's infrastructure ready condition timestamp (if and when available) + // - Control Plane's initialized condition timestamp (if and when available) + // - Machine's infrastructure ready condition timestamp (if and when available) + // - Machine's metadata creation timestamp + // + // Defaults to 10 minutes. + // If you wish to disable this feature, set the value explicitly to 0. + NodeStartupTimeoutSeconds *int32 `json:"nodeStartupTimeoutSeconds,omitempty"` + // unhealthyNodeConditions contains a list of conditions that determine + // whether a node is considered unhealthy. The conditions are combined in a + // logical OR, i.e. if any of the conditions is met, the node is unhealthy. + UnhealthyNodeConditions []UnhealthyNodeConditionApplyConfiguration `json:"unhealthyNodeConditions,omitempty"` + // unhealthyMachineConditions contains a list of the machine conditions that determine + // whether a machine is considered unhealthy. The conditions are combined in a + // logical OR, i.e. if any of the conditions is met, the machine is unhealthy. + UnhealthyMachineConditions []UnhealthyMachineConditionApplyConfiguration `json:"unhealthyMachineConditions,omitempty"` +} + +// MachineDeploymentClassHealthCheckChecksApplyConfiguration constructs a declarative configuration of the MachineDeploymentClassHealthCheckChecks type for use with +// apply. +func MachineDeploymentClassHealthCheckChecks() *MachineDeploymentClassHealthCheckChecksApplyConfiguration { + return &MachineDeploymentClassHealthCheckChecksApplyConfiguration{} +} + +// WithNodeStartupTimeoutSeconds sets the NodeStartupTimeoutSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeStartupTimeoutSeconds field is set to the value of the last call. +func (b *MachineDeploymentClassHealthCheckChecksApplyConfiguration) WithNodeStartupTimeoutSeconds(value int32) *MachineDeploymentClassHealthCheckChecksApplyConfiguration { + b.NodeStartupTimeoutSeconds = &value + return b +} + +// WithUnhealthyNodeConditions adds the given value to the UnhealthyNodeConditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the UnhealthyNodeConditions field. +func (b *MachineDeploymentClassHealthCheckChecksApplyConfiguration) WithUnhealthyNodeConditions(values ...*UnhealthyNodeConditionApplyConfiguration) *MachineDeploymentClassHealthCheckChecksApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithUnhealthyNodeConditions") + } + b.UnhealthyNodeConditions = append(b.UnhealthyNodeConditions, *values[i]) + } + return b +} + +// WithUnhealthyMachineConditions adds the given value to the UnhealthyMachineConditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the UnhealthyMachineConditions field. +func (b *MachineDeploymentClassHealthCheckChecksApplyConfiguration) WithUnhealthyMachineConditions(values ...*UnhealthyMachineConditionApplyConfiguration) *MachineDeploymentClassHealthCheckChecksApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithUnhealthyMachineConditions") + } + b.UnhealthyMachineConditions = append(b.UnhealthyMachineConditions, *values[i]) + } + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedeploymentclasshealthcheckremediation.go b/util/applyconfigurations/core/v1beta2/machinedeploymentclasshealthcheckremediation.go new file mode 100644 index 000000000000..365d2fabb928 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedeploymentclasshealthcheckremediation.go @@ -0,0 +1,69 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// MachineDeploymentClassHealthCheckRemediationApplyConfiguration represents a declarative configuration of the MachineDeploymentClassHealthCheckRemediation type for use +// with apply. +// +// MachineDeploymentClassHealthCheckRemediation configures if and how remediations are triggered if a MachineDeployment Machine is unhealthy. +type MachineDeploymentClassHealthCheckRemediationApplyConfiguration struct { + // maxInFlight determines how many in flight remediations should happen at the same time. + // + // Remediation only happens on the MachineSet with the most current revision, while + // older MachineSets (usually present during rollout operations) aren't allowed to remediate. + // + // Note: In general (independent of remediations), unhealthy machines are always + // prioritized during scale down operations over healthy ones. + // + // MaxInFlight can be set to a fixed number or a percentage. + // Example: when this is set to 20%, the MachineSet controller deletes at most 20% of + // the desired replicas. + // + // If not set, remediation is limited to all machines (bounded by replicas) + // under the active MachineSet's management. + MaxInFlight *intstr.IntOrString `json:"maxInFlight,omitempty"` + // triggerIf configures if remediations are triggered. + // If this field is not set, remediations are always triggered. + TriggerIf *MachineDeploymentClassHealthCheckRemediationTriggerIfApplyConfiguration `json:"triggerIf,omitempty"` + // templateRef is a reference to a remediation template + // provided by an infrastructure provider. + // + // This field is completely optional, when filled, the MachineHealthCheck controller + // creates a new object from the template referenced and hands off remediation of the machine to + // a controller that lives outside of Cluster API. + TemplateRef *MachineHealthCheckRemediationTemplateReferenceApplyConfiguration `json:"templateRef,omitempty"` +} + +// MachineDeploymentClassHealthCheckRemediationApplyConfiguration constructs a declarative configuration of the MachineDeploymentClassHealthCheckRemediation type for use with +// apply. +func MachineDeploymentClassHealthCheckRemediation() *MachineDeploymentClassHealthCheckRemediationApplyConfiguration { + return &MachineDeploymentClassHealthCheckRemediationApplyConfiguration{} +} + +// WithMaxInFlight sets the MaxInFlight field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxInFlight field is set to the value of the last call. +func (b *MachineDeploymentClassHealthCheckRemediationApplyConfiguration) WithMaxInFlight(value intstr.IntOrString) *MachineDeploymentClassHealthCheckRemediationApplyConfiguration { + b.MaxInFlight = &value + return b +} + +// WithTriggerIf sets the TriggerIf field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TriggerIf field is set to the value of the last call. +func (b *MachineDeploymentClassHealthCheckRemediationApplyConfiguration) WithTriggerIf(value *MachineDeploymentClassHealthCheckRemediationTriggerIfApplyConfiguration) *MachineDeploymentClassHealthCheckRemediationApplyConfiguration { + b.TriggerIf = value + return b +} + +// WithTemplateRef sets the TemplateRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TemplateRef field is set to the value of the last call. +func (b *MachineDeploymentClassHealthCheckRemediationApplyConfiguration) WithTemplateRef(value *MachineHealthCheckRemediationTemplateReferenceApplyConfiguration) *MachineDeploymentClassHealthCheckRemediationApplyConfiguration { + b.TemplateRef = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedeploymentclasshealthcheckremediationtriggerif.go b/util/applyconfigurations/core/v1beta2/machinedeploymentclasshealthcheckremediationtriggerif.go new file mode 100644 index 000000000000..7a78dd1deca0 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedeploymentclasshealthcheckremediationtriggerif.go @@ -0,0 +1,47 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// MachineDeploymentClassHealthCheckRemediationTriggerIfApplyConfiguration represents a declarative configuration of the MachineDeploymentClassHealthCheckRemediationTriggerIf type for use +// with apply. +// +// MachineDeploymentClassHealthCheckRemediationTriggerIf configures if remediations are triggered. +type MachineDeploymentClassHealthCheckRemediationTriggerIfApplyConfiguration struct { + // unhealthyLessThanOrEqualTo specifies that remediations are only triggered if the number of + // unhealthy Machines is less than or equal to the configured value. + // unhealthyInRange takes precedence if set. + UnhealthyLessThanOrEqualTo *intstr.IntOrString `json:"unhealthyLessThanOrEqualTo,omitempty"` + // unhealthyInRange specifies that remediations are only triggered if the number of + // unhealthy Machines is in the configured range. + // Takes precedence over unhealthyLessThanOrEqualTo. + // Eg. "[3-5]" - This means that remediation will be allowed only when: + // (a) there are at least 3 unhealthy Machines (and) + // (b) there are at most 5 unhealthy Machines + UnhealthyInRange *string `json:"unhealthyInRange,omitempty"` +} + +// MachineDeploymentClassHealthCheckRemediationTriggerIfApplyConfiguration constructs a declarative configuration of the MachineDeploymentClassHealthCheckRemediationTriggerIf type for use with +// apply. +func MachineDeploymentClassHealthCheckRemediationTriggerIf() *MachineDeploymentClassHealthCheckRemediationTriggerIfApplyConfiguration { + return &MachineDeploymentClassHealthCheckRemediationTriggerIfApplyConfiguration{} +} + +// WithUnhealthyLessThanOrEqualTo sets the UnhealthyLessThanOrEqualTo field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UnhealthyLessThanOrEqualTo field is set to the value of the last call. +func (b *MachineDeploymentClassHealthCheckRemediationTriggerIfApplyConfiguration) WithUnhealthyLessThanOrEqualTo(value intstr.IntOrString) *MachineDeploymentClassHealthCheckRemediationTriggerIfApplyConfiguration { + b.UnhealthyLessThanOrEqualTo = &value + return b +} + +// WithUnhealthyInRange sets the UnhealthyInRange field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UnhealthyInRange field is set to the value of the last call. +func (b *MachineDeploymentClassHealthCheckRemediationTriggerIfApplyConfiguration) WithUnhealthyInRange(value string) *MachineDeploymentClassHealthCheckRemediationTriggerIfApplyConfiguration { + b.UnhealthyInRange = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedeploymentclassinfrastructuretemplate.go b/util/applyconfigurations/core/v1beta2/machinedeploymentclassinfrastructuretemplate.go new file mode 100644 index 000000000000..988ea4791c55 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedeploymentclassinfrastructuretemplate.go @@ -0,0 +1,26 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachineDeploymentClassInfrastructureTemplateApplyConfiguration represents a declarative configuration of the MachineDeploymentClassInfrastructureTemplate type for use +// with apply. +// +// MachineDeploymentClassInfrastructureTemplate defines the InfrastructureTemplate for a MachineDeployment. +type MachineDeploymentClassInfrastructureTemplateApplyConfiguration struct { + // templateRef is a required reference to the InfrastructureTemplate for a MachineDeployment. + TemplateRef *ClusterClassTemplateReferenceApplyConfiguration `json:"templateRef,omitempty"` +} + +// MachineDeploymentClassInfrastructureTemplateApplyConfiguration constructs a declarative configuration of the MachineDeploymentClassInfrastructureTemplate type for use with +// apply. +func MachineDeploymentClassInfrastructureTemplate() *MachineDeploymentClassInfrastructureTemplateApplyConfiguration { + return &MachineDeploymentClassInfrastructureTemplateApplyConfiguration{} +} + +// WithTemplateRef sets the TemplateRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TemplateRef field is set to the value of the last call. +func (b *MachineDeploymentClassInfrastructureTemplateApplyConfiguration) WithTemplateRef(value *ClusterClassTemplateReferenceApplyConfiguration) *MachineDeploymentClassInfrastructureTemplateApplyConfiguration { + b.TemplateRef = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedeploymentclassmachinedeletionspec.go b/util/applyconfigurations/core/v1beta2/machinedeploymentclassmachinedeletionspec.go new file mode 100644 index 000000000000..23b88cef9f09 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedeploymentclassmachinedeletionspec.go @@ -0,0 +1,69 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + corev1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2" +) + +// MachineDeploymentClassMachineDeletionSpecApplyConfiguration represents a declarative configuration of the MachineDeploymentClassMachineDeletionSpec type for use +// with apply. +// +// MachineDeploymentClassMachineDeletionSpec contains configuration options for Machine deletion. +type MachineDeploymentClassMachineDeletionSpecApplyConfiguration struct { + // order defines the order in which Machines are deleted when downscaling. + // Defaults to "Random". Valid values are "Random, "Newest", "Oldest" + Order *corev1beta2.MachineSetDeletionOrder `json:"order,omitempty"` + // nodeDrainTimeoutSeconds is the total amount of time that the controller will spend on draining a node. + // The default value is 0, meaning that the node can be drained without any time limitations. + // NOTE: nodeDrainTimeoutSeconds is different from `kubectl drain --timeout` + // NOTE: This value can be overridden while defining a Cluster.Topology using this MachineDeploymentClass. + NodeDrainTimeoutSeconds *int32 `json:"nodeDrainTimeoutSeconds,omitempty"` + // nodeVolumeDetachTimeoutSeconds is the total amount of time that the controller will spend on waiting for all volumes + // to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations. + // NOTE: This value can be overridden while defining a Cluster.Topology using this MachineDeploymentClass. + NodeVolumeDetachTimeoutSeconds *int32 `json:"nodeVolumeDetachTimeoutSeconds,omitempty"` + // nodeDeletionTimeoutSeconds defines how long the controller will attempt to delete the Node that the Machine + // hosts after the Machine is marked for deletion. A duration of 0 will retry deletion indefinitely. + // Defaults to 10 seconds. + // NOTE: This value can be overridden while defining a Cluster.Topology using this MachineDeploymentClass. + NodeDeletionTimeoutSeconds *int32 `json:"nodeDeletionTimeoutSeconds,omitempty"` +} + +// MachineDeploymentClassMachineDeletionSpecApplyConfiguration constructs a declarative configuration of the MachineDeploymentClassMachineDeletionSpec type for use with +// apply. +func MachineDeploymentClassMachineDeletionSpec() *MachineDeploymentClassMachineDeletionSpecApplyConfiguration { + return &MachineDeploymentClassMachineDeletionSpecApplyConfiguration{} +} + +// WithOrder sets the Order field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Order field is set to the value of the last call. +func (b *MachineDeploymentClassMachineDeletionSpecApplyConfiguration) WithOrder(value corev1beta2.MachineSetDeletionOrder) *MachineDeploymentClassMachineDeletionSpecApplyConfiguration { + b.Order = &value + return b +} + +// WithNodeDrainTimeoutSeconds sets the NodeDrainTimeoutSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeDrainTimeoutSeconds field is set to the value of the last call. +func (b *MachineDeploymentClassMachineDeletionSpecApplyConfiguration) WithNodeDrainTimeoutSeconds(value int32) *MachineDeploymentClassMachineDeletionSpecApplyConfiguration { + b.NodeDrainTimeoutSeconds = &value + return b +} + +// WithNodeVolumeDetachTimeoutSeconds sets the NodeVolumeDetachTimeoutSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeVolumeDetachTimeoutSeconds field is set to the value of the last call. +func (b *MachineDeploymentClassMachineDeletionSpecApplyConfiguration) WithNodeVolumeDetachTimeoutSeconds(value int32) *MachineDeploymentClassMachineDeletionSpecApplyConfiguration { + b.NodeVolumeDetachTimeoutSeconds = &value + return b +} + +// WithNodeDeletionTimeoutSeconds sets the NodeDeletionTimeoutSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeDeletionTimeoutSeconds field is set to the value of the last call. +func (b *MachineDeploymentClassMachineDeletionSpecApplyConfiguration) WithNodeDeletionTimeoutSeconds(value int32) *MachineDeploymentClassMachineDeletionSpecApplyConfiguration { + b.NodeDeletionTimeoutSeconds = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedeploymentclassnamingspec.go b/util/applyconfigurations/core/v1beta2/machinedeploymentclassnamingspec.go new file mode 100644 index 000000000000..9ab340bf766f --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedeploymentclassnamingspec.go @@ -0,0 +1,33 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachineDeploymentClassNamingSpecApplyConfiguration represents a declarative configuration of the MachineDeploymentClassNamingSpec type for use +// with apply. +// +// MachineDeploymentClassNamingSpec defines the naming strategy for machine deployment objects. +type MachineDeploymentClassNamingSpecApplyConfiguration struct { + // template defines the template to use for generating the name of the MachineDeployment object. + // If not defined, it will fallback to `{{ .cluster.name }}-{{ .machineDeployment.topologyName }}-{{ .random }}`. + // If the templated string exceeds 63 characters, it will be trimmed to 58 characters and will + // get concatenated with a random suffix of length 5. + // The templating mechanism provides the following arguments: + // * `.cluster.name`: The name of the cluster object. + // * `.random`: A random alphanumeric string, without vowels, of length 5. + // * `.machineDeployment.topologyName`: The name of the MachineDeployment topology (Cluster.spec.topology.workers.machineDeployments[].name). + Template *string `json:"template,omitempty"` +} + +// MachineDeploymentClassNamingSpecApplyConfiguration constructs a declarative configuration of the MachineDeploymentClassNamingSpec type for use with +// apply. +func MachineDeploymentClassNamingSpec() *MachineDeploymentClassNamingSpecApplyConfiguration { + return &MachineDeploymentClassNamingSpecApplyConfiguration{} +} + +// WithTemplate sets the Template field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Template field is set to the value of the last call. +func (b *MachineDeploymentClassNamingSpecApplyConfiguration) WithTemplate(value string) *MachineDeploymentClassNamingSpecApplyConfiguration { + b.Template = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedeploymentclassrolloutspec.go b/util/applyconfigurations/core/v1beta2/machinedeploymentclassrolloutspec.go new file mode 100644 index 000000000000..935fd914ecf4 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedeploymentclassrolloutspec.go @@ -0,0 +1,26 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachineDeploymentClassRolloutSpecApplyConfiguration represents a declarative configuration of the MachineDeploymentClassRolloutSpec type for use +// with apply. +// +// MachineDeploymentClassRolloutSpec defines the rollout behavior. +type MachineDeploymentClassRolloutSpecApplyConfiguration struct { + // strategy specifies how to roll out control plane Machines. + Strategy *MachineDeploymentClassRolloutStrategyApplyConfiguration `json:"strategy,omitempty"` +} + +// MachineDeploymentClassRolloutSpecApplyConfiguration constructs a declarative configuration of the MachineDeploymentClassRolloutSpec type for use with +// apply. +func MachineDeploymentClassRolloutSpec() *MachineDeploymentClassRolloutSpecApplyConfiguration { + return &MachineDeploymentClassRolloutSpecApplyConfiguration{} +} + +// WithStrategy sets the Strategy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Strategy field is set to the value of the last call. +func (b *MachineDeploymentClassRolloutSpecApplyConfiguration) WithStrategy(value *MachineDeploymentClassRolloutStrategyApplyConfiguration) *MachineDeploymentClassRolloutSpecApplyConfiguration { + b.Strategy = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedeploymentclassrolloutstrategy.go b/util/applyconfigurations/core/v1beta2/machinedeploymentclassrolloutstrategy.go new file mode 100644 index 000000000000..00cfd4208632 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedeploymentclassrolloutstrategy.go @@ -0,0 +1,43 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + corev1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2" +) + +// MachineDeploymentClassRolloutStrategyApplyConfiguration represents a declarative configuration of the MachineDeploymentClassRolloutStrategy type for use +// with apply. +// +// MachineDeploymentClassRolloutStrategy describes how to replace existing machines +// with new ones. +type MachineDeploymentClassRolloutStrategyApplyConfiguration struct { + // type of rollout. Allowed values are RollingUpdate and OnDelete. + // Default is RollingUpdate. + Type *corev1beta2.MachineDeploymentRolloutStrategyType `json:"type,omitempty"` + // rollingUpdate is the rolling update config params. Present only if + // type = RollingUpdate. + RollingUpdate *MachineDeploymentClassRolloutStrategyRollingUpdateApplyConfiguration `json:"rollingUpdate,omitempty"` +} + +// MachineDeploymentClassRolloutStrategyApplyConfiguration constructs a declarative configuration of the MachineDeploymentClassRolloutStrategy type for use with +// apply. +func MachineDeploymentClassRolloutStrategy() *MachineDeploymentClassRolloutStrategyApplyConfiguration { + return &MachineDeploymentClassRolloutStrategyApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *MachineDeploymentClassRolloutStrategyApplyConfiguration) WithType(value corev1beta2.MachineDeploymentRolloutStrategyType) *MachineDeploymentClassRolloutStrategyApplyConfiguration { + b.Type = &value + return b +} + +// WithRollingUpdate sets the RollingUpdate field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RollingUpdate field is set to the value of the last call. +func (b *MachineDeploymentClassRolloutStrategyApplyConfiguration) WithRollingUpdate(value *MachineDeploymentClassRolloutStrategyRollingUpdateApplyConfiguration) *MachineDeploymentClassRolloutStrategyApplyConfiguration { + b.RollingUpdate = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedeploymentclassrolloutstrategyrollingupdate.go b/util/applyconfigurations/core/v1beta2/machinedeploymentclassrolloutstrategyrollingupdate.go new file mode 100644 index 000000000000..2e6436517a47 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedeploymentclassrolloutstrategyrollingupdate.go @@ -0,0 +1,63 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// MachineDeploymentClassRolloutStrategyRollingUpdateApplyConfiguration represents a declarative configuration of the MachineDeploymentClassRolloutStrategyRollingUpdate type for use +// with apply. +// +// MachineDeploymentClassRolloutStrategyRollingUpdate is used to control the desired behavior of rolling update. +type MachineDeploymentClassRolloutStrategyRollingUpdateApplyConfiguration struct { + // maxUnavailable is the maximum number of machines that can be unavailable during the update. + // Value can be an absolute number (ex: 5) or a percentage of desired + // machines (ex: 10%). + // Absolute number is calculated from percentage by rounding down. + // This can not be 0 if MaxSurge is 0. + // Defaults to 0. + // Example: when this is set to 30%, the old MachineSet can be scaled + // down to 70% of desired machines immediately when the rolling update + // starts. Once new machines are ready, old MachineSet can be scaled + // down further, followed by scaling up the new MachineSet, ensuring + // that the total number of machines available at all times + // during the update is at least 70% of desired machines. + MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"` + // maxSurge is the maximum number of machines that can be scheduled above the + // desired number of machines. + // Value can be an absolute number (ex: 5) or a percentage of + // desired machines (ex: 10%). + // This can not be 0 if MaxUnavailable is 0. + // Absolute number is calculated from percentage by rounding up. + // Defaults to 1. + // Example: when this is set to 30%, the new MachineSet can be scaled + // up immediately when the rolling update starts, such that the total + // number of old and new machines do not exceed 130% of desired + // machines. Once old machines have been killed, new MachineSet can + // be scaled up further, ensuring that total number of machines running + // at any time during the update is at most 130% of desired machines. + MaxSurge *intstr.IntOrString `json:"maxSurge,omitempty"` +} + +// MachineDeploymentClassRolloutStrategyRollingUpdateApplyConfiguration constructs a declarative configuration of the MachineDeploymentClassRolloutStrategyRollingUpdate type for use with +// apply. +func MachineDeploymentClassRolloutStrategyRollingUpdate() *MachineDeploymentClassRolloutStrategyRollingUpdateApplyConfiguration { + return &MachineDeploymentClassRolloutStrategyRollingUpdateApplyConfiguration{} +} + +// WithMaxUnavailable sets the MaxUnavailable field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxUnavailable field is set to the value of the last call. +func (b *MachineDeploymentClassRolloutStrategyRollingUpdateApplyConfiguration) WithMaxUnavailable(value intstr.IntOrString) *MachineDeploymentClassRolloutStrategyRollingUpdateApplyConfiguration { + b.MaxUnavailable = &value + return b +} + +// WithMaxSurge sets the MaxSurge field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxSurge field is set to the value of the last call. +func (b *MachineDeploymentClassRolloutStrategyRollingUpdateApplyConfiguration) WithMaxSurge(value intstr.IntOrString) *MachineDeploymentClassRolloutStrategyRollingUpdateApplyConfiguration { + b.MaxSurge = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedeploymentdeletionspec.go b/util/applyconfigurations/core/v1beta2/machinedeploymentdeletionspec.go new file mode 100644 index 000000000000..fbc4917771c8 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedeploymentdeletionspec.go @@ -0,0 +1,31 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + corev1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2" +) + +// MachineDeploymentDeletionSpecApplyConfiguration represents a declarative configuration of the MachineDeploymentDeletionSpec type for use +// with apply. +// +// MachineDeploymentDeletionSpec contains configuration options for MachineDeployment deletion. +type MachineDeploymentDeletionSpecApplyConfiguration struct { + // order defines the order in which Machines are deleted when downscaling. + // Defaults to "Random". Valid values are "Random, "Newest", "Oldest" + Order *corev1beta2.MachineSetDeletionOrder `json:"order,omitempty"` +} + +// MachineDeploymentDeletionSpecApplyConfiguration constructs a declarative configuration of the MachineDeploymentDeletionSpec type for use with +// apply. +func MachineDeploymentDeletionSpec() *MachineDeploymentDeletionSpecApplyConfiguration { + return &MachineDeploymentDeletionSpecApplyConfiguration{} +} + +// WithOrder sets the Order field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Order field is set to the value of the last call. +func (b *MachineDeploymentDeletionSpecApplyConfiguration) WithOrder(value corev1beta2.MachineSetDeletionOrder) *MachineDeploymentDeletionSpecApplyConfiguration { + b.Order = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedeploymentdeprecatedstatus.go b/util/applyconfigurations/core/v1beta2/machinedeploymentdeprecatedstatus.go new file mode 100644 index 000000000000..2636d515e0fd --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedeploymentdeprecatedstatus.go @@ -0,0 +1,27 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachineDeploymentDeprecatedStatusApplyConfiguration represents a declarative configuration of the MachineDeploymentDeprecatedStatus type for use +// with apply. +// +// MachineDeploymentDeprecatedStatus groups all the status fields that are deprecated and will be removed in a future version. +// See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context. +type MachineDeploymentDeprecatedStatusApplyConfiguration struct { + // v1beta1 groups all the status fields that are deprecated and will be removed when support for v1beta1 will be dropped. + V1Beta1 *MachineDeploymentV1Beta1DeprecatedStatusApplyConfiguration `json:"v1beta1,omitempty"` +} + +// MachineDeploymentDeprecatedStatusApplyConfiguration constructs a declarative configuration of the MachineDeploymentDeprecatedStatus type for use with +// apply. +func MachineDeploymentDeprecatedStatus() *MachineDeploymentDeprecatedStatusApplyConfiguration { + return &MachineDeploymentDeprecatedStatusApplyConfiguration{} +} + +// WithV1Beta1 sets the V1Beta1 field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the V1Beta1 field is set to the value of the last call. +func (b *MachineDeploymentDeprecatedStatusApplyConfiguration) WithV1Beta1(value *MachineDeploymentV1Beta1DeprecatedStatusApplyConfiguration) *MachineDeploymentDeprecatedStatusApplyConfiguration { + b.V1Beta1 = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedeploymentremediationspec.go b/util/applyconfigurations/core/v1beta2/machinedeploymentremediationspec.go new file mode 100644 index 000000000000..fe34c6313220 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedeploymentremediationspec.go @@ -0,0 +1,43 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// MachineDeploymentRemediationSpecApplyConfiguration represents a declarative configuration of the MachineDeploymentRemediationSpec type for use +// with apply. +// +// MachineDeploymentRemediationSpec controls how unhealthy Machines are remediated. +type MachineDeploymentRemediationSpecApplyConfiguration struct { + // maxInFlight determines how many in flight remediations should happen at the same time. + // + // Remediation only happens on the MachineSet with the most current revision, while + // older MachineSets (usually present during rollout operations) aren't allowed to remediate. + // + // Note: In general (independent of remediations), unhealthy machines are always + // prioritized during scale down operations over healthy ones. + // + // MaxInFlight can be set to a fixed number or a percentage. + // Example: when this is set to 20%, the MachineSet controller deletes at most 20% of + // the desired replicas. + // + // If not set, remediation is limited to all machines (bounded by replicas) + // under the active MachineSet's management. + MaxInFlight *intstr.IntOrString `json:"maxInFlight,omitempty"` +} + +// MachineDeploymentRemediationSpecApplyConfiguration constructs a declarative configuration of the MachineDeploymentRemediationSpec type for use with +// apply. +func MachineDeploymentRemediationSpec() *MachineDeploymentRemediationSpecApplyConfiguration { + return &MachineDeploymentRemediationSpecApplyConfiguration{} +} + +// WithMaxInFlight sets the MaxInFlight field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxInFlight field is set to the value of the last call. +func (b *MachineDeploymentRemediationSpecApplyConfiguration) WithMaxInFlight(value intstr.IntOrString) *MachineDeploymentRemediationSpecApplyConfiguration { + b.MaxInFlight = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedeploymentrolloutspec.go b/util/applyconfigurations/core/v1beta2/machinedeploymentrolloutspec.go new file mode 100644 index 000000000000..d0e56f491440 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedeploymentrolloutspec.go @@ -0,0 +1,45 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// MachineDeploymentRolloutSpecApplyConfiguration represents a declarative configuration of the MachineDeploymentRolloutSpec type for use +// with apply. +// +// MachineDeploymentRolloutSpec defines the rollout behavior. +type MachineDeploymentRolloutSpecApplyConfiguration struct { + // after is a field to indicate a rollout should be performed + // after the specified time even if no changes have been made to the + // MachineDeployment. + // Example: In the YAML the time can be specified in the RFC3339 format. + // To specify the rolloutAfter target as March 9, 2023, at 9 am UTC + // use "2023-03-09T09:00:00Z". + After *v1.Time `json:"after,omitempty"` + // strategy specifies how to roll out control plane Machines. + Strategy *MachineDeploymentRolloutStrategyApplyConfiguration `json:"strategy,omitempty"` +} + +// MachineDeploymentRolloutSpecApplyConfiguration constructs a declarative configuration of the MachineDeploymentRolloutSpec type for use with +// apply. +func MachineDeploymentRolloutSpec() *MachineDeploymentRolloutSpecApplyConfiguration { + return &MachineDeploymentRolloutSpecApplyConfiguration{} +} + +// WithAfter sets the After field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the After field is set to the value of the last call. +func (b *MachineDeploymentRolloutSpecApplyConfiguration) WithAfter(value v1.Time) *MachineDeploymentRolloutSpecApplyConfiguration { + b.After = &value + return b +} + +// WithStrategy sets the Strategy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Strategy field is set to the value of the last call. +func (b *MachineDeploymentRolloutSpecApplyConfiguration) WithStrategy(value *MachineDeploymentRolloutStrategyApplyConfiguration) *MachineDeploymentRolloutSpecApplyConfiguration { + b.Strategy = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedeploymentrolloutstrategy.go b/util/applyconfigurations/core/v1beta2/machinedeploymentrolloutstrategy.go new file mode 100644 index 000000000000..5912ccbdbf28 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedeploymentrolloutstrategy.go @@ -0,0 +1,43 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + corev1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2" +) + +// MachineDeploymentRolloutStrategyApplyConfiguration represents a declarative configuration of the MachineDeploymentRolloutStrategy type for use +// with apply. +// +// MachineDeploymentRolloutStrategy describes how to replace existing machines +// with new ones. +type MachineDeploymentRolloutStrategyApplyConfiguration struct { + // type of rollout. Allowed values are RollingUpdate and OnDelete. + // Default is RollingUpdate. + Type *corev1beta2.MachineDeploymentRolloutStrategyType `json:"type,omitempty"` + // rollingUpdate is the rolling update config params. Present only if + // type = RollingUpdate. + RollingUpdate *MachineDeploymentRolloutStrategyRollingUpdateApplyConfiguration `json:"rollingUpdate,omitempty"` +} + +// MachineDeploymentRolloutStrategyApplyConfiguration constructs a declarative configuration of the MachineDeploymentRolloutStrategy type for use with +// apply. +func MachineDeploymentRolloutStrategy() *MachineDeploymentRolloutStrategyApplyConfiguration { + return &MachineDeploymentRolloutStrategyApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *MachineDeploymentRolloutStrategyApplyConfiguration) WithType(value corev1beta2.MachineDeploymentRolloutStrategyType) *MachineDeploymentRolloutStrategyApplyConfiguration { + b.Type = &value + return b +} + +// WithRollingUpdate sets the RollingUpdate field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RollingUpdate field is set to the value of the last call. +func (b *MachineDeploymentRolloutStrategyApplyConfiguration) WithRollingUpdate(value *MachineDeploymentRolloutStrategyRollingUpdateApplyConfiguration) *MachineDeploymentRolloutStrategyApplyConfiguration { + b.RollingUpdate = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedeploymentrolloutstrategyrollingupdate.go b/util/applyconfigurations/core/v1beta2/machinedeploymentrolloutstrategyrollingupdate.go new file mode 100644 index 000000000000..b6734bd41bce --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedeploymentrolloutstrategyrollingupdate.go @@ -0,0 +1,63 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// MachineDeploymentRolloutStrategyRollingUpdateApplyConfiguration represents a declarative configuration of the MachineDeploymentRolloutStrategyRollingUpdate type for use +// with apply. +// +// MachineDeploymentRolloutStrategyRollingUpdate is used to control the desired behavior of rolling update. +type MachineDeploymentRolloutStrategyRollingUpdateApplyConfiguration struct { + // maxUnavailable is the maximum number of machines that can be unavailable during the update. + // Value can be an absolute number (ex: 5) or a percentage of desired + // machines (ex: 10%). + // Absolute number is calculated from percentage by rounding down. + // This can not be 0 if MaxSurge is 0. + // Defaults to 0. + // Example: when this is set to 30%, the old MachineSet can be scaled + // down to 70% of desired machines immediately when the rolling update + // starts. Once new machines are ready, old MachineSet can be scaled + // down further, followed by scaling up the new MachineSet, ensuring + // that the total number of machines available at all times + // during the update is at least 70% of desired machines. + MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"` + // maxSurge is the maximum number of machines that can be scheduled above the + // desired number of machines. + // Value can be an absolute number (ex: 5) or a percentage of + // desired machines (ex: 10%). + // This can not be 0 if MaxUnavailable is 0. + // Absolute number is calculated from percentage by rounding up. + // Defaults to 1. + // Example: when this is set to 30%, the new MachineSet can be scaled + // up immediately when the rolling update starts, such that the total + // number of old and new machines do not exceed 130% of desired + // machines. Once old machines have been killed, new MachineSet can + // be scaled up further, ensuring that total number of machines running + // at any time during the update is at most 130% of desired machines. + MaxSurge *intstr.IntOrString `json:"maxSurge,omitempty"` +} + +// MachineDeploymentRolloutStrategyRollingUpdateApplyConfiguration constructs a declarative configuration of the MachineDeploymentRolloutStrategyRollingUpdate type for use with +// apply. +func MachineDeploymentRolloutStrategyRollingUpdate() *MachineDeploymentRolloutStrategyRollingUpdateApplyConfiguration { + return &MachineDeploymentRolloutStrategyRollingUpdateApplyConfiguration{} +} + +// WithMaxUnavailable sets the MaxUnavailable field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxUnavailable field is set to the value of the last call. +func (b *MachineDeploymentRolloutStrategyRollingUpdateApplyConfiguration) WithMaxUnavailable(value intstr.IntOrString) *MachineDeploymentRolloutStrategyRollingUpdateApplyConfiguration { + b.MaxUnavailable = &value + return b +} + +// WithMaxSurge sets the MaxSurge field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxSurge field is set to the value of the last call. +func (b *MachineDeploymentRolloutStrategyRollingUpdateApplyConfiguration) WithMaxSurge(value intstr.IntOrString) *MachineDeploymentRolloutStrategyRollingUpdateApplyConfiguration { + b.MaxSurge = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedeploymentspec.go b/util/applyconfigurations/core/v1beta2/machinedeploymentspec.go new file mode 100644 index 000000000000..6dafb4142153 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedeploymentspec.go @@ -0,0 +1,131 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// MachineDeploymentSpecApplyConfiguration represents a declarative configuration of the MachineDeploymentSpec type for use +// with apply. +// +// MachineDeploymentSpec defines the desired state of MachineDeployment. +type MachineDeploymentSpecApplyConfiguration struct { + // clusterName is the name of the Cluster this object belongs to. + ClusterName *string `json:"clusterName,omitempty"` + // replicas is the number of desired machines. + // This is a pointer to distinguish between explicit zero and not specified. + // + // Defaults to: + // * if the Kubernetes autoscaler min size and max size annotations are set: + // - if it's a new MachineDeployment, use min size + // - if the replicas field of the old MachineDeployment is < min size, use min size + // - if the replicas field of the old MachineDeployment is > max size, use max size + // - if the replicas field of the old MachineDeployment is in the (min size, max size) range, keep the value from the oldMD + // * otherwise use 1 + // Note: Defaulting will be run whenever the replicas field is not set: + // * A new MachineDeployment is created with replicas not set. + // * On an existing MachineDeployment the replicas field was first set and is now unset. + // Those cases are especially relevant for the following Kubernetes autoscaler use cases: + // * A new MachineDeployment is created and replicas should be managed by the autoscaler + // * An existing MachineDeployment which initially wasn't controlled by the autoscaler + // should be later controlled by the autoscaler + Replicas *int32 `json:"replicas,omitempty"` + // rollout allows you to configure the behaviour of rolling updates to the MachineDeployment Machines. + // It allows you to require that all Machines are replaced after a certain time, + // and allows you to define the strategy used during rolling replacements. + Rollout *MachineDeploymentRolloutSpecApplyConfiguration `json:"rollout,omitempty"` + // selector is the label selector for machines. Existing MachineSets whose machines are + // selected by this will be the ones affected by this deployment. + // It must match the machine template's labels. + Selector *v1.LabelSelectorApplyConfiguration `json:"selector,omitempty"` + // template describes the machines that will be created. + Template *MachineTemplateSpecApplyConfiguration `json:"template,omitempty"` + // machineNaming allows changing the naming pattern used when creating Machines. + // Note: InfraMachines & BootstrapConfigs will use the same name as the corresponding Machines. + MachineNaming *MachineNamingSpecApplyConfiguration `json:"machineNaming,omitempty"` + // remediation controls how unhealthy Machines are remediated. + Remediation *MachineDeploymentRemediationSpecApplyConfiguration `json:"remediation,omitempty"` + // deletion contains configuration options for MachineDeployment deletion. + Deletion *MachineDeploymentDeletionSpecApplyConfiguration `json:"deletion,omitempty"` + // paused indicates that the deployment is paused. + Paused *bool `json:"paused,omitempty"` +} + +// MachineDeploymentSpecApplyConfiguration constructs a declarative configuration of the MachineDeploymentSpec type for use with +// apply. +func MachineDeploymentSpec() *MachineDeploymentSpecApplyConfiguration { + return &MachineDeploymentSpecApplyConfiguration{} +} + +// WithClusterName sets the ClusterName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ClusterName field is set to the value of the last call. +func (b *MachineDeploymentSpecApplyConfiguration) WithClusterName(value string) *MachineDeploymentSpecApplyConfiguration { + b.ClusterName = &value + return b +} + +// WithReplicas sets the Replicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Replicas field is set to the value of the last call. +func (b *MachineDeploymentSpecApplyConfiguration) WithReplicas(value int32) *MachineDeploymentSpecApplyConfiguration { + b.Replicas = &value + return b +} + +// WithRollout sets the Rollout field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Rollout field is set to the value of the last call. +func (b *MachineDeploymentSpecApplyConfiguration) WithRollout(value *MachineDeploymentRolloutSpecApplyConfiguration) *MachineDeploymentSpecApplyConfiguration { + b.Rollout = value + return b +} + +// WithSelector sets the Selector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Selector field is set to the value of the last call. +func (b *MachineDeploymentSpecApplyConfiguration) WithSelector(value *v1.LabelSelectorApplyConfiguration) *MachineDeploymentSpecApplyConfiguration { + b.Selector = value + return b +} + +// WithTemplate sets the Template field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Template field is set to the value of the last call. +func (b *MachineDeploymentSpecApplyConfiguration) WithTemplate(value *MachineTemplateSpecApplyConfiguration) *MachineDeploymentSpecApplyConfiguration { + b.Template = value + return b +} + +// WithMachineNaming sets the MachineNaming field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MachineNaming field is set to the value of the last call. +func (b *MachineDeploymentSpecApplyConfiguration) WithMachineNaming(value *MachineNamingSpecApplyConfiguration) *MachineDeploymentSpecApplyConfiguration { + b.MachineNaming = value + return b +} + +// WithRemediation sets the Remediation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Remediation field is set to the value of the last call. +func (b *MachineDeploymentSpecApplyConfiguration) WithRemediation(value *MachineDeploymentRemediationSpecApplyConfiguration) *MachineDeploymentSpecApplyConfiguration { + b.Remediation = value + return b +} + +// WithDeletion sets the Deletion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Deletion field is set to the value of the last call. +func (b *MachineDeploymentSpecApplyConfiguration) WithDeletion(value *MachineDeploymentDeletionSpecApplyConfiguration) *MachineDeploymentSpecApplyConfiguration { + b.Deletion = value + return b +} + +// WithPaused sets the Paused field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Paused field is set to the value of the last call. +func (b *MachineDeploymentSpecApplyConfiguration) WithPaused(value bool) *MachineDeploymentSpecApplyConfiguration { + b.Paused = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedeploymentstatus.go b/util/applyconfigurations/core/v1beta2/machinedeploymentstatus.go new file mode 100644 index 000000000000..2fb2affd878f --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedeploymentstatus.go @@ -0,0 +1,119 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// MachineDeploymentStatusApplyConfiguration represents a declarative configuration of the MachineDeploymentStatus type for use +// with apply. +// +// MachineDeploymentStatus defines the observed state of MachineDeployment. +type MachineDeploymentStatusApplyConfiguration struct { + // conditions represents the observations of a MachineDeployment's current state. + // Known condition types are Available, MachinesReady, MachinesUpToDate, ScalingUp, ScalingDown, Remediating, Deleting, Paused. + Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"` + // observedGeneration is the generation observed by the deployment controller. + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` + // selector is the same as the label selector but in the string format to avoid introspection + // by clients. The string will be in the same format as the query-param syntax. + // More info about label selectors: http://kubernetes.io/docs/user-guide/labels#label-selectors + Selector *string `json:"selector,omitempty"` + // replicas is the total number of non-terminated machines targeted by this deployment + // (their labels match the selector). + Replicas *int32 `json:"replicas,omitempty"` + // readyReplicas is the number of ready replicas for this MachineDeployment. A machine is considered ready when Machine's Ready condition is true. + ReadyReplicas *int32 `json:"readyReplicas,omitempty"` + // availableReplicas is the number of available replicas for this MachineDeployment. A machine is considered available when Machine's Available condition is true. + AvailableReplicas *int32 `json:"availableReplicas,omitempty"` + // upToDateReplicas is the number of up-to-date replicas targeted by this deployment. A machine is considered up-to-date when Machine's UpToDate condition is true. + UpToDateReplicas *int32 `json:"upToDateReplicas,omitempty"` + // phase represents the current phase of a MachineDeployment (ScalingUp, ScalingDown, Running, Failed, or Unknown). + Phase *string `json:"phase,omitempty"` + // deprecated groups all the status fields that are deprecated and will be removed when all the nested field are removed. + Deprecated *MachineDeploymentDeprecatedStatusApplyConfiguration `json:"deprecated,omitempty"` +} + +// MachineDeploymentStatusApplyConfiguration constructs a declarative configuration of the MachineDeploymentStatus type for use with +// apply. +func MachineDeploymentStatus() *MachineDeploymentStatusApplyConfiguration { + return &MachineDeploymentStatusApplyConfiguration{} +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *MachineDeploymentStatusApplyConfiguration) WithConditions(values ...*v1.ConditionApplyConfiguration) *MachineDeploymentStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithObservedGeneration sets the ObservedGeneration field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ObservedGeneration field is set to the value of the last call. +func (b *MachineDeploymentStatusApplyConfiguration) WithObservedGeneration(value int64) *MachineDeploymentStatusApplyConfiguration { + b.ObservedGeneration = &value + return b +} + +// WithSelector sets the Selector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Selector field is set to the value of the last call. +func (b *MachineDeploymentStatusApplyConfiguration) WithSelector(value string) *MachineDeploymentStatusApplyConfiguration { + b.Selector = &value + return b +} + +// WithReplicas sets the Replicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Replicas field is set to the value of the last call. +func (b *MachineDeploymentStatusApplyConfiguration) WithReplicas(value int32) *MachineDeploymentStatusApplyConfiguration { + b.Replicas = &value + return b +} + +// WithReadyReplicas sets the ReadyReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadyReplicas field is set to the value of the last call. +func (b *MachineDeploymentStatusApplyConfiguration) WithReadyReplicas(value int32) *MachineDeploymentStatusApplyConfiguration { + b.ReadyReplicas = &value + return b +} + +// WithAvailableReplicas sets the AvailableReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AvailableReplicas field is set to the value of the last call. +func (b *MachineDeploymentStatusApplyConfiguration) WithAvailableReplicas(value int32) *MachineDeploymentStatusApplyConfiguration { + b.AvailableReplicas = &value + return b +} + +// WithUpToDateReplicas sets the UpToDateReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UpToDateReplicas field is set to the value of the last call. +func (b *MachineDeploymentStatusApplyConfiguration) WithUpToDateReplicas(value int32) *MachineDeploymentStatusApplyConfiguration { + b.UpToDateReplicas = &value + return b +} + +// WithPhase sets the Phase field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Phase field is set to the value of the last call. +func (b *MachineDeploymentStatusApplyConfiguration) WithPhase(value string) *MachineDeploymentStatusApplyConfiguration { + b.Phase = &value + return b +} + +// WithDeprecated sets the Deprecated field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Deprecated field is set to the value of the last call. +func (b *MachineDeploymentStatusApplyConfiguration) WithDeprecated(value *MachineDeploymentDeprecatedStatusApplyConfiguration) *MachineDeploymentStatusApplyConfiguration { + b.Deprecated = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedeploymenttopology.go b/util/applyconfigurations/core/v1beta2/machinedeploymenttopology.go new file mode 100644 index 000000000000..5bbe49432815 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedeploymenttopology.go @@ -0,0 +1,152 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachineDeploymentTopologyApplyConfiguration represents a declarative configuration of the MachineDeploymentTopology type for use +// with apply. +// +// MachineDeploymentTopology specifies the different parameters for a set of worker nodes in the topology. +// This set of nodes is managed by a MachineDeployment object whose lifecycle is managed by the Cluster controller. +type MachineDeploymentTopologyApplyConfiguration struct { + // metadata is the metadata applied to the MachineDeployment and the machines of the MachineDeployment. + // At runtime this metadata is merged with the corresponding metadata from the ClusterClass. + Metadata *ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + // class is the name of the MachineDeploymentClass used to create the set of worker nodes. + // This should match one of the deployment classes defined in the ClusterClass object + // mentioned in the `Cluster.Spec.Class` field. + Class *string `json:"class,omitempty"` + // name is the unique identifier for this MachineDeploymentTopology. + // The value is used with other unique identifiers to create a MachineDeployment's Name + // (e.g. cluster's name, etc). In case the name is greater than the allowed maximum length, + // the values are hashed together. + Name *string `json:"name,omitempty"` + // failureDomain is the failure domain the machines will be created in. + // Must match a key in the FailureDomains map stored on the cluster object. + FailureDomain *string `json:"failureDomain,omitempty"` + // replicas is the number of worker nodes belonging to this set. + // If the value is nil, the MachineDeployment is created without the number of Replicas (defaulting to 1) + // and it's assumed that an external entity (like cluster autoscaler) is responsible for the management + // of this value. + Replicas *int32 `json:"replicas,omitempty"` + // healthCheck allows to enable, disable and override MachineDeployment health check + // configuration from the ClusterClass for this MachineDeployment. + HealthCheck *MachineDeploymentTopologyHealthCheckApplyConfiguration `json:"healthCheck,omitempty"` + // deletion contains configuration options for Machine deletion. + Deletion *MachineDeploymentTopologyMachineDeletionSpecApplyConfiguration `json:"deletion,omitempty"` + // minReadySeconds is the minimum number of seconds for which a newly created machine should + // be ready. + // Defaults to 0 (machine will be considered available as soon as it + // is ready) + MinReadySeconds *int32 `json:"minReadySeconds,omitempty"` + // readinessGates specifies additional conditions to include when evaluating Machine Ready condition. + // + // This field can be used e.g. to instruct the machine controller to include in the computation for Machine's ready + // computation a condition, managed by an external controllers, reporting the status of special software/hardware installed on the Machine. + // + // If this field is not defined, readinessGates from the corresponding MachineDeploymentClass will be used, if any. + ReadinessGates []MachineReadinessGateApplyConfiguration `json:"readinessGates,omitempty"` + // rollout allows you to configure the behaviour of rolling updates to the MachineDeployment Machines. + // It allows you to define the strategy used during rolling replacements. + Rollout *MachineDeploymentTopologyRolloutSpecApplyConfiguration `json:"rollout,omitempty"` + // variables can be used to customize the MachineDeployment through patches. + Variables *MachineDeploymentVariablesApplyConfiguration `json:"variables,omitempty"` +} + +// MachineDeploymentTopologyApplyConfiguration constructs a declarative configuration of the MachineDeploymentTopology type for use with +// apply. +func MachineDeploymentTopology() *MachineDeploymentTopologyApplyConfiguration { + return &MachineDeploymentTopologyApplyConfiguration{} +} + +// WithMetadata sets the Metadata field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Metadata field is set to the value of the last call. +func (b *MachineDeploymentTopologyApplyConfiguration) WithMetadata(value *ObjectMetaApplyConfiguration) *MachineDeploymentTopologyApplyConfiguration { + b.Metadata = value + return b +} + +// WithClass sets the Class field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Class field is set to the value of the last call. +func (b *MachineDeploymentTopologyApplyConfiguration) WithClass(value string) *MachineDeploymentTopologyApplyConfiguration { + b.Class = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *MachineDeploymentTopologyApplyConfiguration) WithName(value string) *MachineDeploymentTopologyApplyConfiguration { + b.Name = &value + return b +} + +// WithFailureDomain sets the FailureDomain field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FailureDomain field is set to the value of the last call. +func (b *MachineDeploymentTopologyApplyConfiguration) WithFailureDomain(value string) *MachineDeploymentTopologyApplyConfiguration { + b.FailureDomain = &value + return b +} + +// WithReplicas sets the Replicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Replicas field is set to the value of the last call. +func (b *MachineDeploymentTopologyApplyConfiguration) WithReplicas(value int32) *MachineDeploymentTopologyApplyConfiguration { + b.Replicas = &value + return b +} + +// WithHealthCheck sets the HealthCheck field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the HealthCheck field is set to the value of the last call. +func (b *MachineDeploymentTopologyApplyConfiguration) WithHealthCheck(value *MachineDeploymentTopologyHealthCheckApplyConfiguration) *MachineDeploymentTopologyApplyConfiguration { + b.HealthCheck = value + return b +} + +// WithDeletion sets the Deletion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Deletion field is set to the value of the last call. +func (b *MachineDeploymentTopologyApplyConfiguration) WithDeletion(value *MachineDeploymentTopologyMachineDeletionSpecApplyConfiguration) *MachineDeploymentTopologyApplyConfiguration { + b.Deletion = value + return b +} + +// WithMinReadySeconds sets the MinReadySeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinReadySeconds field is set to the value of the last call. +func (b *MachineDeploymentTopologyApplyConfiguration) WithMinReadySeconds(value int32) *MachineDeploymentTopologyApplyConfiguration { + b.MinReadySeconds = &value + return b +} + +// WithReadinessGates adds the given value to the ReadinessGates field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ReadinessGates field. +func (b *MachineDeploymentTopologyApplyConfiguration) WithReadinessGates(values ...*MachineReadinessGateApplyConfiguration) *MachineDeploymentTopologyApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithReadinessGates") + } + b.ReadinessGates = append(b.ReadinessGates, *values[i]) + } + return b +} + +// WithRollout sets the Rollout field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Rollout field is set to the value of the last call. +func (b *MachineDeploymentTopologyApplyConfiguration) WithRollout(value *MachineDeploymentTopologyRolloutSpecApplyConfiguration) *MachineDeploymentTopologyApplyConfiguration { + b.Rollout = value + return b +} + +// WithVariables sets the Variables field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Variables field is set to the value of the last call. +func (b *MachineDeploymentTopologyApplyConfiguration) WithVariables(value *MachineDeploymentVariablesApplyConfiguration) *MachineDeploymentTopologyApplyConfiguration { + b.Variables = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedeploymenttopologyhealthcheck.go b/util/applyconfigurations/core/v1beta2/machinedeploymenttopologyhealthcheck.go new file mode 100644 index 000000000000..7e054ce2739f --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedeploymenttopologyhealthcheck.go @@ -0,0 +1,76 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachineDeploymentTopologyHealthCheckApplyConfiguration represents a declarative configuration of the MachineDeploymentTopologyHealthCheck type for use +// with apply. +// +// MachineDeploymentTopologyHealthCheck defines a MachineHealthCheck for MachineDeployment machines. +type MachineDeploymentTopologyHealthCheckApplyConfiguration struct { + // enabled controls if a MachineHealthCheck should be created for the target machines. + // + // If false: No MachineHealthCheck will be created. + // + // If not set(default): A MachineHealthCheck will be created if it is defined here or + // in the associated ClusterClass. If no MachineHealthCheck is defined then none will be created. + // + // If true: A MachineHealthCheck is guaranteed to be created. Cluster validation will + // block if `enable` is true and no MachineHealthCheck definition is available. + Enabled *bool `json:"enabled,omitempty"` + // checks are the checks that are used to evaluate if a Machine is healthy. + // + // If one of checks and remediation fields are set, the system assumes that an healthCheck override is defined, + // and as a consequence the checks and remediation fields from Cluster will be used instead of the + // corresponding fields in ClusterClass. + // + // Independent of this configuration the MachineHealthCheck controller will always + // flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and + // Machines with deleted Nodes as unhealthy. + // + // Furthermore, if checks.nodeStartupTimeoutSeconds is not set it + // is defaulted to 10 minutes and evaluated accordingly. + Checks *MachineDeploymentTopologyHealthCheckChecksApplyConfiguration `json:"checks,omitempty"` + // remediation configures if and how remediations are triggered if a Machine is unhealthy. + // + // If one of checks and remediation fields are set, the system assumes that an healthCheck override is defined, + // and as a consequence the checks and remediation fields from cluster will be used instead of the + // corresponding fields in ClusterClass. + // + // If an health check override is defined and remediation or remediation.triggerIf is not set, + // remediation will always be triggered for unhealthy Machines. + // + // If an health check override is defined and remediation or remediation.templateRef is not set, + // the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via + // the owner of the Machines, for example a MachineSet or a KubeadmControlPlane. + Remediation *MachineDeploymentTopologyHealthCheckRemediationApplyConfiguration `json:"remediation,omitempty"` +} + +// MachineDeploymentTopologyHealthCheckApplyConfiguration constructs a declarative configuration of the MachineDeploymentTopologyHealthCheck type for use with +// apply. +func MachineDeploymentTopologyHealthCheck() *MachineDeploymentTopologyHealthCheckApplyConfiguration { + return &MachineDeploymentTopologyHealthCheckApplyConfiguration{} +} + +// WithEnabled sets the Enabled field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Enabled field is set to the value of the last call. +func (b *MachineDeploymentTopologyHealthCheckApplyConfiguration) WithEnabled(value bool) *MachineDeploymentTopologyHealthCheckApplyConfiguration { + b.Enabled = &value + return b +} + +// WithChecks sets the Checks field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Checks field is set to the value of the last call. +func (b *MachineDeploymentTopologyHealthCheckApplyConfiguration) WithChecks(value *MachineDeploymentTopologyHealthCheckChecksApplyConfiguration) *MachineDeploymentTopologyHealthCheckApplyConfiguration { + b.Checks = value + return b +} + +// WithRemediation sets the Remediation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Remediation field is set to the value of the last call. +func (b *MachineDeploymentTopologyHealthCheckApplyConfiguration) WithRemediation(value *MachineDeploymentTopologyHealthCheckRemediationApplyConfiguration) *MachineDeploymentTopologyHealthCheckApplyConfiguration { + b.Remediation = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedeploymenttopologyhealthcheckchecks.go b/util/applyconfigurations/core/v1beta2/machinedeploymenttopologyhealthcheckchecks.go new file mode 100644 index 000000000000..603463b728d0 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedeploymenttopologyhealthcheckchecks.go @@ -0,0 +1,71 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachineDeploymentTopologyHealthCheckChecksApplyConfiguration represents a declarative configuration of the MachineDeploymentTopologyHealthCheckChecks type for use +// with apply. +// +// MachineDeploymentTopologyHealthCheckChecks are the checks that are used to evaluate if a MachineDeployment Machine is healthy. +type MachineDeploymentTopologyHealthCheckChecksApplyConfiguration struct { + // nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck + // to consider a Machine unhealthy if a corresponding Node isn't associated + // through a `Spec.ProviderID` field. + // + // The duration set in this field is compared to the greatest of: + // - Cluster's infrastructure ready condition timestamp (if and when available) + // - Control Plane's initialized condition timestamp (if and when available) + // - Machine's infrastructure ready condition timestamp (if and when available) + // - Machine's metadata creation timestamp + // + // Defaults to 10 minutes. + // If you wish to disable this feature, set the value explicitly to 0. + NodeStartupTimeoutSeconds *int32 `json:"nodeStartupTimeoutSeconds,omitempty"` + // unhealthyNodeConditions contains a list of conditions that determine + // whether a node is considered unhealthy. The conditions are combined in a + // logical OR, i.e. if any of the conditions is met, the node is unhealthy. + UnhealthyNodeConditions []UnhealthyNodeConditionApplyConfiguration `json:"unhealthyNodeConditions,omitempty"` + // unhealthyMachineConditions contains a list of the machine conditions that determine + // whether a machine is considered unhealthy. The conditions are combined in a + // logical OR, i.e. if any of the conditions is met, the machine is unhealthy. + UnhealthyMachineConditions []UnhealthyMachineConditionApplyConfiguration `json:"unhealthyMachineConditions,omitempty"` +} + +// MachineDeploymentTopologyHealthCheckChecksApplyConfiguration constructs a declarative configuration of the MachineDeploymentTopologyHealthCheckChecks type for use with +// apply. +func MachineDeploymentTopologyHealthCheckChecks() *MachineDeploymentTopologyHealthCheckChecksApplyConfiguration { + return &MachineDeploymentTopologyHealthCheckChecksApplyConfiguration{} +} + +// WithNodeStartupTimeoutSeconds sets the NodeStartupTimeoutSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeStartupTimeoutSeconds field is set to the value of the last call. +func (b *MachineDeploymentTopologyHealthCheckChecksApplyConfiguration) WithNodeStartupTimeoutSeconds(value int32) *MachineDeploymentTopologyHealthCheckChecksApplyConfiguration { + b.NodeStartupTimeoutSeconds = &value + return b +} + +// WithUnhealthyNodeConditions adds the given value to the UnhealthyNodeConditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the UnhealthyNodeConditions field. +func (b *MachineDeploymentTopologyHealthCheckChecksApplyConfiguration) WithUnhealthyNodeConditions(values ...*UnhealthyNodeConditionApplyConfiguration) *MachineDeploymentTopologyHealthCheckChecksApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithUnhealthyNodeConditions") + } + b.UnhealthyNodeConditions = append(b.UnhealthyNodeConditions, *values[i]) + } + return b +} + +// WithUnhealthyMachineConditions adds the given value to the UnhealthyMachineConditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the UnhealthyMachineConditions field. +func (b *MachineDeploymentTopologyHealthCheckChecksApplyConfiguration) WithUnhealthyMachineConditions(values ...*UnhealthyMachineConditionApplyConfiguration) *MachineDeploymentTopologyHealthCheckChecksApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithUnhealthyMachineConditions") + } + b.UnhealthyMachineConditions = append(b.UnhealthyMachineConditions, *values[i]) + } + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedeploymenttopologyhealthcheckremediation.go b/util/applyconfigurations/core/v1beta2/machinedeploymenttopologyhealthcheckremediation.go new file mode 100644 index 000000000000..df73399f64cb --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedeploymenttopologyhealthcheckremediation.go @@ -0,0 +1,69 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// MachineDeploymentTopologyHealthCheckRemediationApplyConfiguration represents a declarative configuration of the MachineDeploymentTopologyHealthCheckRemediation type for use +// with apply. +// +// MachineDeploymentTopologyHealthCheckRemediation configures if and how remediations are triggered if a MachineDeployment Machine is unhealthy. +type MachineDeploymentTopologyHealthCheckRemediationApplyConfiguration struct { + // maxInFlight determines how many in flight remediations should happen at the same time. + // + // Remediation only happens on the MachineSet with the most current revision, while + // older MachineSets (usually present during rollout operations) aren't allowed to remediate. + // + // Note: In general (independent of remediations), unhealthy machines are always + // prioritized during scale down operations over healthy ones. + // + // MaxInFlight can be set to a fixed number or a percentage. + // Example: when this is set to 20%, the MachineSet controller deletes at most 20% of + // the desired replicas. + // + // If not set, remediation is limited to all machines (bounded by replicas) + // under the active MachineSet's management. + MaxInFlight *intstr.IntOrString `json:"maxInFlight,omitempty"` + // triggerIf configures if remediations are triggered. + // If this field is not set, remediations are always triggered. + TriggerIf *MachineDeploymentTopologyHealthCheckRemediationTriggerIfApplyConfiguration `json:"triggerIf,omitempty"` + // templateRef is a reference to a remediation template + // provided by an infrastructure provider. + // + // This field is completely optional, when filled, the MachineHealthCheck controller + // creates a new object from the template referenced and hands off remediation of the machine to + // a controller that lives outside of Cluster API. + TemplateRef *MachineHealthCheckRemediationTemplateReferenceApplyConfiguration `json:"templateRef,omitempty"` +} + +// MachineDeploymentTopologyHealthCheckRemediationApplyConfiguration constructs a declarative configuration of the MachineDeploymentTopologyHealthCheckRemediation type for use with +// apply. +func MachineDeploymentTopologyHealthCheckRemediation() *MachineDeploymentTopologyHealthCheckRemediationApplyConfiguration { + return &MachineDeploymentTopologyHealthCheckRemediationApplyConfiguration{} +} + +// WithMaxInFlight sets the MaxInFlight field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxInFlight field is set to the value of the last call. +func (b *MachineDeploymentTopologyHealthCheckRemediationApplyConfiguration) WithMaxInFlight(value intstr.IntOrString) *MachineDeploymentTopologyHealthCheckRemediationApplyConfiguration { + b.MaxInFlight = &value + return b +} + +// WithTriggerIf sets the TriggerIf field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TriggerIf field is set to the value of the last call. +func (b *MachineDeploymentTopologyHealthCheckRemediationApplyConfiguration) WithTriggerIf(value *MachineDeploymentTopologyHealthCheckRemediationTriggerIfApplyConfiguration) *MachineDeploymentTopologyHealthCheckRemediationApplyConfiguration { + b.TriggerIf = value + return b +} + +// WithTemplateRef sets the TemplateRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TemplateRef field is set to the value of the last call. +func (b *MachineDeploymentTopologyHealthCheckRemediationApplyConfiguration) WithTemplateRef(value *MachineHealthCheckRemediationTemplateReferenceApplyConfiguration) *MachineDeploymentTopologyHealthCheckRemediationApplyConfiguration { + b.TemplateRef = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedeploymenttopologyhealthcheckremediationtriggerif.go b/util/applyconfigurations/core/v1beta2/machinedeploymenttopologyhealthcheckremediationtriggerif.go new file mode 100644 index 000000000000..877fb6c8ad7b --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedeploymenttopologyhealthcheckremediationtriggerif.go @@ -0,0 +1,47 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// MachineDeploymentTopologyHealthCheckRemediationTriggerIfApplyConfiguration represents a declarative configuration of the MachineDeploymentTopologyHealthCheckRemediationTriggerIf type for use +// with apply. +// +// MachineDeploymentTopologyHealthCheckRemediationTriggerIf configures if remediations are triggered. +type MachineDeploymentTopologyHealthCheckRemediationTriggerIfApplyConfiguration struct { + // unhealthyLessThanOrEqualTo specifies that remediations are only triggered if the number of + // unhealthy Machines is less than or equal to the configured value. + // unhealthyInRange takes precedence if set. + UnhealthyLessThanOrEqualTo *intstr.IntOrString `json:"unhealthyLessThanOrEqualTo,omitempty"` + // unhealthyInRange specifies that remediations are only triggered if the number of + // unhealthy Machines is in the configured range. + // Takes precedence over unhealthyLessThanOrEqualTo. + // Eg. "[3-5]" - This means that remediation will be allowed only when: + // (a) there are at least 3 unhealthy Machines (and) + // (b) there are at most 5 unhealthy Machines + UnhealthyInRange *string `json:"unhealthyInRange,omitempty"` +} + +// MachineDeploymentTopologyHealthCheckRemediationTriggerIfApplyConfiguration constructs a declarative configuration of the MachineDeploymentTopologyHealthCheckRemediationTriggerIf type for use with +// apply. +func MachineDeploymentTopologyHealthCheckRemediationTriggerIf() *MachineDeploymentTopologyHealthCheckRemediationTriggerIfApplyConfiguration { + return &MachineDeploymentTopologyHealthCheckRemediationTriggerIfApplyConfiguration{} +} + +// WithUnhealthyLessThanOrEqualTo sets the UnhealthyLessThanOrEqualTo field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UnhealthyLessThanOrEqualTo field is set to the value of the last call. +func (b *MachineDeploymentTopologyHealthCheckRemediationTriggerIfApplyConfiguration) WithUnhealthyLessThanOrEqualTo(value intstr.IntOrString) *MachineDeploymentTopologyHealthCheckRemediationTriggerIfApplyConfiguration { + b.UnhealthyLessThanOrEqualTo = &value + return b +} + +// WithUnhealthyInRange sets the UnhealthyInRange field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UnhealthyInRange field is set to the value of the last call. +func (b *MachineDeploymentTopologyHealthCheckRemediationTriggerIfApplyConfiguration) WithUnhealthyInRange(value string) *MachineDeploymentTopologyHealthCheckRemediationTriggerIfApplyConfiguration { + b.UnhealthyInRange = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedeploymenttopologymachinedeletionspec.go b/util/applyconfigurations/core/v1beta2/machinedeploymenttopologymachinedeletionspec.go new file mode 100644 index 000000000000..51086be73329 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedeploymenttopologymachinedeletionspec.go @@ -0,0 +1,66 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + corev1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2" +) + +// MachineDeploymentTopologyMachineDeletionSpecApplyConfiguration represents a declarative configuration of the MachineDeploymentTopologyMachineDeletionSpec type for use +// with apply. +// +// MachineDeploymentTopologyMachineDeletionSpec contains configuration options for Machine deletion. +type MachineDeploymentTopologyMachineDeletionSpecApplyConfiguration struct { + // order defines the order in which Machines are deleted when downscaling. + // Defaults to "Random". Valid values are "Random, "Newest", "Oldest" + Order *corev1beta2.MachineSetDeletionOrder `json:"order,omitempty"` + // nodeDrainTimeoutSeconds is the total amount of time that the controller will spend on draining a node. + // The default value is 0, meaning that the node can be drained without any time limitations. + // NOTE: nodeDrainTimeoutSeconds is different from `kubectl drain --timeout` + NodeDrainTimeoutSeconds *int32 `json:"nodeDrainTimeoutSeconds,omitempty"` + // nodeVolumeDetachTimeoutSeconds is the total amount of time that the controller will spend on waiting for all volumes + // to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations. + NodeVolumeDetachTimeoutSeconds *int32 `json:"nodeVolumeDetachTimeoutSeconds,omitempty"` + // nodeDeletionTimeoutSeconds defines how long the controller will attempt to delete the Node that the Machine + // hosts after the Machine is marked for deletion. A duration of 0 will retry deletion indefinitely. + // Defaults to 10 seconds. + NodeDeletionTimeoutSeconds *int32 `json:"nodeDeletionTimeoutSeconds,omitempty"` +} + +// MachineDeploymentTopologyMachineDeletionSpecApplyConfiguration constructs a declarative configuration of the MachineDeploymentTopologyMachineDeletionSpec type for use with +// apply. +func MachineDeploymentTopologyMachineDeletionSpec() *MachineDeploymentTopologyMachineDeletionSpecApplyConfiguration { + return &MachineDeploymentTopologyMachineDeletionSpecApplyConfiguration{} +} + +// WithOrder sets the Order field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Order field is set to the value of the last call. +func (b *MachineDeploymentTopologyMachineDeletionSpecApplyConfiguration) WithOrder(value corev1beta2.MachineSetDeletionOrder) *MachineDeploymentTopologyMachineDeletionSpecApplyConfiguration { + b.Order = &value + return b +} + +// WithNodeDrainTimeoutSeconds sets the NodeDrainTimeoutSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeDrainTimeoutSeconds field is set to the value of the last call. +func (b *MachineDeploymentTopologyMachineDeletionSpecApplyConfiguration) WithNodeDrainTimeoutSeconds(value int32) *MachineDeploymentTopologyMachineDeletionSpecApplyConfiguration { + b.NodeDrainTimeoutSeconds = &value + return b +} + +// WithNodeVolumeDetachTimeoutSeconds sets the NodeVolumeDetachTimeoutSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeVolumeDetachTimeoutSeconds field is set to the value of the last call. +func (b *MachineDeploymentTopologyMachineDeletionSpecApplyConfiguration) WithNodeVolumeDetachTimeoutSeconds(value int32) *MachineDeploymentTopologyMachineDeletionSpecApplyConfiguration { + b.NodeVolumeDetachTimeoutSeconds = &value + return b +} + +// WithNodeDeletionTimeoutSeconds sets the NodeDeletionTimeoutSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeDeletionTimeoutSeconds field is set to the value of the last call. +func (b *MachineDeploymentTopologyMachineDeletionSpecApplyConfiguration) WithNodeDeletionTimeoutSeconds(value int32) *MachineDeploymentTopologyMachineDeletionSpecApplyConfiguration { + b.NodeDeletionTimeoutSeconds = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedeploymenttopologyrolloutspec.go b/util/applyconfigurations/core/v1beta2/machinedeploymenttopologyrolloutspec.go new file mode 100644 index 000000000000..d1b66a708d7b --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedeploymenttopologyrolloutspec.go @@ -0,0 +1,26 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachineDeploymentTopologyRolloutSpecApplyConfiguration represents a declarative configuration of the MachineDeploymentTopologyRolloutSpec type for use +// with apply. +// +// MachineDeploymentTopologyRolloutSpec defines the rollout behavior. +type MachineDeploymentTopologyRolloutSpecApplyConfiguration struct { + // strategy specifies how to roll out control plane Machines. + Strategy *MachineDeploymentTopologyRolloutStrategyApplyConfiguration `json:"strategy,omitempty"` +} + +// MachineDeploymentTopologyRolloutSpecApplyConfiguration constructs a declarative configuration of the MachineDeploymentTopologyRolloutSpec type for use with +// apply. +func MachineDeploymentTopologyRolloutSpec() *MachineDeploymentTopologyRolloutSpecApplyConfiguration { + return &MachineDeploymentTopologyRolloutSpecApplyConfiguration{} +} + +// WithStrategy sets the Strategy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Strategy field is set to the value of the last call. +func (b *MachineDeploymentTopologyRolloutSpecApplyConfiguration) WithStrategy(value *MachineDeploymentTopologyRolloutStrategyApplyConfiguration) *MachineDeploymentTopologyRolloutSpecApplyConfiguration { + b.Strategy = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedeploymenttopologyrolloutstrategy.go b/util/applyconfigurations/core/v1beta2/machinedeploymenttopologyrolloutstrategy.go new file mode 100644 index 000000000000..82cbc71ac347 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedeploymenttopologyrolloutstrategy.go @@ -0,0 +1,43 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + corev1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2" +) + +// MachineDeploymentTopologyRolloutStrategyApplyConfiguration represents a declarative configuration of the MachineDeploymentTopologyRolloutStrategy type for use +// with apply. +// +// MachineDeploymentTopologyRolloutStrategy describes how to replace existing machines +// with new ones. +type MachineDeploymentTopologyRolloutStrategyApplyConfiguration struct { + // type of rollout. Allowed values are RollingUpdate and OnDelete. + // Default is RollingUpdate. + Type *corev1beta2.MachineDeploymentRolloutStrategyType `json:"type,omitempty"` + // rollingUpdate is the rolling update config params. Present only if + // type = RollingUpdate. + RollingUpdate *MachineDeploymentTopologyRolloutStrategyRollingUpdateApplyConfiguration `json:"rollingUpdate,omitempty"` +} + +// MachineDeploymentTopologyRolloutStrategyApplyConfiguration constructs a declarative configuration of the MachineDeploymentTopologyRolloutStrategy type for use with +// apply. +func MachineDeploymentTopologyRolloutStrategy() *MachineDeploymentTopologyRolloutStrategyApplyConfiguration { + return &MachineDeploymentTopologyRolloutStrategyApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *MachineDeploymentTopologyRolloutStrategyApplyConfiguration) WithType(value corev1beta2.MachineDeploymentRolloutStrategyType) *MachineDeploymentTopologyRolloutStrategyApplyConfiguration { + b.Type = &value + return b +} + +// WithRollingUpdate sets the RollingUpdate field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RollingUpdate field is set to the value of the last call. +func (b *MachineDeploymentTopologyRolloutStrategyApplyConfiguration) WithRollingUpdate(value *MachineDeploymentTopologyRolloutStrategyRollingUpdateApplyConfiguration) *MachineDeploymentTopologyRolloutStrategyApplyConfiguration { + b.RollingUpdate = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedeploymenttopologyrolloutstrategyrollingupdate.go b/util/applyconfigurations/core/v1beta2/machinedeploymenttopologyrolloutstrategyrollingupdate.go new file mode 100644 index 000000000000..ce5f8c1924af --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedeploymenttopologyrolloutstrategyrollingupdate.go @@ -0,0 +1,63 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// MachineDeploymentTopologyRolloutStrategyRollingUpdateApplyConfiguration represents a declarative configuration of the MachineDeploymentTopologyRolloutStrategyRollingUpdate type for use +// with apply. +// +// MachineDeploymentTopologyRolloutStrategyRollingUpdate is used to control the desired behavior of rolling update. +type MachineDeploymentTopologyRolloutStrategyRollingUpdateApplyConfiguration struct { + // maxUnavailable is the maximum number of machines that can be unavailable during the update. + // Value can be an absolute number (ex: 5) or a percentage of desired + // machines (ex: 10%). + // Absolute number is calculated from percentage by rounding down. + // This can not be 0 if MaxSurge is 0. + // Defaults to 0. + // Example: when this is set to 30%, the old MachineSet can be scaled + // down to 70% of desired machines immediately when the rolling update + // starts. Once new machines are ready, old MachineSet can be scaled + // down further, followed by scaling up the new MachineSet, ensuring + // that the total number of machines available at all times + // during the update is at least 70% of desired machines. + MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"` + // maxSurge is the maximum number of machines that can be scheduled above the + // desired number of machines. + // Value can be an absolute number (ex: 5) or a percentage of + // desired machines (ex: 10%). + // This can not be 0 if MaxUnavailable is 0. + // Absolute number is calculated from percentage by rounding up. + // Defaults to 1. + // Example: when this is set to 30%, the new MachineSet can be scaled + // up immediately when the rolling update starts, such that the total + // number of old and new machines do not exceed 130% of desired + // machines. Once old machines have been killed, new MachineSet can + // be scaled up further, ensuring that total number of machines running + // at any time during the update is at most 130% of desired machines. + MaxSurge *intstr.IntOrString `json:"maxSurge,omitempty"` +} + +// MachineDeploymentTopologyRolloutStrategyRollingUpdateApplyConfiguration constructs a declarative configuration of the MachineDeploymentTopologyRolloutStrategyRollingUpdate type for use with +// apply. +func MachineDeploymentTopologyRolloutStrategyRollingUpdate() *MachineDeploymentTopologyRolloutStrategyRollingUpdateApplyConfiguration { + return &MachineDeploymentTopologyRolloutStrategyRollingUpdateApplyConfiguration{} +} + +// WithMaxUnavailable sets the MaxUnavailable field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxUnavailable field is set to the value of the last call. +func (b *MachineDeploymentTopologyRolloutStrategyRollingUpdateApplyConfiguration) WithMaxUnavailable(value intstr.IntOrString) *MachineDeploymentTopologyRolloutStrategyRollingUpdateApplyConfiguration { + b.MaxUnavailable = &value + return b +} + +// WithMaxSurge sets the MaxSurge field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxSurge field is set to the value of the last call. +func (b *MachineDeploymentTopologyRolloutStrategyRollingUpdateApplyConfiguration) WithMaxSurge(value intstr.IntOrString) *MachineDeploymentTopologyRolloutStrategyRollingUpdateApplyConfiguration { + b.MaxSurge = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedeploymentv1beta1deprecatedstatus.go b/util/applyconfigurations/core/v1beta2/machinedeploymentv1beta1deprecatedstatus.go new file mode 100644 index 000000000000..80f38162eb14 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedeploymentv1beta1deprecatedstatus.go @@ -0,0 +1,87 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + corev1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2" +) + +// MachineDeploymentV1Beta1DeprecatedStatusApplyConfiguration represents a declarative configuration of the MachineDeploymentV1Beta1DeprecatedStatus type for use +// with apply. +// +// MachineDeploymentV1Beta1DeprecatedStatus 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 MachineDeploymentV1Beta1DeprecatedStatusApplyConfiguration struct { + // conditions defines current service state of the MachineDeployment. + // + // 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. + Conditions *corev1beta2.Conditions `json:"conditions,omitempty"` + // updatedReplicas is the total number of non-terminated machines targeted by this deployment + // that have the desired template spec. + // + // 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. + UpdatedReplicas *int32 `json:"updatedReplicas,omitempty"` + // readyReplicas is the total number of ready machines targeted by this deployment. + // + // 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. + ReadyReplicas *int32 `json:"readyReplicas,omitempty"` + // availableReplicas is the total number of available machines (ready for at least minReadySeconds) + // targeted by this deployment. + // + // 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. + AvailableReplicas *int32 `json:"availableReplicas,omitempty"` + // unavailableReplicas is the total number of unavailable machines targeted by this deployment. + // This is the total number of machines that are still required for + // the deployment to have 100% available capacity. They may either + // be machines that are running but not yet available or machines + // that still have not been created. + // + // 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. + UnavailableReplicas *int32 `json:"unavailableReplicas,omitempty"` +} + +// MachineDeploymentV1Beta1DeprecatedStatusApplyConfiguration constructs a declarative configuration of the MachineDeploymentV1Beta1DeprecatedStatus type for use with +// apply. +func MachineDeploymentV1Beta1DeprecatedStatus() *MachineDeploymentV1Beta1DeprecatedStatusApplyConfiguration { + return &MachineDeploymentV1Beta1DeprecatedStatusApplyConfiguration{} +} + +// WithConditions sets the Conditions field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Conditions field is set to the value of the last call. +func (b *MachineDeploymentV1Beta1DeprecatedStatusApplyConfiguration) WithConditions(value corev1beta2.Conditions) *MachineDeploymentV1Beta1DeprecatedStatusApplyConfiguration { + b.Conditions = &value + return b +} + +// WithUpdatedReplicas sets the UpdatedReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UpdatedReplicas field is set to the value of the last call. +func (b *MachineDeploymentV1Beta1DeprecatedStatusApplyConfiguration) WithUpdatedReplicas(value int32) *MachineDeploymentV1Beta1DeprecatedStatusApplyConfiguration { + b.UpdatedReplicas = &value + return b +} + +// WithReadyReplicas sets the ReadyReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadyReplicas field is set to the value of the last call. +func (b *MachineDeploymentV1Beta1DeprecatedStatusApplyConfiguration) WithReadyReplicas(value int32) *MachineDeploymentV1Beta1DeprecatedStatusApplyConfiguration { + b.ReadyReplicas = &value + return b +} + +// WithAvailableReplicas sets the AvailableReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AvailableReplicas field is set to the value of the last call. +func (b *MachineDeploymentV1Beta1DeprecatedStatusApplyConfiguration) WithAvailableReplicas(value int32) *MachineDeploymentV1Beta1DeprecatedStatusApplyConfiguration { + b.AvailableReplicas = &value + return b +} + +// WithUnavailableReplicas sets the UnavailableReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UnavailableReplicas field is set to the value of the last call. +func (b *MachineDeploymentV1Beta1DeprecatedStatusApplyConfiguration) WithUnavailableReplicas(value int32) *MachineDeploymentV1Beta1DeprecatedStatusApplyConfiguration { + b.UnavailableReplicas = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedeploymentvariables.go b/util/applyconfigurations/core/v1beta2/machinedeploymentvariables.go new file mode 100644 index 000000000000..4ff96d6293be --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedeploymentvariables.go @@ -0,0 +1,31 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachineDeploymentVariablesApplyConfiguration represents a declarative configuration of the MachineDeploymentVariables type for use +// with apply. +// +// MachineDeploymentVariables can be used to provide variables for a specific MachineDeployment. +type MachineDeploymentVariablesApplyConfiguration struct { + // overrides can be used to override Cluster level variables. + Overrides []ClusterVariableApplyConfiguration `json:"overrides,omitempty"` +} + +// MachineDeploymentVariablesApplyConfiguration constructs a declarative configuration of the MachineDeploymentVariables type for use with +// apply. +func MachineDeploymentVariables() *MachineDeploymentVariablesApplyConfiguration { + return &MachineDeploymentVariablesApplyConfiguration{} +} + +// WithOverrides adds the given value to the Overrides field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Overrides field. +func (b *MachineDeploymentVariablesApplyConfiguration) WithOverrides(values ...*ClusterVariableApplyConfiguration) *MachineDeploymentVariablesApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOverrides") + } + b.Overrides = append(b.Overrides, *values[i]) + } + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedeprecatedstatus.go b/util/applyconfigurations/core/v1beta2/machinedeprecatedstatus.go new file mode 100644 index 000000000000..d8d4890ff9af --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedeprecatedstatus.go @@ -0,0 +1,29 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachineDeprecatedStatusApplyConfiguration represents a declarative configuration of the MachineDeprecatedStatus type for use +// with apply. +// +// MachineDeprecatedStatus groups all the status fields that are deprecated and will be removed in a future version. +// See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context. +type MachineDeprecatedStatusApplyConfiguration 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. + V1Beta1 *MachineV1Beta1DeprecatedStatusApplyConfiguration `json:"v1beta1,omitempty"` +} + +// MachineDeprecatedStatusApplyConfiguration constructs a declarative configuration of the MachineDeprecatedStatus type for use with +// apply. +func MachineDeprecatedStatus() *MachineDeprecatedStatusApplyConfiguration { + return &MachineDeprecatedStatusApplyConfiguration{} +} + +// WithV1Beta1 sets the V1Beta1 field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the V1Beta1 field is set to the value of the last call. +func (b *MachineDeprecatedStatusApplyConfiguration) WithV1Beta1(value *MachineV1Beta1DeprecatedStatusApplyConfiguration) *MachineDeprecatedStatusApplyConfiguration { + b.V1Beta1 = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedrainrule.go b/util/applyconfigurations/core/v1beta2/machinedrainrule.go new file mode 100644 index 000000000000..4abd8cd3a187 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedrainrule.go @@ -0,0 +1,261 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" + corev1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2" + internal "sigs.k8s.io/cluster-api/util/applyconfigurations/internal" +) + +// MachineDrainRuleApplyConfiguration represents a declarative configuration of the MachineDrainRule type for use +// with apply. +// +// MachineDrainRule is the Schema for the MachineDrainRule API. +type MachineDrainRuleApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + // metadata is the standard object's metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + // spec defines the spec of a MachineDrainRule. + Spec *MachineDrainRuleSpecApplyConfiguration `json:"spec,omitempty"` +} + +// MachineDrainRule constructs a declarative configuration of the MachineDrainRule type for use with +// apply. +func MachineDrainRule(name, namespace string) *MachineDrainRuleApplyConfiguration { + b := &MachineDrainRuleApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("MachineDrainRule") + b.WithAPIVersion("cluster.x-k8s.io/v1beta2") + return b +} + +// ExtractMachineDrainRuleFrom extracts the applied configuration owned by fieldManager from +// machineDrainRule for the specified subresource. Pass an empty string for subresource to extract +// the main resource. Common subresources include "status", "scale", etc. +// machineDrainRule must be a unmodified MachineDrainRule API object that was retrieved from the Kubernetes API. +// ExtractMachineDrainRuleFrom provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractMachineDrainRuleFrom(machineDrainRule *corev1beta2.MachineDrainRule, fieldManager string, subresource string) (*MachineDrainRuleApplyConfiguration, error) { + b := &MachineDrainRuleApplyConfiguration{} + err := managedfields.ExtractInto(machineDrainRule, internal.Parser().Type("io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDrainRule"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(machineDrainRule.Name) + b.WithNamespace(machineDrainRule.Namespace) + + b.WithKind("MachineDrainRule") + b.WithAPIVersion("cluster.x-k8s.io/v1beta2") + return b, nil +} + +// ExtractMachineDrainRule extracts the applied configuration owned by fieldManager from +// machineDrainRule. If no managedFields are found in machineDrainRule for fieldManager, a +// MachineDrainRuleApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// machineDrainRule must be a unmodified MachineDrainRule API object that was retrieved from the Kubernetes API. +// ExtractMachineDrainRule provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractMachineDrainRule(machineDrainRule *corev1beta2.MachineDrainRule, fieldManager string) (*MachineDrainRuleApplyConfiguration, error) { + return ExtractMachineDrainRuleFrom(machineDrainRule, fieldManager, "") +} + +func (b MachineDrainRuleApplyConfiguration) IsApplyConfiguration() {} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *MachineDrainRuleApplyConfiguration) WithKind(value string) *MachineDrainRuleApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *MachineDrainRuleApplyConfiguration) WithAPIVersion(value string) *MachineDrainRuleApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *MachineDrainRuleApplyConfiguration) WithName(value string) *MachineDrainRuleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *MachineDrainRuleApplyConfiguration) WithGenerateName(value string) *MachineDrainRuleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *MachineDrainRuleApplyConfiguration) WithNamespace(value string) *MachineDrainRuleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *MachineDrainRuleApplyConfiguration) WithUID(value types.UID) *MachineDrainRuleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *MachineDrainRuleApplyConfiguration) WithResourceVersion(value string) *MachineDrainRuleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *MachineDrainRuleApplyConfiguration) WithGeneration(value int64) *MachineDrainRuleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *MachineDrainRuleApplyConfiguration) WithCreationTimestamp(value metav1.Time) *MachineDrainRuleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *MachineDrainRuleApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *MachineDrainRuleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *MachineDrainRuleApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *MachineDrainRuleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *MachineDrainRuleApplyConfiguration) WithLabels(entries map[string]string) *MachineDrainRuleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *MachineDrainRuleApplyConfiguration) WithAnnotations(entries map[string]string) *MachineDrainRuleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *MachineDrainRuleApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *MachineDrainRuleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *MachineDrainRuleApplyConfiguration) WithFinalizers(values ...string) *MachineDrainRuleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *MachineDrainRuleApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *MachineDrainRuleApplyConfiguration) WithSpec(value *MachineDrainRuleSpecApplyConfiguration) *MachineDrainRuleApplyConfiguration { + b.Spec = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *MachineDrainRuleApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *MachineDrainRuleApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *MachineDrainRuleApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *MachineDrainRuleApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/util/applyconfigurations/core/v1beta2/machinedrainruledrainconfig.go b/util/applyconfigurations/core/v1beta2/machinedrainruledrainconfig.go new file mode 100644 index 000000000000..96ce330b68ad --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedrainruledrainconfig.go @@ -0,0 +1,54 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + corev1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2" +) + +// MachineDrainRuleDrainConfigApplyConfiguration represents a declarative configuration of the MachineDrainRuleDrainConfig type for use +// with apply. +// +// MachineDrainRuleDrainConfig configures if and how Pods are drained. +type MachineDrainRuleDrainConfigApplyConfiguration struct { + // behavior defines the drain behavior. + // Can be either "Drain", "Skip", or "WaitCompleted". + // "Drain" means that the Pods to which this MachineDrainRule applies will be drained. + // If behavior is set to "Drain" the order in which Pods are drained can be configured + // with the order field. When draining Pods of a Node the Pods will be grouped by order + // and one group after another will be drained (by increasing order). Cluster API will + // wait until all Pods of a group are terminated / removed from the Node before starting + // with the next group. + // "Skip" means that the Pods to which this MachineDrainRule applies will be skipped during drain. + // "WaitCompleted" means that the pods to which this MachineDrainRule applies will never be evicted + // and we wait for them to be completed, it is enforced that pods marked with this behavior always have Order=0. + Behavior *corev1beta2.MachineDrainRuleDrainBehavior `json:"behavior,omitempty"` + // order defines the order in which Pods are drained. + // Pods with higher order are drained after Pods with lower order. + // order can only be set if behavior is set to "Drain". + // If order is not set, 0 will be used. + // Valid values for order are from -2147483648 to 2147483647 (inclusive). + Order *int32 `json:"order,omitempty"` +} + +// MachineDrainRuleDrainConfigApplyConfiguration constructs a declarative configuration of the MachineDrainRuleDrainConfig type for use with +// apply. +func MachineDrainRuleDrainConfig() *MachineDrainRuleDrainConfigApplyConfiguration { + return &MachineDrainRuleDrainConfigApplyConfiguration{} +} + +// WithBehavior sets the Behavior field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Behavior field is set to the value of the last call. +func (b *MachineDrainRuleDrainConfigApplyConfiguration) WithBehavior(value corev1beta2.MachineDrainRuleDrainBehavior) *MachineDrainRuleDrainConfigApplyConfiguration { + b.Behavior = &value + return b +} + +// WithOrder sets the Order field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Order field is set to the value of the last call. +func (b *MachineDrainRuleDrainConfigApplyConfiguration) WithOrder(value int32) *MachineDrainRuleDrainConfigApplyConfiguration { + b.Order = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedrainrulemachineselector.go b/util/applyconfigurations/core/v1beta2/machinedrainrulemachineselector.go new file mode 100644 index 000000000000..ea164a844c09 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedrainrulemachineselector.go @@ -0,0 +1,55 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// MachineDrainRuleMachineSelectorApplyConfiguration represents a declarative configuration of the MachineDrainRuleMachineSelector type for use +// with apply. +// +// MachineDrainRuleMachineSelector defines to which Machines this MachineDrainRule should be applied. +type MachineDrainRuleMachineSelectorApplyConfiguration struct { + // selector is a label selector which selects Machines by their labels. + // This field follows standard label selector semantics; if not present or + // empty, it selects all Machines. + // + // If clusterSelector is also set, then the selector as a whole selects + // Machines matching selector belonging to Clusters selected by clusterSelector. + // If clusterSelector is not set, it selects all Machines matching selector in + // all Clusters. + Selector *v1.LabelSelectorApplyConfiguration `json:"selector,omitempty"` + // clusterSelector is a label selector which selects Machines by the labels of + // their Clusters. + // This field follows standard label selector semantics; if not present or + // empty, it selects Machines of all Clusters. + // + // If selector is also set, then the selector as a whole selects + // Machines matching selector belonging to Clusters selected by clusterSelector. + // If selector is not set, it selects all Machines belonging to Clusters + // selected by clusterSelector. + ClusterSelector *v1.LabelSelectorApplyConfiguration `json:"clusterSelector,omitempty"` +} + +// MachineDrainRuleMachineSelectorApplyConfiguration constructs a declarative configuration of the MachineDrainRuleMachineSelector type for use with +// apply. +func MachineDrainRuleMachineSelector() *MachineDrainRuleMachineSelectorApplyConfiguration { + return &MachineDrainRuleMachineSelectorApplyConfiguration{} +} + +// WithSelector sets the Selector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Selector field is set to the value of the last call. +func (b *MachineDrainRuleMachineSelectorApplyConfiguration) WithSelector(value *v1.LabelSelectorApplyConfiguration) *MachineDrainRuleMachineSelectorApplyConfiguration { + b.Selector = value + return b +} + +// WithClusterSelector sets the ClusterSelector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ClusterSelector field is set to the value of the last call. +func (b *MachineDrainRuleMachineSelectorApplyConfiguration) WithClusterSelector(value *v1.LabelSelectorApplyConfiguration) *MachineDrainRuleMachineSelectorApplyConfiguration { + b.ClusterSelector = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedrainrulepodselector.go b/util/applyconfigurations/core/v1beta2/machinedrainrulepodselector.go new file mode 100644 index 000000000000..752cc31b1104 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedrainrulepodselector.go @@ -0,0 +1,55 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// MachineDrainRulePodSelectorApplyConfiguration represents a declarative configuration of the MachineDrainRulePodSelector type for use +// with apply. +// +// MachineDrainRulePodSelector defines to which Pods this MachineDrainRule should be applied. +type MachineDrainRulePodSelectorApplyConfiguration struct { + // selector is a label selector which selects Pods by their labels. + // This field follows standard label selector semantics; if not present or + // empty, it selects all Pods. + // + // If namespaceSelector is also set, then the selector as a whole selects + // Pods matching selector in Namespaces selected by namespaceSelector. + // If namespaceSelector is not set, it selects all Pods matching selector in + // all Namespaces. + Selector *v1.LabelSelectorApplyConfiguration `json:"selector,omitempty"` + // namespaceSelector is a label selector which selects Pods by the labels of + // their Namespaces. + // This field follows standard label selector semantics; if not present or + // empty, it selects Pods of all Namespaces. + // + // If selector is also set, then the selector as a whole selects + // Pods matching selector in Namespaces selected by namespaceSelector. + // If selector is not set, it selects all Pods in Namespaces selected by + // namespaceSelector. + NamespaceSelector *v1.LabelSelectorApplyConfiguration `json:"namespaceSelector,omitempty"` +} + +// MachineDrainRulePodSelectorApplyConfiguration constructs a declarative configuration of the MachineDrainRulePodSelector type for use with +// apply. +func MachineDrainRulePodSelector() *MachineDrainRulePodSelectorApplyConfiguration { + return &MachineDrainRulePodSelectorApplyConfiguration{} +} + +// WithSelector sets the Selector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Selector field is set to the value of the last call. +func (b *MachineDrainRulePodSelectorApplyConfiguration) WithSelector(value *v1.LabelSelectorApplyConfiguration) *MachineDrainRulePodSelectorApplyConfiguration { + b.Selector = value + return b +} + +// WithNamespaceSelector sets the NamespaceSelector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NamespaceSelector field is set to the value of the last call. +func (b *MachineDrainRulePodSelectorApplyConfiguration) WithNamespaceSelector(value *v1.LabelSelectorApplyConfiguration) *MachineDrainRulePodSelectorApplyConfiguration { + b.NamespaceSelector = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinedrainrulespec.go b/util/applyconfigurations/core/v1beta2/machinedrainrulespec.go new file mode 100644 index 000000000000..9942fc25dcf6 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinedrainrulespec.go @@ -0,0 +1,103 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachineDrainRuleSpecApplyConfiguration represents a declarative configuration of the MachineDrainRuleSpec type for use +// with apply. +// +// MachineDrainRuleSpec defines the spec of a MachineDrainRule. +type MachineDrainRuleSpecApplyConfiguration struct { + // drain configures if and how Pods are drained. + Drain *MachineDrainRuleDrainConfigApplyConfiguration `json:"drain,omitempty"` + // machines defines to which Machines this MachineDrainRule should be applied. + // + // If machines is not set, the MachineDrainRule applies to all Machines in the Namespace. + // If machines contains multiple selectors, the results are ORed. + // Within a single Machine selector the results of selector and clusterSelector are ANDed. + // Machines will be selected from all Clusters in the Namespace unless otherwise + // restricted with the clusterSelector. + // + // Example: Selects control plane Machines in all Clusters or + // Machines with label "os" == "linux" in Clusters with label + // "stage" == "production". + // + // - selector: + // matchExpressions: + // - key: cluster.x-k8s.io/control-plane + // operator: Exists + // - selector: + // matchLabels: + // os: linux + // clusterSelector: + // matchExpressions: + // - key: stage + // operator: In + // values: + // - production + Machines []MachineDrainRuleMachineSelectorApplyConfiguration `json:"machines,omitempty"` + // pods defines to which Pods this MachineDrainRule should be applied. + // + // If pods is not set, the MachineDrainRule applies to all Pods in all Namespaces. + // If pods contains multiple selectors, the results are ORed. + // Within a single Pod selector the results of selector and namespaceSelector are ANDed. + // Pods will be selected from all Namespaces unless otherwise + // restricted with the namespaceSelector. + // + // Example: Selects Pods with label "app" == "logging" in all Namespaces or + // Pods with label "app" == "prometheus" in the "monitoring" + // Namespace. + // + // - selector: + // matchExpressions: + // - key: app + // operator: In + // values: + // - logging + // - selector: + // matchLabels: + // app: prometheus + // namespaceSelector: + // matchLabels: + // kubernetes.io/metadata.name: monitoring + Pods []MachineDrainRulePodSelectorApplyConfiguration `json:"pods,omitempty"` +} + +// MachineDrainRuleSpecApplyConfiguration constructs a declarative configuration of the MachineDrainRuleSpec type for use with +// apply. +func MachineDrainRuleSpec() *MachineDrainRuleSpecApplyConfiguration { + return &MachineDrainRuleSpecApplyConfiguration{} +} + +// WithDrain sets the Drain field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Drain field is set to the value of the last call. +func (b *MachineDrainRuleSpecApplyConfiguration) WithDrain(value *MachineDrainRuleDrainConfigApplyConfiguration) *MachineDrainRuleSpecApplyConfiguration { + b.Drain = value + return b +} + +// WithMachines adds the given value to the Machines field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Machines field. +func (b *MachineDrainRuleSpecApplyConfiguration) WithMachines(values ...*MachineDrainRuleMachineSelectorApplyConfiguration) *MachineDrainRuleSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithMachines") + } + b.Machines = append(b.Machines, *values[i]) + } + return b +} + +// WithPods adds the given value to the Pods field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Pods field. +func (b *MachineDrainRuleSpecApplyConfiguration) WithPods(values ...*MachineDrainRulePodSelectorApplyConfiguration) *MachineDrainRuleSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithPods") + } + b.Pods = append(b.Pods, *values[i]) + } + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinehealthcheck.go b/util/applyconfigurations/core/v1beta2/machinehealthcheck.go new file mode 100644 index 000000000000..37a7d4ab5df7 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinehealthcheck.go @@ -0,0 +1,277 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" + corev1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2" + internal "sigs.k8s.io/cluster-api/util/applyconfigurations/internal" +) + +// MachineHealthCheckApplyConfiguration represents a declarative configuration of the MachineHealthCheck type for use +// with apply. +// +// MachineHealthCheck is the Schema for the machinehealthchecks API. +type MachineHealthCheckApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + // metadata is the standard object's metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + // spec is the specification of machine health check policy + Spec *MachineHealthCheckSpecApplyConfiguration `json:"spec,omitempty"` + // status is the most recently observed status of MachineHealthCheck resource + Status *MachineHealthCheckStatusApplyConfiguration `json:"status,omitempty"` +} + +// MachineHealthCheck constructs a declarative configuration of the MachineHealthCheck type for use with +// apply. +func MachineHealthCheck(name, namespace string) *MachineHealthCheckApplyConfiguration { + b := &MachineHealthCheckApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("MachineHealthCheck") + b.WithAPIVersion("cluster.x-k8s.io/v1beta2") + return b +} + +// ExtractMachineHealthCheckFrom extracts the applied configuration owned by fieldManager from +// machineHealthCheck for the specified subresource. Pass an empty string for subresource to extract +// the main resource. Common subresources include "status", "scale", etc. +// machineHealthCheck must be a unmodified MachineHealthCheck API object that was retrieved from the Kubernetes API. +// ExtractMachineHealthCheckFrom provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractMachineHealthCheckFrom(machineHealthCheck *corev1beta2.MachineHealthCheck, fieldManager string, subresource string) (*MachineHealthCheckApplyConfiguration, error) { + b := &MachineHealthCheckApplyConfiguration{} + err := managedfields.ExtractInto(machineHealthCheck, internal.Parser().Type("io.k8s.sigs.cluster-api.api.core.v1beta2.MachineHealthCheck"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(machineHealthCheck.Name) + b.WithNamespace(machineHealthCheck.Namespace) + + b.WithKind("MachineHealthCheck") + b.WithAPIVersion("cluster.x-k8s.io/v1beta2") + return b, nil +} + +// ExtractMachineHealthCheck extracts the applied configuration owned by fieldManager from +// machineHealthCheck. If no managedFields are found in machineHealthCheck for fieldManager, a +// MachineHealthCheckApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// machineHealthCheck must be a unmodified MachineHealthCheck API object that was retrieved from the Kubernetes API. +// ExtractMachineHealthCheck provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractMachineHealthCheck(machineHealthCheck *corev1beta2.MachineHealthCheck, fieldManager string) (*MachineHealthCheckApplyConfiguration, error) { + return ExtractMachineHealthCheckFrom(machineHealthCheck, fieldManager, "") +} + +// ExtractMachineHealthCheckStatus extracts the applied configuration owned by fieldManager from +// machineHealthCheck for the status subresource. +func ExtractMachineHealthCheckStatus(machineHealthCheck *corev1beta2.MachineHealthCheck, fieldManager string) (*MachineHealthCheckApplyConfiguration, error) { + return ExtractMachineHealthCheckFrom(machineHealthCheck, fieldManager, "status") +} + +func (b MachineHealthCheckApplyConfiguration) IsApplyConfiguration() {} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *MachineHealthCheckApplyConfiguration) WithKind(value string) *MachineHealthCheckApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *MachineHealthCheckApplyConfiguration) WithAPIVersion(value string) *MachineHealthCheckApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *MachineHealthCheckApplyConfiguration) WithName(value string) *MachineHealthCheckApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *MachineHealthCheckApplyConfiguration) WithGenerateName(value string) *MachineHealthCheckApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *MachineHealthCheckApplyConfiguration) WithNamespace(value string) *MachineHealthCheckApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *MachineHealthCheckApplyConfiguration) WithUID(value types.UID) *MachineHealthCheckApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *MachineHealthCheckApplyConfiguration) WithResourceVersion(value string) *MachineHealthCheckApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *MachineHealthCheckApplyConfiguration) WithGeneration(value int64) *MachineHealthCheckApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *MachineHealthCheckApplyConfiguration) WithCreationTimestamp(value metav1.Time) *MachineHealthCheckApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *MachineHealthCheckApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *MachineHealthCheckApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *MachineHealthCheckApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *MachineHealthCheckApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *MachineHealthCheckApplyConfiguration) WithLabels(entries map[string]string) *MachineHealthCheckApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *MachineHealthCheckApplyConfiguration) WithAnnotations(entries map[string]string) *MachineHealthCheckApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *MachineHealthCheckApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *MachineHealthCheckApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *MachineHealthCheckApplyConfiguration) WithFinalizers(values ...string) *MachineHealthCheckApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *MachineHealthCheckApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *MachineHealthCheckApplyConfiguration) WithSpec(value *MachineHealthCheckSpecApplyConfiguration) *MachineHealthCheckApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *MachineHealthCheckApplyConfiguration) WithStatus(value *MachineHealthCheckStatusApplyConfiguration) *MachineHealthCheckApplyConfiguration { + b.Status = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *MachineHealthCheckApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *MachineHealthCheckApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *MachineHealthCheckApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *MachineHealthCheckApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/util/applyconfigurations/core/v1beta2/machinehealthcheckchecks.go b/util/applyconfigurations/core/v1beta2/machinehealthcheckchecks.go new file mode 100644 index 000000000000..f78721fdd48e --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinehealthcheckchecks.go @@ -0,0 +1,71 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachineHealthCheckChecksApplyConfiguration represents a declarative configuration of the MachineHealthCheckChecks type for use +// with apply. +// +// MachineHealthCheckChecks are the checks that are used to evaluate if a Machine is healthy. +type MachineHealthCheckChecksApplyConfiguration struct { + // nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck + // to consider a Machine unhealthy if a corresponding Node isn't associated + // through a `Spec.ProviderID` field. + // + // The duration set in this field is compared to the greatest of: + // - Cluster's infrastructure ready condition timestamp (if and when available) + // - Control Plane's initialized condition timestamp (if and when available) + // - Machine's infrastructure ready condition timestamp (if and when available) + // - Machine's metadata creation timestamp + // + // Defaults to 10 minutes. + // If you wish to disable this feature, set the value explicitly to 0. + NodeStartupTimeoutSeconds *int32 `json:"nodeStartupTimeoutSeconds,omitempty"` + // unhealthyNodeConditions contains a list of conditions that determine + // whether a node is considered unhealthy. The conditions are combined in a + // logical OR, i.e. if any of the conditions is met, the node is unhealthy. + UnhealthyNodeConditions []UnhealthyNodeConditionApplyConfiguration `json:"unhealthyNodeConditions,omitempty"` + // unhealthyMachineConditions contains a list of the machine conditions that determine + // whether a machine is considered unhealthy. The conditions are combined in a + // logical OR, i.e. if any of the conditions is met, the machine is unhealthy. + UnhealthyMachineConditions []UnhealthyMachineConditionApplyConfiguration `json:"unhealthyMachineConditions,omitempty"` +} + +// MachineHealthCheckChecksApplyConfiguration constructs a declarative configuration of the MachineHealthCheckChecks type for use with +// apply. +func MachineHealthCheckChecks() *MachineHealthCheckChecksApplyConfiguration { + return &MachineHealthCheckChecksApplyConfiguration{} +} + +// WithNodeStartupTimeoutSeconds sets the NodeStartupTimeoutSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeStartupTimeoutSeconds field is set to the value of the last call. +func (b *MachineHealthCheckChecksApplyConfiguration) WithNodeStartupTimeoutSeconds(value int32) *MachineHealthCheckChecksApplyConfiguration { + b.NodeStartupTimeoutSeconds = &value + return b +} + +// WithUnhealthyNodeConditions adds the given value to the UnhealthyNodeConditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the UnhealthyNodeConditions field. +func (b *MachineHealthCheckChecksApplyConfiguration) WithUnhealthyNodeConditions(values ...*UnhealthyNodeConditionApplyConfiguration) *MachineHealthCheckChecksApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithUnhealthyNodeConditions") + } + b.UnhealthyNodeConditions = append(b.UnhealthyNodeConditions, *values[i]) + } + return b +} + +// WithUnhealthyMachineConditions adds the given value to the UnhealthyMachineConditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the UnhealthyMachineConditions field. +func (b *MachineHealthCheckChecksApplyConfiguration) WithUnhealthyMachineConditions(values ...*UnhealthyMachineConditionApplyConfiguration) *MachineHealthCheckChecksApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithUnhealthyMachineConditions") + } + b.UnhealthyMachineConditions = append(b.UnhealthyMachineConditions, *values[i]) + } + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinehealthcheckdeprecatedstatus.go b/util/applyconfigurations/core/v1beta2/machinehealthcheckdeprecatedstatus.go new file mode 100644 index 000000000000..381265c6b8a4 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinehealthcheckdeprecatedstatus.go @@ -0,0 +1,27 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachineHealthCheckDeprecatedStatusApplyConfiguration represents a declarative configuration of the MachineHealthCheckDeprecatedStatus type for use +// with apply. +// +// MachineHealthCheckDeprecatedStatus groups all the status fields that are deprecated and will be removed in a future version. +// See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context. +type MachineHealthCheckDeprecatedStatusApplyConfiguration struct { + // v1beta1 groups all the status fields that are deprecated and will be removed when support for v1beta1 will be dropped. + V1Beta1 *MachineHealthCheckV1Beta1DeprecatedStatusApplyConfiguration `json:"v1beta1,omitempty"` +} + +// MachineHealthCheckDeprecatedStatusApplyConfiguration constructs a declarative configuration of the MachineHealthCheckDeprecatedStatus type for use with +// apply. +func MachineHealthCheckDeprecatedStatus() *MachineHealthCheckDeprecatedStatusApplyConfiguration { + return &MachineHealthCheckDeprecatedStatusApplyConfiguration{} +} + +// WithV1Beta1 sets the V1Beta1 field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the V1Beta1 field is set to the value of the last call. +func (b *MachineHealthCheckDeprecatedStatusApplyConfiguration) WithV1Beta1(value *MachineHealthCheckV1Beta1DeprecatedStatusApplyConfiguration) *MachineHealthCheckDeprecatedStatusApplyConfiguration { + b.V1Beta1 = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinehealthcheckremediation.go b/util/applyconfigurations/core/v1beta2/machinehealthcheckremediation.go new file mode 100644 index 000000000000..965d286145af --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinehealthcheckremediation.go @@ -0,0 +1,42 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachineHealthCheckRemediationApplyConfiguration represents a declarative configuration of the MachineHealthCheckRemediation type for use +// with apply. +// +// MachineHealthCheckRemediation configures if and how remediations are triggered if a Machine is unhealthy. +type MachineHealthCheckRemediationApplyConfiguration struct { + // triggerIf configures if remediations are triggered. + // If this field is not set, remediations are always triggered. + TriggerIf *MachineHealthCheckRemediationTriggerIfApplyConfiguration `json:"triggerIf,omitempty"` + // templateRef is a reference to a remediation template + // provided by an infrastructure provider. + // + // This field is completely optional, when filled, the MachineHealthCheck controller + // creates a new object from the template referenced and hands off remediation of the machine to + // a controller that lives outside of Cluster API. + TemplateRef *MachineHealthCheckRemediationTemplateReferenceApplyConfiguration `json:"templateRef,omitempty"` +} + +// MachineHealthCheckRemediationApplyConfiguration constructs a declarative configuration of the MachineHealthCheckRemediation type for use with +// apply. +func MachineHealthCheckRemediation() *MachineHealthCheckRemediationApplyConfiguration { + return &MachineHealthCheckRemediationApplyConfiguration{} +} + +// WithTriggerIf sets the TriggerIf field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TriggerIf field is set to the value of the last call. +func (b *MachineHealthCheckRemediationApplyConfiguration) WithTriggerIf(value *MachineHealthCheckRemediationTriggerIfApplyConfiguration) *MachineHealthCheckRemediationApplyConfiguration { + b.TriggerIf = value + return b +} + +// WithTemplateRef sets the TemplateRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TemplateRef field is set to the value of the last call. +func (b *MachineHealthCheckRemediationApplyConfiguration) WithTemplateRef(value *MachineHealthCheckRemediationTemplateReferenceApplyConfiguration) *MachineHealthCheckRemediationApplyConfiguration { + b.TemplateRef = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinehealthcheckremediationtemplatereference.go b/util/applyconfigurations/core/v1beta2/machinehealthcheckremediationtemplatereference.go new file mode 100644 index 000000000000..dc50a2b2582f --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinehealthcheckremediationtemplatereference.go @@ -0,0 +1,50 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachineHealthCheckRemediationTemplateReferenceApplyConfiguration represents a declarative configuration of the MachineHealthCheckRemediationTemplateReference type for use +// with apply. +// +// MachineHealthCheckRemediationTemplateReference is a reference to a remediation template. +type MachineHealthCheckRemediationTemplateReferenceApplyConfiguration struct { + // kind of the remediation template. + // kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character. + Kind *string `json:"kind,omitempty"` + // name of the remediation template. + // name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character. + Name *string `json:"name,omitempty"` + // apiVersion of the remediation template. + // apiVersion must be fully qualified domain name followed by / and a version. + // NOTE: This field must be kept in sync with the APIVersion of the remediation template. + APIVersion *string `json:"apiVersion,omitempty"` +} + +// MachineHealthCheckRemediationTemplateReferenceApplyConfiguration constructs a declarative configuration of the MachineHealthCheckRemediationTemplateReference type for use with +// apply. +func MachineHealthCheckRemediationTemplateReference() *MachineHealthCheckRemediationTemplateReferenceApplyConfiguration { + return &MachineHealthCheckRemediationTemplateReferenceApplyConfiguration{} +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *MachineHealthCheckRemediationTemplateReferenceApplyConfiguration) WithKind(value string) *MachineHealthCheckRemediationTemplateReferenceApplyConfiguration { + b.Kind = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *MachineHealthCheckRemediationTemplateReferenceApplyConfiguration) WithName(value string) *MachineHealthCheckRemediationTemplateReferenceApplyConfiguration { + b.Name = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *MachineHealthCheckRemediationTemplateReferenceApplyConfiguration) WithAPIVersion(value string) *MachineHealthCheckRemediationTemplateReferenceApplyConfiguration { + b.APIVersion = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinehealthcheckremediationtriggerif.go b/util/applyconfigurations/core/v1beta2/machinehealthcheckremediationtriggerif.go new file mode 100644 index 000000000000..87cf026eebbe --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinehealthcheckremediationtriggerif.go @@ -0,0 +1,47 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// MachineHealthCheckRemediationTriggerIfApplyConfiguration represents a declarative configuration of the MachineHealthCheckRemediationTriggerIf type for use +// with apply. +// +// MachineHealthCheckRemediationTriggerIf configures if remediations are triggered. +type MachineHealthCheckRemediationTriggerIfApplyConfiguration struct { + // unhealthyLessThanOrEqualTo specifies that remediations are only triggered if the number of + // unhealthy Machines is less than or equal to the configured value. + // unhealthyInRange takes precedence if set. + UnhealthyLessThanOrEqualTo *intstr.IntOrString `json:"unhealthyLessThanOrEqualTo,omitempty"` + // unhealthyInRange specifies that remediations are only triggered if the number of + // unhealthy Machines is in the configured range. + // Takes precedence over unhealthyLessThanOrEqualTo. + // Eg. "[3-5]" - This means that remediation will be allowed only when: + // (a) there are at least 3 unhealthy Machines (and) + // (b) there are at most 5 unhealthy Machines + UnhealthyInRange *string `json:"unhealthyInRange,omitempty"` +} + +// MachineHealthCheckRemediationTriggerIfApplyConfiguration constructs a declarative configuration of the MachineHealthCheckRemediationTriggerIf type for use with +// apply. +func MachineHealthCheckRemediationTriggerIf() *MachineHealthCheckRemediationTriggerIfApplyConfiguration { + return &MachineHealthCheckRemediationTriggerIfApplyConfiguration{} +} + +// WithUnhealthyLessThanOrEqualTo sets the UnhealthyLessThanOrEqualTo field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UnhealthyLessThanOrEqualTo field is set to the value of the last call. +func (b *MachineHealthCheckRemediationTriggerIfApplyConfiguration) WithUnhealthyLessThanOrEqualTo(value intstr.IntOrString) *MachineHealthCheckRemediationTriggerIfApplyConfiguration { + b.UnhealthyLessThanOrEqualTo = &value + return b +} + +// WithUnhealthyInRange sets the UnhealthyInRange field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UnhealthyInRange field is set to the value of the last call. +func (b *MachineHealthCheckRemediationTriggerIfApplyConfiguration) WithUnhealthyInRange(value string) *MachineHealthCheckRemediationTriggerIfApplyConfiguration { + b.UnhealthyInRange = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinehealthcheckspec.go b/util/applyconfigurations/core/v1beta2/machinehealthcheckspec.go new file mode 100644 index 000000000000..98ec34b36b49 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinehealthcheckspec.go @@ -0,0 +1,74 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// MachineHealthCheckSpecApplyConfiguration represents a declarative configuration of the MachineHealthCheckSpec type for use +// with apply. +// +// MachineHealthCheckSpec defines the desired state of MachineHealthCheck. +type MachineHealthCheckSpecApplyConfiguration struct { + // clusterName is the name of the Cluster this object belongs to. + ClusterName *string `json:"clusterName,omitempty"` + // selector is a label selector to match machines whose health will be exercised + Selector *v1.LabelSelectorApplyConfiguration `json:"selector,omitempty"` + // checks are the checks that are used to evaluate if a Machine is healthy. + // + // Independent of this configuration the MachineHealthCheck controller will always + // flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and + // Machines with deleted Nodes as unhealthy. + // + // Furthermore, if checks.nodeStartupTimeoutSeconds is not set it + // is defaulted to 10 minutes and evaluated accordingly. + Checks *MachineHealthCheckChecksApplyConfiguration `json:"checks,omitempty"` + // remediation configures if and how remediations are triggered if a Machine is unhealthy. + // + // If remediation or remediation.triggerIf is not set, + // remediation will always be triggered for unhealthy Machines. + // + // If remediation or remediation.templateRef is not set, + // the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via + // the owner of the Machines, for example a MachineSet or a KubeadmControlPlane. + Remediation *MachineHealthCheckRemediationApplyConfiguration `json:"remediation,omitempty"` +} + +// MachineHealthCheckSpecApplyConfiguration constructs a declarative configuration of the MachineHealthCheckSpec type for use with +// apply. +func MachineHealthCheckSpec() *MachineHealthCheckSpecApplyConfiguration { + return &MachineHealthCheckSpecApplyConfiguration{} +} + +// WithClusterName sets the ClusterName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ClusterName field is set to the value of the last call. +func (b *MachineHealthCheckSpecApplyConfiguration) WithClusterName(value string) *MachineHealthCheckSpecApplyConfiguration { + b.ClusterName = &value + return b +} + +// WithSelector sets the Selector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Selector field is set to the value of the last call. +func (b *MachineHealthCheckSpecApplyConfiguration) WithSelector(value *v1.LabelSelectorApplyConfiguration) *MachineHealthCheckSpecApplyConfiguration { + b.Selector = value + return b +} + +// WithChecks sets the Checks field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Checks field is set to the value of the last call. +func (b *MachineHealthCheckSpecApplyConfiguration) WithChecks(value *MachineHealthCheckChecksApplyConfiguration) *MachineHealthCheckSpecApplyConfiguration { + b.Checks = value + return b +} + +// WithRemediation sets the Remediation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Remediation field is set to the value of the last call. +func (b *MachineHealthCheckSpecApplyConfiguration) WithRemediation(value *MachineHealthCheckRemediationApplyConfiguration) *MachineHealthCheckSpecApplyConfiguration { + b.Remediation = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinehealthcheckstatus.go b/util/applyconfigurations/core/v1beta2/machinehealthcheckstatus.go new file mode 100644 index 000000000000..0f3ca46142a8 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinehealthcheckstatus.go @@ -0,0 +1,99 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// MachineHealthCheckStatusApplyConfiguration represents a declarative configuration of the MachineHealthCheckStatus type for use +// with apply. +// +// MachineHealthCheckStatus defines the observed state of MachineHealthCheck. +type MachineHealthCheckStatusApplyConfiguration struct { + // conditions represents the observations of a MachineHealthCheck's current state. + // Known condition types are RemediationAllowed, Paused. + Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"` + // expectedMachines is the total number of machines counted by this machine health check + ExpectedMachines *int32 `json:"expectedMachines,omitempty"` + // currentHealthy is the total number of healthy machines counted by this machine health check + CurrentHealthy *int32 `json:"currentHealthy,omitempty"` + // remediationsAllowed is the number of further remediations allowed by this machine health check before + // maxUnhealthy short circuiting will be applied + RemediationsAllowed *int32 `json:"remediationsAllowed,omitempty"` + // observedGeneration is the latest generation observed by the controller. + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` + // targets shows the current list of machines the machine health check is watching + Targets []string `json:"targets,omitempty"` + // deprecated groups all the status fields that are deprecated and will be removed when all the nested field are removed. + Deprecated *MachineHealthCheckDeprecatedStatusApplyConfiguration `json:"deprecated,omitempty"` +} + +// MachineHealthCheckStatusApplyConfiguration constructs a declarative configuration of the MachineHealthCheckStatus type for use with +// apply. +func MachineHealthCheckStatus() *MachineHealthCheckStatusApplyConfiguration { + return &MachineHealthCheckStatusApplyConfiguration{} +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *MachineHealthCheckStatusApplyConfiguration) WithConditions(values ...*v1.ConditionApplyConfiguration) *MachineHealthCheckStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithExpectedMachines sets the ExpectedMachines field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ExpectedMachines field is set to the value of the last call. +func (b *MachineHealthCheckStatusApplyConfiguration) WithExpectedMachines(value int32) *MachineHealthCheckStatusApplyConfiguration { + b.ExpectedMachines = &value + return b +} + +// WithCurrentHealthy sets the CurrentHealthy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CurrentHealthy field is set to the value of the last call. +func (b *MachineHealthCheckStatusApplyConfiguration) WithCurrentHealthy(value int32) *MachineHealthCheckStatusApplyConfiguration { + b.CurrentHealthy = &value + return b +} + +// WithRemediationsAllowed sets the RemediationsAllowed field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RemediationsAllowed field is set to the value of the last call. +func (b *MachineHealthCheckStatusApplyConfiguration) WithRemediationsAllowed(value int32) *MachineHealthCheckStatusApplyConfiguration { + b.RemediationsAllowed = &value + return b +} + +// WithObservedGeneration sets the ObservedGeneration field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ObservedGeneration field is set to the value of the last call. +func (b *MachineHealthCheckStatusApplyConfiguration) WithObservedGeneration(value int64) *MachineHealthCheckStatusApplyConfiguration { + b.ObservedGeneration = &value + return b +} + +// WithTargets adds the given value to the Targets field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Targets field. +func (b *MachineHealthCheckStatusApplyConfiguration) WithTargets(values ...string) *MachineHealthCheckStatusApplyConfiguration { + for i := range values { + b.Targets = append(b.Targets, values[i]) + } + return b +} + +// WithDeprecated sets the Deprecated field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Deprecated field is set to the value of the last call. +func (b *MachineHealthCheckStatusApplyConfiguration) WithDeprecated(value *MachineHealthCheckDeprecatedStatusApplyConfiguration) *MachineHealthCheckStatusApplyConfiguration { + b.Deprecated = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinehealthcheckv1beta1deprecatedstatus.go b/util/applyconfigurations/core/v1beta2/machinehealthcheckv1beta1deprecatedstatus.go new file mode 100644 index 000000000000..0d434ba06146 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinehealthcheckv1beta1deprecatedstatus.go @@ -0,0 +1,33 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + corev1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2" +) + +// MachineHealthCheckV1Beta1DeprecatedStatusApplyConfiguration represents a declarative configuration of the MachineHealthCheckV1Beta1DeprecatedStatus type for use +// with apply. +// +// MachineHealthCheckV1Beta1DeprecatedStatus 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 MachineHealthCheckV1Beta1DeprecatedStatusApplyConfiguration struct { + // conditions defines current service state of the MachineHealthCheck. + // + // 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. + Conditions *corev1beta2.Conditions `json:"conditions,omitempty"` +} + +// MachineHealthCheckV1Beta1DeprecatedStatusApplyConfiguration constructs a declarative configuration of the MachineHealthCheckV1Beta1DeprecatedStatus type for use with +// apply. +func MachineHealthCheckV1Beta1DeprecatedStatus() *MachineHealthCheckV1Beta1DeprecatedStatusApplyConfiguration { + return &MachineHealthCheckV1Beta1DeprecatedStatusApplyConfiguration{} +} + +// WithConditions sets the Conditions field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Conditions field is set to the value of the last call. +func (b *MachineHealthCheckV1Beta1DeprecatedStatusApplyConfiguration) WithConditions(value corev1beta2.Conditions) *MachineHealthCheckV1Beta1DeprecatedStatusApplyConfiguration { + b.Conditions = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machineinitializationstatus.go b/util/applyconfigurations/core/v1beta2/machineinitializationstatus.go new file mode 100644 index 000000000000..fe48d91a1890 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machineinitializationstatus.go @@ -0,0 +1,41 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachineInitializationStatusApplyConfiguration represents a declarative configuration of the MachineInitializationStatus type for use +// with apply. +// +// MachineInitializationStatus provides observations of the Machine initialization process. +// NOTE: Fields in this struct are part of the Cluster API contract and are used to orchestrate initial Machine provisioning. +type MachineInitializationStatusApplyConfiguration struct { + // infrastructureProvisioned is true when the infrastructure provider reports that Machine's infrastructure is fully provisioned. + // NOTE: this field is part of the Cluster API contract, and it is used to orchestrate provisioning. + // The value of this field is never updated after provisioning is completed. + InfrastructureProvisioned *bool `json:"infrastructureProvisioned,omitempty"` + // bootstrapDataSecretCreated is true when the bootstrap provider reports that the Machine's boostrap secret is created. + // NOTE: this field is part of the Cluster API contract, and it is used to orchestrate provisioning. + // The value of this field is never updated after provisioning is completed. + BootstrapDataSecretCreated *bool `json:"bootstrapDataSecretCreated,omitempty"` +} + +// MachineInitializationStatusApplyConfiguration constructs a declarative configuration of the MachineInitializationStatus type for use with +// apply. +func MachineInitializationStatus() *MachineInitializationStatusApplyConfiguration { + return &MachineInitializationStatusApplyConfiguration{} +} + +// WithInfrastructureProvisioned sets the InfrastructureProvisioned field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the InfrastructureProvisioned field is set to the value of the last call. +func (b *MachineInitializationStatusApplyConfiguration) WithInfrastructureProvisioned(value bool) *MachineInitializationStatusApplyConfiguration { + b.InfrastructureProvisioned = &value + return b +} + +// WithBootstrapDataSecretCreated sets the BootstrapDataSecretCreated field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the BootstrapDataSecretCreated field is set to the value of the last call. +func (b *MachineInitializationStatusApplyConfiguration) WithBootstrapDataSecretCreated(value bool) *MachineInitializationStatusApplyConfiguration { + b.BootstrapDataSecretCreated = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinenamingspec.go b/util/applyconfigurations/core/v1beta2/machinenamingspec.go new file mode 100644 index 000000000000..a34289c7e174 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinenamingspec.go @@ -0,0 +1,43 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachineNamingSpecApplyConfiguration represents a declarative configuration of the MachineNamingSpec type for use +// with apply. +// +// MachineNamingSpec allows changing the naming pattern used when creating +// Machines. +// Note: InfraMachines & BootstrapConfigs will use the same name as the corresponding Machines. +type MachineNamingSpecApplyConfiguration struct { + // template defines the template to use for generating the names of the + // Machine objects. + // If not defined, it will fallback to `{{ .machineSet.name }}-{{ .random }}`. + // If the generated name string exceeds 63 characters, it will be trimmed to + // 58 characters and will + // get concatenated with a random suffix of length 5. + // Length of the template string must not exceed 256 characters. + // The template allows the following variables `.cluster.name`, + // `.machineSet.name` and `.random`. + // The variable `.cluster.name` retrieves the name of the cluster object + // that owns the Machines being created. + // The variable `.machineSet.name` retrieves the name of the MachineSet + // object that owns the Machines being created. + // The variable `.random` is substituted with random alphanumeric string, + // without vowels, of length 5. This variable is required part of the + // template. If not provided, validation will fail. + Template *string `json:"template,omitempty"` +} + +// MachineNamingSpecApplyConfiguration constructs a declarative configuration of the MachineNamingSpec type for use with +// apply. +func MachineNamingSpec() *MachineNamingSpecApplyConfiguration { + return &MachineNamingSpecApplyConfiguration{} +} + +// WithTemplate sets the Template field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Template field is set to the value of the last call. +func (b *MachineNamingSpecApplyConfiguration) WithTemplate(value string) *MachineNamingSpecApplyConfiguration { + b.Template = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinenodereference.go b/util/applyconfigurations/core/v1beta2/machinenodereference.go new file mode 100644 index 000000000000..3922c78fdd94 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinenodereference.go @@ -0,0 +1,27 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachineNodeReferenceApplyConfiguration represents a declarative configuration of the MachineNodeReference type for use +// with apply. +// +// MachineNodeReference is a reference to the node running on the machine. +type MachineNodeReferenceApplyConfiguration struct { + // name of the node. + // name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character. + Name *string `json:"name,omitempty"` +} + +// MachineNodeReferenceApplyConfiguration constructs a declarative configuration of the MachineNodeReference type for use with +// apply. +func MachineNodeReference() *MachineNodeReferenceApplyConfiguration { + return &MachineNodeReferenceApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *MachineNodeReferenceApplyConfiguration) WithName(value string) *MachineNodeReferenceApplyConfiguration { + b.Name = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinepool.go b/util/applyconfigurations/core/v1beta2/machinepool.go new file mode 100644 index 000000000000..60f8e2310366 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinepool.go @@ -0,0 +1,278 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" + corev1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2" + internal "sigs.k8s.io/cluster-api/util/applyconfigurations/internal" +) + +// MachinePoolApplyConfiguration represents a declarative configuration of the MachinePool type for use +// with apply. +// +// MachinePool is the Schema for the machinepools API. +// NOTE: This CRD can only be used if the MachinePool feature gate is enabled. +type MachinePoolApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + // metadata is the standard object's metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + // spec is the desired state of MachinePool. + Spec *MachinePoolSpecApplyConfiguration `json:"spec,omitempty"` + // status is the observed state of MachinePool. + Status *MachinePoolStatusApplyConfiguration `json:"status,omitempty"` +} + +// MachinePool constructs a declarative configuration of the MachinePool type for use with +// apply. +func MachinePool(name, namespace string) *MachinePoolApplyConfiguration { + b := &MachinePoolApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("MachinePool") + b.WithAPIVersion("cluster.x-k8s.io/v1beta2") + return b +} + +// ExtractMachinePoolFrom extracts the applied configuration owned by fieldManager from +// machinePool for the specified subresource. Pass an empty string for subresource to extract +// the main resource. Common subresources include "status", "scale", etc. +// machinePool must be a unmodified MachinePool API object that was retrieved from the Kubernetes API. +// ExtractMachinePoolFrom provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractMachinePoolFrom(machinePool *corev1beta2.MachinePool, fieldManager string, subresource string) (*MachinePoolApplyConfiguration, error) { + b := &MachinePoolApplyConfiguration{} + err := managedfields.ExtractInto(machinePool, internal.Parser().Type("io.k8s.sigs.cluster-api.api.core.v1beta2.MachinePool"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(machinePool.Name) + b.WithNamespace(machinePool.Namespace) + + b.WithKind("MachinePool") + b.WithAPIVersion("cluster.x-k8s.io/v1beta2") + return b, nil +} + +// ExtractMachinePool extracts the applied configuration owned by fieldManager from +// machinePool. If no managedFields are found in machinePool for fieldManager, a +// MachinePoolApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// machinePool must be a unmodified MachinePool API object that was retrieved from the Kubernetes API. +// ExtractMachinePool provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractMachinePool(machinePool *corev1beta2.MachinePool, fieldManager string) (*MachinePoolApplyConfiguration, error) { + return ExtractMachinePoolFrom(machinePool, fieldManager, "") +} + +// ExtractMachinePoolStatus extracts the applied configuration owned by fieldManager from +// machinePool for the status subresource. +func ExtractMachinePoolStatus(machinePool *corev1beta2.MachinePool, fieldManager string) (*MachinePoolApplyConfiguration, error) { + return ExtractMachinePoolFrom(machinePool, fieldManager, "status") +} + +func (b MachinePoolApplyConfiguration) IsApplyConfiguration() {} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *MachinePoolApplyConfiguration) WithKind(value string) *MachinePoolApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *MachinePoolApplyConfiguration) WithAPIVersion(value string) *MachinePoolApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *MachinePoolApplyConfiguration) WithName(value string) *MachinePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *MachinePoolApplyConfiguration) WithGenerateName(value string) *MachinePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *MachinePoolApplyConfiguration) WithNamespace(value string) *MachinePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *MachinePoolApplyConfiguration) WithUID(value types.UID) *MachinePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *MachinePoolApplyConfiguration) WithResourceVersion(value string) *MachinePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *MachinePoolApplyConfiguration) WithGeneration(value int64) *MachinePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *MachinePoolApplyConfiguration) WithCreationTimestamp(value metav1.Time) *MachinePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *MachinePoolApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *MachinePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *MachinePoolApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *MachinePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *MachinePoolApplyConfiguration) WithLabels(entries map[string]string) *MachinePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *MachinePoolApplyConfiguration) WithAnnotations(entries map[string]string) *MachinePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *MachinePoolApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *MachinePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *MachinePoolApplyConfiguration) WithFinalizers(values ...string) *MachinePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *MachinePoolApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *MachinePoolApplyConfiguration) WithSpec(value *MachinePoolSpecApplyConfiguration) *MachinePoolApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *MachinePoolApplyConfiguration) WithStatus(value *MachinePoolStatusApplyConfiguration) *MachinePoolApplyConfiguration { + b.Status = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *MachinePoolApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *MachinePoolApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *MachinePoolApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *MachinePoolApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/util/applyconfigurations/core/v1beta2/machinepoolclass.go b/util/applyconfigurations/core/v1beta2/machinepoolclass.go new file mode 100644 index 000000000000..d9b2ea4dd463 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinepoolclass.go @@ -0,0 +1,110 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachinePoolClassApplyConfiguration represents a declarative configuration of the MachinePoolClass type for use +// with apply. +// +// MachinePoolClass serves as a template to define a pool of worker nodes of the cluster +// provisioned using `ClusterClass`. +type MachinePoolClassApplyConfiguration struct { + // metadata is the metadata applied to the MachinePool. + // At runtime this metadata is merged with the corresponding metadata from the topology. + Metadata *ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + // class denotes a type of machine pool present in the cluster, + // this name MUST be unique within a ClusterClass and can be referenced + // in the Cluster to create a managed MachinePool. + Class *string `json:"class,omitempty"` + // bootstrap contains the bootstrap template reference to be used + // for the creation of the Machines in the MachinePool. + Bootstrap *MachinePoolClassBootstrapTemplateApplyConfiguration `json:"bootstrap,omitempty"` + // infrastructure contains the infrastructure template reference to be used + // for the creation of the MachinePool. + Infrastructure *MachinePoolClassInfrastructureTemplateApplyConfiguration `json:"infrastructure,omitempty"` + // failureDomains is the list of failure domains the MachinePool should be attached to. + // Must match a key in the FailureDomains map stored on the cluster object. + // NOTE: This value can be overridden while defining a Cluster.Topology using this MachinePoolClass. + FailureDomains []string `json:"failureDomains,omitempty"` + // naming allows changing the naming pattern used when creating the MachinePool. + Naming *MachinePoolClassNamingSpecApplyConfiguration `json:"naming,omitempty"` + // deletion contains configuration options for Machine deletion. + Deletion *MachinePoolClassMachineDeletionSpecApplyConfiguration `json:"deletion,omitempty"` + // minReadySeconds is the minimum number of seconds for which a newly created machine pool should + // be ready. + // Defaults to 0 (machine will be considered available as soon as it + // is ready) + // NOTE: This value can be overridden while defining a Cluster.Topology using this MachinePoolClass. + MinReadySeconds *int32 `json:"minReadySeconds,omitempty"` +} + +// MachinePoolClassApplyConfiguration constructs a declarative configuration of the MachinePoolClass type for use with +// apply. +func MachinePoolClass() *MachinePoolClassApplyConfiguration { + return &MachinePoolClassApplyConfiguration{} +} + +// WithMetadata sets the Metadata field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Metadata field is set to the value of the last call. +func (b *MachinePoolClassApplyConfiguration) WithMetadata(value *ObjectMetaApplyConfiguration) *MachinePoolClassApplyConfiguration { + b.Metadata = value + return b +} + +// WithClass sets the Class field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Class field is set to the value of the last call. +func (b *MachinePoolClassApplyConfiguration) WithClass(value string) *MachinePoolClassApplyConfiguration { + b.Class = &value + return b +} + +// WithBootstrap sets the Bootstrap field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Bootstrap field is set to the value of the last call. +func (b *MachinePoolClassApplyConfiguration) WithBootstrap(value *MachinePoolClassBootstrapTemplateApplyConfiguration) *MachinePoolClassApplyConfiguration { + b.Bootstrap = value + return b +} + +// WithInfrastructure sets the Infrastructure field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Infrastructure field is set to the value of the last call. +func (b *MachinePoolClassApplyConfiguration) WithInfrastructure(value *MachinePoolClassInfrastructureTemplateApplyConfiguration) *MachinePoolClassApplyConfiguration { + b.Infrastructure = value + return b +} + +// WithFailureDomains adds the given value to the FailureDomains field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the FailureDomains field. +func (b *MachinePoolClassApplyConfiguration) WithFailureDomains(values ...string) *MachinePoolClassApplyConfiguration { + for i := range values { + b.FailureDomains = append(b.FailureDomains, values[i]) + } + return b +} + +// WithNaming sets the Naming field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Naming field is set to the value of the last call. +func (b *MachinePoolClassApplyConfiguration) WithNaming(value *MachinePoolClassNamingSpecApplyConfiguration) *MachinePoolClassApplyConfiguration { + b.Naming = value + return b +} + +// WithDeletion sets the Deletion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Deletion field is set to the value of the last call. +func (b *MachinePoolClassApplyConfiguration) WithDeletion(value *MachinePoolClassMachineDeletionSpecApplyConfiguration) *MachinePoolClassApplyConfiguration { + b.Deletion = value + return b +} + +// WithMinReadySeconds sets the MinReadySeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinReadySeconds field is set to the value of the last call. +func (b *MachinePoolClassApplyConfiguration) WithMinReadySeconds(value int32) *MachinePoolClassApplyConfiguration { + b.MinReadySeconds = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinepoolclassbootstraptemplate.go b/util/applyconfigurations/core/v1beta2/machinepoolclassbootstraptemplate.go new file mode 100644 index 000000000000..179f080942fb --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinepoolclassbootstraptemplate.go @@ -0,0 +1,26 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachinePoolClassBootstrapTemplateApplyConfiguration represents a declarative configuration of the MachinePoolClassBootstrapTemplate type for use +// with apply. +// +// MachinePoolClassBootstrapTemplate defines the BootstrapTemplate for a MachinePool. +type MachinePoolClassBootstrapTemplateApplyConfiguration struct { + // templateRef is a required reference to the BootstrapTemplate for a MachinePool. + TemplateRef *ClusterClassTemplateReferenceApplyConfiguration `json:"templateRef,omitempty"` +} + +// MachinePoolClassBootstrapTemplateApplyConfiguration constructs a declarative configuration of the MachinePoolClassBootstrapTemplate type for use with +// apply. +func MachinePoolClassBootstrapTemplate() *MachinePoolClassBootstrapTemplateApplyConfiguration { + return &MachinePoolClassBootstrapTemplateApplyConfiguration{} +} + +// WithTemplateRef sets the TemplateRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TemplateRef field is set to the value of the last call. +func (b *MachinePoolClassBootstrapTemplateApplyConfiguration) WithTemplateRef(value *ClusterClassTemplateReferenceApplyConfiguration) *MachinePoolClassBootstrapTemplateApplyConfiguration { + b.TemplateRef = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinepoolclassinfrastructuretemplate.go b/util/applyconfigurations/core/v1beta2/machinepoolclassinfrastructuretemplate.go new file mode 100644 index 000000000000..c81fedc7934c --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinepoolclassinfrastructuretemplate.go @@ -0,0 +1,26 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachinePoolClassInfrastructureTemplateApplyConfiguration represents a declarative configuration of the MachinePoolClassInfrastructureTemplate type for use +// with apply. +// +// MachinePoolClassInfrastructureTemplate defines the InfrastructureTemplate for a MachinePool. +type MachinePoolClassInfrastructureTemplateApplyConfiguration struct { + // templateRef is a required reference to the InfrastructureTemplate for a MachinePool. + TemplateRef *ClusterClassTemplateReferenceApplyConfiguration `json:"templateRef,omitempty"` +} + +// MachinePoolClassInfrastructureTemplateApplyConfiguration constructs a declarative configuration of the MachinePoolClassInfrastructureTemplate type for use with +// apply. +func MachinePoolClassInfrastructureTemplate() *MachinePoolClassInfrastructureTemplateApplyConfiguration { + return &MachinePoolClassInfrastructureTemplateApplyConfiguration{} +} + +// WithTemplateRef sets the TemplateRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TemplateRef field is set to the value of the last call. +func (b *MachinePoolClassInfrastructureTemplateApplyConfiguration) WithTemplateRef(value *ClusterClassTemplateReferenceApplyConfiguration) *MachinePoolClassInfrastructureTemplateApplyConfiguration { + b.TemplateRef = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinepoolclassmachinedeletionspec.go b/util/applyconfigurations/core/v1beta2/machinepoolclassmachinedeletionspec.go new file mode 100644 index 000000000000..b235eadc62f8 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinepoolclassmachinedeletionspec.go @@ -0,0 +1,54 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachinePoolClassMachineDeletionSpecApplyConfiguration represents a declarative configuration of the MachinePoolClassMachineDeletionSpec type for use +// with apply. +// +// MachinePoolClassMachineDeletionSpec contains configuration options for Machine deletion. +type MachinePoolClassMachineDeletionSpecApplyConfiguration struct { + // nodeDrainTimeoutSeconds is the total amount of time that the controller will spend on draining a node. + // The default value is 0, meaning that the node can be drained without any time limitations. + // NOTE: nodeDrainTimeoutSeconds is different from `kubectl drain --timeout` + // NOTE: This value can be overridden while defining a Cluster.Topology using this MachinePoolClass. + NodeDrainTimeoutSeconds *int32 `json:"nodeDrainTimeoutSeconds,omitempty"` + // nodeVolumeDetachTimeoutSeconds is the total amount of time that the controller will spend on waiting for all volumes + // to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations. + // NOTE: This value can be overridden while defining a Cluster.Topology using this MachinePoolClass. + NodeVolumeDetachTimeoutSeconds *int32 `json:"nodeVolumeDetachTimeoutSeconds,omitempty"` + // nodeDeletionTimeoutSeconds defines how long the controller will attempt to delete the Node that the Machine + // hosts after the Machine Pool is marked for deletion. A duration of 0 will retry deletion indefinitely. + // Defaults to 10 seconds. + // NOTE: This value can be overridden while defining a Cluster.Topology using this MachinePoolClass. + NodeDeletionTimeoutSeconds *int32 `json:"nodeDeletionTimeoutSeconds,omitempty"` +} + +// MachinePoolClassMachineDeletionSpecApplyConfiguration constructs a declarative configuration of the MachinePoolClassMachineDeletionSpec type for use with +// apply. +func MachinePoolClassMachineDeletionSpec() *MachinePoolClassMachineDeletionSpecApplyConfiguration { + return &MachinePoolClassMachineDeletionSpecApplyConfiguration{} +} + +// WithNodeDrainTimeoutSeconds sets the NodeDrainTimeoutSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeDrainTimeoutSeconds field is set to the value of the last call. +func (b *MachinePoolClassMachineDeletionSpecApplyConfiguration) WithNodeDrainTimeoutSeconds(value int32) *MachinePoolClassMachineDeletionSpecApplyConfiguration { + b.NodeDrainTimeoutSeconds = &value + return b +} + +// WithNodeVolumeDetachTimeoutSeconds sets the NodeVolumeDetachTimeoutSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeVolumeDetachTimeoutSeconds field is set to the value of the last call. +func (b *MachinePoolClassMachineDeletionSpecApplyConfiguration) WithNodeVolumeDetachTimeoutSeconds(value int32) *MachinePoolClassMachineDeletionSpecApplyConfiguration { + b.NodeVolumeDetachTimeoutSeconds = &value + return b +} + +// WithNodeDeletionTimeoutSeconds sets the NodeDeletionTimeoutSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeDeletionTimeoutSeconds field is set to the value of the last call. +func (b *MachinePoolClassMachineDeletionSpecApplyConfiguration) WithNodeDeletionTimeoutSeconds(value int32) *MachinePoolClassMachineDeletionSpecApplyConfiguration { + b.NodeDeletionTimeoutSeconds = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinepoolclassnamingspec.go b/util/applyconfigurations/core/v1beta2/machinepoolclassnamingspec.go new file mode 100644 index 000000000000..6c69dc2af3a5 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinepoolclassnamingspec.go @@ -0,0 +1,33 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachinePoolClassNamingSpecApplyConfiguration represents a declarative configuration of the MachinePoolClassNamingSpec type for use +// with apply. +// +// MachinePoolClassNamingSpec defines the naming strategy for MachinePool objects. +type MachinePoolClassNamingSpecApplyConfiguration struct { + // template defines the template to use for generating the name of the MachinePool object. + // If not defined, it will fallback to `{{ .cluster.name }}-{{ .machinePool.topologyName }}-{{ .random }}`. + // If the templated string exceeds 63 characters, it will be trimmed to 58 characters and will + // get concatenated with a random suffix of length 5. + // The templating mechanism provides the following arguments: + // * `.cluster.name`: The name of the cluster object. + // * `.random`: A random alphanumeric string, without vowels, of length 5. + // * `.machinePool.topologyName`: The name of the MachinePool topology (Cluster.spec.topology.workers.machinePools[].name). + Template *string `json:"template,omitempty"` +} + +// MachinePoolClassNamingSpecApplyConfiguration constructs a declarative configuration of the MachinePoolClassNamingSpec type for use with +// apply. +func MachinePoolClassNamingSpec() *MachinePoolClassNamingSpecApplyConfiguration { + return &MachinePoolClassNamingSpecApplyConfiguration{} +} + +// WithTemplate sets the Template field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Template field is set to the value of the last call. +func (b *MachinePoolClassNamingSpecApplyConfiguration) WithTemplate(value string) *MachinePoolClassNamingSpecApplyConfiguration { + b.Template = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinepooldeprecatedstatus.go b/util/applyconfigurations/core/v1beta2/machinepooldeprecatedstatus.go new file mode 100644 index 000000000000..35ee18e34966 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinepooldeprecatedstatus.go @@ -0,0 +1,27 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachinePoolDeprecatedStatusApplyConfiguration represents a declarative configuration of the MachinePoolDeprecatedStatus type for use +// with apply. +// +// MachinePoolDeprecatedStatus groups all the status fields that are deprecated and will be removed in a future version. +// See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context. +type MachinePoolDeprecatedStatusApplyConfiguration struct { + // v1beta1 groups all the status fields that are deprecated and will be removed when support for v1beta1 will be dropped. + V1Beta1 *MachinePoolV1Beta1DeprecatedStatusApplyConfiguration `json:"v1beta1,omitempty"` +} + +// MachinePoolDeprecatedStatusApplyConfiguration constructs a declarative configuration of the MachinePoolDeprecatedStatus type for use with +// apply. +func MachinePoolDeprecatedStatus() *MachinePoolDeprecatedStatusApplyConfiguration { + return &MachinePoolDeprecatedStatusApplyConfiguration{} +} + +// WithV1Beta1 sets the V1Beta1 field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the V1Beta1 field is set to the value of the last call. +func (b *MachinePoolDeprecatedStatusApplyConfiguration) WithV1Beta1(value *MachinePoolV1Beta1DeprecatedStatusApplyConfiguration) *MachinePoolDeprecatedStatusApplyConfiguration { + b.V1Beta1 = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinepoolinitializationstatus.go b/util/applyconfigurations/core/v1beta2/machinepoolinitializationstatus.go new file mode 100644 index 000000000000..e1b61fdff305 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinepoolinitializationstatus.go @@ -0,0 +1,41 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachinePoolInitializationStatusApplyConfiguration represents a declarative configuration of the MachinePoolInitializationStatus type for use +// with apply. +// +// MachinePoolInitializationStatus provides observations of the MachinePool initialization process. +// NOTE: Fields in this struct are part of the Cluster API contract and are used to orchestrate initial MachinePool provisioning. +type MachinePoolInitializationStatusApplyConfiguration struct { + // infrastructureProvisioned is true when the infrastructure provider reports that MachinePool's infrastructure is fully provisioned. + // NOTE: this field is part of the Cluster API contract, and it is used to orchestrate provisioning. + // The value of this field is never updated after provisioning is completed. + InfrastructureProvisioned *bool `json:"infrastructureProvisioned,omitempty"` + // bootstrapDataSecretCreated is true when the bootstrap provider reports that the MachinePool's boostrap secret is created. + // NOTE: this field is part of the Cluster API contract, and it is used to orchestrate provisioning. + // The value of this field is never updated after provisioning is completed. + BootstrapDataSecretCreated *bool `json:"bootstrapDataSecretCreated,omitempty"` +} + +// MachinePoolInitializationStatusApplyConfiguration constructs a declarative configuration of the MachinePoolInitializationStatus type for use with +// apply. +func MachinePoolInitializationStatus() *MachinePoolInitializationStatusApplyConfiguration { + return &MachinePoolInitializationStatusApplyConfiguration{} +} + +// WithInfrastructureProvisioned sets the InfrastructureProvisioned field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the InfrastructureProvisioned field is set to the value of the last call. +func (b *MachinePoolInitializationStatusApplyConfiguration) WithInfrastructureProvisioned(value bool) *MachinePoolInitializationStatusApplyConfiguration { + b.InfrastructureProvisioned = &value + return b +} + +// WithBootstrapDataSecretCreated sets the BootstrapDataSecretCreated field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the BootstrapDataSecretCreated field is set to the value of the last call. +func (b *MachinePoolInitializationStatusApplyConfiguration) WithBootstrapDataSecretCreated(value bool) *MachinePoolInitializationStatusApplyConfiguration { + b.BootstrapDataSecretCreated = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinepoolspec.go b/util/applyconfigurations/core/v1beta2/machinepoolspec.go new file mode 100644 index 000000000000..563f39fe80ed --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinepoolspec.go @@ -0,0 +1,105 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachinePoolSpecApplyConfiguration represents a declarative configuration of the MachinePoolSpec type for use +// with apply. +// +// NOTE: we are commenting const for MachinePool's V1Beta2 conditions and reasons because not yet implemented for the 1.9 CAPI release. +// However, we are keeping the v1beta2 struct in the MachinePool struct because the code that will collect conditions and replica +// counters at cluster level is already implemented. +// +// // Conditions that will be used for the MachinePool object in v1Beta2 API version. +// const ( +// // MachinePoolAvailableCondition is true when InfrastructureReady and available replicas >= desired replicas. +// MachinePoolAvailableCondition = clusterv1.AvailableCondition +// +// // MachinePoolBootstrapConfigReadyCondition mirrors the corresponding condition from the MachinePool's BootstrapConfig resource. +// MachinePoolBootstrapConfigReadyCondition = clusterv1.BootstrapConfigReadyCondition +// +// // MachinePoolInfrastructureReadyCondition mirrors the corresponding condition from the MachinePool's Infrastructure resource. +// MachinePoolInfrastructureReadyCondition = clusterv1.InfrastructureReadyCondition +// +// // MachinePoolMachinesReadyCondition surfaces detail of issues on the controlled machines, if any. +// MachinePoolMachinesReadyCondition = clusterv1.MachinesReadyCondition +// +// // MachinePoolMachinesUpToDateCondition surfaces details of controlled machines not up to date, if any. +// MachinePoolMachinesUpToDateCondition = clusterv1.MachinesUpToDateCondition +// +// // MachinePoolScalingUpCondition is true if available replicas < desired replicas. +// MachinePoolScalingUpCondition = clusterv1.ScalingUpCondition +// +// // MachinePoolScalingDownCondition is true if replicas > desired replicas. +// MachinePoolScalingDownCondition = clusterv1.ScalingDownCondition +// +// // MachinePoolRemediatingCondition surfaces details about ongoing remediation of the controlled machines, if any. +// MachinePoolRemediatingCondition = clusterv1.RemediatingCondition +// +// // MachinePoolDeletingCondition surfaces details about ongoing deletion of the controlled machines. +// MachinePoolDeletingCondition = clusterv1.DeletingCondition +// ). +// MachinePoolSpec defines the desired state of MachinePool. +type MachinePoolSpecApplyConfiguration struct { + // clusterName is the name of the Cluster this object belongs to. + ClusterName *string `json:"clusterName,omitempty"` + // replicas is the number of desired machines. Defaults to 1. + // This is a pointer to distinguish between explicit zero and not specified. + Replicas *int32 `json:"replicas,omitempty"` + // template describes the machines that will be created. + Template *MachineTemplateSpecApplyConfiguration `json:"template,omitempty"` + // providerIDList are the identification IDs of machine instances provided by the provider. + // This field must match the provider IDs as seen on the node objects corresponding to a machine pool's machine instances. + ProviderIDList []string `json:"providerIDList,omitempty"` + // failureDomains is the list of failure domains this MachinePool should be attached to. + FailureDomains []string `json:"failureDomains,omitempty"` +} + +// MachinePoolSpecApplyConfiguration constructs a declarative configuration of the MachinePoolSpec type for use with +// apply. +func MachinePoolSpec() *MachinePoolSpecApplyConfiguration { + return &MachinePoolSpecApplyConfiguration{} +} + +// WithClusterName sets the ClusterName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ClusterName field is set to the value of the last call. +func (b *MachinePoolSpecApplyConfiguration) WithClusterName(value string) *MachinePoolSpecApplyConfiguration { + b.ClusterName = &value + return b +} + +// WithReplicas sets the Replicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Replicas field is set to the value of the last call. +func (b *MachinePoolSpecApplyConfiguration) WithReplicas(value int32) *MachinePoolSpecApplyConfiguration { + b.Replicas = &value + return b +} + +// WithTemplate sets the Template field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Template field is set to the value of the last call. +func (b *MachinePoolSpecApplyConfiguration) WithTemplate(value *MachineTemplateSpecApplyConfiguration) *MachinePoolSpecApplyConfiguration { + b.Template = value + return b +} + +// WithProviderIDList adds the given value to the ProviderIDList field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ProviderIDList field. +func (b *MachinePoolSpecApplyConfiguration) WithProviderIDList(values ...string) *MachinePoolSpecApplyConfiguration { + for i := range values { + b.ProviderIDList = append(b.ProviderIDList, values[i]) + } + return b +} + +// WithFailureDomains adds the given value to the FailureDomains field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the FailureDomains field. +func (b *MachinePoolSpecApplyConfiguration) WithFailureDomains(values ...string) *MachinePoolSpecApplyConfiguration { + for i := range values { + b.FailureDomains = append(b.FailureDomains, values[i]) + } + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinepoolstatus.go b/util/applyconfigurations/core/v1beta2/machinepoolstatus.go new file mode 100644 index 000000000000..c4a9d987841e --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinepoolstatus.go @@ -0,0 +1,131 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + corev1 "k8s.io/api/core/v1" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// MachinePoolStatusApplyConfiguration represents a declarative configuration of the MachinePoolStatus type for use +// with apply. +// +// MachinePoolStatus defines the observed state of MachinePool. +type MachinePoolStatusApplyConfiguration struct { + // conditions represents the observations of a MachinePool's current state. + // Known condition types are Available, BootstrapConfigReady, InfrastructureReady, MachinesReady, MachinesUpToDate, + // ScalingUp, ScalingDown, Remediating, Deleting, Paused. + Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"` + // initialization provides observations of the MachinePool initialization process. + // NOTE: Fields in this struct are part of the Cluster API contract and are used to orchestrate initial MachinePool provisioning. + Initialization *MachinePoolInitializationStatusApplyConfiguration `json:"initialization,omitempty"` + // nodeRefs will point to the corresponding Nodes if it they exist. + NodeRefs []corev1.ObjectReference `json:"nodeRefs,omitempty"` + // replicas is the most recently observed number of replicas. + Replicas *int32 `json:"replicas,omitempty"` + // readyReplicas is the number of ready replicas for this MachinePool. A machine is considered ready when Machine's Ready condition is true. + ReadyReplicas *int32 `json:"readyReplicas,omitempty"` + // availableReplicas is the number of available replicas for this MachinePool. A machine is considered available when Machine's Available condition is true. + AvailableReplicas *int32 `json:"availableReplicas,omitempty"` + // upToDateReplicas is the number of up-to-date replicas targeted by this MachinePool. A machine is considered up-to-date when Machine's UpToDate condition is true. + UpToDateReplicas *int32 `json:"upToDateReplicas,omitempty"` + // phase represents the current phase of cluster actuation. + Phase *string `json:"phase,omitempty"` + // observedGeneration is the latest generation observed by the controller. + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` + // deprecated groups all the status fields that are deprecated and will be removed when all the nested field are removed. + Deprecated *MachinePoolDeprecatedStatusApplyConfiguration `json:"deprecated,omitempty"` +} + +// MachinePoolStatusApplyConfiguration constructs a declarative configuration of the MachinePoolStatus type for use with +// apply. +func MachinePoolStatus() *MachinePoolStatusApplyConfiguration { + return &MachinePoolStatusApplyConfiguration{} +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *MachinePoolStatusApplyConfiguration) WithConditions(values ...*v1.ConditionApplyConfiguration) *MachinePoolStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithInitialization sets the Initialization field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Initialization field is set to the value of the last call. +func (b *MachinePoolStatusApplyConfiguration) WithInitialization(value *MachinePoolInitializationStatusApplyConfiguration) *MachinePoolStatusApplyConfiguration { + b.Initialization = value + return b +} + +// WithNodeRefs adds the given value to the NodeRefs field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the NodeRefs field. +func (b *MachinePoolStatusApplyConfiguration) WithNodeRefs(values ...corev1.ObjectReference) *MachinePoolStatusApplyConfiguration { + for i := range values { + b.NodeRefs = append(b.NodeRefs, values[i]) + } + return b +} + +// WithReplicas sets the Replicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Replicas field is set to the value of the last call. +func (b *MachinePoolStatusApplyConfiguration) WithReplicas(value int32) *MachinePoolStatusApplyConfiguration { + b.Replicas = &value + return b +} + +// WithReadyReplicas sets the ReadyReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadyReplicas field is set to the value of the last call. +func (b *MachinePoolStatusApplyConfiguration) WithReadyReplicas(value int32) *MachinePoolStatusApplyConfiguration { + b.ReadyReplicas = &value + return b +} + +// WithAvailableReplicas sets the AvailableReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AvailableReplicas field is set to the value of the last call. +func (b *MachinePoolStatusApplyConfiguration) WithAvailableReplicas(value int32) *MachinePoolStatusApplyConfiguration { + b.AvailableReplicas = &value + return b +} + +// WithUpToDateReplicas sets the UpToDateReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UpToDateReplicas field is set to the value of the last call. +func (b *MachinePoolStatusApplyConfiguration) WithUpToDateReplicas(value int32) *MachinePoolStatusApplyConfiguration { + b.UpToDateReplicas = &value + return b +} + +// WithPhase sets the Phase field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Phase field is set to the value of the last call. +func (b *MachinePoolStatusApplyConfiguration) WithPhase(value string) *MachinePoolStatusApplyConfiguration { + b.Phase = &value + return b +} + +// WithObservedGeneration sets the ObservedGeneration field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ObservedGeneration field is set to the value of the last call. +func (b *MachinePoolStatusApplyConfiguration) WithObservedGeneration(value int64) *MachinePoolStatusApplyConfiguration { + b.ObservedGeneration = &value + return b +} + +// WithDeprecated sets the Deprecated field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Deprecated field is set to the value of the last call. +func (b *MachinePoolStatusApplyConfiguration) WithDeprecated(value *MachinePoolDeprecatedStatusApplyConfiguration) *MachinePoolStatusApplyConfiguration { + b.Deprecated = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinepooltopology.go b/util/applyconfigurations/core/v1beta2/machinepooltopology.go new file mode 100644 index 000000000000..aaefdb8c7c61 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinepooltopology.go @@ -0,0 +1,112 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachinePoolTopologyApplyConfiguration represents a declarative configuration of the MachinePoolTopology type for use +// with apply. +// +// MachinePoolTopology specifies the different parameters for a pool of worker nodes in the topology. +// This pool of nodes is managed by a MachinePool object whose lifecycle is managed by the Cluster controller. +type MachinePoolTopologyApplyConfiguration struct { + // metadata is the metadata applied to the MachinePool. + // At runtime this metadata is merged with the corresponding metadata from the ClusterClass. + Metadata *ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + // class is the name of the MachinePoolClass used to create the pool of worker nodes. + // This should match one of the deployment classes defined in the ClusterClass object + // mentioned in the `Cluster.Spec.Class` field. + Class *string `json:"class,omitempty"` + // name is the unique identifier for this MachinePoolTopology. + // The value is used with other unique identifiers to create a MachinePool's Name + // (e.g. cluster's name, etc). In case the name is greater than the allowed maximum length, + // the values are hashed together. + Name *string `json:"name,omitempty"` + // failureDomains is the list of failure domains the machine pool will be created in. + // Must match a key in the FailureDomains map stored on the cluster object. + FailureDomains []string `json:"failureDomains,omitempty"` + // deletion contains configuration options for Machine deletion. + Deletion *MachinePoolTopologyMachineDeletionSpecApplyConfiguration `json:"deletion,omitempty"` + // minReadySeconds is the minimum number of seconds for which a newly created machine pool should + // be ready. + // Defaults to 0 (machine will be considered available as soon as it + // is ready) + MinReadySeconds *int32 `json:"minReadySeconds,omitempty"` + // replicas is the number of nodes belonging to this pool. + // If the value is nil, the MachinePool is created without the number of Replicas (defaulting to 1) + // and it's assumed that an external entity (like cluster autoscaler) is responsible for the management + // of this value. + Replicas *int32 `json:"replicas,omitempty"` + // variables can be used to customize the MachinePool through patches. + Variables *MachinePoolVariablesApplyConfiguration `json:"variables,omitempty"` +} + +// MachinePoolTopologyApplyConfiguration constructs a declarative configuration of the MachinePoolTopology type for use with +// apply. +func MachinePoolTopology() *MachinePoolTopologyApplyConfiguration { + return &MachinePoolTopologyApplyConfiguration{} +} + +// WithMetadata sets the Metadata field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Metadata field is set to the value of the last call. +func (b *MachinePoolTopologyApplyConfiguration) WithMetadata(value *ObjectMetaApplyConfiguration) *MachinePoolTopologyApplyConfiguration { + b.Metadata = value + return b +} + +// WithClass sets the Class field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Class field is set to the value of the last call. +func (b *MachinePoolTopologyApplyConfiguration) WithClass(value string) *MachinePoolTopologyApplyConfiguration { + b.Class = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *MachinePoolTopologyApplyConfiguration) WithName(value string) *MachinePoolTopologyApplyConfiguration { + b.Name = &value + return b +} + +// WithFailureDomains adds the given value to the FailureDomains field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the FailureDomains field. +func (b *MachinePoolTopologyApplyConfiguration) WithFailureDomains(values ...string) *MachinePoolTopologyApplyConfiguration { + for i := range values { + b.FailureDomains = append(b.FailureDomains, values[i]) + } + return b +} + +// WithDeletion sets the Deletion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Deletion field is set to the value of the last call. +func (b *MachinePoolTopologyApplyConfiguration) WithDeletion(value *MachinePoolTopologyMachineDeletionSpecApplyConfiguration) *MachinePoolTopologyApplyConfiguration { + b.Deletion = value + return b +} + +// WithMinReadySeconds sets the MinReadySeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinReadySeconds field is set to the value of the last call. +func (b *MachinePoolTopologyApplyConfiguration) WithMinReadySeconds(value int32) *MachinePoolTopologyApplyConfiguration { + b.MinReadySeconds = &value + return b +} + +// WithReplicas sets the Replicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Replicas field is set to the value of the last call. +func (b *MachinePoolTopologyApplyConfiguration) WithReplicas(value int32) *MachinePoolTopologyApplyConfiguration { + b.Replicas = &value + return b +} + +// WithVariables sets the Variables field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Variables field is set to the value of the last call. +func (b *MachinePoolTopologyApplyConfiguration) WithVariables(value *MachinePoolVariablesApplyConfiguration) *MachinePoolTopologyApplyConfiguration { + b.Variables = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinepooltopologymachinedeletionspec.go b/util/applyconfigurations/core/v1beta2/machinepooltopologymachinedeletionspec.go new file mode 100644 index 000000000000..ddfcc9190553 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinepooltopologymachinedeletionspec.go @@ -0,0 +1,51 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachinePoolTopologyMachineDeletionSpecApplyConfiguration represents a declarative configuration of the MachinePoolTopologyMachineDeletionSpec type for use +// with apply. +// +// MachinePoolTopologyMachineDeletionSpec contains configuration options for Machine deletion. +type MachinePoolTopologyMachineDeletionSpecApplyConfiguration struct { + // nodeDrainTimeoutSeconds is the total amount of time that the controller will spend on draining a node. + // The default value is 0, meaning that the node can be drained without any time limitations. + // NOTE: nodeDrainTimeoutSeconds is different from `kubectl drain --timeout` + NodeDrainTimeoutSeconds *int32 `json:"nodeDrainTimeoutSeconds,omitempty"` + // nodeVolumeDetachTimeoutSeconds is the total amount of time that the controller will spend on waiting for all volumes + // to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations. + NodeVolumeDetachTimeoutSeconds *int32 `json:"nodeVolumeDetachTimeoutSeconds,omitempty"` + // nodeDeletionTimeoutSeconds defines how long the controller will attempt to delete the Node that the MachinePool + // hosts after the MachinePool is marked for deletion. A duration of 0 will retry deletion indefinitely. + // Defaults to 10 seconds. + NodeDeletionTimeoutSeconds *int32 `json:"nodeDeletionTimeoutSeconds,omitempty"` +} + +// MachinePoolTopologyMachineDeletionSpecApplyConfiguration constructs a declarative configuration of the MachinePoolTopologyMachineDeletionSpec type for use with +// apply. +func MachinePoolTopologyMachineDeletionSpec() *MachinePoolTopologyMachineDeletionSpecApplyConfiguration { + return &MachinePoolTopologyMachineDeletionSpecApplyConfiguration{} +} + +// WithNodeDrainTimeoutSeconds sets the NodeDrainTimeoutSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeDrainTimeoutSeconds field is set to the value of the last call. +func (b *MachinePoolTopologyMachineDeletionSpecApplyConfiguration) WithNodeDrainTimeoutSeconds(value int32) *MachinePoolTopologyMachineDeletionSpecApplyConfiguration { + b.NodeDrainTimeoutSeconds = &value + return b +} + +// WithNodeVolumeDetachTimeoutSeconds sets the NodeVolumeDetachTimeoutSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeVolumeDetachTimeoutSeconds field is set to the value of the last call. +func (b *MachinePoolTopologyMachineDeletionSpecApplyConfiguration) WithNodeVolumeDetachTimeoutSeconds(value int32) *MachinePoolTopologyMachineDeletionSpecApplyConfiguration { + b.NodeVolumeDetachTimeoutSeconds = &value + return b +} + +// WithNodeDeletionTimeoutSeconds sets the NodeDeletionTimeoutSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeDeletionTimeoutSeconds field is set to the value of the last call. +func (b *MachinePoolTopologyMachineDeletionSpecApplyConfiguration) WithNodeDeletionTimeoutSeconds(value int32) *MachinePoolTopologyMachineDeletionSpecApplyConfiguration { + b.NodeDeletionTimeoutSeconds = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinepoolv1beta1deprecatedstatus.go b/util/applyconfigurations/core/v1beta2/machinepoolv1beta1deprecatedstatus.go new file mode 100644 index 000000000000..773705e10428 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinepoolv1beta1deprecatedstatus.go @@ -0,0 +1,100 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + corev1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2" + errors "sigs.k8s.io/cluster-api/errors" +) + +// MachinePoolV1Beta1DeprecatedStatusApplyConfiguration represents a declarative configuration of the MachinePoolV1Beta1DeprecatedStatus type for use +// with apply. +// +// MachinePoolV1Beta1DeprecatedStatus 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 MachinePoolV1Beta1DeprecatedStatusApplyConfiguration struct { + // conditions define the current service state of the MachinePool. + // + // 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. + Conditions *corev1beta2.Conditions `json:"conditions,omitempty"` + // failureReason indicates that there is a problem reconciling the state, and + // will be set to a token value suitable for programmatic interpretation. + // + // 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. + FailureReason *errors.MachinePoolStatusFailure `json:"failureReason,omitempty"` + // failureMessage indicates that there is a problem reconciling the state, + // and will be set to a descriptive error message. + // + // 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. + FailureMessage *string `json:"failureMessage,omitempty"` + // readyReplicas is the number of ready replicas for this MachinePool. A machine is considered ready when the node has been created and is "Ready". + // + // 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. + ReadyReplicas *int32 `json:"readyReplicas,omitempty"` + // availableReplicas is the number of available replicas (ready for at least minReadySeconds) for this MachinePool. + // + // 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. + AvailableReplicas *int32 `json:"availableReplicas,omitempty"` + // unavailableReplicas is the total number of unavailable machine instances targeted by this machine pool. + // This is the total number of machine instances that are still required for + // the machine pool to have 100% available capacity. They may either + // be machine instances that are running but not yet available or machine instances + // that still have not been created. + // + // 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. + UnavailableReplicas *int32 `json:"unavailableReplicas,omitempty"` +} + +// MachinePoolV1Beta1DeprecatedStatusApplyConfiguration constructs a declarative configuration of the MachinePoolV1Beta1DeprecatedStatus type for use with +// apply. +func MachinePoolV1Beta1DeprecatedStatus() *MachinePoolV1Beta1DeprecatedStatusApplyConfiguration { + return &MachinePoolV1Beta1DeprecatedStatusApplyConfiguration{} +} + +// WithConditions sets the Conditions field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Conditions field is set to the value of the last call. +func (b *MachinePoolV1Beta1DeprecatedStatusApplyConfiguration) WithConditions(value corev1beta2.Conditions) *MachinePoolV1Beta1DeprecatedStatusApplyConfiguration { + b.Conditions = &value + return b +} + +// WithFailureReason sets the FailureReason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FailureReason field is set to the value of the last call. +func (b *MachinePoolV1Beta1DeprecatedStatusApplyConfiguration) WithFailureReason(value errors.MachinePoolStatusFailure) *MachinePoolV1Beta1DeprecatedStatusApplyConfiguration { + b.FailureReason = &value + return b +} + +// WithFailureMessage sets the FailureMessage field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FailureMessage field is set to the value of the last call. +func (b *MachinePoolV1Beta1DeprecatedStatusApplyConfiguration) WithFailureMessage(value string) *MachinePoolV1Beta1DeprecatedStatusApplyConfiguration { + b.FailureMessage = &value + return b +} + +// WithReadyReplicas sets the ReadyReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadyReplicas field is set to the value of the last call. +func (b *MachinePoolV1Beta1DeprecatedStatusApplyConfiguration) WithReadyReplicas(value int32) *MachinePoolV1Beta1DeprecatedStatusApplyConfiguration { + b.ReadyReplicas = &value + return b +} + +// WithAvailableReplicas sets the AvailableReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AvailableReplicas field is set to the value of the last call. +func (b *MachinePoolV1Beta1DeprecatedStatusApplyConfiguration) WithAvailableReplicas(value int32) *MachinePoolV1Beta1DeprecatedStatusApplyConfiguration { + b.AvailableReplicas = &value + return b +} + +// WithUnavailableReplicas sets the UnavailableReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UnavailableReplicas field is set to the value of the last call. +func (b *MachinePoolV1Beta1DeprecatedStatusApplyConfiguration) WithUnavailableReplicas(value int32) *MachinePoolV1Beta1DeprecatedStatusApplyConfiguration { + b.UnavailableReplicas = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinepoolvariables.go b/util/applyconfigurations/core/v1beta2/machinepoolvariables.go new file mode 100644 index 000000000000..cc8615f4f509 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinepoolvariables.go @@ -0,0 +1,31 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachinePoolVariablesApplyConfiguration represents a declarative configuration of the MachinePoolVariables type for use +// with apply. +// +// MachinePoolVariables can be used to provide variables for a specific MachinePool. +type MachinePoolVariablesApplyConfiguration struct { + // overrides can be used to override Cluster level variables. + Overrides []ClusterVariableApplyConfiguration `json:"overrides,omitempty"` +} + +// MachinePoolVariablesApplyConfiguration constructs a declarative configuration of the MachinePoolVariables type for use with +// apply. +func MachinePoolVariables() *MachinePoolVariablesApplyConfiguration { + return &MachinePoolVariablesApplyConfiguration{} +} + +// WithOverrides adds the given value to the Overrides field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Overrides field. +func (b *MachinePoolVariablesApplyConfiguration) WithOverrides(values ...*ClusterVariableApplyConfiguration) *MachinePoolVariablesApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOverrides") + } + b.Overrides = append(b.Overrides, *values[i]) + } + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinereadinessgate.go b/util/applyconfigurations/core/v1beta2/machinereadinessgate.go new file mode 100644 index 000000000000..2e2c0bd549a6 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinereadinessgate.go @@ -0,0 +1,46 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + corev1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2" +) + +// MachineReadinessGateApplyConfiguration represents a declarative configuration of the MachineReadinessGate type for use +// with apply. +// +// MachineReadinessGate contains the type of a Machine condition to be used as a readiness gate. +type MachineReadinessGateApplyConfiguration struct { + // conditionType refers to a condition with matching type in the Machine's condition list. + // If the conditions doesn't exist, it will be treated as unknown. + // Note: Both Cluster API conditions or conditions added by 3rd party controllers can be used as readiness gates. + ConditionType *string `json:"conditionType,omitempty"` + // polarity of the conditionType specified in this readinessGate. + // Valid values are Positive, Negative and omitted. + // When omitted, the default behaviour will be Positive. + // A positive polarity means that the condition should report a true status under normal conditions. + // A negative polarity means that the condition should report a false status under normal conditions. + Polarity *corev1beta2.ConditionPolarity `json:"polarity,omitempty"` +} + +// MachineReadinessGateApplyConfiguration constructs a declarative configuration of the MachineReadinessGate type for use with +// apply. +func MachineReadinessGate() *MachineReadinessGateApplyConfiguration { + return &MachineReadinessGateApplyConfiguration{} +} + +// WithConditionType sets the ConditionType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ConditionType field is set to the value of the last call. +func (b *MachineReadinessGateApplyConfiguration) WithConditionType(value string) *MachineReadinessGateApplyConfiguration { + b.ConditionType = &value + return b +} + +// WithPolarity sets the Polarity field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Polarity field is set to the value of the last call. +func (b *MachineReadinessGateApplyConfiguration) WithPolarity(value corev1beta2.ConditionPolarity) *MachineReadinessGateApplyConfiguration { + b.Polarity = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machineset.go b/util/applyconfigurations/core/v1beta2/machineset.go new file mode 100644 index 000000000000..35c97b2b29ef --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machineset.go @@ -0,0 +1,277 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" + corev1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2" + internal "sigs.k8s.io/cluster-api/util/applyconfigurations/internal" +) + +// MachineSetApplyConfiguration represents a declarative configuration of the MachineSet type for use +// with apply. +// +// MachineSet is the Schema for the machinesets API. +type MachineSetApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + // metadata is the standard object's metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + // spec is the desired state of MachineSet. + Spec *MachineSetSpecApplyConfiguration `json:"spec,omitempty"` + // status is the observed state of MachineSet. + Status *MachineSetStatusApplyConfiguration `json:"status,omitempty"` +} + +// MachineSet constructs a declarative configuration of the MachineSet type for use with +// apply. +func MachineSet(name, namespace string) *MachineSetApplyConfiguration { + b := &MachineSetApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("MachineSet") + b.WithAPIVersion("cluster.x-k8s.io/v1beta2") + return b +} + +// ExtractMachineSetFrom extracts the applied configuration owned by fieldManager from +// machineSet for the specified subresource. Pass an empty string for subresource to extract +// the main resource. Common subresources include "status", "scale", etc. +// machineSet must be a unmodified MachineSet API object that was retrieved from the Kubernetes API. +// ExtractMachineSetFrom provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractMachineSetFrom(machineSet *corev1beta2.MachineSet, fieldManager string, subresource string) (*MachineSetApplyConfiguration, error) { + b := &MachineSetApplyConfiguration{} + err := managedfields.ExtractInto(machineSet, internal.Parser().Type("io.k8s.sigs.cluster-api.api.core.v1beta2.MachineSet"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(machineSet.Name) + b.WithNamespace(machineSet.Namespace) + + b.WithKind("MachineSet") + b.WithAPIVersion("cluster.x-k8s.io/v1beta2") + return b, nil +} + +// ExtractMachineSet extracts the applied configuration owned by fieldManager from +// machineSet. If no managedFields are found in machineSet for fieldManager, a +// MachineSetApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// machineSet must be a unmodified MachineSet API object that was retrieved from the Kubernetes API. +// ExtractMachineSet provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractMachineSet(machineSet *corev1beta2.MachineSet, fieldManager string) (*MachineSetApplyConfiguration, error) { + return ExtractMachineSetFrom(machineSet, fieldManager, "") +} + +// ExtractMachineSetStatus extracts the applied configuration owned by fieldManager from +// machineSet for the status subresource. +func ExtractMachineSetStatus(machineSet *corev1beta2.MachineSet, fieldManager string) (*MachineSetApplyConfiguration, error) { + return ExtractMachineSetFrom(machineSet, fieldManager, "status") +} + +func (b MachineSetApplyConfiguration) IsApplyConfiguration() {} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *MachineSetApplyConfiguration) WithKind(value string) *MachineSetApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *MachineSetApplyConfiguration) WithAPIVersion(value string) *MachineSetApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *MachineSetApplyConfiguration) WithName(value string) *MachineSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *MachineSetApplyConfiguration) WithGenerateName(value string) *MachineSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *MachineSetApplyConfiguration) WithNamespace(value string) *MachineSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *MachineSetApplyConfiguration) WithUID(value types.UID) *MachineSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *MachineSetApplyConfiguration) WithResourceVersion(value string) *MachineSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *MachineSetApplyConfiguration) WithGeneration(value int64) *MachineSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *MachineSetApplyConfiguration) WithCreationTimestamp(value metav1.Time) *MachineSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *MachineSetApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *MachineSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *MachineSetApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *MachineSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *MachineSetApplyConfiguration) WithLabels(entries map[string]string) *MachineSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *MachineSetApplyConfiguration) WithAnnotations(entries map[string]string) *MachineSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *MachineSetApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *MachineSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *MachineSetApplyConfiguration) WithFinalizers(values ...string) *MachineSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *MachineSetApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *MachineSetApplyConfiguration) WithSpec(value *MachineSetSpecApplyConfiguration) *MachineSetApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *MachineSetApplyConfiguration) WithStatus(value *MachineSetStatusApplyConfiguration) *MachineSetApplyConfiguration { + b.Status = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *MachineSetApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *MachineSetApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *MachineSetApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *MachineSetApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/util/applyconfigurations/core/v1beta2/machinesetdeletionspec.go b/util/applyconfigurations/core/v1beta2/machinesetdeletionspec.go new file mode 100644 index 000000000000..69b567f92a9b --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinesetdeletionspec.go @@ -0,0 +1,31 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + corev1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2" +) + +// MachineSetDeletionSpecApplyConfiguration represents a declarative configuration of the MachineSetDeletionSpec type for use +// with apply. +// +// MachineSetDeletionSpec contains configuration options for MachineSet deletion. +type MachineSetDeletionSpecApplyConfiguration struct { + // order defines the order in which Machines are deleted when downscaling. + // Defaults to "Random". Valid values are "Random, "Newest", "Oldest" + Order *corev1beta2.MachineSetDeletionOrder `json:"order,omitempty"` +} + +// MachineSetDeletionSpecApplyConfiguration constructs a declarative configuration of the MachineSetDeletionSpec type for use with +// apply. +func MachineSetDeletionSpec() *MachineSetDeletionSpecApplyConfiguration { + return &MachineSetDeletionSpecApplyConfiguration{} +} + +// WithOrder sets the Order field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Order field is set to the value of the last call. +func (b *MachineSetDeletionSpecApplyConfiguration) WithOrder(value corev1beta2.MachineSetDeletionOrder) *MachineSetDeletionSpecApplyConfiguration { + b.Order = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinesetdeprecatedstatus.go b/util/applyconfigurations/core/v1beta2/machinesetdeprecatedstatus.go new file mode 100644 index 000000000000..9ea42c675850 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinesetdeprecatedstatus.go @@ -0,0 +1,27 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachineSetDeprecatedStatusApplyConfiguration represents a declarative configuration of the MachineSetDeprecatedStatus type for use +// with apply. +// +// MachineSetDeprecatedStatus groups all the status fields that are deprecated and will be removed in a future version. +// See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context. +type MachineSetDeprecatedStatusApplyConfiguration struct { + // v1beta1 groups all the status fields that are deprecated and will be removed when support for v1beta1 will be dropped. + V1Beta1 *MachineSetV1Beta1DeprecatedStatusApplyConfiguration `json:"v1beta1,omitempty"` +} + +// MachineSetDeprecatedStatusApplyConfiguration constructs a declarative configuration of the MachineSetDeprecatedStatus type for use with +// apply. +func MachineSetDeprecatedStatus() *MachineSetDeprecatedStatusApplyConfiguration { + return &MachineSetDeprecatedStatusApplyConfiguration{} +} + +// WithV1Beta1 sets the V1Beta1 field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the V1Beta1 field is set to the value of the last call. +func (b *MachineSetDeprecatedStatusApplyConfiguration) WithV1Beta1(value *MachineSetV1Beta1DeprecatedStatusApplyConfiguration) *MachineSetDeprecatedStatusApplyConfiguration { + b.V1Beta1 = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinesetspec.go b/util/applyconfigurations/core/v1beta2/machinesetspec.go new file mode 100644 index 000000000000..7930156bbe8e --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinesetspec.go @@ -0,0 +1,102 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// MachineSetSpecApplyConfiguration represents a declarative configuration of the MachineSetSpec type for use +// with apply. +// +// MachineSetSpec defines the desired state of MachineSet. +type MachineSetSpecApplyConfiguration struct { + // clusterName is the name of the Cluster this object belongs to. + ClusterName *string `json:"clusterName,omitempty"` + // replicas is the number of desired replicas. + // This is a pointer to distinguish between explicit zero and unspecified. + // + // Defaults to: + // * if the Kubernetes autoscaler min size and max size annotations are set: + // - if it's a new MachineSet, use min size + // - if the replicas field of the old MachineSet is < min size, use min size + // - if the replicas field of the old MachineSet is > max size, use max size + // - if the replicas field of the old MachineSet is in the (min size, max size) range, keep the value from the oldMS + // * otherwise use 1 + // Note: Defaulting will be run whenever the replicas field is not set: + // * A new MachineSet is created with replicas not set. + // * On an existing MachineSet the replicas field was first set and is now unset. + // Those cases are especially relevant for the following Kubernetes autoscaler use cases: + // * A new MachineSet is created and replicas should be managed by the autoscaler + // * An existing MachineSet which initially wasn't controlled by the autoscaler + // should be later controlled by the autoscaler + Replicas *int32 `json:"replicas,omitempty"` + // selector is a label query over machines that should match the replica count. + // Label keys and values that must match in order to be controlled by this MachineSet. + // It must match the machine template's labels. + // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + Selector *v1.LabelSelectorApplyConfiguration `json:"selector,omitempty"` + // template is the object that describes the machine that will be created if + // insufficient replicas are detected. + // Object references to custom resources are treated as templates. + Template *MachineTemplateSpecApplyConfiguration `json:"template,omitempty"` + // machineNaming allows changing the naming pattern used when creating Machines. + // Note: InfraMachines & BootstrapConfigs will use the same name as the corresponding Machines. + MachineNaming *MachineNamingSpecApplyConfiguration `json:"machineNaming,omitempty"` + // deletion contains configuration options for MachineSet deletion. + Deletion *MachineSetDeletionSpecApplyConfiguration `json:"deletion,omitempty"` +} + +// MachineSetSpecApplyConfiguration constructs a declarative configuration of the MachineSetSpec type for use with +// apply. +func MachineSetSpec() *MachineSetSpecApplyConfiguration { + return &MachineSetSpecApplyConfiguration{} +} + +// WithClusterName sets the ClusterName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ClusterName field is set to the value of the last call. +func (b *MachineSetSpecApplyConfiguration) WithClusterName(value string) *MachineSetSpecApplyConfiguration { + b.ClusterName = &value + return b +} + +// WithReplicas sets the Replicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Replicas field is set to the value of the last call. +func (b *MachineSetSpecApplyConfiguration) WithReplicas(value int32) *MachineSetSpecApplyConfiguration { + b.Replicas = &value + return b +} + +// WithSelector sets the Selector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Selector field is set to the value of the last call. +func (b *MachineSetSpecApplyConfiguration) WithSelector(value *v1.LabelSelectorApplyConfiguration) *MachineSetSpecApplyConfiguration { + b.Selector = value + return b +} + +// WithTemplate sets the Template field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Template field is set to the value of the last call. +func (b *MachineSetSpecApplyConfiguration) WithTemplate(value *MachineTemplateSpecApplyConfiguration) *MachineSetSpecApplyConfiguration { + b.Template = value + return b +} + +// WithMachineNaming sets the MachineNaming field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MachineNaming field is set to the value of the last call. +func (b *MachineSetSpecApplyConfiguration) WithMachineNaming(value *MachineNamingSpecApplyConfiguration) *MachineSetSpecApplyConfiguration { + b.MachineNaming = value + return b +} + +// WithDeletion sets the Deletion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Deletion field is set to the value of the last call. +func (b *MachineSetSpecApplyConfiguration) WithDeletion(value *MachineSetDeletionSpecApplyConfiguration) *MachineSetSpecApplyConfiguration { + b.Deletion = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinesetstatus.go b/util/applyconfigurations/core/v1beta2/machinesetstatus.go new file mode 100644 index 000000000000..8cc29b2c8951 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinesetstatus.go @@ -0,0 +1,108 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// MachineSetStatusApplyConfiguration represents a declarative configuration of the MachineSetStatus type for use +// with apply. +// +// MachineSetStatus defines the observed state of MachineSet. +type MachineSetStatusApplyConfiguration struct { + // conditions represents the observations of a MachineSet's current state. + // Known condition types are MachinesReady, MachinesUpToDate, ScalingUp, ScalingDown, Remediating, Deleting, Paused. + Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"` + // selector is the same as the label selector but in the string format to avoid introspection + // by clients. The string will be in the same format as the query-param syntax. + // More info about label selectors: http://kubernetes.io/docs/user-guide/labels#label-selectors + Selector *string `json:"selector,omitempty"` + // replicas is the most recently observed number of replicas. + Replicas *int32 `json:"replicas,omitempty"` + // readyReplicas is the number of ready replicas for this MachineSet. A machine is considered ready when Machine's Ready condition is true. + ReadyReplicas *int32 `json:"readyReplicas,omitempty"` + // availableReplicas is the number of available replicas for this MachineSet. A machine is considered available when Machine's Available condition is true. + AvailableReplicas *int32 `json:"availableReplicas,omitempty"` + // upToDateReplicas is the number of up-to-date replicas for this MachineSet. A machine is considered up-to-date when Machine's UpToDate condition is true. + UpToDateReplicas *int32 `json:"upToDateReplicas,omitempty"` + // observedGeneration reflects the generation of the most recently observed MachineSet. + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` + // deprecated groups all the status fields that are deprecated and will be removed when all the nested field are removed. + Deprecated *MachineSetDeprecatedStatusApplyConfiguration `json:"deprecated,omitempty"` +} + +// MachineSetStatusApplyConfiguration constructs a declarative configuration of the MachineSetStatus type for use with +// apply. +func MachineSetStatus() *MachineSetStatusApplyConfiguration { + return &MachineSetStatusApplyConfiguration{} +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *MachineSetStatusApplyConfiguration) WithConditions(values ...*v1.ConditionApplyConfiguration) *MachineSetStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithSelector sets the Selector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Selector field is set to the value of the last call. +func (b *MachineSetStatusApplyConfiguration) WithSelector(value string) *MachineSetStatusApplyConfiguration { + b.Selector = &value + return b +} + +// WithReplicas sets the Replicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Replicas field is set to the value of the last call. +func (b *MachineSetStatusApplyConfiguration) WithReplicas(value int32) *MachineSetStatusApplyConfiguration { + b.Replicas = &value + return b +} + +// WithReadyReplicas sets the ReadyReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadyReplicas field is set to the value of the last call. +func (b *MachineSetStatusApplyConfiguration) WithReadyReplicas(value int32) *MachineSetStatusApplyConfiguration { + b.ReadyReplicas = &value + return b +} + +// WithAvailableReplicas sets the AvailableReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AvailableReplicas field is set to the value of the last call. +func (b *MachineSetStatusApplyConfiguration) WithAvailableReplicas(value int32) *MachineSetStatusApplyConfiguration { + b.AvailableReplicas = &value + return b +} + +// WithUpToDateReplicas sets the UpToDateReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UpToDateReplicas field is set to the value of the last call. +func (b *MachineSetStatusApplyConfiguration) WithUpToDateReplicas(value int32) *MachineSetStatusApplyConfiguration { + b.UpToDateReplicas = &value + return b +} + +// WithObservedGeneration sets the ObservedGeneration field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ObservedGeneration field is set to the value of the last call. +func (b *MachineSetStatusApplyConfiguration) WithObservedGeneration(value int64) *MachineSetStatusApplyConfiguration { + b.ObservedGeneration = &value + return b +} + +// WithDeprecated sets the Deprecated field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Deprecated field is set to the value of the last call. +func (b *MachineSetStatusApplyConfiguration) WithDeprecated(value *MachineSetDeprecatedStatusApplyConfiguration) *MachineSetStatusApplyConfiguration { + b.Deprecated = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinesetv1beta1deprecatedstatus.go b/util/applyconfigurations/core/v1beta2/machinesetv1beta1deprecatedstatus.go new file mode 100644 index 000000000000..09d865913a2f --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinesetv1beta1deprecatedstatus.go @@ -0,0 +1,117 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + corev1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2" + errors "sigs.k8s.io/cluster-api/errors" +) + +// MachineSetV1Beta1DeprecatedStatusApplyConfiguration represents a declarative configuration of the MachineSetV1Beta1DeprecatedStatus type for use +// with apply. +// +// MachineSetV1Beta1DeprecatedStatus 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 MachineSetV1Beta1DeprecatedStatusApplyConfiguration struct { + // conditions defines current service state of the MachineSet. + // + // 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. + Conditions *corev1beta2.Conditions `json:"conditions,omitempty"` + // failureReason will be set in the event that there is a terminal problem + // reconciling the Machine and will contain a succinct value suitable + // for machine interpretation. + // + // In the event that there is a terminal problem reconciling the + // replicas, both FailureReason and FailureMessage will be set. FailureReason + // will be populated with a succinct value suitable for machine + // interpretation, while FailureMessage will contain a more verbose + // string suitable for logging and human consumption. + // + // These fields should not be set for transitive errors that a + // controller faces that are expected to be fixed automatically over + // time (like service outages), but instead indicate that something is + // fundamentally wrong with the MachineTemplate's spec or the configuration of + // the machine controller, and that manual intervention is required. Examples + // of terminal errors would be invalid combinations of settings in the + // spec, values that are unsupported by the machine controller, or the + // responsible machine controller itself being critically misconfigured. + // + // Any transient errors that occur during the reconciliation of Machines + // can be added as events to the MachineSet object and/or logged in the + // controller's output. + // + // 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. + FailureReason *errors.MachineSetStatusError `json:"failureReason,omitempty"` + // failureMessage will be set in the event that there is a terminal problem + // reconciling the Machine and will contain a more verbose string suitable + // for logging and human consumption. + // + // 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. + FailureMessage *string `json:"failureMessage,omitempty"` + // fullyLabeledReplicas is the number of replicas that have labels matching the labels of the machine template of the MachineSet. + // + // 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. + FullyLabeledReplicas *int32 `json:"fullyLabeledReplicas,omitempty"` + // readyReplicas is the number of ready replicas for this MachineSet. A machine is considered ready when the node has been created and is "Ready". + // + // 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. + ReadyReplicas *int32 `json:"readyReplicas,omitempty"` + // availableReplicas is the number of available replicas (ready for at least minReadySeconds) for this MachineSet. + // + // 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. + AvailableReplicas *int32 `json:"availableReplicas,omitempty"` +} + +// MachineSetV1Beta1DeprecatedStatusApplyConfiguration constructs a declarative configuration of the MachineSetV1Beta1DeprecatedStatus type for use with +// apply. +func MachineSetV1Beta1DeprecatedStatus() *MachineSetV1Beta1DeprecatedStatusApplyConfiguration { + return &MachineSetV1Beta1DeprecatedStatusApplyConfiguration{} +} + +// WithConditions sets the Conditions field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Conditions field is set to the value of the last call. +func (b *MachineSetV1Beta1DeprecatedStatusApplyConfiguration) WithConditions(value corev1beta2.Conditions) *MachineSetV1Beta1DeprecatedStatusApplyConfiguration { + b.Conditions = &value + return b +} + +// WithFailureReason sets the FailureReason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FailureReason field is set to the value of the last call. +func (b *MachineSetV1Beta1DeprecatedStatusApplyConfiguration) WithFailureReason(value errors.MachineSetStatusError) *MachineSetV1Beta1DeprecatedStatusApplyConfiguration { + b.FailureReason = &value + return b +} + +// WithFailureMessage sets the FailureMessage field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FailureMessage field is set to the value of the last call. +func (b *MachineSetV1Beta1DeprecatedStatusApplyConfiguration) WithFailureMessage(value string) *MachineSetV1Beta1DeprecatedStatusApplyConfiguration { + b.FailureMessage = &value + return b +} + +// WithFullyLabeledReplicas sets the FullyLabeledReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FullyLabeledReplicas field is set to the value of the last call. +func (b *MachineSetV1Beta1DeprecatedStatusApplyConfiguration) WithFullyLabeledReplicas(value int32) *MachineSetV1Beta1DeprecatedStatusApplyConfiguration { + b.FullyLabeledReplicas = &value + return b +} + +// WithReadyReplicas sets the ReadyReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadyReplicas field is set to the value of the last call. +func (b *MachineSetV1Beta1DeprecatedStatusApplyConfiguration) WithReadyReplicas(value int32) *MachineSetV1Beta1DeprecatedStatusApplyConfiguration { + b.ReadyReplicas = &value + return b +} + +// WithAvailableReplicas sets the AvailableReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AvailableReplicas field is set to the value of the last call. +func (b *MachineSetV1Beta1DeprecatedStatusApplyConfiguration) WithAvailableReplicas(value int32) *MachineSetV1Beta1DeprecatedStatusApplyConfiguration { + b.AvailableReplicas = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinespec.go b/util/applyconfigurations/core/v1beta2/machinespec.go new file mode 100644 index 000000000000..93ac07e9686f --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinespec.go @@ -0,0 +1,160 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachineSpecApplyConfiguration represents a declarative configuration of the MachineSpec type for use +// with apply. +// +// MachineSpec defines the desired state of Machine. +type MachineSpecApplyConfiguration struct { + // clusterName is the name of the Cluster this object belongs to. + ClusterName *string `json:"clusterName,omitempty"` + // bootstrap is a reference to a local struct which encapsulates + // fields to configure the Machine’s bootstrapping mechanism. + Bootstrap *BootstrapApplyConfiguration `json:"bootstrap,omitempty"` + // infrastructureRef is a required reference to a custom resource + // offered by an infrastructure provider. + InfrastructureRef *ContractVersionedObjectReferenceApplyConfiguration `json:"infrastructureRef,omitempty"` + // version defines the desired Kubernetes version. + // This field is meant to be optionally used by bootstrap providers. + Version *string `json:"version,omitempty"` + // providerID is the identification ID of the machine provided by the provider. + // This field must match the provider ID as seen on the node object corresponding to this machine. + // This field is required by higher level consumers of cluster-api. Example use case is cluster autoscaler + // with cluster-api as provider. Clean-up logic in the autoscaler compares machines to nodes to find out + // machines at provider which could not get registered as Kubernetes nodes. With cluster-api as a + // generic out-of-tree provider for autoscaler, this field is required by autoscaler to be + // able to have a provider view of the list of machines. Another list of nodes is queried from the k8s apiserver + // and then a comparison is done to find out unregistered machines and are marked for delete. + // This field will be set by the actuators and consumed by higher level entities like autoscaler that will + // be interfacing with cluster-api as generic provider. + ProviderID *string `json:"providerID,omitempty"` + // failureDomain is the failure domain the machine will be created in. + // Must match the name of a FailureDomain from the Cluster status. + FailureDomain *string `json:"failureDomain,omitempty"` + // minReadySeconds is the minimum number of seconds for which a Machine should be ready before considering it available. + // Defaults to 0 (Machine will be considered available as soon as the Machine is ready) + MinReadySeconds *int32 `json:"minReadySeconds,omitempty"` + // readinessGates specifies additional conditions to include when evaluating Machine Ready condition. + // + // This field can be used e.g. by Cluster API control plane providers to extend the semantic of the + // Ready condition for the Machine they control, like the kubeadm control provider adding ReadinessGates + // for the APIServerPodHealthy, SchedulerPodHealthy conditions, etc. + // + // Another example are external controllers, e.g. responsible to install special software/hardware on the Machines; + // they can include the status of those components with a new condition and add this condition to ReadinessGates. + // + // NOTE: In case readinessGates conditions start with the APIServer, ControllerManager, Scheduler prefix, and all those + // readiness gates condition are reporting the same message, when computing the Machine's Ready condition those + // readinessGates will be replaced by a single entry reporting "Control plane components: " + message. + // This helps to improve readability of conditions bubbling up to the Machine's owner resource / to the Cluster). + ReadinessGates []MachineReadinessGateApplyConfiguration `json:"readinessGates,omitempty"` + // deletion contains configuration options for Machine deletion. + Deletion *MachineDeletionSpecApplyConfiguration `json:"deletion,omitempty"` + // taints are the node taints that Cluster API will manage. + // This list is not necessarily complete: other Kubernetes components may add or remove other taints from nodes, + // e.g. the node controller might add the node.kubernetes.io/not-ready taint. + // Only those taints defined in this list will be added or removed by core Cluster API controllers. + // + // There can be at most 64 taints. + // A pod would have to tolerate all existing taints to run on the corresponding node. + // + // NOTE: This list is implemented as a "map" type, meaning that individual elements can be managed by different owners. + Taints []MachineTaintApplyConfiguration `json:"taints,omitempty"` +} + +// MachineSpecApplyConfiguration constructs a declarative configuration of the MachineSpec type for use with +// apply. +func MachineSpec() *MachineSpecApplyConfiguration { + return &MachineSpecApplyConfiguration{} +} + +// WithClusterName sets the ClusterName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ClusterName field is set to the value of the last call. +func (b *MachineSpecApplyConfiguration) WithClusterName(value string) *MachineSpecApplyConfiguration { + b.ClusterName = &value + return b +} + +// WithBootstrap sets the Bootstrap field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Bootstrap field is set to the value of the last call. +func (b *MachineSpecApplyConfiguration) WithBootstrap(value *BootstrapApplyConfiguration) *MachineSpecApplyConfiguration { + b.Bootstrap = value + return b +} + +// WithInfrastructureRef sets the InfrastructureRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the InfrastructureRef field is set to the value of the last call. +func (b *MachineSpecApplyConfiguration) WithInfrastructureRef(value *ContractVersionedObjectReferenceApplyConfiguration) *MachineSpecApplyConfiguration { + b.InfrastructureRef = value + return b +} + +// WithVersion sets the Version field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Version field is set to the value of the last call. +func (b *MachineSpecApplyConfiguration) WithVersion(value string) *MachineSpecApplyConfiguration { + b.Version = &value + return b +} + +// WithProviderID sets the ProviderID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ProviderID field is set to the value of the last call. +func (b *MachineSpecApplyConfiguration) WithProviderID(value string) *MachineSpecApplyConfiguration { + b.ProviderID = &value + return b +} + +// WithFailureDomain sets the FailureDomain field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FailureDomain field is set to the value of the last call. +func (b *MachineSpecApplyConfiguration) WithFailureDomain(value string) *MachineSpecApplyConfiguration { + b.FailureDomain = &value + return b +} + +// WithMinReadySeconds sets the MinReadySeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinReadySeconds field is set to the value of the last call. +func (b *MachineSpecApplyConfiguration) WithMinReadySeconds(value int32) *MachineSpecApplyConfiguration { + b.MinReadySeconds = &value + return b +} + +// WithReadinessGates adds the given value to the ReadinessGates field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ReadinessGates field. +func (b *MachineSpecApplyConfiguration) WithReadinessGates(values ...*MachineReadinessGateApplyConfiguration) *MachineSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithReadinessGates") + } + b.ReadinessGates = append(b.ReadinessGates, *values[i]) + } + return b +} + +// WithDeletion sets the Deletion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Deletion field is set to the value of the last call. +func (b *MachineSpecApplyConfiguration) WithDeletion(value *MachineDeletionSpecApplyConfiguration) *MachineSpecApplyConfiguration { + b.Deletion = value + return b +} + +// WithTaints adds the given value to the Taints field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Taints field. +func (b *MachineSpecApplyConfiguration) WithTaints(values ...*MachineTaintApplyConfiguration) *MachineSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithTaints") + } + b.Taints = append(b.Taints, *values[i]) + } + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinestatus.go b/util/applyconfigurations/core/v1beta2/machinestatus.go new file mode 100644 index 000000000000..f6bc52f0e1e3 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinestatus.go @@ -0,0 +1,158 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" + corev1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2" +) + +// MachineStatusApplyConfiguration represents a declarative configuration of the MachineStatus type for use +// with apply. +// +// MachineStatus defines the observed state of Machine. +type MachineStatusApplyConfiguration struct { + // conditions represents the observations of a Machine's current state. + // Known condition types are Available, Ready, UpToDate, BootstrapConfigReady, InfrastructureReady, NodeReady, + // NodeHealthy, Updating, Deleting, Paused. + // If a MachineHealthCheck is targeting this machine, also HealthCheckSucceeded, OwnerRemediated conditions are added. + // Additionally control plane Machines controlled by KubeadmControlPlane will have following additional conditions: + // APIServerPodHealthy, ControllerManagerPodHealthy, SchedulerPodHealthy, EtcdPodHealthy, EtcdMemberHealthy. + Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"` + // initialization provides observations of the Machine initialization process. + // NOTE: Fields in this struct are part of the Cluster API contract and are used to orchestrate initial Machine provisioning. + Initialization *MachineInitializationStatusApplyConfiguration `json:"initialization,omitempty"` + // nodeRef will point to the corresponding Node if it exists. + NodeRef *MachineNodeReferenceApplyConfiguration `json:"nodeRef,omitempty"` + // nodeInfo is a set of ids/uuids to uniquely identify the node. + // More info: https://kubernetes.io/docs/concepts/nodes/node/#info + NodeInfo *corev1.NodeSystemInfo `json:"nodeInfo,omitempty"` + // lastUpdated identifies when the phase of the Machine last transitioned. + LastUpdated *metav1.Time `json:"lastUpdated,omitempty"` + // addresses is a list of addresses assigned to the machine. + // This field is copied from the infrastructure provider reference. + Addresses *corev1beta2.MachineAddresses `json:"addresses,omitempty"` + // failureDomain is the failure domain where the Machine has been scheduled. + FailureDomain *string `json:"failureDomain,omitempty"` + // phase represents the current phase of machine actuation. + Phase *string `json:"phase,omitempty"` + // certificatesExpiryDate is the expiry date of the machine certificates. + // This value is only set for control plane machines. + CertificatesExpiryDate *metav1.Time `json:"certificatesExpiryDate,omitempty"` + // observedGeneration is the latest generation observed by the controller. + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` + // deletion contains information relating to removal of the Machine. + // Only present when the Machine has a deletionTimestamp and drain or wait for volume detach started. + Deletion *MachineDeletionStatusApplyConfiguration `json:"deletion,omitempty"` + // deprecated groups all the status fields that are deprecated and will be removed when all the nested field are removed. + Deprecated *MachineDeprecatedStatusApplyConfiguration `json:"deprecated,omitempty"` +} + +// MachineStatusApplyConfiguration constructs a declarative configuration of the MachineStatus type for use with +// apply. +func MachineStatus() *MachineStatusApplyConfiguration { + return &MachineStatusApplyConfiguration{} +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *MachineStatusApplyConfiguration) WithConditions(values ...*v1.ConditionApplyConfiguration) *MachineStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithInitialization sets the Initialization field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Initialization field is set to the value of the last call. +func (b *MachineStatusApplyConfiguration) WithInitialization(value *MachineInitializationStatusApplyConfiguration) *MachineStatusApplyConfiguration { + b.Initialization = value + return b +} + +// WithNodeRef sets the NodeRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeRef field is set to the value of the last call. +func (b *MachineStatusApplyConfiguration) WithNodeRef(value *MachineNodeReferenceApplyConfiguration) *MachineStatusApplyConfiguration { + b.NodeRef = value + return b +} + +// WithNodeInfo sets the NodeInfo field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeInfo field is set to the value of the last call. +func (b *MachineStatusApplyConfiguration) WithNodeInfo(value corev1.NodeSystemInfo) *MachineStatusApplyConfiguration { + b.NodeInfo = &value + return b +} + +// WithLastUpdated sets the LastUpdated field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastUpdated field is set to the value of the last call. +func (b *MachineStatusApplyConfiguration) WithLastUpdated(value metav1.Time) *MachineStatusApplyConfiguration { + b.LastUpdated = &value + return b +} + +// WithAddresses sets the Addresses field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Addresses field is set to the value of the last call. +func (b *MachineStatusApplyConfiguration) WithAddresses(value corev1beta2.MachineAddresses) *MachineStatusApplyConfiguration { + b.Addresses = &value + return b +} + +// WithFailureDomain sets the FailureDomain field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FailureDomain field is set to the value of the last call. +func (b *MachineStatusApplyConfiguration) WithFailureDomain(value string) *MachineStatusApplyConfiguration { + b.FailureDomain = &value + return b +} + +// WithPhase sets the Phase field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Phase field is set to the value of the last call. +func (b *MachineStatusApplyConfiguration) WithPhase(value string) *MachineStatusApplyConfiguration { + b.Phase = &value + return b +} + +// WithCertificatesExpiryDate sets the CertificatesExpiryDate field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CertificatesExpiryDate field is set to the value of the last call. +func (b *MachineStatusApplyConfiguration) WithCertificatesExpiryDate(value metav1.Time) *MachineStatusApplyConfiguration { + b.CertificatesExpiryDate = &value + return b +} + +// WithObservedGeneration sets the ObservedGeneration field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ObservedGeneration field is set to the value of the last call. +func (b *MachineStatusApplyConfiguration) WithObservedGeneration(value int64) *MachineStatusApplyConfiguration { + b.ObservedGeneration = &value + return b +} + +// WithDeletion sets the Deletion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Deletion field is set to the value of the last call. +func (b *MachineStatusApplyConfiguration) WithDeletion(value *MachineDeletionStatusApplyConfiguration) *MachineStatusApplyConfiguration { + b.Deletion = value + return b +} + +// WithDeprecated sets the Deprecated field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Deprecated field is set to the value of the last call. +func (b *MachineStatusApplyConfiguration) WithDeprecated(value *MachineDeprecatedStatusApplyConfiguration) *MachineStatusApplyConfiguration { + b.Deprecated = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinetaint.go b/util/applyconfigurations/core/v1beta2/machinetaint.go new file mode 100644 index 000000000000..b19b18947bfc --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinetaint.go @@ -0,0 +1,68 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + v1 "k8s.io/api/core/v1" + corev1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2" +) + +// MachineTaintApplyConfiguration represents a declarative configuration of the MachineTaint type for use +// with apply. +// +// MachineTaint defines a taint equivalent to corev1.Taint, but additionally having a propagation field. +type MachineTaintApplyConfiguration struct { + // key is the taint key to be applied to a node. + // Must be a valid qualified name of maximum size 63 characters + // with an optional subdomain prefix of maximum size 253 characters, + // separated by a `/`. + Key *string `json:"key,omitempty"` + // value is the taint value corresponding to the taint key. + // It must be a valid label value of maximum size 63 characters. + Value *string `json:"value,omitempty"` + // effect is the effect for the taint. Valid values are NoSchedule, PreferNoSchedule and NoExecute. + Effect *v1.TaintEffect `json:"effect,omitempty"` + // propagation defines how this taint should be propagated to nodes. + // Valid values are 'Always' and 'OnInitialization'. + // Always: The taint will be continuously reconciled. If it is not set for a node, it will be added during reconciliation. + // OnInitialization: The taint will be added during node initialization. If it gets removed from the node later on it will not get added again. + Propagation *corev1beta2.MachineTaintPropagation `json:"propagation,omitempty"` +} + +// MachineTaintApplyConfiguration constructs a declarative configuration of the MachineTaint type for use with +// apply. +func MachineTaint() *MachineTaintApplyConfiguration { + return &MachineTaintApplyConfiguration{} +} + +// WithKey sets the Key field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Key field is set to the value of the last call. +func (b *MachineTaintApplyConfiguration) WithKey(value string) *MachineTaintApplyConfiguration { + b.Key = &value + return b +} + +// WithValue sets the Value field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Value field is set to the value of the last call. +func (b *MachineTaintApplyConfiguration) WithValue(value string) *MachineTaintApplyConfiguration { + b.Value = &value + return b +} + +// WithEffect sets the Effect field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Effect field is set to the value of the last call. +func (b *MachineTaintApplyConfiguration) WithEffect(value v1.TaintEffect) *MachineTaintApplyConfiguration { + b.Effect = &value + return b +} + +// WithPropagation sets the Propagation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Propagation field is set to the value of the last call. +func (b *MachineTaintApplyConfiguration) WithPropagation(value corev1beta2.MachineTaintPropagation) *MachineTaintApplyConfiguration { + b.Propagation = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinetemplatespec.go b/util/applyconfigurations/core/v1beta2/machinetemplatespec.go new file mode 100644 index 000000000000..20ed097c025f --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinetemplatespec.go @@ -0,0 +1,66 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// MachineTemplateSpecApplyConfiguration represents a declarative configuration of the MachineTemplateSpec type for use +// with apply. +// +// MachineTemplateSpec describes the data needed to create a Machine from a template. +type MachineTemplateSpecApplyConfiguration struct { + // metadata is the standard object's metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + *ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + // spec is the specification of the desired behavior of the machine. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + Spec *MachineSpecApplyConfiguration `json:"spec,omitempty"` +} + +// MachineTemplateSpecApplyConfiguration constructs a declarative configuration of the MachineTemplateSpec type for use with +// apply. +func MachineTemplateSpec() *MachineTemplateSpecApplyConfiguration { + return &MachineTemplateSpecApplyConfiguration{} +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *MachineTemplateSpecApplyConfiguration) WithLabels(entries map[string]string) *MachineTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *MachineTemplateSpecApplyConfiguration) WithAnnotations(entries map[string]string) *MachineTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +func (b *MachineTemplateSpecApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *MachineTemplateSpecApplyConfiguration) WithSpec(value *MachineSpecApplyConfiguration) *MachineTemplateSpecApplyConfiguration { + b.Spec = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/machinev1beta1deprecatedstatus.go b/util/applyconfigurations/core/v1beta2/machinev1beta1deprecatedstatus.go new file mode 100644 index 000000000000..32aa86e57bb8 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/machinev1beta1deprecatedstatus.go @@ -0,0 +1,88 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + corev1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2" + errors "sigs.k8s.io/cluster-api/errors" +) + +// MachineV1Beta1DeprecatedStatusApplyConfiguration represents a declarative configuration of the MachineV1Beta1DeprecatedStatus type for use +// with apply. +// +// MachineV1Beta1DeprecatedStatus 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 MachineV1Beta1DeprecatedStatusApplyConfiguration struct { + // conditions defines current service state of the Machine. + // + // 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. + Conditions *corev1beta2.Conditions `json:"conditions,omitempty"` + // failureReason will be set in the event that there is a terminal problem + // reconciling the Machine and will contain a succinct value suitable + // for machine interpretation. + // + // This field should not be set for transitive errors that a controller + // faces that are expected to be fixed automatically over + // time (like service outages), but instead indicate that something is + // fundamentally wrong with the Machine's spec or the configuration of + // the controller, and that manual intervention is required. Examples + // of terminal errors would be invalid combinations of settings in the + // spec, values that are unsupported by the controller, or the + // responsible controller itself being critically misconfigured. + // + // Any transient errors that occur during the reconciliation of Machines + // can be added as events to the Machine object and/or logged in the + // controller's output. + // + // 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. + FailureReason *errors.MachineStatusError `json:"failureReason,omitempty"` + // failureMessage will be set in the event that there is a terminal problem + // reconciling the Machine and will contain a more verbose string suitable + // for logging and human consumption. + // + // This field should not be set for transitive errors that a controller + // faces that are expected to be fixed automatically over + // time (like service outages), but instead indicate that something is + // fundamentally wrong with the Machine's spec or the configuration of + // the controller, and that manual intervention is required. Examples + // of terminal errors would be invalid combinations of settings in the + // spec, values that are unsupported by the controller, or the + // responsible controller itself being critically misconfigured. + // + // Any transient errors that occur during the reconciliation of Machines + // can be added as events to the Machine object and/or logged in the + // controller's output. + // + // 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. + FailureMessage *string `json:"failureMessage,omitempty"` +} + +// MachineV1Beta1DeprecatedStatusApplyConfiguration constructs a declarative configuration of the MachineV1Beta1DeprecatedStatus type for use with +// apply. +func MachineV1Beta1DeprecatedStatus() *MachineV1Beta1DeprecatedStatusApplyConfiguration { + return &MachineV1Beta1DeprecatedStatusApplyConfiguration{} +} + +// WithConditions sets the Conditions field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Conditions field is set to the value of the last call. +func (b *MachineV1Beta1DeprecatedStatusApplyConfiguration) WithConditions(value corev1beta2.Conditions) *MachineV1Beta1DeprecatedStatusApplyConfiguration { + b.Conditions = &value + return b +} + +// WithFailureReason sets the FailureReason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FailureReason field is set to the value of the last call. +func (b *MachineV1Beta1DeprecatedStatusApplyConfiguration) WithFailureReason(value errors.MachineStatusError) *MachineV1Beta1DeprecatedStatusApplyConfiguration { + b.FailureReason = &value + return b +} + +// WithFailureMessage sets the FailureMessage field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FailureMessage field is set to the value of the last call. +func (b *MachineV1Beta1DeprecatedStatusApplyConfiguration) WithFailureMessage(value string) *MachineV1Beta1DeprecatedStatusApplyConfiguration { + b.FailureMessage = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/networkranges.go b/util/applyconfigurations/core/v1beta2/networkranges.go new file mode 100644 index 000000000000..0472a662a0b8 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/networkranges.go @@ -0,0 +1,28 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// NetworkRangesApplyConfiguration represents a declarative configuration of the NetworkRanges type for use +// with apply. +// +// NetworkRanges represents ranges of network addresses. +type NetworkRangesApplyConfiguration struct { + // cidrBlocks is a list of CIDR blocks. + CIDRBlocks []string `json:"cidrBlocks,omitempty"` +} + +// NetworkRangesApplyConfiguration constructs a declarative configuration of the NetworkRanges type for use with +// apply. +func NetworkRanges() *NetworkRangesApplyConfiguration { + return &NetworkRangesApplyConfiguration{} +} + +// WithCIDRBlocks adds the given value to the CIDRBlocks field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the CIDRBlocks field. +func (b *NetworkRangesApplyConfiguration) WithCIDRBlocks(values ...string) *NetworkRangesApplyConfiguration { + for i := range values { + b.CIDRBlocks = append(b.CIDRBlocks, values[i]) + } + return b +} diff --git a/util/applyconfigurations/core/v1beta2/objectmeta.go b/util/applyconfigurations/core/v1beta2/objectmeta.go new file mode 100644 index 000000000000..9dd23edfe255 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/objectmeta.go @@ -0,0 +1,74 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// ObjectMetaApplyConfiguration represents a declarative configuration of the ObjectMeta type for use +// with apply. +// +// ObjectMeta is metadata that all persisted resources must have, which includes all objects +// users must create. This is a copy of customizable fields from metav1.ObjectMeta. +// +// ObjectMeta is embedded in `Machine.Spec`, `MachineDeployment.Template` and `MachineSet.Template`, +// which are not top-level Kubernetes objects. Given that metav1.ObjectMeta has lots of special cases +// and read-only fields which end up in the generated CRD validation, having it as a subset simplifies +// the API and some issues that can impact user experience. +// +// During the [upgrade to controller-tools@v2](https://github.com/kubernetes-sigs/cluster-api/pull/1054) +// for v1alpha2, we noticed a failure would occur running Cluster API test suite against the new CRDs, +// specifically `spec.metadata.creationTimestamp in body must be of type string: "null"`. +// The investigation showed that `controller-tools@v2` behaves differently than its previous version +// when handling types from [metav1](k8s.io/apimachinery/pkg/apis/meta/v1) package. +// +// In more details, we found that embedded (non-top level) types that embedded `metav1.ObjectMeta` +// had validation properties, including for `creationTimestamp` (metav1.Time). +// The `metav1.Time` type specifies a custom json marshaller that, when IsZero() is true, returns `null` +// which breaks validation because the field isn't marked as nullable. +// +// In future versions, controller-tools@v2 might allow overriding the type and validation for embedded +// types. When that happens, this hack should be revisited. +type ObjectMetaApplyConfiguration struct { + // labels is a map of string keys and values that can be used to organize and categorize + // (scope and select) objects. May match selectors of replication controllers + // and services. + // More info: http://kubernetes.io/docs/user-guide/labels + Labels map[string]string `json:"labels,omitempty"` + // annotations is an unstructured key value map stored with a resource that may be + // set by external tools to store and retrieve arbitrary metadata. They are not + // queryable and should be preserved when modifying objects. + // More info: http://kubernetes.io/docs/user-guide/annotations + Annotations map[string]string `json:"annotations,omitempty"` +} + +// ObjectMetaApplyConfiguration constructs a declarative configuration of the ObjectMeta type for use with +// apply. +func ObjectMeta() *ObjectMetaApplyConfiguration { + return &ObjectMetaApplyConfiguration{} +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ObjectMetaApplyConfiguration) WithLabels(entries map[string]string) *ObjectMetaApplyConfiguration { + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ObjectMetaApplyConfiguration) WithAnnotations(entries map[string]string) *ObjectMetaApplyConfiguration { + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} diff --git a/util/applyconfigurations/core/v1beta2/patchdefinition.go b/util/applyconfigurations/core/v1beta2/patchdefinition.go new file mode 100644 index 000000000000..9c5a413872c8 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/patchdefinition.go @@ -0,0 +1,43 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// PatchDefinitionApplyConfiguration represents a declarative configuration of the PatchDefinition type for use +// with apply. +// +// PatchDefinition defines a patch which is applied to customize the referenced templates. +type PatchDefinitionApplyConfiguration struct { + // selector defines on which templates the patch should be applied. + Selector *PatchSelectorApplyConfiguration `json:"selector,omitempty"` + // jsonPatches defines the patches which should be applied on the templates + // matching the selector. + // Note: Patches will be applied in the order of the array. + JSONPatches []JSONPatchApplyConfiguration `json:"jsonPatches,omitempty"` +} + +// PatchDefinitionApplyConfiguration constructs a declarative configuration of the PatchDefinition type for use with +// apply. +func PatchDefinition() *PatchDefinitionApplyConfiguration { + return &PatchDefinitionApplyConfiguration{} +} + +// WithSelector sets the Selector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Selector field is set to the value of the last call. +func (b *PatchDefinitionApplyConfiguration) WithSelector(value *PatchSelectorApplyConfiguration) *PatchDefinitionApplyConfiguration { + b.Selector = value + return b +} + +// WithJSONPatches adds the given value to the JSONPatches field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the JSONPatches field. +func (b *PatchDefinitionApplyConfiguration) WithJSONPatches(values ...*JSONPatchApplyConfiguration) *PatchDefinitionApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithJSONPatches") + } + b.JSONPatches = append(b.JSONPatches, *values[i]) + } + return b +} diff --git a/util/applyconfigurations/core/v1beta2/patchselector.go b/util/applyconfigurations/core/v1beta2/patchselector.go new file mode 100644 index 000000000000..e42d16396faa --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/patchselector.go @@ -0,0 +1,52 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// PatchSelectorApplyConfiguration represents a declarative configuration of the PatchSelector type for use +// with apply. +// +// PatchSelector defines on which templates the patch should be applied. +// Note: Matching on APIVersion and Kind is mandatory, to enforce that the patches are +// written for the correct version. The version of the references in the ClusterClass may +// be automatically updated during reconciliation if there is a newer version for the same contract. +// Note: The results of selection based on the individual fields are ANDed. +type PatchSelectorApplyConfiguration struct { + // apiVersion filters templates by apiVersion. + // apiVersion must be fully qualified domain name followed by / and a version. + APIVersion *string `json:"apiVersion,omitempty"` + // kind filters templates by kind. + // kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character. + Kind *string `json:"kind,omitempty"` + // matchResources selects templates based on where they are referenced. + MatchResources *PatchSelectorMatchApplyConfiguration `json:"matchResources,omitempty"` +} + +// PatchSelectorApplyConfiguration constructs a declarative configuration of the PatchSelector type for use with +// apply. +func PatchSelector() *PatchSelectorApplyConfiguration { + return &PatchSelectorApplyConfiguration{} +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *PatchSelectorApplyConfiguration) WithAPIVersion(value string) *PatchSelectorApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *PatchSelectorApplyConfiguration) WithKind(value string) *PatchSelectorApplyConfiguration { + b.Kind = &value + return b +} + +// WithMatchResources sets the MatchResources field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MatchResources field is set to the value of the last call. +func (b *PatchSelectorApplyConfiguration) WithMatchResources(value *PatchSelectorMatchApplyConfiguration) *PatchSelectorApplyConfiguration { + b.MatchResources = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/patchselectormatch.go b/util/applyconfigurations/core/v1beta2/patchselectormatch.go new file mode 100644 index 000000000000..9e73a2347934 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/patchselectormatch.go @@ -0,0 +1,62 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// PatchSelectorMatchApplyConfiguration represents a declarative configuration of the PatchSelectorMatch type for use +// with apply. +// +// PatchSelectorMatch selects templates based on where they are referenced. +// Note: The selector must match at least one template. +// Note: The results of selection based on the individual fields are ORed. +type PatchSelectorMatchApplyConfiguration struct { + // controlPlane selects templates referenced in .spec.ControlPlane. + // Note: this will match the controlPlane and also the controlPlane + // machineInfrastructure (depending on the kind and apiVersion). + ControlPlane *bool `json:"controlPlane,omitempty"` + // infrastructureCluster selects templates referenced in .spec.infrastructure. + InfrastructureCluster *bool `json:"infrastructureCluster,omitempty"` + // machineDeploymentClass selects templates referenced in specific MachineDeploymentClasses in + // .spec.workers.machineDeployments. + MachineDeploymentClass *PatchSelectorMatchMachineDeploymentClassApplyConfiguration `json:"machineDeploymentClass,omitempty"` + // machinePoolClass selects templates referenced in specific MachinePoolClasses in + // .spec.workers.machinePools. + MachinePoolClass *PatchSelectorMatchMachinePoolClassApplyConfiguration `json:"machinePoolClass,omitempty"` +} + +// PatchSelectorMatchApplyConfiguration constructs a declarative configuration of the PatchSelectorMatch type for use with +// apply. +func PatchSelectorMatch() *PatchSelectorMatchApplyConfiguration { + return &PatchSelectorMatchApplyConfiguration{} +} + +// WithControlPlane sets the ControlPlane field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ControlPlane field is set to the value of the last call. +func (b *PatchSelectorMatchApplyConfiguration) WithControlPlane(value bool) *PatchSelectorMatchApplyConfiguration { + b.ControlPlane = &value + return b +} + +// WithInfrastructureCluster sets the InfrastructureCluster field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the InfrastructureCluster field is set to the value of the last call. +func (b *PatchSelectorMatchApplyConfiguration) WithInfrastructureCluster(value bool) *PatchSelectorMatchApplyConfiguration { + b.InfrastructureCluster = &value + return b +} + +// WithMachineDeploymentClass sets the MachineDeploymentClass field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MachineDeploymentClass field is set to the value of the last call. +func (b *PatchSelectorMatchApplyConfiguration) WithMachineDeploymentClass(value *PatchSelectorMatchMachineDeploymentClassApplyConfiguration) *PatchSelectorMatchApplyConfiguration { + b.MachineDeploymentClass = value + return b +} + +// WithMachinePoolClass sets the MachinePoolClass field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MachinePoolClass field is set to the value of the last call. +func (b *PatchSelectorMatchApplyConfiguration) WithMachinePoolClass(value *PatchSelectorMatchMachinePoolClassApplyConfiguration) *PatchSelectorMatchApplyConfiguration { + b.MachinePoolClass = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/patchselectormatchmachinedeploymentclass.go b/util/applyconfigurations/core/v1beta2/patchselectormatchmachinedeploymentclass.go new file mode 100644 index 000000000000..2ba3612e803e --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/patchselectormatchmachinedeploymentclass.go @@ -0,0 +1,29 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// PatchSelectorMatchMachineDeploymentClassApplyConfiguration represents a declarative configuration of the PatchSelectorMatchMachineDeploymentClass type for use +// with apply. +// +// PatchSelectorMatchMachineDeploymentClass selects templates referenced +// in specific MachineDeploymentClasses in .spec.workers.machineDeployments. +type PatchSelectorMatchMachineDeploymentClassApplyConfiguration struct { + // names selects templates by class names. + Names []string `json:"names,omitempty"` +} + +// PatchSelectorMatchMachineDeploymentClassApplyConfiguration constructs a declarative configuration of the PatchSelectorMatchMachineDeploymentClass type for use with +// apply. +func PatchSelectorMatchMachineDeploymentClass() *PatchSelectorMatchMachineDeploymentClassApplyConfiguration { + return &PatchSelectorMatchMachineDeploymentClassApplyConfiguration{} +} + +// WithNames adds the given value to the Names field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Names field. +func (b *PatchSelectorMatchMachineDeploymentClassApplyConfiguration) WithNames(values ...string) *PatchSelectorMatchMachineDeploymentClassApplyConfiguration { + for i := range values { + b.Names = append(b.Names, values[i]) + } + return b +} diff --git a/util/applyconfigurations/core/v1beta2/patchselectormatchmachinepoolclass.go b/util/applyconfigurations/core/v1beta2/patchselectormatchmachinepoolclass.go new file mode 100644 index 000000000000..cf10877b28c3 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/patchselectormatchmachinepoolclass.go @@ -0,0 +1,29 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// PatchSelectorMatchMachinePoolClassApplyConfiguration represents a declarative configuration of the PatchSelectorMatchMachinePoolClass type for use +// with apply. +// +// PatchSelectorMatchMachinePoolClass selects templates referenced +// in specific MachinePoolClasses in .spec.workers.machinePools. +type PatchSelectorMatchMachinePoolClassApplyConfiguration struct { + // names selects templates by class names. + Names []string `json:"names,omitempty"` +} + +// PatchSelectorMatchMachinePoolClassApplyConfiguration constructs a declarative configuration of the PatchSelectorMatchMachinePoolClass type for use with +// apply. +func PatchSelectorMatchMachinePoolClass() *PatchSelectorMatchMachinePoolClassApplyConfiguration { + return &PatchSelectorMatchMachinePoolClassApplyConfiguration{} +} + +// WithNames adds the given value to the Names field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Names field. +func (b *PatchSelectorMatchMachinePoolClassApplyConfiguration) WithNames(values ...string) *PatchSelectorMatchMachinePoolClassApplyConfiguration { + for i := range values { + b.Names = append(b.Names, values[i]) + } + return b +} diff --git a/util/applyconfigurations/core/v1beta2/topology.go b/util/applyconfigurations/core/v1beta2/topology.go new file mode 100644 index 000000000000..2d1107728338 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/topology.go @@ -0,0 +1,74 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// TopologyApplyConfiguration represents a declarative configuration of the Topology type for use +// with apply. +// +// Topology encapsulates the information of the managed resources. +type TopologyApplyConfiguration struct { + // classRef is the ref to the ClusterClass that should be used for the topology. + ClassRef *ClusterClassRefApplyConfiguration `json:"classRef,omitempty"` + // version is the Kubernetes version of the cluster. + Version *string `json:"version,omitempty"` + // controlPlane describes the cluster control plane. + ControlPlane *ControlPlaneTopologyApplyConfiguration `json:"controlPlane,omitempty"` + // workers encapsulates the different constructs that form the worker nodes + // for the cluster. + Workers *WorkersTopologyApplyConfiguration `json:"workers,omitempty"` + // variables can be used to customize the Cluster through + // patches. They must comply to the corresponding + // VariableClasses defined in the ClusterClass. + Variables []ClusterVariableApplyConfiguration `json:"variables,omitempty"` +} + +// TopologyApplyConfiguration constructs a declarative configuration of the Topology type for use with +// apply. +func Topology() *TopologyApplyConfiguration { + return &TopologyApplyConfiguration{} +} + +// WithClassRef sets the ClassRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ClassRef field is set to the value of the last call. +func (b *TopologyApplyConfiguration) WithClassRef(value *ClusterClassRefApplyConfiguration) *TopologyApplyConfiguration { + b.ClassRef = value + return b +} + +// WithVersion sets the Version field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Version field is set to the value of the last call. +func (b *TopologyApplyConfiguration) WithVersion(value string) *TopologyApplyConfiguration { + b.Version = &value + return b +} + +// WithControlPlane sets the ControlPlane field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ControlPlane field is set to the value of the last call. +func (b *TopologyApplyConfiguration) WithControlPlane(value *ControlPlaneTopologyApplyConfiguration) *TopologyApplyConfiguration { + b.ControlPlane = value + return b +} + +// WithWorkers sets the Workers field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Workers field is set to the value of the last call. +func (b *TopologyApplyConfiguration) WithWorkers(value *WorkersTopologyApplyConfiguration) *TopologyApplyConfiguration { + b.Workers = value + return b +} + +// WithVariables adds the given value to the Variables field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Variables field. +func (b *TopologyApplyConfiguration) WithVariables(values ...*ClusterVariableApplyConfiguration) *TopologyApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithVariables") + } + b.Variables = append(b.Variables, *values[i]) + } + return b +} diff --git a/util/applyconfigurations/core/v1beta2/unhealthymachinecondition.go b/util/applyconfigurations/core/v1beta2/unhealthymachinecondition.go new file mode 100644 index 000000000000..90a3c30ed528 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/unhealthymachinecondition.go @@ -0,0 +1,55 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// UnhealthyMachineConditionApplyConfiguration represents a declarative configuration of the UnhealthyMachineCondition type for use +// with apply. +// +// UnhealthyMachineCondition represents a Machine condition type and value with a timeout +// specified as a duration. When the named condition has been in the given +// status for at least the timeout value, a machine is considered unhealthy. +type UnhealthyMachineConditionApplyConfiguration struct { + // type of Machine condition + Type *string `json:"type,omitempty"` + // status of the condition, one of True, False, Unknown. + Status *v1.ConditionStatus `json:"status,omitempty"` + // timeoutSeconds is the duration that a machine must be in a given status for, + // after which the machine is considered unhealthy. + // For example, with a value of "3600", the machine must match the status + // for at least 1 hour before being considered unhealthy. + TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"` +} + +// UnhealthyMachineConditionApplyConfiguration constructs a declarative configuration of the UnhealthyMachineCondition type for use with +// apply. +func UnhealthyMachineCondition() *UnhealthyMachineConditionApplyConfiguration { + return &UnhealthyMachineConditionApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *UnhealthyMachineConditionApplyConfiguration) WithType(value string) *UnhealthyMachineConditionApplyConfiguration { + b.Type = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *UnhealthyMachineConditionApplyConfiguration) WithStatus(value v1.ConditionStatus) *UnhealthyMachineConditionApplyConfiguration { + b.Status = &value + return b +} + +// WithTimeoutSeconds sets the TimeoutSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TimeoutSeconds field is set to the value of the last call. +func (b *UnhealthyMachineConditionApplyConfiguration) WithTimeoutSeconds(value int32) *UnhealthyMachineConditionApplyConfiguration { + b.TimeoutSeconds = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/unhealthynodecondition.go b/util/applyconfigurations/core/v1beta2/unhealthynodecondition.go new file mode 100644 index 000000000000..30be99e24c70 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/unhealthynodecondition.go @@ -0,0 +1,55 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + v1 "k8s.io/api/core/v1" +) + +// UnhealthyNodeConditionApplyConfiguration represents a declarative configuration of the UnhealthyNodeCondition type for use +// with apply. +// +// UnhealthyNodeCondition represents a Node condition type and value with a timeout +// specified as a duration. When the named condition has been in the given +// status for at least the timeout value, a node is considered unhealthy. +type UnhealthyNodeConditionApplyConfiguration struct { + // type of Node condition + Type *v1.NodeConditionType `json:"type,omitempty"` + // status of the condition, one of True, False, Unknown. + Status *v1.ConditionStatus `json:"status,omitempty"` + // timeoutSeconds is the duration that a node must be in a given status for, + // after which the node is considered unhealthy. + // For example, with a value of "3600", the node must match the status + // for at least 1 hour before being considered unhealthy. + TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"` +} + +// UnhealthyNodeConditionApplyConfiguration constructs a declarative configuration of the UnhealthyNodeCondition type for use with +// apply. +func UnhealthyNodeCondition() *UnhealthyNodeConditionApplyConfiguration { + return &UnhealthyNodeConditionApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *UnhealthyNodeConditionApplyConfiguration) WithType(value v1.NodeConditionType) *UnhealthyNodeConditionApplyConfiguration { + b.Type = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *UnhealthyNodeConditionApplyConfiguration) WithStatus(value v1.ConditionStatus) *UnhealthyNodeConditionApplyConfiguration { + b.Status = &value + return b +} + +// WithTimeoutSeconds sets the TimeoutSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TimeoutSeconds field is set to the value of the last call. +func (b *UnhealthyNodeConditionApplyConfiguration) WithTimeoutSeconds(value int32) *UnhealthyNodeConditionApplyConfiguration { + b.TimeoutSeconds = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/validationrule.go b/util/applyconfigurations/core/v1beta2/validationrule.go new file mode 100644 index 000000000000..bb941b03fd93 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/validationrule.go @@ -0,0 +1,137 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +import ( + corev1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2" +) + +// ValidationRuleApplyConfiguration represents a declarative configuration of the ValidationRule type for use +// with apply. +// +// ValidationRule describes a validation rule written in the CEL expression language. +type ValidationRuleApplyConfiguration struct { + // rule represents the expression which will be evaluated by CEL. + // ref: https://github.com/google/cel-spec + // The Rule is scoped to the location of the x-kubernetes-validations extension in the schema. + // The `self` variable in the CEL expression is bound to the scoped value. + // If the Rule is scoped to an object with properties, the accessible properties of the object are field selectable + // via `self.field` and field presence can be checked via `has(self.field)`. + // If the Rule is scoped to an object with additionalProperties (i.e. a map) the value of the map + // are accessible via `self[mapKey]`, map containment can be checked via `mapKey in self` and all entries of the map + // are accessible via CEL macros and functions such as `self.all(...)`. + // If the Rule is scoped to an array, the elements of the array are accessible via `self[i]` and also by macros and + // functions. + // If the Rule is scoped to a scalar, `self` is bound to the scalar value. + // Examples: + // - Rule scoped to a map of objects: {"rule": "self.components['Widget'].priority < 10"} + // - Rule scoped to a list of integers: {"rule": "self.values.all(value, value >= 0 && value < 100)"} + // - Rule scoped to a string value: {"rule": "self.startsWith('kube')"} + // + // Unknown data preserved in custom resources via x-kubernetes-preserve-unknown-fields is not accessible in CEL + // expressions. This includes: + // - Unknown field values that are preserved by object schemas with x-kubernetes-preserve-unknown-fields. + // - Object properties where the property schema is of an "unknown type". An "unknown type" is recursively defined as: + // - A schema with no type and x-kubernetes-preserve-unknown-fields set to true + // - An array where the items schema is of an "unknown type" + // - An object where the additionalProperties schema is of an "unknown type" + // + // Only property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible. + // Accessible property names are escaped according to the following rules when accessed in the expression: + // - '__' escapes to '__underscores__' + // - '.' escapes to '__dot__' + // - '-' escapes to '__dash__' + // - '/' escapes to '__slash__' + // - Property names that exactly match a CEL RESERVED keyword escape to '__{keyword}__'. The keywords are: + // "true", "false", "null", "in", "as", "break", "const", "continue", "else", "for", "function", "if", + // "import", "let", "loop", "package", "namespace", "return". + // Examples: + // - Rule accessing a property named "namespace": {"rule": "self.__namespace__ > 0"} + // - Rule accessing a property named "x-prop": {"rule": "self.x__dash__prop > 0"} + // - Rule accessing a property named "redact__d": {"rule": "self.redact__underscores__d > 0"} + // + // If `rule` makes use of the `oldSelf` variable it is implicitly a + // `transition rule`. + // + // By default, the `oldSelf` variable is the same type as `self`. + // + // Transition rules by default are applied only on UPDATE requests and are + // skipped if an old value could not be found. + Rule *string `json:"rule,omitempty"` + // message represents the message displayed when validation fails. The message is required if the Rule contains + // line breaks. The message must not contain line breaks. + // If unset, the message is "failed rule: {Rule}". + // e.g. "must be a URL with the host matching spec.host" + Message *string `json:"message,omitempty"` + // messageExpression declares a CEL expression that evaluates to the validation failure message that is returned when this rule fails. + // Since messageExpression is used as a failure message, it must evaluate to a string. + // If both message and messageExpression are present on a rule, then messageExpression will be used if validation + // fails. If messageExpression results in a runtime error, the validation failure message is produced + // as if the messageExpression field were unset. If messageExpression evaluates to an empty string, a string with only spaces, or a string + // that contains line breaks, then the validation failure message will also be produced as if the messageExpression field were unset. + // messageExpression has access to all the same variables as the rule; the only difference is the return type. + // Example: + // "x must be less than max ("+string(self.max)+")" + MessageExpression *string `json:"messageExpression,omitempty"` + // reason provides a machine-readable validation failure reason that is returned to the caller when a request fails this validation rule. + // The currently supported reasons are: "FieldValueInvalid", "FieldValueForbidden", "FieldValueRequired", "FieldValueDuplicate". + // If not set, default to use "FieldValueInvalid". + // All future added reasons must be accepted by clients when reading this value and unknown reasons should be treated as FieldValueInvalid. + Reason *corev1beta2.FieldValueErrorReason `json:"reason,omitempty"` + // fieldPath represents the field path returned when the validation fails. + // It must be a relative JSON path (i.e. with array notation) scoped to the location of this x-kubernetes-validations extension in the schema and refer to an existing field. + // e.g. when validation checks if a specific attribute `foo` under a map `testMap`, the fieldPath could be set to `.testMap.foo` + // If the validation checks two lists must have unique attributes, the fieldPath could be set to either of the list: e.g. `.testList` + // It does not support list numeric index. + // It supports child operation to refer to an existing field currently. Refer to [JSONPath support in Kubernetes](https://kubernetes.io/docs/reference/kubectl/jsonpath/) for more info. + // Numeric index of array is not supported. + // For field name which contains special characters, use `['specialName']` to refer the field name. + // e.g. for attribute `foo.34$` appears in a list `testList`, the fieldPath could be set to `.testList['foo.34$']` + FieldPath *string `json:"fieldPath,omitempty"` +} + +// ValidationRuleApplyConfiguration constructs a declarative configuration of the ValidationRule type for use with +// apply. +func ValidationRule() *ValidationRuleApplyConfiguration { + return &ValidationRuleApplyConfiguration{} +} + +// WithRule sets the Rule field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Rule field is set to the value of the last call. +func (b *ValidationRuleApplyConfiguration) WithRule(value string) *ValidationRuleApplyConfiguration { + b.Rule = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *ValidationRuleApplyConfiguration) WithMessage(value string) *ValidationRuleApplyConfiguration { + b.Message = &value + return b +} + +// WithMessageExpression sets the MessageExpression field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MessageExpression field is set to the value of the last call. +func (b *ValidationRuleApplyConfiguration) WithMessageExpression(value string) *ValidationRuleApplyConfiguration { + b.MessageExpression = &value + return b +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *ValidationRuleApplyConfiguration) WithReason(value corev1beta2.FieldValueErrorReason) *ValidationRuleApplyConfiguration { + b.Reason = &value + return b +} + +// WithFieldPath sets the FieldPath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FieldPath field is set to the value of the last call. +func (b *ValidationRuleApplyConfiguration) WithFieldPath(value string) *ValidationRuleApplyConfiguration { + b.FieldPath = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/variableschema.go b/util/applyconfigurations/core/v1beta2/variableschema.go new file mode 100644 index 000000000000..9937a71e8684 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/variableschema.go @@ -0,0 +1,28 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// VariableSchemaApplyConfiguration represents a declarative configuration of the VariableSchema type for use +// with apply. +// +// VariableSchema defines the schema of a variable. +type VariableSchemaApplyConfiguration struct { + // openAPIV3Schema defines the schema of a variable via OpenAPI v3 + // schema. The schema is a subset of the schema used in + // Kubernetes CRDs. + OpenAPIV3Schema *JSONSchemaPropsApplyConfiguration `json:"openAPIV3Schema,omitempty"` +} + +// VariableSchemaApplyConfiguration constructs a declarative configuration of the VariableSchema type for use with +// apply. +func VariableSchema() *VariableSchemaApplyConfiguration { + return &VariableSchemaApplyConfiguration{} +} + +// WithOpenAPIV3Schema sets the OpenAPIV3Schema field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the OpenAPIV3Schema field is set to the value of the last call. +func (b *VariableSchemaApplyConfiguration) WithOpenAPIV3Schema(value *JSONSchemaPropsApplyConfiguration) *VariableSchemaApplyConfiguration { + b.OpenAPIV3Schema = value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/variableschemametadata.go b/util/applyconfigurations/core/v1beta2/variableschemametadata.go new file mode 100644 index 000000000000..9211b4d97772 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/variableschemametadata.go @@ -0,0 +1,52 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// VariableSchemaMetadataApplyConfiguration represents a declarative configuration of the VariableSchemaMetadata type for use +// with apply. +// +// VariableSchemaMetadata is the metadata of a variable or a nested field within a variable. +// It can be used to add additional data for higher level tools. +type VariableSchemaMetadataApplyConfiguration struct { + // labels is a map of string keys and values that can be used to organize and categorize + // (scope and select) variables. + Labels map[string]string `json:"labels,omitempty"` + // annotations is an unstructured key value map that can be used to store and + // retrieve arbitrary metadata. + // They are not queryable. + Annotations map[string]string `json:"annotations,omitempty"` +} + +// VariableSchemaMetadataApplyConfiguration constructs a declarative configuration of the VariableSchemaMetadata type for use with +// apply. +func VariableSchemaMetadata() *VariableSchemaMetadataApplyConfiguration { + return &VariableSchemaMetadataApplyConfiguration{} +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *VariableSchemaMetadataApplyConfiguration) WithLabels(entries map[string]string) *VariableSchemaMetadataApplyConfiguration { + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *VariableSchemaMetadataApplyConfiguration) WithAnnotations(entries map[string]string) *VariableSchemaMetadataApplyConfiguration { + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} diff --git a/util/applyconfigurations/core/v1beta2/workersclass.go b/util/applyconfigurations/core/v1beta2/workersclass.go new file mode 100644 index 000000000000..3e869ec3062a --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/workersclass.go @@ -0,0 +1,48 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// WorkersClassApplyConfiguration represents a declarative configuration of the WorkersClass type for use +// with apply. +// +// WorkersClass is a collection of deployment classes. +type WorkersClassApplyConfiguration struct { + // machineDeployments is a list of machine deployment classes that can be used to create + // a set of worker nodes. + MachineDeployments []MachineDeploymentClassApplyConfiguration `json:"machineDeployments,omitempty"` + // machinePools is a list of machine pool classes that can be used to create + // a set of worker nodes. + MachinePools []MachinePoolClassApplyConfiguration `json:"machinePools,omitempty"` +} + +// WorkersClassApplyConfiguration constructs a declarative configuration of the WorkersClass type for use with +// apply. +func WorkersClass() *WorkersClassApplyConfiguration { + return &WorkersClassApplyConfiguration{} +} + +// WithMachineDeployments adds the given value to the MachineDeployments field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the MachineDeployments field. +func (b *WorkersClassApplyConfiguration) WithMachineDeployments(values ...*MachineDeploymentClassApplyConfiguration) *WorkersClassApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithMachineDeployments") + } + b.MachineDeployments = append(b.MachineDeployments, *values[i]) + } + return b +} + +// WithMachinePools adds the given value to the MachinePools field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the MachinePools field. +func (b *WorkersClassApplyConfiguration) WithMachinePools(values ...*MachinePoolClassApplyConfiguration) *WorkersClassApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithMachinePools") + } + b.MachinePools = append(b.MachinePools, *values[i]) + } + return b +} diff --git a/util/applyconfigurations/core/v1beta2/workersstatus.go b/util/applyconfigurations/core/v1beta2/workersstatus.go new file mode 100644 index 000000000000..9d2973b7e1b1 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/workersstatus.go @@ -0,0 +1,67 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// WorkersStatusApplyConfiguration represents a declarative configuration of the WorkersStatus type for use +// with apply. +// +// WorkersStatus groups all the observations about workers current state. +type WorkersStatusApplyConfiguration struct { + // desiredReplicas is the total number of desired worker machines in this cluster. + DesiredReplicas *int32 `json:"desiredReplicas,omitempty"` + // replicas is the total number of worker machines in this cluster. + // NOTE: replicas also includes machines still being provisioned or being deleted. + Replicas *int32 `json:"replicas,omitempty"` + // upToDateReplicas is the number of up-to-date worker machines in this cluster. A machine is considered up-to-date when Machine's UpToDate condition is true. + UpToDateReplicas *int32 `json:"upToDateReplicas,omitempty"` + // readyReplicas is the total number of ready worker machines in this cluster. A machine is considered ready when Machine's Ready condition is true. + ReadyReplicas *int32 `json:"readyReplicas,omitempty"` + // availableReplicas is the total number of available worker machines in this cluster. A machine is considered available when Machine's Available condition is true. + AvailableReplicas *int32 `json:"availableReplicas,omitempty"` +} + +// WorkersStatusApplyConfiguration constructs a declarative configuration of the WorkersStatus type for use with +// apply. +func WorkersStatus() *WorkersStatusApplyConfiguration { + return &WorkersStatusApplyConfiguration{} +} + +// WithDesiredReplicas sets the DesiredReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DesiredReplicas field is set to the value of the last call. +func (b *WorkersStatusApplyConfiguration) WithDesiredReplicas(value int32) *WorkersStatusApplyConfiguration { + b.DesiredReplicas = &value + return b +} + +// WithReplicas sets the Replicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Replicas field is set to the value of the last call. +func (b *WorkersStatusApplyConfiguration) WithReplicas(value int32) *WorkersStatusApplyConfiguration { + b.Replicas = &value + return b +} + +// WithUpToDateReplicas sets the UpToDateReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UpToDateReplicas field is set to the value of the last call. +func (b *WorkersStatusApplyConfiguration) WithUpToDateReplicas(value int32) *WorkersStatusApplyConfiguration { + b.UpToDateReplicas = &value + return b +} + +// WithReadyReplicas sets the ReadyReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadyReplicas field is set to the value of the last call. +func (b *WorkersStatusApplyConfiguration) WithReadyReplicas(value int32) *WorkersStatusApplyConfiguration { + b.ReadyReplicas = &value + return b +} + +// WithAvailableReplicas sets the AvailableReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AvailableReplicas field is set to the value of the last call. +func (b *WorkersStatusApplyConfiguration) WithAvailableReplicas(value int32) *WorkersStatusApplyConfiguration { + b.AvailableReplicas = &value + return b +} diff --git a/util/applyconfigurations/core/v1beta2/workerstopology.go b/util/applyconfigurations/core/v1beta2/workerstopology.go new file mode 100644 index 000000000000..1bb600242436 --- /dev/null +++ b/util/applyconfigurations/core/v1beta2/workerstopology.go @@ -0,0 +1,46 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package v1beta2 + +// WorkersTopologyApplyConfiguration represents a declarative configuration of the WorkersTopology type for use +// with apply. +// +// WorkersTopology represents the different sets of worker nodes in the cluster. +type WorkersTopologyApplyConfiguration struct { + // machineDeployments is a list of machine deployments in the cluster. + MachineDeployments []MachineDeploymentTopologyApplyConfiguration `json:"machineDeployments,omitempty"` + // machinePools is a list of machine pools in the cluster. + MachinePools []MachinePoolTopologyApplyConfiguration `json:"machinePools,omitempty"` +} + +// WorkersTopologyApplyConfiguration constructs a declarative configuration of the WorkersTopology type for use with +// apply. +func WorkersTopology() *WorkersTopologyApplyConfiguration { + return &WorkersTopologyApplyConfiguration{} +} + +// WithMachineDeployments adds the given value to the MachineDeployments field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the MachineDeployments field. +func (b *WorkersTopologyApplyConfiguration) WithMachineDeployments(values ...*MachineDeploymentTopologyApplyConfiguration) *WorkersTopologyApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithMachineDeployments") + } + b.MachineDeployments = append(b.MachineDeployments, *values[i]) + } + return b +} + +// WithMachinePools adds the given value to the MachinePools field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the MachinePools field. +func (b *WorkersTopologyApplyConfiguration) WithMachinePools(values ...*MachinePoolTopologyApplyConfiguration) *WorkersTopologyApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithMachinePools") + } + b.MachinePools = append(b.MachinePools, *values[i]) + } + return b +} diff --git a/util/applyconfigurations/internal/internal.go b/util/applyconfigurations/internal/internal.go new file mode 100644 index 000000000000..20ce95f6254c --- /dev/null +++ b/util/applyconfigurations/internal/internal.go @@ -0,0 +1,2584 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package internal + +import ( + fmt "fmt" + sync "sync" + + typed "sigs.k8s.io/structured-merge-diff/v6/typed" +) + +func Parser() *typed.Parser { + parserOnce.Do(func() { + var err error + parser, err = typed.NewParser(schemaYAML) + if err != nil { + panic(fmt.Sprintf("Failed to parse schema: %v", err)) + } + }) + return parser +} + +var parserOnce sync.Once +var parser *typed.Parser +var schemaYAML = typed.YAMLObject(`types: +- name: io.k8s.api.core.v1.ConditionStatus + scalar: string +- name: io.k8s.api.core.v1.NodeConditionType + scalar: string +- name: io.k8s.api.core.v1.NodeSwapStatus + map: + fields: + - name: capacity + type: + scalar: numeric +- name: io.k8s.api.core.v1.NodeSystemInfo + map: + fields: + - name: architecture + type: + scalar: string + - name: bootID + type: + scalar: string + - name: containerRuntimeVersion + type: + scalar: string + - name: kernelVersion + type: + scalar: string + - name: kubeProxyVersion + type: + scalar: string + - name: kubeletVersion + type: + scalar: string + - name: machineID + type: + scalar: string + - name: operatingSystem + type: + scalar: string + - name: osImage + type: + scalar: string + - name: swap + type: + namedType: io.k8s.api.core.v1.NodeSwapStatus + - name: systemUUID + type: + scalar: string +- name: io.k8s.api.core.v1.ObjectReference + map: + fields: + - name: apiVersion + type: + scalar: string + - name: fieldPath + type: + scalar: string + - name: kind + type: + scalar: string + - name: name + type: + scalar: string + - name: namespace + type: + scalar: string + - name: resourceVersion + type: + scalar: string + - name: uid + type: + namedType: io.k8s.apimachinery.pkg.types.UID + elementRelationship: atomic +- name: io.k8s.api.core.v1.TaintEffect + scalar: string +- name: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSON + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +- name: io.k8s.apimachinery.pkg.apis.meta.v1.Condition + map: + fields: + - name: lastTransitionTime + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + - name: message + type: + scalar: string + - name: observedGeneration + type: + scalar: numeric + - name: reason + type: + scalar: string + - name: status + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ConditionStatus + - name: type + type: + scalar: string +- name: io.k8s.apimachinery.pkg.apis.meta.v1.ConditionStatus + scalar: string +- name: io.k8s.apimachinery.pkg.apis.meta.v1.FieldsV1 + map: + elementType: + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +- name: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector + map: + fields: + - name: matchExpressions + type: + list: + elementType: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelectorRequirement + elementRelationship: atomic + - name: matchLabels + type: + map: + elementType: + scalar: string + elementRelationship: atomic +- name: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelectorOperator + scalar: string +- name: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelectorRequirement + map: + fields: + - name: key + type: + scalar: string + - name: operator + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelectorOperator + - name: values + type: + list: + elementType: + scalar: string + elementRelationship: atomic +- name: io.k8s.apimachinery.pkg.apis.meta.v1.ManagedFieldsEntry + map: + fields: + - name: apiVersion + type: + scalar: string + - name: fieldsType + type: + scalar: string + - name: fieldsV1 + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.FieldsV1 + - name: manager + type: + scalar: string + - name: operation + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ManagedFieldsOperationType + - name: subresource + type: + scalar: string + - name: time + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time +- name: io.k8s.apimachinery.pkg.apis.meta.v1.ManagedFieldsOperationType + scalar: string +- name: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + map: + fields: + - name: annotations + type: + map: + elementType: + scalar: string + - name: creationTimestamp + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + - name: deletionGracePeriodSeconds + type: + scalar: numeric + - name: deletionTimestamp + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + - name: finalizers + type: + list: + elementType: + scalar: string + elementRelationship: associative + - name: generateName + type: + scalar: string + - name: generation + type: + scalar: numeric + - name: labels + type: + map: + elementType: + scalar: string + - name: managedFields + type: + list: + elementType: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ManagedFieldsEntry + elementRelationship: atomic + - name: name + type: + scalar: string + - name: namespace + type: + scalar: string + - name: ownerReferences + type: + list: + elementType: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.OwnerReference + elementRelationship: associative + keys: + - uid + - name: resourceVersion + type: + scalar: string + - name: selfLink + type: + scalar: string + - name: uid + type: + namedType: io.k8s.apimachinery.pkg.types.UID +- name: io.k8s.apimachinery.pkg.apis.meta.v1.OwnerReference + map: + fields: + - name: apiVersion + type: + scalar: string + - name: blockOwnerDeletion + type: + scalar: boolean + - name: controller + type: + scalar: boolean + - name: kind + type: + scalar: string + - name: name + type: + scalar: string + - name: uid + type: + namedType: io.k8s.apimachinery.pkg.types.UID + elementRelationship: atomic +- name: io.k8s.apimachinery.pkg.apis.meta.v1.Time + scalar: untyped +- name: io.k8s.apimachinery.pkg.types.UID + scalar: string +- name: io.k8s.apimachinery.pkg.util.intstr.IntOrString + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.APIEndpoint + map: + fields: + - name: host + type: + scalar: string + - name: port + type: + scalar: numeric +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.Bootstrap + map: + fields: + - name: configRef + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ContractVersionedObjectReference + - name: dataSecretName + type: + scalar: string +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.Cluster + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + - name: spec + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterSpec + - name: status + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterStatus +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterAvailabilityGate + map: + fields: + - name: conditionType + type: + scalar: string + - name: polarity + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ConditionPolarity +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterClass + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + - name: spec + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterClassSpec + - name: status + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterClassStatus +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterClassDeprecatedStatus + map: + fields: + - name: v1beta1 + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterClassV1Beta1DeprecatedStatus +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterClassPatch + map: + fields: + - name: definitions + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.PatchDefinition + elementRelationship: atomic + - name: description + type: + scalar: string + - name: enabledIf + type: + scalar: string + - name: external + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ExternalPatchDefinition + - name: name + type: + scalar: string +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterClassRef + map: + fields: + - name: name + type: + scalar: string + - name: namespace + type: + scalar: string +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterClassSpec + map: + fields: + - name: availabilityGates + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterAvailabilityGate + elementRelationship: associative + keys: + - conditionType + - name: controlPlane + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ControlPlaneClass + - name: infrastructure + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.InfrastructureClass + - name: kubernetesVersions + type: + list: + elementType: + scalar: string + elementRelationship: atomic + - name: patches + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterClassPatch + elementRelationship: atomic + - name: upgrade + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterClassUpgrade + - name: variables + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterClassVariable + elementRelationship: atomic + - name: workers + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.WorkersClass +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterClassStatus + map: + fields: + - name: conditions + type: + list: + elementType: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Condition + elementRelationship: associative + keys: + - type + - name: deprecated + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterClassDeprecatedStatus + - name: observedGeneration + type: + scalar: numeric + - name: variables + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterClassStatusVariable + elementRelationship: atomic +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterClassStatusVariable + map: + fields: + - name: definitions + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterClassStatusVariableDefinition + elementRelationship: atomic + - name: definitionsConflict + type: + scalar: boolean + - name: name + type: + scalar: string +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterClassStatusVariableDefinition + map: + fields: + - name: deprecatedV1Beta1Metadata + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterClassVariableMetadata + - name: from + type: + scalar: string + - name: required + type: + scalar: boolean + - name: schema + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.VariableSchema +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterClassTemplateReference + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: name + type: + scalar: string +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterClassUpgrade + map: + fields: + - name: external + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterClassUpgradeExternal +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterClassUpgradeExternal + map: + fields: + - name: generateUpgradePlanExtension + type: + scalar: string +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterClassV1Beta1DeprecatedStatus + map: + fields: + - name: conditions + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.Conditions +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterClassVariable + map: + fields: + - name: deprecatedV1Beta1Metadata + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterClassVariableMetadata + - name: name + type: + scalar: string + - name: required + type: + scalar: boolean + - name: schema + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.VariableSchema +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterClassVariableMetadata + map: + fields: + - name: annotations + type: + map: + elementType: + scalar: string + - name: labels + type: + map: + elementType: + scalar: string +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterControlPlaneStatus + map: + fields: + - name: availableReplicas + type: + scalar: numeric + - name: desiredReplicas + type: + scalar: numeric + - name: readyReplicas + type: + scalar: numeric + - name: replicas + type: + scalar: numeric + - name: upToDateReplicas + type: + scalar: numeric +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterDeprecatedStatus + map: + fields: + - name: v1beta1 + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterV1Beta1DeprecatedStatus +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterInitializationStatus + map: + fields: + - name: controlPlaneInitialized + type: + scalar: boolean + - name: infrastructureProvisioned + type: + scalar: boolean +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterNetwork + map: + fields: + - name: apiServerPort + type: + scalar: numeric + - name: pods + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.NetworkRanges + - name: serviceDomain + type: + scalar: string + - name: services + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.NetworkRanges +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterSpec + map: + fields: + - name: availabilityGates + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterAvailabilityGate + elementRelationship: associative + keys: + - conditionType + - name: clusterNetwork + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterNetwork + - name: controlPlaneEndpoint + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.APIEndpoint + - name: controlPlaneRef + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ContractVersionedObjectReference + - name: infrastructureRef + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ContractVersionedObjectReference + - name: paused + type: + scalar: boolean + - name: topology + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.Topology +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterStatus + map: + fields: + - name: conditions + type: + list: + elementType: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Condition + elementRelationship: associative + keys: + - type + - name: controlPlane + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterControlPlaneStatus + - name: deprecated + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterDeprecatedStatus + - name: failureDomains + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.FailureDomain + elementRelationship: associative + keys: + - name + - name: initialization + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterInitializationStatus + - name: observedGeneration + type: + scalar: numeric + - name: phase + type: + scalar: string + - name: workers + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.WorkersStatus +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterV1Beta1DeprecatedStatus + map: + fields: + - name: conditions + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.Conditions + - name: failureMessage + type: + scalar: string + - name: failureReason + type: + namedType: io.k8s.sigs.cluster-api.errors.ClusterStatusError +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterVariable + map: + fields: + - name: name + type: + scalar: string + - name: value + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSON +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.Condition + map: + fields: + - name: lastTransitionTime + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + - name: message + type: + scalar: string + - name: reason + type: + scalar: string + - name: severity + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ConditionSeverity + - name: status + type: + namedType: io.k8s.api.core.v1.ConditionStatus + - name: type + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ConditionType +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ConditionPolarity + scalar: string +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ConditionSeverity + scalar: string +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ConditionType + scalar: string +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.Conditions + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.Condition + elementRelationship: atomic +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ContractVersionedObjectReference + map: + fields: + - name: apiGroup + type: + scalar: string + - name: kind + type: + scalar: string + - name: name + type: + scalar: string +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ControlPlaneClass + map: + fields: + - name: deletion + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ControlPlaneClassMachineDeletionSpec + - name: healthCheck + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ControlPlaneClassHealthCheck + - name: machineInfrastructure + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ControlPlaneClassMachineInfrastructureTemplate + - name: metadata + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ObjectMeta + - name: naming + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ControlPlaneClassNamingSpec + - name: readinessGates + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineReadinessGate + elementRelationship: associative + keys: + - conditionType + - name: templateRef + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterClassTemplateReference +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ControlPlaneClassHealthCheck + map: + fields: + - name: checks + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ControlPlaneClassHealthCheckChecks + - name: remediation + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ControlPlaneClassHealthCheckRemediation +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ControlPlaneClassHealthCheckChecks + map: + fields: + - name: nodeStartupTimeoutSeconds + type: + scalar: numeric + - name: unhealthyMachineConditions + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.UnhealthyMachineCondition + elementRelationship: atomic + - name: unhealthyNodeConditions + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.UnhealthyNodeCondition + elementRelationship: atomic +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ControlPlaneClassHealthCheckRemediation + map: + fields: + - name: templateRef + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineHealthCheckRemediationTemplateReference + - name: triggerIf + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ControlPlaneClassHealthCheckRemediationTriggerIf +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ControlPlaneClassHealthCheckRemediationTriggerIf + map: + fields: + - name: unhealthyInRange + type: + scalar: string + - name: unhealthyLessThanOrEqualTo + type: + namedType: io.k8s.apimachinery.pkg.util.intstr.IntOrString +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ControlPlaneClassMachineDeletionSpec + map: + fields: + - name: nodeDeletionTimeoutSeconds + type: + scalar: numeric + - name: nodeDrainTimeoutSeconds + type: + scalar: numeric + - name: nodeVolumeDetachTimeoutSeconds + type: + scalar: numeric +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ControlPlaneClassMachineInfrastructureTemplate + map: + fields: + - name: templateRef + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterClassTemplateReference +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ControlPlaneClassNamingSpec + map: + fields: + - name: template + type: + scalar: string +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ControlPlaneTopology + map: + fields: + - name: deletion + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ControlPlaneTopologyMachineDeletionSpec + - name: healthCheck + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ControlPlaneTopologyHealthCheck + - name: metadata + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ObjectMeta + - name: readinessGates + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineReadinessGate + elementRelationship: associative + keys: + - conditionType + - name: replicas + type: + scalar: numeric + - name: variables + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ControlPlaneVariables +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ControlPlaneTopologyHealthCheck + map: + fields: + - name: checks + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ControlPlaneTopologyHealthCheckChecks + - name: enabled + type: + scalar: boolean + - name: remediation + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ControlPlaneTopologyHealthCheckRemediation +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ControlPlaneTopologyHealthCheckChecks + map: + fields: + - name: nodeStartupTimeoutSeconds + type: + scalar: numeric + - name: unhealthyMachineConditions + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.UnhealthyMachineCondition + elementRelationship: atomic + - name: unhealthyNodeConditions + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.UnhealthyNodeCondition + elementRelationship: atomic +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ControlPlaneTopologyHealthCheckRemediation + map: + fields: + - name: templateRef + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineHealthCheckRemediationTemplateReference + - name: triggerIf + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ControlPlaneTopologyHealthCheckRemediationTriggerIf +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ControlPlaneTopologyHealthCheckRemediationTriggerIf + map: + fields: + - name: unhealthyInRange + type: + scalar: string + - name: unhealthyLessThanOrEqualTo + type: + namedType: io.k8s.apimachinery.pkg.util.intstr.IntOrString +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ControlPlaneTopologyMachineDeletionSpec + map: + fields: + - name: nodeDeletionTimeoutSeconds + type: + scalar: numeric + - name: nodeDrainTimeoutSeconds + type: + scalar: numeric + - name: nodeVolumeDetachTimeoutSeconds + type: + scalar: numeric +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ControlPlaneVariables + map: + fields: + - name: overrides + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterVariable + elementRelationship: associative + keys: + - name +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ExternalPatchDefinition + map: + fields: + - name: discoverVariablesExtension + type: + scalar: string + - name: generatePatchesExtension + type: + scalar: string + - name: settings + type: + map: + elementType: + scalar: string + - name: validateTopologyExtension + type: + scalar: string +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.FailureDomain + map: + fields: + - name: attributes + type: + map: + elementType: + scalar: string + - name: controlPlane + type: + scalar: boolean + - name: name + type: + scalar: string +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.FieldValueErrorReason + scalar: string +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.InfrastructureClass + map: + fields: + - name: naming + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.InfrastructureClassNamingSpec + - name: templateRef + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterClassTemplateReference +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.InfrastructureClassNamingSpec + map: + fields: + - name: template + type: + scalar: string +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.JSONPatch + map: + fields: + - name: op + type: + scalar: string + - name: path + type: + scalar: string + - name: value + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSON + - name: valueFrom + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.JSONPatchValue +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.JSONPatchValue + map: + fields: + - name: template + type: + scalar: string + - name: variable + type: + scalar: string +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.JSONSchemaProps + map: + fields: + - name: additionalProperties + type: + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable + - name: allOf + type: + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable + - name: anyOf + type: + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable + - name: default + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSON + - name: description + type: + scalar: string + - name: enum + type: + list: + elementType: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSON + elementRelationship: atomic + - name: example + type: + namedType: io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSON + - name: exclusiveMaximum + type: + scalar: boolean + - name: exclusiveMinimum + type: + scalar: boolean + - name: format + type: + scalar: string + - name: items + type: + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable + - name: maxItems + type: + scalar: numeric + - name: maxLength + type: + scalar: numeric + - name: maxProperties + type: + scalar: numeric + - name: maximum + type: + scalar: numeric + - name: minItems + type: + scalar: numeric + - name: minLength + type: + scalar: numeric + - name: minProperties + type: + scalar: numeric + - name: minimum + type: + scalar: numeric + - name: not + type: + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable + - name: oneOf + type: + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable + - name: pattern + type: + scalar: string + - name: properties + type: + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable + - name: required + type: + list: + elementType: + scalar: string + elementRelationship: atomic + - name: type + type: + scalar: string + - name: uniqueItems + type: + scalar: boolean + - name: x-kubernetes-int-or-string + type: + scalar: boolean + - name: x-kubernetes-preserve-unknown-fields + type: + scalar: boolean + - name: x-kubernetes-validations + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ValidationRule + elementRelationship: associative + keys: + - rule + - name: x-metadata + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.VariableSchemaMetadata +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.Machine + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + - name: spec + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineSpec + - name: status + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineStatus +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineAddress + map: + fields: + - name: address + type: + scalar: string + - name: type + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineAddressType +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineAddressType + scalar: string +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineAddresses + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineAddress + elementRelationship: atomic +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeletionSpec + map: + fields: + - name: nodeDeletionTimeoutSeconds + type: + scalar: numeric + - name: nodeDrainTimeoutSeconds + type: + scalar: numeric + - name: nodeVolumeDetachTimeoutSeconds + type: + scalar: numeric +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeletionStatus + map: + fields: + - name: nodeDrainStartTime + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + - name: waitForNodeVolumeDetachStartTime + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeployment + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + - name: spec + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentSpec + - name: status + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentStatus +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentClass + map: + fields: + - name: bootstrap + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentClassBootstrapTemplate + - name: class + type: + scalar: string + - name: deletion + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentClassMachineDeletionSpec + - name: failureDomain + type: + scalar: string + - name: healthCheck + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentClassHealthCheck + - name: infrastructure + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentClassInfrastructureTemplate + - name: metadata + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ObjectMeta + - name: minReadySeconds + type: + scalar: numeric + - name: naming + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentClassNamingSpec + - name: readinessGates + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineReadinessGate + elementRelationship: associative + keys: + - conditionType + - name: rollout + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentClassRolloutSpec +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentClassBootstrapTemplate + map: + fields: + - name: templateRef + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterClassTemplateReference +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentClassHealthCheck + map: + fields: + - name: checks + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentClassHealthCheckChecks + - name: remediation + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentClassHealthCheckRemediation +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentClassHealthCheckChecks + map: + fields: + - name: nodeStartupTimeoutSeconds + type: + scalar: numeric + - name: unhealthyMachineConditions + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.UnhealthyMachineCondition + elementRelationship: atomic + - name: unhealthyNodeConditions + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.UnhealthyNodeCondition + elementRelationship: atomic +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentClassHealthCheckRemediation + map: + fields: + - name: maxInFlight + type: + namedType: io.k8s.apimachinery.pkg.util.intstr.IntOrString + - name: templateRef + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineHealthCheckRemediationTemplateReference + - name: triggerIf + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentClassHealthCheckRemediationTriggerIf +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentClassHealthCheckRemediationTriggerIf + map: + fields: + - name: unhealthyInRange + type: + scalar: string + - name: unhealthyLessThanOrEqualTo + type: + namedType: io.k8s.apimachinery.pkg.util.intstr.IntOrString +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentClassInfrastructureTemplate + map: + fields: + - name: templateRef + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterClassTemplateReference +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentClassMachineDeletionSpec + map: + fields: + - name: nodeDeletionTimeoutSeconds + type: + scalar: numeric + - name: nodeDrainTimeoutSeconds + type: + scalar: numeric + - name: nodeVolumeDetachTimeoutSeconds + type: + scalar: numeric + - name: order + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineSetDeletionOrder +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentClassNamingSpec + map: + fields: + - name: template + type: + scalar: string +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentClassRolloutSpec + map: + fields: + - name: strategy + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentClassRolloutStrategy +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentClassRolloutStrategy + map: + fields: + - name: rollingUpdate + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentClassRolloutStrategyRollingUpdate + - name: type + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentRolloutStrategyType +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentClassRolloutStrategyRollingUpdate + map: + fields: + - name: maxSurge + type: + namedType: io.k8s.apimachinery.pkg.util.intstr.IntOrString + - name: maxUnavailable + type: + namedType: io.k8s.apimachinery.pkg.util.intstr.IntOrString +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentDeletionSpec + map: + fields: + - name: order + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineSetDeletionOrder +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentDeprecatedStatus + map: + fields: + - name: v1beta1 + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentV1Beta1DeprecatedStatus +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentRemediationSpec + map: + fields: + - name: maxInFlight + type: + namedType: io.k8s.apimachinery.pkg.util.intstr.IntOrString +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentRolloutSpec + map: + fields: + - name: after + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + - name: strategy + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentRolloutStrategy +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentRolloutStrategy + map: + fields: + - name: rollingUpdate + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentRolloutStrategyRollingUpdate + - name: type + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentRolloutStrategyType +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentRolloutStrategyRollingUpdate + map: + fields: + - name: maxSurge + type: + namedType: io.k8s.apimachinery.pkg.util.intstr.IntOrString + - name: maxUnavailable + type: + namedType: io.k8s.apimachinery.pkg.util.intstr.IntOrString +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentRolloutStrategyType + scalar: string +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentSpec + map: + fields: + - name: clusterName + type: + scalar: string + - name: deletion + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentDeletionSpec + - name: machineNaming + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineNamingSpec + - name: paused + type: + scalar: boolean + - name: remediation + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentRemediationSpec + - name: replicas + type: + scalar: numeric + - name: rollout + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentRolloutSpec + - name: selector + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector + - name: template + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineTemplateSpec +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentStatus + map: + fields: + - name: availableReplicas + type: + scalar: numeric + - name: conditions + type: + list: + elementType: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Condition + elementRelationship: associative + keys: + - type + - name: deprecated + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentDeprecatedStatus + - name: observedGeneration + type: + scalar: numeric + - name: phase + type: + scalar: string + - name: readyReplicas + type: + scalar: numeric + - name: replicas + type: + scalar: numeric + - name: selector + type: + scalar: string + - name: upToDateReplicas + type: + scalar: numeric +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentTopology + map: + fields: + - name: class + type: + scalar: string + - name: deletion + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentTopologyMachineDeletionSpec + - name: failureDomain + type: + scalar: string + - name: healthCheck + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentTopologyHealthCheck + - name: metadata + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ObjectMeta + - name: minReadySeconds + type: + scalar: numeric + - name: name + type: + scalar: string + - name: readinessGates + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineReadinessGate + elementRelationship: associative + keys: + - conditionType + - name: replicas + type: + scalar: numeric + - name: rollout + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentTopologyRolloutSpec + - name: variables + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentVariables +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentTopologyHealthCheck + map: + fields: + - name: checks + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentTopologyHealthCheckChecks + - name: enabled + type: + scalar: boolean + - name: remediation + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentTopologyHealthCheckRemediation +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentTopologyHealthCheckChecks + map: + fields: + - name: nodeStartupTimeoutSeconds + type: + scalar: numeric + - name: unhealthyMachineConditions + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.UnhealthyMachineCondition + elementRelationship: atomic + - name: unhealthyNodeConditions + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.UnhealthyNodeCondition + elementRelationship: atomic +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentTopologyHealthCheckRemediation + map: + fields: + - name: maxInFlight + type: + namedType: io.k8s.apimachinery.pkg.util.intstr.IntOrString + - name: templateRef + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineHealthCheckRemediationTemplateReference + - name: triggerIf + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentTopologyHealthCheckRemediationTriggerIf +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentTopologyHealthCheckRemediationTriggerIf + map: + fields: + - name: unhealthyInRange + type: + scalar: string + - name: unhealthyLessThanOrEqualTo + type: + namedType: io.k8s.apimachinery.pkg.util.intstr.IntOrString +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentTopologyMachineDeletionSpec + map: + fields: + - name: nodeDeletionTimeoutSeconds + type: + scalar: numeric + - name: nodeDrainTimeoutSeconds + type: + scalar: numeric + - name: nodeVolumeDetachTimeoutSeconds + type: + scalar: numeric + - name: order + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineSetDeletionOrder +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentTopologyRolloutSpec + map: + fields: + - name: strategy + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentTopologyRolloutStrategy +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentTopologyRolloutStrategy + map: + fields: + - name: rollingUpdate + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentTopologyRolloutStrategyRollingUpdate + - name: type + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentRolloutStrategyType +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentTopologyRolloutStrategyRollingUpdate + map: + fields: + - name: maxSurge + type: + namedType: io.k8s.apimachinery.pkg.util.intstr.IntOrString + - name: maxUnavailable + type: + namedType: io.k8s.apimachinery.pkg.util.intstr.IntOrString +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentV1Beta1DeprecatedStatus + map: + fields: + - name: availableReplicas + type: + scalar: numeric + - name: conditions + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.Conditions + - name: readyReplicas + type: + scalar: numeric + - name: unavailableReplicas + type: + scalar: numeric + - name: updatedReplicas + type: + scalar: numeric +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentVariables + map: + fields: + - name: overrides + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterVariable + elementRelationship: associative + keys: + - name +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeprecatedStatus + map: + fields: + - name: v1beta1 + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineV1Beta1DeprecatedStatus +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDrainRule + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + - name: spec + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDrainRuleSpec +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDrainRuleDrainBehavior + scalar: string +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDrainRuleDrainConfig + map: + fields: + - name: behavior + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDrainRuleDrainBehavior + - name: order + type: + scalar: numeric +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDrainRuleMachineSelector + map: + fields: + - name: clusterSelector + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector + - name: selector + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDrainRulePodSelector + map: + fields: + - name: namespaceSelector + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector + - name: selector + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDrainRuleSpec + map: + fields: + - name: drain + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDrainRuleDrainConfig + - name: machines + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDrainRuleMachineSelector + elementRelationship: atomic + - name: pods + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDrainRulePodSelector + elementRelationship: atomic +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineHealthCheck + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + - name: spec + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineHealthCheckSpec + - name: status + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineHealthCheckStatus +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineHealthCheckChecks + map: + fields: + - name: nodeStartupTimeoutSeconds + type: + scalar: numeric + - name: unhealthyMachineConditions + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.UnhealthyMachineCondition + elementRelationship: atomic + - name: unhealthyNodeConditions + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.UnhealthyNodeCondition + elementRelationship: atomic +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineHealthCheckDeprecatedStatus + map: + fields: + - name: v1beta1 + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineHealthCheckV1Beta1DeprecatedStatus +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineHealthCheckRemediation + map: + fields: + - name: templateRef + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineHealthCheckRemediationTemplateReference + - name: triggerIf + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineHealthCheckRemediationTriggerIf +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineHealthCheckRemediationTemplateReference + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: name + type: + scalar: string +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineHealthCheckRemediationTriggerIf + map: + fields: + - name: unhealthyInRange + type: + scalar: string + - name: unhealthyLessThanOrEqualTo + type: + namedType: io.k8s.apimachinery.pkg.util.intstr.IntOrString +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineHealthCheckSpec + map: + fields: + - name: checks + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineHealthCheckChecks + - name: clusterName + type: + scalar: string + - name: remediation + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineHealthCheckRemediation + - name: selector + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineHealthCheckStatus + map: + fields: + - name: conditions + type: + list: + elementType: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Condition + elementRelationship: associative + keys: + - type + - name: currentHealthy + type: + scalar: numeric + - name: deprecated + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineHealthCheckDeprecatedStatus + - name: expectedMachines + type: + scalar: numeric + - name: observedGeneration + type: + scalar: numeric + - name: remediationsAllowed + type: + scalar: numeric + - name: targets + type: + list: + elementType: + scalar: string + elementRelationship: atomic +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineHealthCheckV1Beta1DeprecatedStatus + map: + fields: + - name: conditions + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.Conditions +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineInitializationStatus + map: + fields: + - name: bootstrapDataSecretCreated + type: + scalar: boolean + - name: infrastructureProvisioned + type: + scalar: boolean +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineNamingSpec + map: + fields: + - name: template + type: + scalar: string +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineNodeReference + map: + fields: + - name: name + type: + scalar: string +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachinePool + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + - name: spec + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachinePoolSpec + - name: status + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachinePoolStatus +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachinePoolClass + map: + fields: + - name: bootstrap + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachinePoolClassBootstrapTemplate + - name: class + type: + scalar: string + - name: deletion + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachinePoolClassMachineDeletionSpec + - name: failureDomains + type: + list: + elementType: + scalar: string + elementRelationship: atomic + - name: infrastructure + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachinePoolClassInfrastructureTemplate + - name: metadata + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ObjectMeta + - name: minReadySeconds + type: + scalar: numeric + - name: naming + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachinePoolClassNamingSpec +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachinePoolClassBootstrapTemplate + map: + fields: + - name: templateRef + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterClassTemplateReference +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachinePoolClassInfrastructureTemplate + map: + fields: + - name: templateRef + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterClassTemplateReference +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachinePoolClassMachineDeletionSpec + map: + fields: + - name: nodeDeletionTimeoutSeconds + type: + scalar: numeric + - name: nodeDrainTimeoutSeconds + type: + scalar: numeric + - name: nodeVolumeDetachTimeoutSeconds + type: + scalar: numeric +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachinePoolClassNamingSpec + map: + fields: + - name: template + type: + scalar: string +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachinePoolDeprecatedStatus + map: + fields: + - name: v1beta1 + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachinePoolV1Beta1DeprecatedStatus +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachinePoolInitializationStatus + map: + fields: + - name: bootstrapDataSecretCreated + type: + scalar: boolean + - name: infrastructureProvisioned + type: + scalar: boolean +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachinePoolSpec + map: + fields: + - name: clusterName + type: + scalar: string + - name: failureDomains + type: + list: + elementType: + scalar: string + elementRelationship: atomic + - name: providerIDList + type: + list: + elementType: + scalar: string + elementRelationship: atomic + - name: replicas + type: + scalar: numeric + - name: template + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineTemplateSpec +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachinePoolStatus + map: + fields: + - name: availableReplicas + type: + scalar: numeric + - name: conditions + type: + list: + elementType: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Condition + elementRelationship: associative + keys: + - type + - name: deprecated + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachinePoolDeprecatedStatus + - name: initialization + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachinePoolInitializationStatus + - name: nodeRefs + type: + list: + elementType: + namedType: io.k8s.api.core.v1.ObjectReference + elementRelationship: atomic + - name: observedGeneration + type: + scalar: numeric + - name: phase + type: + scalar: string + - name: readyReplicas + type: + scalar: numeric + - name: replicas + type: + scalar: numeric + - name: upToDateReplicas + type: + scalar: numeric +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachinePoolTopology + map: + fields: + - name: class + type: + scalar: string + - name: deletion + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachinePoolTopologyMachineDeletionSpec + - name: failureDomains + type: + list: + elementType: + scalar: string + elementRelationship: atomic + - name: metadata + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ObjectMeta + - name: minReadySeconds + type: + scalar: numeric + - name: name + type: + scalar: string + - name: replicas + type: + scalar: numeric + - name: variables + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachinePoolVariables +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachinePoolTopologyMachineDeletionSpec + map: + fields: + - name: nodeDeletionTimeoutSeconds + type: + scalar: numeric + - name: nodeDrainTimeoutSeconds + type: + scalar: numeric + - name: nodeVolumeDetachTimeoutSeconds + type: + scalar: numeric +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachinePoolV1Beta1DeprecatedStatus + map: + fields: + - name: availableReplicas + type: + scalar: numeric + - name: conditions + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.Conditions + - name: failureMessage + type: + scalar: string + - name: failureReason + type: + namedType: io.k8s.sigs.cluster-api.errors.MachinePoolStatusFailure + - name: readyReplicas + type: + scalar: numeric + - name: unavailableReplicas + type: + scalar: numeric +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachinePoolVariables + map: + fields: + - name: overrides + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterVariable + elementRelationship: associative + keys: + - name +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineReadinessGate + map: + fields: + - name: conditionType + type: + scalar: string + - name: polarity + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ConditionPolarity +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineSet + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + - name: spec + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineSetSpec + - name: status + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineSetStatus +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineSetDeletionOrder + scalar: string +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineSetDeletionSpec + map: + fields: + - name: order + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineSetDeletionOrder +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineSetDeprecatedStatus + map: + fields: + - name: v1beta1 + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineSetV1Beta1DeprecatedStatus +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineSetSpec + map: + fields: + - name: clusterName + type: + scalar: string + - name: deletion + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineSetDeletionSpec + - name: machineNaming + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineNamingSpec + - name: replicas + type: + scalar: numeric + - name: selector + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector + - name: template + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineTemplateSpec +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineSetStatus + map: + fields: + - name: availableReplicas + type: + scalar: numeric + - name: conditions + type: + list: + elementType: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Condition + elementRelationship: associative + keys: + - type + - name: deprecated + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineSetDeprecatedStatus + - name: observedGeneration + type: + scalar: numeric + - name: readyReplicas + type: + scalar: numeric + - name: replicas + type: + scalar: numeric + - name: selector + type: + scalar: string + - name: upToDateReplicas + type: + scalar: numeric +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineSetV1Beta1DeprecatedStatus + map: + fields: + - name: availableReplicas + type: + scalar: numeric + - name: conditions + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.Conditions + - name: failureMessage + type: + scalar: string + - name: failureReason + type: + namedType: io.k8s.sigs.cluster-api.errors.MachineSetStatusError + - name: fullyLabeledReplicas + type: + scalar: numeric + - name: readyReplicas + type: + scalar: numeric +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineSpec + map: + fields: + - name: bootstrap + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.Bootstrap + - name: clusterName + type: + scalar: string + - name: deletion + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeletionSpec + - name: failureDomain + type: + scalar: string + - name: infrastructureRef + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ContractVersionedObjectReference + - name: minReadySeconds + type: + scalar: numeric + - name: providerID + type: + scalar: string + - name: readinessGates + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineReadinessGate + elementRelationship: associative + keys: + - conditionType + - name: taints + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineTaint + elementRelationship: associative + keys: + - key + - effect + - name: version + type: + scalar: string +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineStatus + map: + fields: + - name: addresses + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineAddresses + - name: certificatesExpiryDate + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + - name: conditions + type: + list: + elementType: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Condition + elementRelationship: associative + keys: + - type + - name: deletion + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeletionStatus + - name: deprecated + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeprecatedStatus + - name: failureDomain + type: + scalar: string + - name: initialization + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineInitializationStatus + - name: lastUpdated + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + - name: nodeInfo + type: + namedType: io.k8s.api.core.v1.NodeSystemInfo + - name: nodeRef + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineNodeReference + - name: observedGeneration + type: + scalar: numeric + - name: phase + type: + scalar: string +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineTaint + map: + fields: + - name: effect + type: + namedType: io.k8s.api.core.v1.TaintEffect + - name: key + type: + scalar: string + - name: propagation + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineTaintPropagation + - name: value + type: + scalar: string +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineTaintPropagation + scalar: string +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineTemplateSpec + map: + fields: + - name: metadata + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ObjectMeta + - name: spec + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineSpec +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineV1Beta1DeprecatedStatus + map: + fields: + - name: conditions + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.Conditions + - name: failureMessage + type: + scalar: string + - name: failureReason + type: + namedType: io.k8s.sigs.cluster-api.errors.MachineStatusError +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.NetworkRanges + map: + fields: + - name: cidrBlocks + type: + list: + elementType: + scalar: string + elementRelationship: atomic +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ObjectMeta + map: + fields: + - name: annotations + type: + map: + elementType: + scalar: string + - name: labels + type: + map: + elementType: + scalar: string +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.PatchDefinition + map: + fields: + - name: jsonPatches + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.JSONPatch + elementRelationship: atomic + - name: selector + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.PatchSelector +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.PatchSelector + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: matchResources + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.PatchSelectorMatch +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.PatchSelectorMatch + map: + fields: + - name: controlPlane + type: + scalar: boolean + - name: infrastructureCluster + type: + scalar: boolean + - name: machineDeploymentClass + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.PatchSelectorMatchMachineDeploymentClass + - name: machinePoolClass + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.PatchSelectorMatchMachinePoolClass +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.PatchSelectorMatchMachineDeploymentClass + map: + fields: + - name: names + type: + list: + elementType: + scalar: string + elementRelationship: atomic +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.PatchSelectorMatchMachinePoolClass + map: + fields: + - name: names + type: + list: + elementType: + scalar: string + elementRelationship: atomic +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.Topology + map: + fields: + - name: classRef + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterClassRef + - name: controlPlane + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ControlPlaneTopology + - name: variables + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.ClusterVariable + elementRelationship: associative + keys: + - name + - name: version + type: + scalar: string + - name: workers + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.WorkersTopology +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.UnhealthyMachineCondition + map: + fields: + - name: status + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ConditionStatus + - name: timeoutSeconds + type: + scalar: numeric + - name: type + type: + scalar: string +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.UnhealthyNodeCondition + map: + fields: + - name: status + type: + namedType: io.k8s.api.core.v1.ConditionStatus + - name: timeoutSeconds + type: + scalar: numeric + - name: type + type: + namedType: io.k8s.api.core.v1.NodeConditionType +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.ValidationRule + map: + fields: + - name: fieldPath + type: + scalar: string + - name: message + type: + scalar: string + - name: messageExpression + type: + scalar: string + - name: reason + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.FieldValueErrorReason + default: FieldValueInvalid + - name: rule + type: + scalar: string +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.VariableSchema + map: + fields: + - name: openAPIV3Schema + type: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.JSONSchemaProps +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.VariableSchemaMetadata + map: + fields: + - name: annotations + type: + map: + elementType: + scalar: string + - name: labels + type: + map: + elementType: + scalar: string +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.WorkersClass + map: + fields: + - name: machineDeployments + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentClass + elementRelationship: associative + keys: + - class + - name: machinePools + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachinePoolClass + elementRelationship: associative + keys: + - class +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.WorkersStatus + map: + fields: + - name: availableReplicas + type: + scalar: numeric + - name: desiredReplicas + type: + scalar: numeric + - name: readyReplicas + type: + scalar: numeric + - name: replicas + type: + scalar: numeric + - name: upToDateReplicas + type: + scalar: numeric +- name: io.k8s.sigs.cluster-api.api.core.v1beta2.WorkersTopology + map: + fields: + - name: machineDeployments + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachineDeploymentTopology + elementRelationship: associative + keys: + - name + - name: machinePools + type: + list: + elementType: + namedType: io.k8s.sigs.cluster-api.api.core.v1beta2.MachinePoolTopology + elementRelationship: associative + keys: + - name +- name: io.k8s.sigs.cluster-api.errors.ClusterStatusError + scalar: string +- name: io.k8s.sigs.cluster-api.errors.MachinePoolStatusFailure + scalar: string +- name: io.k8s.sigs.cluster-api.errors.MachineSetStatusError + scalar: string +- name: io.k8s.sigs.cluster-api.errors.MachineStatusError + scalar: string +- name: __untyped_atomic_ + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic +- name: __untyped_deduced_ + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +`) diff --git a/util/applyconfigurations/utils.go b/util/applyconfigurations/utils.go new file mode 100644 index 000000000000..3c840535d086 --- /dev/null +++ b/util/applyconfigurations/utils.go @@ -0,0 +1,318 @@ +// Code generated by controller-gen-v0.20.1-0. DO NOT EDIT. + +package applyconfigurations + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" + v1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2" + corev1beta2 "sigs.k8s.io/cluster-api/util/applyconfigurations/core/v1beta2" + internal "sigs.k8s.io/cluster-api/util/applyconfigurations/internal" +) + +// ForKind returns an apply configuration type for the given GroupVersionKind, or nil if no +// apply configuration type exists for the given GroupVersionKind. +func ForKind(kind schema.GroupVersionKind) interface{} { + switch kind { + // Group=cluster.x-k8s.io, Version=v1beta2 + case v1beta2.SchemeGroupVersion.WithKind("APIEndpoint"): + return &corev1beta2.APIEndpointApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("Bootstrap"): + return &corev1beta2.BootstrapApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("Cluster"): + return &corev1beta2.ClusterApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ClusterAvailabilityGate"): + return &corev1beta2.ClusterAvailabilityGateApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ClusterClass"): + return &corev1beta2.ClusterClassApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ClusterClassDeprecatedStatus"): + return &corev1beta2.ClusterClassDeprecatedStatusApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ClusterClassPatch"): + return &corev1beta2.ClusterClassPatchApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ClusterClassRef"): + return &corev1beta2.ClusterClassRefApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ClusterClassSpec"): + return &corev1beta2.ClusterClassSpecApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ClusterClassStatus"): + return &corev1beta2.ClusterClassStatusApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ClusterClassStatusVariable"): + return &corev1beta2.ClusterClassStatusVariableApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ClusterClassStatusVariableDefinition"): + return &corev1beta2.ClusterClassStatusVariableDefinitionApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ClusterClassTemplateReference"): + return &corev1beta2.ClusterClassTemplateReferenceApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ClusterClassUpgrade"): + return &corev1beta2.ClusterClassUpgradeApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ClusterClassUpgradeExternal"): + return &corev1beta2.ClusterClassUpgradeExternalApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ClusterClassV1Beta1DeprecatedStatus"): + return &corev1beta2.ClusterClassV1Beta1DeprecatedStatusApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ClusterClassVariable"): + return &corev1beta2.ClusterClassVariableApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ClusterClassVariableMetadata"): + return &corev1beta2.ClusterClassVariableMetadataApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ClusterControlPlaneStatus"): + return &corev1beta2.ClusterControlPlaneStatusApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ClusterDeprecatedStatus"): + return &corev1beta2.ClusterDeprecatedStatusApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ClusterInitializationStatus"): + return &corev1beta2.ClusterInitializationStatusApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ClusterNetwork"): + return &corev1beta2.ClusterNetworkApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ClusterSpec"): + return &corev1beta2.ClusterSpecApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ClusterStatus"): + return &corev1beta2.ClusterStatusApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ClusterV1Beta1DeprecatedStatus"): + return &corev1beta2.ClusterV1Beta1DeprecatedStatusApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ClusterVariable"): + return &corev1beta2.ClusterVariableApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("Condition"): + return &corev1beta2.ConditionApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ContractVersionedObjectReference"): + return &corev1beta2.ContractVersionedObjectReferenceApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ControlPlaneClass"): + return &corev1beta2.ControlPlaneClassApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ControlPlaneClassHealthCheck"): + return &corev1beta2.ControlPlaneClassHealthCheckApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ControlPlaneClassHealthCheckChecks"): + return &corev1beta2.ControlPlaneClassHealthCheckChecksApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ControlPlaneClassHealthCheckRemediation"): + return &corev1beta2.ControlPlaneClassHealthCheckRemediationApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ControlPlaneClassHealthCheckRemediationTriggerIf"): + return &corev1beta2.ControlPlaneClassHealthCheckRemediationTriggerIfApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ControlPlaneClassMachineDeletionSpec"): + return &corev1beta2.ControlPlaneClassMachineDeletionSpecApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ControlPlaneClassMachineInfrastructureTemplate"): + return &corev1beta2.ControlPlaneClassMachineInfrastructureTemplateApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ControlPlaneClassNamingSpec"): + return &corev1beta2.ControlPlaneClassNamingSpecApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ControlPlaneTopology"): + return &corev1beta2.ControlPlaneTopologyApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ControlPlaneTopologyHealthCheck"): + return &corev1beta2.ControlPlaneTopologyHealthCheckApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ControlPlaneTopologyHealthCheckChecks"): + return &corev1beta2.ControlPlaneTopologyHealthCheckChecksApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ControlPlaneTopologyHealthCheckRemediation"): + return &corev1beta2.ControlPlaneTopologyHealthCheckRemediationApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ControlPlaneTopologyHealthCheckRemediationTriggerIf"): + return &corev1beta2.ControlPlaneTopologyHealthCheckRemediationTriggerIfApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ControlPlaneTopologyMachineDeletionSpec"): + return &corev1beta2.ControlPlaneTopologyMachineDeletionSpecApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ControlPlaneVariables"): + return &corev1beta2.ControlPlaneVariablesApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ExternalPatchDefinition"): + return &corev1beta2.ExternalPatchDefinitionApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("FailureDomain"): + return &corev1beta2.FailureDomainApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("InfrastructureClass"): + return &corev1beta2.InfrastructureClassApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("InfrastructureClassNamingSpec"): + return &corev1beta2.InfrastructureClassNamingSpecApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("JSONPatch"): + return &corev1beta2.JSONPatchApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("JSONPatchValue"): + return &corev1beta2.JSONPatchValueApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("JSONSchemaProps"): + return &corev1beta2.JSONSchemaPropsApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("Machine"): + return &corev1beta2.MachineApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineAddress"): + return &corev1beta2.MachineAddressApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDeletionSpec"): + return &corev1beta2.MachineDeletionSpecApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDeletionStatus"): + return &corev1beta2.MachineDeletionStatusApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDeployment"): + return &corev1beta2.MachineDeploymentApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDeploymentClass"): + return &corev1beta2.MachineDeploymentClassApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDeploymentClassBootstrapTemplate"): + return &corev1beta2.MachineDeploymentClassBootstrapTemplateApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDeploymentClassHealthCheck"): + return &corev1beta2.MachineDeploymentClassHealthCheckApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDeploymentClassHealthCheckChecks"): + return &corev1beta2.MachineDeploymentClassHealthCheckChecksApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDeploymentClassHealthCheckRemediation"): + return &corev1beta2.MachineDeploymentClassHealthCheckRemediationApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDeploymentClassHealthCheckRemediationTriggerIf"): + return &corev1beta2.MachineDeploymentClassHealthCheckRemediationTriggerIfApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDeploymentClassInfrastructureTemplate"): + return &corev1beta2.MachineDeploymentClassInfrastructureTemplateApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDeploymentClassMachineDeletionSpec"): + return &corev1beta2.MachineDeploymentClassMachineDeletionSpecApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDeploymentClassNamingSpec"): + return &corev1beta2.MachineDeploymentClassNamingSpecApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDeploymentClassRolloutSpec"): + return &corev1beta2.MachineDeploymentClassRolloutSpecApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDeploymentClassRolloutStrategy"): + return &corev1beta2.MachineDeploymentClassRolloutStrategyApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDeploymentClassRolloutStrategyRollingUpdate"): + return &corev1beta2.MachineDeploymentClassRolloutStrategyRollingUpdateApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDeploymentDeletionSpec"): + return &corev1beta2.MachineDeploymentDeletionSpecApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDeploymentDeprecatedStatus"): + return &corev1beta2.MachineDeploymentDeprecatedStatusApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDeploymentRemediationSpec"): + return &corev1beta2.MachineDeploymentRemediationSpecApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDeploymentRolloutSpec"): + return &corev1beta2.MachineDeploymentRolloutSpecApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDeploymentRolloutStrategy"): + return &corev1beta2.MachineDeploymentRolloutStrategyApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDeploymentRolloutStrategyRollingUpdate"): + return &corev1beta2.MachineDeploymentRolloutStrategyRollingUpdateApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDeploymentSpec"): + return &corev1beta2.MachineDeploymentSpecApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDeploymentStatus"): + return &corev1beta2.MachineDeploymentStatusApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDeploymentTopology"): + return &corev1beta2.MachineDeploymentTopologyApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDeploymentTopologyHealthCheck"): + return &corev1beta2.MachineDeploymentTopologyHealthCheckApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDeploymentTopologyHealthCheckChecks"): + return &corev1beta2.MachineDeploymentTopologyHealthCheckChecksApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDeploymentTopologyHealthCheckRemediation"): + return &corev1beta2.MachineDeploymentTopologyHealthCheckRemediationApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDeploymentTopologyHealthCheckRemediationTriggerIf"): + return &corev1beta2.MachineDeploymentTopologyHealthCheckRemediationTriggerIfApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDeploymentTopologyMachineDeletionSpec"): + return &corev1beta2.MachineDeploymentTopologyMachineDeletionSpecApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDeploymentTopologyRolloutSpec"): + return &corev1beta2.MachineDeploymentTopologyRolloutSpecApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDeploymentTopologyRolloutStrategy"): + return &corev1beta2.MachineDeploymentTopologyRolloutStrategyApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDeploymentTopologyRolloutStrategyRollingUpdate"): + return &corev1beta2.MachineDeploymentTopologyRolloutStrategyRollingUpdateApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDeploymentV1Beta1DeprecatedStatus"): + return &corev1beta2.MachineDeploymentV1Beta1DeprecatedStatusApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDeploymentVariables"): + return &corev1beta2.MachineDeploymentVariablesApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDeprecatedStatus"): + return &corev1beta2.MachineDeprecatedStatusApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDrainRule"): + return &corev1beta2.MachineDrainRuleApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDrainRuleDrainConfig"): + return &corev1beta2.MachineDrainRuleDrainConfigApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDrainRuleMachineSelector"): + return &corev1beta2.MachineDrainRuleMachineSelectorApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDrainRulePodSelector"): + return &corev1beta2.MachineDrainRulePodSelectorApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineDrainRuleSpec"): + return &corev1beta2.MachineDrainRuleSpecApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineHealthCheck"): + return &corev1beta2.MachineHealthCheckApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineHealthCheckChecks"): + return &corev1beta2.MachineHealthCheckChecksApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineHealthCheckDeprecatedStatus"): + return &corev1beta2.MachineHealthCheckDeprecatedStatusApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineHealthCheckRemediation"): + return &corev1beta2.MachineHealthCheckRemediationApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineHealthCheckRemediationTemplateReference"): + return &corev1beta2.MachineHealthCheckRemediationTemplateReferenceApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineHealthCheckRemediationTriggerIf"): + return &corev1beta2.MachineHealthCheckRemediationTriggerIfApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineHealthCheckSpec"): + return &corev1beta2.MachineHealthCheckSpecApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineHealthCheckStatus"): + return &corev1beta2.MachineHealthCheckStatusApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineHealthCheckV1Beta1DeprecatedStatus"): + return &corev1beta2.MachineHealthCheckV1Beta1DeprecatedStatusApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineInitializationStatus"): + return &corev1beta2.MachineInitializationStatusApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineNamingSpec"): + return &corev1beta2.MachineNamingSpecApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineNodeReference"): + return &corev1beta2.MachineNodeReferenceApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachinePool"): + return &corev1beta2.MachinePoolApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachinePoolClass"): + return &corev1beta2.MachinePoolClassApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachinePoolClassBootstrapTemplate"): + return &corev1beta2.MachinePoolClassBootstrapTemplateApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachinePoolClassInfrastructureTemplate"): + return &corev1beta2.MachinePoolClassInfrastructureTemplateApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachinePoolClassMachineDeletionSpec"): + return &corev1beta2.MachinePoolClassMachineDeletionSpecApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachinePoolClassNamingSpec"): + return &corev1beta2.MachinePoolClassNamingSpecApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachinePoolDeprecatedStatus"): + return &corev1beta2.MachinePoolDeprecatedStatusApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachinePoolInitializationStatus"): + return &corev1beta2.MachinePoolInitializationStatusApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachinePoolSpec"): + return &corev1beta2.MachinePoolSpecApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachinePoolStatus"): + return &corev1beta2.MachinePoolStatusApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachinePoolTopology"): + return &corev1beta2.MachinePoolTopologyApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachinePoolTopologyMachineDeletionSpec"): + return &corev1beta2.MachinePoolTopologyMachineDeletionSpecApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachinePoolV1Beta1DeprecatedStatus"): + return &corev1beta2.MachinePoolV1Beta1DeprecatedStatusApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachinePoolVariables"): + return &corev1beta2.MachinePoolVariablesApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineReadinessGate"): + return &corev1beta2.MachineReadinessGateApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineSet"): + return &corev1beta2.MachineSetApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineSetDeletionSpec"): + return &corev1beta2.MachineSetDeletionSpecApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineSetDeprecatedStatus"): + return &corev1beta2.MachineSetDeprecatedStatusApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineSetSpec"): + return &corev1beta2.MachineSetSpecApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineSetStatus"): + return &corev1beta2.MachineSetStatusApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineSetV1Beta1DeprecatedStatus"): + return &corev1beta2.MachineSetV1Beta1DeprecatedStatusApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineSpec"): + return &corev1beta2.MachineSpecApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineStatus"): + return &corev1beta2.MachineStatusApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineTaint"): + return &corev1beta2.MachineTaintApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineTemplateSpec"): + return &corev1beta2.MachineTemplateSpecApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("MachineV1Beta1DeprecatedStatus"): + return &corev1beta2.MachineV1Beta1DeprecatedStatusApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("NetworkRanges"): + return &corev1beta2.NetworkRangesApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ObjectMeta"): + return &corev1beta2.ObjectMetaApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("PatchDefinition"): + return &corev1beta2.PatchDefinitionApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("PatchSelector"): + return &corev1beta2.PatchSelectorApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("PatchSelectorMatch"): + return &corev1beta2.PatchSelectorMatchApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("PatchSelectorMatchMachineDeploymentClass"): + return &corev1beta2.PatchSelectorMatchMachineDeploymentClassApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("PatchSelectorMatchMachinePoolClass"): + return &corev1beta2.PatchSelectorMatchMachinePoolClassApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("Topology"): + return &corev1beta2.TopologyApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("UnhealthyMachineCondition"): + return &corev1beta2.UnhealthyMachineConditionApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("UnhealthyNodeCondition"): + return &corev1beta2.UnhealthyNodeConditionApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("ValidationRule"): + return &corev1beta2.ValidationRuleApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("VariableSchema"): + return &corev1beta2.VariableSchemaApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("VariableSchemaMetadata"): + return &corev1beta2.VariableSchemaMetadataApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("WorkersClass"): + return &corev1beta2.WorkersClassApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("WorkersStatus"): + return &corev1beta2.WorkersStatusApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("WorkersTopology"): + return &corev1beta2.WorkersTopologyApplyConfiguration{} + + } + return nil +} + +func NewTypeConverter(scheme *runtime.Scheme) managedfields.TypeConverter { + return managedfields.NewSchemeTypeConverter(scheme, internal.Parser()) +}