Skip to content

Commit

Permalink
feat(hydrator): write credentials handling + UI
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

WIP: add new APIs for write creds

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

write api and template api

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

fix time function

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

fix lint issues

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

don't enrich with read creds

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

revert tls change

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

don't disable buttons in UI

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
  • Loading branch information
crenshaw-dev committed Nov 4, 2024
1 parent 426dc26 commit 4621d30
Show file tree
Hide file tree
Showing 35 changed files with 3,916 additions and 464 deletions.
498 changes: 498 additions & 0 deletions assets/swagger.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions controller/hydrator/hydrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type Dependencies interface {
GetProcessableAppProj(app *appv1.Application) (*appv1.AppProject, error)
GetProcessableApps() (*appv1.ApplicationList, error)
GetRepoObjs(app *appv1.Application, source appv1.ApplicationSource, revision string, project *appv1.AppProject) ([]*unstructured.Unstructured, *apiclient.ManifestResponse, error)
GetWriteCredentials(ctx context.Context, repoURL string) (*appv1.Repository, error)
GetWriteCredentials(ctx context.Context, repoURL string, project string) (*appv1.Repository, error)
ResolveGitRevision(repoURL, targetRevision string) (string, error)
RequestAppRefresh(appName string)
// TODO: only allow access to the hydrator status
Expand Down Expand Up @@ -288,7 +288,8 @@ func (h *Hydrator) hydrate(logCtx *log.Entry, apps []*appv1.Application, revisio
})
}

repo, err := h.dependencies.GetWriteCredentials(context.Background(), repoURL)
// FIXME: handle project-scoped credentials
repo, err := h.dependencies.GetWriteCredentials(context.Background(), repoURL, "")
if err != nil {
return "", fmt.Errorf("failed to get hydrator credentials: %w", err)
}
Expand Down
4 changes: 2 additions & 2 deletions controller/hydrator_dependencies.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ func (ctrl *ApplicationController) GetRepoObjs(app *appv1.Application, source ap
return objs, resp[0], nil
}

func (ctrl *ApplicationController) GetWriteCredentials(ctx context.Context, repoURL string) (*appv1.Repository, error) {
return ctrl.db.GetWriteCredentials(ctx, repoURL)
func (ctrl *ApplicationController) GetWriteCredentials(ctx context.Context, repoURL string, project string) (*appv1.Repository, error) {
return ctrl.db.GetWriteRepository(ctx, repoURL, project)
}

func (ctrl *ApplicationController) ResolveGitRevision(repoURL, targetRevision string) (string, error) {
Expand Down
4 changes: 2 additions & 2 deletions controller/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ func (m *appStateManager) CompareAppState(app *v1alpha1.Application, project *v1
if hasMultipleSources {
return &comparisonResult{
syncStatus: &v1alpha1.SyncStatus{
ComparedTo: v1alpha1.ComparedTo{Destination: app.Spec.Destination, Sources: sources, IgnoreDifferences: app.Spec.IgnoreDifferences},
ComparedTo: app.Spec.BuildComparedToStatus(),
Status: v1alpha1.SyncStatusCodeUnknown,
Revisions: revisions,
},
Expand All @@ -491,7 +491,7 @@ func (m *appStateManager) CompareAppState(app *v1alpha1.Application, project *v1
} else {
return &comparisonResult{
syncStatus: &v1alpha1.SyncStatus{
ComparedTo: v1alpha1.ComparedTo{Source: sources[0], Destination: app.Spec.Destination, IgnoreDifferences: app.Spec.IgnoreDifferences},
ComparedTo: app.Spec.BuildComparedToStatus(),
Status: v1alpha1.SyncStatusCodeUnknown,
Revision: revisions[0],
},
Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide/commands/argocd_account_can-i.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

221 changes: 189 additions & 32 deletions pkg/apiclient/repocreds/repocreds.pb.go

Large diffs are not rendered by default.

Loading

0 comments on commit 4621d30

Please sign in to comment.