From 542f082fe2c77d05959d9adf67639bd026be96b1 Mon Sep 17 00:00:00 2001 From: jichangjun Date: Sun, 17 Sep 2023 12:56:01 +0800 Subject: [PATCH] feat: use clusterip instead of DNS for service status check --- controllers/k6_start.go | 2 +- controllers/k6_stopped_jobs.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/k6_start.go b/controllers/k6_start.go index 13a0b7f9..9308cffb 100644 --- a/controllers/k6_start.go +++ b/controllers/k6_start.go @@ -17,7 +17,7 @@ import ( ) func isServiceReady(log logr.Logger, service *v1.Service) bool { - resp, err := http.Get(fmt.Sprintf("http://%v.%v.svc.cluster.local:6565/v1/status", service.ObjectMeta.Name, service.ObjectMeta.Namespace)) + resp, err := http.Get(fmt.Sprintf("http://%v:6565/v1/status", service.Spec.ClusterIP)) if err != nil { log.Error(err, fmt.Sprintf("failed to get status from %v", service.ObjectMeta.Name)) diff --git a/controllers/k6_stopped_jobs.go b/controllers/k6_stopped_jobs.go index da9d73ce..d010e0a1 100644 --- a/controllers/k6_stopped_jobs.go +++ b/controllers/k6_stopped_jobs.go @@ -18,7 +18,7 @@ import ( ) func isJobRunning(log logr.Logger, service *v1.Service) bool { - resp, err := http.Get(fmt.Sprintf("http://%v.%v.svc.cluster.local:6565/v1/status", service.ObjectMeta.Name, service.ObjectMeta.Namespace)) + resp, err := http.Get(fmt.Sprintf("http://%v:6565/v1/status", service.Spec.ClusterIP)) if err != nil { return false }