Skip to content

Commit fcda11d

Browse files
authored
Merge pull request #7535 from fabriziopandini/add-missing-fields-in-cc
✨ Add missing fields in ControlPlaneClass and MachineDeploymentClass
2 parents 75d0b22 + 317e023 commit fcda11d

File tree

10 files changed

+621
-37
lines changed

10 files changed

+621
-37
lines changed

api/v1alpha4/conversion.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,18 @@ func (src *ClusterClass) ConvertTo(dstRaw conversion.Hub) error {
122122
dst.Spec.Patches = restored.Spec.Patches
123123
dst.Spec.Variables = restored.Spec.Variables
124124
dst.Spec.ControlPlane.MachineHealthCheck = restored.Spec.ControlPlane.MachineHealthCheck
125+
dst.Spec.ControlPlane.NodeDrainTimeout = restored.Spec.ControlPlane.NodeDrainTimeout
126+
dst.Spec.ControlPlane.NodeVolumeDetachTimeout = restored.Spec.ControlPlane.NodeVolumeDetachTimeout
127+
dst.Spec.ControlPlane.NodeDeletionTimeout = restored.Spec.ControlPlane.NodeDeletionTimeout
125128

126129
for i := range restored.Spec.Workers.MachineDeployments {
127130
dst.Spec.Workers.MachineDeployments[i].MachineHealthCheck = restored.Spec.Workers.MachineDeployments[i].MachineHealthCheck
131+
dst.Spec.Workers.MachineDeployments[i].FailureDomain = restored.Spec.Workers.MachineDeployments[i].FailureDomain
132+
dst.Spec.Workers.MachineDeployments[i].NodeDrainTimeout = restored.Spec.Workers.MachineDeployments[i].NodeDrainTimeout
133+
dst.Spec.Workers.MachineDeployments[i].NodeVolumeDetachTimeout = restored.Spec.Workers.MachineDeployments[i].NodeVolumeDetachTimeout
134+
dst.Spec.Workers.MachineDeployments[i].NodeDeletionTimeout = restored.Spec.Workers.MachineDeployments[i].NodeDeletionTimeout
135+
dst.Spec.Workers.MachineDeployments[i].MinReadySeconds = restored.Spec.Workers.MachineDeployments[i].MinReadySeconds
136+
dst.Spec.Workers.MachineDeployments[i].Strategy = restored.Spec.Workers.MachineDeployments[i].Strategy
128137
}
129138

130139
dst.Status = restored.Status

api/v1alpha4/zz_generated.conversion.go

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1beta1/clusterclass_types.go

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,26 @@ type ControlPlaneClass struct {
100100
// referenced above is Machine based and supports setting replicas.
101101
// +optional
102102
MachineHealthCheck *MachineHealthCheckClass `json:"machineHealthCheck,omitempty"`
103+
104+
// NodeDrainTimeout is the total amount of time that the controller will spend on draining a node.
105+
// The default value is 0, meaning that the node can be drained without any time limitations.
106+
// NOTE: NodeDrainTimeout is different from `kubectl drain --timeout`
107+
// NOTE: This value can be overridden while defining a Cluster.Topology.
108+
// +optional
109+
NodeDrainTimeout *metav1.Duration `json:"nodeDrainTimeout,omitempty"`
110+
111+
// NodeVolumeDetachTimeout is the total amount of time that the controller will spend on waiting for all volumes
112+
// to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations.
113+
// NOTE: This value can be overridden while defining a Cluster.Topology.
114+
// +optional
115+
NodeVolumeDetachTimeout *metav1.Duration `json:"nodeVolumeDetachTimeout,omitempty"`
116+
117+
// NodeDeletionTimeout defines how long the controller will attempt to delete the Node that the Machine
118+
// hosts after the Machine is marked for deletion. A duration of 0 will retry deletion indefinitely.
119+
// Defaults to 10 seconds.
120+
// NOTE: This value can be overridden while defining a Cluster.Topology.
121+
// +optional
122+
NodeDeletionTimeout *metav1.Duration `json:"nodeDeletionTimeout,omitempty"`
103123
}
104124

105125
// WorkersClass is a collection of deployment classes.
@@ -125,6 +145,44 @@ type MachineDeploymentClass struct {
125145
// MachineHealthCheck defines a MachineHealthCheck for this MachineDeploymentClass.
126146
// +optional
127147
MachineHealthCheck *MachineHealthCheckClass `json:"machineHealthCheck,omitempty"`
148+
149+
// FailureDomain is the failure domain the machines will be created in.
150+
// Must match a key in the FailureDomains map stored on the cluster object.
151+
// NOTE: This value can be overridden while defining a Cluster.Topology using this MachineDeploymentClass.
152+
// +optional
153+
FailureDomain *string `json:"failureDomain,omitempty"`
154+
155+
// NodeDrainTimeout is the total amount of time that the controller will spend on draining a node.
156+
// The default value is 0, meaning that the node can be drained without any time limitations.
157+
// NOTE: NodeDrainTimeout is different from `kubectl drain --timeout`
158+
// NOTE: This value can be overridden while defining a Cluster.Topology using this MachineDeploymentClass.
159+
// +optional
160+
NodeDrainTimeout *metav1.Duration `json:"nodeDrainTimeout,omitempty"`
161+
162+
// NodeVolumeDetachTimeout is the total amount of time that the controller will spend on waiting for all volumes
163+
// to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations.
164+
// NOTE: This value can be overridden while defining a Cluster.Topology using this MachineDeploymentClass.
165+
// +optional
166+
NodeVolumeDetachTimeout *metav1.Duration `json:"nodeVolumeDetachTimeout,omitempty"`
167+
168+
// NodeDeletionTimeout defines how long the controller will attempt to delete the Node that the Machine
169+
// hosts after the Machine is marked for deletion. A duration of 0 will retry deletion indefinitely.
170+
// Defaults to 10 seconds.
171+
// NOTE: This value can be overridden while defining a Cluster.Topology using this MachineDeploymentClass.
172+
// +optional
173+
NodeDeletionTimeout *metav1.Duration `json:"nodeDeletionTimeout,omitempty"`
174+
175+
// Minimum number of seconds for which a newly created machine should
176+
// be ready.
177+
// Defaults to 0 (machine will be considered available as soon as it
178+
// is ready)
179+
// NOTE: This value can be overridden while defining a Cluster.Topology using this MachineDeploymentClass.
180+
MinReadySeconds *int32 `json:"minReadySeconds,omitempty"`
181+
182+
// The deployment strategy to use to replace existing machines with
183+
// new ones.
184+
// NOTE: This value can be overridden while defining a Cluster.Topology using this MachineDeploymentClass.
185+
Strategy *MachineDeploymentStrategy `json:"strategy,omitempty"`
128186
}
129187

130188
// MachineDeploymentClassTemplate defines how a MachineDeployment generated from a MachineDeploymentClass

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 45 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1beta1/zz_generated.openapi.go

Lines changed: 58 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)