@@ -3,7 +3,9 @@ package rancher2
33import (
44 provisionv1 "github.com/rancher/rancher/pkg/apis/provisioning.cattle.io/v1"
55 corev1 "k8s.io/api/core/v1"
6+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
67 "k8s.io/apimachinery/pkg/util/intstr"
8+ "time"
79)
810
911// Flatteners
@@ -75,6 +77,19 @@ func flattenClusterV2RKEConfigMachinePools(p []provisionv1.RKEMachinePool) []int
7577 }
7678 obj ["worker_role" ] = in .WorkerRole
7779 out [i ] = obj
80+
81+ if in .NodeStartupTimeout != nil {
82+ obj ["node_startup_timeout_seconds" ] = int (in .NodeStartupTimeout .Seconds ())
83+ }
84+ if in .UnhealthyNodeTimeout != nil {
85+ obj ["unhealthy_node_timeout_seconds" ] = int (in .UnhealthyNodeTimeout .Seconds ())
86+ }
87+ if in .MaxUnhealthy != nil {
88+ obj ["max_unhealthy" ] = * in .MaxUnhealthy
89+ }
90+ if in .UnhealthyRange != nil {
91+ obj ["unhealthy_range" ] = * in .UnhealthyRange
92+ }
7893 }
7994
8095 return out
@@ -173,6 +188,21 @@ func expandClusterV2RKEConfigMachinePools(p []interface{}) []provisionv1.RKEMach
173188 if v , ok := in ["worker_role" ].(bool ); ok {
174189 obj .WorkerRole = v
175190 }
191+ if v , ok := in ["node_startup_timeout_seconds" ].(int ); ok && v > 0 {
192+ d := metav1.Duration {Duration : time .Duration (v ) * time .Second }
193+ obj .NodeStartupTimeout = & d
194+ }
195+ if v , ok := in ["unhealthy_node_timeout_seconds" ].(int ); ok && v > 0 {
196+ d := metav1.Duration {Duration : time .Duration (v ) * time .Second }
197+ obj .UnhealthyNodeTimeout = & d
198+ }
199+ if v , ok := in ["max_unhealthy" ].(string ); ok && len (v ) > 0 {
200+ obj .MaxUnhealthy = & v
201+ }
202+ if v , ok := in ["unhealthy_range" ].(string ); ok && len (v ) > 0 {
203+ obj .UnhealthyRange = & v
204+ }
205+
176206 out [i ] = obj
177207 }
178208
0 commit comments