Skip to content

Commit 32ae2dd

Browse files
committed
Fix few other on-prem jobs
Signed-off-by: chiragkyal <ckyal@redhat.com>
1 parent ce68c31 commit 32ae2dd

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

pkg/monitortestlibrary/platformidentification/types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,8 @@ func GetJobType(ctx context.Context, clientConfig *rest.Config) (*JobType, error
207207
platform = "openstack"
208208
case configv1.LibvirtPlatformType:
209209
platform = "libvirt"
210+
case configv1.KubevirtPlatformType:
211+
platform = "kubevirt"
210212
}
211213

212214
networkType := ""

test/extended/router/external_certificate.go

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
exutil "github.com/openshift/origin/test/extended/util"
2626
rbacv1 "k8s.io/api/rbac/v1"
2727
"k8s.io/apimachinery/pkg/util/rand"
28+
"k8s.io/apimachinery/pkg/util/sets"
2829
"k8s.io/apimachinery/pkg/util/wait"
2930
e2e "k8s.io/kubernetes/test/e2e/framework"
3031
"k8s.io/kubernetes/test/e2e/framework/pod"
@@ -445,11 +446,11 @@ var _ = g.Describe("[sig-network][OCPFeatureGate:RouteExternalCertificate][Featu
445446
hostName, err := getHostnameForRoute(oc, routeToTest.Name)
446447
o.Expect(err).NotTo(o.HaveOccurred())
447448

448-
// Check if the job is running on a metal platform
449-
metal, err := isMetalJob(oc)
449+
// Check if the job is running on an on-prem platform
450+
onPrem, err := isOnPremJob(oc)
450451
o.Expect(err).NotTo(o.HaveOccurred())
451452

452-
if metal {
453+
if onPrem {
453454
execPod := exutil.CreateExecPodOrFail(oc.AdminKubeClient(), oc.Namespace(), "execpod")
454455
defer func() {
455456
oc.AdminKubeClient().CoreV1().Pods(oc.Namespace()).Delete(context.Background(), execPod.Name, *metav1.NewDeleteOptions(1))
@@ -486,7 +487,7 @@ var _ = g.Describe("[sig-network][OCPFeatureGate:RouteExternalCertificate][Featu
486487

487488
// httpsGetCall makes an HTTPS GET request to the specified hostname with retries.
488489
// It uses the provided rootDerBytes as the trusted CA certificate.
489-
// For metal platforms, it uses an exec pod to make the request.
490+
// For on-prem platforms, it uses an exec pod to make the request.
490491
func httpsGetCall(oc *exutil.CLI, hostname string, rootDerBytes []byte) (string, error) {
491492
url := fmt.Sprintf("https://%s", hostname)
492493
e2e.Logf("running https get for host %q", hostname)
@@ -500,14 +501,14 @@ func httpsGetCall(oc *exutil.CLI, hostname string, rootDerBytes []byte) (string,
500501
Bytes: rootDerBytes,
501502
})
502503

503-
// Check if the job is running on a metal platform
504-
metal, err := isMetalJob(oc)
504+
// Check if the job is running on an on-prem platform
505+
onPrem, err := isOnPremJob(oc)
505506
if err != nil {
506507
return "", err
507508
}
508509

509-
if metal {
510-
e2e.Logf("Running on a metal platform")
510+
if onPrem {
511+
e2e.Logf("Running on an on-prem platform")
511512
return httpsGetCallWithExecPod(oc, url, rootCertPEM)
512513
}
513514

@@ -529,7 +530,7 @@ func httpsGetCall(oc *exutil.CLI, hostname string, rootDerBytes []byte) (string,
529530
}
530531

531532
// httpsGetCallWithExecPod makes HTTPS GET request using an exec pod.
532-
// This function is used specifically for metal platforms where external DNS resolution
533+
// This function is used specifically for on-prem platforms where external DNS resolution
533534
// might be problematic. It creates a ConfigMap using the given root CA certificate,
534535
// mounts it to the exec pod, and then uses curl within the pod to make the HTTPS request with retries.
535536
func httpsGetCallWithExecPod(oc *exutil.CLI, url string, rootCertPEM []byte) (string, error) {
@@ -883,11 +884,15 @@ func patchRouteToRemoveExternalCertificate(oc *exutil.CLI, routeName string) err
883884
return err
884885
}
885886

886-
// isMetalJob checks if the current job is running on a metal platform.
887-
func isMetalJob(oc *exutil.CLI) (bool, error) {
887+
// isOnPremJob checks if the current job is running on an on-prem platform.
888+
func isOnPremJob(oc *exutil.CLI) (bool, error) {
889+
onPremPlatforms := sets.NewString("metal", "openstack", "kubevirt")
890+
888891
jobType, err := platformidentification.GetJobType(context.TODO(), oc.AdminConfig())
889892
if err != nil {
890893
return false, err
891894
}
892-
return jobType.Platform == "metal", nil
895+
e2e.Logf("Detected platform: %s", jobType.Platform)
896+
897+
return onPremPlatforms.Has(jobType.Platform), nil
893898
}

0 commit comments

Comments
 (0)