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

openshift oauth (PROJQUAY-673) #473

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

mosen
Copy link
Contributor

@mosen mosen commented Jul 11, 2020

Description of Changes

This change adds features and configuration for integrating with the OpenShift 3.x/4.x integrated OAuth service.

When using the config app, the administrator is presented with the option to configure Integrated OAuth, such that logging into the OpenShift console confers access to Project Quay.

The functionality will not impact Project Quay permissions at this time. The user is authenticated to Quay but there will be no further provisioning. This is regarded as beyond the scope of this change.

As OpenShift does not store e-mail addresses. This functionality will not work if the MAILING feature is enabled.

The end user motivation for the change: To provide a seamless experience when deploying Project Quay into an OpenShift v3/v4 cluster so that no further configuration of Authentication is required, unless there is a requirement to separate Project Quay from the operation of the cluster.

The current behaviour: When deploying Project Quay into an OpenShift cluster, none of the available authentication methods support integration with the OpenShift RBAC/console identity. It is up to the user to establish an LDAP or OIDC connection via an external IdP which matches their OpenShift identity.

Changes:

  • Adds Configuration Feature flag and Configuration Variable, similar to Google, Gitlab etc OIDC configuration parameters.
  • Validates configuration (except optional items, like running out-of-cluster).
  • Adds a section to the config app underneath the GitHub OIDC provider settings which has placeholder variables suggesting the recommended values.
  • Added a markdown document describing the operation of the OAuth provider if you would like to split that out to another repo.
  • Retrieves user information from the OpenShift users API (no e-mail available here).

Issue: PROJQUAY-673

TESTING ->

Manually validated against OpenShift 4.4.10
We could possibly look at a pytest-docker which brings up the openshift-oauth proxy as a standalone container in the CI if that was required.

BREAKING CHANGE ->

New functionality, only modifications made are to the config schema.


Reviewer Checklist

  • It works!
  • Comments provide sufficient explanations for the next contributor
  • Tests cover changes and corner cases
  • Follows Quay syntax patterns and format

@app-sre-bot
Copy link
Collaborator

Can one of the admins verify this patch?

@mosen
Copy link
Contributor Author

mosen commented Jul 11, 2020

Re-submission of #321 with a bunch of things fixed.

@mosen
Copy link
Contributor Author

mosen commented Aug 11, 2020

Rebased over quay/quay master as requested and force pushed

@mosen
Copy link
Contributor Author

mosen commented Aug 11, 2020

@alecmerdler tom says to ping you regarding this PR

@alecmerdler
Copy link
Contributor

@mosen Looks like some tests are failing, but I'll check this out later today and try running it.

@mosen
Copy link
Contributor Author

mosen commented Aug 12, 2020

@alecmerdler yep this one is my fault, eg

 >           assert has_key, "Property `%s` is missing from config schema" % key
E           AssertionError: Property `OPENSHIFT_LOGIN_CONFIG` is missing from config schema

@mosen
Copy link
Contributor Author

mosen commented Sep 1, 2020

Getting back on this after a vacation. Update soon

Add oauth.services.openshift based mostly on oidc.py
Add a basic test
Make necessary provisions for a new config item called OPENSHIFT_LOGIN_CONFIG
PROJQUAY-673: Add OpenShift Config Validator class
PROJQUAY-673: Add OpenShift Authentication Documentation via openshift-authentication.md
PROJQUAY-673: do not rely on the presence of the config var OPENSHIFT_SERVER
PROJQUAY-673: more explanation in markdown docs
…e network as it seems the openshift.default.svc endpoint is untrusted.
PROJQUAY-673: documentation explains troubleshooting of incorrect redirect uri
…nge_code_for_login() so they don't diverge at some point.
PROJQUAY-673: add more notes about caveats RE emails
PROJQUAY-673: change config variable for API endpoint to OPENSHIFT_API_URL as it makes more sense.
@mosen mosen force-pushed the PROJQUAY-673-openshift-oauth branch from c4345a7 to dceb868 Compare September 1, 2020 05:21
@mosen
Copy link
Contributor Author

mosen commented Sep 1, 2020

Rebased on master, will fix CI test failures

@mosen
Copy link
Contributor Author

mosen commented Sep 1, 2020

@alecmerdler clear to review

@werne2j
Copy link

werne2j commented Oct 19, 2020

Any insight into when we may see this PR get reviewed and merged in? This is a feature my team is waiting for. Thanks!

@alecmerdler
Copy link
Contributor

@werne2j I spent some time attempting to deploy and run this on an OpenShift cluster using the new Quay Operator, and I may have done something incorrectly because I ran into an error. I will swing back to testing this again soon.

@mosen
Copy link
Contributor Author

mosen commented Oct 21, 2020

happy to give it a test if you can point me to the error. There's a bit of setup on the openshift side so im happy to walk through that.

@openshift-ci
Copy link

openshift-ci bot commented Dec 15, 2021

@mosen: PR needs rebase.

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.

@mosen
Copy link
Contributor Author

mosen commented Dec 20, 2021

Won't rebase unless its considered for merge

@HammerMeetNail HammerMeetNail changed the title Projquay 673 openshift oauth openshift oauth (PROJQUAY-673) Mar 21, 2022
@flavianmissi
Copy link
Contributor

hey @mosen, did you have any plans of implementing validate_client_id_and_secret[1] in this PR?

[1] https://github.com/quay/quay/pull/473/files#diff-444473ce9154266d39f66c801d863b71eec414cf0a0222bd04154a5bad537565R74-R76

@mosen
Copy link
Contributor Author

mosen commented May 12, 2022

Not at this time. I left the team using red hat quay. Unsure where you want to go from here

@flavianmissi
Copy link
Contributor

Gotcha. I'm probing to team about getting this moving, but can't say where we'll go from here just yet. Will keep you posted.

@wouter2397
Copy link

@flavianmissi Any updates regarding this feature? We are looking into authentication options for Quay and we are very interested in this feature.

@mosen
Copy link
Contributor Author

mosen commented Oct 12, 2022

I'd probably be happy to rebase again. I'm kinda worried about dumping code on the core team and then they have to support it but there's nothing super magical included.

@wouter2397
Copy link

@mosen Thank you for your comment. I have direct contacts within Red Hat. I can ask them to review your code to see if they can support this in the Quay team(s).

Do you think this is a good way to get this rolling within the Quay project?

@flavianmissi
Copy link
Contributor

I brought this up internally with the team - will report back when I have news.

@flavianmissi
Copy link
Contributor

Our PM is positive towards this feature. @mosen I just noticed this has some config app related changes - we have moved the config app to its own repository: https://github.com/quay/config-tool/tree/master/pkg/lib/editor/js/core-config-setup, so we'll need a PR against that repo for the configuration related changes.

@jonathankingfc
Copy link
Contributor

Hi @mosen Thanks for submitting this. I have a few comments. The OAuth implementation looks correct at a quick glance, although I have not yet tested it. As @flavianmissi mentioned, the config app and the validation logic have been moved to the config-tool repository. Your changes to the front end can be copied to that repo, as for the validator logic we have rewritten that tool in Go so there may be some rewrites there. I would say reduce this PR to just the OAuth implementation and it should be good for testing.

@flavianmissi flavianmissi requested review from jonathankingfc and removed request for josephschorr and alecmerdler October 13, 2022 15:13
Copy link
Contributor

@jonathankingfc jonathankingfc left a comment

Choose a reason for hiding this comment

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

Please see the previous comment for the requested changes. Thanks!

@BenjaminNeale-Heritage
Copy link

Red Hat is pushing the OpenShift Platform Plus which bundles Quay on OCP.  This feature is a Quality of Life feature that aligns well with the with the goal of the OPP bundle. I'm very interested to see OpenShift OAuth added to Quay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
8 participants