8000 KEYCLOAK-13580 Ingress Tests by slaskawi · Pull Request #164 · keycloak/keycloak-operator · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Nov 16, 2022. It is now read-only.

KEYCLOAK-13580 Ingress Tests - #164

Merged
slaskawi merged 1 commit into
keycloak:masterfrom
slaskawi:KEYCLOAK-13580-Ingress-Tests
Apr 30, 2020
Merged

slaskawi merged 1 commit into
keycloak:masterfrom
slaskawi:KEYCLOAK-13580-Ingress-Tests

Conversation

@slaskawi
Copy link
Copy Markdown
Contributor

JIRA ID

KEYCLOAK-13580

Additional Information

This Pull Request fixes Ingress with TLS support and tests it in the e2e tests.

Verification Steps

Checklist:

  • Verified by team member
  • Comments where necessary
  • Automated Tests
  • Documentation changes if necessary

Additional Notes

@slaskawi slaskawi added this to the 9.0.3 milestone Apr 10, 2020
Comment thread test/e2e/utils.go Resolved
Comment thread test/e2e/keycloak_test.go Resolved
Comment thread test/e2e/keycloak_test.go Resolved
Comment thread test/e2e/keycloak_test.go Resolved
@slaskawi
slaskawi force-pushed the KEYCLOAK-13580-Ingress-Tests branch 3 times, most recently from cfad812 to 531e45a Compare April 14, 2020 08:19
@slaskawi
slaskawi force-pushed the KEYCLOAK-13580-Ingress-Tests branch 10 times, most recently from 9a44b13 to d978d25 Compare April 22, 2020 10:01
@coveralls
coveralls commented Apr 22, 2020 •
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.09%) to 41.265% when pulling 79bf509 on slaskawi:KEYCLOAK-13580-Ingress-Tests into bae3b1e on keycloak:master.

@slaskawi
slaskawi force-pushed the KEYCLOAK-13580-Ingress-Tests branch 5 times, most recently from 76b2d2a to ebc79c6 Compare April 23, 2020 11:05
Comment thread test/e2e/keycloak_test.go
if err != nil {
return err
}
expectInternalURL := fmt.Sprintf("https://%s.%s.svc:%d",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This check is no longer necessary. Once we introduce other tests (for all other Pull Requests) we will be validating the InternalURL implicitly.

@mhajas mhajas mentioned this pull request Apr 23, 2020
4 tasks
@slaskawi
slaskawi requested a review from mhajas April 24, 2020 09:09
@mhajas mhajas left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you @slaskawi. This will be really helpful for further testing of other CRDS. I added some comments into the code.

Also, there is one thing to consider, in order to run this locally with Minikube one needs to configure ingress addons/ etc/hosts and then create PVC from workaround file. Maybe we should extract these steps into a separate Makefile goal. And if possible it would be great to run it automatically as part of cluster/prepare in case minikube is detected (not sure how to do it though)

Comment thread test/e2e/keycloak_test.go
expectInternalURL, keycloakCR.Status.InternalURL)

// Kubernetes case - Ingress is on
if _, ok := keycloakCR.Status.SecondaryResources["Ingress"]; ok {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If I understand this correctly we check here whether we are on Kubernetes or Openshift. Do we need it? Why don't we just send the request to InternalURL from status?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That's a good point! Fixed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@slaskawi Seems like this is back again. Sorry, I missed it when I did my last review, I was just looking at changes regarding ingress resolution.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Together with @mhajas we agreed this will be fixed in the refactoring PR.

Comment thread Makefile Resolved
Comment thread Makefile Resolved
@slaskawi
slaskawi force-pushed the KEYCLOAK-13580-Ingress-Tests branch from ebc79c6 to d91c4d4 Compare April 27, 2020 07:57
@slaskawi
Copy link
Copy Markdown
Contributor Author

Also, there is one thing to consider, in order to run this locally with Minikube one needs to configure ingress addons/ etc/hosts and then create PVC from workaround file. Maybe we should extract these steps into a separate Makefile goal. And if possible it would be great to run it automatically as part of cluster/prepare in case minikube is detected (not sure how to do it though)

@mhajas Adding this to Makefile is a bit limiting. Minikube is not that popular, as far as I know, other folks use RHPDS and K3s. I would leave it as is, and hopefully, Minikube folks will fix kubernetes/minikube#3129 soon.

Comment thread test/e2e/keycloak_test.go Resolved
@mhajas
mhajas commented Apr 27, 2020
Copy link
Copy Markdown
Contributor

Also, there is one thing to consider, in order to run this locally with Minikube one needs to configure ingress addons/ etc/hosts and then create PVC from workaround file. Maybe we should extract these steps into a separate Makefile goal. And if possible it would be great to run it automatically as part of cluster/prepare in case minikube is detected (not sure how to do it though)

@mhajas Adding this to Makefile is a bit limiting. Minikube is not that popular, as far as I know, other folks use RHPDS and K3s. I would leave it as is, and hopefully, Minikube folks will fix kubernetes/minikube#3129 soon.

I see. Ok, this makes sense, thanks for the explanation. I added a suggestion in tests. We should be good to go after fixing.

@slaskawi
slaskawi force-pushed the KEYCLOAK-13580-Ingress-Tests branch from d91c4d4 to f66a4c5 Compare April 27, 2020 08:18
mhajas
mhajas previously approved these changes Apr 27, 2020
@mhajas mhajas left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@slaskawi thank you for all fixes. The PR looks good to me. However, do you have any idea why Travis wasn't triggered? I would like to see it green before merging because for me updating /etc/resolv.conf didn't work, I probably need to configure it differently on Fedora. Updating /etc/hosts worked.

@slaskawi
Copy link
Copy Markdown
Contributor Author

@mhajas It has and it failed: https://travis-ci.org/github/keycloak/keycloak-operator/builds/679987098

I'll try to look into it in the afternoon or tomorrow morning (have a bunch of emails to respond to).

@slaskawi
Copy link
Copy Markdown
Contributor Author

@mhajas I tried pretty hard to get this working with DNS Resolver but failed. Modifying /etc/resolv.conf is not perfect as the resolver picks up the second DNS only if the first one fails (see this thread). This may lead to very weird and hard to reproduce bugs in the future.

So I decided to fall back to using /etc/hosts as this is a solution everybody knows.

@mhajas mhajas left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Well, what a pity. The DNS solution would be very pretty. However, for now /etc/hosts is enough. We need to make some decent test coverage asap so we can productize. Once we will want to make our tests parallel, we will probably need to revisit this as we will need more ingresses at once. We can discuss this on tomorrow's call as well, but for now, I will approve.

@vinay2107
Copy link
Copy Markdown

@slaskawi Sorry this query might not be linked to this PR but since this repo hasn't enabled issues, I ll post it anyways . Today the "keycloak" CR uses single service ingress implementation and doesn't provide any way to configure ingress hostname, tls configurations or annotations necessary for using it with any other ingress controller. Will this support be enabled in future or ?

@slaskawi
Copy link
Copy Markdown
Contributor Author

@slaskawi
Copy link
Copy Markdown
Contributor Author

Today the "keycloak" CR uses single service ingress implementation and doesn't provide any way to configure ingress hostname, tls configurations or annotations necessary for using it with any other ingress controller. Will this support be enabled in future or ?

@vinay2107 Thanks for the interest in this!

At the moment, the Operator do not reconcile the Host part of the Ingress. You can modify it to anything you need.

As for TLS Settings, it's on our radar and we track it in KEYCLOAK-12307. We also had some implementation proposals (#104), however we had to reject them as the solution need to work in both - Kubernetes and OpenShift (so on both Routes and Ingresses).

Perhaps you would be interested in donating us an implementation?

@stianst stianst left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approving based on @mhajas review, @slaskawi leaving it for you to merge when you want

@slaskawi
slaskawi merged commit 9b28ef3 into keycloak:master Apr 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

0