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

Merged
merged 126 commits into from
Feb 25, 2025
Merged
Changes from 1 commit
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
cd6b3e5
feat(dex): create connector and client to sql along with the CRDs
kengou Jan 9, 2025
b2edebf
feat(dex): add sql backend to idproxy commented out
kengou Jan 9, 2025
df36be5
feat(dex): create connector and client to sql along with the CRDs
kengou Jan 9, 2025
274eaa1
feat(dex): add sql backend to idproxy commented out
kengou Jan 9, 2025
5a93642
Merge branch 'feat/dex-sql' of https://github.com/cloudoperators/gree…
kengou Jan 9, 2025
c76613c
fix(controller) go fmt, fix imports
kengou Jan 9, 2025
9500d0d
fix(dex) failing tests
kengou Jan 10, 2025
e9fe394
feat(dex) shared networkstorage, rm events
kengou Jan 15, 2025
47e1cca
fix(dex) use clienutil instead of osext
kengou Jan 16, 2025
2c0feb7
feat(idproxy): use struct in idproxy as input
kengou Jan 16, 2025
1605920
feat(dex): add mock for dex Storage
kengou Jan 16, 2025
f56f4d9
Automatic application of license header
Jan 16, 2025
5078f0e
(chore): removes unused vars
abhijith-darshan Jan 16, 2025
7caec01
(chore): spin up postgres test container for organization test
abhijith-darshan Jan 16, 2025
74f0bb4
(chore): tidy up!
abhijith-darshan Jan 16, 2025
6c9e6f6
(chore): go fmt
abhijith-darshan Jan 16, 2025
18791f5
(chore): lint fix
abhijith-darshan Jan 16, 2025
812c804
Merge branch 'main' into feat/dex-sql
abhijith-darshan Jan 16, 2025
d3c5cce
feat(ci) add flags, featureflag to deployments
kengou Jan 29, 2025
290bca1
fix(ci) rm license header frmo mockery generated code
kengou Jan 29, 2025
1096082
add licenserc to skip mockery
kengou Jan 29, 2025
59702e1
feat(idproxy) add featureflag to switch backend
kengou Jan 29, 2025
5356ec9
lint licenserc.yaml
kengou Jan 29, 2025
7476913
fix(dex) only create when ErrNotFound is the error during fetch
kengou Jan 30, 2025
42393b6
fix(feature) increase PollingInterval
kengou Jan 30, 2025
4baeee0
fix(idproxy) add comments to the code
kengou Jan 30, 2025
bfadac0
Merge branch 'main' into feat/dex-sql
kengou Jan 30, 2025
4af3b6f
Automatic application of license header
Jan 30, 2025
69449bb
(chore): move to dex pkg
abhijith-darshan Jan 31, 2025
3e496e7
(chore): adds GetEnv with error return
abhijith-darshan Jan 31, 2025
6f786df
(chore): adds feature resolver
abhijith-darshan Jan 31, 2025
c9aa70d
(chore): adds generic helper to return ptr types
abhijith-darshan Jan 31, 2025
366832e
(chore): adds dex storage resolver to idproxy
abhijith-darshan Jan 31, 2025
df1b96a
(chore): adds license headers
abhijith-darshan Jan 31, 2025
3f3e4fd
(chore): resolve feature flags from configmap
abhijith-darshan Jan 31, 2025
13e0fed
(chore): adds dex storage adapter interface
abhijith-darshan Jan 31, 2025
cf7b2d8
(chore): adds dex postgres storage adapter
abhijith-darshan Jan 31, 2025
41cf6ff
(chore): adds dex kubernetes storage adapter
abhijith-darshan Jan 31, 2025
76bfbae
(chore): adds dex storage adapter interface mocks
abhijith-darshan Jan 31, 2025
91759fc
(chore): adds dex storage adapter interface to reconciler
abhijith-darshan Jan 31, 2025
e4ba7b2
(chore): creates dex resources in organization namespace
abhijith-darshan Jan 31, 2025
d4b72df
(chore): setup dex storage adapter interface on operator start
abhijith-darshan Jan 31, 2025
6d86ff7
(chore): setup dex storage adapter interface on idproxy start
abhijith-darshan Jan 31, 2025
a3f1211
(chore): mock dex storage interface in unit tests
abhijith-darshan Jan 31, 2025
6e0541c
Merge branch 'feat/dex_storage' into feat/dex-sql
abhijith-darshan Jan 31, 2025
5382565
(chore): adds inline code comments
abhijith-darshan Jan 31, 2025
b3857ff
Automatic application of license header
Jan 31, 2025
4a9fdcb
(chore): use create update for writing oauth2client secrets
abhijith-darshan Feb 1, 2025
faba477
(chore): adds docs to run dex locally
abhijith-darshan Feb 1, 2025
43a284b
(chore): auto determine kubernetes
abhijith-darshan Feb 5, 2025
cdc76eb
(chore): uses org name as dex resource namespace
abhijith-darshan Feb 5, 2025
726dc2f
(chore): regenerate dexter mocks
abhijith-darshan Feb 5, 2025
55e946c
Merge branch 'main' into feat/dex-sql
abhijith-darshan Feb 5, 2025
7ec3a48
Merge branch 'main' into feat/dex-sql
abhijith-darshan Feb 7, 2025
6c87911
feat(dex): add postgresql helm chart to greenhouse, idproxy, manager …
kengou Feb 11, 2025
adf07c4
fix(charts): rm .gitignore from idproxy chart
kengou Feb 11, 2025
7d75177
fix fmt
kengou Feb 11, 2025
cfe3fbb
fix(charts): helm lint, update umbrellachart versions
kengou Feb 11, 2025
aa24488
Apply suggestions from code review
abhijith-darshan Feb 13, 2025
0146401
Apply suggestions from code review
abhijith-darshan Feb 13, 2025
e782dda
(chore): uses descriptive var names and const
abhijith-darshan Feb 13, 2025
2e343e6
(chore): remove mutex and use k8s ptr.To
abhijith-darshan Feb 13, 2025
153bdcd
(chore): inline homeDir usage
abhijith-darshan Feb 13, 2025
2565083
(chore): uses descriptive var names and const
abhijith-darshan Feb 13, 2025
d05bc49
(chore): adds logging
abhijith-darshan Feb 13, 2025
b107ded
Merge branch 'main' into feat/dex-sql
abhijith-darshan Feb 13, 2025
e7fa9aa
(chore): adds common redirect uri logic
abhijith-darshan Feb 13, 2025
a30ae0b
(chore): features as struct methods
abhijith-darshan Feb 13, 2025
727be1e
(chore): adds inline comments
abhijith-darshan Feb 13, 2025
02f09ba
(chore): use k8s ptr.To
abhijith-darshan Feb 13, 2025
e9a3203
(chore): fix lints
abhijith-darshan Feb 13, 2025
b3ec876
fix(postgres-ng) make chart working
kengou Feb 13, 2025
670c7b0
Merge branch 'feat/dex-sql' of https://github.com/cloudoperators/gree…
kengou Feb 13, 2025
3ed7b18
bump umbrella chart version
kengou Feb 13, 2025
6b86e16
(chore): simplifies dex storage usage
abhijith-darshan Feb 13, 2025
608c4c8
(chore): initialize dex backend for organization reconciler
abhijith-darshan Feb 13, 2025
2a86e58
(chore): regenerate mocks
abhijith-darshan Feb 13, 2025
962106c
(chore): refactors dex reconciliation
abhijith-darshan Feb 13, 2025
abbe59f
(chore): add go docs
abhijith-darshan Feb 13, 2025
2a89556
(chore): update org test suite
abhijith-darshan Feb 13, 2025
085d567
(chore): adds new conditions for appending redirects to default conne…
abhijith-darshan Feb 13, 2025
29fe086
(chore): uses simplified dex storage initialization
abhijith-darshan Feb 13, 2025
dc82fb5
(chore): adds .dockerignore
abhijith-darshan Feb 13, 2025
d1e5fbf
(chore): removes unused vars
abhijith-darshan Feb 13, 2025
dba8cf6
Automatic generation of CRD API Docs
cloud-operator Feb 13, 2025
09be246
(chore): fixes out of bounds issue for postgres port
abhijith-darshan Feb 13, 2025
06bae36
(chore): provide dex values for e2e
abhijith-darshan Feb 13, 2025
e06e445
(chore): allow dex api to create CRDs in local and e2e cluster
abhijith-darshan Feb 13, 2025
46ca51e
Merge branch 'main' into feat/dex-sql
abhijith-darshan Feb 13, 2025
0662211
(chore): uses postgres testcontainers for integration tests
abhijith-darshan Feb 13, 2025
aaa9a56
(chore): increase timeout for plugin preset test
abhijith-darshan Feb 14, 2025
6ec8254
(chore): go fmt!
abhijith-darshan Feb 14, 2025
30f1131
(chore): uses dex k8s backend for integration test
abhijith-darshan Feb 17, 2025
1f17721
(chore): uses global const
abhijith-darshan Feb 17, 2025
2d8c9b6
(chore): increase timeout on cluster delete
abhijith-darshan Feb 17, 2025
eca6f2d
(chore): removes timeout on preset test
abhijith-darshan Feb 17, 2025
b280812
Merge branch 'main' into feat/dex-sql
abhijith-darshan Feb 17, 2025
a88e378
Merge branch 'main' into feat/dex-sql
abhijith-darshan Feb 17, 2025
b1c608b
remove postgresng tableowner from root
kengou Feb 17, 2025
8737d1d
Merge branch 'main' into feat/dex-sql
kengou Feb 17, 2025
7cb0aa0
disable validation for kubernetes backend and postgres
kengou Feb 18, 2025
8237ce5
rename variable to avoid failing lint
kengou Feb 18, 2025
44de225
Merge branch 'main' into feat/dex-sql
abhijith-darshan Feb 18, 2025
01d7e8d
(chore): removes explicit timeouts in tests
abhijith-darshan Feb 18, 2025
c472e8a
use alias for chart to fix lint
kengou Feb 18, 2025
1371167
Merge branch 'feat/dex-sql' of https://github.com/cloudoperators/gree…
kengou Feb 18, 2025
f360f9c
(chore): enable owner ref on dex resources
abhijith-darshan Feb 19, 2025
0a3c2f4
(chore): handle deletion of org and dex resources
abhijith-darshan Feb 19, 2025
d0ab9e9
(chore): add tests for dex resources
abhijith-darshan Feb 19, 2025
ef5de60
Merge branch 'main' into feat/dex-sql
abhijith-darshan Feb 19, 2025
4a9012a
Merge branch 'main' into feat/dex-sql
abhijith-darshan Feb 19, 2025
8befc6c
bump chart version
kengou Feb 19, 2025
f4a2537
Merge branch 'main' into feat/dex-sql
abhijith-darshan Feb 24, 2025
364c3ff
(chore): rebuild chart dependencies
abhijith-darshan Feb 24, 2025
da3e6eb
(chore): bump chart version
abhijith-darshan Feb 24, 2025
0e52eeb
(chore): update docs
abhijith-darshan Feb 24, 2025
50a8f9c
(chore): adds connector and client deletion
abhijith-darshan Feb 24, 2025
8d259a9
(chore): remove unused org condition type
abhijith-darshan Feb 24, 2025
faec442
(chore): regenerate manifests
abhijith-darshan Feb 24, 2025
104e5e8
(chore): org deletion test
abhijith-darshan Feb 24, 2025
94cbbd1
Automatic generation of CRD API Docs
cloud-operator Feb 24, 2025
37cb154
(chore): removes unused finalizer const
abhijith-darshan Feb 24, 2025
21c7bd1
(chore): updates organization deletion phase and tests
abhijith-darshan Feb 25, 2025
f23d3fc
(chore): fixes lint errors
abhijith-darshan Feb 25, 2025
0975842
(chore): fixes org test
abhijith-darshan Feb 25, 2025
f242014
Merge branch 'main' into feat/dex-sql
kengou Feb 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(dex) only create when ErrNotFound is the error during fetch
kengou committed Jan 30, 2025
commit 74769139e21c0d971151210773dadd82d57324b3
10 changes: 8 additions & 2 deletions pkg/controllers/organization/dex.go
Original file line number Diff line number Diff line change
@@ -92,7 +92,7 @@ func (r *OrganizationReconciler) reconcileDexConnector(ctx context.Context, org

// Create the connectors also in SQL storage
var oidcConnector storage.Connector
if oidcConnector, err = r.dexStorage.GetConnector(org.Name); err != nil {
if oidcConnector, err = r.dexStorage.GetConnector(org.Name); err != nil && errors.Is(err, storage.ErrNotFound) {
if err = r.dexStorage.CreateConnector(ctx, storage.Connector{
ID: org.Name,
Type: dexConnectorTypeGreenhouse,
@@ -103,6 +103,9 @@ func (r *OrganizationReconciler) reconcileDexConnector(ctx context.Context, org
}
log.FromContext(ctx).Info("created dex connector in SQL storage", "name", org.Name)
}
if err != nil {
log.FromContext(ctx).Error(err, "failed to get dex connector in SQL storage", "name", org.Name)
}
if err = r.dexStorage.UpdateConnector(oidcConnector.ID, func(c storage.Connector) (storage.Connector, error) {
c.ID = org.Name
c.Type = dexConnectorTypeGreenhouse
@@ -146,7 +149,7 @@ func (r *OrganizationReconciler) discoverOIDCRedirectURL(ctx context.Context, or
func (r *OrganizationReconciler) reconcileOAuth2Client(ctx context.Context, org *greenhousesapv1alpha1.Organization) error {
var oAuthClient storage.Client
var err error
if oAuthClient, err = r.dexStorage.GetClient(org.Name); err != nil {
if oAuthClient, err = r.dexStorage.GetClient(org.Name); err != nil && errors.Is(err, storage.ErrNotFound) {
if err = r.dexStorage.CreateClient(ctx, storage.Client{
Public: true,
ID: org.Name,
@@ -161,6 +164,9 @@ func (r *OrganizationReconciler) reconcileOAuth2Client(ctx context.Context, org
log.FromContext(ctx).Info("created oauth2client", "name", org.Name)
return nil
}
if err != nil {
log.FromContext(ctx).Error(err, "failed to get oauth2client", "name", org.Name)
}

if err = r.dexStorage.UpdateClient(oAuthClient.Name, func(authClient storage.Client) (storage.Client, error) {
authClient.Public = true