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: Headless Argo CD (aka GitOps Agent) #6361

Merged
merged 4 commits into from
Jul 21, 2021

Conversation

alexmt
Copy link
Collaborator

@alexmt alexmt commented May 29, 2021

Signed-off-by: Alexander Matyushentsev AMatyushentsev@gmail.com

Summary

PR makes it possible to use argocd CLI commands in a headless mode with Kubectl access only and without Argo CD API server using --headless flag. So it is possible to run argocd app list --headless without logging to Argo CD assuming that current kubecontext points argocd namespace.

The second commit of the PR adds argocd admin dashboard command that starts Argo CD UI locally.

Why?

This change enables two use cases.

  1. Argo CD admins have full access to Argo CD settings either way but still have to set up an admin account to manage settings. Instead, we can suggest using argocd --headess CLI to manage all Argo CD settings using only Kubectl access.

  2. Argo CD provides awesome features like SSO, RBAC for multi-tenant environments. At the same time, some users who don't need multi-tenancy view these features as a disadvantage and consider Argo CD too heavyweight. That is not correct because of Argo CD UI/API/SSO part is totally optional. Using the argocd --headless flag we can offer Headless Argo CD that consists only of the backend (controller + repo-server).

Long story short:

kubectl create ns argocd
kubectl apply -k ./manifests/base/config
kubectl apply -k ./manifests/crds
kubectl apply -k ./manifests/base/application-controller -n argocd
kubectl apply -k ./manifests/base/redis -n argocd
kubectl apply -k ./manifests/base/repo-server  -n argocd
# done!
argocd login --headless
argocd app create guestbook --repo https://github.com/argoproj/argocd-example-apps --path guestbook --dest-name in-cluster --dest-namespace default --project default

@alexmt alexmt requested review from jannfis and sbose78 May 29, 2021 01:16
@alexmt alexmt force-pushed the headless-argo-cd branch 2 times, most recently from a1ca270 to 09be7ae Compare May 29, 2021 02:04
@alexmt alexmt requested review from jessesuen and jgwest May 29, 2021 02:09
@codecov
Copy link

codecov bot commented May 29, 2021

Codecov Report

Merging #6361 (7a75ac1) into master (b627435) will decrease coverage by 0.10%.
The diff coverage is 8.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6361      +/-   ##
==========================================
- Coverage   41.00%   40.90%   -0.11%     
==========================================
  Files         156      157       +1     
  Lines       20872    20921      +49     
==========================================
- Hits         8558     8557       -1     
- Misses      11101    11151      +50     
  Partials     1213     1213              
Impacted Files Coverage Δ
cmd/argocd-util/commands/app.go 31.30% <0.00%> (ø)
cmd/argocd-util/commands/cluster.go 0.00% <0.00%> (ø)
cmd/argocd/commands/admin.go 0.00% <0.00%> (ø)
cmd/argocd/commands/login.go 2.31% <0.00%> (-0.12%) ⬇️
cmd/argocd/commands/root.go 2.08% <0.00%> (-0.10%) ⬇️
util/kube/portforwarder.go 0.00% <0.00%> (ø)
util/localconfig/localconfig.go 3.09% <ø> (ø)
server/server.go 53.57% <18.60%> (-1.39%) ⬇️
util/settings/settings.go 47.77% <60.00%> (+0.40%) ⬆️
util/helm/cmd.go 29.87% <0.00%> (-0.37%) ⬇️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b627435...7a75ac1. Read the comment docs.

@alexmt alexmt force-pushed the headless-argo-cd branch 7 times, most recently from 35c774c to 37f45c2 Compare June 1, 2021 04:03
@alexmt alexmt changed the title feat: expose client side commands in argocd-util feat: Headless Argo CD (aka GitOps Agent) Jun 2, 2021
@alexmt alexmt force-pushed the headless-argo-cd branch 7 times, most recently from 2c85bc4 to 1f15182 Compare June 29, 2021 22:33
@alexmt alexmt added this to the v2.1 milestone Jul 2, 2021
@alexmt alexmt self-assigned this Jul 2, 2021
@alexmt alexmt force-pushed the headless-argo-cd branch 2 times, most recently from 2904b39 to bc61f6e Compare July 14, 2021 16:24
@@ -45,16 +45,26 @@ func NewLoginCommand(globalClientOpts *argocdclient.ClientOptions) *cobra.Comman
Use: "login SERVER",
Short: "Log in to Argo CD",
Long: "Log in to Argo CD",
Example: `# Login to Argo CD using a username and password
argo login cd.argoproj.io
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be argocd login instead of argo login?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good catch. Thank you! fixed

Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
}

if len(pods.Items) > 0 {
pod = &pods.Items[0]
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to break out of this for loop once we found a pod?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

thank you! fixed

Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
Copy link
Contributor

@mayzhang2000 mayzhang2000 left a comment

Choose a reason for hiding this comment

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

LGTM

@alexmt alexmt merged commit 561452a into argoproj:master Jul 21, 2021
@alexmt alexmt deleted the headless-argo-cd branch July 21, 2021 04:51
@alexmt alexmt added the needs-verification PR requires pre-release verification label Jul 28, 2021
@alexmt alexmt removed the needs-verification PR requires pre-release verification label Aug 12, 2021
@mauricio-sardinas
Copy link

The documentation shows the use of /shared/app folder for custom styles, which is being defined with the staticassets flag. If this is not the correct approach what are the alternatives for custom-styling?

https://argoproj.github.io/argo-cd/operator-manual/custom-styles/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants