diff --git a/controlplane/api/v1beta1/conversion.go b/controlplane/api/v1beta1/conversion.go index 2e6689e3..b7e9ad76 100644 --- a/controlplane/api/v1beta1/conversion.go +++ b/controlplane/api/v1beta1/conversion.go @@ -89,6 +89,8 @@ func (in *KThreesControlPlane) ConvertTo(dstRaw ctrlconversion.Hub) error { dst.Spec.KThreesConfigSpec.ServerConfig.CloudProviderName = restored.Spec.KThreesConfigSpec.ServerConfig.CloudProviderName dst.Spec.KThreesConfigSpec.ServerConfig.DeprecatedDisableExternalCloudProvider = restored.Spec.KThreesConfigSpec.ServerConfig.DeprecatedDisableExternalCloudProvider dst.Spec.KThreesConfigSpec.ServerConfig.DisableCloudController = restored.Spec.KThreesConfigSpec.ServerConfig.DisableCloudController + dst.Spec.MachineTemplate.NodeVolumeDetachTimeout = restored.Spec.MachineTemplate.NodeVolumeDetachTimeout + dst.Spec.MachineTemplate.NodeDeletionTimeout = restored.Spec.MachineTemplate.NodeDeletionTimeout return nil } diff --git a/controlplane/api/v1beta1/zz_generated.conversion.go b/controlplane/api/v1beta1/zz_generated.conversion.go index 3210004e..5f479db9 100644 --- a/controlplane/api/v1beta1/zz_generated.conversion.go +++ b/controlplane/api/v1beta1/zz_generated.conversion.go @@ -211,6 +211,8 @@ func autoConvert_v1beta2_KThreesControlPlaneMachineTemplate_To_v1beta1_KThreesCo out.ObjectMeta = in.ObjectMeta // WARNING: in.InfrastructureRef requires manual conversion: does not exist in peer-type // WARNING: in.NodeDrainTimeout requires manual conversion: does not exist in peer-type + // WARNING: in.NodeVolumeDetachTimeout requires manual conversion: does not exist in peer-type + // WARNING: in.NodeDeletionTimeout requires manual conversion: does not exist in peer-type return nil } diff --git a/controlplane/api/v1beta2/kthreescontrolplane_types.go b/controlplane/api/v1beta2/kthreescontrolplane_types.go index 4ef1f512..cab51471 100644 --- a/controlplane/api/v1beta2/kthreescontrolplane_types.go +++ b/controlplane/api/v1beta2/kthreescontrolplane_types.go @@ -101,6 +101,15 @@ type KThreesControlPlaneMachineTemplate struct { // NOTE: NodeDrainTimeout is different from `kubectl drain --timeout` // +optional NodeDrainTimeout *metav1.Duration `json:"nodeDrainTimeout,omitempty"` + // NodeVolumeDetachTimeout 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. + // +optional + NodeVolumeDetachTimeout *metav1.Duration `json:"nodeVolumeDetachTimeout,omitempty"` + // NodeDeletionTimeout defines how long the machine 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. + // If no value is provided, the default value for this property of the Machine resource will be used. + // +optional + NodeDeletionTimeout *metav1.Duration `json:"nodeDeletionTimeout,omitempty"` } // RemediationStrategy allows to define how control plane machine remediation happens. diff --git a/controlplane/api/v1beta2/zz_generated.deepcopy.go b/controlplane/api/v1beta2/zz_generated.deepcopy.go index 44a1a942..078d9630 100644 --- a/controlplane/api/v1beta2/zz_generated.deepcopy.go +++ b/controlplane/api/v1beta2/zz_generated.deepcopy.go @@ -95,6 +95,16 @@ func (in *KThreesControlPlaneMachineTemplate) DeepCopyInto(out *KThreesControlPl *out = new(v1.Duration) **out = **in } + if in.NodeVolumeDetachTimeout != nil { + in, out := &in.NodeVolumeDetachTimeout, &out.NodeVolumeDetachTimeout + *out = new(v1.Duration) + **out = **in + } + if in.NodeDeletionTimeout != nil { + in, out := &in.NodeDeletionTimeout, &out.NodeDeletionTimeout + *out = new(v1.Duration) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KThreesControlPlaneMachineTemplate. diff --git a/controlplane/config/crd/bases/controlplane.cluster.x-k8s.io_kthreescontrolplanes.yaml b/controlplane/config/crd/bases/controlplane.cluster.x-k8s.io_kthreescontrolplanes.yaml index b3d412c8..7b4392e6 100644 --- a/controlplane/config/crd/bases/controlplane.cluster.x-k8s.io_kthreescontrolplanes.yaml +++ b/controlplane/config/crd/bases/controlplane.cluster.x-k8s.io_kthreescontrolplanes.yaml @@ -892,12 +892,23 @@ spec: More info: http://kubernetes.io/docs/user-guide/labels type: object type: object + nodeDeletionTimeout: + description: |- + NodeDeletionTimeout defines how long the machine 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. + If no value is provided, the default value for this property of the Machine resource will be used. + type: string nodeDrainTimeout: description: |- NodeDrainTimeout is the total amount of time that the controller will spend on draining a controlplane node The default value is 0, meaning that the node can be drained without any time limitations. NOTE: NodeDrainTimeout is different from `kubectl drain --timeout` type: string + nodeVolumeDetachTimeout: + description: |- + NodeVolumeDetachTimeout 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. + type: string required: - infrastructureRef type: object diff --git a/controlplane/config/crd/bases/controlplane.cluster.x-k8s.io_kthreescontrolplanetemplates.yaml b/controlplane/config/crd/bases/controlplane.cluster.x-k8s.io_kthreescontrolplanetemplates.yaml index 7df23e15..9d984e20 100644 --- a/controlplane/config/crd/bases/controlplane.cluster.x-k8s.io_kthreescontrolplanetemplates.yaml +++ b/controlplane/config/crd/bases/controlplane.cluster.x-k8s.io_kthreescontrolplanetemplates.yaml @@ -332,12 +332,23 @@ spec: More info: http://kubernetes.io/docs/user-guide/labels type: object type: object + nodeDeletionTimeout: + description: |- + NodeDeletionTimeout defines how long the machine 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. + If no value is provided, the default value for this property of the Machine resource will be used. + type: string nodeDrainTimeout: description: |- NodeDrainTimeout is the total amount of time that the controller will spend on draining a controlplane node The default value is 0, meaning that the node can be drained without any time limitations. NOTE: NodeDrainTimeout is different from `kubectl drain --timeout` type: string + nodeVolumeDetachTimeout: + description: |- + NodeVolumeDetachTimeout 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. + type: string required: - infrastructureRef type: object diff --git a/controlplane/controllers/scale.go b/controlplane/controllers/scale.go index df78779d..48d25384 100644 --- a/controlplane/controllers/scale.go +++ b/controlplane/controllers/scale.go @@ -372,8 +372,10 @@ func (r *KThreesControlPlaneReconciler) generateMachine(ctx context.Context, kcp Bootstrap: clusterv1.Bootstrap{ ConfigRef: bootstrapRef, }, - FailureDomain: failureDomain, - NodeDrainTimeout: kcp.Spec.MachineTemplate.NodeDrainTimeout, + FailureDomain: failureDomain, + NodeDrainTimeout: kcp.Spec.MachineTemplate.NodeDrainTimeout, + NodeVolumeDetachTimeout: kcp.Spec.MachineTemplate.NodeVolumeDetachTimeout, + NodeDeletionTimeout: kcp.Spec.MachineTemplate.NodeDeletionTimeout, }, }