Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #1568 #2225 #2458

Closed
wants to merge 3 commits into from
Closed

Conversation

antoniomerlin
Copy link
Contributor

@antoniomerlin antoniomerlin commented Feb 6, 2024

Which problem is this PR solving?

Description of the changes

  • if spec.IngressClassName is not specified in CRD, then this will query kubernetes API for getting list of IngressClasses and look for if any default IngressClass is available, if present the it attach that IngressClass to networkingv1.IngressSpec of jaegerIngress and if not available then it check for nginx ingress controller and attach that and if nothing is avalable then it do nothing.

How was this change tested?

  • tested over multinode cluster with nginx ingress controller enabled, for getting IP from LoadBalancer

Checklist

if spec.IngressClassName is not specified in CRD, then this will query kubernetes API for getting list of IngressClasses and look for if any default IngressClass is available, if present the it attach that IngressClass to networkingv1.IngressSpec of jaegerIngress and if not available then it check for nginx ingress controller and attach that and if nothing is avalable then it do nothing.

Signed-off-by: Gaurav Singh <[email protected]>
Copy link

openshift-ci bot commented Feb 6, 2024

Hi @antoniomerlin. Thanks for your PR.

I'm waiting for a jaegertracing member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Comment on lines 61 to 81
if err == nil {
clientSet, err := kubernetes.NewForConfig(config)
if err == nil {
ingressList, err := clientSet.NetworkingV1().IngressClasses().List(context.Background(), metav1.ListOptions{})
if err == nil {
for _, ingress := range ingressList.Items {
if ingress.Name == "nginx" {
nginxIngressAvailable = true
}
for k, v := range ingress.Annotations {
if k == "ingressclass.kubernetes.io/is-default-class" {
if v == "true" {
class = ingress.Name
break
}
}
}
}
}
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, instead of this, create a new method and call it from here. It will help readability. Also, instead of checking there are no errors, check if there is an error and return if true.

Copy link
Collaborator

@iblancasa iblancasa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, add a test.

@antoniomerlin
Copy link
Contributor Author

antoniomerlin commented Feb 8, 2024

Hi, thanks for reviewing, i've modified the changes just a query you already having test mentioning this scenario :-

func TestQueryIngressClass(t *testing.T) {
	jaeger := v1.NewJaeger(types.NamespacedName{Name: "TestQueryIngressClass"})
	jaegerNoIngressNoClass := v1.NewJaeger(types.NamespacedName{Name: "TestQueryIngressNoClass"})

	inressClassName := "nginx"
	jaeger.Spec.Ingress.IngressClassName = &inressClassName

	ingress := NewQueryIngress(jaeger)
	ingressNoClass := NewQueryIngress(jaegerNoIngressNoClass)

	dep := ingress.Get()

	assert.NotNil(t, dep.Spec.IngressClassName)
	assert.Equal(t, "nginx", *dep.Spec.IngressClassName)
	assert.Nil(t, ingressNoClass.Get().Spec.IngressClassName)
}

pkg/ingress/query_test.go do i need to write again or can use existing one or do any modification in this ?

@iblancasa
Copy link
Collaborator

Please, fix the DCO

@antoniomerlin antoniomerlin deleted the bug/1568 branch February 12, 2024 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Facing issues in getting the IP address to access Jaeger-UI on Linux platform
2 participants