@@ -302,6 +302,30 @@ func newEtcdPod(m *etcdutil.Member, initialCluster []string, clusterName, state,
302302 "--listen-peer-urls=%s --listen-client-urls=%s --advertise-client-urls=%s " +
303303 "--initial-cluster=%s --initial-cluster-state=%s" ,
304304 dataDir , m .Name , m .PeerURL (), m .ListenPeerURL (), m .ListenClientURL (), m .ClientURL (), strings .Join (initialCluster , "," ), state )
305+ if cs .HeartbeatTimeout > 0 {
306+ commands += fmt .Sprintf (" --heartbeat-interval=%d" , cs .HeartbeatTimeout )
307+ }
308+
309+ if cs .ElectionTimeout > 0 {
310+ commands += fmt .Sprintf (" --election-timeout=%d" , cs .ElectionTimeout )
311+ }
312+
313+ if cs .SnapshotCount > 0 {
314+ commands += fmt .Sprintf (" --snapshot-count=%d" , cs .SnapshotCount )
315+ }
316+
317+ if cs .AutoCompactionMode != "" {
318+ commands += fmt .Sprintf (" --auto-compaction-mode=%s" , cs .AutoCompactionMode )
319+ }
320+
321+ if cs .AutoCompactionRetention != "" {
322+ commands += fmt .Sprintf (" --auto-compaction-retention=%s" , cs .AutoCompactionRetention )
323+ }
324+
325+ if cs .ExperimentalPeerSkipClientSANVerification {
326+ commands += fmt .Sprintf (" --experimental-peer-skip-client-san-verification" )
327+ }
328+
305329 if m .SecurePeer {
306330 commands += fmt .Sprintf (" --peer-client-cert-auth=true --peer-trusted-ca-file=%[1]s/peer-ca.crt --peer-cert-file=%[1]s/peer.crt --peer-key-file=%[1]s/peer.key" , peerTLSDir )
307331 }
@@ -318,12 +342,7 @@ func newEtcdPod(m *etcdutil.Member, initialCluster []string, clusterName, state,
318342 "etcd_cluster" : clusterName ,
319343 }
320344
321- livenessProbe := newEtcdProbe (cs .TLS .IsSecureClient ())
322- readinessProbe := newEtcdProbe (cs .TLS .IsSecureClient ())
323- readinessProbe .InitialDelaySeconds = 1
324- readinessProbe .TimeoutSeconds = 5
325- readinessProbe .PeriodSeconds = 5
326- readinessProbe .FailureThreshold = 3
345+ livenessProbe , readinessProbe := provisionProbeConfigs (cs )
327346
328347 container := containerWithProbes (
329348 etcdContainer (strings .Split (commands , " " ), cs .Repository , cs .Version ),
@@ -406,6 +425,60 @@ func newEtcdPod(m *etcdutil.Member, initialCluster []string, clusterName, state,
406425 return pod
407426}
408427
428+ func provisionProbeConfigs (cs api.ClusterSpec ) (livenessProbe * v1.Probe , readinessProbe * v1.Probe ) {
429+ livenessProbe = newEtcdProbe (cs .TLS .IsSecureClient ())
430+
431+ if cs .LivenessProbeConfig .InitialDelaySeconds != 0 {
432+ livenessProbe .InitialDelaySeconds = cs .LivenessProbeConfig .InitialDelaySeconds
433+ } else {
434+ livenessProbe .InitialDelaySeconds = 10
435+ }
436+
437+ if cs .LivenessProbeConfig .TimeoutSeconds != 0 {
438+ livenessProbe .TimeoutSeconds = cs .LivenessProbeConfig .TimeoutSeconds
439+ } else {
440+ livenessProbe .TimeoutSeconds = 10
441+ }
442+
443+ if cs .LivenessProbeConfig .PeriodSeconds != 0 {
444+ livenessProbe .PeriodSeconds = cs .LivenessProbeConfig .PeriodSeconds
445+ } else {
446+ livenessProbe .PeriodSeconds = 60
447+ }
448+
449+ if cs .LivenessProbeConfig .FailureThreshold != 0 {
450+ livenessProbe .FailureThreshold = cs .LivenessProbeConfig .FailureThreshold
451+ } else {
452+ livenessProbe .FailureThreshold = 3
453+ }
454+
455+ readinessProbe = newEtcdProbe (cs .TLS .IsSecureClient ())
456+
457+ if cs .ReadinessProbeConfig .InitialDelaySeconds != 0 {
458+ livenessProbe .InitialDelaySeconds = cs .LivenessProbeConfig .InitialDelaySeconds
459+ } else {
460+ livenessProbe .InitialDelaySeconds = 1
461+ }
462+
463+ if cs .ReadinessProbeConfig .TimeoutSeconds != 0 {
464+ livenessProbe .TimeoutSeconds = cs .LivenessProbeConfig .TimeoutSeconds
465+ } else {
466+ livenessProbe .TimeoutSeconds = 5
467+ }
468+
469+ if cs .ReadinessProbeConfig .PeriodSeconds != 0 {
470+ livenessProbe .PeriodSeconds = cs .LivenessProbeConfig .PeriodSeconds
471+ } else {
472+ livenessProbe .PeriodSeconds = 5
473+ }
474+
475+ if cs .ReadinessProbeConfig .FailureThreshold != 0 {
476+ livenessProbe .FailureThreshold = cs .LivenessProbeConfig .FailureThreshold
477+ } else {
478+ livenessProbe .FailureThreshold = 3
479+ }
480+ }
481+
409482func podSecurityContext (podPolicy * api.PodPolicy ) * v1.PodSecurityContext {
410483 if podPolicy == nil {
411484 return nil
0 commit comments