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(hydrator): write credentials handling + UI #20166

Draft
wants to merge 1 commit into
base: hydrator-controller-changes
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
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 @@ -284,7 +284,8 @@ func (h *Hydrator) hydrate(apps []*appv1.Application, revision string) (string,
})
}

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 @@ -51,8 +51,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 @@ -480,7 +480,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 @@ -489,7 +489,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.

209 changes: 208 additions & 1 deletion manifests/core-install-with-hydrator.yaml

Large diffs are not rendered by default.

214 changes: 213 additions & 1 deletion manifests/ha/install-with-hydrator.yaml

Large diffs are not rendered by default.

48 changes: 48 additions & 0 deletions manifests/ha/namespace-install-with-hydrator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1664,6 +1664,12 @@ spec:
key: applicationsetcontroller.enable.progressive.syncs
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_APPLICATIONSET_CONTROLLER_TOKENREF_STRICT_MODE
valueFrom:
configMapKeyRef:
key: applicationsetcontroller.enable.tokenref.strict.mode
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_APPLICATIONSET_CONTROLLER_ENABLE_NEW_GIT_FILE_GLOBBING
valueFrom:
configMapKeyRef:
Expand Down Expand Up @@ -1724,6 +1730,12 @@ spec:
key: applicationsetcontroller.webhook.parallelism.limit
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_APPLICATIONSET_CONTROLLER_REQUEUE_AFTER
valueFrom:
configMapKeyRef:
key: applicationsetcontroller.requeue.after
name: argocd-cmd-params-cm
optional: true
image: quay.io/argoproj/argocd:latest
imagePullPolicy: Always
name: argocd-applicationset-controller
Expand Down Expand Up @@ -1754,6 +1766,8 @@ spec:
name: tmp
- mountPath: /app/config/reposerver/tls
name: argocd-repo-server-tls
nodeSelector:
kubernetes.io/os: linux
serviceAccountName: argocd-applicationset-controller
volumes:
- configMap:
Expand Down Expand Up @@ -2036,6 +2050,8 @@ spec:
name: static-files
- mountPath: /tmp
name: dexconfig
nodeSelector:
kubernetes.io/os: linux
serviceAccountName: argocd-dex-server
volumes:
- emptyDir: {}
Expand Down Expand Up @@ -2125,6 +2141,8 @@ spec:
- mountPath: /app/config/reposerver/tls
name: argocd-repo-server-tls
workingDir: /app
nodeSelector:
kubernetes.io/os: linux
securityContext:
runAsNonRoot: true
seccompProfile:
Expand Down Expand Up @@ -2435,6 +2453,12 @@ spec:
key: reposerver.plugin.tar.exclusions
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_REPO_SERVER_PLUGIN_USE_MANIFEST_GENERATE_PATHS
valueFrom:
configMapKeyRef:
key: reposerver.plugin.use.manifest.generate.paths
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_REPO_SERVER_ALLOW_OUT_OF_BOUNDS_SYMLINKS
valueFrom:
configMapKeyRef:
Expand Down Expand Up @@ -2573,6 +2597,8 @@ spec:
volumeMounts:
- mountPath: /var/run/argocd
name: var-files
nodeSelector:
kubernetes.io/os: linux
serviceAccountName: argocd-repo-server
volumes:
- configMap:
Expand Down Expand Up @@ -2956,6 +2982,8 @@ spec:
name: tmp
- mountPath: /home/argocd/params
name: argocd-cmd-params-cm
nodeSelector:
kubernetes.io/os: linux
serviceAccountName: argocd-server
volumes:
- emptyDir: {}
Expand Down Expand Up @@ -3113,6 +3141,24 @@ spec:
key: controller.self.heal.timeout.seconds
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_APPLICATION_CONTROLLER_SELF_HEAL_BACKOFF_TIMEOUT_SECONDS
valueFrom:
configMapKeyRef:
key: controller.self.heal.backoff.timeout.seconds
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_APPLICATION_CONTROLLER_SELF_HEAL_BACKOFF_FACTOR
valueFrom:
configMapKeyRef:
key: controller.self.heal.backoff.factor
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_APPLICATION_CONTROLLER_SELF_HEAL_BACKOFF_CAP_SECONDS
valueFrom:
configMapKeyRef:
key: controller.self.heal.backoff.cap.seconds
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_APPLICATION_CONTROLLER_REPO_SERVER_PLAINTEXT
valueFrom:
configMapKeyRef:
Expand Down Expand Up @@ -3255,6 +3301,8 @@ spec:
- mountPath: /home/argocd/params
name: argocd-cmd-params-cm
workingDir: /home/argocd
nodeSelector:
kubernetes.io/os: linux
serviceAccountName: argocd-application-controller
volumes:
- emptyDir: {}
Expand Down
50 changes: 50 additions & 0 deletions manifests/install-with-hydrator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,12 @@ spec:
key: applicationsetcontroller.enable.progressive.syncs
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_APPLICATIONSET_CONTROLLER_TOKENREF_STRICT_MODE
valueFrom:
configMapKeyRef:
key: applicationsetcontroller.enable.tokenref.strict.mode
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_APPLICATIONSET_CONTROLLER_ENABLE_NEW_GIT_FILE_GLOBBING
valueFrom:
configMapKeyRef:
Expand Down Expand Up @@ -841,6 +847,12 @@ spec:
key: applicationsetcontroller.webhook.parallelism.limit
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_APPLICATIONSET_CONTROLLER_REQUEUE_AFTER
valueFrom:
configMapKeyRef:
key: applicationsetcontroller.requeue.after
name: argocd-cmd-params-cm
optional: true
image: quay.io/argoproj/argocd:latest
imagePullPolicy: Always
name: argocd-applicationset-controller
Expand Down Expand Up @@ -871,6 +883,8 @@ spec:
name: tmp
- mountPath: /app/config/reposerver/tls
name: argocd-repo-server-tls
nodeSelector:
kubernetes.io/os: linux
serviceAccountName: argocd-applicationset-controller
volumes:
- configMap:
Expand Down Expand Up @@ -1153,6 +1167,8 @@ spec:
name: static-files
- mountPath: /tmp
name: dexconfig
nodeSelector:
kubernetes.io/os: linux
serviceAccountName: argocd-dex-server
volumes:
- emptyDir: {}
Expand Down Expand Up @@ -1242,6 +1258,8 @@ spec:
- mountPath: /app/config/reposerver/tls
name: argocd-repo-server-tls
workingDir: /app
nodeSelector:
kubernetes.io/os: linux
securityContext:
runAsNonRoot: true
seccompProfile:
Expand Down Expand Up @@ -1336,6 +1354,8 @@ spec:
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
nodeSelector:
kubernetes.io/os: linux
securityContext:
runAsNonRoot: true
runAsUser: 999
Expand Down Expand Up @@ -1505,6 +1525,12 @@ spec:
key: reposerver.plugin.tar.exclusions
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_REPO_SERVER_PLUGIN_USE_MANIFEST_GENERATE_PATHS
valueFrom:
configMapKeyRef:
key: reposerver.plugin.use.manifest.generate.paths
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_REPO_SERVER_ALLOW_OUT_OF_BOUNDS_SYMLINKS
valueFrom:
configMapKeyRef:
Expand Down Expand Up @@ -1643,6 +1669,8 @@ spec:
volumeMounts:
- mountPath: /var/run/argocd
name: var-files
nodeSelector:
kubernetes.io/os: linux
serviceAccountName: argocd-repo-server
volumes:
- configMap:
Expand Down Expand Up @@ -2024,6 +2052,8 @@ spec:
name: tmp
- mountPath: /home/argocd/params
name: argocd-cmd-params-cm
nodeSelector:
kubernetes.io/os: linux
serviceAccountName: argocd-server
volumes:
- emptyDir: {}
Expand Down Expand Up @@ -2181,6 +2211,24 @@ spec:
key: controller.self.heal.timeout.seconds
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_APPLICATION_CONTROLLER_SELF_HEAL_BACKOFF_TIMEOUT_SECONDS
valueFrom:
configMapKeyRef:
key: controller.self.heal.backoff.timeout.seconds
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_APPLICATION_CONTROLLER_SELF_HEAL_BACKOFF_FACTOR
valueFrom:
configMapKeyRef:
key: controller.self.heal.backoff.factor
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_APPLICATION_CONTROLLER_SELF_HEAL_BACKOFF_CAP_SECONDS
valueFrom:
configMapKeyRef:
key: controller.self.heal.backoff.cap.seconds
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_APPLICATION_CONTROLLER_REPO_SERVER_PLAINTEXT
valueFrom:
configMapKeyRef:
Expand Down Expand Up @@ -2323,6 +2371,8 @@ spec:
- mountPath: /home/argocd/params
name: argocd-cmd-params-cm
workingDir: /home/argocd
nodeSelector:
kubernetes.io/os: linux
serviceAccountName: argocd-application-controller
volumes:
- emptyDir: {}
Expand Down
Loading
Loading