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

feat(dex): dex backend storage adapter implementation #839

Open
wants to merge 54 commits into
base: main
Choose a base branch
from

Conversation

kengou
Copy link
Contributor

@kengou kengou commented Jan 9, 2025

Description

Implements:

  • Resolves feature-flags with dex storage selection from a ConfigMap
  • Dex backend storage adapter interface to support kubernetes or postgres
  • idproxy and Organization Reconciler uses the storage adapter interface

Additionally implements #798 partially -

  • If dex storage backend is kubernetes then Dex Custom Resources are created in the organization's namespace

What type of PR is this? (check all applicable)

  • 🍕 Feature
  • 🐛 Bug Fix
  • 📝 Documentation Update
  • 🎨 Style
  • 🧑‍💻 Code Refactor
  • 🔥 Performance Improvements
  • ✅ Test
  • 🤖 Build
  • 🔁 CI
  • 📦 Chore (Release)
  • ⏩ Revert

Related Tickets & Documents

Added tests?

  • 👍 yes
  • 🙅 no, because they aren't needed
  • 🙋 no, because I need help
  • Separate ticket for tests # (issue/pr)

Added to documentation?

  • 📜 README.md
  • 🤝 Documentation pages updated
  • 🙅 no documentation needed
  • (if applicable) generated OpenAPI docs for CRD changes

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes

pkg/controllers/organization/dex.go Outdated Show resolved Hide resolved
pkg/controllers/organization/dex.go Outdated Show resolved Hide resolved
pkg/controllers/organization/dex.go Outdated Show resolved Hide resolved
pkg/controllers/organization/dex.go Outdated Show resolved Hide resolved
cmd/greenhouse/main.go Outdated Show resolved Hide resolved
cmd/greenhouse/main.go Outdated Show resolved Hide resolved
@kengou kengou requested a review from a team as a code owner January 16, 2025 13:21
@kengou kengou requested a review from a team as a code owner January 29, 2025 13:41
@abhijith-darshan abhijith-darshan changed the title feat(dex): use postgresql as backend feat(dex): dex backend storage adapter implementation Jan 31, 2025
pkg/dex/store/pg_store.go Dismissed Show dismissed Hide dismissed
@abhijith-darshan
Copy link
Contributor

abhijith-darshan commented Feb 1, 2025

@IvoGoman @kengou - Please review from scratch as the implementation has been re-written

Implements:

  • Resolves feature-flags with dex storage selection from a ConfigMap
  • Dex backend storage adapter interface to support kubernetes or postgres
  • idproxy and Organization Reconciler uses the storage adapter interface
  • organization controller will not try to Own dex CRs if the storage is postgres, which should allow running both postgres and kubernetes storage backends in the cluster

Additionally implements #798 -

  • If dex storage backend is kubernetes then Dex Custom Resources are created in the organization's namespace
  • OAuth2Client credentials secret is created in the organization's namespace following the pattern org-name-dex-secrets
  • generates a deterministic client secret using hmac sha256 from clientID and secretKey + truncated to 32 characters (so as to consistently generate the same credential on every reconciliation)

TODO -

  • We need to wrap environment variables in manager deployment with if postgres enabled and not have a static injection of postgres vars (currently e2e tests and helm lint fail because of that)
  • for [FEAT] - Refactor DEX Controller #798 we need to early exit (requeue?) if the organization namespace is not active
  • E2E tests for kubernetes and Postgres should be implemented

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.

[FEAT] - Dex IDP Persistence with DB
3 participants