Browse code

Extract duplicate code

Yanqiang Miao authored on 2016/09/23 15:44:35
Showing 1 changed files
... ...
@@ -483,24 +483,17 @@ func (opts *RegistryOptions) RunCmdRegistry() error {
483 483
 }
484 484
 
485 485
 func generateLivenessProbeConfig(port int, https bool) *kapi.Probe {
486
-	var scheme kapi.URIScheme
487
-	if https {
488
-		scheme = kapi.URISchemeHTTPS
489
-	}
490
-	return &kapi.Probe{
491
-		InitialDelaySeconds: 10,
492
-		TimeoutSeconds:      healthzRouteTimeoutSeconds,
493
-		Handler: kapi.Handler{
494
-			HTTPGet: &kapi.HTTPGetAction{
495
-				Scheme: scheme,
496
-				Path:   healthzRoute,
497
-				Port:   intstr.FromInt(port),
498
-			},
499
-		},
500
-	}
486
+	probeConfig := generateProbeConfig(port, https)
487
+	probeConfig.InitialDelaySeconds = 10
488
+
489
+	return probeConfig
501 490
 }
502 491
 
503 492
 func generateReadinessProbeConfig(port int, https bool) *kapi.Probe {
493
+	return generateProbeConfig(port, https)
494
+}
495
+
496
+func generateProbeConfig(port int, https bool) *kapi.Probe {
504 497
 	var scheme kapi.URIScheme
505 498
 	if https {
506 499
 		scheme = kapi.URISchemeHTTPS