Skip to content

Commit

Permalink
[#1012] Fix MicroShit detection
Browse files Browse the repository at this point in the history
  • Loading branch information
brusdev committed Sep 17, 2024
1 parent f0f2a8c commit 7a87720
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
8 changes: 4 additions & 4 deletions controllers/activemqartemis_controller2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ var _ = Describe("artemis controller 2", func() {
}
candidate.Spec.Resources = corev1.ResourceRequirements{
Requests: corev1.ResourceList{
corev1.ResourceStorage: resource.MustParse("1Mi"),
corev1.ResourceStorage: resource.MustParse("16Mi"),
},
}
})
Expand Down Expand Up @@ -287,7 +287,7 @@ var _ = Describe("artemis controller 2", func() {
}
candidate.Spec.Resources = corev1.ResourceRequirements{
Requests: corev1.ResourceList{
corev1.ResourceStorage: resource.MustParse("2Mi"),
corev1.ResourceStorage: resource.MustParse("16Mi"),
},
}
})
Expand All @@ -312,7 +312,7 @@ var _ = Describe("artemis controller 2", func() {
},
Resources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{
corev1.ResourceName(corev1.ResourceStorage): resource.MustParse("2Mi"),
corev1.ResourceName(corev1.ResourceStorage): resource.MustParse("16Mi"),
},
},
},
Expand Down Expand Up @@ -363,7 +363,7 @@ var _ = Describe("artemis controller 2", func() {
},
Resources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{
corev1.ResourceName(corev1.ResourceStorage): resource.MustParse("2Mi"),
corev1.ResourceName(corev1.ResourceStorage): resource.MustParse("16Mi"),
},
},
},
Expand Down
7 changes: 4 additions & 3 deletions controllers/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,19 +236,20 @@ func setUpNamespace() {
}

func setUpIngress() {
isIngressSSLPassthroughEnabled = isOpenshift
clusterIngressHost = clusterUrl.Hostname()

ingressConfig := &configv1.Ingress{}
ingressConfigKey := types.NamespacedName{Name: "cluster"}
ingressConfigErr := k8sClient.Get(ctx, ingressConfigKey, ingressConfig)

if ingressConfigErr == nil {
isIngressSSLPassthroughEnabled = true
clusterIngressHost = "ingress." + ingressConfig.Spec.Domain
} else {
isIngressSSLPassthroughEnabled = false
clusterIngressHost = clusterUrl.Hostname()
ingressNginxControllerDeployment := &appsv1.Deployment{}
ingressNginxControllerDeploymentKey := types.NamespacedName{Name: "ingress-nginx-controller", Namespace: "ingress-nginx"}
err := k8sClient.Get(ctx, ingressNginxControllerDeploymentKey, ingressNginxControllerDeployment)

if err == nil {
if len(ingressNginxControllerDeployment.Spec.Template.Spec.Containers) > 0 {
ingressNginxControllerContainer := &ingressNginxControllerDeployment.Spec.Template.Spec.Containers[0]
Expand Down
4 changes: 2 additions & 2 deletions pkg/utils/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -685,9 +685,9 @@ func DetectOpenshiftWith(config *rest.Config) (bool, error) {
for i := 0; i < defaultRetries; i++ {
isOpenShiftResourcePresent, err = discovery.IsResourceEnabled(discoveryClient,
schema.GroupVersionResource{
Group: "operator.openshift.io",
Group: "route.openshift.io",
Version: "v1",
Resource: "openshiftapiservers",
Resource: "routes",
})

if err == nil {
Expand Down

0 comments on commit 7a87720

Please sign in to comment.