Compare commits

...

2496 Commits

Author SHA1 Message Date
Ryan
69d23e105e docs: Clarifying override RBAC needs (#16964)
Signed-off-by: Ryan Shatford <ryan@shatford.com>
Signed-off-by: Dan Garfield <dan@codefresh.io>
Co-authored-by: Ryan Shatford <ryan@shatford.com>
Co-authored-by: Dan Garfield <dan@codefresh.io>
2025-06-13 16:17:40 -04:00
Kostis (Codefresh)
2d963ab8d0 docs: Cluster overview page (#11637)
* docs: Cluster overview page

Signed-off-by: Kostis Kapelonis <kostis@codefresh.io>

* docs: finished with text

Signed-off-by: Kostis Kapelonis <kostis@codefresh.io>

* docs: pictures for cluster section

Signed-off-by: Kostis Kapelonis <kostis@codefresh.io>

* docs: Apply suggestions from code review

Co-authored-by: Dan Garfield <dan@codefresh.io>
Co-authored-by: Blake Pettersson <blake.pettersson@gmail.com>
Signed-off-by: Kostis (Codefresh) <39800303+kostis-codefresh@users.noreply.github.com>

* docs: optimized images

Signed-off-by: Kostis Kapelonis <kostis@codefresh.io>

Signed-off-by: Kostis Kapelonis <kostis@codefresh.io>
Signed-off-by: Kostis (Codefresh) <39800303+kostis-codefresh@users.noreply.github.com>
Co-authored-by: Dan Garfield <dan@codefresh.io>
Co-authored-by: Blake Pettersson <blake.pettersson@gmail.com>
2022-12-22 13:30:45 -05:00
Kostis (Codefresh)
7a3cd61060 docs: refreshed page for sync windows (#9770)
Signed-off-by: Kostis Kapelonis <kostis@codefresh.io>
2022-06-28 10:50:33 -04:00
Kostis (Codefresh)
5cbb397c93 docs: sync hooks and waves (#9552)
* docs: sync hooks and waves

Signed-off-by: Kostis Kapelonis <kostis@codefresh.io>

* docs: review comments

Signed-off-by: Kostis Kapelonis <kostis@codefresh.io>

* docs: spelling mistakes

Signed-off-by: Kostis Kapelonis <kostis@codefresh.io>
2022-06-12 21:31:46 +02:00
Kostis (Codefresh)
5257a902fb docs: first steps (#8732)
* docs: first steps

Signed-off-by: Kostis Kapelonis <kostis@codefresh.io>

* docs: Apply suggestions from code review

Signed-off-by: Kostis Kapelonis kostis@codefresh.io

Co-authored-by: jannfis <jann@mistrust.net>
Signed-off-by: Kostis Kapelonis <kostis@codefresh.io>

* docs: extra comments from code review

Signed-off-by: Kostis Kapelonis <kostis@codefresh.io>

* docs: minor spelling mistake

Signed-off-by: Kostis Kapelonis <kostis@codefresh.io>

Co-authored-by: jannfis <jann@mistrust.net>
2022-03-11 11:06:15 +01:00
Kostis (Codefresh)
4c6a74642f docs: Cli windows installation (#8589)
* docs: more installation options

Signed-off-by: Kostis Kapelonis <kostis@codefresh.io>

* docs: cli windows install

Signed-off-by: Kostis Kapelonis <kostis@codefresh.io>

* docs: fixed broken link

Signed-off-by: Kostis Kapelonis <kostis@codefresh.io>

* docs: Apply suggestions from code review

Co-authored-by: jannfis <jann@mistrust.net>

Co-authored-by: jannfis <jann@mistrust.net>
2022-02-22 17:35:11 +01:00
Kostis (Codefresh)
ab715efd2b docs: First page for new documentation (#8507)
* docs: first page

Signed-off-by: Kostis Kapelonis <kostis@codefresh.io>

* docs: first page with relative links

Signed-off-by: Kostis Kapelonis <kostis@codefresh.io>

* applied first round of suggestions

Co-authored-by: jannfis <jann@mistrust.net>

* docs: first page - second round of comments

Signed-off-by: Kostis Kapelonis <kostis@codefresh.io>

Co-authored-by: jannfis <jann@mistrust.net>
2022-02-16 13:11:47 +01:00
Kostis (Codefresh)
50a693e554 docs: Terminology page in the new documentation structure (#8456)
* docs: basic terminology

Signed-off-by: Kostis Kapelonis <kostis@codefresh.io>

* docs: finished terminology

Signed-off-by: Kostis Kapelonis <kostis@codefresh.io>

* docs: Apply suggestions from code review

Co-authored-by: jannfis <jann@mistrust.net>
Signed-off-by: Kostis Kapelonis <kostis@codefresh.io>

Co-authored-by: jannfis <jann@mistrust.net>
2022-02-10 19:20:13 +01:00
Fischer Jemison
8409da4df8 docs: add scaling docs (#6038)
Signed-off-by: Fischer Jemison <fjemison@newrelic.com>
2021-04-15 20:22:50 +02:00
J. Mark Pim
857ea0edfe docs: Two small typos/grammar fix (#5857)
Part of #5635

Signed-off-by: Mark Pim <j.mark.pim@gmail.com>
2021-03-25 08:19:07 +01:00
Fischer Jemison
068a7a6abc docs: fill in docs page for managing clusters (#5822)
Signed-off-by: Fischer Jemison <fjemison@newrelic.com>
2021-03-19 19:40:24 +01:00
jannfis
6c019b037b More moving things around
Signed-off-by: jannfis <jann@mistrust.net>
2021-02-28 20:25:43 +01:00
jannfis
b37bb53f5e Another fix of mkdocs configuration
Signed-off-by: jannfis <jann@mistrust.net>
2021-02-28 17:22:11 +01:00
jannfis
4251200f78 Fix overrides path
Signed-off-by: jannfis <jann@mistrust.net>
2021-02-28 17:20:05 +01:00
jannfis
b407d59fa5 Add docs/requirements.txt
Signed-off-by: jannfis <jann@mistrust.net>
2021-02-28 17:15:58 +01:00
jannfis
4f7aaf0d71 docs: Initial replacement of docs
Signed-off-by: jannfis <jann@mistrust.net>
2021-02-28 16:49:18 +01:00
jannfis
24b18a83a6 docs: Move security policy to SECURITY.md for integration with GitHub (#5627)
* docs: Move security policy to SECURITY.md for integration with GitHub

Signed-off-by: jannfis <jann@mistrust.net>

* Change wording a bit.

Signed-off-by: jannfis <jann@mistrust.net>

* Change order of e-mail addresses

Signed-off-by: jannfis <jann@mistrust.net>
2021-02-27 08:41:20 +01:00
Josh Soref
ba7054e808 fix: drop trailing ; (#5622) (#5623)
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2021-02-26 18:03:08 +01:00
Josh Soref
5660dbab96 fix: Say Go Version/Go Compiler in About (#5329) (#5624)
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2021-02-26 18:02:02 +01:00
May Zhang
0430725544 fixes: https://github.com/argoproj/argo-cd/issues/5611 (#5616)
Signed-off-by: May Zhang <may_zhang@intuit.com>
2021-02-26 08:31:38 -08:00
jannfis
e896c0e4b4 fix: Properly escape HTML for error message from CLI SSO (#5563)
Signed-off-by: jannfis <jann@mistrust.net>
2021-02-26 09:50:27 +01:00
Sureshkumaar09
3c12f20dc0 Update USERS.md (#5375) 2021-02-25 22:50:53 -08:00
Alexander Matyushentsev
ce50a9de21 fix: API server should not print resource body when resource update fails (#5617)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-02-25 19:24:40 -08:00
Alexander Matyushentsev
7433a996e4 fix: upgrade argo-ui version (fixes stuck logs viewer); properly retry loading logs if network connection broke (#5615)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-02-25 15:48:58 -08:00
kshamajain99
7ad79e5e12 fix: fix memory leak in application controller (#5604)
fix: fix memory leak in application controller
2021-02-25 08:57:54 -08:00
Shubham Agarwal
2a1a03a919 fix: updated retry var type from string to duration for app sync (#5583)
* refactor: fixed retry var type from string to duration for app sync

Signed-off-by: Shubham Agarwal <shubhamagarawal19@gmail.com>

* fix codegen error

Signed-off-by: Shubham Agarwal <shubhamagarawal19@gmail.com>

* updated upgrade doc 1.8 - 1.9

Signed-off-by: Shubham Agarwal <shubhamagarawal19@gmail.com>
2021-02-24 09:58:58 +01:00
Joseph Petersen
7ec8b266f8 chore: indent in kustomize deployment base (#5530)
Signed-off-by: Joseph Petersen <josephp90@gmail.com>
2021-02-22 18:33:11 +01:00
Mikhail Nacharov
f665a74e65 fix: return http400/405 to invalid webhook requests (#5565)
Fixes #5124

Signed-off-by: Mikhail Vladimirovich Nacharov <author@mnacharov.ru>

Co-authored-by: Mikhail Vladimirovich Nacharov <author@mnacharov.ru>
2021-02-20 19:51:12 +01:00
Alexander Matyushentsev
6e6cd1a1ef fix: show operation status if app is being deleted (#5561)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-02-19 14:36:12 -08:00
Alexander Matyushentsev
e1168fd1bf fix: 'argocd app wait --suspended' stuck if operation is in progress (#5511)
* fix: 'argocd app wait --suspended' stuck if operation is in progress

Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-02-19 14:34:11 -08:00
Slava Markeyev
13b9b92c99 feat: GitHub organization app for git cloning (#4348) (#5355)
* Git GitHub App auth

Signed-off-by: Slava Markeyev <slavamarkeyev@gmail.com>
2021-02-19 14:24:32 -08:00
May Zhang
594c827b66 fix: Update gitops-engine to get the fix for sync should apply Namesp… (#5556)
* fix: Update gitops-engine to get the fix for sync should apply Namespaces and CRDs before resources

Signed-off-by: May Zhang <may_zhang@intuit.com>

* fix: Update gitops-engine to get the fix for sync should apply Namespaces and CRDs before resources

Signed-off-by: May Zhang <may_zhang@intuit.com>
2021-02-18 17:02:14 -08:00
Remington Breeze
fbf0a780a0 fix(ui): Save current logs page to URL (#5541)
Signed-off-by: Remington Breeze <remington@breeze.software>
2021-02-18 16:10:07 -08:00
kshamajain99
6de3cf44a4 fix: support longer http cookie (#2917) (#5497)
* fix: support longer cookie

Signed-off-by: kshamajain99 <kshamajain99@gmail.com>
2021-02-18 12:26:01 -08:00
Kai Reichart
47529ee246 docs: updated metrics docs to correct selector on servicemonitor for repo-server (#5545)
* updated metrics docs to correct selector

Signed-off-by: Kai Reichart <kai@reichart.dev>

* docs: updated metrics docs to correct selector on servicemonitor for repo-server

Signed-off-by: Kai Reichart <kai@reichart.dev>
2021-02-18 08:24:53 -08:00
Jan Gräfen
a4ee25b59d docs: Add FAQ entry about sealed secret health checks (#5539)
* docs: FAQ entry for SealedSecret health updates

Since certain version combinations of ArgoCD and
the sealed-secret controller might lead to
SealedSecrets being stuck in the Progressing
state, this commit adds an explanation and
possible work-arounds to the FAQ.

Signed-off-by: Jan Graefen <223234+jangraefen@users.noreply.github.com>

* Fix review findings

Signed-off-by: Jan Gräfen <223234+jangraefen@users.noreply.github.com>

* Add missing letter

Signed-off-by: Jan Gräfen <223234+jangraefen@users.noreply.github.com>
2021-02-18 11:00:39 +01:00
Abhishek Veeramalla
b2b5b50b09 chore: Add k8s 1.20.2 to test-e2e strategy matrix in CI (#5542)
Signed-off-by: iam-veeramalla <abhishek.veeramalla@gmail.com>
2021-02-18 10:47:37 +01:00
Chetan Banavikalmutt
656bd51d55 feat: Clicking on filter bar should expand filter (#5488)
Fixes: #4790
Signed-off-by: Chetan Banavikalmutt <chetanrns1997@gmail.com>
2021-02-17 10:52:39 -08:00
Abhishek Veeramalla
73edc0a652 fix: Exclude kube-root-ca.crt ConfigMap from Orphaned Resources monitoring by default (#5490) (#5523)
Signed-off-by: iam-veeramalla <abhishek.veeramalla@gmail.com>
2021-02-17 11:25:21 +01:00
Abhishek Veeramalla
047d2e6c8e docs: correct the initialPasswordSecretName in docs (#5536)
Signed-off-by: iam-veeramalla <abhishek.veeramalla@gmail.com>
2021-02-17 10:43:20 +01:00
Shubham Agarwal
e33b54decb fix: do not display empty tool version fields for server (#5531)
Signed-off-by: Shubham Agarwal <shubhamagarawal19@gmail.com>
2021-02-17 09:30:53 +01:00
Masaya Ozawa
2be1b8771a docs: fix link (#5534)
Signed-off-by: m3y <ma3ya.ozw+github@gmail.com>
2021-02-17 08:52:40 +01:00
Remington Breeze
ad923ba0c8 fix(ui): improve spacing of app status panel (#5528)
Signed-off-by: Remington Breeze <remington@breeze.software>
2021-02-16 13:47:14 -08:00
Alexander Matyushentsev
f54d372440 docs: add CII badge to README.md (#5527)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-02-16 10:58:20 -08:00
Alexander Matyushentsev
6e2ee623f8 feat: support token revocation (#5477)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-02-16 10:33:40 -08:00
Alexander Matyushentsev
ac5cfb9a60 docs: Updates docs for CII. (#5526)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-02-16 19:20:47 +01:00
Jan Gräfen
d342993c3f fix: Declarative helm repositories with missing secret causes all repositories in ArgoCD to lock (#3492) (#5363)
* Add test for get repository credentials

Signed-off-by: Jan Graefen <223234+jangraefen@users.noreply.github.com>

* Log error on missing repository credentials

Signed-off-by: Jan Graefen <223234+jangraefen@users.noreply.github.com>

* Fix import formatting

Signed-off-by: Jan Graefen <223234+jangraefen@users.noreply.github.com>

* Use connection state instead of logging

Just logging the error will be a bad user
experience, since it provides no direct feedback
as before.

Signed-off-by: Jan Graefen <223234+jangraefen@users.noreply.github.com>

* Fix test to check for connection state

Signed-off-by: Jan Graefen <223234+jangraefen@users.noreply.github.com>

* Do not expose technical message directly

Instead of displaying a technical error message
that might expose critical information about the
cluster, we only display a generic error message.
The actual error is then logged to the server
logged, so that an administrator can further
drill down into the problem

Signed-off-by: Jan Graefen <223234+jangraefen@users.noreply.github.com>

* Adapt tests to new error message

Signed-off-by: Jan Graefen <223234+jangraefen@users.noreply.github.com>

* Retrigger CI pipeline

Signed-off-by: Jan Graefen <223234+jangraefen@users.noreply.github.com>

* See if I am actually the cause of this error

Signed-off-by: Jan Graefen <223234+jangraefen@users.noreply.github.com>

* Revert changes to evaluate CodeQL result

Signed-off-by: Jan Graefen <223234+jangraefen@users.noreply.github.com>

* Desperate attempt to find the cause of the CodeQL error

Signed-off-by: Jan Graefen <223234+jangraefen@users.noreply.github.com>

* Revert "Desperate attempt to find the cause of the CodeQL error"

This reverts commit a38ff650

Signed-off-by: Jan Graefen <223234+jangraefen@users.noreply.github.com>

* Fix first to review findings

Signed-off-by: Jan Graefen <223234+jangraefen@users.noreply.github.com>

* Propose a better function name and add docu

Signed-off-by: Jan Graefen <223234+jangraefen@users.noreply.github.com>

* Overwrite connection status for refresh as well

Signed-off-by: Jan Graefen <223234+jangraefen@users.noreply.github.com>

* Fix goimports lint issue

Signed-off-by: Jan Graefen <223234+jangraefen@users.noreply.github.com>
2021-02-16 07:38:06 +01:00
Jacob Wernette
fd03eccfc8 docs: Add IBM to users (#5521)
Signed-off-by: Jacob Wernette <werne2j@gmail.com>
2021-02-15 16:45:00 +01:00
Remington Breeze
824ff732a2 fix(ui): Crash when syncing from applications sync panel (#5508)
Signed-off-by: Remington Breeze <remington@breeze.software>
2021-02-12 10:55:49 -08:00
Jared Clarke
65ecd87027 feat: Add health checks for kubernetes-external-secrets (#5435)
Signed-off-by: Jared Clarke <jared.clarke@eckoh.com>
2021-02-12 09:45:42 +01:00
Ajay Kemparaj
f53cbd5d0e fix: add the missing rbac resources to the documentation (#5476)
* Adds resources accounts and gpgkeys

Signed-off-by: ajayk <ajaykemparaj@gmail.com>
2021-02-12 09:44:28 +01:00
Chetan Banavikalmutt
6a19451d0b feat: Add health check for Sealed Secrets (#5503)
This commit adds a lua script, which updates the health status of an application based on sealed secret's status

Fixes: #4754

Signed-off-by: Chetan Banavikalmutt <chetanrns1997@gmail.com>
2021-02-12 09:16:39 +01:00
Reed Palmer
11a42c3941 docs: Update USERS.md (#5498)
Add Recreation.gov to the list of users

Signed-off-by: Reed Palmer <reed.d.palmer@gmail.com>
2021-02-12 08:47:23 +01:00
Alexander Matyushentsev
3473005364 fix: remove duplicated code that sets 'container' query parameter (#5502)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-02-12 08:08:10 +01:00
Remington Breeze
aeeeac79fe fix(ui): Consolidate sync options (#5357)
Signed-off-by: Remington Breeze <remington@breeze.software>
2021-02-11 16:12:05 -08:00
jannfis
2d06b5077e chore: Make e2e tests work on K8s v1.20 (#5491)
* chore: Make e2e tests work on K8s v1.20

Signed-off-by: jannfis <jann@mistrust.net>

* Fix linter complaints

Signed-off-by: jannfis <jann@mistrust.net>
2021-02-11 12:00:36 -08:00
Viktor Farcic
29850811c7 docs: video (#5493)
* docs: PRs with Argo CD and Codefresh

Signed-off-by: Viktor Farcic <viktor@farcic.com>

* Video

Signed-off-by: Viktor Farcic <viktor@farcic.com>
2021-02-11 20:20:31 +01:00
Remington Breeze
4a06699a6a chore: Add reminder to PR template to link auto close issue (#5496) 2021-02-11 10:47:42 -08:00
Alexander Matyushentsev
e01703ba3a fix: refreshing label and orphaned resource filter are hidden by page header (#5495)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-02-11 10:25:32 -08:00
Remington Breeze
b7e6dcf085 fix(ui): Don't try to show helm metadata (#5494)
Signed-off-by: Remington Breeze <remington@breeze.software>
2021-02-11 09:22:04 -08:00
Alexander Matyushentsev
223335d96e feat: support viewing logs of multiple pods in UI (#5469)
* feat: support viewing logs of multiple pods in UI

Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-02-10 17:58:13 -08:00
Remington Breeze
fb8096a1f7 feat(ui): Status panel labels (#5458)
Signed-off-by: Remington Breeze <remington@breeze.software>
2021-02-09 18:09:17 -08:00
Victor Boissiere
e0f7731fee feat(prom): Add prometheus metrics reset support #5287 (#5304)
* feat(prom): Add prometheus metrics reset support

Signed-off-by: Victor Boissiere <victor.boissiere@gmail.com>
2021-02-09 17:27:08 -08:00
J. Mark Pim
c540b719cf chore: Remove usages of k8s.io/kubernetes (#4055) (#5434)
* chore:Remove usages of k8s.io/kubernetes

Signed-off-by: Mark Pim <j.mark.pim@gmail.com>

* Linting fix

Signed-off-by: Mark Pim <j.mark.pim@gmail.com>
2021-02-09 17:12:43 -08:00
Yujun Zhang
137ff39293 fix(cli): format appURL from server settings (#5333) (#5449)
* fix(cli): format appURL from server settings (#5333)

Signed-off-by: Yujun Zhang <yujunz@nvidia.com>

* fix(cli): fallback to client options if URL is not set

Signed-off-by: Yujun Zhang <yujunz@nvidia.com>
2021-02-09 17:01:22 -08:00
kshamajain99
1d1fbf0fb1 fix invalid external url (#5396)
Signed-off-by: kshamajain99 <kshamajain99@gmail.com>
2021-02-09 13:06:42 -08:00
Ishita Sequeira
366b7ff364 chore: dockerized *-docs Makefile commands - #4662 (#5459)
* feat: Dockerized *-docs Makefile commands

Signed-off-by: ishitasequeira <isequeir@redhat.com>

* removed the deprecated target(publish-docs) and added a local build and serve target

Signed-off-by: ishitasequeira <isequeir@redhat.com>
2021-02-09 18:27:22 +01:00
Sho Okada
e22da4a941 fix: Log output fails when JSON logging is enabled (#4911) (#5446)
Signed-off-by: Sho Okada <shokada3@gmail.com>
2021-02-08 16:06:18 -08:00
Alexander Matyushentsev
685f15b695 chore: github actions should use versions from docs/requirements.txt while building docs (#5460)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-02-08 22:57:55 +01:00
Alexander Matyushentsev
b8adbf0818 docs: replace https://argoproj.github.io/argo-cd/ with https://argo-cd.readthedocs.io/ (#5457)
* docs: replace https://argoproj.github.io/argo-cd/ with https://argo-cd.readthedocs.io/

Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-02-08 10:39:56 -08:00
Chetan Banavikalmutt
8eec7b360f fix: Update the UI link in e2e tests doc (#5447)
UI for the argocd e2e test server will be available on port 4000. This patch updates the link in e2e tests to use 4000 instead of 8080.

Signed-off-by: Chetan Banavikalmutt <chetanrns1997@gmail.com>
2021-02-08 09:58:26 -08:00
May Zhang
ae3de246fd feat: get pod logs (#5311)
* feat: get pod logs sequential

Signed-off-by: May Zhang <may_zhang@intuit.com>

* feat: check in the md file

Signed-off-by: May Zhang <may_zhang@intuit.com>

* feat: get pod logs

Signed-off-by: May Zhang <may_zhang@intuit.com>

* feat: fix conflicts

Signed-off-by: May Zhang <may_zhang@intuit.com>

* feat: fix lint error

Signed-off-by: May Zhang <may_zhang@intuit.com>

* feat: added timeout for test

Signed-off-by: May Zhang <may_zhang@intuit.com>

* feat: update doc

Signed-off-by: May Zhang <may_zhang@intuit.com>

* feat: update test

Signed-off-by: May Zhang <may_zhang@intuit.com>

* feat: add unit test

Signed-off-by: May Zhang <may_zhang@intuit.com>

* feat: add unit test

Signed-off-by: May Zhang <may_zhang@intuit.com>

* feat: fix merge conflict

Signed-off-by: May Zhang <may_zhang@intuit.com>

* feat: add e2e test

Signed-off-by: May Zhang <may_zhang@intuit.com>

* feat: clone query

Signed-off-by: May Zhang <may_zhang@intuit.com>

* feat: fix lint error

Signed-off-by: May Zhang <may_zhang@intuit.com>

* feat: rename tail-lines to tail

Signed-off-by: May Zhang <may_zhang@intuit.com>

* feat: fix when to send last message status

Signed-off-by: May Zhang <may_zhang@intuit.com>

* feat: fix lint error

Signed-off-by: May Zhang <may_zhang@intuit.com>

* feat: fix lint error

Signed-off-by: May Zhang <may_zhang@intuit.com>

* feat: retry on the client side

Signed-off-by: May Zhang <may_zhang@intuit.com>

* feat: fix lint error

Signed-off-by: May Zhang <may_zhang@intuit.com>

* feat: fix lint error

Signed-off-by: May Zhang <may_zhang@intuit.com>

* feat: fix lint error

Signed-off-by: May Zhang <may_zhang@intuit.com>

* feat: fix lint error

Signed-off-by: May Zhang <may_zhang@intuit.com>

* feat: fix lint error

Signed-off-by: May Zhang <may_zhang@intuit.com>

* feat: fix lint error

Signed-off-by: May Zhang <may_zhang@intuit.com>

* feat: if --follow, keep retry

Signed-off-by: May Zhang <may_zhang@intuit.com>

* feat: added two more flags for CLI

Signed-off-by: May Zhang <may_zhang@intuit.com>

* feat: added two more flags for CLI

Signed-off-by: May Zhang <may_zhang@intuit.com>

* feat: added two more flags for CLI

Signed-off-by: May Zhang <may_zhang@intuit.com>

* feat: added two more flags for CLI

Signed-off-by: May Zhang <may_zhang@intuit.com>

* feat: error return when there are more than 10 pods to render.

Signed-off-by: May Zhang <may_zhang@intuit.com>

* feat: if podname is present, use the same flow as if query by resource kind

Signed-off-by: May Zhang <may_zhang@intuit.com>
2021-02-08 09:27:24 -08:00
Joao Paulo Bastos
e4165d01b8 docs: add Octadesk to USERS.md (#5455)
Signed-off-by: João Paulo Bastos <joao.bastos@octadesk.com>
Signed-off-by: joaopaulosr95 <joaopaulosr95@gmail.com>
2021-02-08 09:19:09 -08:00
Josh Soref
2d79d97b44 chore: Fix markdown (#5438)
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2021-02-08 09:18:35 -08:00
Remington Breeze
bb15a4996e fix(ui): Only connect edges between resources in the same namespace (#5430)
Signed-off-by: Remington Breeze <remington@breeze.software>
2021-02-05 16:54:45 -08:00
matthewhembree
33bf9901ce fix: Remove empty fields from argocd-redis-ha. Fixes #5371 (#5399)
Signed-off-by: Matthew Hembree <matthew_hembree@yahoo.com>
2021-02-05 16:35:40 -08:00
Remington Breeze
3c3325f3e7 feat: add source repos to fields inherited from global projects (#5417)
Signed-off-by: Remington Breeze <remington@breeze.software>
2021-02-05 11:48:47 -08:00
Remington Breeze
c936355508 fix(ui): Add header and browser title to fullscreen logs viewer (#5419)
Signed-off-by: Remington Breeze <remington@breeze.software>
Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2021-02-05 08:22:44 -08:00
Alexander Matyushentsev
161d1d777d fix: version info should be avaialble if anonymous access is enabled (#5422)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-02-04 18:39:31 -08:00
Alexander Matyushentsev
f0d8129ea0 fix: fix issues discovered by sonarcloud (#5416)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-02-04 17:53:53 -08:00
kshamajain99
d9e9a9939d fix: disable jwt claim audience validation #5381 (#5413)
* fix: disable audience validation

Signed-off-by: kshamajain99 <kshamajain99@gmail.com>

* update other places

Signed-off-by: kshamajain99 <kshamajain99@gmail.com>
2021-02-04 16:38:12 -08:00
Alexander Matyushentsev
8f5379e1cc fix: /api/version should not return tools version for unauthenticated requests (#5415)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-02-04 16:03:56 -08:00
Alexander Matyushentsev
85ffe1c4bf fix: account tokens should be rejected if required capability is disabled (#5414)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-02-04 15:45:49 -08:00
Alexander Matyushentsev
8014cf3c03 feat: set X-XSS-Protection while serving static content (#5412)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-02-04 15:27:31 -08:00
Regina Scott
bef46390ea fix: overriding version logic in warning banner (#5410)
Signed-off-by: Regina Scott <rescott@redhat.com>
2021-02-04 12:53:16 -08:00
Regina Scott
c160a7140e feat: add versioning to argocd docs (#5099)
* feat: add versioning to argocd docs

Signed-off-by: Regina Scott <rescott@redhat.com>

* make default branch stable, provide warning for latest

Signed-off-by: Regina Scott <rescott@redhat.com>
2021-02-04 12:06:29 -08:00
Markus Hinz
7dfc439086 feat: Add Access-Control-Allow-Origin: * response header to badges (#5395)
Signed-off-by: Markus Hinz <markus.hinz@syncier.com>
2021-02-04 09:38:24 -08:00
Tianhe Zhang
564a1221b3 docs: add Orbital Insight to USERS.md (#5405)
Signed-off-by: Tianhe Zhang <tianhe.zhang@orbitalinsight.com>
2021-02-03 23:36:49 -08:00
Alexander Matyushentsev
20ed703e03 fix: tokens keep working after account is deactivated (#5402)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-02-03 16:24:36 -08:00
Ishita Sequeira
8da699f177 fix: autocomplete filter to make it case insensitive #5152 (#5400)
Signed-off-by: ishitasequeira <isequeir@redhat.com>
2021-02-03 15:06:42 -08:00
Alexander Matyushentsev
9bf7ae378f refactor: upgrade helm to 3.5.1 (#5385)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-02-02 16:07:13 -08:00
Alexander Matyushentsev
b29c56aaf1 fix: k8s client version is blank after removing client binary (#5386)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-02-02 16:07:02 -08:00
Alexander Matyushentsev
a85f8e89f5 fix: a request which was using a revoked project token, would still be allowed to perform requests allowed by default policy (#5378)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-02-02 15:26:20 -08:00
Keith Chong
bc4fba3f1b feat: Show number of pod restarts in the argo ui (5041) (#5384)
Signed-off-by: Keith Chong <kykchong@redhat.com>
2021-02-02 15:18:35 -08:00
Alexander Matyushentsev
065e5b9306 fix: correctly sort events by lastTimestamp field (#5383)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-02-02 15:15:46 -08:00
Remington Breeze
d6d534a94e feat(ui): User defined information banner (#5299)
Signed-off-by: Remington Breeze <remington@breeze.software>
Co-authored-by: gaganeggday <gh1268@rit.edu>
2021-02-02 12:24:43 -08:00
kshamajain99
0cc4fc2b15 update external link doc (#5377)
Signed-off-by: kshamajain99 <kshamajain99@gmail.com>
2021-02-02 11:34:48 -08:00
Alexander Matyushentsev
82b74d274d chore: image Github actions workflow should override quay.io/argoproj/argocd image (#5379)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-02-02 11:32:49 -08:00
Remington Breeze
5d5cd742c0 fix(ui): Overlapping buttons at narrow screen widths (#5259)
* fix(ui): Prevent overlap of toolbar items with narrow browser windows. Other narrow window related fixes

Signed-off-by: Remington Breeze <remington@breeze.software>
2021-02-02 09:53:11 -08:00
jannfis
f7c2b886db chore: Bring back kubectl to test-tools-image (#5369)
Signed-off-by: jannfis <jann@mistrust.net>
2021-02-01 17:58:15 -08:00
kshamajain99
baa0f2e39c feat: selective sync (#3877) (#5347)
* selective sync

Signed-off-by: kshamajain99 <kshamajain99@gmail.com>
2021-01-29 12:26:47 -08:00
Alexander Matyushentsev
21670820a4 refactor: optimize argocd-application-controller redis usage (#5345)
* refactor: controller uses two level caching to reduce number of redis calls

Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-01-29 11:42:40 -08:00
Amit Rout
5d1bbb13f8 fix: Update argocd login command example (#5352)
Signed-off-by: arout <arout@redhat.com>
2021-01-29 15:41:51 +01:00
Regina Scott
5f10461034 fix: minor cleanup for wording in cli and docs (#5321)
* fix: various docs grammar fixes

Signed-off-by: Regina Scott <rescott@redhat.com>
2021-01-28 14:46:57 -08:00
kshamajain99
420c1705ae docs: instructions on how to add external link (#5330)
* doc on external link instructions

Signed-off-by: kshamajain99 <kshamajain99@gmail.com>

* add to mkdocs

Signed-off-by: kshamajain99 <kshamajain99@gmail.com>
2021-01-28 14:03:16 -08:00
Thomas Decaux
0382763367 docs: Update next MS to 1.9 (#5332)
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
2021-01-28 13:10:03 -08:00
Dewan Ishtiaque Ahmed
5e7c68c8fc docs: Remove stale warning banner (#5346)
fixes https://github.com/argoproj/argo-cd/issues/5025

Signed-off-by: Dewan Ahmed <dewan.ishtiaque@hotmail.com>
2021-01-28 12:08:55 -08:00
Remington Breeze
076924dd77 fix(ui): Various minor UI fixes (#5337)
Signed-off-by: Remington Breeze <remington@breeze.software>
2021-01-27 17:47:05 -08:00
Remington Breeze
abf78a3c4c feat(ui): Open pod logs in an isolated new tab (#5323)
Signed-off-by: Remington Breeze <remington@breeze.software>
2021-01-27 17:18:53 -08:00
Remington Breeze
3967baf0c9 feat: Prevent unnecessary controller diffing with caching (#5255)
Signed-off-by: Remington Breeze <remington@breeze.software>
Co-authored-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-01-27 16:13:29 -08:00
Remington Breeze
32642dfb1b feat(ui): Filterable pod logs (#5319)
* feat(ui): Filterable pod logs

Signed-off-by: Remington Breeze <remington@breeze.software>
2021-01-27 15:48:37 -08:00
Alexander Matyushentsev
00f53b510d feat: Logs should favor containers over init containers (#4345) (#5322)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-01-26 15:26:01 -08:00
Alexander Matyushentsev
7165b45aea fix: consistently display information about 'compared to' and 'synced to' revisions (#5313)
* fix: consistently display information about 'compared to' and 'synced to' revisions

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

* apply review notes

Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-01-26 13:22:48 -08:00
Alexander Matyushentsev
d516f4754f fix: fix fetching commit SHAs (#5312) (#5320)
Signed-off-by: Alexander Matyushentsev <Alexander_Matyushentsev@intuit.com>
2021-01-26 12:59:51 -08:00
Alexander Matyushentsev
d8b545d107 fix: improve fetching commit SHAs (#5312)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-01-25 23:13:27 -08:00
Remington Breeze
dbadd74b42 feat(ui): New pod logs viewer (#5233)
feat(ui): New pod logs viewer (#5233)
2021-01-25 11:48:49 -08:00
nishant-d
e02b8646c9 docs: add user Devtron labs (#5300)
Signed-off-by: nishant <nishant@devtron.ai>
2021-01-23 20:52:05 -08:00
jannfis
b2a3918005 fix: Use correct API version when generating app and project manifests (#5301)
Signed-off-by: jannfis <jann@mistrust.net>
2021-01-23 20:50:54 -08:00
May Zhang
d95e35fcab feat: turn on grpc-web (#5288)
* turn on grpc-web

Signed-off-by: May Zhang <may_zhang@intuit.com>

* feat: turn on grpc-web

Signed-off-by: May Zhang <may_zhang@intuit.com>

* feat: turn on grpc-web

Signed-off-by: May Zhang <may_zhang@intuit.com>

* feat: add warning message.

Signed-off-by: May Zhang <may_zhang@intuit.com>
2021-01-21 18:17:54 -08:00
Snyk bot
bacddacbcf fix: ui/package.json & ui/yarn.lock to reduce vulnerabilities (#5239)
The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-NODESASS-1059081
2021-01-21 17:06:11 -08:00
jannfis
166d0cc68b docs: Clarify RBAC requirements for GnuPG (#5294)
* docs: Clarify RBAC requirements for GnuPG

Signed-off-by: jannfis <jann@mistrust.net>

* Fix

Signed-off-by: jannfis <jann@mistrust.net>
2021-01-21 15:09:53 -08:00
Abhishek Veeramalla
eaf9887d17 fix: Remove kubectl binary from argo image(#5005) (#5101)
Signed-off-by: iam-veeramalla <abhishek.veeramalla@gmail.com>
2021-01-21 09:49:51 -08:00
kshamajain99
1ee7997fb8 fix dev image and update doc (#5285)
Signed-off-by: kshamajain99 <kshamajain99@gmail.com>
2021-01-21 09:28:34 -08:00
kshamajain99
7af5837ffa build consolidated argocd binary (#5247)
Signed-off-by: kshamajain99 <kshamajain99@gmail.com>
2021-01-20 11:28:06 -08:00
Alexander Matyushentsev
9dd5dd2f83 fix: directory source include/exclude should match relative file path (#5277)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-01-20 09:12:49 -08:00
Matt Veitas
41fb0ac2de feat: Allow GetRevisionMetadata to use truncated sha revision (#5265)
Signed-off-by: Matt Veitas <matt.veitas@everbridge.com>
2021-01-19 20:14:18 -08:00
Tom Wieczorek
54716ac0ed fix: app create with -f ignored labels from file (#5268)
Since v1.7.5, argocd app create -f doesn't use any labels specified
inside the application file anymore. Refactor the SetLabels funcion to
merge labels specified in the file with those from the command line
arguments. Extend the existing e2e test to verify that behavior.

Signed-off-by: Tom Wieczorek <t.wieczorek@yieldlab.de>
2021-01-19 14:51:48 -08:00
Evan Lowry
67d15ce05c docs: update AWS auth information in security.md (#5274)
In PR #3010 the method of authentication w/ AWS changed. The previous method was still referenced in the docs.

Signed-off-by: Evan Lowry <elowry@beyondtrust.com>
2021-01-19 14:13:45 -08:00
Tom Wieczorek
a12f805bb2 fix: locale-independent gpg output parsing (#5269)
Explicitly specify the "C" language during the invocation of the gpg
binary. That way, parsing its output is more robust on non-english
systems.

Signed-off-by: Tom Wieczorek <t.wieczorek@yieldlab.de>
2021-01-18 21:04:06 +01:00
jannfis
ae6b8241d5 fix: Prevent possible nil pointer dereference in project API (#5263)
Signed-off-by: jannfis <jann@mistrust.net>
2021-01-17 22:38:14 -08:00
Regina Scott
e26ad305b4 fix: expand button spacing issue (#5258)
Signed-off-by: Regina Scott <rescott@redhat.com>
2021-01-15 14:42:45 -08:00
Regina Scott
534ec17b3c fix: commit message overflows box (#5043) (#5241)
Signed-off-by: Regina Scott <rescott@redhat.com>
Co-authored-by: Remington Breeze <remington@breeze.software>
2021-01-15 13:26:06 -08:00
Jorge López Zarza
ac7dbfe81f fix: remove unnecessary colons (#5254)
Signed-off-by: Jorge López <j.lopezarza@gmail.com>
2021-01-15 09:03:14 -08:00
Regina Scott
5037a652f6 fix: use red spinner for terminating animation (#5252)
Signed-off-by: Regina Scott <rescott@redhat.com>
2021-01-15 05:49:21 -08:00
Remington Breeze
81497bbcf1 fix(ui): Pod view tooltips positioned incorrectly (#5244)
Signed-off-by: Remington Breeze <remington@breeze.software>
2021-01-13 14:31:45 -08:00
Alexander Matyushentsev
c9c8befa45 refactor: upgrade gitops-engine version (closes #4627) (#5235)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-01-13 11:12:28 -08:00
Remington Breeze
2f080e14f9 fix(ui): Improve pod view with better space efficiency (#5238)
Signed-off-by: Remington Breeze <remington@breeze.software>
2021-01-12 20:54:00 -08:00
Alexander Matyushentsev
64e1c3825a fix: make sure JWT token time fields contain only integer values (#5228)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-01-11 13:59:34 -08:00
jannfis
ffb8ce22ee chore: Change installation manifests to pull images from quay.io (#5227)
* chore: Update manifests to point to quay.io

Signed-off-by: jannfis <jann@mistrust.net>

* Set image also in kustomize bases

Signed-off-by: jannfis <jann@mistrust.net>

* make manifests

Signed-off-by: jannfis <jann@mistrust.net>

* Also update for Dex init container

Signed-off-by: jannfis <jann@mistrust.net>

* Adapt upgrade docs to reflect new registry

Signed-off-by: jannfis <jann@mistrust.net>
2021-01-11 22:28:16 +01:00
Alexander Matyushentsev
27a609fb1a fix: controller should load application related nodes from target cluster (#5208)
* fix: controller should load application related nodes from target cluster

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

* fix: make sure node capasity and pod requests are in same unit, improve unit formatting

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

* fix: application hosts should include info about resources requested by app neighbors

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

* apply reviewer notes

Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-01-11 12:35:47 -08:00
jannfis
1771d9fd78 chore: Also push container images to quay.io (#5226)
Signed-off-by: jannfis <jann@mistrust.net>
2021-01-11 21:24:15 +01:00
Kostis (Codefresh)
da42028c8c docs: Two new blog posts (#5213)
Signed-off-by: Kostis Kapelonis <kostis@codefresh.io>
2021-01-09 11:37:54 -08:00
kshamajain99
0f233c072b updating cluster drops secret (#5220)
Signed-off-by: kshamajain99 <kshamajain99@gmail.com>
2021-01-09 11:36:38 -08:00
kshamajain99
98bec61d61 feat: Include argocd-util as part of release artifacts(#5174) (#5203)
* Publish argocd-util

Signed-off-by: kshamajain99 <kshamajain99@gmail.com>

* Don't add util to argocd-image

Signed-off-by: kshamajain99 <kshamajain99@gmail.com>
2021-01-08 08:05:38 +01:00
May Zhang
f5b9704267 feat: prune last (#5199)
* feat: prune last
fixes: #5080.
If sync option has PruneLast=true, or individual resource has annotation argocd.argoproj.io/sync-options: PruneLast=true, these prune tasks get assigned with a new sync wave.

the new sync wave is the last sync wave of non-prune tasks which is in sync phase + 1, so that these resources will be pruned after all sync phase resources are synced and healthy.

Signed-off-by: May Zhang <may_zhang@intuit.com>

* fix: go mod tidy

Signed-off-by: May Zhang <may_zhang@intuit.com>
2021-01-06 14:13:02 -08:00
jannfis
eb9216f8e1 chore: Upgrade gorilla/handlers and gorilla/websocket (#5186)
* chore: Upgrade gorilla/handlers and gorilla/websocket

Signed-off-by: jannfis <jann@mistrust.net>

* go mod tidy

Signed-off-by: jannfis <jann@mistrust.net>
2021-01-06 11:26:04 +01:00
jannfis
f4c9c3db59 fix: Generate initial admin password in a more secure manner (#5138)
* fix: Generate initial admin password in a more secure manner

Signed-off-by: jannfis <jann@mistrust.net>

* Make CreateOrUpdateSecret method public

Signed-off-by: jannfis <jann@mistrust.net>
2021-01-06 10:44:37 +01:00
Alexander Matyushentsev
dfcbddf605 refactor: upgrade gitops-engine and k8s deps to v0.20.1 (#5194)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-01-06 00:07:46 -08:00
Alexander Matyushentsev
da6bd1138d fix: remove invalid assumption about OCI helm chart path (#5179)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-01-06 00:07:24 -08:00
Remington Breeze
b0819691d3 fix(ui): Group by node in pod view not working due to using label rather than metadata.name (#5191)
Signed-off-by: Remington Breeze <remington@breeze.software>
2021-01-05 16:33:20 -08:00
Remington Breeze
9c597acaac fix(ui): Overflowing info items for pods belonging to nodes with long names (#5190)
Signed-off-by: Remington Breeze <remington@breeze.software>
2021-01-05 16:12:54 -08:00
jannfis
14b8e3da66 chore: Switch Docker base image to ubuntu:20.10 instead of debian:10-slim (#5185)
Signed-off-by: jannfis <jann@mistrust.net>
2021-01-05 14:16:54 -08:00
Remington Breeze
5d6b3216f5 feat(ui): Pod view (#5091)
* feat(server): Pod view server (#5089)

Signed-off-by: Remington Breeze <remington@breeze.software>
2021-01-05 12:28:14 -08:00
jannfis
b314824e31 chore: Upgrade jwt-go to 4.0.0-preview1 (#5184)
Signed-off-by: jannfis <jann@mistrust.net>
2021-01-05 19:12:50 +01:00
Alexander Matyushentsev
49b2e034cf docs: document ARGOCD_EXEC_TIMEOUT environment variable (#5180)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-01-05 14:48:37 +01:00
Arthur Koziel
cee02b7dac docs: add blog post about setting up Argo CD with Helm (#5177)
Signed-off-by: Arthur Koziel <arthur@arthurkoziel.com>
2021-01-04 22:57:17 -08:00
jovianx-dev
eac50fcb22 Add JovianX to USERS.md (#5171) 2021-01-04 14:30:41 -08:00
Yujun Zhang
ad1dd825c6 feat: support fetch refs (#4893)
Signed-off-by: Yujun Zhang <yujunz@nvidia.com>
2021-01-04 10:19:00 -08:00
Alexander Matyushentsev
3b87781003 fix: add liveness probe to restart repo server if it fails to server tls requests (#5110) (#5119)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-01-04 10:02:15 -08:00
Masaya Aoyama (@amsy810)
7d277dc042 feat: implement include filter for directory settings (#5166)
modified files are following (others are automatically generated)
* cmd/util/app.go
* pkg/apis/application/v1alpha1/types.go
* reposerver/repository/repository.go
* util/argo/argo.go
* test/e2e/app_management_test.go

Signed-off-by: MasayaAoyama <amsy810@gmail.com>
2021-01-03 19:17:42 -08:00
jannfis
ddecca412c chore: Remove stray debug Printf() from CLI (#5163)
Signed-off-by: jannfis <jann@mistrust.net>
2021-01-01 16:16:00 -08:00
Nadav Shatz
19ec893118 Add Tailor Brands to USERS.md (#5143)
Signed-off-by: Nadav Shatz <nadav@tailorbrands.com>
2020-12-31 09:18:35 -08:00
jannfis
36204efcc9 fix: Possible nil pointer dereference in repocreds API (#5130)
Signed-off-by: jannfis <jann@mistrust.net>
2020-12-30 10:32:29 -08:00
jannfis
94eba091ba fix: Possible nil pointer dereference in repository API (#5128)
Signed-off-by: jannfis <jann@mistrust.net>
2020-12-27 14:19:26 -08:00
kshamajain99
12ec99ad01 feat: declarative config for cluster and repo(#4734) (#5102)
* Declarative config for cluster and repo

Signed-off-by: kshamajain99 <kshamajain99@gmail.com>

* Review comments

Signed-off-by: kshamajain99 <kshamajain99@gmail.com>
2020-12-23 14:15:05 -08:00
Liviu Costea
30ffe8de71 refactor(jwt): use typed access to claims (#5075)
Signed-off-by: Liviu Costea <email.lcostea@gmail.com>
2020-12-22 10:30:12 -08:00
Noah Kantrowitz
5b464c996b feat: Add resource.Quantity as a known field type for diffing. (#5095)
Signed-off-by: Noah Kantrowitz <noah@coderanger.net>
2020-12-21 14:04:32 -08:00
Tamas Kozma
cfdf1db4a1 docs: fix Validate sync option description (#5093)
Signed-off-by: Tamas Kozma <tkozma@users.noreply.github.com>
2020-12-21 14:02:04 -08:00
jannfis
8bd59530e8 fix: Allow correct SSO redirect URL for CLI static client (#5098)
Signed-off-by: jannfis <jann@mistrust.net>
2020-12-21 13:43:17 -08:00
Josh Soref
45b3e48dfc fix: /!\ icon for overridden parameters should be gavel (#5085) (#5087)
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2020-12-18 09:08:35 -08:00
Keith Chong
14cf261f48 feat: Add locator for delete app confirmation field for UI tests (#4393) (#5074)
Signed-off-by: Keith Chong <kykchong@redhat.com>
2020-12-17 13:58:33 -08:00
William Tam
554c39dc34 fix: correct name for argocd-redis-ha-haproxy role/role binding (#5078)
* correct name for argocd-redis-ha-haproxy role/role binding
Signed-off-by: William Tam <email.wtam@gmail.com>

* Trim  trailing spaces
Signed-off-by: William Tam <email.wtam@gmail.com>
2020-12-16 14:21:50 -08:00
Cory Jacobsen
456f637196 docs: add 7shifts to users list (#5073)
Signed-off-by: Cory Jacobsen <cory@unrolled.ca>
2020-12-16 14:16:47 -08:00
Regina Scott
4bcdfbe1a9 fix: Various typing errors and general docs improvements (#5066)
Signed-off-by: Regina Scott <rescott@redhat.com>
2020-12-16 16:23:44 +01:00
kshamajain99
1734b46f71 feat: Generate declarative config for app and appproj (#4734) (#5014)
* Generate declarative config for app and appproj
2020-12-15 13:23:54 -08:00
May Zhang
d2295d45d0 fix: add grpc health check (#5060)
* fix: add grpc health check

Signed-off-by: May Zhang <may_zhang@intuit.com>

* fix: fixing lint error

Signed-off-by: May Zhang <may_zhang@intuit.com>

* fix: fixing lint error

Signed-off-by: May Zhang <may_zhang@intuit.com>
2020-12-15 10:35:53 -08:00
Arpan Balpande
e3e392c058 Update sync-waves.md (#5062)
Corrected the typo in line number 9 from "than" to "that".
2020-12-15 08:52:08 -08:00
jannfis
b2284379dd feat: Application specific parameter override files (#5038)
* feat: Support application specific parameter override files

Signed-off-by: jannfis <jann@mistrust.net>
2020-12-15 08:51:02 -08:00
Josh Soref
d4ef744454 chore: sort USERS.md (#5057)
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2020-12-14 16:55:31 -08:00
Keith Chong
09a1bf4644 feat: App list filter counters and labels should dynamically update (#4822)
Signed-off-by: Keith Chong <kykchong@redhat.com>
2020-12-14 16:54:33 -08:00
jannfis
e08e0d29bb chore: Update Dex to v2.27.0 (#5058)
Signed-off-by: jannfis <jann@mistrust.net>
2020-12-14 14:38:31 -08:00
Tadayuki Onishi
fba23d9e45 Support multibyte for truncate string functions (#5055)
Signed-off-by: kenchan0130 <tt.tanishi100@gmail.com>
2020-12-14 09:56:11 -08:00
Keith Chong
e1990faf67 fix: Prompt for name for managed resources only when deleting (#5033) (#5049)
Signed-off-by: Keith Chong <kykchong@redhat.com>
2020-12-14 09:19:49 -08:00
Keith Chong
1f7ef07512 fix: Correct Revision History Limit tooltip (#3534) (#5050)
Signed-off-by: Keith Chong <kykchong@redhat.com>
2020-12-14 07:48:31 +01:00
Josh Soref
e160afc225 chore: change version to 1.9.0 (#5045)
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2020-12-13 12:30:35 -08:00
Alexander Matyushentsev
9e61354fa2 fix: setting 'revision history limit' errors in UI (#5035)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-12-11 08:50:32 -08:00
Jesse Suen
696bf8be7c chore: issue template config.yaml was improperly named (#5032)
Signed-off-by: Jesse Suen <Jesse_Suen@intuit.com>
2020-12-10 15:26:04 -08:00
Jesse Suen
68f316137b chore: direct users to ask questions on GitHub discussions (#5028)
Signed-off-by: Jesse Suen <Jesse_Suen@intuit.com>
2020-12-10 14:06:59 -08:00
Regina Scott
e472678815 fix: Capitalization in toc (#5024)
Signed-off-by: Regina Scott <rescott@redhat.com>
2020-12-10 22:33:01 +01:00
Grant Isdale
ca1235a21d docs(fix): note not rendering correctly on user-management/auth0 page (#5019)
* docs(fix): note not rendering correctly on user-management/auth0 page

Add newline under `note` to try fix rendering of note component from my previous commit on user-management/auth0 page of the docs

Signed-off-by: Grant Isdale <44140736+grantisdale@users.noreply.github.com>

* docs(fix): fix note section at the bottom of Auth0 SSO page

Signed-off-by: Grant Isdale <44140736+grantisdale@users.noreply.github.com>
2020-12-10 13:04:59 -08:00
dependabot[bot]
d7a5257094 chore(deps): bump ini from 1.3.5 to 1.3.7 in /ui (#5027)
Bumps [ini](https://github.com/isaacs/ini) from 1.3.5 to 1.3.7.
- [Release notes](https://github.com/isaacs/ini/releases)
- [Commits](https://github.com/isaacs/ini/compare/v1.3.5...v1.3.7)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-10 12:37:42 -08:00
Keith Chong
3d019a22c2 feat: Cascade delete option is ticked by default (#3205) (#4994)
Signed-off-by: Keith Chong <kykchong@redhat.com>
2020-12-10 11:56:19 -08:00
Alexander Matyushentsev
85ea4c445e fix: add api-server liveness probe that catches bad data in informer (#5026)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-12-10 11:48:27 -08:00
k.bigwheel
13eefd8292 docs: Fix configmap name in doc (#5022)
Signed-off-by: bigwheel <k.bigwheel+eng@gmail.com>
2020-12-10 16:14:45 +01:00
Abhishek Veeramalla
89a8751216 fix: argocd-test-server does not get removed/deleted upon SIGINT(#4969) (#5018)
Signed-off-by: iam-veeramalla <abhishek.veeramalla@gmail.com>
2020-12-10 08:04:32 +01:00
Alexander Matyushentsev
dcf2694285 fix: sync retry is broken for multi-phase syncs (#5017)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-12-09 18:05:34 -08:00
James Callahan
8b486b5e0f fix: typo in dashboard (#5015)
Signed-off-by: James Callahan <jamescallahan@bitgo.com>
2020-12-09 16:53:24 -08:00
Grant Isdale
1ef14dca83 docs: provide clearer docs on storing clientSecrets when using SSO (#5012)
Signed-off-by: Grant Isdale <44140736+grantisdale@users.noreply.github.com>
2020-12-09 14:21:01 -08:00
jannfis
b955c6a7a4 chore: Update grpc-gateway to v1.16.0 (#5011)
Signed-off-by: jannfis <jann@mistrust.net>
2020-12-09 20:33:54 +01:00
Isaac Gaskin
27912a08f1 feat: adding print statements to cli "rm" commands (#5009)
also standardizing on capitalization of add/remove command print statements

Signed-off-by: Isaac Gaskin <igaskin@tesla.com>
2020-12-09 09:34:35 +01:00
May Zhang
fdb5ada06d fix: Revert "feat: Add health check for HPA (#4915)" (#5006)
* Revert "feat: Add health check for HPA (#4915)"

This reverts commit f6a32a9e

Signed-off-by: May Zhang <may_zhang@intuit.com>

* fix: revert health check

Signed-off-by: May Zhang <may_zhang@intuit.com>

* fix: remove extra line

Signed-off-by: May Zhang <may_zhang@intuit.com>
2020-12-08 16:32:20 -08:00
Lionel Houssou
9b53f8f93a docs: add user Energisme (#5001)
Signed-off-by: lhoussou <lionel.houssou@energisme.com>
2020-12-08 10:14:46 -08:00
Alexander Matyushentsev
bb7bdbab9b fix: infer app destination server in indexer to prevent concurrent app object modification (#4993)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-12-08 08:45:37 -08:00
Alexander Matyushentsev
3114fdde80 chore: fix flaky TestCRDStatusSubresourceAction e2e test (#4996)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-12-08 07:29:06 -08:00
Jeremy Mouton
73f75df173 docs: Add Spendesk user (#5000)
Signed-off-by: Labbs <moutonjeremy@labbs.fr>
2020-12-08 07:25:09 -08:00
Abhishek Veeramalla
6b8867a582 fix: sync repository certificates UI with other pages(#4609) (#4971)
Signed-off-by: iam-veeramalla <abhishek.veeramalla@gmail.com>
2020-12-07 23:30:29 -08:00
Regina Scott
9ea1163411 fix: Change icons so that there will be no two identical icons together (#4977)
Signed-off-by: Regina Scott <rescott@redhat.com>
2020-12-07 19:54:44 -08:00
Alexander Matyushentsev
3b67e91d55 fix: prevent short-circuit during env variable substitution (#4984)
* fix: prevent short-circuit during env variable substitution

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

* improve expansion logic

Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-12-07 11:22:14 -08:00
Abhishek Veeramalla
b7b74582cb fix: make start fails to start webpack-dev-server(#4968) (#4990)
Signed-off-by: iam-veeramalla <abhishek.veeramalla@gmail.com>
2020-12-07 16:24:08 +01:00
Lapi
ea73f093e8 docs: Add url parameter in example of Auth0 setting (#4989)
* Add url parameter in example of Auth0 setting

Signed-off-by: Ayato Tachibana <tyoutugai.7@gmail.com>

* docs: Add url parameter in example of Auth0 setting

Signed-off-by: Ayato Tachibana <tyoutugai.7@gmail.com>
2020-12-07 10:47:48 +01:00
htgeis
75eed3961c docs: Fix wrong commands in user guide (#4982)
Signed-off-by: jingwei.su <6914259+htgeis@users.noreply.github.com>

Co-authored-by: jingwei.su <jingwei.su@hulu.com>
2020-12-06 14:37:48 +01:00
Josh Soref
9fb51f7af6 Grammar (#4986)
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2020-12-05 18:57:07 -08:00
Josh Soref
869af3e2fe feat(ui): replicaset children of deployment should sort by revision (#4249) (#4252)
* feat(ui): replicaset children of deployment should sort by revision #4249

* fix: export and test compareNodes

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* feat: use info["name"="Revision"].value

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2020-12-05 18:55:51 -08:00
Alexander Matyushentsev
991894e305 fix: update helm version help text (#4976)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-12-04 11:21:17 -08:00
Jonah Back
0ebde72d6a docs: Add example for using ALB with GRPC (#4974)
* docs: add example for using ALB with GRPC

Signed-off-by: Jonah Back <jonah@jonahback.com>

* docs: address review comments

Signed-off-by: Jonah Back <jonah@jonahback.com>
2020-12-04 18:52:34 +01:00
kshamajain99
f05ac0cb3a list applications filter by name (#4959)
Signed-off-by: kshamajain99 <kshamajain99@gmail.com>
2020-12-04 09:48:48 -08:00
IliaGe
6863838917 Update okta.md (#4943) 2020-12-03 16:30:16 -08:00
Kenneth Tan Xin You
75601a7177 Update getting_started.md (#4870) 2020-12-03 15:49:30 -08:00
Osama Nabil
5c268b9af9 use correct command to list kubeconfig contexts (#4804)
Signed-off-by: hacktron95 <hacktron95@gmail.com>
2020-12-03 15:26:34 -08:00
Denis Jajčević
a516ffedba Update USERS.md (#4916)
Add https://croz.net/
2020-12-03 15:23:47 -08:00
Keith Chong
c36b7ce4bd fix: Design Flaw leading to errant delete (#4844) (#4909)
Signed-off-by: Keith Chong <kykchong@redhat.com>
2020-12-03 15:18:51 -08:00
Mya Pitzeruse
d804e81e1f added blog post on argo-cd and renovate (#4970)
Signed-off-by: Mya Pitzeruse <j.mya.pitz@gmail.com>
2020-12-03 13:26:54 -08:00
jannfis
230bafd3c3 chore: Update PR template to include notes on DCO (#4966)
* chore: Update PR template with DCO instructions

Signed-off-by: jannfis <jann@mistrust.net>

* Move note to top

Signed-off-by: jannfis <jann@mistrust.net>
2020-12-03 20:03:15 +01:00
Shoubhik Bose
da929c2796 docs: fix typo in user management doc (#4962)
Signed-off-by: Shoubhik Bose <shbose@redhat.com>
2020-12-03 19:26:10 +01:00
Alexander Matyushentsev
4417cc8180 fix: use json serialization to store cache instead of github.com/vmihailenco/msgpack (#4965)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-12-03 10:24:47 -08:00
Shoubhik Bose
5f46815469 docs: The default realm is master (#4963)
Signed-off-by: Shoubhik Bose <shbose@redhat.com>
2020-12-03 19:16:57 +01:00
Michael Goodness
d82f6b425a fix(repository.go): rename .argocd-source.yaml in error message (#4964)
Signed-off-by: Michael Goodness <michael.goodness@mlb.com>
2020-12-03 08:37:40 -08:00
Alexander Matyushentsev
7b0fe7bffb increase cache version (#4957)
Signed-off-by: Alexander Matyushentsev <Alexander_Matyushentsev@intuit.com>
2020-12-02 17:04:55 -08:00
Maxime Brunet
d766a82185 chore: Upgrade go-jsonnet to v0.17.0 (#4891)
* chore: Upgrade go-jsonnet to v0.17.0

Signed-off-by: Maxime Brunet <max@brnt.mx>

* Fix vm.EvaluateSnippet is deprecated

Use EvaluateFile or EvaluateAnonymousSnippet instead.

Signed-off-by: Maxime Brunet <max@brnt.mx>

* Do not read Jsonnet files

Signed-off-by: Maxime Brunet <max@brnt.mx>
2020-12-02 17:04:05 -08:00
Alexander Matyushentsev
cfbd535904 fix: reset cached manifest generation errors after 1hr instead of 12 requests (#4953)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-12-02 13:36:26 -08:00
Alexander Matyushentsev
2b50698987 fix: cache missing app path and commit verification errors (#4947)
* fix: cache missing app path and commit verification errors

Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-12-02 12:12:53 -08:00
Alexander Matyushentsev
3bf3ac7e21 fix: upgrades github.com/vmihailenco/msgpack/v5 to fix #4933 (#4952)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-12-02 12:05:32 -08:00
Jesse Suen
708adaff60 docs: add Argo CD demo video (#4948)
Signed-off-by: Jesse Suen <Jesse_Suen@intuit.com>
2020-12-02 08:40:54 -08:00
Abhishek Veeramalla
dc13884f4b fix: Include Headers in login clientopts (#4918) (#4941)
Signed-off-by: iam-veeramalla <abhishek.veeramalla@gmail.com>
2020-12-02 08:08:08 -08:00
Jesse Suen
854c8a6f98 fix: rollout health could incorrectly report v0.9 rollouts as Progressing (#4949)
Signed-off-by: Jesse Suen <Jesse_Suen@intuit.com>
2020-12-02 08:07:00 -08:00
Chetan Banavikalmutt
ee28288d50 feat: Display creation time in application node and summary (#4920)
This PR adds the creation time as a bubble to the root node in network view. It also adds CREATED_AT field to the application summary page

Fixes: #4903

Signed-off-by: Chetan Banavikalmutt <chetanrns1997@gmail.com>
2020-12-01 14:14:55 -08:00
Chetan Banavikalmutt
f6a32a9ebc feat: Add health check for HPA (#4915)
HorizontalPodAutoscaler uses annotations to store conditions. This commit adds a custom heath check that parses the conditions from annotation and creates health status.

Fixes: #4413

Signed-off-by: Chetan Banavikalmutt <chetanrns1997@gmail.com>
2020-12-01 09:44:10 -08:00
Alexander Matyushentsev
c108e2f061 fix: correctly compare application destinations with inferred cluster URL (#4937)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-12-01 09:35:32 -08:00
Chetan Banavikalmutt
6095fc564f feat: Add a keyboard shortcut to move focus to search (#4796)
Fixes: #4700
Signed-off-by: Chetan Banavikalmutt <chetanrns1997@gmail.com>
2020-12-01 09:34:52 -08:00
Alexander Matyushentsev
6e1649b1e2 refactor: upgrade helm to v3.4.1 (#4938)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-12-01 09:34:21 -08:00
jannfis
b89639e921 feat: argocd-util can now validate RBAC configuration (#4876)
* feat: argocd-util can now validate RBAC configuration

Signed-off-by: jannfis <jann@mistrust.net>

* feat: argocd-util can now validate RBAC configuration

Signed-off-by: jannfis <jann@mistrust.net>

* Validate user policy before loading it

Signed-off-by: jannfis <jann@mistrust.net>

* Add rbac validate command

Signed-off-by: jannfis <jann@mistrust.net>

* Add documentation

Signed-off-by: jannfis <jann@mistrust.net>

* Make parameters mandatory

Signed-off-by: jannfis <jann@mistrust.net>

* Fix linter issue

Signed-off-by: jannfis <jann@mistrust.net>

* codegen

Signed-off-by: jannfis <jann@mistrust.net>

* missing new files from codegen

Signed-off-by: jannfis <jann@mistrust.net>

* More linter issues

Signed-off-by: jannfis <jann@mistrust.net>
2020-12-01 08:44:02 +01:00
Josh Soref
3ca1b02725 fix: Use pause icon for Suspended (#4838) (#4905)
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2020-11-30 13:46:03 -08:00
Yujun Zhang
48291d8701 feat: support add plugin env entry from CLI (#4923)
Signed-off-by: Yujun Zhang <zhangyujun@gmail.com>
2020-11-30 18:41:30 +01:00
lowkey
345c77a8c7 docs: Add documentation for Okta SAML with private ingress (#4904)
* Describe presenting okta CA as a secret

Signed-off-by: lowkeyliesmyth <lowkey@kaffeinlabs.com>

* Describe private argo UI with public Okta SSO callback

Signed-off-by: lowkeyliesmyth <lowkey@kaffeinlabs.com>

* Describe using Contour with split public and private Ingresses

Signed-off-by: lowkeyliesmyth <lowkey@kaffeinlabs.com>

* Okta group to Argo CD role mapping

Signed-off-by: lowkeyliesmyth <lowkey@kaffeinlabs.com>

* Include required scopes for RBAC

Signed-off-by: lowkeyliesmyth <lowkey@kaffeinlabs.com>
2020-11-25 21:17:36 +01:00
jannfis
371de922d8 chore: Fix erroneous path expansion in release action (#4907)
Signed-off-by: jannfis <jann@mistrust.net>
2020-11-25 20:50:45 +01:00
Viktor Farcic
a8a451f811 docs: PRs with Argo CD and Codefresh (#4898)
Signed-off-by: Viktor Farcic <viktor@farcic.com>
2020-11-24 19:25:34 +01:00
Alexander Matyushentsev
c214fe0d95 refactor: disable gRPC metrics by default (#4892)
Signed-off-by: Alexander Matyushentsev <Alexander_Matyushentsev@intuit.com>
2020-11-23 16:44:09 -08:00
Alexander Matyushentsev
eb0d8b48bb fix: upgrade gitops-engine version. (fixes #4877) (#4890)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-11-23 13:02:19 -08:00
Alexander Matyushentsev
cb59fc72ef docs: add v1.8 changelog and upgrading instructions (#4888)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-11-23 12:45:35 -08:00
Chetan Banavikalmutt
ae12145f2d feat: Click on search icon must focus on search area (#4801)
Fixes: #4791

Signed-off-by: Chetan Banavikalmutt <chetanrns1997@gmail.com>
2020-11-23 09:46:58 -08:00
Payungsak Klinchampa
79509003fa docs : Add Google SAML Attribute Mapping for User management. (#4881)
* Update high_availability.md (#4878)

Remove double "don't have" in "Enable Concurrent Processing" section.

Signed-off-by: Peter Malmgren <peter.malmgren@zapier.com>
Signed-off-by: PayungsakCNR <payungsakpk@payungsakpk.xyz>

* Update google.md

Add SAML Attribute Mapping Details.

Signed-off-by: PayungsakCNR <payungsakpk@payungsakpk.xyz>

* Add Google SAML Mapping Photo.

Add screenshot of Google SAML Attribute Mapping.

Signed-off-by: PayungsakCNR <payungsakpk@payungsakpk.xyz>

Co-authored-by: Peter Malmgren <peter.malmgren@zapier.com>
2020-11-22 19:57:10 +01:00
Peter Malmgren
5aa1e47f8e Update high_availability.md (#4878)
Remove double "don't have" in "Enable Concurrent Processing" section.

Signed-off-by: Peter Malmgren <peter.malmgren@zapier.com>
2020-11-21 13:01:25 +01:00
kshamajain99
9ed140deaa fix: validate empty server address for destination cluster (#4852) (#4860)
* Always set inferred destination server

Signed-off-by: kshamajain99 <kshamajain99@gmail.com>
2020-11-20 16:45:22 -08:00
Jaideep Raghunath Rao
c147320687 feat: Allow configuration of OIDC logout URL to invalidate SSO session after logout (#4452) (#4826)
feat: Allow configuration of OIDC logout URL to invalidate SSO session after logout (#4452) (#4826)

Signed-off-by: jaideepr97 <jaideep.r97@gmail.com>
2020-11-20 11:19:17 -08:00
Sho Okada
3ddf50b787 fix: argocd app patch remove does not work (#4585)
Signed-off-by: Sho Okada <shokada3@gmail.com>
2020-11-20 10:19:59 -08:00
Alexander Matyushentsev
97c8b561ea fix: increase max grpc message size (#4869)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-11-20 09:40:44 -08:00
Jürgen Etzlstorfer
0c47b008ff docs: adding Keptn (#4874)
Signed-off-by: jetzlstorfer <juergen.etzlstorfer@dynatrace.com>
2020-11-20 09:40:31 -08:00
Alexander Matyushentsev
9bfa1e706b chore: use release tag to reference gitops engine dependency (#4866)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-11-19 14:10:04 -08:00
Mikhail Nacharov
59443ad185 fix: Adds podAntiAffinity in base manifests (#4549) (#4599)
Signed-off-by: Mikhail Vladimirovich Nacharov <author@webnach.ru>
2020-11-19 10:14:17 -08:00
Alex Gervais
6e6f4f50a0 docs: Improved documentation for Ambassador host-based routing configuration (#4857)
Signed-off-by: alex <alex@datawire.io>
2020-11-18 14:06:03 -08:00
Alexander Matyushentsev
ed547aa545 docs: add missing v1.7 patches description to changelog (#4859)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-11-18 10:09:01 -08:00
mitchharpur
ca7fa55a2b docs: Correct default docker desktop context name (#4830)
Signed-off-by: mitchharpur <mitchharpur@me.com>

Improved out of the box docker desktop instructions.
2020-11-18 08:52:33 -08:00
Alexander Matyushentsev
7ee951b5b8 fix: argocd diff --local should not print data of local secrets (#4850)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-11-17 09:30:35 -08:00
Alexander Matyushentsev
be8308199c docs: add automated sync policy allowEmpty to sample application (#4855)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-11-17 08:59:25 -08:00
Keith Chong
d8c08bfe7d test: Allow individual application tiles to be selectable (#4841) (#4851)
Signed-off-by: Keith Chong <kykchong@redhat.com>
2020-11-17 08:03:14 -08:00
Alexander Matyushentsev
231509bb3c feat: add project badge panel to project details page (#4846)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-11-17 08:02:07 -08:00
Alexander Matyushentsev
a2d6582e54 fix: fix rendering external links on application details page (#4847)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-11-16 23:48:31 -08:00
Alexander Matyushentsev
4b23918802 chore: add git operation metrics to sample dashboard (#4849)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-11-16 20:22:23 -08:00
Alexander Matyushentsev
51f2949883 feat: add jsonnet version to version panel (#4845)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-11-16 20:20:03 -08:00
Alexander Matyushentsev
ffa824bbba fix: use correct operation type to track ls-remote performance (#4848)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-11-16 20:19:46 -08:00
Keith Chong
e4e503aad7 feat: Add option to show branches or tags for GIT revision (#4751) (#4788)
Signed-off-by: Keith Chong <kykchong@redhat.com>
2020-11-16 13:04:17 -08:00
Alexander Matyushentsev
e8e810934d docs: document .argocd-source.yaml file usage (#4843)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-11-16 12:34:44 -08:00
jannfis
762b33c819 fix: Don't allow arbitrary redirects at login (#4780)
* fix: Don't allow arbitrary redirects at login

Signed-off-by: jannfis <jann@mistrust.net>

* Also check for CRLF in path

Signed-off-by: jannfis <jann@mistrust.net>

* Explicit unit test for empty redirect_url

Signed-off-by: jannfis <jann@mistrust.net>

* Cosmetics and remove redundancy

Signed-off-by: jannfis <jann@mistrust.net>
2020-11-16 20:30:36 +01:00
kshamajain99
69d8831b38 docs: improve description for API endpoint (#4821)
Signed-off-by: kshamajain99 <kshamajain99@gmail.com>
2020-11-16 09:03:15 -08:00
Jesse Suen
ad8715cbad feat: support argo-rollouts v0.10 (#4823)
Signed-off-by: Jesse Suen <Jesse_Suen@intuit.com>
2020-11-15 14:59:34 -08:00
jannfis
6cadaa2a5d chore: Update golang to v1.14.12 (#4832)
Signed-off-by: jannfis <jann@mistrust.net>
2020-11-15 09:33:46 -08:00
Oleg Sucharevich
8b1a118cdb docs: add codefresh (#4833)
Signed-off-by: Oleg Sucharevich <oleg2807@gmail.com>
2020-11-15 09:10:01 -08:00
Sven Walter
ccb7371047 fix: improve commit verification tolerance (#4825)
The `git verify-commit` output might have additional fields like
`issuer`. This change will make the parser skip the additional fields
instead of returning an error.

    gpg: Signature made Mon Aug 26 20:59:48 2019 CEST
    gpg:                using RSA key 4AEE18F83AFDEB23
    gpg:                issuer "j.doe@example.com"
    gpg: Can't check signature: No public key

This change is designed so it is easy to specify additional fields that
need to get skipped, by adjusting the regex.

Signed-off-by: Sven Walter <s.walter@rebuy.com>
2020-11-13 16:43:44 +01:00
Jesse Suen
2f72f3adad fix: sync hooks using generateName was using fixed timestamp suffix (#4787)
Signed-off-by: Jesse Suen <Jesse_Suen@intuit.com>
2020-11-13 01:18:15 -08:00
sethp-verica
ae17c70b00 docs: add Google SAML integration example (#4816)
Signed-off-by: Seth Pellegrino <seth@verica.io>
2020-11-12 14:18:48 -08:00
jannfis
5921feda5f chore: Cleanup Helm testdata after test (#4815)
Signed-off-by: jannfis <jann@mistrust.net>
2020-11-11 10:49:01 -08:00
Alexander Matyushentsev
71bd3fdd24 fix: add FIRST OCCURRED, LAST OCCURRED to events table (#4812)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-11-11 17:57:08 +01:00
Relk Li
30816bc549 docs: add WeMo Scooter to USERS.md (#4813)
Signed-off-by: Relk Li <YiJiun.Li.C@gmail.com>
2020-11-11 08:38:50 -08:00
Simon Rüegg
0681c2754a feat: Add health checks for Crossplane providers (#4778)
Signed-off-by: Simon Rüegg <simon@rueggs.ch>
2020-11-10 13:57:21 -08:00
William Tam
5040d6f080 fix: add roles to redis-ha service accounts to enable run-as non-root users in OpenShift (#4800)
Signed-off-by: William Tam <email.wtam@gmail.com>
2020-11-10 13:53:33 -08:00
William Tam
e3b733627f docs: Generate server command reference (#4795)
* Generate  server command reference docs
Signed-off-by: William Tam <email.wtam@gmail.com>

* Insert newline
Signed-off-by: William Tam <email.wtam@gmail.com>

* undo iinsert newline
Signed-off-by: William Tam <email.wtam@gmail.com>

Signed-off-by: William Tam <email.wtam@gmail.com>

* * Renane tab to `Server Configuration Parameters`
* Generate argocd-util command docs

Signed-off-by: William Tam <email.wtam@gmail.com>

* Tweak erver command  descriptions

Signed-off-by: William Tam <email.wtam@gmail.com>

* Minor tweaks to argocd-util command descriptions

Signed-off-by: William Tam <email.wtam@gmail.com>

* Move main_test.go to secrets_redactor_test.go into commands package
Signed-off-by: William Tam <email.wtam@gmail.com>

* Disable auto generation tag.

Signed-off-by: William Tam <email.wtam@gmail.com>
2020-11-10 20:01:11 +01:00
Jonathan West
be513e431a chore: Fix bulleted list in Global Projects section of projects (#4803)
Signed-off-by: Jonathan West <jonwest@redhat.com>
2020-11-10 19:34:26 +01:00
Xavier Krantz
5e24d21ae8 docs: Add Virtuo to USERS.md (#4805)
Virtuo (govirtuo.com) is officially using ArgoCD along with the other Argo projects to deploy to Kubernetes.

Signed-off-by: Xavier Krantz <xakraz@gmail.com>
2020-11-10 19:33:52 +01:00
Josh Soref
eec8f79923 fix: Clarify in multiple applications (#4769) (#4771)
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2020-11-09 10:21:24 -08:00
Ashley Manraj
d1ba640bff docs: add 3rein to users (#4797)
Signed-off-by: Ashley Manraj <ashley@3rein.com>
2020-11-09 10:11:40 -08:00
jannfis
7947b59eeb chore: Fix helm2 dependency tests (#4789)
Signed-off-by: jannfis <jann@mistrust.net>
2020-11-07 10:07:51 -08:00
Jonathan West
4c3f97f78a chore: Add a GitHub action that runs unit tests with -race to CI build (#4774) (#4775)
* chore: Add a GitHub action that runs unit tests with -race to CI build (#4774)

Signed-off-by: Jonathan West <jonwest@redhat.com>

* chore: Add a GitHub action that runs unit tests with -race to CI build (#4774)

Signed-off-by: Jonathan West <jonwest@redhat.com>
2020-11-07 12:57:18 +01:00
Alexander Matyushentsev
c4dcae3442 fix: improve project details page summary tab (#4782)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-11-06 16:00:45 -08:00
Jesse Suen
d1a36e5b6d feat: add new rollout actions (abort, retry, promote-full, terminate). improve health check (#4777)
Signed-off-by: Jesse Suen <jesse_suen@intuit.com>
2020-11-06 15:16:32 -08:00
kshamajain99
9c51838ccc Chore: Update broken link in conrtibution guide (#4785) 2020-11-06 14:44:45 -08:00
Hu Sheng
700a4104c6 docs: add openEuler, openGauss, openLooKeng, MindSpore to users (#4779) 2020-11-06 14:09:25 -08:00
William Tam
dcb5f07c23 docs: Add documentation to run redis-ha in OpenShift (#4759)
Signed-off-by: William Tam <email.wtam@gmail.com>
2020-11-06 14:00:10 -08:00
Josh Soref
9625e50ccd fix: Use ghost icon for unknown/missing permissions (#4730) (#4783)
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2020-11-06 12:29:10 -08:00
jannfis
3e19b2fdf1 chore: Update redis to 5.0.10 (#4767)
Signed-off-by: jannfis <jann@mistrust.net>
2020-11-05 13:58:26 -08:00
Amit Rout
96e0f0d3be docs: Add github reference to k3d in developer-guide (#4761)
Signed-off-by: arout <arout@redhat.com>
2020-11-05 13:57:59 -08:00
May Zhang
620e31e52d fix: From UI create or delete JWTToken, error "'metadata' of undefined" (#4766)
Signed-off-by: May Zhang <may_zhang@intuit.com>
2020-11-05 13:57:19 -08:00
Paweł Hajduk
ab7e1773f0 docs: Updated OneLogin documentation of clientSecret property (#4763) 2020-11-05 21:31:41 +01:00
Tim Etchells
e67d934827 docs: Add myself as reviewer (#4762)
Signed-off-by: Tim Etchells <tetchell@redhat.com>
2020-11-05 16:35:58 +01:00
Jonathan West
9ee0d2c6c0 docs: proposal to add jgwest as a reviewer (#4757)
Signed-off-by: Jonathan West <jonwest@redhat.com>
2020-11-04 20:40:44 -08:00
William Tam
9c684ddc08 Proposal to add wtam2018 as a reviewer (#4756)
* Add wtam2018 as a reviewer

* remove "P"  that  gets prepended
2020-11-04 18:06:21 -08:00
jannfis
c9f3c64a58 chore: Fail-fast in Makefile when not within $GOPATH (#4744)
Signed-off-by: jannfis <jann@mistrust.net>
2020-11-04 14:01:01 -08:00
jannfis
8c3a8e3655 docs: Remove deprecated warnig for local users (#4750)
Signed-off-by: jannfis <jann@mistrust.net>
2020-11-04 20:36:02 +01:00
May Zhang
449b50cf6c fix: failUnmarshal only checks for file resembles a resource (#4729)
* fix: failUnmarshal only checked for file contains information which has apiVersion, kind and metadata.

Signed-off-by: May Zhang <may_zhang@intuit.com>

* add negative test case

Signed-off-by: May Zhang <may_zhang@intuit.com>

* modified negative test data

Signed-off-by: May Zhang <may_zhang@intuit.com>

* modified negative test data

Signed-off-by: May Zhang <may_zhang@intuit.com>
2020-11-03 15:46:51 -08:00
Alexander Matyushentsev
da3ab59be0 refactor: upgrade helm to v3.4.0 (#4745)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-11-03 11:48:00 -08:00
Alexander Matyushentsev
e8f63d4583 feat: remove unnecessary fields from project creation panel (#4742)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-11-03 11:43:14 -08:00
Alexander Matyushentsev
cdb3df1077 fix: Argo CD should present the live object in the resource version in git (#4740)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-11-03 11:24:14 -08:00
Isaac Gaskin
858676c4f8 chore: helm2 verison bump (#4724)
* chore: helm2 verison bump
2020-11-03 11:22:14 -08:00
Josh Soref
44c31e278c Allow deny (#4293) (#4294)
* chore(ui): switch to using allow/deny (#4293)

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2020-11-03 10:54:13 -08:00
jannfis
a759601264 fix: Only verify GPG signatures on metadata requests when verification is enforced (#4741)
Signed-off-by: jannfis <jann@mistrust.net>
2020-11-03 18:43:02 +01:00
Alexander Matyushentsev
9bbbda55a4 fix: use fmt.Sprintf to format complex logging fields (#4739)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-11-03 08:41:08 -08:00
Alexander Matyushentsev
b97f4f7f8e fix: RevisionFormField component crashes in 'refs' API returns no tags (#4735)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-11-02 22:56:00 -08:00
phillip-ops
422a26e8d8 docs: add Opensurvey to USERS.md (#4727) 2020-11-02 14:16:44 -08:00
nahidupa
245e1ee636 docs: correct parameters usage in CLI (#4725)
Adding guestbook= before the value does not require. Removed that.
2020-11-02 14:16:09 -08:00
Jonathan West
2166fea351 fix: Repo-server has silent unmarshalling errors leading to empty applications (#4423) (#4708)
* fix: Repo-server has silent unmarshalling errors leading to empty applications (#4423)
2020-11-02 14:15:31 -08:00
Jesse Suen
dea75eb481 fix: inject artificial delay between sync waves to better support health assessments (#4715)
Signed-off-by: Jesse Suen <jesse_suen@intuit.com>
2020-11-02 12:17:43 -08:00
May Zhang
6ef89e3c09 fix: exclude files listed under exclusions (#4686)
* fix: exclude files listed under exclustions

* fix: add it to cli

* fix: update doc

* fix: added e2e test

* fix: fix merge conflicts

* fix: fix merge conflicts

* fix: fix merge conflicts

* use glob

* fix merge conflict

* fix rename the flag

* This is my commit message

Signed-off-by: May Zhang <may_zhang@intuit.com>

* -s
2020-11-02 08:46:02 -08:00
Jesse Suen
b9954e55ac feat: support resource actions on CRDs that use status subresources (#4690)
Signed-off-by: Jesse Suen <Jesse_Suen@intuit.com>
2020-11-02 02:09:05 -08:00
Tim Etchells
86031504af feat: Add autocomplete for repo Revisions (#4645) (#4713)
* feat: Add autocomplete for repo Revisions

- Introduces api/v1/repositories/{repo}/refs which returns branches and tags
- Add new RevisionFormField component to Create and Edit Application pages

Signed-off-by: Tim Etchells <tetchell@redhat.com>
2020-11-01 19:25:37 -08:00
Alexander Matyushentsev
97003caebc fix: webhook don't refresh apps pointing to HEAD (#4717) 2020-10-30 11:13:03 -07:00
J. Mark Pim
42ebb227e1 feat: Add support for ExecProvider cluster auth (#4600) (#4710) 2020-10-30 09:58:45 -07:00
John Pitman
c7f7631f2e fix: adding helm values file in New App (#4635)
Signed-off-by: John Pitman <jpitman@redhat.com>
2020-10-30 09:47:14 -07:00
Dewan Ahmed
9cdfe40faf docs: Instructions on make verify-kube-connect step when using k3d (#4687) 2020-10-30 09:07:13 -07:00
Alexander Matyushentsev
21304ee2c5 feat: Annotation based app paths detection in webhooks (#4699)
* feat: Annnotation based app prefix detection in webhooks

* webhook should copy previously generated manifests cache if new commit does not introduce any changes

* use 'argocd.argoproj.io/manifest-generate-paths' annotation to specify paths

Co-authored-by: Carson Anderson <ca@carsonoid.net>
2020-10-29 13:17:54 -07:00
Isaac Gaskin
7f0ffb4cd2 fix: adding commonAnnotations for Kustomize (#4613)
* fix: adding commonAnnotations

optional k/v map to add annotations via kustomize

* fix: adding kustomize common annotations

also correcting kustomize cli flags to respect multiple options

#4613
2020-10-29 19:12:55 +01:00
Darshan Chaudhary
22e0b4ff55 fix: add flag to indicate end of logs (#4696)
Signed-off-by: darshanime <deathbullet@gmail.com>
2020-10-29 09:37:59 -07:00
Tim Etchells
0767dff025 feat(ui): Improve UX when filtering applications (#4403) (#4622)
* feat: Improve UX when filtering applications

- When application filters are active, show a badge with # filters and a button to clear them
- When no matching applications are found, provide a button to clear filters
- Styling updates to application filters UI

Signed-off-by: Tim Etchells <tetchell@redhat.com>
2020-10-29 09:08:45 -07:00
Keith Chong
5ba8710ff1 docs: Describe Argo UI dependency changes in dependencies.md (#4698) (#4702)
Signed-off-by: Keith Chong <kykchong@redhat.com>
2020-10-29 08:56:00 -07:00
jannfis
dde5f143fc chore: Fix failing unit test for TestGetIstioVirtualServiceInfo (#4711) 2020-10-29 08:38:06 -07:00
William Tam
f02115af15 fix: add argocd-redis SA to nonroot security context constraint (#4660) 2020-10-28 16:30:09 -07:00
Omer Kahani
cd302fd055 feat: add Istio virtual service to the network view - part of #4675 (#4677) 2020-10-28 16:24:06 -07:00
Remington Breeze
cfd59aded2 fix(ui): stack overflow crash of resource tree view for large applications (#4685) 2020-10-28 15:57:16 -07:00
May Zhang
dd856e1c2b feat: Util for generate global project from ClusterRole (#4653)
* feat: Util for generate global project from ClusterRole

* feat: fix lint error

* feat: fix test failure

* fix lint

* fix lint error

* moved into sub command and removed not needed fields.

* updated error package

* rename files
2020-10-27 16:54:47 -07:00
Shuwei Hao
387f775f4a feat: Support oci-based helm repository (#4018)
* feat: Support oci-based helm repository

Signed-off-by: haoshuwei <haoshuwei24@gmail.com>
2020-10-27 15:37:42 -07:00
Jason
837ed45361 docs: Clarify where hook manifests go (#4659) 2020-10-27 14:59:32 -07:00
Keith Chong
46ee2f21a2 fix: Automated smoke test that mimics user behavior UI (#4393) (#4683)
Signed-off-by: Keith Chong <kykchong@redhat.com>
2020-10-27 14:55:10 -07:00
Josh Soref
3bf9deb15e chore: Remove newline from new issue template (#4681)
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2020-10-27 14:14:44 -07:00
Alexander Matyushentsev
a96b476f16 refactor: upgrade gitops-engine version ( breaking API changes related to logr mirgation ) (#4652) 2020-10-27 14:10:24 -07:00
Tim Etchells
764ea07fc0 feat: Add 'proj role list-tokens' command (#4674)
Signed-off-by: Tim Etchells <tetchell@redhat.com>
2020-10-27 12:56:37 -07:00
Marco Londero
6ddd98c4f8 docs: add tru.ID to USERS (#4672) 2020-10-27 09:20:29 -07:00
Tim Etchells
be60425a47 feat(cli): Add ID option to 'proj role create-token' (#4632) (#4636)
* feat: Add ID option to 'proj role create-token'

Also add some more informative output to the same command

Signed-off-by: Tim Etchells <tetchell@redhat.com>

* Parse token on client side, add --token-only flag

Signed-off-by: Tim Etchells <tetchell@redhat.com>
2020-10-27 08:25:07 +01:00
Alexander Matyushentsev
0850bcc184 fix: application list page crash if app referencing not configured cluster URL (#4671) 2020-10-26 17:43:46 -07:00
Alexander Matyushentsev
aaae4003a0 fix: fix nil pointer error in Argo CD repo server (#4668) 2020-10-26 15:29:30 -07:00
jannfis
6535d1ac34 chore: Change log level in updateClusters() from info to debug (#4667) 2020-10-26 14:07:34 -07:00
Adrian Ludwin
81b84e66c1 docs: Remove obsolete instructions for GKE (#4658) 2020-10-26 14:03:47 -07:00
Alexander Matyushentsev
5fdbe2057a feat: support generating manifests for the same commit in parallel (#4625) 2020-10-26 13:32:18 -07:00
Tim Etchells
ac8d18d39d chore: Update developer guide docs (#4664)
- Remove references to CircleCI
- Move info for troubleshooting CI builds into ci.md
- Add 'gofmt' note to Lint CI check failing
- Add note about generated code to FAQ

Signed-off-by: Tim Etchells <tetchell@redhat.com>
2020-10-26 19:48:43 +01:00
May Zhang
3d39accdb2 feat: Global Project UI (#4587)
* feat: Global Project UI

* feat: fixing compile error

* feat: rename import

* feat: Fixing TypeError: Cannot read property 'spec' of undefined when editing existing fields of project.

* feat: Fixing lint error.

* feat: Fixed issue when editing project fields, virtual project had stale info

* feat: fixing lint

* feat: add GetGlobalProjects

* feat: fixing swagger conflict.

* feat: fixing undefined.

* feat: update swagger.json

* feat: update doc

* feat: update doc

* feat: update doc with version number

* Load project and global projects in parallel

* feat: hide global project info.

* feat: lint

* feat: fixed edit issue

* feat: dedup

* feat: fix lint error

Co-authored-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-10-26 10:39:39 -07:00
Chetan Banavikalmutt
4d643a151d feat: Include cluster name in application filter (#4529) 2020-10-23 18:54:10 -07:00
Marcel Hoyer
41ab92fbdd docs: Fix broken 'Dex Connectors' link (#4647)
The documentation of Dex was materialized to https://dexidp.io/docs/ in the meantime.
2020-10-23 12:08:01 -07:00
Jonathan West
2e06118792 fix: Data race between processAppRefreshQueueItem and processAppOperationQueueItem, in appcontroller.go (#4643) (#4644) 2020-10-23 12:05:41 -07:00
Tim Etchells
bbfbf6834f fix: Add tooltips to Role JWTs view (#4642)
- Improve error message for invalid 'Expires In'
- Remove extra space next to 'Create' button

Signed-off-by: Tim Etchells <tetchell@redhat.com>
2020-10-23 19:43:34 +02:00
Mike Bryant
c7dbe4883b feat: Add additional printer columns for Health and Sync status (#4641) 2020-10-22 14:07:05 -07:00
Jaideep Rao
bdee71d4c7 fix: Pick up correct commit SHA when using annotated git tags (#4231) (#4538) 2020-10-22 13:06:36 -07:00
lonfme
9af729c738 fix: ssh repo url match failed when webhook github http custom port (#4532) 2020-10-22 13:05:05 -07:00
Josh Soref
c0f9c9ae93 chore(ui): Login page link should be "Log in" (the verb phrase) (#4611) (#4612)
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2020-10-22 09:57:48 -07:00
yutachaos
dfc75df7a0 docs: Update USERS.md (#4638)
add Quipper
2020-10-22 09:38:23 -07:00
Jean-Luc Geering
cf03c1dcc5 docs: Update USERS.md (#4630)
add UFirstGroup
2020-10-21 20:47:06 +02:00
jannfis
7824a1fc2b chore: Upload e2e server component logfiles to GH action on failures (#4565) 2020-10-21 07:59:24 -07:00
Josh Soref
5db8d97bf0 chore: Update swagger docs (#4610) (#4616)
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2020-10-20 20:28:57 +02:00
Josh Soref
05c493b3a6 Spelling (#4596) 2020-10-19 18:21:06 -07:00
William Tam
894f95dce5 docs: Add generated argocd command docs (#4606) 2020-10-19 17:30:32 -07:00
Vincent Gilles
90227f226d docs: describe application creation from helm repository in declarative setup documentation (#4463) (#4597) 2020-10-19 11:21:50 -07:00
jannfis
fd482316d0 fix: Serve ReDoc JS from Argo CD server instead of from CDN (#4594)
* fix: Serve ReDoc JS from Argo CD server instead of from CDN

* refactor: dynamically copy redoc.standalone.js from npm module

Co-authored-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-10-19 20:01:45 +02:00
Tim Etchells
c620fa7aaa fix: only bundle the yaml language for Monaco (#4582)
Signed-off-by: Tim Etchells <tetchell@redhat.com>
2020-10-19 10:59:21 -07:00
jannfis
a0f6e033c0 chore: Replace deprecated commands for release action (#4593) 2020-10-19 10:40:39 -07:00
jannfis
15b0a6e793 chore: Replace deprecated GH actions directives for integration tests (#4589)
* chore: Replace deprecated set-env directives

* revert lint version change

* Revert go.mod and go.sum changes

* Fix typo

* Update golangci-lint-action to v2

* Fix golangci-lint version

* Skip new lint complaints in test

* Skip more new lint complaints in test

* Exclude new SA5011 check in lint
2020-10-17 09:03:57 +02:00
Jason DeWitt
3408e2d72d docs: Add clarification on the initial password to Getting Started guide 2020-10-16 14:10:48 -07:00
Victor Boissiere
e09cacba65 docs: Add new company to user list (#4588) 2020-10-16 15:35:56 +02:00
Ricardo Contreras
66d86fe56f docs: update upgrading overview doc to include missed versions (#4592)
add missing links to 1.5->1.6 and 1.6->1.7 upgrades notes.
2020-10-16 15:35:02 +02:00
Tim Etchells
67c91564c4 fix: don't re-pull fonts on each webpack build (#4584)
Signed-off-by: Tim Etchells <tetchell@redhat.com>
2020-10-15 19:32:00 -07:00
jannfis
698712f396 fix: Make gpg watcher re-creation more robust (#4580) 2020-10-15 15:20:37 -07:00
Alex Gervais
001d990d0c docs: Add documentation for Ambassador ingress options (#4575) 2020-10-15 13:56:55 -07:00
Remington Breeze
1cbada9d86 fix(ui): UI crash when ksonnet app has no environments (#4566) 2020-10-15 11:20:54 -07:00
Chetan Banavikalmutt
dff7da7271 fix: Infer destination server when latest version of app is fetched (#4574) 2020-10-15 08:57:18 -07:00
Alexander Matyushentsev
12957a494c chore: fix flaky TestFinalizeAppDeletion/ErrorOnBothDestNameAndServer test (#4571) 2020-10-15 13:22:06 +02:00
Jonathan West
4f1e371830 fix: Data race in SettingsManager.GetRepositoryCredentials() (#4561) (#4562) 2020-10-15 13:18:38 +02:00
Alexander Matyushentsev
8e11facb94 refactor: upgrade gitops-engine version ( #4354, #1787 ) (#4563) 2020-10-14 14:05:09 -07:00
Kevin McDermott
61c8f73e21 Don't parse empty strings as maps in settings. (#4556)
There's a bug in the resource inclusions parsing, if the string is "" then it's
parsed as a map, which returns nil, and so it fails when adding elements later.
2020-10-14 12:15:58 -07:00
May Zhang
23ac24bdea fix: login with apiKey capability (#4557)
* fix: login with apiKey capability

* fix: update based on code review.

* fix: update based on code review.

* fix: check pws first.
2020-10-14 11:31:35 -07:00
Alexander Matyushentsev
e6f116319b fix: editing Clusers in the UI drops credentials from the secret (#4553) 2020-10-14 10:45:58 -07:00
Chetan Banavikalmutt
5fa808a788 fix: Infer cluster URL while deleting app resource (#4559)
An application can be created by specifying only cluster name. Since cluster URL is used for queries, it should inferred. ValidateDestination() method will infer the cluster URL if cluster name is present.

Fixes: #4534
2020-10-14 10:32:41 -07:00
Jonathan West
6d64280fba fix: Data race in SettingsManager.GetRepositories(), via util/db unit tests (#4550) (#4551) 2020-10-14 15:16:22 +02:00
William Tam
3ae1d13dfd refactor: update gitops engine version (issue #1816) (#4552) 2020-10-13 21:22:36 -07:00
May Zhang
f512d213cf feat: global project (#4506)
* feat: global project

* feat: revert back argocd-cm.yaml

* feat: remove commented code.

* feat: check err

* feat: corrected comments.

* feat: merge sync windows

* feat: getProject

* feat: fix lint error

* feat: update existing test case

* feat: minor comments

* feat: Fixed for sync window which is also called from API server.

* feat: fix application tests

* feat: block by sync window

* feat: test using sync window

* feat: updated based on code review

* feat: fixed comment
2020-10-13 15:12:05 -07:00
Viktor Farcic
35914ff7ab docs: YouTube video on how to create PR (preview) environments with Argo CD (#4544) 2020-10-13 14:13:22 -07:00
William Tam
48891e2536 chore: rename cli-docker -> cli-argocd (#4527) 2020-10-13 14:05:23 -07:00
Jonathan West
a88c729148 fix: Data races detected while running 'server/application' unit tests (#4546) (#4547) 2020-10-13 13:49:45 -07:00
jannfis
c8ca3e7c45 chore: Run e2e tests against different K8s versions (#4444) 2020-10-13 13:37:05 -07:00
Alexander Matyushentsev
2a0012d5f1 refactor: upgrade k8s client to v0.19.2 (#4545) 2020-10-13 13:01:26 -07:00
William Tam
fd483babb7 docs: replace deployment with statefulset (#4531) 2020-10-13 11:30:21 -07:00
Tim Etchells
52f4ed203f fix: Revert "fix: webpack-dev-server proxy hostname (#4515)" (#4530)
This reverts commit 8eb3306064.
2020-10-11 08:16:20 -07:00
Alexander Matyushentsev
497cd603ca docs: clarify project RBAC management documentation (#4526) 2020-10-09 16:51:14 -07:00
Adam Blackwell
97f094756d Add edX to USERS (#4524) 2020-10-09 16:17:03 -07:00
Alexander Matyushentsev
5cdcca4544 fix: bump cache version to avoid nil pointer error (#4525) 2020-10-09 16:16:38 -07:00
Jonathan West
d479d22de7 feat: Failed manifest generation protection (#4238) (#4430) 2020-10-09 13:47:31 -07:00
Alexander Matyushentsev
303925f4a0 feat: Support controller horizontal scaling (#4285) 2020-10-09 13:16:54 -07:00
Tim Etchells
8eb3306064 fix: webpack-dev-server proxy hostname (#4515)
Switching the hostname from 'localhost' to the ipv6 '[::1]' fixes the dev server proxy

https://github.com/webpack/webpack-dev-server/issues/793#issuecomment-316650146

Signed-off-by: Tim Etchells <tetchell@redhat.com>
2020-10-09 12:55:28 -07:00
Keith Chong
9f2eab665b fix: Summary legend overflow view (#4523)
Signed-off-by: Keith Chong <kykchong@redhat.com>
2020-10-09 12:08:33 -07:00
Alexander Matyushentsev
3ac0bc36d4 fix: api-server should not try creating default project it is exists already (#4517) 2020-10-09 10:17:00 -07:00
Timothy OBrien
2b84672641 docs: minor spelling fix to azure sso docs (#4518) 2020-10-09 09:45:48 -07:00
Timothy OBrien
701dda9a28 docs: Add documentation for Microsoft Azure AD SAML SSO (#4509) 2020-10-08 14:15:15 -07:00
Alexander Matyushentsev
8995d0405a fix: JS error on application list page if app has no namespace (#4499) 2020-10-07 11:41:21 -07:00
May Zhang
286f98ba82 feat: autosync protection (#4475)
* feat: autosync protection

* feat: autosync protection - update doc

* feat: autosync protection - update doc with version
2020-10-06 21:10:50 -07:00
Masaya Ozawa
10f68dde2d use resources (#4495)
https://kubernetes-sigs.github.io/kustomize/api-reference/kustomization/bases/
2020-10-06 16:25:01 -07:00
Tim Etchells
5592150f18 feat: Add version information panel (#4312) (#4376) 2020-10-06 12:03:25 -07:00
Keith Chong
7af7f30715 docs: Format issue in documentation site for dependencies.md (#4491) (#4496)
Signed-off-by: Keith Chong <kykchong@redhat.com>
2020-10-06 20:33:53 +02:00
Keith Chong
4534bd2725 docs: Add developer docs for gitops-engine changes (#4492)
Signed-off-by: Keith Chong <kykchong@redhat.com>
2020-10-06 19:31:57 +02:00
Chetan Banavikalmutt
95d19cdcca feat: Add labels to list view icons(#4396) (#4493)
The icons present in the list view should have labels similar to the icons in tree view

Fixes: #4396
2020-10-06 12:59:17 +02:00
Alexander
05b70f1e97 docs: add TableCheck to users (#4494)
Signed-off-by: Alexander Nicholson <4584443+DragonStuff@users.noreply.github.com>
2020-10-06 12:28:32 +02:00
Jean-François Roche
da57c9f1c8 docs: declare where to add the annotation (#4490)
We got bitten by thinking that this annotation could possibly added to the application to exclude all extraneous resources (see #4487).
The annotation must be added to the resource we wish to exclude.
2020-10-06 08:12:35 +02:00
Keith Chong
287e8cffdb refactor: fix: update gitops engine version (issue #3781) (#4489)
Signed-off-by: Keith Chong <kykchong@redhat.com>
2020-10-05 15:22:37 -07:00
Satoshi Inoue (butter)
f93da5346c docs: add VISITS Technologies to users (#4485) 2020-10-05 10:40:11 +02:00
Maxime Brunet
aefa739169 feat: Upgrade Dex to v2.25.0 (#4470) 2020-10-05 09:02:49 +02:00
k.bigwheel
3123c00a85 docs: Added Speee to USERS list (#4484) 2020-10-05 08:57:34 +02:00
Liviu Costea
efb7028d84 docs: Add instructions for cli installation on Windows #4481 (#4482)
* docs: Add instructions for cli installation on Windows

* docs: Remove chocolatey until it is part of the release
2020-10-05 08:53:33 +02:00
Isaac Gaskin
3848f64807 fix(info.go): omitting wildcard paths from controller cache (#4479)
edge case where /* should not be appended to path
2020-10-05 08:36:26 +02:00
Chance Zibolski
5af0c5ad3a fix: reposerver: Set GRPC max message size (#4472) 2020-10-02 13:53:29 -07:00
jannfis
24927c4d4f docs: Fix broken link to user guide (#4477) 2020-10-02 09:33:08 -07:00
John Pitman
91e62bfc3b fix: fix broken docker build of argocd-test-tools image (#4471)
Signed-off-by: John Pitman <jpitman@redhat.com>
2020-10-01 13:56:32 -07:00
Dewan Ahmed
b08f895d9a chore: removing circleci since we're moved to GitHub Actions (#4469) 2020-10-01 13:54:41 -07:00
dependabot[bot]
3409e0728f chore(deps): bump node-sass from 4.12.0 to 4.13.1 in /ui (#4267)
Bumps [node-sass](https://github.com/sass/node-sass) from 4.12.0 to 4.13.1.
- [Release notes](https://github.com/sass/node-sass/releases)
- [Changelog](https://github.com/sass/node-sass/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sass/node-sass/compare/v4.12.0...v4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-10-01 01:08:44 -07:00
dependabot[bot]
dd63715017 chore(deps): bump http-proxy from 1.17.0 to 1.18.1 in /ui (#4286)
Bumps [http-proxy](https://github.com/http-party/node-http-proxy) from 1.17.0 to 1.18.1.
- [Release notes](https://github.com/http-party/node-http-proxy/releases)
- [Changelog](https://github.com/http-party/node-http-proxy/blob/master/CHANGELOG.md)
- [Commits](https://github.com/http-party/node-http-proxy/compare/1.17.0...1.18.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-10-01 00:51:39 -07:00
dependabot[bot]
0d2fc86330 chore(deps): bump handlebars from 4.1.2 to 4.7.6 in /ui (#4271)
Bumps [handlebars](https://github.com/wycats/handlebars.js) from 4.1.2 to 4.7.6.
- [Release notes](https://github.com/wycats/handlebars.js/releases)
- [Changelog](https://github.com/handlebars-lang/handlebars.js/blob/master/release-notes.md)
- [Commits](https://github.com/wycats/handlebars.js/compare/v4.1.2...v4.7.6)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-10-01 00:49:34 -07:00
Alexander Matyushentsev
8299e99049 refactor: upgrade dependencies and node version (#4461) 2020-09-30 23:02:48 -07:00
John Pitman
7b60548e8a fix: switch monkeypatching implementation (#4462)
Signed-off-by: John Pitman <jpitman@redhat.com>
2020-09-30 14:02:18 -07:00
Jacek Wysocki
0226190ef4 docs: Add kinguin to USERS.md (#4458) 2020-09-30 13:54:57 -07:00
Carson A
25823a4625 feat: Add external link annotation support (#4380)
Example implementation of https://github.com/argoproj/argo-cd/issues/3487
2020-09-30 07:39:10 +02:00
May Zhang
712df19fac feat: add labels for projects (#4446)
* add labels for projects

* feat: add labels for projects

* feat: add labels for projects
2020-09-29 21:35:31 -07:00
jmpcyc
bccaefdac9 delete duplicate code (#4449) 2020-09-29 21:29:33 -07:00
Tim Etchells
53d50df001 fix: prevent sync error overflowing (#4453)
Also make the 'sync status' help icon clickable to view sync status

Signed-off-by: Tim Etchells <tetchell@redhat.com>
2020-09-29 17:33:37 -07:00
Alexander Matyushentsev
8b2e05c20d fix: remove redundant check from EditablePanel control (#4436) 2020-09-28 08:51:07 -07:00
Alexander Matyushentsev
9bb9c19e67 fix: show error message if unable to terminate operation (#4437) 2020-09-28 08:50:50 -07:00
Alexander Matyushentsev
6b106768a5 refactor: update gitops engine version (issues #4329, #4298) (#4434) 2020-09-25 16:09:09 -07:00
Josh Soref
4810874348 feat(ui): widgets don't have tooltips (#4257) (#4422)
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2020-09-25 09:50:19 -07:00
Alexander Matyushentsev
d96083c293 fix: bump cache version due to redis compression feature (#4421) 2020-09-25 09:44:34 -07:00
Alexander Matyushentsev
f815c96605 docs: add 'helm.parameters.forceString' example to application.yaml (#4431) 2020-09-25 09:42:34 -07:00
Remington Breeze
4347a3c0ad feat(ui): Migrate project summary settings to EditablePanel for parity with rest of UI (#4400) 2020-09-24 13:40:03 -07:00
Josh Soref
3f7d60018f feat(ui): widgets don't have tooltips (#4257) (#4261) 2020-09-24 13:29:57 -07:00
Keith Chong
b7c2002a11 feat: Progress indicators in Argo CD UI (#4227) (#4411)
Signed-off-by: Keith Chong <kykchong@redhat.com>
2020-09-24 09:16:32 -07:00
Sayak Mukhopadhyay
c1ee89b502 docs: Changed docs for Helm to clarify the location of values files. (#4417)
Also did a grammar pass.
2020-09-24 10:36:44 +02:00
Viktor Farcic
74f5043e87 docs: 20 min video (#4390) 2020-09-23 17:22:52 -07:00
May Zhang
fbfa89d358 fix: Support transition from a git managed namespace to auto create (#4401)
* fix: Support transition from a git managed namespace to auto create

* fix: Support transition from a git managed namespace to auto create
2020-09-22 17:38:55 -07:00
Josh Soref
1c95c90a2d fix(ui): center icon tiles in list view (#4262) (#4266) 2020-09-22 13:04:42 -07:00
bukbuk1231
9f47a11621 feat: display k8s object CREATED_AT time in local time instead of UTC (#4347) (#4383)
* feat: display k8s object CREATED_AT time in local time instead of UTC

* fix linting issues
2020-09-21 16:28:05 -07:00
Chetan Banavikalmutt
e28a3e5ed0 fix: Cluster remove should return an error for unknown cluster name (#4366) 2020-09-21 13:56:21 -07:00
Johan Sandström
52cae98705 fix: add no log init flag to useradd (#4379)
This commit fixes an error where the underlaying disk would get
filled up when running make test-tools-image and the user running
it are running with a big UID.

Adding --no-log-init or -l will prevent useradd from trying to make
sure that there are is room for the user in lastlog and faillog.
2020-09-21 10:58:24 +02:00
Alexander Matyushentsev
3850e80040 fix: swagger UI stuck loading (#4377) 2020-09-18 15:39:56 -07:00
Jonathan West
989f5c80c6 fix: Sync Window status in argocd CLI is not matched with argocd UI for same sync window (#3831) (#4372) 2020-09-18 23:08:25 +02:00
Sayak Mukhopadhyay
82340a0740 Fixed padding issues with application list in cards and row view (#4364) 2020-09-18 10:38:03 -07:00
Alexander Matyushentsev
28e60406a8 fix: prevent 'argocd app sync' hangs if sync is completed too quickly (#4373) 2020-09-17 16:21:25 -07:00
Alex Collins
eb0d018c31 chore: Upgrade to pkg v0.2.0 (#4356) 2020-09-17 14:05:27 -07:00
William Tam
850de2021a Add documentation checkboxes in PR template (#4371) 2020-09-17 12:58:31 -07:00
Josh Soref
b8d1b9bbc0 fix: Reword application is healthy (#4336) (#4357)
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2020-09-17 21:33:30 +02:00
John Pitman
7caa2106ef fix: 'prettier' error from tslint (#4368)
Signed-off-by: John Pitman <jpitman@redhat.com>
2020-09-17 21:32:26 +02:00
Herrmann Hinz
24b5c1e34d Update app_deletion.md (#4365)
kubectl command typo
2020-09-17 09:01:29 -07:00
Keith Chong
3aa0748c70 fix: Add tooltip for application tile detail labels (#4341) (#4343)
* [4341] Add tooltip for application tile labels

* fix: Add tooltip for application tile detail labels (#4341)

Signed-off-by: Keith Chong <kykchong@redhat.com>
2020-09-16 19:28:05 -07:00
Josh Soref
1462ab3c06 Improve release docs (#4346)
Mention bumping `VERSION` on master

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2020-09-16 19:09:55 -07:00
Alexander Matyushentsev
5de3a302fb fix: argocd app wait/sync might stuck (#4350) 2020-09-16 19:03:48 -07:00
jheyduk
14fa7f954c fix: application external url falsely uses backend servicePort (#4339)
* fix: application external url falsely uses backend servicePort #2318

Use https if spec.tls is specified for the related host. Otherwise use http

* refactor / add new test
2020-09-16 16:18:28 -07:00
Alexander Matyushentsev
1b3d7a02e1 fix: failed syncs are not retried soon enough (#4353) 2020-09-16 13:39:18 -07:00
Jonathan West
eb13305984 fix: Log output stops if message is too long (#3258) (#4334) 2020-09-15 14:10:52 -07:00
Josh Soref
3a30a4fc74 chore: change version to 1.8.0 (#4340)
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2020-09-15 13:57:35 -07:00
John Pitman
d4ddd51602 fix: create valid spec for project policy (#4332)
Signed-off-by: John Pitman <jpitman@redhat.com>
2020-09-15 11:07:38 -07:00
Isaac Gaskin
95eda65759 fix(applications-table.tsx): adding "name" to Cluster (#4317)
this corrects the "destination" of the table view of applications if they use
app.spec.destination.name instead of app.spec.destination.server
2020-09-15 11:03:07 -07:00
Gagan Hegde
c26573369d Add status badge for project #4001 (#4301)
* The status badge for the project has been added : //Sample url: http://localhost:8080/api/badge?project=default, creates a badge with the health and sync status
2020-09-15 09:55:32 -07:00
Josh Soref
c91acc0673 chore: spelling: will (#4292)
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2020-09-15 09:54:23 -07:00
Joost VdC
51a5795b44 Update understand_the_basics.md (#4299)
link to kubernetes course is outdated
2020-09-15 09:54:12 -07:00
William Tam
9aae99cf7f fix: Only processes need root uid will run as root inside test container (#4210)
* Add  "chown" to gpg/keys  in "start-local" target that so that repo-server can access gpg keys.

* * Set -u uid:gid in the docker run commands  so that test images are run under the current user.
* test Procfile processes will not need to perform "su"  to  default user (which has the current user's uid/gid)

* Remove chown in start-e2e-local

* clean up, remove  "bash -c"

* Test containers are run as uid 0 which allows uid_entrypoint.sh  to perform some user setup.  uid_entrypoint.sh creates a non-root user (default) and enables passwordless sudo for that user.    The container entry point command is run as the non-root user.   "goreman start"  does "sudo" to to the processes that need root permission including sshd, fcgiwrap, and nginix.   The other processes are running as the non-root user.

* use /bin/bash

* change back to sh

* Docker image to create  unpriveleged testuser and enable passwordless sudo for that user
2020-09-15 11:32:16 +02:00
Chetan Banavikalmutt
5f680d6cec fix: Log an error when invalid token exists (#4318)
Instead of returning an error for invalid token and thereby breaking API requests for all users, print the error to the logs.

Fixes: #4156
2020-09-14 23:18:51 -07:00
Tim Etchells
28a76352c5 fix: Add tooltips to sync result table (#4310)
Bug #4234

Signed-off-by: Tim Etchells <tetchell@redhat.com>
2020-09-14 17:45:14 -07:00
May Zhang
cfb925c0d4 fix: app create with -f should not ignore other options (#4322) 2020-09-14 15:29:45 -07:00
Isaac Gaskin
4e6d8cc1d2 fix(logging.go): changing marshaler for JSON logging to use gogo (#4319)
* fix(logging.go): changing marshaler for JSON logging to use gogo

grpc-gateway json marshaler breaks with gogo protos

#4117

* Retrigger CI pipeline
2020-09-14 15:15:31 -07:00
Alexander Matyushentsev
f215233af4 fix: limit concurrent list requests accross all clusters (#4328) 2020-09-14 14:45:02 -07:00
Chance Zibolski
b1e3036bc2 chore: Update helm3 to 3.3.1 (#4323) 2020-09-14 14:28:33 -07:00
Alexander Matyushentsev
df4002a987 fix: fix flaky TestTrackAppStateAndSyncApp e2e test (#4325) 2020-09-14 11:45:59 -07:00
Tim Etchells
96035d3b51 fix: Bundle google font into webpack build (#4324)
Signed-off-by: Tim Etchells <tetchell@redhat.com>
2020-09-14 10:35:17 -07:00
Alexander Matyushentsev
89ee234634 fix: fix possible deadlock in /v1/api/stream/applications and /v1/api/application APIs (#4315) 2020-09-11 20:39:58 -07:00
Alexander Matyushentsev
ff2aa41539 fix: WatchResourceTree does not enforce RBAC (#4311) 2020-09-11 11:14:08 -07:00
Alexander Matyushentsev
85b27e6deb fix: app refresh API should use app resource version (#4303) 2020-09-11 10:26:45 -07:00
Alexander Matyushentsev
d60486fb47 fix: use redis pub-sub with correct context (#4300) 2020-09-10 09:57:32 -07:00
jannfis
41ca6b2ada chore: Upgrade installation manifests & codegen to Kustomize 3 (#3347)
* Use kustomize v3 to build ArgoCD manifests

* Update to test-tools-image v0.3.0

* Reorder patches so Kustomize v3 will properly find targets

* adding back these changes

* Use the generated files.

* changed the namespace

* changed kustomize version to 3.8.1 to be in sync with the one in tool-version.sh

* revert changes in makefile

* Re-run codegen

Co-authored-by: Zhang <may_zhang@intuit.com>
Co-authored-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-09-09 15:31:33 -07:00
Alexander Matyushentsev
d9f4e224a0 fix: use informer instead of k8s watch to ensure app is refreshed (#4290) 2020-09-09 13:08:18 -07:00
Naoto Enokawa
29c1095a2d docs: Fix typo (#4287) 2020-09-09 08:40:59 -07:00
William Tam
0473ed8104 doc: fix typo "make lint-ui" (#4283)
There is no target "ui" in the Makefile.   The documentation should read "lint-ui".
2020-09-08 13:28:06 -07:00
Joseph Petersen
706205958c fix containers syntax (#4277) 2020-09-08 13:06:25 -07:00
Hyungrok Kim
e5dde6eefc docs: Add Toss to USERS.md (#4282) 2020-09-08 12:19:17 -07:00
Sayak Mukhopadhyay
aa2762a9b7 fix: Added cluster authentication to AKS clusters (#4265) 2020-09-07 19:53:33 -07:00
Niketh Sabbineni
6959f032f0 Update USERS.md (#4274)
Added sumologic to the list of companies
2020-09-05 10:33:07 -07:00
Alexander Matyushentsev
1dfe670d1c fix: revert accidental changes from PR #4250 (#4263) 2020-09-04 16:02:36 -07:00
Alexander Matyushentsev
76782a0270 fix: automatically stop watch API requests when page is hidden (#4269) 2020-09-04 14:36:47 -07:00
dherman
b3be910465 perf: upgrade redis deps to enable compression (#4259)
Newer versions of the redis go libraries include built-in support for
compression of values going to and from redis.  Since the controller
is extremely chatty and makes heavy use of redis for caching, this
reduces the amount of bandwidth requires significantly.

This change should be backwards compatible since the redis libraries
detect whether or not compression was used and does not error in the
no compression case.

Fixes #4256
2020-09-04 13:59:59 -07:00
Alexander Matyushentsev
34c4aa42d6 fix: upgrade gitops-engine dependency (issues #4242, #1881) (#4268) 2020-09-04 13:58:56 -07:00
Alexander Matyushentsev
89ebf5a906 fix: application stream API should not return 'ADDED' events if resource version is provided (#4260) 2020-09-03 22:13:49 -07:00
Alexander Zigelski
bae5f93590 Migrate to Homebrew Core (#3978) (#3979)
* Update Homebrew formula instructions and CI

* docs: Migrate homebrew formula to homebrew-core
2020-09-03 14:44:55 -07:00
Tianxin Dong
8f7eabefd4 docs: Fix typo in documentation (#4254) 2020-09-03 14:03:48 -07:00
Takahiro Tsuruda
8fa2c7f43f docs: add Nikkei to user list (#4253)
Signed-off-by: TakahiroTsuruda <isrgnoe@gmail.com>
2020-09-03 14:02:41 -07:00
Rael Garcia
d3eb8e9590 docs: add list format to the cluster namespaces field (#4237) 2020-09-03 14:01:57 -07:00
Mikhail Mazurskiy
ad38421b76 fix: return parsing error (#3942)
Don't assume that a file is not a Kubernetes
resource if there was no previous objects parsed
2020-09-03 10:14:18 -07:00
Alexander Matyushentsev
92bbcf15e8 fix: JS error when using cluster filter in the /application view (#4247) 2020-09-03 10:13:52 -07:00
Josh Soref
10dc3ac12a fix: Pending deletion tooltip includes trailing semicolon ; (#4250) (#4251) 2020-09-02 21:43:50 -07:00
Alexander Matyushentsev
2f5e45490c fix: improve applications list page client side performance (#4244) 2020-09-02 15:37:37 -07:00
James Callahan
e10c20f683 chore: update to kustomize 3.8.1 (#4130) 2020-09-02 14:01:35 -07:00
Shoubhik Bose
bc537c1e87 docs: improve serviceability terminology (#4240) 2020-09-02 11:18:24 -07:00
Dan Garfield
a482546112 Add CNCF talk to list of resources (#4241)
This is a talk Codefresh did with the CNCF in July, it's been one of the most popular talks on their platform (top 10 for august). Huzzah!
2020-09-02 11:17:31 -07:00
Alexander Matyushentsev
7ead93458e fix: application details page crash when app is deleted (#4229) 2020-09-01 15:25:13 -07:00
May Zhang
dc6d88950c Doc: updated doc for namespace-install (#4199) 2020-09-01 15:08:36 -07:00
Darshan Chaudhary
c44074d4d6 fix: allow clusters to include resources independently (#4027)
Signed-off-by: darshanime <deathbullet@gmail.com>
2020-09-01 14:06:06 -07:00
Alexander Matyushentsev
016c8b333a fix: api-server unnecessary normalize projects on every start (#4219) 2020-09-01 13:06:11 -07:00
Alexander Matyushentsev
cc1592eb0c refactor: load only project names in UI (#4217) 2020-09-01 12:50:03 -07:00
jannfis
ea9b0b35d0 fix: Re-create already initialized ARGOCD_GNUPGHOME on startup (#4214) (#4223) 2020-09-01 21:01:56 +02:00
Josh Soref
44623d6be2 fix: vertically center 3+ letter abbreviations (#4179) (#4180) 2020-09-01 10:39:01 -07:00
Darshan Chaudhary
f625ddc6b9 feat: allow diff against a revision (#4205)
Signed-off-by: darshanime <deathbullet@gmail.com>
2020-09-01 10:30:37 -07:00
chrisob
324a336a52 fix: Add openshift as a dex connector type which requires a redirectURI (#4222) 2020-09-01 10:27:38 -07:00
Alexander Matyushentsev
d09bd23cf8 feat: support gzip compression in api server (#4218) 2020-09-01 10:08:08 -07:00
Johan Sandström
90eb262f64 docs: document how to set helm version (#4216) 2020-09-01 10:02:35 -07:00
Mickaël Canévet
c14f87d565 Update USERS.md (#4213) 2020-08-31 11:24:09 -07:00
Alexander Matyushentsev
fca0f69b5e refactor: Replace status.observedAt with redis pub/sub channels for resource tree updates (#1340) (#4208) 2020-08-31 10:18:12 -07:00
Maxime Brunet
edf2904004 feat: Add Jsonnet version to version endpoint (#4207) 2020-08-31 10:29:32 +02:00
Maxime Brunet
d7a70bfc6f fix(cli): Fix local diff/sync of apps using cluster name (#4201)
This fixes the cluster query when the application uses cluster name as destination:

```shell
$ argocd app diff guestbook --local=guestbook/
FATA[0010] rpc error: code = Internal desc = runtime error: invalid memory address or nil pointer dereference
```
2020-08-29 09:56:49 +02:00
faruryo
a4ea2624a8 docs: Add documentation for Namespace Auto-Creation in application.yaml (#4203)
* update docs/application.yaml for Namespace Auto-Creation

* remove trailing spaces in application.yaml
2020-08-29 09:50:55 +02:00
Alexander Matyushentsev
dec73c77e6 fix: cache inconsistency of child resources (#4053) (#4202) 2020-08-28 22:41:28 -07:00
Alexander Matyushentsev
761ad0bdcf docs: add 1.7.1 and 1.7.2 to CHANGELOG (#4197) 2020-08-28 13:26:15 -07:00
Chetan Banavikalmutt
d1e272e192 feat: Flag to add kustomize common labels (#4131) 2020-08-28 12:07:19 -07:00
Shea Stewart
9fb7aa4f20 Update USERS.md (#4193)
I am a partner at Arctiq and we use the argo suite extensively for internal tooling, and am also the technical lead for the DevOps Platform at BCGov in which we are using ArgoCD (and the suite) for cluster configuration management.
2020-08-28 09:07:50 -07:00
Josh Soref
8fa0f04e43 fix: remove stray period (#4183) (#4184) 2020-08-27 16:58:42 -07:00
Byungjin Park (BJ)
c00e84700c Update USERS.md (#4185) 2020-08-27 16:52:28 -07:00
Alexander Matyushentsev
2d2335f95a fix: upgrade github.com/evanphx/json-patch to v4.9.0 (#4189) 2020-08-27 15:21:57 -07:00
Daisuke Taniwaki
10d05cdb60 fix: Allow no config cluster (#4164)
* Update USERS.md

* Allow no config cluster

* Add tests

* Fix lint issues
2020-08-26 19:50:02 -07:00
Michael Barrientos
9f79340505 fix: support for PKCE for cli login (#2932) (#4067) 2020-08-26 16:02:39 -07:00
Alexander Matyushentsev
290712d4b3 docs: document YAML handling change in v1.7 upgrade instructions (#4168) 2020-08-26 14:41:08 -07:00
Alexander Matyushentsev
c49dd8d383 feat: support storing app parameters in .argocd-app.yaml file (#4084)
* feat: support storing app parameters in .argocd-app.yaml file

* rename .argocd-app.yaml to .argocd-source.yaml
2020-08-26 14:27:34 -07:00
Oleg Sucharevich
3a50f8df81 feat: do not include kube-api check in application liveness flow (#4163)
* feat: do not include kube-api liveness check in application liveness flow
2020-08-26 10:33:36 -07:00
Alexander Matyushentsev
569a2a6bc6 fix: Unable to create project JWT token on K8S v1.15 (#4165) 2020-08-26 10:31:52 -07:00
Alex Gervais
2e8a8f09b1 docs: Update README.md with a new community tutorial (#4161) 2020-08-26 16:04:34 +02:00
Alexander Matyushentsev
d04b6e2d35 refactor: upgrade gitops-engine version (#4160) 2020-08-26 00:00:28 -07:00
Johan
f208700f78 feat: Add configurable Helm version (#4111)
This commit adds support for configurable Helm version either via
declarative syntax or via argocd cli.

New helm option 'Version' added to the ApplicationSourceHelm
struct which can be either 'v2' or 'v3'.

Argocd app create accepts '--helm-version' that also looks for the
same Helm versions as above.
2020-08-25 12:36:27 -07:00
Chetan Banavikalmutt
7a3d05cb7c docs: Switch to argocd namespace before starting local services (#4153) 2020-08-25 19:20:06 +02:00
May Zhang
8df8bfff18 fix: Badge links are not generating properly when using --rootpath (#4140)
* fix: Badge links are not generating properly when using --rootpath

* fix: fix lint error

* fix: use context.baseHref
2020-08-25 09:54:30 -07:00
Josh Soref
9ac6bb3248 fix: clear filters to show (#4142) (#4143) 2020-08-25 09:20:36 -07:00
Alexander Matyushentsev
ee57ded16f refactor: upgrade K8S client to v0.18.8 (#4149) 2020-08-24 16:46:38 -07:00
Shoubhik Bose
f508dec107 chore: add nodemodules to gitignore (#4151) 2020-08-24 14:00:22 -07:00
S.H
0b387a454b doc: fix the ci_automation's kustomize source code. (#4144) 2020-08-24 13:57:54 -07:00
May Zhang
bc565d384d fix: UI setting auto sync causes erroneous config (#4118)
* fix: UI setting auto sync causes erroneous config

* fix: remove log
2020-08-24 12:13:06 -07:00
jannfis
372eae0f21 fix: Make GnuPG keyring independent of user ID within container (#4136)
* fix: Make GnuPG keyring independent of user ID within container

* Update unit test
2020-08-24 12:01:41 -07:00
Marc Boorshtein
474301c5ab docs: fixed link for OpenUnison (#4150)
* added docs for openunison integration

* fixed formatting

* added link to makedocs, fix last header

* fix link
2020-08-24 11:58:39 -07:00
Marc Boorshtein
beb2817d6f docs: added docs for openunison integration (#4146)
* added docs for openunison integration

* fixed formatting

* added link to makedocs, fix last header
2020-08-24 19:28:51 +02:00
Remington Breeze
0ee983fc31 chore(docs): add note about base64 encoding to SSO documentation (#4139) 2020-08-24 16:43:57 +02:00
Oleg Sucharevich
c32d5fd5ee docs: Add remote debugging example to contribution docs
docs: fix grammar

Minor editing

empty
2020-08-24 16:39:51 +02:00
Yankee
0d193cfd57 docs: Update broken link for Branch Tracking (#4147)
Updated broken internal link for the Branch Tracking section.
2020-08-24 16:35:33 +02:00
Povilas Versockas
263e7a8497 feat: add grpc metrics in repo server (#3827) 2020-08-18 21:48:42 -07:00
Povilas Versockas
7f86e6b38c feat: add git histogram metrics (#3828) 2020-08-18 21:48:00 -07:00
Povilas Versockas
194d471db4 fix: rename redis histogram metric name (#3829) 2020-08-18 21:45:47 -07:00
Jared Welch
84e8af7976 chore: Add New Relic to USERS.md (#4119)
New Relic (https://newrelic.com/) is officially using ArgoCD along with the other Argo projects to deploy to Kubernetes.
2020-08-18 15:08:17 -07:00
Nicholas St. Germain
f2dca0315c docs: Update traefik gRPC docs (#4112) (#4113) 2020-08-18 13:35:04 -07:00
Suraj Biyani
01d9b94f62 docs: Add Beat to USERS (#4109) 2020-08-17 13:56:27 -07:00
Oleg Sucharevich
ebb216ff11 fix: log warn when external url is not fully qualified (#4108) 2020-08-17 14:54:10 +02:00
Chetan Banavikalmutt
e56997f504 docs: Fix spelling in contributing guide and FAQ (#4107) 2020-08-17 09:06:52 +02:00
Oleg Sucharevich
f66dd977e7 fix: support ** wildcard in repo sources permitted sources (#3759) (#4085)
* chore: add more tests to permitted sources (#3759)

* fix: support ** wildcard  in repo sources

* keep backward compitability

* fix: typo

* use separator only in source
2020-08-14 12:49:35 -07:00
Alexander Matyushentsev
0a19fbc6e3 docs: add 1.7 changelog and update instructions (#4095)
* docs: add 1.7 changelog and update instructions

* apply reviewer notes
2020-08-14 12:47:50 -07:00
Daniel Barclay
88159ed84c docs: Fixed some resource_hooks.md grammatical problems. (#4005) 2020-08-14 11:11:30 -07:00
Johnathan Falk
7eee090507 docs: Added some grammar and readability fixes to roadmap (#4100)
* Added some grammer fixes.

Signed-off-by: Johnathan Falk <johnathan.falk@gmail.com>

* docs: updated docs/raodmap.md.

Signed-off-by: Johnathan Falk <johnathan.falk@gmail.com>
2020-08-14 10:26:57 -07:00
Alexander Matyushentsev
c387a27f73 docs: add roadmap document (#3906)
* docs: add first roadmap draft

* Update docs/roadmap.md

Co-authored-by: Remington Breeze <remington@breeze.software>

* Update docs/roadmap.md

Co-authored-by: Remington Breeze <remington@breeze.software>

* Update docs/roadmap.md

Co-authored-by: Remington Breeze <remington@breeze.software>

* Update docs/roadmap.md

Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>

* Update docs/roadmap.md

Co-authored-by: Remington Breeze <remington@breeze.software>

* Update docs/roadmap.md

Co-authored-by: Remington Breeze <remington@breeze.software>

* Update docs/roadmap.md

Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>

* Update docs/roadmap.md

Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>

* update table on content; add argocd-image-updater-link

* Update docs/roadmap.md

Co-authored-by: Remington Breeze <remington@breeze.software>

* add more information about ApplicationSet project

* Update roadmap.md

Co-authored-by: Remington Breeze <remington@breeze.software>
Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
Co-authored-by: Ed Lee <edlee2121@users.noreply.github.com>
2020-08-13 12:32:44 -07:00
Alexander Matyushentsev
959dd4ee99 Update gpg-verification.md (#4080) 2020-08-13 12:32:11 -07:00
Alex Stein
e2cdfddc8d docs: adds initial documentation for user-defined-styles feature (#3642) (#4089) 2020-08-13 11:36:28 -07:00
Alexander Matyushentsev
b4f80133d0 docs: document 'ignoreResourceStatusField' option (#4093) 2020-08-13 11:14:45 -07:00
Alexander Matyushentsev
523bc50eb7 fix: remove unnecessary liveness probe from argocd components (#4082) 2020-08-13 08:01:00 -07:00
descrepes
3d4d64e1b7 docs: Add InsideBoard to USERS (#4088) 2020-08-12 15:07:19 +02:00
Alexander Matyushentsev
f6dbe5ad8a fix: removes unnecessary scroll on apps filter panel (#4073) 2020-08-11 13:29:11 -07:00
Alexander Matyushentsev
cea3c19d62 feat: support disabling grpc histogram (#4075) 2020-08-11 13:28:57 -07:00
Josh Soref
c99ddc46bb fix: add line break between committer and date (#4078)
Fixes #4077
2020-08-11 13:28:40 -07:00
Josh Soref
176faa57b0 chore: Use https (#4076)
* Use https

* Use https

* Use https

* Use https
2020-08-11 20:55:47 +02:00
Alexander Matyushentsev
2854497644 fix: add partial sync with namespace example to 'argcocd app sync' command (#4074) 2020-08-11 10:21:11 -07:00
Shoubhik Bose
f1212736c0 docs: Add adoption section (#4063)
* docs: Add adoption section

Should we list adoption separately ? Would be nice if we could add more known adopters to the list.

* Link to users.md

* Add a whitespace between Argo and CD :)
2020-08-11 09:34:17 -07:00
Alexander Matyushentsev
997f38d640 fix: cluster settings change is not applied correctly (#4070) 2020-08-10 16:13:06 -07:00
Alexander Matyushentsev
c3a05e8cf5 fix: 'argocd app sync' should not wait for app refresh if '--dry-run' flag is set (#4069) 2020-08-10 15:02:16 -07:00
Alex Stein
978d10f2f3 feat: add user-defined css overlay (#3642) (#4065) 2020-08-10 19:13:40 +02:00
Alexander Matyushentsev
6cbcbe7003 fix: make sure allow-cluster-resource/deny-cluster-resource are consistent with allow-namespace-resource/deny-namespace-resource commands (#4064) 2020-08-06 15:28:43 -07:00
Alexander Matyushentsev
aaab777d27 fix: optional 'name' flag of add-orphaned-ignore/remove-orphaned-ignore command should be named, not positional (#4062) 2020-08-06 15:28:22 -07:00
rachelwang20
011415f5bd feat: Switch to use weighted semaphore (#4049)
* Switch to use weighted semaphore

* Add replica count env

* fixed codegen
2020-08-06 13:29:30 -07:00
jannfis
cc8dd94d27 docs: Clarify that retry in application spec is available from 1.7 (#4061) 2020-08-06 10:34:55 -07:00
Alexander Matyushentsev
68597718bf fix: terminated sync operation should not auto-retry (#4056) 2020-08-05 17:58:59 -07:00
Alexander Matyushentsev
c82451ca9a fix: infer app destination server URL prior app deletion and during lightweight reconciliation (#4039)
* fix: infer app destination server URL prior app deletion and during lightweight reconciliation

* apply reviewer notes
2020-08-05 17:58:20 -07:00
Alexander Matyushentsev
ba71ad934c refactor: upgrade k8s client to 1.18 (#4046)
* refactor: upgrade k8s client to 1.18

* remove unnecessary go mod replacements
2020-08-05 11:36:40 -07:00
May Zhang
2f92cdd2eb fix: not hide resource when resource is owned by other resource (#4022)
* fix: show resource when this resource owned by other resource

* fix: fix lint error

* fix: using map to reduce loops
2020-08-05 09:35:26 -07:00
Darshan Chaudhary
cb7fa39144 feat: add cluster resource blacklist to projects (#3960)
feat: add cluster resource blacklist to projects (#3960)

Signed-off-by: darshanime <deathbullet@gmail.com>
2020-08-04 08:06:28 -07:00
Imre Nagi
5908963cca fix: trim right backslash in cluster server URL (#4037)
Signed-off-by: Imre Nagi <imre.nagi@go-jek.com>
2020-08-04 07:50:26 -07:00
UlyssesCB
38584bff25 docs: Add QuintoAndar to USERS (#4043) 2020-08-04 07:36:49 -07:00
Alexander Matyushentsev
aecf149159 fix: kustomize-version flag is not working on 'argocd app set' command (#4040) 2020-08-03 21:46:03 -07:00
rachelwang20
18de22744e feat: Adding text box and dropdown allows user to switch cluster url & name (#4019)
* Include sub and and iat in PermissionDenied message

* Run test-local

* Fix typo

* Fix lint error

* iat fromat changing

* Adding MapClaims convertion

* Fix lint issue

* Fix golang lint

* Fix blank space

* Fix missing field

* Adding Orphaned exception list

* Fixed lint error

* Rebased on master

* Adding group kind label

* golangci-lint run

* Addressed comments

* Fixed lint errors

* Method rename

* orphaned ignore list cli support

* Add switch for cluster name & URL

* Added also in application update

* address review comment
2020-08-03 13:31:16 -07:00
Darshan Chaudhary
c4834492b9 feat: add client side keepalive pings (#4026) 2020-07-31 13:48:51 -07:00
Rael Garcia
e80e5fcbe4 docs: Add namespace field to cluster secret documentation (#3992)
* docs: add `namespace` field to cluster secret documentation

This feature for connecting with clusters where you only are (or can) watch a set of namespaces. Also useful when connecting argo with several clusters to avoid having the controller watching every single kind from every single api group from every single cluster.

https://github.com/argoproj/argo-cd/pull/2839

* fix: typo in the cluster namespaces description
2020-07-31 09:13:13 +02:00
May Zhang
613af547c3 feat: adding validate for app create and app set (#4016)
* feat: adding disable-validation for app create and app set

* feat: adding disable-validation for app create and app set

* feat: change test func name

* feat: added support of app unset and app edit in addition to app create and app set.

* feat: remove extra space.
2020-07-30 13:28:36 -07:00
Darshan Chaudhary
9b99276d59 fix: skipped resources should not impact sync status (#3986)
* fix: skipped resources should not impact sync status

Signed-off-by: darshanime <deathbullet@gmail.com>
2020-07-30 10:09:12 -07:00
Alexander Matyushentsev
e0d0968b89 feat: support overriding default cluster re-sync duration (#4014) 2020-07-30 10:00:19 -07:00
Nick Stogner
b96910cddc fix: Microsoft SSO docs RBAC ConfigMap ref (#4012) 2020-07-29 13:48:20 -07:00
May Zhang
382bbdf031 feat: autosync protection (#3996) 2020-07-28 19:52:30 -07:00
Alexander Matyushentsev
50d9914e8d fix: handle encoded URL parameter in cluster details page (#4011) 2020-07-28 14:16:49 -07:00
Alexander Matyushentsev
5a4ded4f3f fix: minor UI fixes in applications create/edit panels (#4009) 2020-07-28 12:38:21 -07:00
Alexander Matyushentsev
a6399e59e1 feat: support retrying failed sync attempts (#3997)
* feat: support retrying failed sync attempts

* fix: sync results should be cleared in retry sync attempt
2020-07-28 10:14:17 -07:00
XIAO TANG
09c1656a22 docs: Add LINE to list of users (#4007) 2020-07-28 08:00:21 -07:00
May Zhang
067dcce88d feat: auto create namespace (#3976)
* feat: auto create namespace

* feat: fixing yarn lint error.

* feat: fixing yarn lint error.

* update to the latest gitops-engine

* fix tidiness of go.sum
2020-07-27 13:33:08 -07:00
Arthur Outhenin-Chalandre
3b8ee7840b fix: normalize libs jsonnet and broken command in docs (#4003)
* fix: jsonnet Libs normalize

Signed-off-by: Arthur Outhenin-Chalandre <arthur@cri.epita.fr>

* fix: jsonnet libs broken command in docs

Signed-off-by: Arthur Outhenin-Chalandre <arthur@cri.epita.fr>
2020-07-27 20:16:22 +02:00
Frederik Weber
34b7ad7000 fix: #3933 - Use a non root Redis Image (#3934)
* fix: #3933 - Set Security Context for Redis Image

* Also set Group in Redis Security Context

* Regenerate with Kustomize 2.0.3
2020-07-27 19:46:08 +02:00
jannfis
506fceae32 fix: Normalize Helm chart path when chart name contains a slash (#3987)
* fix: Normalize Helm chart path when chart name contains a slash

* handle special cases and add unit tests
2020-07-25 09:14:46 +02:00
Liviu Costea
275daa7976 feat: Support applications with cluster name in the ui #1548 (#3944)
* feat: Support applications with cluster name in the ui

* Retrigger CI pipeline
2020-07-24 15:37:58 -07:00
rachelwang20
7a348f786b feat: Allow custom cluster names (#3985)
* Include sub and and iat in PermissionDenied message

* Run test-local

* Fix typo

* Fix lint error

* iat fromat changing

* Adding MapClaims convertion

* Fix lint issue

* Fix golang lint

* Fix blank space

* Fix missing field

* Adding Orphaned exception list

* Fixed lint error

* Rebased on master

* Adding group kind label

* golangci-lint run

* Addressed comments

* Fixed lint errors

* Method rename

* orphaned ignore list cli support

* Orphaned resources cli support

* Display orphaned resource cli

* Added tests

* Create argocd app resources command

* Addressed comments

* fix a lint error
2020-07-24 13:23:26 -07:00
Alexander Matyushentsev
1a36fd178a chore: stop using pre-built docker images for testing/code generation (#3955) 2020-07-23 08:05:06 +02:00
Alexander Matyushentsev
6ebd156198 fix: support project finalizer to ensure proper deletion (#3967)
* fix: support project finalizer to ensure proper deletion

* apply reviewer notes
2020-07-21 17:25:41 -07:00
Alexander Matyushentsev
1b956f133b fix: application resources info should be stored in persistent order (#3974) 2020-07-21 16:59:00 -07:00
Alexander Matyushentsev
4ceb403632 fix: reduce number of v1/applications/<appName>/syncwindows requests from app details page (#3973) 2020-07-21 13:14:04 -07:00
Alexander Matyushentsev
141018acc0 fix: argocd-util diff-reconcile-results should print app reconcile results sorted by app name (#3972) 2020-07-21 12:00:49 -07:00
Simon Clifford
ececbed999 fix: allow duplicates when using generateName (#3878)
* Generate Name field generates names when created so should not cause a duplication warning
* Updating existing test case to check no additional conditions are added
2020-07-21 10:15:41 -07:00
Darshan Chaudhary
53a9222ad7 feat: delete in reverse order of sync waves (#3959)
* feat: delete in reverse order of sync waves

Signed-off-by: darshanime <deathbullet@gmail.com>

* feat: add tests for deletion in order

Signed-off-by: darshanime <deathbullet@gmail.com>

* feat: fix lint for appcontroller.go

Signed-off-by: darshanime <deathbullet@gmail.com>

* feat: add comment to explain early return

Signed-off-by: darshanime <deathbullet@gmail.com>
2020-07-21 09:52:59 +02:00
Alexander Matyushentsev
dfd7457c21 fix: use glob matcher in casbin built-in model (#3966) 2020-07-20 13:55:19 -07:00
rachelwang20
52926b7cb0 feat: Create argocd app resources CLI with various filters. (#3946)
* Include sub and and iat in PermissionDenied message

* Run test-local

* Fix typo

* Fix lint error

* iat fromat changing

* Adding MapClaims convertion

* Fix lint issue

* Fix golang lint

* Fix blank space

* Fix missing field

* Adding Orphaned exception list

* Fixed lint error

* Rebased on master

* Adding group kind label

* golangci-lint run

* Addressed comments

* Fixed lint errors

* Method rename

* orphaned ignore list cli support

* Orphaned resources cli support

* Display orphaned resource cli

* Added tests

* Create argocd app resources command

* Addressed comments
2020-07-20 13:29:25 -07:00
Alexander Matyushentsev
c8def406b0 refactor: upgrade gitops engine (#3962) 2020-07-20 10:11:17 -07:00
Alexander Matyushentsev
e92e0fa409 fix: bump gitops engine version (#3954) 2020-07-17 12:46:58 -07:00
Omer Kahani
9805996975 docs: Add GitOps Deployment and Kubernetes blog post (#3935)
* Add GitOps Deployment and Kubernetes blog post

* Update README.md

Co-authored-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-07-17 12:27:20 -07:00
Soheil Eizadi
664609af91 Update README.md (#3851) 2020-07-17 09:57:23 -07:00
Daniel Iziourov
9ef40f457a docs: expanding the description of repo credendials (#3938)
Signed-off-by: danmx <daniel@iziourov.info>
2020-07-17 18:54:07 +02:00
jannfis
fec4dc78c3 chore: Fix intermittently failing CLI build in e2e-tests (#3952)
* fix: Do not use -i flag when building CLI

* Debug output

* re-disable CGO

* increase timeout

* correctly create dist directory before e2e server

* Revert
2020-07-17 18:35:02 +02:00
Alexander Matyushentsev
f9889e3c0b fix: wait/sync command should send app resource version to avoid app stale data (#3951) 2020-07-17 08:34:48 +02:00
rachelwang20
561f30815c feat: Orphaned ignore list cli support (#3922)
* Include sub and and iat in PermissionDenied message

* Run test-local

* Fix typo

* Fix lint error

* iat fromat changing

* Adding MapClaims convertion

* Fix lint issue

* Fix golang lint

* Fix blank space

* Fix missing field

* Adding Orphaned exception list

* Fixed lint error

* Rebased on master

* Adding group kind label

* golangci-lint run

* Addressed comments

* Fixed lint errors

* Method rename

* orphaned ignore list cli support
2020-07-14 14:53:56 -07:00
Hiroki Sakamoto
1a94538568 docs: add installation step for running locally (#3923)
* docs: add installation step for running locally

* docs: fix to add apply command
2020-07-14 16:56:32 +02:00
Hiroki Sakamoto
0d571fce14 feat: add resource's age & creation time (#3931)
* feat: add resource creation time to api response

* feat: add creation time to model

* feat: add resource's age to app detail page

* feat: add created_at to resource summary page
2020-07-14 16:54:00 +02:00
Hiroki Sakamoto
4336c46c8a chore: pass image namespace env to manifests (#3926) 2020-07-14 16:52:30 +02:00
Hiroki Sakamoto
6f77d9b7bb chore: pass required envs to repo server (#3929) 2020-07-14 09:38:30 +02:00
Matthias Riegler
e930de1228 Feat: (Jsonnet) Add support to include library paths (#3825)
* feat: added Libs field to ApplicationSourceJsonnet

Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com>

* feat: codegen

Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com>

* feat: implemented jsonnet jpath arguments

- Implement the `-J` command line flag for jsonnet
- adapt test to include a nested library for testing the VM
  functionality

Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com>

* feat: jsonnet import path relative to the repoRoot

- adapted testCase to make use of a jpath
- join repoRoot and provided jpath attributes

Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com>

* fix: added checking for out-of-repoRoot references

Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com>

* feat: Added CLI option for passing jsonnet libs

Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com>

* feat: Updated jsonnet docs

Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com>

* fix: renamed function

Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com>

* feat: Expose --local-repo-root flag

Allows passing a "virtal" git repository root when using the local sync
mode with --local.
Provides backwardscompatible with the previous default value ("/")

Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com>

* fix: added missing command

Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com>

* Remove obsolete line out of docs

Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com>
2020-07-13 23:18:21 +02:00
gambuzzi
2a7aabe5a5 feat: add flagger.app/Canary health check lua script and tests (#3902)
* add flagger.app/Canary health check lua script and tests

* add flagger.app/Canary health check lua script and tests, fix type

* add handle for flagger Initialized phase

* add handle for flagger Initialized phase and test
2020-07-13 13:14:22 -07:00
Alexander Matyushentsev
60637e6df2 fix: remove TestSyncOptionDryRun test (#3939) 2020-07-13 11:59:30 -07:00
Alexander Matyushentsev
817f68aeec feat: display sync operation status message on app details page (#3918) 2020-07-13 11:22:08 -07:00
rachelwang20
95820cf64f feat: User can define Orphaned exception avoiding unnecessary warnings (#3900)
* Include sub and and iat in PermissionDenied message

* iat fromat changing

* Adding MapClaims convertion

* Adding Orphaned exception list

* Adding group kind label

* Fixed lint errors

* Method rename
2020-07-09 16:19:47 -07:00
Darshan Chaudhary
921606169a chore: bump up k8s.io dependencies to 1.17 (#3899)
chore: bump up k8s.io dependencies to 1.17 (#3899)

Signed-off-by: darshanime <deathbullet@gmail.com>
2020-07-09 13:38:32 -07:00
Alin Balutoiu
a4815e0f8a fix: Update dependencies built from source for ARM (#3909)
Signed-off-by: Alin Balutoiu <alinbalutoiu@gmail.com>
2020-07-09 09:55:49 -07:00
Vlad
e18438cf7b Add Garner (#3903) 2020-07-08 09:53:55 -07:00
jannfis
48d942087d chore: Integrate Docker build into CI for PRs (#3898) 2020-07-08 09:44:04 -07:00
Darshan Chaudhary
63acc26211 fix: don't refresh if dry run (#3891)
* fix: don't refresh if dry run

Signed-off-by: darshanime <deathbullet@gmail.com>

* fix: add e2e test for sync with dry-run

Signed-off-by: darshanime <deathbullet@gmail.com>

* fix: refresh only if not dryRun for sync command

Signed-off-by: darshanime <deathbullet@gmail.com>
2020-07-08 09:43:39 -07:00
Darshan Chaudhary
508e2c5f78 chore: make make cli use virtualized toolchain (#3884)
* chore: make make cli use virtualized toolchain

Signed-off-by: darshanime <deathbullet@gmail.com>

* chore: use cli-local in Dockerfile

Signed-off-by: darshanime <deathbullet@gmail.com>

* chore: use cli-local in Dockerfile

Signed-off-by: darshanime <deathbullet@gmail.com>
2020-07-04 12:58:57 +02:00
Darshan Chaudhary
b3c118d4c0 feat: ignore status globally (#3754)
feat: ignore status globally (#3754)
2020-07-02 23:28:36 -07:00
May Zhang
021b13c660 fix: permission denied due to NormalizeProjs failed to get list of pr… (#3883)
* fix: permission denied due to NormalizeProjs failed to get list of projects

* fix: permission denied due to NormalizeProjs failed to get list of projects

* fix: return error if normalization failed.

* fix: return error if normalization failed.

* fix: return error if normalization failed.

* fix: in GetJWTToken, remove normalize. It causes issue with delete token.

* Moved get project to only when apierr.IsConflict(err)
2020-07-02 15:31:35 -07:00
Alexander Matyushentsev
34a51b4772 fix: refactor: upgrade gitops engine version to pull in diffing fix (#3886) 2020-07-02 15:30:21 -07:00
Alexander Matyushentsev
d09d25cc2a feat: implement 'argocd-util apps get-reconcile-results command' (#3888)
* feat: implement 'argocd-util apps get-reconcile-results' command

* implement missing unit tests
2020-07-02 13:47:56 -07:00
Josh Soref
21c93d95f4 fix: Correct filters disclosure widget direction (#3885)
Fixes #3879
2020-07-02 09:18:54 +02:00
Jacob Smullin
0dd00580c2 Add in clientID function call. (#3853) 2020-07-01 16:49:38 -07:00
Alexander Matyushentsev
12cec86e43 fix: more space for application title (#3880) 2020-06-30 10:49:14 -07:00
rachelwang20
66dbc7ec73 feat: Include sub and and iat in PermissionDenied message (#3850)
* Include sub and and iat in PermissionDenied message

* Run test-local

* Adding MapClaims convertion

* Fix lint issue

* Fix golang lint
2020-06-29 20:19:04 -07:00
May Zhang
c6d8beed3e fix: UI for App Creation Requires Namespace Even When Repo Contains Only Global Custom Resource (#3875) 2020-06-29 17:33:29 -07:00
May Zhang
d676209daa fix: App Creation Requires Namespace Even When Repo Contains Only Global Custom Resource (#3874)
* fix: App Creation Requires Namespace Even When Repo Contains Only Global Custom Resource

* fix a typo

* fix a failed test
2020-06-29 16:33:13 -07:00
Alexander Matyushentsev
20eb8bbc4d fix: application list page consumes too much CPU (#3849)
* fix: application list page consumes too much CPU

* add broadcasterHandler tests
2020-06-29 15:32:18 -07:00
Seth Mason
9466071561 Added D2iQ (#3873) 2020-06-29 10:08:52 -07:00
Artem Yarmoliuk
099811c200 feat(dex): allow dex custom static clients (#3834) (#3835)
* feat(dex): allow dex custom static clients

* feat(dex): update dex doc
2020-06-26 19:01:45 +02:00
Junya Ogasawara
b697f56b4c docs: Add Money Forward to USERS.md (#3857) 2020-06-26 18:13:32 +02:00
Ryota
ba31d2001c docs: Correct bullet format (#3832) 2020-06-26 12:09:07 +02:00
May Zhang
7fbf51c346 fix: jwtTokens are reset when applying AppProjects (#3791)
* jwtTokens are reset when applying AppProjects

* fix unit tests in server_test.go
checking in generated.pb.go

* fix unit tests in rbackpolicy_test.go

* fix yarnl lint errors

* fix delete token in both spec and status

* add tests

* fixing failed test

* fixing failed test

* retry 3 times during update

* renamed CRD fields.
Updated nomalize method.

* fixed UI

* fixing merge conflicts

* fixing merge conflicts

* removed unused variables in UI
renamed a CRD field
updated combineToken logic using map

* Only update project which needs normalize token.

* Changed logging.

* check for nil

* Fix UI

* added project role get tests

* rename variables

* clean up

* fixing failed tests

* fixing failed tests

* fixing error handling for remove token

* log err when we have retried 3 times

* sort tokens

* sort tokens
2020-06-25 15:11:24 -07:00
Alexander Matyushentsev
aee6003d6e fix: sort application summary images and urls to avoid unnecessary updates (#3848) 2020-06-25 09:53:12 -07:00
Alexander Matyushentsev
ce4ac1f88e fix: avoid lock contention in GetClustersInfo method (#3844) 2020-06-24 17:19:39 -07:00
Alexander Matyushentsev
83f9bbf8c4 refactor: upgrade to 1.3 pre-release gitops engine verison (#3842) 2020-06-24 12:30:25 -07:00
jannfis
c76d7b9c7c refactor: There were some more places needed for JSON marshaler migration (#3840) 2020-06-24 20:34:29 +02:00
jannfis
28eb286f85 refactor: Migrate JSON marshaler from gitops-engine to argo-cd (#3839)
* fix: Migrate JSON marshaler from gitops-engine to argo-cd

* Lint
2020-06-24 18:07:49 +02:00
Isaac Gaskin
24acaefce3 fix(revision.tsx): correcting regex for matching SHAs (#3820)
caused some targetRevisions to be treated like commits instead of branches, also fixed URLs for github repos

3801
2020-06-23 09:14:29 -07:00
Alexander Matyushentsev
5751404c58 chore: change version to 1.7.0 (#3826) 2020-06-23 14:29:34 +02:00
Alexander Matyushentsev
5d5d6a4ad6 feat: Display cluster info on cluster details page (#3793)
* feat: Display cluster info on cluster details page

* Store cluster info in cache instead of secret
2020-06-22 17:51:20 -07:00
Povilas Versockas
7d4f8558fe feat: add grpc histogram metric in server (#3776) 2020-06-22 16:02:31 -07:00
Alexander Matyushentsev
42e24e6e2a fix: controller should not re-trigger auto-sync if sync failed due to comparison error (#3824) 2020-06-22 14:09:22 -07:00
Alexander Matyushentsev
fc2e3f82a2 fix: application controller should not modify cached applications (#3821) 2020-06-22 11:04:25 -07:00
jannfis
be718e2b61 feat: GPG commit signature verification (#2492) (#3242)
* Add initial primitives and tests for GPG related operations

* More tests and test documentation

* Move gpg primitives to own module

* Add initial primitives for running git verify-commit and tests

* Improve and better comment test

* Implement VerifyCommitSignature() primitive for metrics wrapper

* More commentary

* Make reposerver verify gpg signatures when generating manifests

* Make signature validation optional

* Forbid use of local manifests when signature verification is enabled

* Introduce new signatureKeys field in project CRD

* Initial support for only syncing against signed revisions

* Updates to GnuPG primitives and more test cases

* Move signature verification to correct place and add tests

* Add signature verification result to revision metadata and display it in UI

* Add more primitives and move out some stuff to common module

* Add more testdata

* Add key management primitives to ArgoDB

* Move type GnuPGPublicKey to appsv1 package

* Add const ArgoCDGPGKeysConfigMapName

* Handle key operations with appsv1.GnuPGPublicKey

* Add initial API for managing GPG keys

* Remove deprecated code

* Add primitives for adding public keys to configuration

* Change semantics of ValidateGPGKeys to return more key information

* Add key import functionality to public key API

* Fix code quirks reported by linter

* More code quirks fixes

* Fix test

* Add primitives for deleting keys from configuration

* Add delete key operation to API and CLI

* Cosmetics

* Implement logic to sync configuration to keyring in repo-server

* Add IsGPGEnabled() primitive and also update trustdb on ownertrust changes

* Use gpg.IsGPGEnabled() instead of custom test

* Remove all keyring manipulating methods from DB

* Cosmetics/comments

* Require grpc methods from argoproj pkg

* Enable setting config path via ARGOCD_GPG_DATA_PATH

* Allow "no" and any cases in ARGOCD_GPG_ENABLED

* Enable GPG feature on start and start-e2e and set required environment

* Cosmetics/comments

* Cosmetics and commentary

* Update API documentation

* Fix comment

* Only run GPG related operations if GPG is enabled

* Allow setting ARGOCD_GPG_ENABLE from the environment

* Create GPG ConfigMap resource during installation

* Use function instead of constant to get the watcher path

* Re-watch source path in case it gets recreated. Also, error on finish

* Add End-to-End tests for GPG commit verification

* Introduce SignatureKey type for AppProject CRD

* Fix merge error from previous commit

* Adapt test for additional manifest (argocd-gpg-keys-cm.yaml)

* Fix linter issues

* Adapt CircleCI configuration to enable running tests

* Add wrapper scripts for git and gpg

* Sigh.

* Display gpg version in CircleCI

* Install gnupg2 and link it to gpg in CI

* Try to install gnupg2 in CircleCI image

* More CircleCI tweaks

* # This is a combination of 10 commits.
# This is the 1st commit message:

Containerize tests - test cycle

# This is the commit message #2:

adapt working directory

# This is the commit message #3:

Build before running tests (so we might have a cache)

# This is the commit message #4:

Test limiting parallelism

# This is the commit message #5:

Remove unbound variable

# This is the commit message #6:

Decrease parallelism to find out limit

# This is the commit message #7:

Use correct flag

# This is the commit message #8:

Update Docker image

# This is the commit message #9:

Remove build phase and increase parallelism

# This is the commit message #10:

Further increase parallelism

* Dockerize toolchain

* Add new targets to Makefile

* Codegen

* Properly handle permissions for E2E tests

* Remove gnupg2 installation from CircleCI configuration

* Limit parallelism of build

* Fix Yarn lint

* Retrigger CI for possible flaky test

* Codegen

* Remove duplicate target in Makefile

* Pull in pager from dep ensure -v

* Adapt to gitops-engine changes and codegen

* Use new health package for health status constants

* Add GPG methods to ArgoDB mock module

* Fix possible nil pointer dereference

* Fix linter issue in imports

* Introduce RBAC resource type 'gpgkeys' and adapt policies

* Use ARGOCD_GNUPGHOME instead of GNUPGHOME for subsystem configuration

Also remove some deprecated unit tests.

* Also register GPG keys API with gRPC-GW

* Update from codegen

* Update GPG key API

* Add web UI to manage GPG keys

* Lint updates

* Change wording

* Add some plausibility checks for supplied data on key creation

* Update from codegen

* Re-allow binary keys and move check for ASCII armoured to UI

* Make yarn lint happy

* Add editing signature keys for projects in UI

* Add ability to configure signature keys for project in CLI

* Change default value to use for GNUPGHOME

* Do not include data section in default gpg keys CM

* Adapt Docker image for GnuPG feature

* Add required configuration to installation manifests

* Add add-signature-key and remove-signature-key commands to project CLI

* Fix typo

* Add initial user documentation for GnuPG verification

* Fix role name - oops

* Mention required RBAC roles in docs

* Support GPG verification of git annotated tags as well

* Ensure CLI can build succesfully

* Better support verification on tags

* Print key type in upper case

* Update user documentation

* Correctly disable GnuPG verification if ARGOCD_GPG_ENABLE=false

* Clarify that this feature is only available with Git repositories

* codegen

* Move verification code to own function

* Remove deprecated check

* Make things more developer friendly when running locally

* Enable GPG feature by default, and don't require ARGOCD_GNUPGHOME to be set

* Revert changes to manifests to reflect default enable state

* Codegen
2020-06-22 18:21:53 +02:00
Roman
a886241ef2 Specify ingress namespace in docs (#3809) 2020-06-20 16:23:15 -07:00
Liviu Costea
7ccb16bf7a feat: Support cluster name on Application destination. Closes #1548 (#2808)
feat: Support cluster name on Application destination. Closes #1548 (#2808)
2020-06-20 16:12:46 -07:00
Liviu Costea
fab28f7f64 Remove outdated references to dep targets (#3817) 2020-06-20 16:01:50 -07:00
Alexander Matyushentsev
49b6157308 chore: implement development helpers that mount config maps to local folder (#3796) 2020-06-19 12:27:39 -07:00
Alexander Matyushentsev
c7c554674e docs: fix invalid link in declarative-setup.md (#3813) 2020-06-19 09:33:42 -07:00
David Laban
37f5a8bfc0 docs: use kubectl apply in Declarative Setup (#3812)
The declarative setup approach is very powerful, and potentially reduces the
number of tools that you need to learn.

When coming in fresh to help out a colleague (without my head
in ops mode) my brain failed to make the mental leap from
"kubernetes manifests" to "Oh! I can use `kubectl apply` for those!".
I was worried that I would need to get kustomize out to combine things
together or something.

This patch points out that `kubectl apply` really is good enough for this job,
and also points out that it lets you skip a bunch of steps when setting up your
cluster.
2020-06-19 09:07:01 -07:00
rumstead
62bb719f88 docs: Update api-docs.md (#3810)
moving around some words
2020-06-19 17:06:56 +02:00
Isaac Gaskin
3126f4f4ae fix(application-tiles.tsx): moving helm/git icon to the left of app name (#3808)
was obtrustive in its current possition and truncating text

#3794
2020-06-19 17:04:08 +02:00
Alexander Matyushentsev
0486c72b95 docs: add v1.6.1 changelog (#3807) 2020-06-18 13:38:50 -07:00
Alexander Matyushentsev
6143f6d9be fix: return default scopes if custom scopes are not configured (#3805) 2020-06-18 11:00:44 -07:00
Alexander Matyushentsev
332617099d docs: add 'resource.compareoptions' to sample argocd-cm.yaml (#3803) 2020-06-18 11:00:19 -07:00
David Maciel
04ea9e77f5 Add clarification when working with Github webhook (#3802)
When creating the webhook in Github (enterprise, not sure if it happens in Github.com), The default "Content type" is "application/x-www-form-urlencoded". After some time debugging it I found the library used to handle the hooks (https://github.com/go-playground/webhooks) only supports 'application/json'.

I just noticed that the screenshot has the 'application/json' selected, but since the default is "application/x-www-form-urlencoded" it  can be easily overlooked and create some frustration when the hooks doesn't work as expected. 

Someone else from my team tried to activate the hooks a while ago an assumed they weren't working, and probably this was the reason :S
2020-06-18 08:59:48 -07:00
Thomas Santerre
b37134c3c1 Add PayPay to the list of users (#3797)
https://paypay.ne.jp/
2020-06-18 08:51:21 -07:00
Alexander Matyushentsev
963341727e docs: add 1.5 - 1.6 upgrade instructions (#3790) 2020-06-17 20:28:41 +02:00
Przemek
2e84b643be docs: Add docs how to use ArgoCD with helm plugins (#3766)
docs: Add docs how to use ArgoCD with helm plugins (#3766)
2020-06-17 10:11:54 -07:00
Darshan Chaudhary
cddeabe976 feat: add alias for sync policy automated (#3788)
Signed-off-by: darshanime <deathbullet@gmail.com>
2020-06-17 13:58:21 +02:00
Alexander Matyushentsev
6036ff8afd chore: fix tag matching in trigger-release.sh script (#3785) 2020-06-17 08:59:08 +02:00
Alexander Matyushentsev
a969f5e681 docs: add 1.5.6 ~ 1.6.0 changelog (#3786) 2020-06-17 08:57:56 +02:00
Alexander Matyushentsev
c6d1179307 feat: upgrade redis to 5.0.8-alpine (#3783) 2020-06-16 14:04:06 -07:00
Erik DeLamarter
6d44c4de41 docs: Add documentation for Keycloak SSO integration (#3767)
docs: Add documentation for Keycloak SSO integration (#3767)
2020-06-16 12:35:58 -07:00
Darshan Chaudhary
56b3a89157 fix: use *metav1.Time for deployStartedAt (#3782)
Signed-off-by: darshanime <deathbullet@gmail.com>
2020-06-16 10:10:31 -07:00
wdullaer
f2c7c3f230 feat: Add support for TLS client authentication in the CLI (#3779)
This commit adds support for TLS client authentication in the CLI.
It adds the necessary fields to the config and CLI parameters, modeled
on the existing server-crt functionality.

It also fixes 2 bugs in the grpcproxy:
1. The grpcproxy would ignore the server-crt when making a call to the
upstream server.
2. The grpcproxy would falsely assume that the HTTP status code returned
by the upstream server is always 200. It would then try to parse the
body as if it was a grpc response. At best this led to weird errors
being shown, at worst I have seen it cause the runtime to run out of
memory.
2020-06-16 17:03:03 +02:00
Alexander Matyushentsev
9019ae101e fix: upgrade awscli version (#3774) 2020-06-16 07:12:20 +02:00
Alexander Matyushentsev
7e877b0698 fix: html encode login error/description before rendering it (#3773) 2020-06-15 16:32:56 -07:00
Isaac Gaskin
e54d039998 feat(applications-tiles.tsx): adding helm icon to app tiles (#3765)
* feat(applications-tiles.tsx): adding helm icon to app tiles

conditionally add the helm icon if the application uses a "chart" otherwise default to git
2020-06-15 16:09:14 -07:00
Alexander Matyushentsev
1380af6af5 fix: cluster update method panic (#3772) 2020-06-15 13:51:04 -07:00
Alexander Matyushentsev
1aeba18d81 fix: cluster state cache should be initialized before using (#3752) (#3763) 2020-06-12 15:05:01 -07:00
Alan Tang
a9866a7013 Fix upgrading overview links (#3757) 2020-06-12 10:56:15 -07:00
Björn Häuser
a0b67fb607 Sort URLS (#3746)
If an ingress has several URLS, the list changes on every reload. This
should "guarantee" stable sorting.
2020-06-12 09:56:05 -07:00
whitleykeith
b79db51340 feat: Added healthchecks for more custom resources (#3726) (#3728)
* Adding LexisNexis to USERS.md

* Adding Istio healthcheck

* Adding Jaeger healthcheck

* Adding Kafka healthcheck

* Adding Kiali healthcheck

* Adding Knative healthchecks

* Adding Spark Application healthcheck

* Adding Zookeeper  healthcheck
2020-06-12 09:51:13 -07:00
Daichi Sakaue
9192cd94c9 chore: Update Redis to 5.0.8 (#3734)
Signed-off-by: Daichi Sakaue <daichi-sakaue@cybozu.co.jp>
2020-06-11 14:41:18 -07:00
Alexander Matyushentsev
ef0a63d45d fix: ensure cache settings read/writes are protected by mutex (#3753) 2020-06-11 12:54:10 -07:00
May Zhang
d040d9bf04 feat: Support additional metadata in Application sync operation (#3747)
* feat: Support additional metadata in Application sync operation

* regenerated generated.pb.go
2020-06-10 15:28:07 -07:00
Justin Hutchings
108a580a3f Add CodeQL security scanning (#3743) 2020-06-10 12:27:03 -07:00
Darshan Chaudhary
d63ced413e feat: add time taken to complete deployment (#3715)
* feat: add time taken to complete deployment

Signed-off-by: darshanime <deathbullet@gmail.com>

* feat: add test for adding deploy started at time

Signed-off-by: darshanime <deathbullet@gmail.com>

* feat: use hourglass for time to deploy

Signed-off-by: darshanime <deathbullet@gmail.com>

* feat: add comments to RevisionHistory fields

Signed-off-by: darshanime <deathbullet@gmail.com>
2020-06-10 14:28:40 +02:00
Darshan Chaudhary
e102ec11ac feat: Allow --local with automatic sync for --dry-run (#3675)
* feat: Allow --local with automatic sync for --dry-run

Signed-off-by: darshanime <deathbullet@gmail.com>

* feat: add e2e test for local sync with dry run

Signed-off-by: darshanime <deathbullet@gmail.com>
2020-06-10 14:05:37 +02:00
Alexander Matyushentsev
460f6653dc fix: avoid panic in badge handler (#3741) 2020-06-09 19:01:25 -07:00
Alexander Matyushentsev
e143fb4cb2 fix: SyncOperationResult namespace field should be optional (#3742) 2020-06-09 18:52:56 -07:00
Alexander Matyushentsev
3117a2c3b5 chore: trigger-release should not fail if commentChar not configured (#3740) 2020-06-09 23:59:39 +02:00
May Zhang
10dc082404 fix: Support argocd app diff --local and argocd app sync --local with custom plugins (#3733)
* settingsMgr returns plugins list When login successful or When API server DisableAuth
2020-06-09 14:06:49 -07:00
jannfis
4032e8efd7 fix: Reap orphaned ("zombie") processes in argocd-repo-server pod (#3611) (#3721)
* fix: Reap orphaned ("zombie") processes in argocd-repo-server pod
2020-06-09 13:58:37 -07:00
jannfis
b6e2d5a430 chore: Introduce release automation (#3711)
* chore: Introduce release automation
2020-06-09 12:05:52 -07:00
Alexander Matyushentsev
94e6efc0fc fix: delete api should return 404 error if app does not exist (#3739) 2020-06-09 11:06:34 -07:00
May Zhang
0a815be07a fix: support partial sync with namespace. (#3705)
* support partial sync with namespace.

* corrected test folder name

* Trying to fix lint error

* 1. in test, delete ns after test
2. in test, created new methods for ResourceSyncStatusWithNamespaceIs and ResourceHealthWithNamespaceIs.

* reformat imports

* simplify code

* remove timeout
2020-06-08 15:59:59 -07:00
jannfis
1add08bb20 fix: Fix possible nil pointer deref on resource deduplication (#3725) 2020-06-08 15:35:20 -07:00
Alexander Matyushentsev
d60bb6804c fix: upgrade gitops-engine dependency to v0.1.2 (#3729) 2020-06-08 15:12:35 -07:00
Darshan Chaudhary
86bfb6b380 refactor: change favicon.png on docs to argo-cd logo (#3723)
Signed-off-by: darshanime <deathbullet@gmail.com>
2020-06-08 10:28:39 +02:00
Chris Vest
7ca04b5897 feat: Add Strimzi KafkaConnect CRD custom health checks (#3684)
* Add Strimzi KafkaConnect custom health checks

* Update degraded test case & manifest
2020-06-06 16:44:24 +02:00
Timothy Vandenbrande
9bee00f942 fix: use uid instead of named user in Dockerfile (#3108) 2020-06-06 14:04:19 +02:00
Starslider
11b4614d60 Adding Swisscom to USERS list (#3706) 2020-06-04 12:18:18 -07:00
Alexander Matyushentsev
132e667a7b fix: revert incorrectly update go.mod/go.sum files (#3712) 2020-06-04 12:14:08 -07:00
May Zhang
d60e1b2876 feat: get cluster connection status from cluster synced time (#3604)
feat: get cluster connection status from cluster synced time (#3604)
2020-06-04 11:36:26 -07:00
Anna M. Kosek
60dbf545b6 docs: updated import command in the Disaster Recovery (#3710) 2020-06-04 14:57:44 +02:00
ragarcia26
4bf6e88189 docs: Add EA to USERS.md (#3704)
* docs: Add EA to USERS.md
2020-06-03 21:26:55 -07:00
Eder Nucci
53e5c65e11 Adding Greenpass to USERS list (#3699) 2020-06-03 21:25:53 -07:00
Alexander Matyushentsev
e775b8fce8 chore: run intergation tests in release branches (#3697) 2020-06-02 11:07:06 -07:00
David Maciel
84bece53a3 docs: Use official curl image instead of appropriate/curl (#3695)
The appropriate/curl last update is from two years ago:

```
$ docker run -it --entrypoint /bin/ash appropriate/curl:latest
$ curl --version
curl 7.59.0 (x86_64-alpine-linux-musl) libcurl/7.59.0 LibreSSL/2.6.3 zlib/1.2.11 libssh2/1.8.0
Release-Date: 2018-03-14
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile NTLM NTLM_WB SSL libz UnixSockets HTTPS-proxy
```

There is already an official curl image at https://hub.docker.com/r/curlimages/curl (The link to the docker hub can be found in the official curl download page: https://curl.haxx.se/download.html)
$ docker run -it --entrypoint /bin/ash curlimages/curl:latest
$ curl --version
curl 7.70.0-DEV (x86_64-pc-linux-musl) libcurl/7.70.0-DEV OpenSSL/1.1.1d zlib/1.2.11 libssh2/1.9.0 nghttp2/1.40.0
Release-Date: [unreleased]
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS HTTP2 HTTPS-proxy IPv6 Largefile libz NTLM NTLM_WB SSL TLS-SRP UnixSockets
2020-06-02 18:45:15 +02:00
Alexander Matyushentsev
4a6fe4cd31 feat: upgrade kustomize to v3.6.1 version (#3696) 2020-06-02 09:37:10 -07:00
Isaac Gaskin
45cb1d5967 fix: correcting arg positions for Sprintf example message (#3692) 2020-06-02 09:29:36 +02:00
jannfis
415d5e569f chore: Add GH actions status badge to README (#3690) 2020-06-01 21:52:23 +02:00
Alexander Matyushentsev
03a0a192ec refactor: upgrade gitops engine (#3687) 2020-06-01 20:23:07 +02:00
jannfis
a40f3689b3 chore: Add missing asset to Dockerfile (#3678)
* chore: Fix complaints of golang-ci lint v1.26.0

* chore: Fix Dockerfile
2020-05-31 19:28:16 -07:00
jannfis
80515a3b57 chore: Migrate CI toolchain to GitHub actions (#3677)
* chore: Migrate CI to GitHub actions

* Do not install golangci-lint, we use the action

* Integrate codecov.io upload

* Use some better names for analyze job & steps

* go mod tidy

* Update tools

* Disable CircleCI completely

* Satisfy CircleCI with a dummy step until it's disabled
2020-05-31 23:11:28 +02:00
Alin Balutoiu
00f99edf1a feat: Add build support for ARM images (#3554)
Signed-off-by: Alin Balutoiu <alinbalutoiu@gmail.com>
2020-05-31 19:31:29 +02:00
jannfis
bc83719037 chore: Fix complaints of golang-ci lint v1.26.0 (#3673) 2020-05-30 18:54:14 -07:00
Alexander Matyushentsev
2926f2bd60 fix: settings manager should invalidate cache after updating repositories/repository credentials (#3672) 2020-05-30 10:00:11 +02:00
Henno Schooljan
7b2a95e83c fix: Allow unsetting the last remaining values file (#3644) (#3645)
* fix: Allow unsetting the last values file (#3644)

Because the `setHelmOpt()` function does not act on empty inputs, it 
would do nothing when removing the last values file using `argocd app 
unset`.
The parameter overrides are actually being unset correctly, so this has 
been changed to work the same way by manipulating `app.Spec.Source.Helm` 
directly.

This fixes #3644.

* fix: Allow unsetting the last values file, add tests

* Retrigger CI pipeline
2020-05-29 22:27:40 -07:00
AGloberman
d89b7d8a41 fix: Read cert data from kubeconfig during cluster addition and use if present (#3655) (#3667)
* Read cert data from kubeconfig and use if present

* gofmt test updates
2020-05-29 11:33:56 -07:00
Henno Schooljan
36da074344 feat: CLI: Allow setting Helm values literal (#3601) (#3646)
* feat: CLI: Allow setting Helm values literal (#3601)

While you could already set values files using the `--values` flag with external data using the CLI with `argocd app create` and `argocd app set`, this was not yet possible for managing the literal `.spec.source.helm.values` value in an Application without resorting to a complicated `argocd app patch` escaped parameter or by generating the entire application YAML manifest by yourself.

Therefore, this PR adds a `--values-literal-file` flag to the `argocd app create` and `argocd app set` commands, which accepts a local file name or URL to a values file, which will be read and included as a multiline string in the application manifest. This is different from the `--helm-set-file` flag which expects the file in the chart itself.

The `argocd app unset` command is expanded with a `--values-literal` flag, so we can also unset this field again.

I hope I chose nice enough names for the flags, I wanted to make clear it expects a file name, but also distinguish it enough from the existing `--values` flag which actually points to values files.

Because the current `setHelmOpt()` functionality would not work for unsetting things to an empty value and it was difficult to do these changes independently, this PR also contains the fix for issue #3644. A separate PR has still been created for that one because I think it should end up as a separate issue in the release notes.

* feat: CLI: Allow setting Helm values literal, add tests
2020-05-29 09:00:28 -07:00
Hyungrok Kim
2277af2f32 docs: Add PUBG to USERS.md (#3669) 2020-05-29 08:14:32 -07:00
Alexander Matyushentsev
ee64a4d9ca fix: upgrade gitops engine dependency (#3668) 2020-05-28 18:42:01 -07:00
Fred Dubois
d9bae2f83f Add AppDirect to USERS.md (#3666) 2020-05-28 11:43:57 -07:00
Josh Soref
a724574ede chore: Spelling (#3647)
chore: Spelling (#3647)
2020-05-27 10:22:13 -07:00
Buvanesh Kumar
1c5fc0076e Dynamically get the account details from gcloud (#3662) 2020-05-27 10:10:56 -07:00
Alexander Matyushentsev
f826b0e397 chore: fix image dev build command (#3659) 2020-05-27 08:04:09 +02:00
jannfis
196eb16244 chore: Migrate GH image build action to go modules (#3654) 2020-05-26 14:10:39 -07:00
Josh Soref
09f3b45e39 chore: Spelling - md files (#3651)
chore: Spelling - md files (#3651)
2020-05-26 13:58:29 -07:00
jannfis
c914ea0218 chore: Update Dockerfile to reflect switch to go modules (#3652)
* chore: Update Dockerfile to reflect switch to go modules
2020-05-26 12:42:58 -07:00
jannfis
5ad46b025a docs: Adapt contribution guide for Go modules (#3653) 2020-05-26 21:30:40 +02:00
Alexander Matyushentsev
22dcc1e87d fix: prevent possible null pointer dereference error in TestAddHelmRepoInsecureSkipVerify test (#3650) 2020-05-26 10:52:12 -07:00
Alexander Matyushentsev
91d5d7e37b fix: sort output of 'argocd-util resource-overrides action list' command (#3649) 2020-05-26 10:49:28 -07:00
jannfis
23bf07d206 chore: Migrate to Go modules (#3639)
* chore: Migrate to Go modules

* Update CircleCI config

* Fix path

* Attach vendor for test step correctly

* restore_vendor -> attach_vendor

* Update cache path

* Checkout code before attaching vendor

* Move checkout to even earlier in job

* Don't restore cache for e2e step

* .

* Explicitly set GOPATH

* Restore Build cache

* Fix permissions

* Set correct environment for docker env

* Uncache everything

* Fix permissions

* Use workspace for caching Go code

* .

* go mod tidy

* Try to speed up builds

* Make mod target implicit dependencies

* Do not call make mod-download or mod-vendor

* Fix permissions

* Don't have modules dependendencies on test-e2e-local

* Fix confgi

* Bye bye

* Remove test parallelism

* Get max test parallelism back in, but with lower value
2020-05-26 18:15:38 +02:00
Im, Juno
6637ee5c24 fix: oidc should set samesite cookie (#3632)
* fix: oidc should set samesite cookie

* edit: adapt the path value for cookies from root path
2020-05-26 09:13:50 +02:00
jannfis
867282f726 fix: Allow underscores in hostnames in certificate module (#3596) 2020-05-25 21:34:06 +02:00
Phil Gore
8aadc310c9 fix: apply scopes from argocd-rbac-cm to project jwt group searches (#3508)
* merging changes

* apply scopes from argocd-rbac-cm to projects

* fixing server merge conflict

* passing tests
2020-05-25 09:05:56 +02:00
May Zhang
ac097f143c Fixing how to compare two objects. (#3636) 2020-05-22 15:10:25 -07:00
Alexander Matyushentsev
4a12cbb231 fix: fix nil pointer dereference error after cluster deletion (#3634) 2020-05-22 09:35:04 -07:00
Chance Zibolski
40eb8c79ab feat: Upgrade kustomize to 3.5.5 (#3619)
* feat: Upgrade kustomize to 3.5.5
2020-05-20 19:24:25 -07:00
Florian
710d06c800 docs: minor typo fix (#3625)
Just a quick typo fix
2020-05-20 20:46:07 +02:00
Alexander Matyushentsev
2f2f39c8a6 feat: upgrade gitops engine version (#3624) 2020-05-20 11:15:23 -07:00
Andy Feller
7c831ad781 docs: Fix minor typos in code examples (#3622) 2020-05-20 18:37:27 +02:00
Alexander Matyushentsev
51998e0846 feat: argocd-util settings resource-overrides list-actions (#3616) 2020-05-19 14:46:46 -07:00
jannfis
313de86941 fix: Prevent possible nil pointer dereference when getting Helm client (#3613) 2020-05-19 18:40:50 +02:00
dthomson25
0a4ce77bce Add Rollout Restart to Discovery.lua script (#3607)
* Add Rollout Restart to Discovery.lua script

* Fix tests
2020-05-19 08:16:08 -07:00
Shuhei Kitagawa
f95004c428 fix: Allow CLI version command to succeed without server connection (#3049) (#3550) 2020-05-19 14:21:34 +02:00
Drew Boswell
f59391161e docs: Update USERS.md with Swissquote (#3605)
* Update USERS.md

* Update USERS.md
2020-05-19 14:19:38 +02:00
Alexander Matyushentsev
27e95df536 feat: update gitops engine version to get access to sync error (#3609) 2020-05-18 12:26:34 -07:00
May Zhang
ec23d917eb feat: adding failure retry (#3548)
* Initial Try of failure retry

* Get failureRetryCount and failureRetryPeriodSecond from command line args.

* Get failureRetryCount and failureRetryPeriodSecond from command line args.

* Get failureRetryCount and failureRetryPeriodSecond from command line args.

* Get failureRetryCount and failureRetryPeriodSecond from command line args.

* Update logic to find out if we should retry.

* 1. add retry wrapper to only argo client.
2. change to env variables instead of command line arguments.

* keep imports grouped

* resolve merge conflict
2020-05-18 09:51:03 -07:00
Micke Lisinge
991ee9b771 feat: Implement GKE ManagedCertificate CRD health checks (#3600)
* Implement GKE ManagedCertificate CRD health checks

* Retrigger CI pipeline

* Match against FailedNotVisible instead of Failed
2020-05-17 17:23:54 +02:00
Alexander Matyushentsev
c21a6eae7d docs: update 1.5.4 changelog (#3585)
* docs: update 1.5.4 changelog

* Update CHANGELOG.md
2020-05-16 17:26:02 +02:00
jannfis
173a0f011d chore: Fix Docker mounts for good (#3597) 2020-05-15 14:43:12 -07:00
Alexander Matyushentsev
fe8d47e0ea feat: move engine code to argoproj/gitops-engine repo (#3599) 2020-05-15 14:39:29 -07:00
Alexander Matyushentsev
192ee93fc4 feat: Gitops engine (#3066)
* Move utils packages that are required for gitops engine under engine/pkg/utils package.
Following changes were implemented:
* util/health package is split into two parts: resource health assessement & resource health assessement and moved into engine/pkg/utils
* utils packages moved: Closer and Close method of util package moved into engine/pkg/utils/io package
* packages diff, errors, exec, json, kube and tracing moved into engine/pkg/utils

* Move single cluster caching into engine/kube/cache package

* move sync functionality to engine/kube/sync package

* remove dependency on metrics package from engine/pkg/utils/kube/cache

* move annotation label definitions into engine/pkg/utils/kube/sync

* make sure engine/pkg has no dependencies on other argo-cd packages

* allow importing engine as a go module

* implement a high-level interface that might be consumed by flux

* fix deadlock caused by cluster cache event handler

* ClusterCache should return error if requested group kind not found

* remove obsolete tests

* apply reviewer notes
2020-05-15 10:01:18 -07:00
Jai Govindani
490d4004b1 docs: typo/punctuation in tracking_strategies.md (#3449)
* Fix typo/punctuation

* Add Honestbank to USERS.md

* fix: typo in image caption

Signed-off-by: Jai Govindani <jai@honestbank.com>
2020-05-15 18:25:23 +02:00
Shuhei Kitagawa
c2ff86e8b2 chore: Change cli log to logrus (#3566) 2020-05-15 17:49:35 +02:00
chroju
a32f70f207 Fix small typo in user management docs (#3438) 2020-05-14 07:42:08 -07:00
jannfis
02b3c61fd9 feat: Introduce diff normalizer knobs and allow for ignoring aggregated cluster roles (#2382) (#3076)
* Add the ability to ignore rules added by aggregated cluster roles
2020-05-13 13:34:43 -07:00
Riccardo M. Cefala
f822d098c3 Add External Secrets Operator to secret management list (#3579) 2020-05-13 11:36:12 -07:00
Alexander Matyushentsev
dc5ac89f36 docs: add more details about redis issue during 1.4 -> 1.5 upgrade (#3584) 2020-05-13 11:08:13 -07:00
Christine Banek
046406e7d3 fix: Fix login with port forwarding (#3574)
The argocd command line supports using the --port-forward options
to allow you to connect to an argocd without an ingress rule.  This
is especially useful for command line automation of new environments.

But login doesn't respect port-forward - making it impossible to login
to argocd to be able to later create apps.  App creation works fine
with port-forwarding after being able to login.
2020-05-13 10:28:42 -07:00
Alexander Matyushentsev
4f49168c1a fix: use 'git show-ref' to both retrieve and store generated manifests (#3578)
* fix: use 'git show-ref' to both retrieve and store generated manifests

* print warning message when an incorrect repo tag is detected
2020-05-13 10:19:59 -07:00
Simon Rüegg
22bb1dd40f feat: Implement Crossplane CRD health checks (#3581)
* Implement Crossplane CRD health checks

A health check for the ClusterStackInstall CRD to help Argo CD to wait
for a successful install.

Signed-off-by: Simon Rüegg <simon@rueggs.ch>

* Add VSHN to USERS.md

Signed-off-by: Simon Rüegg <simon@rueggs.ch>
2020-05-13 09:45:27 -07:00
Alexander Matyushentsev
cd1de6e680 fix: redis request failed with nil error should not be counted as failed (#3576) 2020-05-12 18:02:22 -07:00
Alexander Matyushentsev
24fa758444 fix: enable redis retries; add redis request duration metric (#3575) 2020-05-12 14:39:18 -07:00
jannfis
9208176e86 feat: Allow selecting TLS ciphers on server (#3524) 2020-05-12 12:32:06 -07:00
rachelwang20
66e1fb78f7 feat: Adding deploy time and duration label (#3563)
* Adding deploy time and duration label

* Update application-deployment-history.tsx

* Adding deploy time and duration label

* Formatting
2020-05-11 13:24:29 -07:00
May Zhang
e42102a67e fix: when --rootpath is on, 404 is returned when URL contains encoded URI (#3564)
* Fix when --rootpath is on, 404 is returned when URL contains encoded URI

* Update doc

* Update doc
2020-05-11 08:39:27 -07:00
dthomson25
887adffcc8 Add Rollout restart action (#3557) 2020-05-08 14:08:34 -07:00
Shuwei Hao
c66919f9ff support delete cluster from UI (#3555)
Signed-off-by: haoshuwei <haoshuwei24@gmail.com>
2020-05-08 09:22:11 -07:00
jqlu
301d18820a feat: add button loading status for time-consuming operations (#3559) 2020-05-08 00:21:20 -07:00
jannfis
d2d37583af docs: Add note about required ConfigMap annotation to docs (#3540)
* Add note about required ConfigMap annotation to docs

* More clarifications
2020-05-07 22:41:21 -07:00
iamsudip
e0e995a944 Add moengage to users list (#3542) 2020-05-07 22:40:36 -07:00
jannfis
1f87950d48 Update security docs to reflect recent changes (#3558) 2020-05-07 22:31:15 -07:00
Shuhei Kitagawa
9a17103830 feat: Add --logformat switch to API server, repository server and controller (#3408) 2020-05-05 14:03:48 +02:00
Shuhei Kitagawa
fd49a4e74f doc: Fix Contribution Guide link in running-locally.md (#3545) 2020-05-05 12:32:47 +02:00
May Zhang
e78f61ea37 Fix version (#3544) 2020-05-04 14:48:16 -07:00
SB
e5d4673eac feat: Add a Get Repo command to see if Argo CD has a repo (#3523)
* fix: Updating to jsonnet v1.15.0 fix issue #3277

* feat: Changes from codegen, adding a repository gt service

* feat: Adding a get repository command

* Retrigger CI pipeline

* refactor: delete deprecated option on Get
refactor printing getcommand result
Getrepository() dependent on rbac enforcement

* fix: setting Get repo command to get
2020-05-04 09:20:48 +02:00
jannfis
3df4850418 fix: Disable keep-alive for HTTPS connection to Git (#3531) 2020-05-01 10:56:25 -07:00
Chris Pappas
1b0421c3aa docs: Adding OneLogin integration docs (#3529) 2020-04-30 21:05:03 -07:00
Alexander Matyushentsev
20d56730ff Revert "fix: Text overflow when the application status panel item was too big (#3460)" (#3530)
This reverts commit ffc99354d2.
2020-04-30 17:47:03 -07:00
Martin Jaime
ffc99354d2 fix: Text overflow when the application status panel item was too big (#3460) 2020-04-30 14:23:12 -07:00
Alexander Matyushentsev
e845478a96 docs: v1.5.3 changelog (#3526)
* docs: v1.5.3 changelog

* address reviewer notes
2020-04-30 13:17:44 -07:00
Alexander Matyushentsev
28dd7167d0 docs: describe upgrading process and version breaking changes (#3512)
* docs: describe upgrading process and version breaking changes

* add upgrading instructions link to overview doc
2020-04-30 12:28:39 -07:00
May Zhang
faee66888e docs: update document for --rootpath support for argoCD server and UI (#3525)
* Update document for rootpath support
2020-04-30 12:01:54 -07:00
Moses Bett
fc753ac489 added MTN Group as a user of ArgoCD (#3497) 2020-04-30 11:19:46 -07:00
jqlu
88a76022c1 fix: remove extra backtick(`) in JSX (#3518) 2020-04-30 09:42:04 -07:00
Alexander Matyushentsev
31df9d11a9 feat: upgrade helm 3 to v3.2.0; user --insecure-verify-flag (#3514) 2020-04-29 21:04:25 -07:00
May Zhang
7ed6c18762 fix: to support --rootpath (#3503)
* added path to cookie

* additional changes to support rootpath:
1. when using https, redirect to the right URL.
2. when rootpath is set, handle healthz, swagger, etc.

* additional changes to support rootpath:
1. when using https, redirect to the right URL.
2. when rootpath is set, handle healthz only.

* additional changes to support rootpath:
1. when using https, redirect to the right URL.
2. when rootpath is set, handle healthz only.

* Fixed for swagger-ui with rootpath

* Fixed for swagger test

* Fixed for redirect path

* Fixed for redirect path
2020-04-29 14:40:03 -07:00
Alexander Matyushentsev
81d5b13083 fix: api incorrectly verifies if auto-sync is enabled and reject sync local request (#3506) 2020-04-29 00:09:27 -07:00
Alexander Matyushentsev
02624bf3a6 fix: redis timeout should be more than client timeout (#3505) 2020-04-29 08:49:10 +02:00
Alexander Matyushentsev
842a3d12f6 feat: add redis metrics to application controller and api server (#3500)
* add redis metrics to application controller and api server

* fix failed test
2020-04-28 12:52:03 -07:00
May Zhang
14f1725f53 added path to cookie (#3501) 2020-04-28 10:26:47 -07:00
Alexander Matyushentsev
9b142c799a fix: 'argocd sync' does not take into account IgnoreExtraneous annotation (#3486) 2020-04-28 08:49:07 -07:00
May Zhang
d77072b534 fix: Set root path (#3475)
* Set root path

* updated http mux if --rootpath is set during server startup.
updated baseHRef if --rootpath is set.
added --grpc-web-root-path for CLI.

* added rootpath as part of config context name

* clean up not used variables.
2020-04-27 08:35:58 -07:00
Alexander Matyushentsev
8a77075cff fix: CLI renders flipped diff results (#3480) 2020-04-24 10:18:15 -07:00
Alexander Matyushentsev
f5b600d4af feat: limit the maximum number of concurrent login attempts (#3467)
* feat: limit the maximum number of concurrent login attempts

* unit test rate limiter

* address reviewer questions
2020-04-23 12:33:17 -07:00
Alexander Matyushentsev
4ae70139d9 feat: upgrade kustomize version to 3.5.4 (#3472) 2020-04-23 10:29:15 -07:00
rumstead
7660e40fdc Update README.md (#3470)
Fix spelling/spacing
2020-04-23 07:49:01 -07:00
Alexander Matyushentsev
310b40aa20 feat: downgrade dex to 2.22.0 and revert bug workaround (#3468) 2020-04-22 17:34:58 -07:00
Alexander Matyushentsev
0b0c72a80b docs: update incorrect sync options example (#3457) 2020-04-22 09:41:57 +02:00
Alexander Matyushentsev
14188656c8 fix: GetApplicationSyncWindows API should not validate project permissions (#3456) 2020-04-21 11:26:17 -07:00
jannfis
76bacfdea4 fix: Add initial implementation for rate limiting failed logins (#3404)
* fix: Add initial implementation  for rate limiting failed logins

* Trigger test build

* Remove deprecated code and fix new project tests

* move cache related code from sessionmanager to cache access wrapper

* avoid using sleep in sessionmanager tests

* mention SECONDS in session manager environment variables to make it easier to understand meaning of each variable

* Login button should be disabled while user is waiting for login result

* prevent timing-based user enumeration attack

* reject too many failed attempts; always compute hash and introduce random delay

* remove unused constants

* fix linter errors

Co-authored-by: Alexander Matyushentsev <amatyushentsev@gmail.com>
2020-04-21 11:10:25 -07:00
Alexander Matyushentsev
ee44e489b5 fix: javascript error on accounts list page (#3453) 2020-04-21 10:08:36 -07:00
Alexander Matyushentsev
89774fef17 fix: argocd-util kubeconfig should use RawRestConfig to export config (#3447)
* fix: argocd-util kubeconfig should use RawRestConfig to export config

* document 'argocd-util kubeconfig' command
2020-04-21 13:45:20 +02:00
Alexander Matyushentsev
acc2369dc7 feat: upgrade dex to v2.23.0 (#3448)
* feat: upgrade dex to v2.23.0

* workaround for https://github.com/dexidp/dex/issues/1695
2020-04-20 22:22:19 -07:00
Alexander Matyushentsev
9de06e35eb Clean docker images before building Argo CD image to avoid no disk space left failure (#3446) 2020-04-20 15:57:36 -07:00
jannfis
4575adca86 chore: Disable lint in CI due to OOM fails (#3444) 2020-04-20 23:01:05 +02:00
jannfis
ca42a375c2 Revert "feat: metrics, argocd_app_info adding syncpolicy info, argocd_cluster_info adding clustername (#3411)" (#3443)
This reverts commit 0214eb8d92.
2020-04-20 08:55:38 -07:00
wecger
0214eb8d92 feat: metrics, argocd_app_info adding syncpolicy info, argocd_cluster_info adding clustername (#3411)
* extending metrics with syncpolicies and clustername

* extending metrics with syncpolicies and clustername: fixing tests

* extending metrics with syncpolicies and clustername: fixing order in labels

* extending metrics with syncpolicies and clustername: fixing lint issues
2020-04-20 11:32:20 +02:00
Alexander Matyushentsev
949518e680 fix: sort imports in knowntypes_normalizer.go (#3440)
* fix: sort imports in knowntypes_normalizer.go

* drafT
2020-04-19 09:05:26 +02:00
Ed Lee
81e4bb1fef Update OWNERS (#3439) 2020-04-18 19:54:44 -07:00
Alexander Matyushentsev
35b40cdb22 fix: support both <group>/<kind> as well as <kind> as a resource override key (#3433) 2020-04-17 09:23:19 -07:00
Alexander Matyushentsev
fa47fe00a2 fix: Grafana dashboard should dynamically load list of clusters (#3435) 2020-04-17 00:13:34 -07:00
Alexander Matyushentsev
743371ed4f fix: use $datasource variable as a source for all dashboard panels (#3434) 2020-04-16 18:13:52 -07:00
jannfis
75d9f23adb chore: Migrate golangci-lint into CircleCI tests (#3427) 2020-04-16 08:55:13 -07:00
SB
e05ebc4990 fix: Updating to jsonnet v1.15.0 fix issue #3277 (#3431) 2020-04-16 08:44:51 -07:00
May Zhang
6ffd34dcf9 fix for helm repo add with flag --insecure-skip-server-verification (#3420) 2020-04-15 16:56:27 -07:00
Alexander Matyushentsev
16c6eaf9ae feat: support user specified account token ids (#3425) 2020-04-15 15:19:25 -07:00
Alexander Matyushentsev
e67a55463f fix: update min CLI version to 1.4.0 (#3413) 2020-04-15 14:17:24 -07:00
jannfis
476cb655b7 fix: Make CLI downwards compatible using old repository API (#3418) 2020-04-15 23:05:17 +02:00
jannfis
6c1ccf4d60 docs: Update documentation for CVE-2020-5260 (#3421) 2020-04-15 12:16:29 -07:00
Alexander Matyushentsev
05f5a79923 feat: support separate Kustomize version per application (#3414) 2020-04-15 12:04:31 -07:00
May Zhang
3dbc330cf0 fix: app diff --local support for helm repo. #3151 (#3407)
* Fixing argocd app diff when using helm repo

* adding test code

* get rid of optional parameter

* get rid of optional parameter

* Added test case

* Fix failed tests
2020-04-14 08:13:38 -07:00
jannfis
8ad928330f chore: Fix a bunch of lint issues (#3412)
* chore: Fix linter complaints
2020-04-14 08:01:43 -07:00
Bruno Clermont
355e77e56f feat: add support for dex prometheus metrics (#3249) 2020-04-14 07:53:59 -07:00
Alexander Matyushentsev
376d79a454 feat: add settings troubleshooting commands to the 'argocd-util' binary (#3398)
* feat: add settings troubleshooting commands to the 'argocd-util' binary
2020-04-14 07:51:16 -07:00
peteski
b74a9461ed docs: Updated best practices to remove typos. (#3410)
Fixed typos in best practices section for immutability.
2020-04-14 12:26:09 +02:00
rachelwang20
b4236e1dc7 feat: Let user to define meaningful unique JWT token name (#3388)
* feat: Let user to define meaningful unique JWT token name

* Update sessionmanager.go

* Update server_test.go

* Update sessionmanager_test.go

* Adding get JWTToken by id if not then by issued time

* Adding relate tests

* Adding relate tests

* Retrigger the build

* feat: Let user to define meaningful unique JWT token name

* Update sessionmanager.go

* Update server_test.go

* Update sessionmanager_test.go

* Adding get JWTToken by id if not then by issued time

* Adding relate tests

* Retrigger the build

* feat: Let user to define meaningful unique JWT token name

* Adding get JWTToken by id if not then by issued time

* Adding relate tests

* Adding UI change

* add yarn lint
2020-04-13 14:13:05 -07:00
jannfis
6ecc25edbd docs: Beautify & update security considerations doc (#3400) 2020-04-13 21:51:40 +02:00
jannfis
56ca1fb4ea chore: Fix some Sonarcloud related quirks (#3399)
* chore: Fix some Sonarcloud related quirks
2020-04-13 11:45:54 -07:00
jannfis
3629346085 chore: Workaround for CircleCI bug (#3397)
* chore: workaround circleci bug

* Oops
2020-04-10 15:47:49 -07:00
jannfis
092072a281 chore: Add sonarqube configuration for CI (#3392) 2020-04-10 22:18:31 +02:00
Alexey Osheychik
e1142f9759 docs: Fix azure AD integration doc (#3396)
* docs: Add permissions configuration process for Azure to docs

* docs: Update configuration for Azure SSO integration
2020-04-10 13:03:11 +02:00
jannfis
fbd3fe69ff docs: Add bug triage process proposal to docs (#3394) 2020-04-09 11:35:37 -07:00
ramz
f05f84979c Fix for #3286 updated with the expected display message. (#3385) 2020-04-09 11:21:38 -07:00
Devan Goodwin
3d6ff9e903 Add a fake owner reference for ClusterServiceVersion. (#3390)
For anyone installing an Operator Lifecycle Manager operator, the ArgoCD
UI would show your OperatorGroup and Subscription, but would not detect
the resulting ClusterServiceVersion, and subsequent pods etc, limiting
the value of the UI in viewing overall status of your operator.

The CSV should not technically have an owner reference, so we add a fake
one in similar fashion to the pre-existing code above for endpoints. The
CSV then is linked to it's OperatorGroup via the olm.operatorGroup
annotation. The CSV has no link to it's Subscription or InstallPlan that
I can see. Adding an annotation to this might be something we could
pursue with OLM folks.
2020-04-09 11:20:37 -07:00
Alexander Matyushentsev
4c812576c1 chore: minor dev tools fixing for mac (#3330) 2020-04-09 15:01:45 +02:00
jannfis
6753fc9743 Add Dex and missing url field to FAQ (#3380) 2020-04-08 13:23:23 -07:00
Andreas Kappler
8d082cc46e feat: Introduce sync-option SkipDryRunOnMissingResource=true (#2873) (#3247)
* feat: Introduce sync-option SkipDryRunOnMissingResource=true
2020-04-08 10:53:18 -07:00
Denis Jajčević
f586385c8b docs: Fix diffing_known_types.txt link (#3381)
Update documentation to have valid link to `diffing_known_types.txt`.
2020-04-08 19:03:07 +02:00
jannfis
466c73fa3b chore: Code coverage offensive 05: util/clusterauth (#3371)
* Add first batch of clusterauth tests

* More tests
2020-04-07 12:39:24 +02:00
May Zhang
9e6c78d55c Fix for jsonnet when it is localed in nested subdirectory and uses import (#3372) 2020-04-06 15:20:07 -07:00
jannfis
c6af4cca10 docs: Clarify RBAC requirement for local users (#3361)
* Clarify RBAC requirement for local users

* Update docs/operator-manual/user-management/index.md

Co-Authored-By: Alexander Matyushentsev <AMatyushentsev@gmail.com>

Co-authored-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-04-06 21:41:10 +02:00
Alexander Matyushentsev
5448466ddc feat: support normalizing CRD fields that use known built-in K8S types (#3357)
* feat: support normalizing CRD fields that use known built-in K8S types

* apply reviewers notes

* fix codegen
2020-04-06 21:13:50 +02:00
yutachaos
0eec2fee71 fix: Update 4.5.3 redis-ha helm manifest (#3370)
Signed-off-by: yutachaos <18604471+yutachaos@users.noreply.github.com>
2020-04-06 12:02:40 -07:00
Alexander Matyushentsev
e5452ff70e fix: return 401 error code if username does not exist (#3369) 2020-04-06 11:15:15 +02:00
jannfis
9fdd782854 fix: Do not panic while running hooks with short revision (#3368) 2020-04-05 23:54:09 -07:00
jannfis
053ae28ed5 Add note about .git suffixes for GitLab repository URLs (#3363) 2020-04-05 21:09:54 -07:00
jannfis
6eb4f41343 chore: Keep autogenerated message in upstream.yaml for HA manifests (#3367)
* fix: Keep autogenerated message in upstream.yaml
2020-04-05 21:08:59 -07:00
Alexander Matyushentsev
d9072d8200 docs: mention issue #3358 in 1.5 changelog (#3359) 2020-04-04 08:43:38 +02:00
Alexander Matyushentsev
238abbf771 docs: document built-in user limitations and workaround (#3341)
* document security limitations

* minor issue description revisions + formatting

* Update security.md

* move CVEs description into separate document

Co-authored-by: Matt Hamilton <matt@soluble.ai>
Co-authored-by: Ed Lee <edlee2121@users.noreply.github.com>
2020-04-04 08:43:21 +02:00
jannfis
aa4fb9ab4a fix: Increase HAProxy check interval to prevent intermittent failures (#3356)
* Increase HAProxy check interval to prevent intermittent failures/state flapping

* Restore original namespace
2020-04-03 17:10:37 -07:00
May Zhang
55bc144410 fix: Helm v3 CRD are not deployed (#3345)
* Fixing could not find plugin issue when app sync and app diff

* Fixing codegen error

* Revert "Fixing codegen error"

This reverts commit b2dcfb81

* Fixing codegen error

* If user is logged in, settings API would return ConfigManagementPlugins

* For helm3, add flag --include-crds when calling helm template to support helm3 crd

* Fixing typo.

* Added further assertion of ResourceSyncStatusIs for CRD resources.
2020-04-03 13:41:17 -07:00
jannfis
c428e091ab chore: Fix flaky test TestWatchCacheUpdated (#3350) 2020-04-03 18:26:37 +02:00
Sara Jarjoura
c13bf422f8 docs: Added detail on how to use the caData field with Okta SAML (#3351) 2020-04-03 16:49:11 +02:00
jannfis
b4bbe60b8c chore: Code coverage offensive 02: util/argo (#3329) 2020-04-03 09:53:47 +02:00
jannfis
4fdf573fd1 chore: More tests (#3340) 2020-04-02 23:38:23 +02:00
rachelwang20
d326daef62 Rebase (#3333) 2020-04-02 11:08:24 -07:00
May Zhang
98337065ae fix: Fixing could not find plugin issue when app sync and app diff (#3326)
* Fixing could not find plugin issue when app sync and app diff

* Fixing codegen error

* Revert "Fixing codegen error"

This reverts commit b2dcfb81

* Fixing codegen error

* If user is logged in, settings API would return ConfigManagementPlugins
2020-04-02 09:50:42 -07:00
jannfis
1b1df76ef2 chore: Code coverage offensive 03: util/cache (#3335)
* Add dependency for miniredis, used for unit testing Redis cache

* Add more tests
2020-04-02 09:16:42 -07:00
Yurii Komar
7f40739b97 Changed GRPC Message Size for apiclient (#3337) 2020-04-02 09:14:02 -07:00
dthomson25
9db879f68f Add V0.8 changes to Rollouts healthcheck (#3331) 2020-04-02 09:00:30 -07:00
Alexander Matyushentsev
e4235dabb8 docs: improved Grafana dashboard (#3327) 2020-04-01 11:58:43 -07:00
May Zhang
ff07b112b1 fix: update documentation for adding environment variable KUBE_VERSION and KUBE_API_VERSION (#3323)
* ArgoCD plugin: add environment variable KUBEVERSION and KUBE_API_VERSIONS.

* Added test verification of KUBE_API_VERSION

* Using assert.EqualValues for assertion.

* update build-environment.md to add KUBE_VERSION and KUBE_API_VERSIONS
2020-03-31 20:21:39 -07:00
Alexander Matyushentsev
53e618a4c0 docs: mention metrics changes and add legacy grafana dashboard (#3324) 2020-03-31 17:54:57 -07:00
Alexander Matyushentsev
eae0527839 fix: argocd fails to connect clusters with IAM authentication configuration (#3325) 2020-03-31 17:44:00 -07:00
jannfis
2d79dbb0bb chore: Update argocd-test-tools to Go v1.14.1 (#3306)
* Update test-tools-image to v0.2.0 and optimize layers in Dockerfile

* Also adapt CirclCI config for new image

* Retrigger CI on possible flaky test
2020-03-31 19:33:59 +02:00
Dai Kurosawa
a501cdbb56 chore: Upgrade golang version from v1.14.0 to v1.14.1 (#3304)
* Upgrade golang version from v1.14.0 to v1.14.1

* use argocd-test-tools version v0.2.0
2020-03-31 19:13:51 +02:00
May Zhang
d2c1821148 feat: ArgoCD plugin: add environment variable KUBEVERSION and KUBE_API_VERS… (#3318)
* ArgoCD plugin: add environment variable KUBEVERSION and KUBE_API_VERSIONS.

* Added test verification of KUBE_API_VERSION

* Using assert.EqualValues for assertion.
2020-03-31 09:13:15 -07:00
rachelwang20
00d44910b8 feat: Whitelisted namespace in UI (#3314)
* Including namespace whiteliste resources support

* regenerate CRD definition and related go code

* Redo make codegen

* revert pkg/apiclient/repository/repository.pb.go

* Whitelisted namespace in UI

* Reflect the whitelist description

* Break one long line to two lines

* Break lines

* Adding line break

* Formatting

Co-authored-by: Alexander Matyushentsev <amatyushentsev@gmail.com>
2020-03-30 16:13:40 -07:00
Alexander Matyushentsev
7ae204d426 fix: avoid nil pointer dereference in badge handler (#3316) 2020-03-30 14:27:43 -07:00
Alexander Matyushentsev
6411958be5 fix: pass APIVersions value to manifest generation request during app validation and during app manifests loading (#3312)
* fix: pass APIVersions value to manifest generation request during app validation and during app manifests loading
2020-03-30 13:36:46 -07:00
jannfis
a7f6866344 Add UI lint instructions and accompanying targets to Makefile (#3315) 2020-03-30 22:21:27 +02:00
Shuwei Hao
c71bfc62ba fix: update help info about argcd account can-i (#3310)
Signed-off-by: Shuwei Hao <haoshuwei24@gmail.com>
2020-03-30 11:49:03 +02:00
jannfis
c4d6fde1c4 chore: Code coverage offensive #1: util/dex (#3305)
* Fix possible panic when generating Dex config from malformed YAML

* Add first batch of tests for util/dex

* More tests

* More tests

* More tests

* Use constants
2020-03-29 14:02:04 -07:00
jannfis
306a84193a Fix possible panic when generating Dex config from malformed YAML (#3303) 2020-03-29 11:42:17 +02:00
jannfis
b02f7f14a7 chore: Run "dep check" in CircleCI pipeline to detect for changes in Gopkg.lock (#3301)
* Run "dep check" in CircleCI pipeline to detect for changes in Gopkg.lock

* Run dep check after restoring vendor cache

* Use -skip-vendor on dep check
2020-03-29 11:10:02 +02:00
Alexander Matyushentsev
ac8ac14545 fix: SSO user unable to change local account password (#3297) (#3298)
* fix: SSO user unable to change local account password (#3297)

* apply code review notes
2020-03-29 10:35:25 +02:00
Alexander Matyushentsev
cdb8758b34 fix: use pagination while loading initial cluster state to avoid memory spikes (#3299) 2020-03-27 22:31:36 -07:00
Alexander Matyushentsev
521f87fe5f fix: convert 'namesuffix', 'nameprefix' string flags to boolean flags in 'argocd app unset' (#3300) 2020-03-27 20:26:22 -07:00
jannfis
27141ff083 chore: Containerize complete build & test toolchain (#3245)
chore: Containerize complete build & test toolchain
2020-03-27 11:36:20 -07:00
Alexander Matyushentsev
7599516f68 fix: fix Cannot read property 'length' of undefined error (#3296) 2020-03-27 10:48:49 +01:00
rachelwang20
e3a18b9cd7 feat: Including namespace whiteliste resources support (#3292)
feat: Including namespace whiteliste resources support (#3292)
2020-03-26 16:13:31 -07:00
May Zhang
eef35a32ab feat: Argocd App Unset Kustomize Override (#3289)
feat: Argocd App Unset Kustomize Override (#3289)
2020-03-26 15:35:55 -07:00
jannfis
e26dace64d Fix unparam errors from linter (#3283) 2020-03-26 09:31:22 -07:00
Adriaan Knapen
1520346369 docs: document Traefik 2 ingress requires disabling TLS (#3284) 2020-03-26 09:30:35 -07:00
Therianthropie
702d4358d1 Add Healy to USERS.md (#3250)
Moved Healy entry to the right position
2020-03-26 09:03:30 -07:00
Alexander Matyushentsev
0162971ea0 fix: implement workaround for helm/helm#6870 bug (#3290)
* fix: implement workaround for  helm/helm#6870 bug

* Update app_management_test.go
2020-03-25 21:07:02 -07:00
Alexander Matyushentsev
7fd7999e49 fix: increase max connections count to support clusters with very large number of CRDs (#3278) 2020-03-25 01:02:33 -07:00
Alexander Matyushentsev
03f773d0ff docs: add slack link to issue template (#3273) 2020-03-24 09:08:35 +01:00
Alexander Matyushentsev
c4bc740fb7 docs: fix resource hooks docs layout (#3266) (#3272) 2020-03-24 08:55:14 +01:00
Jesse Suen
5934bc4699 improvement: remove app name and project labels from reconcliation histogram to reduce cardinality (#3271) 2020-03-23 16:07:37 -07:00
Josef Meier
3f0d26ec17 Refine docs: How to explicitly select a tool (#3261)
Its easy to misconfigure the Application if you use the Application creation wizard, because the default is 'Directory'. If you choose that, your kustomize repo won't work.
2020-03-23 09:54:09 -07:00
Alexander Matyushentsev
7665e58613 chore: update example dashboard to use updated metrics (#3264) 2020-03-23 09:53:04 -07:00
Alexander Matyushentsev
ab80a8126b fix: prevent syncing the same cluster cache multiple times due to race condition (#3256) 2020-03-19 12:44:23 -07:00
Jesse Suen
6905196665 feat: rework prometheus metrics to support richer dashboards (#3254)
* the argocd_app_sync_status and argocd_app_health_status are deprecated in place of additional labels to argocd_app_info
* argocd_app_created_time is deprecated
* deprecated labels can be re-enabled using ARGOCD_LEGACY_CONTROLLER_METRICS
* operation label was added to argocd_app_info to support a guauge of in-progress operations.
* dest_server label was added to k8s related counters to support filtering by cluster
2020-03-18 19:59:51 -07:00
Alexander Matyushentsev
4e283c14fb fix: upgrade argoproj/pkg version (#3255) 2020-03-18 18:22:40 -07:00
Alexander Matyushentsev
1b5925a494 fix: stop trigging auto-syncing if app only need to prune resources and automated prune is disabled (#3253) 2020-03-18 14:19:54 -07:00
Alexander Matyushentsev
d500b27f1d feat: store the name operation initator in the app CRD (#3252) 2020-03-18 13:32:39 -07:00
Alexander Matyushentsev
868b4c4c7c fix: UI crashes when trying to enable auto-sync (#3251) 2020-03-18 11:37:32 -07:00
Jesse Suen
4bbce1cb22 perf: reduce unnecessary K8s calls for CRDs during reconciliation (#3246)
* reduce K8s calls for CRDs during reconciliation
* additional metric labels to k8s API requests (server, verb, kind, namespace)
2020-03-18 03:28:31 -07:00
Bruno Clermont
127f50d697 fix: really skip app requeing for some types of resources (#3225)
* Really skip app requeing

* Add new user
2020-03-17 23:03:01 -07:00
Alexander Matyushentsev
e51aab8d1f fix: applications.List API should sort apps by name (#3248) 2020-03-17 17:10:54 -07:00
Miles Armstrong
85a746f861 feat: Add revision to status badge (#2445) (#3128)
* Refactor SVG and colour assignment

* Add option to include revision (short SHA) in the badge

* Remove unnecessary conversion
2020-03-17 15:44:40 -07:00
Alexander Matyushentsev
3c2be61827 feat: implement Service Account / Local Users (#3215)
* feat: implement Service Account / Local Users

* add local users documentation

* implement accounts management UI

* address code review notes
2020-03-17 15:31:37 -07:00
Alexander Matyushentsev
42d572306d feat: use --api-versions during helm chart rendering (#3243) 2020-03-17 14:20:36 -07:00
Alexander Matyushentsev
b3f8e7a02c docs: add v1.5 change log (#3244) 2020-03-17 11:50:00 -07:00
Jesse Suen
476b09cbbf feat: improve api-server and controller performance (#3222)
* group read comparison settings during app reconciliation
* Reduce lock contention in clusterInfo::ensureSynced(). Add getRepoObj stats
* Remove additional source of lock contention
* Exclude the coordination.k8s.io/Lease resource

Co-authored-by: Alexander Matyushentsev <amatyushentsev@gmail.com>
2020-03-16 11:51:59 -07:00
Conlan Cesar
487d6647d5 Add missing parentheses to Webhook docs (#3239) 2020-03-16 09:44:15 -07:00
jannfis
0378819c54 Test for nil to prevent nil pointer dereference (#3237) 2020-03-16 09:43:44 -07:00
jannfis
bbb925cb63 Update testify to v1.5.1 (#3209) 2020-03-13 19:33:22 -07:00
Alexander Matyushentsev
9d1a378ce8 fix: fix broken URL regex expression (#3236) 2020-03-13 14:35:08 -07:00
Alexander Matyushentsev
e2358cabc9 refactor: use http forwarders from argoproj/pkg repository (#3235) 2020-03-13 11:50:19 -07:00
Alexander Matyushentsev
5cd12a3943 fix: 'requires pruning' is not rendered on app details page for resources that should be pruned (#3234) 2020-03-13 11:36:08 -07:00
Alexander Matyushentsev
ebb06b8c89 fix: app reconciliation fails with panic: index out of (#3233) 2020-03-13 10:52:24 -07:00
Alexander Matyushentsev
d5d01eca3e fix: upgrade argoproj/pkg version to fix leaked sensitive information in logs (#3230) 2020-03-12 13:19:14 -07:00
bergur88
e13bb79578 add docs on mapping different scopes for microsoft (#3224) 2020-03-11 09:06:04 -07:00
khhirani
a8b6282b15 improvement: Surface failure reasons for Rollouts/AnalysisRuns (#3219)
* Modify AnalysisRun error messages. Return hard-coded value if AnalysisRun status doesn't contain message

* Create tests
2020-03-10 16:18:51 -07:00
Saradhi Sreegiriraju
fc00d73cf5 docs: Create USERS.md (#3206)
* Create USERS.md

Create a new USERS file to keep track of who is using Argo CD to minimize scrolling on README.

* Update README.md

Removed `Who users Argo CD` section from README. Users are now tracked in USERS file.

* Update README.md

* Update README.md

* Update USERS.md

* Update pull_request_template.md
2020-03-10 09:01:35 +01:00
CBytelabs
303d46e67c docs: Fixed documentation fault in user-guide/projects/ (#3207)
* Update projects.md

~ Fixed adding policy with wildcard in documentation

* Update projects.md

~ acutally fixed the command completly
2020-03-09 20:20:57 +01:00
Matthias Bertschy
a00798bc5e fix: set MaxCallSendMsgSize to MaxGRPCMessageSize for the GRPC caller (#3189) 2020-03-07 19:30:44 -08:00
Abdullah Alqarni
1c4a15129b feat(ui): add docs to sync policy options present in create application panel (Close #3098) (#3203)
* feat(ui): document sealHeal & pruneResources options in create-application panel

* fix(ui): re-order import statements in application-create-panel.tsx

* docs: correct a typo in user guide auto_sync.md

* docs: document Automatic Self-Healing in user guide auto_sync.md

* docs: add v1.4.3 changelog

* fix: capitalize git word

* docs: update CHANGELOG

* docs: remove CHANGELOG update
2020-03-07 18:03:15 +01:00
Alex Khaerov
0ca35ef26c Add Prudential to the customer list (#3199)
Signed-off-by: Alex Khaerov <alex.khaerov@prudential.com.sg>
2020-03-06 16:26:44 -08:00
Alexander Matyushentsev
b38a9aacb2 fix: codegen task is broken locally (#3200) 2020-03-06 12:51:03 -08:00
jannfis
5b239fc1d1 fix: stop caching helm index (#3193)
* fix: stop caching helm index

* Apply reviewer notes
2020-03-05 19:55:47 +01:00
jannfis
fdf7566bb7 fix: error message on login page if login is disabled (#3198) 2020-03-05 19:54:26 +01:00
Alexander Matyushentsev
389858b6df Add note about where the valueFiles param references (#3196)
This file seems to serve as the only real reference as to what parameters are available for the Application CRD. It took me a bit of trial and error to figure out that these are in the git repo referenced and relative to the path of the helm chart set previously. Hopefully this helps a future user save some time.
2020-03-05 10:00:33 -08:00
Alexander Matyushentsev
20adad76ef feat: Disable Admin Login (fixes #3019) (#3179)
feat: Disable Admin Login (fixes #3019) (#3179)
2020-03-04 15:26:07 -08:00
Alexander Matyushentsev
f37ae1c1f6 docs: document resource.inclusions setting (#3190)
* docs: document resource.inclusions setting

* clarify that resource.inclusions and resource.exclusions might be used together
2020-03-04 17:33:08 +01:00
Alexander Matyushentsev
6edd18bb89 feat: support helm3 (#2383) (#3178)
* feat: support helm3 (#2383)

* draft

* Apply reviewer notes
2020-03-04 17:05:44 +01:00
Alex Mironov
4d23fe8108 feat: add "service-account" flag to "cluster add" command (#3183) (#3184)
* Add "skip-rbac-setup" flag to "cluster add" command

"InstallClusterManagerRBAC" method of the clusterauth package
is somewhat opinionated about rolebindings and role definitions
for "argocd-manager" SA. Sometimes it is desirable however to manually
pre-configure such bindings and/or modify them in order to comply
with existing infrastructure requirements.

This commit introduces a new option "--skip-rbac-setup" which allows operator
to skip the aforementioned "InstallClusterManagerRBAC" method call.

* Modified --skip-rbac-setup into --service-account flag

* use reference instead of hardoded SA name
2020-03-04 14:25:36 +01:00
Andy Boyett
7eeefb003c docs: correct typo in diffing section on HPAs (#3172)
Reordering `spec.metrics` will fix an OutOfSync state due to the HPA
controller reordering this array. The previously referenced
`spec.replicas` field doesn't exist within any known version of the
`HorizontalPodAutoscaler` (autoscaling/v1, autoscaling/v2beta1, or
autoscaling/v2beta2)
2020-03-03 17:51:21 -08:00
Masaya Ozawa
3ae5b2bfe4 Fixed description of non-cascade command in App Deletion (#3173) 2020-03-02 18:01:05 +01:00
wecger
cdebd26ab4 examples/dashboard.json: removing filling, add increase to grpc metrics (#3154) 2020-02-28 10:12:02 -08:00
Alexander Matyushentsev
3a088c7c86 fix: dex proxy should forward request to dex preserving the basehref (#3165) 2020-02-28 18:57:14 +01:00
Dai Kurosawa
5a363e9d9f Update Go version from v1.13.8 to v1.14.0 (#3162) 2020-02-28 08:42:56 -08:00
Gustav Paul
57ea24281c fix: set default login redirect to baseHRef (#3164) 2020-02-27 11:35:51 -08:00
Gustav Paul
94d7c10baa fix: don't double-prepend basehref to redirect URLs (fixes #3137) (#3138)
* fix: don't double-prepend basehref to redirect URLs

Fixes https://github.com/argoproj/argo-cd/issues/3137

* ui/src/app: add basehref to window.location.href assignment
2020-02-26 15:13:42 -08:00
Shelby Moore
28027897aa fix: upgrade redis-ha chart and enable haproxy (#3147)
* fix: upgrade redis-ha chart and enable haproxy

* fix: regenerate manifests, revert removal of failover cache client

* fix: add kustomize patch to strip namespace from redis-ha manifests
2020-02-26 14:22:34 -08:00
nurinamu
0c610f91e5 fix broken url and resize it (#3145) 2020-02-26 14:18:41 -08:00
jannfis
990d9ef92b Use a more sane regexp pattern without capture groups for URL matching (#3161) 2020-02-26 10:07:52 -08:00
wecger
6592773a35 improvement: example/dashboard.json: added labels to legends (#3140) 2020-02-22 10:32:59 +01:00
Shelby Moore
beee4de10e fix: make dex server deployment init container resilient to restarts (#3136) 2020-02-20 21:52:21 +01:00
David J. M. Karlsen
7fde387dd6 Update auth0.md (#3133)
cosmetics

Signed-off-by: David Karlsen <david@davidkarlsen.com>
2020-02-19 11:30:00 -08:00
Dai Kurosawa
64c8ac70fb Update Go version from v1.13.7 to v1.13.8 (#3129) 2020-02-17 22:42:19 +01:00
Andreas Grimmer
f230df938e Improve docs for Hooks (#3115) 2020-02-14 07:39:47 -08:00
Alex Rowley
c9b0fdf1d7 Add missing CHANGELOG entry for 1.2.5 (#3109) 2020-02-14 07:39:08 -08:00
jannfis
ea57d15a80 fix: Allow multiple hostnames per SSH known hosts entry and also allow IPv6 (#2814) (#3074)
* Allow multiple hostnames per SSH known hosts entry and also allow IPv6

* Satisfy lint monster

* And also satisfy the other lint monster
2020-02-10 14:11:50 -08:00
Alex Collins
ebc048167c feat: Supports the validate-false option at an app level. Closes #1063 (#2542) 2020-02-10 14:09:25 -08:00
Nándor István Krácser
3b8405a89b add Bank-Vaults to Secret Management (#3106) 2020-02-10 14:05:22 -08:00
Jesse Suen
66d496d1ef fix: argocd-util backup produced truncated backups. import app status (#3096) 2020-02-10 11:24:33 -08:00
Alex Stein
9d71ae5ad6 Adding ThousandEyes to user-list in README.md (#3103) 2020-02-10 08:44:14 -08:00
Felix Gläske
85d660f0b9 Update custom_tools.md (#3100)
docs: fix typo in custom_tools.md (#3100)
2020-02-10 09:11:55 +01:00
Alexander Matyushentsev
d5286296eb fix: install exact version of mkdocs and mkdocs_material during docs site building (#3095) 2020-02-07 16:06:06 -08:00
Alexander Matyushentsev
916d4aed57 fix: reduct secret values of manifests stored in git (#3088) 2020-02-07 15:40:58 -08:00
Alexander Matyushentsev
59d7b7d2b4 fix: ui referring to /api/version using absolute path (#3092) 2020-02-07 15:39:07 -08:00
Alexander Matyushentsev
18c8716f0a feat: add dest cluster and namespace in the Events (#3093) 2020-02-07 15:38:58 -08:00
Fred Dubois
a1afe44066 docs: Fix json pointer in docs (#3087)
We just copy/pasted this json pointer because we deployed a
`MutatingWebhookConfiguration` and realized it wasn't fixing the out of sync.
2020-02-06 21:19:21 +01:00
Alexander Matyushentsev
1695457f9c fix: when user tries to rollback an app with auto-sync enabled UI should ask for user confirmation once (#3080) 2020-02-04 14:55:17 -08:00
Alexander Matyushentsev
06bc4064c1 fix: labels not being deleted via UI (#3081) 2020-02-04 13:49:21 -08:00
Abdullah Alqarni
d67b4f6c36 Fix: correct a typo in kustomize.md (#3079)
Only for the sake of perfection, replacing `it's` with `its` :)

More on this here[http://its-not-its.info/](http://its-not-its.info/)
2020-02-03 23:47:04 -08:00
Adam Johnson
d2ff5887ac Rollback disables auto sync issue #2441 (#2591)
* rollback disables auto sync

* add error check

* Add confirmation to disable auto sync in ui and revert backend change
2020-02-03 16:48:22 -08:00
eSamS
205926fa80 feat: allow ssh and http repository references in bitbucketserver webhook #2773 (#3036)
* check ssh and https url in bitbucketserver webhook

* do not break up checking webhook urls if one check fails

* log webhook url if regexp compile fails
2020-02-03 10:03:48 +01:00
jannfis
c4dd9d19c2 Use 'latest' as default tag for Docker image builds (#3072) 2020-02-01 20:47:25 -08:00
Guido Maria Serra+Fenaroli
74fe4af98e fix: HTTP|HTTPS|NO_PROXY env variable reading #3055 (#3063)
* attempting to fix HTTP|HTTPS|NO_PROXY env variable reading #3055 -> @jannfis tnx for the snippet ;)

* adding a couple of sponsors references

* fix! semanthic and form of the statement

* doc: add ref. to companies that sponsored my work on ArgoCD #3055

* avoiding problems

* Trigger notification

Co-authored-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2020-02-01 20:46:20 -08:00
Miles Armstrong
949808f0b2 docs: Add MOO Print to list of users (#3065)
* Add MOO Print to list of users

* Re-sort 'Who uses' list alphabetically
2020-01-31 14:36:50 -08:00
jannfis
9ef80ef1f7 chore: Update CHANGELOG.md up to 1.4.2 (#3069) 2020-01-31 13:41:23 -08:00
Dai Kurosawa
1801212ac7 chore: Upgrade Go version from v1.13.6 to v1.13.7 (#3056) 2020-01-31 22:00:43 +01:00
jannfis
722d5b02d9 fix: Correct usage text for repo add command regarding insecure repos (#3068)
* Correct usage information for repo add command regarding insecure repositories

* Retrigger stuck CI
2020-01-31 12:50:39 -08:00
jannfis
9f8505205f fix: Ensure SSH private key is written out with a final newline character (#2890) (#3064)
* Ensure SSH private key is written out with a final newline character

* Retrigger stuck CI
2020-01-31 11:02:43 -08:00
jannfis
9e81c38c13 fix: Handle SSH URLs in 'git@server:org/repo' notation correctly (#3062)
* Handle invalid repo URLs better

* Safeguard Git repository root at client creation
2020-01-31 01:14:22 -08:00
rayanebel
ff40297bdc fix sso condition when several sso connectors has been configured (#3057) 2020-01-30 13:40:16 -08:00
Dai Kurosawa
c8d74d1a7f Fix bug where the same pointer is used. (#3059) 2020-01-30 09:47:18 -08:00
Alexander Matyushentsev
a3f8ec33f4 chore: fix codegen-local (#3053) 2020-01-29 20:00:32 +01:00
Alexander Matyushentsev
c7718242f9 chore: publish image on every push to master (#3051) 2020-01-29 19:09:16 +01:00
Sean Dukehart
57eeaa4231 Changes to enable helm --set-file (#2752)
Necessary STDIN changes to support Windows

Added support for SE Linux

Informational message about linting OOM

Updated due to latest helm stable being 3.x
2020-01-29 08:26:05 -08:00
aarongorka
7edcf47a03 docs: Clarify syntax for diff customization should be json-patch (#3044)
One might assume that Argo is expecting
[JSONPath](https://kubernetes.io/docs/reference/kubectl/jsonpath/)
rather than JSON Patch, which this commit clarifies via a link to the
official RFC.
2020-01-29 07:46:58 -08:00
Pablo Fredrikson
f561f22caa Removing extra dot in docs (#3043)
This dot breaks the yaml and it shouldn't be present
2020-01-28 15:07:21 -08:00
jannfis
dcea620ca6 Update argo-ui dependency to latest commit in master (#3038) 2020-01-27 08:57:46 -08:00
jannfis
9790a5da9c fix: Better handling of K8s secrets for repository credentials & templates (#3016 #3028) (#3029)
* Fix for calculation of credential secrets' names and secret deletion

* Fix comments to reflect reality

* Update unit tests

* Don't encode parts of the repo URL into secret names anymore

* Lint fixes

* Satisfy linter: Remove unused variable

* Retrigger stuck CI
2020-01-27 07:56:41 -08:00
jannfis
b1d281e7bb Allow dash character in output of kubectl version (#3035) 2020-01-27 07:16:37 -08:00
Glen Keane
2e7fa935c4 docs: Fix getting started 404, add useful links (#3037) 2020-01-27 13:51:06 +01:00
Dai Kurosawa
8b69efcdb9 fix: Include resource group for events InvolvedObject.APIVersion #3011 (#3031) 2020-01-25 12:09:24 +01:00
jannfis
8b08a337c5 Clarify that non-standard SSH ports have to use ssh:// URLs (#3030) 2020-01-24 14:27:26 -08:00
Daniel Beal
e22f946415 fix: Jsonnet TLA parameters of same type are overwritten (#3022)
* TLA parameters of same time are overwritten

When updating an application deployed with existing TLAs using the following command:

```
argocd app set m2-jsonnet --jsonnet-tla-code "myTLAVar={hello:'world'}"
```

The all the TLAs of type code will be cleared and not preserved as would be expected of a set. The only TLA remaining is `myTLAVar`.
This will set the behavior of TLAs to match that of extVars

Signed-off-by: Daniel Beal <dbeal@wiser.com>

* revert gopkg.lock

* add unit tests

* fix go formatting
2020-01-24 10:34:53 -08:00
Joseph Mulloy
3c6715a6f9 fix: Replace aws-iam-authenticator to support IRSA (#3010)
Replace aws-iam-authenticator with aws cli to support EKS cluster auth
via IAM Roles for Service Accounts (IRSA)

See https://aws.amazon.com/blogs/opensource/introducing-fine-grained-iam-roles-service-accounts/
2020-01-24 10:32:33 -08:00
Dário Nascimento
4cf02fd813 Hide bindPW in dex config (#3025)
Like https://github.com/argoproj/argo-cd/issues/2536 , the DEX password for LDAP is being leaked in a command that prints configuration.
This change not only hides the bindPW but also changes the logging level to trace so that by default, the configuration is not leaked to logs.
2020-01-24 08:37:14 -08:00
Masayuki Ishii
17d217c2d6 feat: Add argocd cmd for Windows #2121 (#3015)
* fix: Explicitly cast Stdin file descriptors to int

Signed-off-by: Masayuki Ishii <masa213f@gmail.com>

* feat: Add the windows CLI

Signed-off-by: Masayuki Ishii <masa213f@gmail.com>

* fix: Fix warning message

Signed-off-by: Masayuki Ishii <masa213f@gmail.com>
2020-01-24 08:18:00 +01:00
Alexander Matyushentsev
32d5a05aef fix: correctly replace cache in namespace isolation mode (#3023) 2020-01-23 16:19:29 -08:00
rumstead
e3f3688227 docs: Update disaster_recovery.md (#3021)
Fixing verbiage.
2020-01-23 19:39:19 +01:00
Dai Kurosawa
ad715565a6 Upgrade Go version from v1.12.6 to v1.13.6 (#2994) 2020-01-23 10:11:01 -08:00
Alexander Matyushentsev
d7cad4ac6d fix: run dep ensure (#3018) 2020-01-22 14:42:06 -08:00
jannfis
cc6c67d343 fix: Provide correct example for repocreds add command (#3016) (#3017)
* Correct SSH example for repocreds add command

* More example & comment fixes for repo and repocreds commands
2020-01-22 10:34:34 -08:00
Alexander Matyushentsev
6ada626dda fix: impossible to config RBAC if group name includes ',' (#3013)
* fix:  impossible to config RBAC if group name includes ','

* apply reviewer notes
2020-01-22 18:19:46 +01:00
Alexander Matyushentsev
5bc59003af chore: add jannfis to approvers list (#3014) 2020-01-22 08:45:39 +01:00
Alexander Matyushentsev
fe583c2f5d docs: update v1.4 contributors list (#2993) 2020-01-21 14:53:07 -08:00
Marco Schmid
539281f89e fix: Fixes username matching for SSH repositories for webhooks (fixes #2988) (#2990)
* fixed username matching for ssh-repos

* fixed string format
2020-01-16 08:02:41 -08:00
Alexander Matyushentsev
e5ea3fe1fb feat: upgrade dex to v2.21.0 (#2985) 2020-01-15 14:06:38 -08:00
Alexander Matyushentsev
f36ea4646d fix: sync apps panel fails with 'No App Selected' message if name contains '.' (#2983) 2020-01-15 11:00:25 -08:00
Alexander Matyushentsev
ddcdbaa990 docs: add notifications.md with recommandation about notifications (#2979)
* docs: add demo argocd/grafana links

* docs: add notifications.md with recommandation about notifications
2020-01-15 10:48:03 -08:00
Paul Brit
857ce87f00 docs: Fix a broken link to Helm Hooks (#2970) 2020-01-14 14:13:45 -08:00
Alexander Matyushentsev
4643a1c26d fix: fix nil pointer dereference in CreateRepositoryCredentials method (#2975) 2020-01-14 14:13:40 -08:00
Alexander Matyushentsev
3bf8dc6fb0 fix: remove 'total' suffix from gauge prom metric (#2976) 2020-01-14 14:13:19 -08:00
Alexander Matyushentsev
f62559128d fix: fix rendering CRD acronym (#2978) 2020-01-14 14:13:00 -08:00
Alexander Matyushentsev
63fe5f32ba docs: v1.3 and v1.4 changelog (#2952) 2020-01-14 14:10:44 -08:00
Alexander Matyushentsev
a6cb9987a9 chore: sort imports in controller/sync_hooks.go and run 'dep ensure' (#2972) 2020-01-13 09:02:19 -08:00
Alexander Matyushentsev
802edf3202 chore: remove unnecessary gh-pages filter from circle config (#2966) 2020-01-10 16:37:47 -08:00
Alexander Matyushentsev
6c1e6b1e72 chore: add github action that publish docs changes (#2965) 2020-01-10 14:12:19 -08:00
Alexander Matyushentsev
3396a604fe fix: rename cluster prometheus metrics according to the naming convention (#2964) 2020-01-10 13:27:03 -08:00
Alexander Matyushentsev
574446b3c0 fix: app create --upsert should take finalizers into account (#2963) 2020-01-10 12:06:04 -08:00
Alexander Matyushentsev
07e35b1839 fix: application upsert should retry on concurrent modification error (#2959) 2020-01-09 16:00:35 -08:00
Alexander Matyushentsev
0989faf4bd fix: sort conditions to avoid reconciliation loop (#2955) 2020-01-09 00:00:45 -08:00
Alexander Matyushentsev
85bda0f793 fix: self-heal should retry syncing an application after specified delay (#2950)
* fix: self-heal should retry syncing an application after specified delay
2020-01-08 14:07:36 -08:00
Michael Goodness
ac4191ff8e Add MLB to users list! (#2951)
🎉 🎉 🎉
2020-01-08 07:21:24 -08:00
Alexander Matyushentsev
08e50d4eb3 fix: use resource health for hook status evaluation (#2938) 2020-01-07 15:01:40 -08:00
Manatsawin Hanmongkolchai
9c0db45331 feat: Add support for ssh-with-port repo url (#2866) (#2948)
* Add gitlab test

* webhook: Add support for ssh with port url
2020-01-06 23:10:35 -08:00
Alexander Matyushentsev
76da1529d9 fix: limit number of parallel kubectl apply (#2944)
* fix: limit number of parallel kubectl apply
2020-01-06 22:28:42 -08:00
Alexander Matyushentsev
da6da2a229 fix: argocd diff should use NormalizedLiveState (#2943) 2020-01-06 15:39:54 -08:00
Alexander Matyushentsev
3cbe3483ca fix: property retry clusters secret watch (#2940) 2020-01-03 18:59:50 -08:00
Alexander Matyushentsev
bc33f19333 fix: diff local ignore kustomize build options (#2942) 2020-01-03 18:56:55 -08:00
Jesse Suen
189eaf2705 fix: update argocd-util import was not working properly (#2939) 2020-01-03 17:19:07 -08:00
Alexander Matyushentsev
cd27e55711 Simplify using Argo CD without users/SSO/UI (#2688) 2020-01-02 17:54:06 -08:00
Alexander Matyushentsev
6d612b47f6 fix: stop logging dex config secrets #(2904) (#2937) 2020-01-02 15:39:57 -08:00
Alexander Matyushentsev
e07953bf74 fix: remove unnecessary scroll from filter panel (#2935) 2020-01-01 20:43:32 -08:00
Alexander Matyushentsev
af212ce6b9 fix: status badge should display 'Not Found' if application does not exist (#2927) 2019-12-30 13:37:35 -08:00
Alexander Matyushentsev
3911cd48ca fix: the 'repo add' command incorrectly requires upsert flag (#2926) 2019-12-30 12:02:47 -08:00
Alexander Matyushentsev
d4c0ee80ee fix: collect cluster metrics in background; remove obsolete metrics (#2923) 2019-12-27 21:06:37 -08:00
Alexander Matyushentsev
6a0bb821cc fix: stop using jsondiffpatch on clientside to render resource difference (#2869)
* fix: stop using jsondiffpatch on clientside to render resource difference (#2863)

* Apply reviewer notes
2019-12-26 14:42:56 -08:00
Alexander Matyushentsev
9a23823f32 fix: removes redundant mutex usage in controller cache and adds cluster cache metrics (#2898) 2019-12-26 14:08:31 -08:00
Alexander Matyushentsev
aea81373eb fix: prevent user from seeing/deleting resources not permitted in project (#2908) (#2910) 2019-12-26 14:08:14 -08:00
David J. M. Karlsen
2354965b6f chore: a few lint fixes (#2911) 2019-12-26 13:36:58 -08:00
David J. M. Karlsen
c7b48e3f7c fix: cmd line docs (#2912)
Signed-off-by: David J. M. Karlsen <david@davidkarlsen.com>
2019-12-25 15:34:20 -08:00
shlo
4e579da8e9 correct wordings (#2916) 2019-12-25 15:32:48 -08:00
Alexander Matyushentsev
04097a1383 fix: add missing networking.k8s.io/Ingress health check (#2908) (#2909) 2019-12-20 10:49:18 -08:00
John Girvan
dbcfccbfc0 Add documentation for Azure AD SSO configuration (#2905) 2019-12-19 09:40:23 -08:00
Laura Barber
7e8723d664 Add peloton as user to readme. (#2901) 2019-12-18 15:12:15 -08:00
Alexander Matyushentsev
316cf5c61c fix: commit is rendered as undefinied is app revision is not specified explicitly (#2899) 2019-12-18 11:20:48 -08:00
Simon Behar
b1b443543b refactor: Export autocomplete to argo-ui (#2897)
* refactor: Export autocomplete to argo-ui
2019-12-18 11:20:32 -08:00
David J. M. Karlsen
90769d47ed improve docs. Fixes #2884 (#2895)
Signed-off-by: David J. M. Karlsen <david@davidkarlsen.com>
2019-12-18 08:25:14 -08:00
Alexander Matyushentsev
f253fcfa86 fix: UI should re-trigger SSO login if SSO JWT token expires (#2891) 2019-12-17 18:31:30 -08:00
Alexander Matyushentsev
aea2a51eeb fix: expand/collapse annotations on application details page (#2894) 2019-12-17 18:30:56 -08:00
Alexander Matyushentsev
d0530a6c39 fix: UI should cache version info to avoid having loading indicator on every navigation (#2889) 2019-12-17 15:31:06 -08:00
Alexander Matyushentsev
21f1c6c977 fix: add missing git checkout in GetRevisionMetadata method (#2893) 2019-12-17 15:30:08 -08:00
Alex Collins
e1c65a0190 feat: Displays controllerrevsion's revision in the UI. Closes #2306 (#2702) 2019-12-17 14:12:13 -08:00
Alex Collins
9783e7e2bf Updates UI icons. Closes #2625 and #2757 (#2653)
* Updates icons. Closes #2625
2019-12-17 10:50:33 -08:00
Alexander Matyushentsev
e9ae87ae67 feat: namespace isolation (#2176) (#2839)
feat: namespace isolation (#2176) (#2839)
2019-12-17 07:50:11 -08:00
Omer Kahani
cda1be72c0 Fix links (#2888) 2019-12-17 07:18:48 -08:00
Alexander Matyushentsev
66169ba982 Upgrade argo ui (#2887) 2019-12-16 16:38:22 -08:00
Alexander Matyushentsev
35adaf04bf Add tooltip to version info (#2882) 2019-12-16 13:54:09 -08:00
Alexander Matyushentsev
fca87b7884 Prevent loading commit metadata is it is missing in sync results (#2886) 2019-12-16 13:45:56 -08:00
Alexander Matyushentsev
54b3786f32 fix: clarify cluster cli command arguments to avoid confusion (#2879) 2019-12-13 19:26:12 -08:00
Alexander Matyushentsev
899abd37b5 fix: stop loading history metadata for the whole deployment history (#2878) (#2880) 2019-12-13 19:25:33 -08:00
Jesse Suen
73f0437ef3 feat: Use kubectl apply library instead of forking binary (#2861) 2019-12-13 17:29:01 -08:00
Alexander Matyushentsev
f815facf71 fix: git contention leads applications into Unknown state (#2877) 2019-12-13 12:00:39 -08:00
Alexander Matyushentsev
7ab781d309 fix: Fix flaky TestAutoSyncSelfHealEnabled test (#2876) 2019-12-13 12:00:27 -08:00
Qingbo Zhou
566a690813 docs: fix typo in webhook doc (#2870) 2019-12-13 11:38:53 -08:00
Alex Collins
2707008c1a Adds revision history limit. Closes #2790 (#2818)
* Adds revision history limit. Closes #2790
2019-12-13 11:14:43 -08:00
Torsten Walter
c4eeb8d3a6 chore: Add Syncier as user of Argo CD (#2872)
Signed-off-by: Torsten Walter <torsten.walter@syncier.com>
2019-12-13 09:34:13 -08:00
vdinesh2461990
3c24681907 Update README.md (#2868)
Added Tiger Analytics
2019-12-12 08:14:52 -08:00
jkleinlercher
20bdfeca81 Add ARZ to Argo CD users (#2867) 2019-12-12 00:07:29 -08:00
Alexander Matyushentsev
0a5023d08e Issue #2853 - Improve application env variables/labels editing (#2856) 2019-12-11 14:01:36 -08:00
Alexander Matyushentsev
0bf38bb93f Fix TestAutoSyncSelfHealEnabled test (#2857) 2019-12-11 13:26:32 -08:00
Scott Cabrinha
9670f406a3 Issue #2833: use editor arguments in InteractiveEditor (#2850) 2019-12-11 10:06:54 -08:00
Abhishek Jaisingh
575f7604d6 feat: Template Out Data Source in Grafana Dashboard (#2859)
* Template Out Hardcoded Prometheus Data Source
* This allows monitoring Argo CD deployed on different Promethei

Change-Id: I89a326865c30515716c78f9485fa91769dc9fe4c
2019-12-10 23:53:47 -08:00
Aoi Motomura
97b45c7a74 Add cybozu to the list of users (#2858) 2019-12-10 23:41:05 -08:00
Jesse Suen
0ea0404044 Update k8s dependency to v1.16 (#2828) 2019-12-10 18:33:58 -08:00
Alex Collins
0fa02b0a55 Updates releasing guide. (#2844) 2019-12-10 15:05:55 -08:00
David Hong
7c787a3bb0 Add version information for git submodule support (#2855) 2019-12-10 15:05:40 -08:00
Simon Behar
ef2501f4b1 Add support for hidden directories with directory enforcer (#2821)
* Add support for hidden directories with directory enforcer

* Refactor

* Lint

* Rework done, still needs tests

* WIP

* Should be done

* Fix test

* Helm Charts
2019-12-10 13:50:20 -08:00
Alexander Matyushentsev
f56e084bb9 Issue #2683 - Make sure app update don't fail due to concurrent modification (#2852) 2019-12-10 13:09:39 -08:00
dthomson25
c3ed032c79 Update rollout healthcheck to use pause conditons (#2842) 2019-12-10 11:00:46 -08:00
Julian Mazzitelli
14d0e76f12 who uses: biobox analytics (#2851)
* Update README.md

* who uses: biobox alphabetical ordering
2019-12-10 09:37:25 -08:00
Alexander Matyushentsev
cc2b7b149e Issue 2848 - Application Deployment history panel shows incorrect info for recent releases (#2849) 2019-12-09 15:36:39 -08:00
Devin Stein
9ffba90a73 [doc] Add KSOPS to Secret Management List (#2846) 2019-12-09 12:55:21 -08:00
Devin Stein
659b16f5f8 doc: Add Viaduct to "Who Uses" List (#2841) 2019-12-09 11:07:09 -08:00
Alex Collins
adc2e9ba54 Improves the "Sync Apps" panel UI. Closes #2698 (#2699) 2019-12-09 11:04:31 -08:00
Yros Aguiar
3a7f6d06b1 doc: Add Pipefy to list of current companies using Argocd (#2838)
* Add pipefy to list of current company using argocd
2019-12-09 10:38:22 -08:00
jannfis
4fa47ce6cd Only delete resources during app delete cascade if permitted to (fixes #2693) (#2695)
* Only delete resources during app delete if we're permitted to

* Permission checks need to move to a different place

* Add unit tests

* Return map of actually deleted object, so we can test against it

* Better error handling

* Move logic into shouldBeDeleted()
2019-12-09 08:39:20 -08:00
Daniel Helfand
fb0aef3d73 More Detailed argocd CLI Install Instructions for Mac and Linux (#2807) 2019-12-09 08:36:33 -08:00
Julien Poissonnier
8cd34503a1 doc: add elium to list of users (#2834) 2019-12-09 08:35:37 -08:00
Dominik Münch
e40a046504 doc: add celonis to list of users (#2836) 2019-12-09 08:30:09 -08:00
Anton Lindholm
6710ac15f4 Add walkbase to the list of users (#2835) 2019-12-09 08:28:45 -08:00
Enrico Stahn
026cfc5efd doc: add hipages to list of users (#2832) 2019-12-08 22:25:47 -08:00
Jacob O'Farrell
880ee7fbaf Add Max Kelsen to Who Uses Argo CD (#2831) 2019-12-08 22:24:23 -08:00
Nikolas Philips
6bf943c156 Add Baloise as Argo CD user (#2830) 2019-12-08 22:22:38 -08:00
Jaime
78dfbd37b4 Add Adevinta in README.md (#2829)
Add Adevinta.
https://www.adevinta.com/
2019-12-08 18:00:10 -08:00
Nick Kampe
03acca8ef7 Added EDF Renewables to list of organizations (#2823)
* Added EDF Renewables to list of organizations
2019-12-08 17:41:33 -08:00
Alex Collins
2032688f36 Make ConvertToVersion maybe 1090% faster on average (#2820) 2019-12-06 17:31:54 -08:00
Alex Collins
3ad462a112 Fixes error in docs that prevents publishing them (#2817) 2019-12-05 22:56:42 -08:00
Alex Collins
9b679ffa75 Fixes logging of tracing option in CLI (#2819) 2019-12-05 15:19:36 -08:00
Alex Collins
cb4898acb5 Adds tracing to key external invocations. (#2811) 2019-12-05 13:35:20 -08:00
Alexander Matyushentsev
5077be9482 argocd-util should allow editing project policies in bulk (#2615)
* Implement 'argocd-util projects update-role-policy' command which allows to update multiple project policies
2019-12-05 13:35:12 -08:00
Alexander Matyushentsev
89a5bc87b9 Issue #2721 Optimize helm repo querying (#2816) 2019-12-05 11:13:08 -08:00
Guido Maria Serra
a5f22d3841 SAML/Azure integration (#2815) 2019-12-05 09:41:21 -08:00
Byungjin Park
50ac3fd6c5 Fix typo in docs (#2813) 2019-12-04 22:18:11 -08:00
Alexander Matyushentsev
91b0cd0a47 Issue #2721 - cache parsed repositories, repo credentials to avoid unnecessary yaml parsing (#2809) 2019-12-04 15:23:18 -08:00
Daniel Helfand
9fa1886c02 updates to getting started tutorial (#2801) 2019-12-03 17:33:11 -08:00
Alex Collins
148b90b5b5 Revert "Use Kustomize 3 to generate manifetsts. Closes #2487 (#2510)" (#2696) 2019-12-03 10:52:29 -08:00
Christine Banek
0715d05733 Fix 'Open application' link when using basehref (#2729) 2019-12-03 10:26:37 -08:00
INOUE BANJI
3258f2deee Add custom healthchecks for cert-manager v0.11.0 (#2689) 2019-12-03 09:44:20 -08:00
Simon Behar
72b90f6890 Fix directory traversal edge case and enhance tests (#2797) 2019-12-02 18:26:58 -08:00
Devan Goodwin
addf397b53 Fix a bug with cluster add when token secret is not first in list. (#2744) 2019-12-02 15:34:57 -08:00
Alex Collins
aeb48b0a69 Fix bug where manifests are not cached. Fixes #2770 (#2771) 2019-12-02 12:08:06 -08:00
Alex Collins
a6ccf924b5 Fixes bug whereby retry does not work for CLI. Fixes #2767 (#2768) 2019-12-02 10:09:41 -08:00
Alex Collins
e416547192 Make BeforeHookCreation the default. Fixes #2754 (#2759) 2019-12-02 09:44:42 -08:00
Alex Collins
60aa7fb71e Adds support for /api/v1/account* via HTTP. Fixes #2664 (#2701) 2019-12-02 09:43:58 -08:00
Alex Collins
cbe94440df Allow dot in project policy. Closes #2724 (#2755) 2019-12-01 19:14:32 -08:00
Alexander Matyushentsev
bfe05e4755 Update README.md (#2788) 2019-11-30 12:26:43 -08:00
nitinpatil1992
848a576a05 Usage of Argo-cd at Saloodo! GmbH (#2786)
* Usage of Argo-cd at Saloodo! GmbH

Argocd for CD for saloodo platform deploying almost 24 webservices

* Re-order argocd organization list for saloodo

* Reorder organisations list for saloodo
2019-11-28 18:20:04 -08:00
Alex Collins
a6da0ca65b Ensures that Helm charts are correctly resolved before sync. Fixes #2758 (#2760) 2019-11-28 12:55:22 -08:00
Alex Collins
af195f36f0 Update README.md to add KubeCon workshop (#2766) 2019-11-28 12:54:53 -08:00
Konstantin
31e30fbf6e fixed docs with proper keys for secret data (#2777) 2019-11-27 09:54:51 -08:00
Gregor Krmelj
f994926487 docs: fix label for ServiceMonitor CRD for API server metrics (#2775) 2019-11-27 09:53:16 -08:00
Simon Behar
c8ae89f953 Make directory enforcer more lenient (#2716)
* Make directory enforcer more lenient and add flag

* Fixes

* Lint fixes

* Lint fixes

* Fixed test

* Minor

* Removed enforcer option

* Move directory traversal check higher up

* Go fmt

* Allow URLs

* Added test
2019-11-27 07:00:46 -08:00
Alex Collins
257c27677a Removes log warning regarding indexer and may improve performance. Closes #1345 (#2761) 2019-11-24 14:12:47 -08:00
Alex Collins
73a1a7ce76 Correct version of Argo CD that build env is available in. See #2749 (#2750) 2019-11-21 14:37:45 -08:00
Alex Collins
c2ff8e856b Allow you to sync local Helm apps. Fixes #2741 (#2747) 2019-11-20 18:20:12 -08:00
Ilir Bekteshi
5980b604a6 Add values file block example (#2745) 2019-11-20 08:28:48 -08:00
Alex Collins
d3b670937a Shows chart name in apps tiles and apps table pages. Closes #2726 (#2728) 2019-11-19 07:48:48 -08:00
Alex Collins
9593f8d3b3 Update CONTRIBUTING.md (#2727) 2019-11-18 15:19:52 -08:00
jannfis
0cfe1cdedf Set X-Frame-Options on serving static assets (#2706) (#2711)
* Add some test data for testing static assets

* Optional send X-Frame-Options header for static assets

* Allow fake server some time to settle in tests

* Retrigger CI
2019-11-18 15:12:35 -08:00
Alex Collins
39ea6444f9 Disables TestAutoSyncSelfHealEnabled. (#2703) 2019-11-18 15:12:11 -08:00
Alex Collins
620d956038 Returns a clearer error on invalid Helm version. Closes #2665 and #2736 (#2666) 2019-11-18 10:08:52 -08:00
Naoki Oketani
be77f468a3 modify pre-requisites kustomize version (#2725) 2019-11-15 11:19:33 -08:00
David Maciel
24eb0b2409 Clarify the need for namespace during export (#2722) 2019-11-15 10:10:49 -08:00
Simon Behar
b233563e29 Fixed KustomizeBuildOptions not getting synced (#2714) 2019-11-13 09:31:37 -08:00
Olivier Lemasle
455837f3e8 Remove references to argocd-ui image in manifests generation (#2710)
Docker image argocd-ui is no longer used and is not present
in YAML manifests; however, there was still references to it
in the manifest generation workflow.
2019-11-13 09:12:50 -08:00
Alex Collins
09808b5016 Fixes the failing CI master build (#2697) 2019-11-12 16:10:35 -08:00
Alexander Matyushentsev
f01df4e686 Restore 'argocd app run action' backward compatibility (#2700) 2019-11-12 16:08:51 -08:00
Naoki Oketani
a6db07ff72 Rename deprecated deadline option to timeout (#2686) 2019-11-12 15:54:20 -08:00
Masayuki Ishii
048e787668 Issue #2668 - Delete a specified context (#2669)
* Issue #2668 - Delete a specified context
2019-11-12 14:38:48 -08:00
Alexander Matyushentsev
3d6c77e3a8 Issue #2691 - Remove annoying toolbar flickering (#2692) 2019-11-12 08:39:19 -08:00
Naoki Oketani
11f00c88b5 modified make target (#2685) 2019-11-11 09:37:46 -08:00
Alan Tang
6cbc43e2ae Modify docs for ingress ssl passthrough and SSO (#2649) 2019-11-11 09:33:06 -08:00
Alexander Matyushentsev
84f24cdb6c Issue #2673 - Application controller flag is broken (#2674) 2019-11-08 16:20:31 -08:00
Alexander Matyushentsev
0d8011da8e Issue #2670 - API server does not allow creating role with action 'action/*' (#2671) 2019-11-08 11:02:47 -08:00
Alexander Matyushentsev
0ff2533ba0 Issue #2559 - Add gauge Prometheus metric which represents the number of pending manifest requests. (#2658) 2019-11-07 18:28:13 -08:00
dthomson25
7982a19966 Add AnalysisRun and Experiment HealthCheck (#2579) 2019-11-07 15:08:32 -08:00
Alexander Matyushentsev
f4400b9493 Issue #2659 - Fix 1.3 login regressions (#2660)
* Issue #2659 - Fix 1.3 login regressions

* Add server.go tests
2019-11-07 14:52:17 -08:00
Alexander Matyushentsev
4facca0ae7 Issue #2662 - Don't parse kustomize version outout (#2663) 2019-11-07 14:51:13 -08:00
Alex Collins
8ac09c9ca9 Adds support for testing .tsx files. Closes #2610 (#2661) 2019-11-07 14:50:52 -08:00
Alexander Matyushentsev
cb6d7eaad2 Issue #2645 - /api/version should not fail if unable to load tool version (#2654) 2019-11-06 16:17:54 -08:00
Alexander Matyushentsev
4ccb02375f Issue #2655 - Application list page is not updated automatically (#2656) 2019-11-06 16:16:31 -08:00
Alex Collins
329b845f55 Adds note to docs that build enviroment is available in v1.3. Fixes 2651 (#2652) 2019-11-06 14:36:09 -08:00
David Hong
de29c9d0f5 chore: Upgrade kustomize to 3.2.1 (#2607) 2019-11-06 00:25:45 -08:00
Yujun Zhang
7065229a45 Revert "Fix Typo: Filter Label To Get Server Pod Name (#2597)" (#2637)
This reverts commit 424f1e9a3d.
2019-11-05 07:15:54 -08:00
Alexander Matyushentsev
68a81854c1 Issue #2635 - Custom actions are disabled in Argo CD UI (#2636) 2019-11-04 14:28:38 -08:00
Alexander Matyushentsev
d06260ebbb Issue #2592 - Remove transitive dependency on packr (#2631) 2019-11-04 10:41:43 -08:00
Alexander Matyushentsev
cc7b83adf3 Issue #2633 - Application list page incorrectly filter apps by label selector (#2634) 2019-11-04 10:41:10 -08:00
jannfis
45270ec03f Assume git as default repository type (fixes #2622) (#2628)
* Assume git as default repository type

* Add helm repo with name in E2E tests
2019-11-03 20:15:28 -08:00
Saradhi Sreegiriraju
42804dbbac Update README.md (#2630) 2019-11-03 11:18:04 -08:00
Alexander Matyushentsev
00eebce95a Issue #2626 - Repo server executes unnecessary ls-remotes (#2627) 2019-11-02 21:56:51 -07:00
Gene Liverman
e00607b722 Certmanager docs (#2629)
* Add example of SSL-Passthrough with cert-manager

The certificates in this example are from Let's Ecnrypt

* Callout the secret name as being provided by Argo CD directly
2019-11-02 17:12:22 -07:00
Alex Collins
8575e3942c Adds support for Helm charts to be a semver range. Closes #2552 (#2606) 2019-11-01 13:41:35 -07:00
Alexander Matyushentsev
da04075120 Issue #2620 - Cluster list page fails if any cluster is not reachable (#2621) 2019-11-01 13:22:51 -07:00
Alexander Matyushentsev
0b684db148 Issue #2616 - argocd app diff prints only first difference (#2617) 2019-11-01 11:49:01 -07:00
Alexander Matyushentsev
1d5e6a1b90 Bump min client cache version (#2619) 2019-11-01 11:35:49 -07:00
jannfis
0fab3707cc Allow '@'-character in SSH usernames when connecting a repository (#2612) 2019-11-01 11:03:28 -07:00
Alex Collins
212ca9e37e Adds argocd auth can-i command. Close #2255 (#2521) 2019-10-31 16:06:29 -07:00
Alexander Matyushentsev
89b33a1442 Execute application label filtering on client side (#2605) 2019-10-30 18:42:04 -07:00
Alex Collins
6930ecc947 Adds timeout to Helm commands. (#2570) 2019-10-30 16:41:39 -07:00
Alex Collins
430b933869 UI fixes for "Sync Apps" panel. (#2604) 2019-10-30 16:39:28 -07:00
Alex Collins
e328a5d144 Adds a status icon for the op to the UI. Closes #2596 (#2601) 2019-10-30 15:59:43 -07:00
Alex Collins
70ec0d8b29 Upgrade Helm to v2.15.2. Closes #2587 (#2590) 2019-10-30 15:32:23 -07:00
jannfis
fdea6e2edf Adds the option to output in YAML and JSON to several CLI commands. Closes #2534 (#2551) 2019-10-30 10:23:28 -07:00
niqdev
c096341772 [doc] update secret-management (#2598) 2019-10-30 10:16:46 -07:00
Abhishek Jaisingh
424f1e9a3d Fix Typo: Filter Label To Get Server Pod Name (#2597) 2019-10-30 10:16:14 -07:00
Abhishek Jaisingh
4d795ac381 Fix Typo in Docs (#2595) 2019-10-30 10:15:48 -07:00
dherman
7610a8b2dd correct the spelling of hashicorp (#2599) 2019-10-30 10:15:29 -07:00
Miguel
b8bac1e688 Update README.md added Universidad Mesoamericana to organization list (#2514) 2019-10-29 13:34:13 -07:00
Isaac Gaskin
afda10bc8f docs(app cmd): updating --local text to include helm and kustomize (#2582) 2019-10-29 13:31:10 -07:00
Alex Collins
a9a28b7e42 Sets app status to unknown if there is an error. Closes #2577 (#2578) 2019-10-29 11:44:34 -07:00
Mohammed Naser
9d784e7e3f Fix date in CHANGELOG.md (#2584) 2019-10-29 10:14:54 -07:00
Alexander Matyushentsev
a53950e5a8 Issue #2339 - Don't update 'status.reconciledAt' unless compared with latest git version (#2581) 2019-10-28 16:44:23 -07:00
Devan Goodwin
134469c5f0 Display app conditions timestamp in CLI and UI. (#737) (#2565)
* Display app conditions timestamp in CLI and UI.

* Add Red Hat to README.
2019-10-28 11:13:02 -07:00
Alex Collins
aeb5223169 Allows Helm charts to have arbitrary file names. Fixes #2549 (#2569) 2019-10-28 10:53:02 -07:00
Masayuki Ishii
73590e1a39 Fixes blocking SSO login via CLI (#2563) (#2564) 2019-10-27 01:43:24 -07:00
Alex Collins
a0f3903418 Fixes panic when creating repo (#2568) 2019-10-25 12:35:17 -07:00
Alex Collins
21cc1ec89b Reduces total build time from 20m to 14m (#2560) 2019-10-25 12:33:54 -07:00
Simon Behar
0675ff2fb2 Done (#2529) 2019-10-23 17:19:59 -07:00
Lev Aminov
c72160f681 Upgrade casbin/casbin to 1.9.1 (#2517) 2019-10-23 17:00:45 -07:00
Alex Collins
513b0eb51b Adds doc on secrets, updates changelog, updates Github templates (#2550) 2019-10-23 15:16:26 -07:00
Alex Collins
4169697302 Enable prettier on UI source code (#2524) 2019-10-22 15:45:33 -07:00
Alexander Matyushentsev
9c3c2f3f14 Issue #2339 - Controller should compare with latest git revision if app has changed (#2543) 2019-10-22 15:23:15 -07:00
Alex Collins
99426ce659 Tidies up naming of variables in code. See #2389 (#2541) 2019-10-22 14:25:02 -07:00
Alexander Matyushentsev
7e4cb92fb8 Unknown child app should not affect app health (#2544) 2019-10-22 13:56:55 -07:00
Alex Collins
a55087b6fd Shows version in UI. (#2502) 2019-10-22 11:11:54 -07:00
Simon Behar
2d73fea0a5 Redact secrets in dex logs (#2538)
* Done

* Pre-commit

* Added test

* Pre-commit

* Goimports
2019-10-22 10:11:34 -07:00
Alex Collins
5706a17155 Adds support for ARGO_CD_[TARGET_REVISION|REVISION] and pass to Custom Tool/Helm/Jsonnet (#2415) 2019-10-21 16:54:23 -07:00
Adam Johnson
bbfb96cb01 add git submodule support (#2495) 2019-10-21 15:17:07 -07:00
Eltahir Eltahir
500730ef6c Add CARFAX to list of Argo CD users (#2527) 2019-10-19 09:00:38 -07:00
Simon Behar
078f5ccccf Done (#2526) 2019-10-18 15:34:46 -07:00
Alex Collins
cf5d9db5bb Allows Helm parameters that contains arrays or maps. (#2525) 2019-10-18 15:30:46 -07:00
Alex Collins
6c93047367 Use the same tools for make image to make dev-tools-image. Closes #2488 (#2511) 2019-10-18 13:21:36 -07:00
Alex Collins
e7b5007361 Use Kustomize 3 to generate manifetsts. Closes #2487 (#2510) 2019-10-18 13:21:09 -07:00
Alex Collins
4cb84b37ce changes on 2pc to .codecov.yml, (#2513) 2019-10-18 07:40:16 -07:00
Alex Collins
572d376dab Adds the ability to work with groups of apps using labels (#2463) 2019-10-17 14:48:08 -07:00
Alex Collins
941ccda32e Update CHANGELOG.md to list v1.3.0-rc1 (#2504) 2019-10-17 14:15:39 -07:00
jannfis
8d5939f128 Set cookie policy to SameSite=lax and httpOnly (#2498) 2019-10-17 11:29:06 -07:00
jannfis
e8c21ab010 Fix typo: grcp -> grpc (#2509) 2019-10-17 10:35:46 -07:00
stgarf
0f2a88102d Added SSO and RBAC (#2503) 2019-10-16 19:58:42 -07:00
Devan Goodwin
e3edd2ced3 Add Time to ApplicationCondition. (#2417) 2019-10-16 19:29:52 -07:00
jannfis
37641cf2d0 Add repository credential management API and CLI (addresses #2136) (#2207) 2019-10-16 17:17:47 -07:00
Jeff Hastings
2148b593ee add namesuffix for kustomize applications (#2473) 2019-10-16 16:34:52 -07:00
Imran Ismail
5ec5aeb002 Use vars for service name reference in commands (#2408)
=
2019-10-16 16:33:48 -07:00
Alex Collins
bbdbe364b0 Makes cache timeouts configurable (#2412) 2019-10-16 15:46:45 -07:00
Alex Collins
8df3bad4c8 Fixes a bug where app kind was not show in UI YAML editor (#2501) 2019-10-16 13:52:49 -07:00
Alex Collins
f44681693a Fix bug preventing Helm CRDs from being installed (#2500) 2019-10-16 10:12:38 -07:00
Simon Behar
656167fceb Fix possible path traversal attack when supporting Helm values.yaml (#2452)
* Done

* Pre-commit

* Fixed bugs

* Fixed E2E test

* Added doc

* Added tests

* Pre-commit

* Lint issues

* Linter
2019-10-16 07:48:15 -07:00
Alex Collins
87cb4987c9 Work-around golang cilint error (#2499) 2019-10-15 14:36:33 -07:00
Alex Collins
549503c87a Final optimisations (#2486) 2019-10-15 09:15:33 -07:00
Alexander Matyushentsev
ae959ec575 Speedup codegen on mac (#2489) 2019-10-14 09:19:30 -07:00
jannfis
2c88adc2ed Update CONTRIBUTING.md (#2494)
* Remove reference to argocd-ui

* Fix deployment scaling instructions

* Mention some additional env vars
2019-10-14 08:34:23 -07:00
Alexander Matyushentsev
8e60bdfe59 Fix UI crash on application list page (#2490) 2019-10-11 16:29:21 -07:00
Aananth K
803b346caf Add Latest Version Badge (#2465) 2019-10-11 15:53:12 -07:00
Olivier Boukili
4bd81730ef add support for --additional-headers cli flag (#2467) 2019-10-11 15:46:05 -07:00
Alex Collins
df56d036ff Optimize codegen (#2482) 2019-10-11 13:42:02 -07:00
Alex Collins
213ba364d7 Optimize linting (#2479) 2019-10-11 11:55:48 -07:00
Alex Collins
d06df7438f Optimizes e2e tests (#2474) 2019-10-11 11:48:57 -07:00
Alexander Matyushentsev
9ebb12cf50 Issue #2484 - Impossible to edit chart name using App details page (#2485) 2019-10-11 11:37:41 -07:00
Alex Collins
cb99c9c0ee Update issue and PR templates (#2478) 2019-10-11 10:49:34 -07:00
Alexander Matyushentsev
1374107bea Issue #2185 - Manual sync don't trigger hooks (#2477) 2019-10-11 10:47:38 -07:00
Alexander Matyushentsev
6e60762067 Issue #2480 - Helm Hook is executed twice if annotated with both pre-install and pre-upgrade annotations (#2481) 2019-10-11 10:47:21 -07:00
Alexander Matyushentsev
15cf89535e Issue #2475 - UI don't allow to create window with '* * * * *' schedule (#2476) 2019-10-11 10:46:31 -07:00
Simon Behar
88e9cf0e18 Change "available" to "disabled" in actions, make them available by default (#2470)
* Done

* Fixes

* Done

* Done

* Added minor comment
2019-10-10 20:34:40 -07:00
Alexander Matyushentsev
402ce43804 Issue #2453 - Application controller sometimes accidentally removes duplicated/excluded resource warning condition (#2454) 2019-10-10 17:26:53 -07:00
Alexander Matyushentsev
f75984fbf5 Issue #1944 - Gracefully handle missing cached app state (#2464)
* Issue #1944 - Gracefully handle missing cached app state

* Unit test getCachedAppState method
2019-10-10 15:17:13 -07:00
Alexander Matyushentsev
f72a5c76a0 Allow collapse/expand helm values text (#2469) 2019-10-10 13:34:32 -07:00
Alexander Matyushentsev
9aa1b18610 Issue #2321 - Hook deletion should not fail if error message is not found (#2458) 2019-10-09 16:46:19 -07:00
Alex Collins
2e05e50fcb changes on hide-windows to ui/src/app/applications/components/application-status-panel/application-status-panel.tsx, (#2459) 2019-10-09 16:33:55 -07:00
Adam Johnson
138ec15834 Fix logic when checking sync window status using the cli (#2456)
Fix logic when checking sync window status using the cli (#2456)
2019-10-09 16:06:14 -07:00
Alex Collins
e422d33fec Update resource_hooks.md (#2446) 2019-10-09 11:40:48 -07:00
Alexander Matyushentsev
d925b73bf8 Issue #2448 - Custom resource actions cannot be executed from the UI (#2449) 2019-10-09 10:25:52 -07:00
Adam Johnson
f94495ab82 make proj windows commands consistent (#2444)
* make proj windows commands consistent

* update sync window docs
2019-10-09 09:30:28 -07:00
Alexander Matyushentsev
c2dce9c981 Issue #2110 - Disable menu item for non available resource actions on App Details page (#2450) 2019-10-09 09:22:02 -07:00
Alexander Matyushentsev
f6545cd56a Fix flaky TestExcludedResource (#2440) 2019-10-08 18:19:43 -07:00
Adam Johnson
5abe863ea9 Convert maintenance windows to sync windows (#2416)
Convert maintenance windows to sync windows (#2416)
2019-10-08 15:20:19 -07:00
jannfis
963300a7c9 Update base image to Debian buster (#2431) 2019-10-08 14:53:51 -07:00
Simon Behar
f45991c8a7 Error with new actions run suggestion (#2434) 2019-10-08 12:24:05 -07:00
Simon Behar
61d1c1c722 Detach ArgoCD from specific workflow API (#2428) 2019-10-08 12:23:58 -07:00
Alexander Matyushentsev
d59a8b5b78 Add application labels to Applications list and Applications details page (#2430)
* Issue #1099 - Add labels filter to application list page

* Issue #1099 - Add labels to application details page
2019-10-08 10:04:30 -07:00
Michael Bridgen
cf3436dcb3 Detypo architecture doc (#2332) 2019-10-07 12:46:13 -07:00
Aalok Ahluwalia
afce1abbfb Issue #2396 argocd list command should have filter options like by pr… (#2421) 2019-10-07 11:56:52 -07:00
Alexander Matyushentsev
5bea7c32dc Fix JS error on application creation page if no plugins configured (#2432) 2019-10-07 11:16:46 -07:00
Alex Collins
cc6be7f6f4 Fixes flakey test (#2426) 2019-10-07 10:17:54 -07:00
Zoltán Reegn
34a94bb060 Add missing externalURL for networking.k8s.io Ingress type (#2390) 2019-10-07 08:56:47 -07:00
Alexander Matyushentsev
53bf214207 App status panel shows metadata of current revision in git instead of most recent reconciled revision (#2419) 2019-10-04 15:27:07 -07:00
Alex Collins
abf6888dd5 Adds support for plugin params. (#2406) 2019-10-04 15:24:23 -07:00
Alex Collins
f116bd3588 Add a hook example for sending a Slack message (#2414) 2019-10-04 14:51:41 -07:00
Simon Behar
dd21ab92ad Granular RBAC Support for actions (#2110) 2019-10-03 17:11:42 -07:00
Simon Behar
f185137ed1 Added Kustomize, Helm, and Kubectl to argocd version (#2329) 2019-10-03 17:07:56 -07:00
Alexander Matyushentsev
c3479b886a Issue #2407 - Improve Helm/Git app version rendering (#2410) 2019-10-03 14:47:36 -07:00
Alexander Matyushentsev
9df130938e Stop unnecessary re-loading clusters on every app list page re-render (#2411) 2019-10-03 14:10:07 -07:00
Alexander Matyushentsev
16e645b268 Issue #2316 - support deprecated 'helm.repositories' config (#2405)
* Issue #2316 - support deprecated 'helm.repositories' config

* Address reviewer notes
2019-10-03 12:27:19 -07:00
Alexander Matyushentsev
e9b2a6212a Issue #2378 - Creating an application from Helm repository should select Helm as source type (#2409) 2019-10-03 09:55:02 -07:00
Alex Collins
399a022099 Updates FAQ for progressing sts scenario (#2402) 2019-10-02 14:21:48 -07:00
Alex Collins
039d81a8fc Update FAQ for resource limits case (#2404) 2019-10-02 14:21:29 -07:00
Alex Collins
9d1a65d6a9 Update faq.md (#2394) 2019-10-02 14:21:13 -07:00
Alex Collins
b5025559ac Polish maintenance windows (#2400) 2019-10-02 13:55:12 -07:00
Alexander Matyushentsev
f5faeb888b Add release 1.2.1~1.2.3 changelog (#2395) 2019-10-02 10:43:03 -07:00
Adam Johnson
e6e4751326 Add project level maintenance windows for applications (#2380)
* Add maintenance windows for applications, configured at the project level

* move maintenance window check out of autoSync(), fix imports and error checking

* fix ui lint

* add some more tests for maintenance

* patch after pre-commit

* Add more tests for maintenance windows

* Remove Dockerfile as it was added by mistake
2019-10-01 15:23:09 -07:00
Andrew Waters
9a367da4f7 Adds Traefik v2 documentation to ingress options (#2392) 2019-10-01 14:41:51 -07:00
Fred Dubois
01ce567b66 Make argo-cd docker images openshift friendly (#2362)
In openshift clusters, the user id of your container can be arbitrary,
so you need to make the running images compatible with this behavior.

The problematic application for argo-cd was the repo server. When trying
to clone the repos it was getting the error "No user exists for uid
100083000" (100083000 was the random user id being injected by
openshift in my case). This was because the user 100083000 wasn't in the
/etc/passwd file.

The changes in this commit add a uid_entrypoint.sh script that, when the
container starts, modifies the /etc/passwd file to add an entry with the
current UID _only_ if the current UID isn't there.

References:
* Problematic behavior of ssh when user id isn't in the /etc/passwd file:
  https://unix.stackexchange.com/questions/524268/running-git-or-ssh-client-in-docker-as-user-no-user-exists-for-uid
* OpenShift guidelines on how to make your docker image runnable by
  arbitrary user ids:
  https://access.redhat.com/documentation/en-us/openshift_container_platform/3.11/html/creating_images/creating-images-guidelines#use-uid
2019-10-01 12:42:41 -07:00
Alexander Matyushentsev
8099a8807b Fix broken helm test (#2393) 2019-10-01 11:50:40 -07:00
Alexander Matyushentsev
96764c4d49 Use configured certificate to access helm repository (#2385) 2019-09-30 19:20:27 -07:00
Alexander Matyushentsev
0b6c02391f Refactor Helm client and unit test repo server (#2377) 2019-09-30 15:04:13 -07:00
Alexander Matyushentsev
886e1d3a14 Stop loggin /repository.RepositoryService/ValidateAccess parameters (#2387) 2019-09-30 14:34:05 -07:00
Alexander Matyushentsev
a82d708dd8 Add dest-server and dest-namespace field to reconciliation logs (#2388) 2019-09-30 14:33:44 -07:00
Alex Collins
7aa647080f Update api-docs.md (#2365) 2019-09-30 09:52:29 -07:00
Alex Collins
9fb8d05591 Update Helm docs (#2368) 2019-09-30 09:52:11 -07:00
dthomson25
b609a8ae85 Add custom action example to argocd-cm.yaml (#2375) 2019-09-27 15:13:11 -07:00
jannfis
a1b7a41705 Fix API version for Deployment resources in e2e tests to app/v1 (#2372) 2019-09-27 10:59:27 -07:00
Alex Collins
bd2c4f1161 Try out community icons. (#2349) 2019-09-26 16:52:54 -07:00
Alexander Matyushentsev
0f7e9a1d28 Issue #2261 - Refactor Helm first class support (#2364)
* Issue #2261 - Refactor Helm first class support

* Address code review comments

* Remove unused field from GetAppDetails method
2019-09-26 12:05:12 -07:00
Yujun Zhang
32f825e779 Make group optional for ignoreDifferences setting (#2335) 2019-09-24 19:13:58 -07:00
Alex Collins
41a440f23d Fixes display of path in UI (#2345) 2019-09-23 14:57:59 -07:00
Alex Collins
706b413353 Adds support for Github Enterprise URLs (#2344) 2019-09-23 13:24:17 -07:00
Alexander Matyushentsev
c4203f7989 Codegen (#2343) 2019-09-23 13:14:27 -07:00
Olivier Lemasle
0e0a6e726e Fix Helm parameters with comma (#2334) 2019-09-23 10:55:11 -07:00
Alexander Matyushentsev
a345f349bc Issue #2339 - Make sure controller uses latest git version if app reconciliation result expired (#2346) 2019-09-23 10:31:59 -07:00
Alexander Matyushentsev
af8e41d6f8 Don't fix imports in auto-generated files (#2342) 2019-09-23 08:48:49 -07:00
Gregor Krmelj
ad24165eef docs: improve sso oidc documentation regarding client secret (#2341) 2019-09-23 07:29:26 -07:00
Isaac Gaskin
4ff56493e6 Add argocd project as variable to grafana dashboard (#2336)
useful for multitenant environments where filtering by projects is useful
2019-09-21 09:27:11 -07:00
Alex Collins
a57e37a666 Update OWNERS (#2283) 2019-09-19 21:50:04 +01:00
Yujun Zhang
06bab51ee2 Fix missing envs when updating application of content management plugin type (#2331)
Close: #2330
2019-09-19 10:21:43 -07:00
Gustav Paul
affbfe9020 util/localconfig: prefer HOME env var over os/user (#2326)
* util/localconfig: prefer HOME env var over os/user

The os/user package requires that the current user be in /etc/passwd.
That complicates executing the argocd command in a docker container
when the UID:GID of the executing user is overridden.

This is often done in order to have files generated inside a docker
container have their ownership set to match the uid/gid of the host
user.

For example,

```sh
docker run -ti -u "$(id -u "${USER}"):$(id -g "${USER}")" argocd:latest ...
```

* Makefile: use pinned dev image dependencies to run make lint
2019-09-19 10:14:51 -07:00
Alex Collins
1e5c78e35f Auto-detect Helm repos + support Helm basic auth + fix bugs (#2309) 2019-09-19 17:35:27 +01:00
Gregor Krmelj
70a97c0db8 Add cache-control HTTP header to badge response (#2328)
Since we serve the badge as an image using HTTP GET, cache systems
(incl. GitHub's CDN - Fastly) like to cache the image thus the
badge becomes stale rendering it useless. Adding the appropriate
Cache-Control HTTP header we direct cache systems and web browsers
not to cache the contents of the response.
2019-09-18 15:48:37 -07:00
Luiz Fonseca
5ef5ebcf19 Who uses ArgoCD: Add Lytt to the list (#2324)
* Who uses ArgoCD: Add Lytt to the list

Adds lytt.co to the list of organisations using ArgoCD in their Kubernetes clusters.

* Update README.md
2019-09-17 13:21:01 +01:00
Yujun Zhang
e1954e3eaf Fix docker image for dev (#2319)
* missing `argocd-ui` assets
* set default IMAGE_TAG
2019-09-17 08:48:35 +01:00
John Reese
d2af2faa52 Fix broken links (#2313) 2019-09-13 18:05:14 -07:00
Alexander Matyushentsev
06267d74f2 Add helm.repositories back to argocd-cm.yaml (#2314) 2019-09-13 18:04:02 -07:00
Alexander Matyushentsev
047d06f16f Document flags/env variables useful for performance tuning (#2312) 2019-09-13 17:16:30 -07:00
Alex Collins
300b9b5fae Fixes bug that prevents you creating repos via UI/CLI. (#2308)
* changes
2019-09-13 16:51:30 -07:00
Alex Collins
bc226dcd6f Re-enable caching when listing apps. (#2295) 2019-09-13 16:50:53 -07:00
Alex Collins
dfb44373bf Fixes bug in argocd repo list and tidy up UI (#2307) 2019-09-13 12:07:35 -07:00
Jesse Suen
dc322f8a1f Add restart action to Deployment/StatefulSet/DaemonSet (#2300) 2019-09-13 02:50:57 -07:00
Alex Collins
41b1b0a2d5 Clean-up the kube-version from Helm so that we can support GKE. (#2304) 2019-09-12 15:59:15 -07:00
Alex Collins
12b45116ed Fixes issue diffing secrets (#2271) 2019-09-12 09:52:43 -07:00
Seiya Muramatsu
fb5bc58c56 Add --self-heal flag to argocd cli (#2296) 2019-09-12 09:06:56 -07:00
Alex Collins
62f029af5f Support --kube-version. (#2276) 2019-09-11 16:37:00 -07:00
Alex Collins
c0084ebfe8 More helm (#2274) 2019-09-11 14:59:24 -07:00
Alexander Matyushentsev
e0dd4b107c Fix TestAutoSyncSelfHealEnabled test flakiness (#2293) 2019-09-11 13:59:37 -07:00
Alexander Matyushentsev
5516316cd2 Issue #2290 - Fix nil pointer dereference in application controller (#2291) 2019-09-11 13:53:31 -07:00
Yujun Zhang
72ea7912eb Fix building error when following CONTRIBUTING.md (#2278) 2019-09-11 10:33:00 -07:00
Alexander Matyushentsev
010dd02ba8 Issue #2245 - Intermittent "git ls-remote" request failures should not fail app reconciliation (#2281) 2019-09-10 22:03:21 -07:00
agabet
02cc6b100c Adding information to make local execution more accessible (#2279) 2019-09-10 13:29:16 -07:00
Alex Collins
8e3e79b5fc API clients may use the HTTP Authorization header for auth. (#2262) 2019-09-10 10:41:04 -07:00
Alexander Matyushentsev
5d606cae2f Fix TestAutoSyncSelfHealEnabled test flakiness (#2282) 2019-09-10 10:38:11 -07:00
Alexander Matyushentsev
39cb8db3e1 Issue #2022 - Support limiting number of concurrent kubectl fork/execs (#2264) 2019-09-10 09:56:48 -07:00
Alex Collins
f4f291302c Increase e2e timeout to 15m. See #2272 (#2273) 2019-09-09 14:56:02 -07:00
Tom Wieczorek
a1e7618d0f Change Helm repo URLs to argoproj/argo-cd/master (#2266) 2019-09-09 06:47:03 -07:00
ssbtn
b85785726c Fix typo (#2265)
> `/metadata/generaName`. 

Is generaName a mistake in generateName ?
2019-09-09 00:01:20 -07:00
Alex Collins
4e9772e19b Adds support for Helm 1st-class. Closes #1145 (#1865) 2019-09-06 15:37:25 -07:00
Alex Collins
b37be09d6b codegen (#2254) 2019-09-05 15:29:30 -07:00
Alexander Matyushentsev
b42389a021 Add v1.2 Changelog (#2252) 2019-09-05 13:35:24 -07:00
Alex Collins
cbf9585d84 Gzip JWTs and Adds New User Info Page (#2204) 2019-09-05 13:31:04 -07:00
Mitz Amano
e322750265 Fix degraded proxy support for http(s) git repository (#2243) (#2249) 2019-09-05 10:42:38 -07:00
Alex Collins
fe90744ea3 Improve build stability (#2247) 2019-09-04 16:24:33 -07:00
Alex Collins
75cc094b88 codegen (#2244) 2019-09-04 10:46:14 -07:00
Alex Collins
3fa91729cc Update bug_report.md (#2242) 2019-09-03 14:51:36 -07:00
Gustav Paul
ea9b8c8b27 docs/user-guide/projects.md: fix example policy (#2233) 2019-09-03 11:58:17 -07:00
Chris Jones
858823d911 Grammar fixes. (#2232) 2019-09-03 11:57:52 -07:00
Ben Doyle
58c32833ed Alter wording in Ingress docs to be more natural (#2230) 2019-09-03 11:44:28 -07:00
ssbtn
7d9b8e60cc Fix typo. (#2240) 2019-09-03 09:32:45 -07:00
Andrew Waters
06b2fec68c Fix/grafana datasources (#2229)
* Adds missing datasources for panels

* Adds UBIO to organisation using Argo
2019-09-03 09:31:47 -07:00
Alex Collins
21bc70be05 If there is only one wave and no pre/post hooks, we should be synced.… (#2217) 2019-08-27 08:56:59 -07:00
Alexander Matyushentsev
9d4a32e94f Issue #2198 - Print empty string instead of Unknown in 'argocd app sync' output (#2223) 2019-08-26 16:42:48 -07:00
Toby Jackson
476682ba8c Add FuturePLC to List of companies using ArgoCD (#2122)
* Add FuturePLC to List of companies using ArgoCD

We've been using ArgoCD for a few months now, and are using it to deploy onto 5 on prem clusters, 1 cloud cluster and have implemented some of our own code to support hands-off deployment onto review branches into dedicated namespaces.

Using the App of Apps pattern to self-manage argo, the clusters, and the services on those clusters.

Keep up the good work

* Update README.md

Ordering list and very minor format change on "Why" to make list flow more neatly.
2019-08-26 13:51:27 -07:00
Alex Collins
94b0a79d94 Fix for displaying hooks in app diff view. Fixes #2215 (#2218)
* Duct tape fix for displaying hooks in app diff view. Fixes #2215

* ""operationId": "ListMixin7"," to swagger.json

* "for _, item := range items {" to app.go
2019-08-26 13:50:19 -07:00
Rayyis
81aa3fb786 Create projects from manifests (#2202) 2019-08-26 13:21:09 -07:00
Alexander Matyushentsev
44a69e8a73 Fix JS crash in EditablePanel component (#2222) 2019-08-26 12:00:02 -07:00
Alexander Matyushentsev
608361ce20 Fix flaky TestOrphanedResource test (#2210) 2019-08-23 14:11:45 -07:00
Alexander Matyushentsev
8b29b9c8c2 Issue #2212 - Correctly handle trailing shash in configured URL while creating redirect URL (#2214) 2019-08-23 14:06:20 -07:00
jannfis
43a333d3a6 Use same /24 network for testing immutable field update (#2213) 2019-08-23 10:56:44 -07:00
Rodolphe Prin
16883df273 Add path to externalURLs (#2208) 2019-08-23 08:26:03 -07:00
Sverre Boschman
459402b569 support OIDC claims request (#1957) 2019-08-23 08:18:34 -07:00
Tom Wieczorek
318a9251bd Better detection for authorization_code OIDC response type (#2164)
Currently, the authorization_code flow is only chosen if either a
client secret is present, or if it is the only supported response type
by the Identity Provider (which was a special case for dex). If a public
OIDC client is used (i.e. a client without a secret) which supports more
than just the 'code' flow, implicit mode is preferred.

Change the flow detection to properly check if the 'code' flow is
supported, and, if it's available, prefer it in any case over the
implicit flow since one cannot obtain Refresh Tokens that way, which
means that users need to re-authenticate every time the ID Token expires.
2019-08-22 17:41:36 -07:00
Alex Collins
38b0f9d21f Deals with race condition when deleting resource. Closes #2141 (#2200) 2019-08-22 17:17:04 -07:00
Alexander Matyushentsev
a10dd3f184 Issue #1059 - Use ApplicationParameters panel on ApplicationCreatePanel (#2197) 2019-08-22 15:53:16 -07:00
Alexander Matyushentsev
f9286cfab9 Issue #1167 - Document orphaned resources, update proj CLI (#2188) 2019-08-22 11:35:43 -07:00
Alex Collins
b45b3e807c Codegen (#2195)
]
2019-08-22 11:30:28 -07:00
Alexander Matyushentsev
7ac9e6f23c Remove duplicated DoNotIgnoreErrors method (#2196) 2019-08-22 10:43:39 -07:00
Alex Collins
fc934fd4d7 Improves BeforeHookCreation. Closes #2141 (#2142) 2019-08-22 09:39:15 -07:00
Alexander Matyushentsev
133dfb76fe Issue #2192 - SyncError app condition disappears during app reconciliation (#2193) 2019-08-22 09:36:27 -07:00
jannfis
b79b388425 Fix broken links in Operator Manual declarative setup (#2194) 2019-08-22 09:33:24 -07:00
Tom Wieczorek
5930a8a04d FAQ: Simplify admin password snippet a bit (#2190) 2019-08-22 09:20:07 -07:00
Alexander Matyushentsev
57db0188cc Add missing labels to argocd-cm yaml in kustomize.md and declarative-setup.md (#2189) 2019-08-21 13:52:08 -07:00
Alexander Matyushentsev
adc6afd011 Issue #1167 - Allow enabling/disabling orphaned resources using UI (#2186) 2019-08-21 13:01:46 -07:00
Alexander Matyushentsev
be56670519 Add missing labels to configmap/secret in documentation (#2187) 2019-08-21 11:24:26 -07:00
Alexander Matyushentsev
83f58f2652 Issue #1167 - Excluded known orphaned resources exceptions (#2178) 2019-08-20 15:48:37 -07:00
dthomson25
49a1a77c69 Allow list actions to return yaml or json (#1805) 2019-08-20 14:41:52 -07:00
Alex Collins
c9eb111d8a Adds test for updating immutable field, adds UI button to allow force from UI. See #2150 (#2155) 2019-08-20 14:31:33 -07:00
Alex Collins
575dcc1697 Adds a floating action button with help and chat links to every page.… (#2125) 2019-08-20 10:34:54 -07:00
Alexander Matyushentsev
b96a3aa401 Issue #2174 - Fix git repo url parsing on application list view (#2175) 2019-08-20 09:16:10 -07:00
Alexander Matyushentsev
b7377a1080 Issue #2146 - Fix nil pointer dereference error during app reconciliation (#2170) 2019-08-20 08:43:29 -07:00
Alexander Matyushentsev
cdeff93e3a Temporary disable Git LFS test to unblock release (#2172) 2019-08-19 16:28:05 -07:00
Alex Collins
57aa8901e2 Determine the manifest version from the VERSION file when on release branch (#2166) 2019-08-19 13:22:40 -07:00
Alexander Matyushentsev
24b04be335 Issue #1167 - Controller should remove orphaned resources warning if app has no orphaned resources (#2169) 2019-08-19 11:12:07 -07:00
Alexander Matyushentsev
9fc6185436 Issue #2114 - Fix history api fallback implementation to support app names with dots (#2168) 2019-08-19 11:11:39 -07:00
Alexander Matyushentsev
aa0f9a3aa7 Issue #1167 - Implement orphan resources support (#2103) 2019-08-19 20:14:48 +05:00
Alex Collins
b85d3e59fa Enhances cookie warning with actual length to help users fix their co… (#2134) 2019-08-16 14:06:46 -07:00
Alex Collins
eb7f942acb Fixes some code issues related to Kustomize build options. See #2146 (#2151) 2019-08-16 12:55:36 -07:00
Alex Collins
ff71377546 Updates app-of-apps docs (#2159) 2019-08-16 12:49:42 -07:00
Alex Collins
97a6ebfdc8 Update helm.md (#2145) 2019-08-16 12:49:14 -07:00
Simon Behar
066a083c62 Create "argocd" ns in make start (#2161) 2019-08-16 09:44:16 -07:00
Simon Behar
ec142a1031 Fixed routing issue for periods (#2162) 2019-08-15 13:08:08 -07:00
Simon Behar
db6146a25c Added more health filters in UI (#2160) 2019-08-15 11:14:06 -07:00
Ryota
5b4c132e36 Update broken link (#2158)
Follow-up on https://github.com/argoproj/argocd-example-apps/pull/35
2019-08-15 11:11:19 -07:00
Simon Behar
e94999b07d Added 'SyncFail' to possible HookTypes in UI (#2153) 2019-08-14 14:29:15 -07:00
Simon Behar
9a2e7ca190 Indicate that SyncFail hooks are on v1.2+ (#2149) 2019-08-14 09:19:31 -07:00
Alex Collins
bad2e91039 Helm hooks. Closes #355 (#2069) 2019-08-12 15:34:21 -07:00
Alexander Matyushentsev
fdbe926aa8 Ignore generated code coverage (#2135) 2019-08-09 15:26:46 -07:00
Alex Collins
a69c664e38 Update faq.md (#2131)
* Update faq.md

* Update faq.md

* Update faq.md

* Update faq.md
2019-08-09 14:28:07 -07:00
Alex Collins
690a3cae16 Adds checks around valid paths for apps (#2133) 2019-08-09 14:25:56 -07:00
Alex Collins
cc7862bbb8 Minor CLI bug fixes (#2132) 2019-08-09 13:26:37 -07:00
Alex Collins
f2a341550d Update rbac.md (#2130) 2019-08-09 11:16:05 -07:00
Alex Collins
65ae3c2a32 Adds support for a literal YAML block of Helm values. Closes #1930 (#2057) 2019-08-09 10:47:02 -07:00
Alexander Matyushentsev
9a59e9ac28 Issue #2060 - Enpoint incorrectly considered top level managed resource (#2129) 2019-08-09 10:05:54 -07:00
Alex Collins
e682056ffc Updates hook delete policy docs (#2127) 2019-08-09 08:37:54 -07:00
Alex Collins
b17f330b88 Fixed truncation of group in UI. Closes #2006 (#2128) 2019-08-08 17:03:40 -07:00
Alex Collins
9d0824beb6 Fixes flaky e2e tests. Closes #2086 (#2126) 2019-08-08 16:17:44 -07:00
Alex Collins
9c8ab50d60 Redact secrets using "+" rather than "*" as this is base 64 compatiba… (#2119) 2019-08-08 14:45:27 -07:00
jannfis
d2e98df607 Allow adding certs for hostnames ending on a dot (fixes #2116) (#2120) 2019-08-08 09:01:13 -07:00
jannfis
de4fbcdf5b Fix and enhance end-to-end testing for SSH repositories (#2101)
* Fix and enhance end-to-end testing for SSH repositories
2019-08-07 10:53:00 -07:00
Alex Collins
3f312a9e92 Adds support for hook-delete-policy: BeforeHookCreation. Closes #2036 (#2048) 2019-08-07 10:32:49 -07:00
Alex Collins
28be15de56 Adds support for setting Helm string parameters via CLI. Closes #2078 (#2109) 2019-08-07 09:59:02 -07:00
jannfis
103609794c Escape square brackets in pattern matching hostnames (fixes #2099) (#2113) 2019-08-07 09:54:16 -07:00
Ryota
818524694d Correct some broken links in yaml (#2111) 2019-08-06 16:13:23 -07:00
Alex Collins
e3e4ae5d2e Do not panic if the type is not api.Status (an error scenario). Closes #2105 (#2106) 2019-08-06 00:24:22 -07:00
Alexander Matyushentsev
c47cc25690 Run dockerized manifests generation during release (#2107) 2019-08-06 00:24:03 -07:00
Alexander Matyushentsev
c2ee30f49f Issue #2073 - Fix status column width on resources list table (#2104) 2019-08-05 16:34:51 -07:00
jannfis
ea8b7c6ac9 Update private repository documentation to reflect latest changes (#2102) 2019-08-05 15:22:30 -07:00
Alexander Matyushentsev
9bc5f26b41 Fix flaky TestDeletingAppStuckInSync test (#2100) 2019-08-05 10:12:03 -07:00
jannfis
1e81f2a163 Export TLS and SSH known hosts settings and TLS client cert secrets in argocd-util (#2098) 2019-08-05 09:37:15 -07:00
jannfis
f6240f0dea Correctly set required env vars for running E2E tests locally (#2097) 2019-08-04 11:35:00 -07:00
Alexander Matyushentsev
52e7a839d6 Support Jsonnet TLA code and string args (#2096) 2019-08-02 16:58:09 -07:00
Alexander Matyushentsev
31ec4cf615 Issue #2060 - Make sure endpoint is shown as a child of service (#2080) 2019-08-02 16:57:54 -07:00
Simon Behar
3a9034e68f Added Kustomize build options to settings/argocd-cm (#1817)
Added Kustomize build options to settings/argocd-cm (#1817)
2019-08-02 16:57:33 -07:00
Alex Collins
583be34815 Fixes TestDeletingAppStuckInSync. Closes #2087 (#2093) 2019-08-02 15:06:59 -07:00
Alex Collins
bc77e8ce12 Fixes TestArgoCDWaitEnsureAppIsNotCrashing. Closes #2088 (#2092) 2019-08-02 15:06:45 -07:00
Alex Collins
5f2dc0e9e0 Skip TestAppOfApps. Closes #2089 (#2091) 2019-08-02 15:06:35 -07:00
Alex Collins
b49a0ce7d5 Remove support for Kustomize 1. Closes #1573 (#2077) 2019-08-02 13:13:27 -07:00
JB Volta
5d5c8168d4 Update metrics doc (#2079) 2019-08-02 13:07:24 -07:00
Alexander Matyushentsev
5e0f3fc81c Update releasing docs (#2084) 2019-08-02 11:48:13 -07:00
Alexander Matyushentsev
daad4306bd Update VERSION file (#2083) 2019-08-02 11:47:27 -07:00
Alexander Matyushentsev
cdfa8c1561 Issue #2081 - Fix empty manifest tab error (#2082) 2019-08-02 11:46:22 -07:00
Alex Collins
4e15036cad Adds support for argocd app set for Kustomize. Closes #1843 (#2055) 2019-08-02 11:39:24 -07:00
Alex Collins
2780f81fbb Allow users to create tokens for projects where they have any role. C… (#2066) 2019-08-01 17:03:07 -07:00
Alexander Matyushentsev
2114189bef Issue #2074 - Add UI to manage sync options (#2076) 2019-08-01 16:26:27 -07:00
Alexander Matyushentsev
588d30268b Upgrade kustomize to v3.1.0 (#2072) 2019-08-01 11:27:08 -07:00
jannfis
399b33df48 Change field names to camelCase in RepositoryCertificate of cert API (#2071) 2019-08-01 10:09:15 -07:00
jannfis
2742ead047 Bugfix: Ensure we have a valid hostname when adding certificates (#2064) 2019-08-01 08:29:04 -07:00
Alexander Matyushentsev
dacdeb6025 Improve wrapped text rendering on application list and application sync status pages (#2067) 2019-07-31 18:39:41 -07:00
jannfis
29b72ca695 Add first-class support for connecting repositories via UI (#2043)
* Add first-class support for connecting repositories via UI

* Fix height of TextArea and title of add HTTPS repo dialogue
2019-07-31 17:38:34 -07:00
Alexander Matyushentsev
355e949a87 Make sure applications filter is expanded on xlarge and xxlarge screens (#2065) 2019-07-31 14:26:07 -07:00
Alex Collins
47804103d9 Moves talks into one place (#2063) 2019-07-31 11:22:08 -07:00
jannfis
df6a66e580 Update user documentation on private repositories feature (#2062) 2019-07-31 09:30:18 -07:00
jannfis
4257031c3f Move repo certificate info generation to server side (#2044) 2019-07-31 09:29:26 -07:00
Alexander Matyushentsev
8da326926b Make sure applications page has 4 tiles on very large screen (#2059) 2019-07-30 17:14:15 -07:00
Alex Collins
935ffc167e Bump Circle CI cache key versions. (#2058) 2019-07-30 16:34:32 -07:00
Alexander Matyushentsev
5d27eaab9b Install missing go tools in CI job (#2054) 2019-07-30 13:53:30 -07:00
Alexander Matyushentsev
4a00634ac1 Improve refresh button on applications tiles view (#2053) 2019-07-30 13:50:45 -07:00
Alexander Matyushentsev
d6b97c93f5 Add v1.x changelog (#2051) 2019-07-30 13:48:48 -07:00
jannfis
c51645be35 Build UI into argocd Docker image (#2052) 2019-07-30 13:07:20 -07:00
Alexander Matyushentsev
a24184bb7a Issue #2049 - 'argocd app wait' should print correct sync status (#2050) 2019-07-30 10:30:51 -07:00
Alex Collins
3f34667dc7 Word-wraps app info in the table and list views. Closes #2004 (#2026) 2019-07-29 16:14:36 -07:00
Alex Collins
4ec2ed3fe6 Adds a refresh button to list and tile view. Closes #1606 (#2027) 2019-07-29 15:32:16 -07:00
jannfis
488bdcf0e3 Build argocd-repo-server and argocd-util with packr (#2041) 2019-07-29 10:21:19 -07:00
Alexander Matyushentsev
2cac22bc55 Delete obsolete comment (#2042) 2019-07-29 10:17:49 -07:00
jannfis
351e964e4e Allow codegen to run as non-root user in the Docker container (#2032) 2019-07-26 10:46:45 -07:00
Alex Collins
5e4f327edd Shows correct revision metadata for. Closes #2028 (#2029) 2019-07-26 08:50:37 -07:00
Alex Collins
47e5285544 Removes width limitation and adjusts column widths for resource list … (#2025) 2019-07-26 08:50:11 -07:00
Alex Collins
3445f448ac Run yarn build on CI. (#2024) 2019-07-26 08:49:44 -07:00
Ed Lee
3cf00496b3 Update OWNERS (#2030) 2019-07-25 16:37:58 -07:00
Alexander Matyushentsev
81719d3150 Issue #1780 - Project source/destination removal should consider wildcards (#2023) 2019-07-25 15:31:18 -07:00
Alex Collins
d9bdc3b125 Word wraps error message. Closes #1942 (#2011) 2019-07-25 13:22:46 -07:00
Alex Collins
0fb8680da6 Adds CLI support for adding and removing groups from project roles. C… (#2013) 2019-07-25 11:05:06 -07:00
Alex Collins
2e523bfb93 Update yarn.lock (#2012) 2019-07-25 09:29:35 -07:00
Lev Aminov
0ef5061e11 Allow Apply Only on sync (#2015) 2019-07-25 09:13:16 -07:00
Ali
ab8b435de3 Fixed date and version number of 1.1 release in changelog (#2014) 2019-07-25 09:12:27 -07:00
Alexander Matyushentsev
e27568fa8c Issue #1736 - Auto-sync should support self-healing option (#1990) 2019-07-24 19:26:09 -07:00
Alexander Matyushentsev
41650ed043 Issue #2000 - Repo whitelisting in UI does not support wildcards (#2010) 2019-07-24 17:26:35 -07:00
jannfis
5953080c96 Add support for connecting repositories using TLS client certs (fixes #1945) (#1960) 2019-07-24 17:25:27 -07:00
Alexander Matyushentsev
754e4754eb Issue #2007 - UI should remember most recent selected tab on resource info panel (#2009) 2019-07-24 16:08:19 -07:00
Alexander Matyushentsev
8d0744cdb0 Regenerate lock file (#2008) 2019-07-24 16:04:11 -07:00
Alex Collins
da29f43a2b Adds link to the project from the app summary page. Closes #1911 (#1998) 2019-07-24 15:50:31 -07:00
Alex Collins
7dc19630fe Documents the instance label. Closes #1482 (#1996) 2019-07-24 15:08:24 -07:00
Alex Collins
1b2bdb1e09 Update config-management-plugins.md (#1997) 2019-07-24 15:07:48 -07:00
Alexander Matyushentsev
1b3ec9d578 Issue #1989 - Fix creating app resources graph using network connections on app details page (#2001) 2019-07-24 15:07:06 -07:00
Alexander Matyushentsev
282de00d80 Fix invalid RBAC configuration example (add missing quotes) (#2003) 2019-07-24 15:06:17 -07:00
Alexander Matyushentsev
017f9c06fb Issue #1940 - Wait for CRD creation during sync process (#1999) 2019-07-24 15:00:40 -07:00
Alexander Matyushentsev
be5ea7e219 Add 1.1 changelog (#1994) 2019-07-24 10:52:02 -07:00
jannfis
33bc349280 Add UI functionality for certificate management (#1987)
Add UI functionality for certificate management (#1987)
2019-07-24 10:04:42 -07:00
Rayyis
d1d783f24d Added a button to select out of sync items in the sync panel (#1993) 2019-07-24 09:12:35 -07:00
Dai Kurosawa
8bedda2314 Fix typo. (#1991) 2019-07-24 09:10:44 -07:00
Alexander Matyushentsev
8c8b552485 Issue #1984 - Support 'override' action in UI/API (#1985) 2019-07-23 14:16:36 -07:00
Alexander Matyushentsev
6956dcb6dc Move kustomization files back to kustomize 2.0.3 (#1972)
* Move kustomization files back to kustomize 2.0.3

* Dockerize codegen
2019-07-23 11:24:59 -07:00
Alexander Matyushentsev
57e2c5d7e7 Issue #1982 - Fix argocd app wait message (#1983) 2019-07-23 11:14:48 -07:00
jannfis
d58339561c Add ability to specify insecure and LFS modes when adding repos via UI (#1979) 2019-07-23 09:24:40 -07:00
Alexander Matyushentsev
a6cf2c5145 Update sample grafana dashboard with new metrics (#1976) 2019-07-23 08:58:30 -07:00
jannfis
1cd016d7eb Mention git-lfs as a build pre-requisite (#1978) 2019-07-23 02:32:14 -07:00
Alex Collins
c11c2a617f Only run Git LFS tests on CI. (#1975) 2019-07-22 16:51:29 -07:00
Alex Collins
6031d7f830 Do not ignore Argo hooks when there is a Helm hook. Closes #1952 (#1973) 2019-07-22 14:52:38 -07:00
dependabot[bot]
604ac4f0e7 Bump jquery from 3.3.1 to 3.4.1 in /ui (#1970) 2019-07-22 13:49:09 -07:00
dependabot[bot]
2438c0de91 Bump lodash-es from 4.17.10 to 4.17.15 in /ui (#1969) 2019-07-22 13:48:57 -07:00
dependabot[bot]
abeb301c2b Bump fstream from 1.0.11 to 1.0.12 in /ui (#1968) 2019-07-22 13:48:47 -07:00
dependabot[bot]
db5f795be8 Bump lodash.mergewith from 4.6.1 to 4.6.2 in /ui (#1967) 2019-07-22 13:48:38 -07:00
dependabot[bot]
fe86b57a2c Bump js-yaml from 3.12.0 to 3.13.1 in /ui (#1966) 2019-07-22 13:48:30 -07:00
Devon Mizelle
4dc959f3e5 Check that TLS is enabled when registering DEX Handlers (#1963)
This commit makes it so that `registerDexHandlers` in `server/server.go`
only attempts to modify `a.TLSConfig` if TLS is enabled.

Without this, deployments of ArgoCD that don't have a certificate
enabled (in the case where a LB/Ingress Controller is handling SSL
connections as a reverse proxy) end up having a nil pointer reference
panic on start.
2019-07-20 21:53:22 -07:00
stgarf
a657ceb59d Update CONTRIBUTING.md (#1964)
Add small snippet on updating dependencies before building to avoid 
failures.
2019-07-20 21:02:40 -07:00
Alexander Matyushentsev
26df57e5c7 Fix argocd app sync/get cli (#1959) 2019-07-19 14:31:07 -07:00
Jesse Suen
09dd89a468 Do not allow app-of-app child app's Missing status to affect parent (#1954) 2019-07-19 13:27:44 -07:00
Alexander Matyushentsev
ce861fe366 Issue #1935 - argocd app sync hangs when cluster is not configured #1935 (#1962) 2019-07-19 13:04:01 -07:00
Alexander Matyushentsev
3f4bacdbba Revision metadata api fails if specified revision is ambiguous (#1958) 2019-07-19 12:31:13 -07:00
Alexander Matyushentsev
cd3ff90e0d Remove unnecessary details from sync errors (#1951) 2019-07-18 17:28:28 -07:00
jannfis
8f3a6047b2 Add support for Git LFS enabled repositories (fixes #1853) (#1941)
* Add support for LFS enabled repositories
2019-07-18 12:49:49 -07:00
Alexander Matyushentsev
6049a49114 Change git prometheus counter name (#1949) 2019-07-17 16:04:54 -07:00
Devon Mizelle
43721515d8 Bump Kustomize v2.1.0 to v3.0.2 (#1948)
* Bump Kustomize v2.1.0 to v3.0.0
2019-07-17 14:39:21 -07:00
Alexander Matyushentsev
5c07473e60 E2E test should fail in action fails unless otherwise configured (#1946) 2019-07-17 14:38:48 -07:00
Liviu Costea
1524aed25e Add Mambu - The SaaS Banking Engine to the list of users (#1947) 2019-07-17 10:46:13 -07:00
Saradhi Sreegiriraju
a182e0c306 Update README.md (#1943) 2019-07-15 15:49:46 -07:00
Alexander Matyushentsev
a9fc89e8a5 Issue #1919 - Eliminate unnecessary git interactions for top-level resource changes (#1929)
* Issue #1919 - Eliminate unnecessary git interactions for top-level resource changes

* Apply reviewer notes
2019-07-15 13:34:26 -07:00
Alexander Matyushentsev
8ea7b4ac3b Add link to IBM blog about Argo CD (#1939) 2019-07-15 12:50:47 -07:00
Saradhi Sreegiriraju
d50fbccaf1 Update README.md (#1937)
Created a community blogs and presentations section
2019-07-15 11:19:58 -07:00
Alexander Matyushentsev
d3c850b8e7 Issues #1513 - Make sure insecure flag works for remote Kustomize bases (#1934)
* Make sure insecure flag works for remote Kustomize bases
2019-07-12 17:17:23 -07:00
jannfis
958239fffb Update user and operator documentation for change introduced in #1807 (#1933) 2019-07-12 14:04:44 -07:00
jannfis
22dfc7e066 Adress some change requests remaining from #1807 (#1931) 2019-07-12 10:19:51 -07:00
Alex Collins
9a76a06f39 Introduces compact diff view. Closes #1831 (#1913) 2019-07-12 09:30:02 -07:00
Alexander Matyushentsev
a607731d86 Make sure refresh icon is not hidden under status panel (#1928) 2019-07-12 09:19:43 -07:00
Alexander Matyushentsev
ba731ee507 Regenerate Gopkg.lock (#1925) 2019-07-11 16:31:18 -07:00
Alexander Matyushentsev
e93b0a0a8d Disable codecov/patch (#1926) 2019-07-11 16:31:07 -07:00
Alexander Matyushentsev
377fa5532a Issue #1915 - Deployment history metadata should be loaded only if deployment history panel is opened (#1916) 2019-07-11 16:01:21 -07:00
jannfis
9cf744f435 Simplify server certificate and known hosts management (#1807) 2019-07-11 16:00:47 -07:00
Masayuki Ishii
641e344c7f Issue #1841 Make the health check for APIService a built in (#1921) 2019-07-11 11:12:13 -07:00
Alexander Matyushentsev
722aefd1c9 Issue #897 - Secret data not redacted in last-applied-configuration (#1920) 2019-07-11 09:40:48 -07:00
Alexander Matyushentsev
f40ffdf81e Issue #1912 - Add Prometheus metrics for git repo interactions (#1914) 2019-07-10 17:13:58 -07:00
Alexander Matyushentsev
647275cf46 Issue #1917 - App details page incorrect uses 'requires pruning' icon for out-of-sync resources (#1918) 2019-07-10 16:56:52 -07:00
Alex Collins
933426a5e6 Update config-management-plugins.md (#1908) 2019-07-10 14:46:05 -07:00
Alexander Matyushentsev
7162100415 Issue #1909 - App controller should log additional information during app syncing (#1910) 2019-07-10 13:29:19 -07:00
Alexander Matyushentsev
85b6defbc8 Upgrade argo ui version to pull dropdown fix (#1906) 2019-07-10 11:45:46 -07:00
Simon Behar
a03f257205 Sync Docs (#1907) 2019-07-10 11:43:53 -07:00
Alex Collins
2a8807161a Attempts to make CI builds more reliable by reducing lint memory usage. (#1905) 2019-07-10 11:43:11 -07:00
Alex Collins
51e340cff6 Improved the usability of an app-of-apps by adding a link to the chil… (#1900) 2019-07-09 16:47:36 -07:00
Alexander Matyushentsev
03aade0267 Upgrade argo ui version to pull dropdown fix (#1899) 2019-07-09 14:15:13 -07:00
Jake Utley
afdfabd71b Allow Helm parameters to force ambiguously-typed values to be strings (#1889)
* Allow Helm parameters to force ambiguously-typed values to be strings

* Fix protobud issue for ForceString field

* Ran pre-commit checks

* Revert "Ran pre-commit checks"

This reverts commit b384d16e46.

* Ran pre-commit checks

* Revert "Ran pre-commit checks"

This reverts commit dc9e31567b.

* Ran pre-commit checks
2019-07-09 12:20:36 -07:00
Alex Collins
b2131e4a06 Attempts to fix flaky TestCustomToolWithEnv (#1876) (#1893) 2019-07-08 17:24:59 -07:00
Alex Collins
a786caa73d Log more error information. See #1887 (#1891) 2019-07-08 17:24:36 -07:00
Alex Collins
43d2848c12 Fixes bug where repo was not displayed in UI. Closes #1883 (#1892) 2019-07-08 14:07:20 -07:00
Alex Collins
a123f0bd37 Attempts to fix flaky TestCustomToolWithEnv (#1876) 2019-07-03 14:39:37 -07:00
Alex Collins
11afe8d723 Marks TestDeletingAppStuckInSync as flaky (#1880) 2019-07-03 14:37:54 -07:00
Alex Collins
8665997d89 Fixes garbage in e2e logging on CI (#1879) 2019-07-03 14:37:41 -07:00
Alex Collins
4296a87e6b Enables unparam linter and fixes linting issues (#1872) 2019-07-03 14:17:58 -07:00
Alexander Matyushentsev
37b72caf37 Issue #1874 - validate app spec before verifying app permissions (#1875) 2019-07-03 13:09:54 -07:00
Alex Collins
37ee096322 Redacts Helm username and password. Closes #1868 (#1871) 2019-07-03 13:02:25 -07:00
Alexander Matyushentsev
a2c9ed21ff Issue #1867 - Fix JS error on project role edit panel (#1869) 2019-07-03 10:36:32 -07:00
Alexander Matyushentsev
7d86b51246 Issue #1620 - Support anonymous argocd access (#1864) 2019-07-02 19:10:53 -07:00
Alex Collins
b387a3a1e1 Adds support for environment variables to custom plugins (#1860) 2019-07-02 15:59:55 -07:00
Alexander Matyushentsev
5f798583db Fix JS UI crash if user is not authenticated (#1863) 2019-07-02 14:36:07 -07:00
Alexander Matyushentsev
9f8693a6a1 Issue #1621 - Proper handling of an excluded resource in an application (#1862) 2019-07-02 13:56:25 -07:00
Alexander Matyushentsev
5ee346c266 Issue 1858 - Support 'application/merge-patch+json' in 'argocd app patch' (#1859) 2019-07-02 13:41:25 -07:00
Alexander Matyushentsev
f79b49e706 Issue #1159 - Different icon for resources which require pruning (#1854) 2019-07-02 09:43:29 -07:00
Alexander Matyushentsev
24f68835d3 Issue #1855 - Fix jumping app status panel (#1856) 2019-07-02 09:28:49 -07:00
Alex Collins
92d3173077 Attempt to fix flaky tests (#1849) 2019-07-02 09:23:50 -07:00
Alexander Matyushentsev
f555da6536 Issue #738 - Allow configuring google analytics tracking (#1848) 2019-07-01 16:57:40 -07:00
Alexander Matyushentsev
71cf80b44b Issue #1614 - Stop repeating logs on stopped container (#1850) 2019-07-01 16:47:51 -07:00
Alex Collins
5be6db4689 Adds cluster name to UI. Closes #1353 (#1814) 2019-07-01 15:41:48 -07:00
Alexander Matyushentsev
c26c07d938 Improve status badge feature (#1844)
* Improve status badge feature

* Add status badge tests
2019-07-01 12:10:36 -07:00
Alexander Matyushentsev
46204e4a44 Upgrade argo-ui version to fix dropdown position calculation (#1847) 2019-07-01 10:08:12 -07:00
Simon Behar
fb5e85d7fa Added SyncFail hooks (#1795) 2019-06-28 15:50:02 -07:00
Alex Collins
4f9e81f6c4 Removes logging that appears when using the CLI (#1842) 2019-06-28 13:19:27 -07:00
Jean-Philippe Evrard
809f742249 Fix docs typos (#1838) 2019-06-28 10:54:05 -07:00
Alexander Matyushentsev
b0aa80f26f Enable monaco editor web service to improve editor performance (#1837) 2019-06-28 10:46:51 -07:00
naynasiddharth
c76ee06cd8 Badgedocs (#1840) 2019-06-28 10:45:46 -07:00
Alex Collins
f0d3a042a3 Adds a timeout to all external commands. Closes #1821 (#1823) 2019-06-28 10:44:01 -07:00
Alexander Matyushentsev
bbad449ac6 Fields status.reconciledAt and status.observedAt must be pointers (#1836) 2019-06-27 17:55:06 -07:00
Alex Collins
640c139fdc Updates CI cache go-v16 (#1834) 2019-06-27 16:19:51 -07:00
Alexander Matyushentsev
0f40a0b843 Explicitly specify version of every dev tool (#1835) 2019-06-27 15:55:43 -07:00
Alexander Matyushentsev
1e502fb5c5 Generate CRD schema using github.com/kubernetes-sigs/controller-tools (#1773) 2019-06-27 14:44:49 -07:00
Alexander Matyushentsev
825a815dd0 Issue #1820 - Make sure api server to repo server grpc calls have timeout (#1832) 2019-06-27 14:21:43 -07:00
Alexander Matyushentsev
00134d2faf Issue #1676 - Move remove Repositories, RepositoryCredentials, HelmCredentials settings from ArgoCDSettings structure (#1829)
* Issue #1676 - Move remove Repositories, RepositoryCredentials, HelmCredentials settings from ArgoCDSettings structure

* Apply reviewer notes
2019-06-27 12:04:47 -07:00
Alexander Matyushentsev
b53a3db971 Increase codecov threshold to 1% (#1830) 2019-06-27 11:37:22 -07:00
Alex Collins
8d2ab47494 Update declarative-setup.md (#1825) 2019-06-27 11:35:17 -07:00
Jesse Suen
6c5ccca4cd Running application actions should require override privileges not get (#1828) 2019-06-27 11:01:48 -07:00
naynasiddharth
3815570294 App status badge (#1818) 2019-06-26 17:08:55 -07:00
Alex Collins
c46e3f979e Fixes TestUserAgent (#1822) 2019-06-26 07:42:27 -07:00
naynasiddharth
d55ac4fe92 App status badge (#1812) 2019-06-25 14:30:29 -07:00
Jesse Suen
7950a6e0e5 Update k8s libraries to v1.14 (#1806) 2019-06-25 02:52:58 -07:00
Jesse Suen
9ff0cbf6ff Parameterize Argo UI base image (#1813) 2019-06-24 17:18:50 -07:00
John Marcou
60fedf0985 Implement Bitbucket Server and Gogs webhook providers (#1808) 2019-06-24 16:40:44 -07:00
Alex Collins
469455ef00 Fix formatting on helm docs (#1810) 2019-06-24 16:03:42 -07:00
Edwin Jacques
94116d17d8 bash autocompletion for argocd (#1803) 2019-06-24 13:30:23 -07:00
Alex Collins
e5f9f9df14 Display the revision of resources in the labels. Closes #1367 (#1802) 2019-06-21 17:48:21 -07:00
Alexander Matyushentsev
933877a179 Issue #1676 - Move remove AppInstanceLabelKey, ConfigManagementPlugins, ResourceOverrides, ResourceExclusions, ResourceInclusions settings from ArgoCDSettings structure (#1799)
* Issue #1676 - Move remove AppInstanceLabelKey, ConfigManagementPlugins, ResourceOverrides, ResourceExclusions, ResourceInclusions settings from ArgoCDSettings structure

* Add missing tests
2019-06-21 15:59:05 -07:00
Alex Collins
f8a4d662f2 Adds more commit data. Closes #1219 (#1762) 2019-06-21 15:51:48 -07:00
Jesse Suen
059275a37f Server side rotation of cluster bearer tokens (#1744) 2019-06-21 13:34:56 -07:00
Alex Collins
261c6885f8 Fixes TestKustomize2AppSource. Closes #1800 (#1801) 2019-06-21 12:49:42 -07:00
Jesse Suen
8a6c18f3c9 Move remarshaling to happen only during comparison, instead of manifest generation (#1788) 2019-06-21 00:42:22 -07:00
Alex Collins
d2647e85a9 Fixes a bug where cluster objs could leave app is running op state. C… (#1796) 2019-06-20 21:26:19 -07:00
Alexander Matyushentsev
024dee09f5 Add health check to the controller deployment (#1785) 2019-06-19 12:00:01 -07:00
stgarf
1b55b1f1d4 Make the --grpc-web flag more obvious (#1703) 2019-06-19 11:31:39 -07:00
Liviu Costea
a223cbb96d Support top level arguments for jsonnet on app create cli (#1769) 2019-06-18 22:40:03 -07:00
Alexander Matyushentsev
882584202c Make status fields as optional fields (#1779) 2019-06-18 15:59:15 -07:00
dthomson25
2dfa59ac3a Use correct healthcheck for Rollout with empty steps list (#1776) 2019-06-18 14:09:39 -07:00
Alex Collins
d9f087fe6c Adds a check for whether or not the application path exists and return a clear error message (#1772) 2019-06-18 14:08:29 -07:00
Alex Collins
4660456ad9 Adds Validate=false that disables validation when applying resources.… (#1750) 2019-06-18 14:07:26 -07:00
Alex Collins
b2066afee4 Updates docs for resetting password. Closes #1775 (#1777) 2019-06-18 13:30:45 -07:00
Simon Behar
d6ff62e19c Added local sync to docs (#1771) 2019-06-18 10:03:19 -07:00
Alex Collins
620b3faa8f Displays targetRevision in app dashboards. Closes #1239 (#1767) 2019-06-18 10:02:45 -07:00
Alex Collins
65783410b6 Improve sync result messages. Closes #1486 (#1768) 2019-06-18 09:59:42 -07:00
Alexander Matyushentsev
fac9d6d38d Sync status button should be hidden if there is no sync operation (#1770) 2019-06-18 09:57:53 -07:00
Simon Behar
120502097a Added local path syncing (#1578) 2019-06-17 19:09:43 -07:00
Alexander Matyushentsev
d8272908e9 UI should allow editing repo URL (#1763) 2019-06-17 14:38:55 -07:00
Jesse Suen
d3268f11f9 Pin k8s.io/kube-openapi to a stable version (#1765) 2019-06-17 14:27:27 -07:00
Alex Collins
9457c65feb Attempts to make CI builds more robust by increasing the expect timeout (#1759) 2019-06-17 13:04:23 -07:00
Alex Collins
75dc92ff5f Adds "namespace: argocd" to examples (#1758) 2019-06-17 10:54:49 -07:00
Alex Collins
030acb0f56 Fix bug in release (#1748) 2019-06-17 10:45:32 -07:00
Andreas Sommer
784f73c0fe Add example for overriding Helm values and release name (#1756) 2019-06-17 09:43:32 -07:00
jannfis
7bc8bc9846 Allow setting timeout for golangci-lint in build process from external (#1752) 2019-06-17 09:39:57 -07:00
jannfis
6e6fef8d2f Make E2E tests more configurable locally (#1753) 2019-06-17 09:37:24 -07:00
Jaret
83db6a68f3 Update Readme.md adds Saildrone org (#1757) 2019-06-17 09:19:57 -07:00
Alexander Matyushentsev
569aec60a3 Increase stale bot inactivity period (#1754) 2019-06-17 09:17:54 -07:00
John Marcou
4d008602cd Add ANSTO - Australian Synchrotron to list of users (#1755) 2019-06-16 20:33:59 -07:00
Alexander Matyushentsev
ff00be9a7c Explicitly specify user root during argocd image build (#1749) 2019-06-14 15:50:43 -07:00
Alex Collins
4927943595 codegen (#1747) 2019-06-14 14:08:00 -07:00
Alex Collins
fbf2e9e128 Adds support for SSH keys with Kustomize remote bases WIP (#1733) 2019-06-14 09:34:27 -07:00
Simon Behar
770832bcb9 Added --async flag to argocd app sync (#1738) 2019-06-14 09:32:10 -07:00
Jesse Suen
40ca1e731d Cluster registration was unintentionally persisting client-cert auth credentials (#1742)
Remove unused CreateClusterFromKubeConfig server method
2019-06-14 03:45:57 -07:00
Alexander Matyushentsev
87ac100e77 Support parameterizing argocd base image (#1741) 2019-06-13 23:20:15 -07:00
Aditya Gupta
05097f3307 Issue #1677 - Allow users to define app specific urls to expose in the UI (#1714)
* Issue argoproj#1677 - allow users to define application-specific URLs, email addresses, and other info
2019-06-13 10:52:37 -07:00
Spencer Gilbert
19f0af6169 Add Optoro to list of users (#1737) 2019-06-13 09:59:30 -07:00
Mats Iremark
bb53a8edff Adding Volvo Cars as officially using ArgoCD (#1735) 2019-06-12 11:37:05 -07:00
Alex Collins
b7f1639016 No longer waits for healthy before completing sync op. Closes #1715 (#1727) 2019-06-11 15:47:19 -07:00
Aditya Gupta
e57fa0c32e Issue #1375 - Error view instead of blank page in UI (#1726) 2019-06-11 15:31:51 -07:00
Simon Behar
8729c093c8 Helm parameter fix (#1732) 2019-06-11 15:06:15 -07:00
Simon Behar
bbe800dbac Fix key generation loop when running server on insecure mode (#1723) 2019-06-11 12:40:17 -07:00
Simon Behar
1d9cd061b1 Fixes non-escaped comma bug on Helm command arguments (#1720) 2019-06-10 15:41:34 -07:00
Alex Collins
65cceaf224 Order users alphabetically (#1721) 2019-06-10 15:40:31 -07:00
Alexander Matyushentsev
88231bc93b Issue #1533 - Add e2e tests for self-referenced app edge case (#1724) 2019-06-10 14:30:13 -07:00
Alexander Matyushentsev
611323b5ce Add ui/node_modules to docker ignore (#1725) 2019-06-10 14:28:24 -07:00
Aditya Gupta
4dc102af3f Issue #1693 - Project Editor: Whitelisted Cluster Resources doesn't strip whitespace (#1722) 2019-06-10 11:53:54 -07:00
Alexander Matyushentsev
3f14f75e51 Issue #1711 - Upgrade argo ui version to get dropdown fix (#1717) 2019-06-07 18:29:51 -07:00
Alex Collins
3256e6c29e Forward git credentials to config management plugins. Closes #1628 (#1716) 2019-06-07 18:28:38 -07:00
Alex Collins
604954561a Adds documentation around repo connections (#1709) 2019-06-07 16:21:28 -07:00
Alexander Matyushentsev
9f60933a6e Issue #1701 - UI will crash when create application without destination namespace (#1713) 2019-06-07 16:21:23 -07:00
Isaac Gaskin
893f142345 Adding Telsa to list of users (#1712) 2019-06-07 14:22:16 -07:00
dthomson25
03b7d24216 Account for missing fields in Rollout HealthStatus (#1699) 2019-06-07 11:41:52 -07:00
Simon Behar
4860f2ce21 Added logout ability (argocd logout) (#1582) 2019-06-07 11:41:47 -07:00
Alex Collins
00889551e7 Adds Prune=false and IgnoreExtraneous options (#1680) 2019-06-07 08:46:11 -07:00
Alexander Matyushentsev
bdabd5b75c Restore reposerver in Procfile (#1708) 2019-06-06 16:40:50 -07:00
Alex Collins
ac51f66829 Name e2e apps after the test they run for, rather than random ID. (#1698) 2019-06-06 15:50:10 -07:00
Alex Collins
bc7bbb9dbc Improve Circle CI builds (#1691) 2019-06-06 14:45:52 -07:00
Alex Collins
fcf9f82da0 Updates generated code (#1707) 2019-06-06 14:45:30 -07:00
Liviu Costea
8275200c82 Support to override helm release name (#1682) 2019-06-06 11:51:31 -07:00
Paul Brit
85ff669b66 Add Mirantis as an official user (#1702) 2019-06-06 10:09:31 -07:00
dthomson25
b16c485a2a Handle nil obj when processing custom actions (#1700) 2019-06-05 18:04:22 -07:00
Alex Collins
23ad098aa9 Documents HA/DR (#1690) 2019-06-05 14:23:30 -07:00
Alexander Matyushentsev
0f2fe76027 Move generated api code to pkg package (#1696) 2019-06-05 12:58:11 -07:00
narg95
a5d957ec06 Bump base version to 1.0.1 for cluster-install (#1695) 2019-06-05 09:13:31 -07:00
Sebastian Vaisov
251cbfa99e Adds custom port repo note (#1694) 2019-06-05 09:13:07 -07:00
Alex Collins
243378b035 Sync wave (#1634) 2019-06-04 18:17:41 -07:00
Alex Collins
0dd80f9d8e Tidy up #1684 (#1689) 2019-06-04 17:08:07 -07:00
Alex Collins
f380deaf86 Update SUPPORT.md (#1681) 2019-06-04 17:07:19 -07:00
Alex Collins
bb5b78e94e Merge pull request #1684 from twz123/kustomize-commonlabels 2019-06-04 16:16:01 -07:00
Alex Collins
a234894d01 Merge pull request #1688 from argoproj/merge-ui
Merge UI
2019-06-04 14:55:53 -07:00
Alex Collins
4c1cbbcdfc Merge remote-tracking branch 'ui/master' into merge-ui 2019-06-04 14:50:51 -07:00
Alex Collins
10cf1482ab Moves UI code into ui/ (#129) 2019-06-04 14:47:28 -07:00
Steve Christensen
89afb5cac2 add tZERO to organizations using Argo CD list (#1686) 2019-06-04 14:40:03 -07:00
Marcin Jasion
34f0f286d6 Added Codility to ArgoCD users (#1679) 2019-06-04 14:18:18 -07:00
Tom Wieczorek
b645589ed5 Add support for adding Kustomize commonLabels in Applications 2019-06-04 16:54:56 +02:00
Alex Collins
d09388bc97 codegen (#1674) 2019-06-03 12:00:16 -07:00
jannfis
64a1ea9e81 Add ability to specify system namespace during cluster add operation (#1661) 2019-06-03 09:50:46 -07:00
Alex Collins
0fd10be9de Adds "Sync Status" button" (#127) 2019-05-31 17:52:05 -07:00
Alexander Matyushentsev
c214ed9546 Issue #1668 - Replicasets ordering is not stable on app tree view (#1669) 2019-05-31 17:42:20 -07:00
Alexander Matyushentsev
8a7c870f1c Fix broken e2e tests (#1667) 2019-05-31 13:13:35 -07:00
Alex Collins
556f12fd59 Adds docs about app deletion (#1664) 2019-05-30 14:38:52 -07:00
Alexander Matyushentsev
ecdf94232f Issue #1665 - Stuck processor on App Controller after deleting application with incomplete operation (#1666) 2019-05-30 12:39:54 -07:00
Alex Collins
c2b6e0f34a Update releasing.md (#1657) 2019-05-29 14:53:00 -07:00
Alexander Matyushentsev
32bfad21f8 Issue #1662 - Role edit page fails with JS error (#126) 2019-05-29 11:53:14 -07:00
Alex Collins
2777910d1f Terminates op before delete (#1658) 2019-05-29 10:55:27 -07:00
Alexander Matyushentsev
a49314be07 Issue #1609 - Improve Kustomize 2 parameters UI (#125)
* Issue #1609 - Improve Kustomize 2 parameters UI

* Add unit tests for kustomize image parsing
2019-05-28 15:30:57 -07:00
jannfis
9f9a076433 Make listener and metrics ports configurable (#1647) 2019-05-28 11:41:02 -07:00
Alex Collins
4c41f82d18 Build ArgoCD on CircleCI (#1635) 2019-05-28 11:39:13 -07:00
Alex Collins
18b62f9bbe Updated templates (#1654) 2019-05-28 10:18:04 -07:00
Appréderisse Benjamin
b9700b760f Update README.md (#1650) 2019-05-28 08:35:33 -07:00
samcgardner
894b150ac9 Add END. to adopters in README.md (#1643) 2019-05-24 05:25:29 +02:00
Alex Collins
5515b8ce9d Public git creds (#1633) 2019-05-22 17:21:56 -07:00
jannfis
24006300e5 Make build options in Makefile settable from environment (#1619) 2019-05-22 15:59:30 -07:00
Alex Collins
8cd7d590e0 Codegen (#1632) 2019-05-21 14:37:20 -07:00
Alexander Matyushentsev
38b5b242b3 Update v1.0.0 change log (#1618) 2019-05-16 15:08:22 -07:00
Alex Collins
9f330348ec Fixes e2e tests. Closes #1616. (#1617) 2019-05-16 11:05:35 -07:00
Alexander Matyushentsev
303737c0b0 Issue #1471 - Support configuring requested OIDC provider scopes and enforced RBAC scopes (#1585)
* Issue #1471 - Support configuring requested OIDC provider scopes and enforced RBAC scopes

* Apply reviewer notes
2019-05-16 07:34:20 -07:00
Alex Collins
71a8eb1697 E2e test infra (#1600) 2019-05-15 09:24:35 -07:00
Alexander Matyushentsev
71f3351d2b Issue #1352 - Dedupe live resourced by UID instead of group/kind/namespace/name (#123) 2019-05-13 15:56:46 -07:00
Alexander Matyushentsev
b93143381f Issue #1352 - Dedupe live resourced by UID instead of group/kind/namespace/name (#1575) 2019-05-13 15:56:40 -07:00
Jesse Suen
5ed0b1a6bf Supply resourceVersion to watch request to prevent reading of stale cache (#1612) 2019-05-13 14:58:22 -07:00
Alexander Matyushentsev
847b7f5e11 Issue #1533 - Prevent reconciliation loop for self-managed apps (#1608) 2019-05-13 11:17:32 -07:00
Alex Collins
7568b099ee Updates codegen (#1601) 2019-05-09 13:40:41 -07:00
Alexander Matyushentsev
7fdd865d5c Issue #1586 - Ignore patch errors during diffing normalization (#1599) 2019-05-09 09:26:02 -07:00
Alex Collins
d0d4d593cf Updates issue template and Makefile (#1598) 2019-05-09 09:05:42 -07:00
Alexander Matyushentsev
20810e98f2 Issue #1596 - SSH URLs support is partially broken (#1597) 2019-05-09 08:53:11 -07:00
Alexander Matyushentsev
97ab061ab5 Issue #1592 - Fix UI Crash is app never been reconciled 2019-05-09 08:45:14 -07:00
Alexander Matyushentsev
edf8a0ede2 Issue #1592 - Fix UI Crash is app never been reconciled 2019-05-09 07:46:50 -07:00
Alex Collins
1c6bb4386f Documents Kustomize. Closes #1566 (#1572) 2019-05-08 09:37:45 -07:00
Alexander Matyushentsev
ee00a0e049 Issue #1552 - Improve rendering app image information (#124) 2019-05-08 09:00:49 -07:00
Alexander Matyushentsev
e85eb01831 Issue #1552 - Improve rendering app image information (#1584) 2019-05-08 09:00:45 -07:00
Alexander Matyushentsev
e6697274f4 Fix ingress browsable url formatting if port is not string (#1576) 2019-05-07 16:07:34 -07:00
Alexander Matyushentsev
b3ade6159e Issue #1579 - Impossible to sync to HEAD from UI if auto-sync is enabled (#1580) 2019-05-07 14:54:51 -07:00
jpresky
6c0e21780c add commonbond to users of argocd (#1577) 2019-05-07 07:34:38 -07:00
Alexander Matyushentsev
0b945ef616 Issue #1570 - Application controller is unable to delete self-referenced app (#1574) 2019-05-06 12:49:29 -07:00
Alexander Matyushentsev
41cad56991 Issue #1546 - Add liveness probe to repo server/api servers (#1560) 2019-05-04 10:51:26 -07:00
Sahil Ahuja
f8283a1014 Add GMETRI to organizations using ArgoCD (#1564) 2019-05-04 10:50:16 -07:00
Alexander Matyushentsev
da29c05662 Issue #1563 - Network view crashes if any filter is set (#122) 2019-05-03 15:05:37 -07:00
Alexander Matyushentsev
5bf834e14e Fix broken applications chart icon (#121) 2019-05-02 17:55:49 -07:00
Alexander Matyushentsev
5c353a12f2 ISsue #1557 - Controller incorrectly report health state of self managed application (#1558) 2019-05-02 14:38:37 -07:00
Alexander Matyushentsev
5ec5301680 Issue #1540 - Fix kustomize manifest generation crash is manifest has image without version (#1559) 2019-05-02 13:34:54 -07:00
Paul Brit
d06303c432 Fix hardcoded 'git' user in util/git.NewClient (#1556)
Closes #1555
2019-05-02 10:01:20 -07:00
dthomson25
f268f82780 Improve Rollout health.lua (#1554) 2019-05-01 15:53:27 -07:00
Alexander Matyushentsev
8ea785892f Fix invalid URL for ingress without hostname (#1553) 2019-05-01 15:38:24 -07:00
Alexander Matyushentsev
5f81dc0d51 Issue #1550 - Support ':' character in resource name (#120) 2019-05-01 12:08:56 -07:00
Alex Collins
6ca654294c Updates manifests. Closes #1520 (#1549) 2019-05-01 11:48:27 -07:00
Alexander Matyushentsev
96d0beeaaf Issue #1533 - Prevent reconciliation loop for self-managed apps (#1547) 2019-05-01 09:42:45 -07:00
Alexander Matyushentsev
3f913c0c3f Rollout health checks/actions should support v0.2 and v0.2+ versions (#1543) 2019-04-30 13:17:06 -07:00
Alex Collins
31a8e07cec Adds missing section to docs (#1537) 2019-04-30 11:35:40 -07:00
Alex Collins
fc6df01b8e Fixes bug in normalizer (#1542) 2019-04-30 11:32:20 -07:00
Omer Kahani
bcefc34287 Add kustomize (#1541) 2019-04-30 08:00:15 -07:00
tom-256
e6fe4f0e05 fix typo in best practices (#1538) 2019-04-30 07:57:59 -07:00
Alexander Matyushentsev
e20e693d70 Issue 1476 - Avoid validating repository in application controller (#1535) 2019-04-29 15:04:25 -07:00
Alexander Matyushentsev
686fab7fec Issue #1414 - Load target resource using K8S if conversion fails (#1527) 2019-04-29 12:42:59 -07:00
Alex Collins
1ee6e1c7fa Documents cluster bootstrapping. Close #1481 (#1530) 2019-04-29 11:35:57 -07:00
Alex Collins
444b65ecac Update CONTRIBUTING.md (#1534) 2019-04-29 11:35:43 -07:00
Alexander Matyushentsev
a12124512e Fix flaky TestGetIngressInfo unit test (#1529) 2019-04-25 16:53:43 -07:00
Alexander Matyushentsev
e5e1308852 Issue #1476 - Add repo server grpc call timeout (#1528) 2019-04-25 16:53:05 -07:00
Alex Collins
7beae2beac Adds support for configuring repo creds at a domain/org level. Closes… (#1496) 2019-04-25 15:22:49 -07:00
Alex Collins
d9345c99e3 Fix e2e (#1526) 2019-04-25 14:53:25 -07:00
Simon Behar
d222b935e6 Whitelisting of resources (#1509)
* Added whitelisting of resources
2019-04-25 14:48:22 -07:00
Alexander Matyushentsev
8577114e2e Ingress resource might get invalid ExternalURL (#1522) (#1523) 2019-04-24 13:39:59 -07:00
Alex Collins
e3a120b1d8 codegen (#1521) 2019-04-24 13:39:07 -07:00
Alex Collins
00c12d9a25 Updated CHANGELOG.md (#1518) 2019-04-24 10:56:20 -07:00
Simon Behar
33353417df Added ability to sync specific labels from the command line (#1501)
* Finished initial implementation

* Added tests and fix a few bugs
2019-04-24 10:46:05 -07:00
Alexander Matyushentsev
b667cef4a8 Add Network View description to changelog (#1519) 2019-04-24 10:44:22 -07:00
Alexander Matyushentsev
3b71bd05a4 Issue #1411 - Document private repository configuration (#1515) 2019-04-24 10:26:07 -07:00
Alexander Matyushentsev
e75a7a5dea Update min client version and cache version to 1.0.0 (#1517) 2019-04-24 10:15:02 -07:00
Alexander Matyushentsev
5134ca37a7 Issue #1499 - Render application browsable URLs (#119) 2019-04-23 10:34:57 -07:00
Alexander Matyushentsev
60273ba84f Issue #1499 - Use ingress host information to populate application external URL (#1511) 2019-04-23 10:34:53 -07:00
Alexander Matyushentsev
ae23af7061 Issue #1507 - Selective sync is broken in UI (#118) 2019-04-22 15:33:06 -07:00
Alexander Matyushentsev
c33604f2ef v0.12.2 Change log (#1508) 2019-04-22 15:26:55 -07:00
Alexander Matyushentsev
9686a2f16b Issue #1502 - UI fails to load custom actions is resource is not deployed (#117) 2019-04-22 15:24:41 -07:00
Alex Collins
eea804b3f6 Allow empty. Close #1504 (#1506) 2019-04-22 14:07:12 -07:00
Alexander Matyushentsev
8f658108f2 Issue #1503 - Events tab title is not right if resources has no errors (#116) 2019-04-22 13:43:14 -07:00
Alex Collins
25edf8ac3f Update CHANGELOG.md (#1500) 2019-04-22 13:28:29 -07:00
Alexander Matyushentsev
3db5c36e60 Issue #1505 - Fix broken node resource panel (#115) 2019-04-22 11:49:17 -07:00
Omer Kahani
3ed6dc91dd Add riskified to organizations using ArgoCD (#1497) 2019-04-21 07:25:26 -07:00
Alex Collins
e803969442 Adds event count. Closes argoproj/argo-cd#1477 (#113) 2019-04-19 16:00:16 -07:00
Alexander Matyushentsev
5be580c105 Issue #86 - Support triggering resources custom actions (#114) 2019-04-19 14:34:09 -07:00
Alex Collins
13e5348177 Updates CHANGELOG for v1.0.0 (#1469) 2019-04-19 11:44:42 -07:00
Alexander Matyushentsev
90e44c092a Issue #86 - Custom actions bug fixing (#1494) 2019-04-19 10:27:12 -07:00
Simon Behar
8027882c1c Added --resource flag to argocd app wait (#1453) 2019-04-19 09:59:06 -07:00
Alexander Matyushentsev
ad9ed33f8d Fix flaky e2e test. Again (#1489) 2019-04-19 09:05:42 -07:00
Alex Collins
ddf5f0cf46 Introduces new RBAC permissions that are required for changing cluste… (#1440) 2019-04-19 08:54:30 -07:00
Alexander Matyushentsev
76811a992e Change loggin level in util function to Debug (#1488) 2019-04-18 11:58:30 -07:00
Alexander Matyushentsev
2eac7bf457 Issue #1476 - Fix racing condition in controller cache (#1485) 2019-04-18 08:12:18 -07:00
Alex Collins
53cbcd362d Adds a faster way to run e2e locally (#1475) 2019-04-17 10:53:37 -07:00
Alexander Matyushentsev
11c878b847 Change version to 1.0.0 (#1473) 2019-04-17 08:35:07 -07:00
Alexander Matyushentsev
25d5333894 Fix flaky e2e test (#1474) 2019-04-17 08:21:18 -07:00
Alexander Matyushentsev
a0ae6dd32f Fix JS error caused by change of unmounted React component 2019-04-16 15:28:15 -07:00
Alexander Matyushentsev
1bbd8f038b Issue #1386 - Improve notifications rendering (#112) 2019-04-16 15:27:07 -07:00
Alexander Matyushentsev
e7bde586d8 Network view external nodes (#109)
* Add load balancer nodes to network view

* Color traffic on network view
2019-04-16 15:07:24 -07:00
dthomson25
4541ca664a Initial Custom Actions Implementation (#1369) 2019-04-16 14:50:44 -07:00
Alexander Matyushentsev
97422b4148 Improve e2e tests for app with secrets (#1466) 2019-04-16 13:04:54 -07:00
Alex Collins
4df07a278d Adds label to Github issue templates (#1468) 2019-04-16 11:54:17 -07:00
Alexander Matyushentsev
efa418c58b Document steps to troubleshot cluster configuration (#1467) 2019-04-16 11:41:44 -07:00
Alexander Matyushentsev
5540c9b9aa Issue #1326 - Rollback UI is not showing correct ksonnet parameters in preview (#111) 2019-04-16 08:57:31 -07:00
Alexander Matyushentsev
be40dbc8cc Issue #1326 - Rollback UI is not showing correct ksonnet parameters in preview (#1464) 2019-04-16 08:52:48 -07:00
dthomson25
0bd7023b66 Add link to e2e testing on contributing guide (#1456) 2019-04-15 13:50:46 -07:00
Marc
db82456dde don't compare secrets, since argo-cd doesn't have access to their data (#1459) 2019-04-15 13:46:03 -07:00
Alex Collins
a51441546c more-information-needed (#1463) 2019-04-15 13:39:13 -07:00
Alex Collins
0bd323140d Docs (#1441) 2019-04-15 13:39:04 -07:00
Ryan Fernandes
ad22949925 grammar change. added an 'if' (#1465) 2019-04-15 13:19:11 -07:00
Alex Collins
0726ee8995 Fixes goroutine leak. Closes #1381 (#1457) 2019-04-15 10:50:05 -07:00
Alexander Matyushentsev
c120004084 Fix e2e test flakyness (#1462) 2019-04-15 09:55:30 -07:00
Alexander Matyushentsev
02c81851a8 Improve application list page UI (#110) 2019-04-12 15:45:30 -07:00
Alexander Matyushentsev
e15b97ee08 Document how to use helm without internet access (#1448) 2019-04-12 15:22:38 -07:00
Alexander Matyushentsev
bbc7d39928 Regenerate manifests (#1454) 2019-04-12 14:38:08 -07:00
Alexander Matyushentsev
b53c34c3f7 Generate random name for grpc proxy unix socket file instead of time stamp (#1455) 2019-04-12 14:25:01 -07:00
Alex Collins
d2928d5b31 Shows the health of the application. Closes #1433 (#1434) 2019-04-12 11:52:37 -07:00
Karsten Siemer
7e76d6de33 Overlay selector of argocd-redis-ha service (#1436)
* The selector of the argocd-redis-ha service wasn't being overlayed and the service never got to have endpoints

* Generated install.yaml and namespace-install.yaml using make manifests
2019-04-12 09:17:01 -07:00
Alexander Matyushentsev
3eac376a41 Revert "Redis mastergroup name should be resolvable and argocd-redis-ha is (#1450)" (#1452)
This reverts commit 7084e3af5c.
2019-04-12 07:44:45 -07:00
Karsten Siemer
7084e3af5c Redis mastergroup name should be resolvable and argocd-redis-ha is (#1450)
the mastergroup name of redis was set as argocd since this is not
resolvable because no service has this name, this should be
renamed to the service which selects all redis pods
2019-04-12 07:26:52 -07:00
Alexander Matyushentsev
ac3d12c746 Issue #1446 - Delete helm temp directories (#1449) 2019-04-12 05:24:38 -07:00
Jonah Back
41a3352516 Fix github reference to use mainline instead of fork (#1445) 2019-04-11 18:32:12 -07:00
Alex Collins
01dad77d44 Updates icons (#108) 2019-04-11 17:50:01 -07:00
Alexander Matyushentsev
018ce4e9f0 Fix JS error while rendering resource without health info 2019-04-11 16:06:56 -07:00
Alexander Matyushentsev
311ff8caed Issue #1389 - Fix null pointer exception in secret normalization function (#1443) 2019-04-11 11:46:42 -07:00
Alexander Matyushentsev
197bbda02e Issue #1425 - Argo CD should not delete CRDs (#1428) 2019-04-11 09:07:14 -07:00
Alexander Matyushentsev
56cd8fcc95 Fix invalid ignoreDifferences config example (#1437) 2019-04-11 07:53:56 -07:00
Alex Collins
3c4b42de75 Displays resources that are being deleted as "Progressing". Closes #1410 (#1426) 2019-04-11 07:47:59 -07:00
Arnar
0e89b744ec Query-ing basehref to redirect to the right URI on auth expiration (#107) 2019-04-10 14:16:24 -07:00
Alexander Matyushentsev
6aa12887b3 Fix linter error 2019-04-10 12:57:46 -07:00
Alexander Matyushentsev
e5d6e9a21a Fix broken icons on project details page 2019-04-10 08:16:41 -07:00
Le Van Nghia
e4b8a9d895 Added CyberAgent and OpenSaaS Studio to organizations using ArgoCD (#1427) 2019-04-10 07:59:24 -07:00
Alex Collins
76d25d3795 Perform health assessments on all resource nodes in the tree. Closes #1382 (#1422) 2019-04-09 18:15:24 -07:00
Alex Collins
97a59ca753 Enables Probot stale and no-respones plugins. Closes #1418 (#1419) 2019-04-09 17:35:44 -07:00
Alex Collins
544bd47e94 Nils health if the resource does not provide it. Closes #1383 (#1408) 2019-04-09 15:05:14 -07:00
Alexander Matyushentsev
56916a0321 Add v0.12.1 release notes (#1423) 2019-04-09 14:57:18 -07:00
Michael Goodness
eff83a45cd Add Ticketmaster to "Who uses" section of README (#1424)
Signed-off-by: Michael Goodness <mike.goodness@ticketmaster.com>
2019-04-09 14:42:04 -07:00
Alexander Matyushentsev
3f9d361d4f Issue #357 - Render external traffic node on network view (#105) 2019-04-09 14:09:57 -07:00
Alex Collins
0565dd3df1 Allows health to be null in the UI (#104) 2019-04-09 11:22:13 -07:00
Alex Collins
c8e8c2dc32 Updates in-product help (#103) 2019-04-09 11:01:28 -07:00
Alex Collins
9df1e27191 Fixes doc bugs. Closes #1395 (#1403) 2019-04-09 11:01:04 -07:00
Alexander Matyushentsev
abe25f62d0 Run 'go fmt' for application.go and server.go (#1417) 2019-04-09 09:43:53 -07:00
dthomson25
ad5d26f08a Add patch audit (#1416)
* Add auditing to patching commands

* Omit Patch Resource logs to prevent secret leaks
2019-04-09 08:57:22 -07:00
Alex Collins
9c5c420483 FontAwesome 5 fixes (#106) 2019-04-09 08:34:15 -07:00
Alexander Matyushentsev
dea731a6b2 Add networking test app (#1409) 2019-04-08 16:29:08 -07:00
Isaac Gaskin
1d19447e8e issue #1202: docs(help examples): adding template and first examples for the app command (#1398)
shameless ripoff of kubectl example templating
2019-04-08 15:47:02 -07:00
Alexander Matyushentsev
ac938c8738 Issue #1406 - Don't try deleting application resource if it already have (#1407) 2019-04-08 15:08:48 -07:00
Alex Collins
88a1c2a593 Pod health (#1365) 2019-04-08 14:49:57 -07:00
Petr Jediný
1e8db87320 Add KompiTech GmbH to organizations using Argo CD (#1402) 2019-04-08 12:45:40 -07:00
Alexander Matyushentsev
7382ebce27 Issue #1404 - App controller unnecessary set namespace to cluster level resources (#1405) 2019-04-08 12:02:06 -07:00
Alexander Matyushentsev
911425c1c1 Move applicatoin Refresh button to action buttons on Application Details page 2019-04-08 09:58:35 -07:00
Alex Collins
9988b3d8e6 Mkdocs2 (#1393) 2019-04-08 09:20:36 -07:00
Alexander Matyushentsev
3d0f85c188 Issue #1217 - Improve form input usability 2019-04-08 09:01:18 -07:00
Jesse Suen
6b69449175 Add OpenAPI validation in CRD schema (#1256) 2019-04-06 17:18:00 -07:00
dthomson25
85a5fb5a41 Allow wait to return on health or suspended (#1392) 2019-04-06 10:31:07 -06:00
Alex Collins
f5bc901dd7 Create docs website (#1387) Closes #1390 2019-04-05 15:12:27 -07:00
Alexander Matyushentsev
ba43a01669 Issue #1354 - [UI] default view should resource view instead of diff view 2019-04-05 15:05:40 -07:00
Alexander Matyushentsev
f5833da4cd Issue #1368 - [UI] applications view blows up when user does not have permissions 2019-04-05 15:05:02 -07:00
Alexander Matyushentsev
67882a9dff Fix broken icons on Help page 2019-04-05 13:11:59 -07:00
Alexander Matyushentsev
c03bd896d8 Issue #1357 - Dropdown menu should not have sync item for unmanaged resources 2019-04-05 11:25:27 -07:00
Alexander Matyushentsev
8ee3c93c84 Upgrade font-awesome to v5 2019-04-05 10:06:26 -07:00
Alex Collins
4ac062d09e Removes componentParameterOverrides. Closes #1372 (#1378) 2019-04-05 08:26:37 -07:00
Alexander Matyushentsev
159a30fdc7 Support tab deep linking on app details page (#102) 2019-04-05 08:26:35 -07:00
Marcin Jasion
a15ca7259c Fix project.yaml link in README.md (#1384) 2019-04-05 07:34:52 -07:00
brushmate
d4ee7972ca Add Yieldlab to organzations using Argo CD (#1385) 2019-04-05 07:34:09 -07:00
Alexander Matyushentsev
56ca350ed2 Support obsolete extensions in UI 2019-04-04 18:04:44 -07:00
Alexander Matyushentsev
86f6b657e2 Issue #1374 - Add k8s objects circular dependency protection to getApp method (#1379) 2019-04-04 17:52:30 -07:00
Alexander Matyushentsev
ac7906fdea Issue #1366 - Fix null pointer dereference error in 'argocd app wait' (#1380) 2019-04-04 17:49:34 -07:00
Alexander Matyushentsev
781a9ab627 Regenerate yarn.lock file 2019-04-04 17:38:06 -07:00
Alex Collins
d0ecaed401 Ui enhancements (#100) 2019-04-04 11:27:07 -07:00
dthomson25
4d494f3a1b Magically increase the code coverage!!! (#1370) 2019-04-04 10:06:10 -06:00
Alexander Matyushentsev
57ff5b25e4 Issue #1012 - kubectl v1.13 fails to convert extensions/NetworkPolicy (#1360) 2019-04-04 08:30:35 -07:00
Jesse Suen
28fa4a7571 MAGA: Make ArgoCD Golang Again! (#1279) 2019-04-04 02:35:13 -07:00
Alex Collins
723228598e Adds images to resource tree (#1351) 2019-04-03 15:11:48 -07:00
Alexander Matyushentsev
f28d11bf90 Issue #908 - Surface Service/Ingress external IPs, hostname to application (#99) 2019-04-03 12:04:18 -07:00
Arnar
7091585dbe Changing SSO login URL to be a relative link so it's affected by basehref (#101) 2019-04-03 12:03:34 -07:00
Alexander Matyushentsev
790cdd1d45 Add 'Who uses Argo CD?' section (#1361) 2019-04-02 22:27:54 -07:00
Tom Wieczorek
81e21a551d Add mapping to new canonical Ingress API group (#1348)
Since Kubernetes 1.14, Ingress resources are only available via networking.k8s.io/v1beta1.
2019-04-02 21:25:09 -07:00
dthomson25
7cf3f6cd19 Fix Failing Linter (#1350) 2019-04-02 17:39:04 -06:00
Alexander Matyushentsev
506d95da10 Issue #1294 - CLI diff should take into account resource customizations (#1337)
* Issue #1294 - CLI diff should take into account resource customizations

* Apply reviewer notes: add comments to type definition and e2e test
2019-04-02 13:59:55 -07:00
Alexander Matyushentsev
36b4683e84 Issue #908 - Surface Service/Ingress external IPs, hostname to application (#1347) 2019-04-02 08:48:34 -07:00
Noah Kantrowitz
2becacd48d Copy-paste error: clusterResourceWhitelist -> namespaceResourceBlacklist (#1343)
Same fix as #1312 but in another file.
2019-04-01 09:17:09 -07:00
Alex Collins
ae41425c77 gotestsum (#1341) 2019-03-30 22:14:35 -07:00
Alexander Matyushentsev
59837cb513 Issue #1218 - Allow using any name for secrets which store cluster credentials (#1336) 2019-03-29 22:09:36 -07:00
Alexander Matyushentsev
66e5d51329 Issue #733 - 'argocd app wait' should fail sooner if app transitioned to (#1339)
Issue #733 - 'argocd app wait' should fail sooner if app transitioned to Degraded state
2019-03-29 21:00:50 -07:00
Alexander Matyushentsev
8d55e72dfa Issue #357 - Implement networking view (#98) 2019-03-29 20:59:50 -07:00
Alexander Matyushentsev
15dfa79708 Issue #357 - Expose application nodes networking information (#1333) 2019-03-29 20:59:25 -07:00
Alexander Matyushentsev
896d46525e Don't run lint after running codegen (#1338) 2019-03-29 13:27:22 -07:00
Daniel van den Berg
a8b70b411c Declarative setup doc update (#1334)
This change updates the documentation around declarative setups. The
docs did not explicitly distinguish between adding an HTTPS repository
or an SSH repository, and this PR clarifies that.
2019-03-29 08:13:32 -07:00
Alex Collins
cd25c4b3c9 Enables default lint checks, fixes lint and bugs (#1330) 2019-03-28 13:37:53 -07:00
Alex Collins
b28d8361f5 Adds "make build" target, and running lint,build,test (#1331) 2019-03-28 11:20:51 -07:00
Jesse Suen
b40ba175a3 Update argocd-util import/export to support proper backup and restore (#1328) 2019-03-27 17:05:59 -07:00
Alex Collins
cd87a1436b Support overriding image name/tag in for Kustomize 2 apps (#97) 2019-03-27 12:54:30 -07:00
Alex Collins
dfa91d87cf Adds support for kustomize edit set image. Closes #1275 (#1324) 2019-03-27 12:54:23 -07:00
Alex Collins
102c24cc29 Fixs deps (#1325) 2019-03-26 15:35:32 -07:00
Alex Collins
7d3b6cc8e0 Force color logging locally (#1316) 2019-03-26 13:59:03 -07:00
Alexander Matyushentsev
9ef7064cc4 Use paused field in rollout health check (#1321) 2019-03-26 11:07:06 -07:00
Alexander Matyushentsev
56f0ff204e Issue #1319 - Fix invalid group filtering in 'patch-resource' command (#1320) 2019-03-26 08:01:35 -07:00
Alexander Matyushentsev
af896533df Issue #1135 - Run e2e tests in throw-away kubernetes cluster (#1318)
* Issue #1135 - Run e2e tests in throw-away kubernetes cluster
2019-03-24 07:35:57 -07:00
Jesse Suen
aa099f3fc0 Update CHANGELOG.md for v0.12 release (#1317) 2019-03-22 21:02:20 -07:00
Alexander Matyushentsev
27b23f6a00 Issue #1310 - application table view needs to be sorted 2019-03-22 13:59:09 -07:00
Jesse Suen
e07a877e73 Use Recreate deployment strategy for controller (#1315) 2019-03-22 11:50:15 -07:00
Jesse Suen
1f675f4bb9 Fix goroutine leak in RetryUntilSucceed (#1314) 2019-03-22 11:50:00 -07:00
Jesse Suen
e482d74d19 Support a separate OAuth2 CLI clientID different from server (#1307) 2019-03-22 03:23:51 -07:00
Tom Wieczorek
50bff3e540 Copy-paste error: clusterResourceWhitelist -> namespaceResourceBlacklist (#1312) 2019-03-22 02:35:39 -07:00
Andre Krueger
0d7c42ba54 Honor os environment variables for helm commands (#1306) 2019-03-21 16:51:04 -07:00
Alexander Matyushentsev
ec7cbf8e15 Issue #1308 - argo diff --local fails if live object does not exist (#1309) 2019-03-21 15:32:44 -07:00
Alexander Matyushentsev
d60fb2b449 Unavailable cache should not prevent reconciling/syncing application (#1303) 2019-03-20 14:02:54 -07:00
Jesse Suen
dc989dbebc Update redis-ha chart to resolve redis failover issues (#1301) 2019-03-20 12:06:18 -07:00
Marc
09164cae6c only print to stdout, if there is a diff + exit code (#1288) 2019-03-19 18:58:52 -07:00
Alexander Matyushentsev
80f0f779db Fix sample dashboard link in metrics doc (#1299) 2019-03-19 14:26:26 -07:00
Alexander Matyushentsev
c605e892b6 Issue #1258 - Disable CGO_ENABLED for server/controller binaries (#1286) 2019-03-19 14:25:19 -07:00
Alexander Matyushentsev
80fe3e1877 Controller don't stop running watches on cluster resync (#1298) 2019-03-19 13:25:01 -07:00
Jesse Suen
8f7a7ef6a4 Update dashboard to have controller/repo-server stats. Collapsible rows (#1295) 2019-03-19 10:41:51 -07:00
hartman17
2aad4d0ab5 Sample Grafana dashboard (#1277) 2019-03-19 01:12:21 -07:00
Alexander Matyushentsev
df7b0c6682 Issue #1290 - Fix concurrent read/write error in state cache (#1293) 2019-03-18 23:38:10 -07:00
Jesse Suen
ea1519de82 Fix a goroutine leak in api-server application.PodLogs and application.Watch (#1292) 2019-03-18 21:50:11 -07:00
Alexander Matyushentsev
b60067af97 Issue #1287 - Fix local diff of non-namespaced resources. Also handle duplicates in local diff (#1289) 2019-03-18 21:19:08 -07:00
Alexander Matyushentsev
3540859074 Use application/strategic-patch+json patch to update resources 2019-03-18 15:07:08 -07:00
Jesse Suen
22ddd53ea5 Fix isssue where argocd app set -p required repo privileges. (#1280)
Grant patch privileges to argocd-server
2019-03-18 14:39:32 -07:00
Alexander Matyushentsev
1b41aba841 Issue #1282 - Prevent filering out application node on Applicatoin details page 2019-03-18 14:27:27 -07:00
Alexander Matyushentsev
cafe24da86 Issue #1070 - Handle duplicated resource definitions (#1284) 2019-03-18 13:21:03 -07:00
Yann Soubeyrand
c33acf749c Fix documentation on diffing customization (#1285) 2019-03-18 13:20:44 -07:00
Jesse Suen
dab3b688f0 Add golang prometheus metrics to controller and repo-server (#1281) 2019-03-18 11:32:20 -07:00
dthomson25
a34d2c750b Add note about Kustomize1 (#1263) 2019-03-17 22:25:20 -07:00
Jesse Suen
5210c678b9 Git cloning via SSH was not verifying host public key (#1276) 2019-03-15 14:29:10 -07:00
Alexander Matyushentsev
baf157901c Rename Application observedAt to reconciledAt and use observedAt to notify about partial app refresh (#1270) 2019-03-14 16:42:36 -07:00
Alexander Matyushentsev
e457dd6f6c Bug fix: set 'Version' field while saving application resources tree (#1268) 2019-03-14 15:52:50 -07:00
Alexander Matyushentsev
f787828712 Chunk file name should include content hash 2019-03-14 15:08:40 -07:00
Alexander Matyushentsev
2724aeef32 Avoid doing full reconciliation unless application 'managed' resource has changed (#1267) 2019-03-14 14:54:34 -07:00
Jesse Suen
1d3ec93ec7 Support kustomize apps with remote bases in private repos in the same host (#1264) 2019-03-14 14:25:05 -07:00
Alexander Matyushentsev
471dac48be Issue #1261 - UI loads helm parameters without taking into account selected values files 2019-03-12 11:46:20 -07:00
Omer Kahani
fea3899f26 Fix project.yaml link location (#1257) 2019-03-12 10:38:22 -07:00
Alex Collins
f016acdade Enable debug logging for local development (#1260)
* Enable debug logging for local development

* Update Procfile
2019-03-12 10:31:51 -07:00
Alex Collins
0c4d5009a2 Tweak lint (#1259) 2019-03-12 10:31:35 -07:00
Alexander Matyushentsev
815ba879e6 Issue #1252 - Application controller incorrectly build application objects tree (#1253) 2019-03-11 11:31:46 -07:00
Alexander Matyushentsev
3df86a7918 Issue #1247 - Fix CRD creation/deletion handling (#1249) 2019-03-11 08:50:00 -07:00
Alexander Matyushentsev
2675367400 Live manifest state tab should always load latest manifest from target cluster 2019-03-11 00:06:56 -07:00
Alex Collins
5e7b48c9a2 Migrates from gometalinter to golangci-lint. Closes #1225 (#1226) 2019-03-08 16:22:04 -08:00
Jesse Suen
0f248e9149 Replace git fetch implementation with git CLI (from go-git) (#1244) 2019-03-08 14:08:02 -08:00
Alexander Matyushentsev
461d8c980f Fix nil pointer dereference in CompareAppState (#1234) (#1240) 2019-03-07 19:24:47 -08:00
Alexander Matyushentsev
f120c1dedb Fix autocomlete dropdown scrolling 2019-03-07 16:37:44 -08:00
Alexander Matyushentsev
a54dc192d7 Issue #1058 - Allows you to set sync-policy when you create an app 2019-03-07 12:07:06 -08:00
Alexander Matyushentsev
0850db530f Issue #1236 - project field in 'create application' dialog is confusing 2019-03-07 11:26:15 -08:00
Alexander Matyushentsev
0a1a579714 Enable autocomplete suggestions filtering only on application list page 2019-03-06 15:22:26 -08:00
Alexander Matyushentsev
9a7fecef06 Issue #1231 - Deprecated resource kinds from 'extensions' groups are not reconciled correctly (#1232) 2019-03-06 01:42:26 -08:00
Alexander Matyushentsev
39c63371bf Update link to config management plugins in custom_tools.md (#1228) 2019-03-06 01:16:19 -08:00
Jesse Suen
80b0e1138c Update documentation for v0.12.0 (#1227)
* Sort kustomize params in GetAppDetails
2019-03-06 00:09:01 -08:00
Alexander Matyushentsev
3acc0b3af2 Issue #1229 - App creation failed for public repository (#1230) 2019-03-06 00:02:27 -08:00
Alexander Matyushentsev
af3a766304 Fix rendering revision history parameters 2019-03-05 15:57:22 -08:00
Alexander Matyushentsev
d7b1ffd014 Issue #1141 - Deprecate ComponentParameterOverrides in favor of source specific config 2019-03-05 15:24:58 -08:00
Jesse Suen
39174ab969 Move parameters listing from GenerateManifests to GetAppDetails (#1221)
* Move parameters listing from GenerateManifests to GetAppDetails
* Fix logging to use standard logger to honor CLI loglevel
2019-03-05 14:56:47 -08:00
Alexander Matyushentsev
0578b6cf36 Issue 1065 - The '--grpc-web' flag is ignored by login command (#1215) 2019-03-04 11:40:59 -08:00
Alexander Matyushentsev
0a6028e116 Issue #1122 - Autosuggest should expand to the top is there is not enough space to expand bottom 2019-03-04 11:33:36 -08:00
Alexander Matyushentsev
61173d7e70 Recalculate autocomplete menu position on scroll 2019-03-04 09:21:05 -08:00
Alexander Matyushentsev
3ae30c9028 Pre-populate sample app values when user create the first app 2019-03-04 09:20:20 -08:00
Jesse Suen
cc7b283f23 Deprecate componentParameterOverrides in favor of source specific config (#1207)
* Deprecate componentParameterOverrides in favor of source specific config
* Support rollback when application source changes
* Removes the legacy spec.source.environment and spec.source.valuesFiles which were deprecated in v0.11
* Fix issue where argocd app create APPNAME --file didn't fail when there were name conflicts
* Fix issue where auto-sync and app deletion would cause infighting
2019-03-04 00:56:36 -08:00
Jesse Suen
4adca869c8 Support talking to Dex using local cluster address instead of public address (#1211) 2019-03-03 23:46:19 -08:00
Alexander Matyushentsev
fa62cdf127 Fix showing edit button on resource yaml editor panel 2019-03-03 23:34:30 -08:00
Alexander Matyushentsev
80af8ce93c Issue #701 - Add config management plugins documentation (#1175)
* Issue #701 - Add config management plugins documentation
2019-03-03 23:19:09 -08:00
Alexander Matyushentsev
c90b020a83 Issue #1065 - Correctly read chunked http response in GRPC proxy (#1214) 2019-03-03 22:36:04 -08:00
dthomson25
052bd6808b Fix broken test for rollout health lua (#1213) 2019-03-03 20:26:19 -08:00
Alexander Matyushentsev
d715ac9e53 Issue #1176 - UI should support raw YAML editor when creating/updating an app 2019-03-02 21:59:22 -08:00
Alexander Matyushentsev
87507d50c6 Issue #1161 - no need to maintain map of existing CRDs since it is handled by resourceVersion usage (#1194) 2019-03-01 12:09:47 -08:00
Jesse Suen
058d32ec0b Fix issue where CLI would panic after timeout when cli did not have get permissions (#1209) 2019-03-01 12:06:30 -08:00
dthomson25
e830f5d4e7 Add Suspended status to Rollout health script (#1203) 2019-03-01 10:54:57 -08:00
dthomson25
a848090014 Add cli command to patch resources (#1200) 2019-02-28 14:43:38 -08:00
Jesse Suen
ecb2601164 Include resource, action, object in permission denied errors (#1188) 2019-02-28 13:11:47 -08:00
Alex Collins
31e801425f Lints local imports. Closes #1197 (#1198) 2019-02-27 18:05:55 -08:00
Jesse Suen
d386e24df4 Rename excludedResources config key to resource.exclusions. Support hot reload (#1189) 2019-02-27 16:44:17 -08:00
Alex Collins
8fa0d9c4fc Corrects lint error 2019-02-27 16:34:42 -08:00
dthomson25
5d2304b18f Add support for suspended status (#94) 2019-02-27 14:36:33 -08:00
dthomson25
a9d352efb2 Add suspended status (#1187) 2019-02-27 14:36:25 -08:00
Alexander Matyushentsev
a886a58421 Issue #1176 - support editing raw application spec YAML 2019-02-27 14:08:23 -08:00
Alex Collins
2f5549e0c8 Allows you to set sync-policy when you create an app. Closes #1058 (#93) 2019-02-27 13:03:42 -08:00
Alexander Matyushentsev
80fb0c90ea 'argocd app diff --local' is broken if application.instanceLabelKey setting is not configured (#1191) 2019-02-27 00:38:12 -08:00
Alexander Matyushentsev
f3172d6727 Issue #1161 - Update resource version on every watch event (#1192) 2019-02-26 23:24:30 -08:00
Jesse Suen
af0f6e578b Introduce prometheus histogram for app reconcile performance (#1184) 2019-02-26 23:09:46 -08:00
Alexander Matyushentsev
915514e37b Support editing resource manifests on application details page 2019-02-26 22:23:33 -08:00
Alexander Matyushentsev
863e66ecde Support patching resource using REST API (#1186) 2019-02-26 15:57:47 -08:00
Alex Collins
0b07ce6d79 Makes the fields of excluded resources optional. Closes #1183 (#1185) 2019-02-26 14:39:49 -08:00
Alexander Matyushentsev
e776d64b6f Fix 'details' menu item on application details page 2019-02-26 13:15:14 -08:00
Alexander Matyushentsev
d3c41395bc Fix double bottom border in form fields 2019-02-26 11:58:18 -08:00
Alexander Matyushentsev
7cc55c078f Fix React warning which happens on App list page after app creation 2019-02-26 11:51:35 -08:00
Alex Collins
02319bcfd7 Adds support for Jsonnet External Variables and Top-Level Arguments. … (#1165) 2019-02-26 11:50:13 -08:00
Alexander Matyushentsev
a1edbb5972 Issue #1086 - Switch to text based YAML diff instead of json diff 2019-02-26 11:29:47 -08:00
Jesse Suen
6654601bb1 Switch to kustomize v2.0.2 (from v2.0.1) (#1178) 2019-02-26 09:34:01 -08:00
Alexander Matyushentsev
6fe6a603d7 Upgrade react; use argo-ui from git instead of npm 2019-02-26 08:05:34 -08:00
narg95
caacba907c invalidate repo cache on delete (#1182)
Signed-off-by: Nestor <nesterran@gmail.com>
2019-02-26 07:12:29 -08:00
Alexander Matyushentsev
2f62d1b763 Issue #1161 - Use correct resource version in K8S watch API calls to avoid lost update events (#1173) 2019-02-26 07:09:14 -08:00
Takahiro Tsuruda
ee617d13d5 Fix typo to link from readme (#1179) 2019-02-26 00:53:28 -08:00
Alex Collins
03e0076eec Make test more tolerant (#1177) 2019-02-25 20:46:10 -08:00
Jesse Suen
33953954a2 Switch to kustomize2 as default. Add argocd-ha install manifests (#1169) 2019-02-25 15:25:57 -08:00
Alexander Matyushentsev
2a9a9884cf Issue #1152 - Render cluster name in application wizard 2019-02-25 15:03:57 -08:00
Alex Collins
e0594aa9b5 Adds support for patching applications. Closes #1162 (#1166) 2019-02-25 14:25:25 -08:00
Alexander Matyushentsev
99bb3cff43 Issue #701 - Rename config management pluging command 'template' to 'generate' (#1174) 2019-02-25 14:13:28 -08:00
Jesse Suen
8295a5cc6b Fix reconcile hotloop due to incorrect app source equality check (#1170) 2019-02-25 10:51:24 -08:00
Liviu Costea
f704cd07e6 Use kubernetes recommended labels (#1168)
The recommended labels are the ones described here:
https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/
The manifests labels should be in sync with the helm chart
Also this is a follow up after the discussion from:
https://github.com/argoproj/argo-cd/pull/1035
2019-02-24 01:42:23 -08:00
Alexander Matyushentsev
d2df9dbdfb Let config management plugin inherit system env variables (#1163) 2019-02-22 15:23:39 -08:00
Jesse Suen
eb431308de Add application sync counters as new prometheus metric. Add API-server metrics (#1156) 2019-02-22 15:20:34 -08:00
Alexander Matyushentsev
418676ffab Issue #701 - Support for custom templaters (#1151)
* Issue #701 - Support for custom templaters
2019-02-22 14:56:11 -08:00
Alexander Matyushentsev
87b327f52d Issue #1075 - Ability to selectively ignore differences to support fuzzy diff comparisons (#1130)
* Issue #1075 - Ability to selectively ignore differences to support fuzzy diff comparisons
2019-02-22 13:19:10 -08:00
Jesse Suen
21be93548c Fix issue where argocd app diff reversed the left/right comparison (#1158) 2019-02-22 11:43:23 -08:00
Jesse Suen
c2a000c605 Fix issue where YAML file did not split correctly when encoded in UTF-16 (#1155) 2019-02-22 11:42:50 -08:00
Alexander Matyushentsev
a5fedca016 Fix application node selection 2019-02-22 08:56:01 -08:00
Alexander Matyushentsev
98caad1ff7 Issue #1160 - Deleting an application child resource from a parent application deletes the parent 2019-02-22 08:45:31 -08:00
Alexander Matyushentsev
b38485e169 Allow user configure table page size 2019-02-21 15:48:25 -08:00
Alexander Matyushentsev
943f3364e1 Document custom health checks and diffing customization (#1140) 2019-02-21 09:40:50 -08:00
Alex Collins
06c55b348a Allows you to exclude resources based on API group, kind, and cluster. Fixes #1010 (#1147) 2019-02-21 08:30:13 -08:00
Alex Collins
c630e19d0d Display a warning if the JWT cookie is too large. Fixes #1103 (#1146)
* Display a warning if the JWT cookie is too large. Fixes #1103

* Removes double message
2019-02-21 08:27:18 -08:00
Alex Collins
5222d47b5d Adds some instructions on how to run images locally. (#1121) 2019-02-20 14:19:07 -08:00
Alexander Matyushentsev
b92e0a6d0f UI fails to update application which has spec errors and not reconciled by app controller 2019-02-20 12:47:17 -08:00
Alexander Matyushentsev
8b366ed5c2 Application details page fails if application have been reconciled by app controller 2019-02-20 12:39:39 -08:00
Alex Collins
1c1d9c95ef Adds support for Kustomize 2.0.1. Fixes #1085 (#1138) 2019-02-19 10:31:52 -08:00
Jesse Suen
7d21318c64 Update CHANGELOG.md for v0.11.2 (#1144) 2019-02-19 10:00:55 -08:00
Lev Aminov
1770fb250b Switch to correct Redis port (#1143) 2019-02-19 09:23:05 -08:00
Asier Marruedo
d555245fd5 Fix EncodeX509KeyPair function so it takes in account chained certificates (#1137) 2019-02-19 01:18:59 -08:00
Alexander Matyushentsev
665b80c048 Issue #1132 - Interactive application/project edit (#1133) 2019-02-15 14:59:52 -08:00
Alexander Matyushentsev
ce6ee88721 Issue #911 - Implement cert-manager CRD health checks (#1139) 2019-02-15 14:51:13 -08:00
Stuart Harris
8d5c15b8f4 Add service manifest for redis (#1134)
* add service manifest for redis
2019-02-15 11:02:04 -08:00
Alexander Matyushentsev
ecfb009f66 Disable authentication in dev setup (#1136) 2019-02-15 09:16:33 -08:00
Alexander Matyushentsev
7b1bf35b8c Don't show directory app parameters for kustomize apps (#92) 2019-02-15 09:13:54 -08:00
Alex Collins
cbe862765f Adds support for ARGOCD_OPTS envvar for global variables. Fixes #1081 (#1131) 2019-02-14 15:04:06 -08:00
Jesse Suen
173bf63617 Exclude metrics.k8s.io from watch (#1128) 2019-02-14 13:40:01 -08:00
Ed Lee
15ef5b425f added community blog to readme (#1129) 2019-02-14 09:42:00 -08:00
Alexander Matyushentsev
d2ca6715c6 Issue #1087 - Exclude hooks from local diff (#1123) 2019-02-13 21:04:38 -08:00
Jesse Suen
19906ded5b Fix issue where dex restart could cause login failures (#1114) 2019-02-13 18:07:47 -08:00
Alex Collins
4283b8ad0d Adds client retry. Fixes #959 (#1119) 2019-02-13 15:32:07 -08:00
Alexander Matyushentsev
cb9eb0a9bb Issue #937 - Use redis as a shared throwaway cache (#1120) 2019-02-13 15:20:40 -08:00
Jesse Suen
3e4e4f30ec Prevent deletion hotloop. Improve reconciliation log for easier log queries (#1115) 2019-02-13 10:11:01 -08:00
Jesse Suen
bc32e7472f Revert broken fix for azure repos which broke private repositories (#1108) 2019-02-13 10:10:04 -08:00
Jesse Suen
70b0194218 Nil out application sources if source spec is equal to their zero value (#1109)
Fix ability to set directory-recurse=false from CLI
2019-02-12 23:40:18 -08:00
dthomson25
b1edc18faa Stop logging /cluster.ClusterService/Create (#1069)
* Stop logging /cluster.ClusterService/Create and other places
2019-02-11 17:12:00 -08:00
Alexander Matyushentsev
b5e733d29b Issue #1076 - support wildcard globs for project sources & destinations (#1106) 2019-02-11 15:14:08 -08:00
Alex Collins
c631589306 Directory recurse (#90)
* Adds support for viewing and editing directory recurse

* Adds support for creating apps using directory recurse

* Adds details of pre-commit checks

* Removed redundant file

* Removed redundant file

* Removes unused field

* Renames CheckboxInputField to CheckboxField

* Renames directory to just "checkbox"

* Updates to use CheckboxField
2019-02-11 13:58:21 -08:00
Alex Collins
c6dd3727fb Added a recurse option for directories. Fixes 1083 (#1096)
* Added a recurse option for directorys. Fixes 1083

* Linting

* Makes manifests minimally valid

* Adds tests for VerifyOneSourceType

* Adds recurse field to ManifestRequest

* Fixes spelling

* Adds --directory-recurse option to local diff

* Adds omitempty to recurse flag

* Uses paths to join path

* Use filepath.Walk

* Supports --directory-recurse when adding/setting apps from the CLI

* Fixes problem with recurse

* Updates API to surface directory.recurse

* Nil directory if recurse is false
2019-02-11 13:56:30 -08:00
Lev Aminov
802da56e14 Fix rollback command help (#1104) 2019-02-11 11:08:29 -08:00
Alex Collins
eeed50e6c0 Update CONTRIBUTING.md (#1098)
* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md
2019-02-11 10:38:43 -08:00
Alexander Matyushentsev
138233e97d Issue #929 - Add indicator to app resources tree if resources are filtered 2019-02-11 09:40:08 -08:00
Alexander Matyushentsev
f09e213202 Issue #1101 - Add menu to resource list table (#91) 2019-02-11 08:42:13 -08:00
Alexander Matyushentsev
960a51853e Fix broken prod build 2019-02-11 07:32:26 -08:00
Jecho
bc38c06f37 fixed minor typo in docs (#1102) 2019-02-08 17:15:33 -08:00
Alexander Matyushentsev
906ac8f987 Add list view to application details page 2019-02-08 15:10:37 -08:00
Alexander Matyushentsev
6bd8dea088 Handle invalid/obsolete applications list filters in user preferences 2019-02-07 14:02:24 -08:00
Alexander Matyushentsev
9f1a1f0f5e Add summary view to applications list page 2019-02-07 13:13:41 -08:00
Alexander Matyushentsev
c49e8da3d6 Mention brew tap argoproj/tap in getting started (#1097) 2019-02-07 11:25:38 -08:00
Alexander Matyushentsev
c4952fe81e Add 'x' to search bar on applications list page 2019-02-07 10:05:00 -08:00
Alexander Matyushentsev
abad42fcd5 Add search functionality to applications list page 2019-02-07 09:54:29 -08:00
Alexander Matyushentsev
fc87fa0630 Fix cluster filtering 2019-02-06 23:19:45 -08:00
Alexander Matyushentsev
59c5c6276d Delete tags-editor component 2019-02-06 22:39:01 -08:00
Alexander Matyushentsev
9d81e923b9 Impement cluster/networks filtering on Applications list page 2019-02-06 22:15:40 -08:00
Alexander Matyushentsev
4d402c1223 Issue #1055 - Render sync/health status filter checkboxes even if there are not apps in that status 2019-02-05 13:44:46 -08:00
Alexander Matyushentsev
ce18509697 Issue #279 - improve empty state design 2019-02-05 08:12:59 -08:00
Alexander Matyushentsev
e9990767fa Minor applications view improvements 2019-02-04 22:35:40 -08:00
Alexander Matyushentsev
cf4896bb3a Issue #1061 - Implement table view mode on applications list page 2019-02-04 18:49:01 -08:00
Alexander Matyushentsev
adcac7f7b4 Issue #1055 - Implement applications list view filtering 2019-02-04 17:32:36 -08:00
Jesse Suen
b2b5eea343 Add security docs and how to build custom repo-server from Dockerfile (#1078) 2019-02-02 01:42:48 -08:00
Alexander Matyushentsev
e68fe35a55 Issue #1065 - Support using grpc-web in argocd cli (#1077) 2019-02-01 13:37:39 -08:00
Jesse Suen
297a91fde4 Refactor packr box usage into new assets library. Add faster DEV_IMAGE build (#1073) 2019-02-01 13:12:52 -08:00
Michael Goodness
d6c88cd77a Split manifests into components (#1035) 2019-01-31 12:54:46 -08:00
Danny Thomson
00421bb46e Add custom resource health through lua 2019-01-31 11:46:09 -08:00
Jesse Suen
cefa9d9ba4 Switch to CLI git fetch from go-git to support fetching Azure DevOps repos (#1071) 2019-01-31 01:02:22 -08:00
Danny Thomson
1295d71988 Add Rollout resource progress to cli 2019-01-29 11:57:49 -08:00
Danny Thomson
204428cf0a Add Patch resource to API server 2019-01-29 11:57:49 -08:00
Alexander Matyushentsev
4bcef1bc67 Issue #1061 - Fix JS crash during app creation 2019-01-24 22:51:15 -08:00
Alexander Matyushentsev
f205c1380f Document v0.11.1 changes (#1049) 2019-01-24 15:39:10 -08:00
Jesse Suen
8875ebc9f8 Enable docker buildkit in ci builds (#1060) 2019-01-24 15:34:45 -08:00
Jesse Suen
ccbf80312e Relax ingress/service health check to accept non-empty ingress list (#1053) 2019-01-22 16:40:26 -08:00
Alexander Matyushentsev
b1b5ce211e Update project LICENSE 2019-01-22 08:44:47 -08:00
Alexander Matyushentsev
838d77050b Fix test compile error (#1052) 2019-01-18 15:15:56 -08:00
Jesse Suen
711e271583 Handle case where manifests contain a null items list (#1051) 2019-01-18 15:04:52 -08:00
Jesse Suen
d40bbb23cb Fix controller deadlock when checking for stale cache (#1046)
* Controller cache was susceptible to clock skew in managed cluster

* Fix controller deadlock when checking for stale cache
2019-01-18 10:38:51 -08:00
Jesse Suen
130a5ee0d9 Controller cache was susceptible to clock skew in managed cluster (#1043) 2019-01-18 10:38:21 -08:00
Alexander Matyushentsev
074c812592 Fix sync operation sorting (#1042) 2019-01-18 07:32:50 -08:00
Jesse Suen
ea428eb722 Fix ability to unset ApplicationSource specific parameters (#1041) 2019-01-17 19:38:35 -08:00
Alexander Matyushentsev
8da5fd9bb7 Issue #1039 - Correct redirect to login page if dex authentication is not successful (#1040) 2019-01-17 18:42:57 -08:00
Alexander Matyushentsev
150c69bb1d Correctly handle empty response from repository/<repo>/apps API 2019-01-17 16:12:26 -08:00
Alexander Matyushentsev
cf486a480e Hooks result should have Running phase by default (given we don't have Pending state) (#1037) 2019-01-17 13:15:48 -08:00
Alexander Matyushentsev
6006254716 Issue #1036 - Fix rendering resources state without status 2019-01-17 11:37:04 -08:00
Alexander Matyushentsev
a36af99dcd Issue #1033 - Fix force resource delete API (#1034) 2019-01-17 10:36:18 -08:00
Jesse Suen
421e4ff058 Fix PermissionDenied issue during app creation with project roles. Fix custom casbin adapter (#1030) 2019-01-17 10:30:31 -08:00
Alexander Matyushentsev
2658cdfa5d Issue #1032 - fix JS error during editing helm app without value files 2019-01-17 09:02:03 -08:00
Alexander Matyushentsev
4140c9867d Replace grpc repo-server parallelism limit interceptor with semaphore (#1029) 2019-01-16 15:56:26 -08:00
Jesse Suen
2988cebaa9 Downgrade kubectl to v1.12 to regain kubectl convert functionality (#1023) 2019-01-16 11:44:33 -08:00
Alexander Matyushentsev
6a4d84d42c Issue #1025 - Fix /v1/applications/<appName>/manifests for app with helm depencencies (#1026) 2019-01-16 11:30:42 -08:00
Alexander Matyushentsev
eb79239e6e Issue #1028 - Resource details 'blink' when resource changes 2019-01-16 09:58:55 -08:00
Alexander Matyushentsev
5c0c5a8446 Issue #1027 - UI should render page title to simplify navigation 2019-01-16 09:53:27 -08:00
Alexander Matyushentsev
07effbd950 Issue #937 - Allow using redis as a cache in repo-server (#1020)
* Issue #937 - Allow using redis as a cache in repo-server

* Support repo server grpc methods throttling

* Upgrade redis
2019-01-16 09:12:48 -08:00
Christopher Adigun
4e36713c8b Correct "basehref " in the sample UI base path (#1024)
The UI path example in the yaml should be "- --basehref" instead of - --base-href in the ingress documentation.
2019-01-16 07:59:49 -08:00
Jesse Suen
2939907c48 Do not allow metadata.creationTimestamp to affect sync status (#1021) 2019-01-15 22:51:46 -08:00
Jesse Suen
0b64a813da Switch to a custom casbin adapter for rbac enforcment (#1022) 2019-01-15 22:50:50 -08:00
Jesse Suen
5f06be724c Graceful handling of clusters where API resource discovery is partially successful (#1018) 2019-01-15 10:22:38 -08:00
Alexander Matyushentsev
2200a27a5f Issue #1013 - handle k8s resources circular dependency (#1016) 2019-01-15 03:24:28 -08:00
Ed Lee
4e2700b5d4 Update README (#1014) 2019-01-15 00:02:02 -08:00
Jesse Suen
e56d3a0412 Fix app diff --local command (#1008) 2019-01-14 23:38:54 -08:00
Saradhi Sreegiriraju
1996d191c0 Update parameters.md (#1007) 2019-01-12 15:50:38 -08:00
Jesse Suen
bf5cf3256f Update CHANGELOG, docs to use stable tag, and tweak getting started guide (#1005) 2019-01-10 20:56:04 -08:00
Jesse Suen
f732e23488 Moving apps between projects requires create/update in new project (#1002) 2019-01-10 11:37:32 -08:00
Jesse Suen
a10b0af718 Update docs to use v0.11.0-rc6 (#1001) 2019-01-09 16:17:32 -08:00
Jesse Suen
09067585fa Settings were getting re-initialized when incomplete. Session manager now uses settings manager (#1000) 2019-01-09 15:46:38 -08:00
Alexander Matyushentsev
bc4c5d83ce Log manifest with debug log level (#999) 2019-01-09 15:19:20 -08:00
Alexander Matyushentsev
fbc2021ed8 Add metadata.creationTimestamp to list of requested app fields 2019-01-09 14:10:43 -08:00
Jesse Suen
7750c359b9 Update docs to use v0.11.0-rc5 (#994) 2019-01-09 08:15:06 -08:00
Jesse Suen
f87d16f90f Add better project policy rule validation (#990) 2019-01-08 15:43:12 -08:00
Alexander Matyushentsev
fa4b761612 Use informers to load ArgoCD settings (#989)
* Use informers to load Argo CD settings
2019-01-08 14:53:45 -08:00
Jesse Suen
564413df01 Add descriptions for project fields and slight improvements to UI/validation 2019-01-08 02:57:02 -08:00
Jesse Suen
3884b07295 Eliminate reconcile hotloop by prevent Endpoint updates from requeuing apps (#986) 2019-01-07 14:35:16 -08:00
Jesse Suen
3379585847 Increase QPS and Burst used in K8s client configs to 25/50 (#984) 2019-01-07 14:25:07 -08:00
Jesse Suen
5490766972 Fix issue where custom resource objects might get synced to incorrect namespace during initial sync (#982) 2019-01-07 13:46:11 -08:00
Alexander Matyushentsev
0d3fe64c08 Fix loading cluster connection status (#980) 2019-01-04 17:57:30 -08:00
Jesse Suen
2745bab613 Update golang to v1.11.4 (#977) 2019-01-04 10:37:50 -08:00
Alexander Matyushentsev
df0591a831 Issue #978 - Fix application rollback to deployment without overrides (#979)
* Issue #978 - Fix application rollback to deployment without overrides

* Fix imports sorting
2019-01-04 10:16:41 -08:00
Paul van Staden
88dbcee873 Improving documentation regarding params (#974) (#975) 2019-01-04 07:41:17 -08:00
Jesse Suen
053875f47f Update versions for kubectl (v1.13.1), helm (v2.12.1), ksonnet (v0.13.1) (#973) 2019-01-03 15:16:08 -08:00
Alexander Matyushentsev
24063e7a7b Reduce timeout for checking cluster health (#972) 2019-01-03 11:11:01 -08:00
Alexander Matyushentsev
4d1e65c6b0 Update sample commands in project management doc (#971) 2019-01-03 10:57:23 -08:00
Alexander Matyushentsev
5f32cae938 Issue #966 - UI error with helm charts parameters 2019-01-03 10:39:29 -08:00
Alexander Matyushentsev
198e4fe520 Issue #969 - Fix rendering number of application parameter overrides 2019-01-03 09:37:03 -08:00
Jesse Suen
8c4a7a9b39 Update docs to use v0.11.0-rc2 version (#964) 2018-12-27 21:05:59 -08:00
Alexander Matyushentsev
229d4c167a Use --refresh --hard-refresh flags in 'app get' 'app diff' commands (#963) 2018-12-27 16:08:52 -08:00
Alexander Matyushentsev
3c2febf8b4 Update argo slack URL 2018-12-27 15:58:08 -08:00
Alexander Matyushentsev
3f362be146 Issue #916 - Use 'diff' to render actual vs target state difference (#962) 2018-12-27 08:30:20 -08:00
Jesse Suen
57e979c24c Show sync policy in app list view (#961) 2018-12-27 04:00:59 -08:00
Jesse Suen
1582ddf3c4 Handle diff corner case where Role/ClusterRole rules are null (#960) 2018-12-27 04:00:16 -08:00
Alexander Matyushentsev
0d8121710f Load repo/cluster status in parallel to improve /repos /clusters API performance (#958) 2018-12-26 14:20:26 -08:00
Alexander Matyushentsev
8d020fa694 Issue #956 - Slow comparison if cluster is down (#957) 2018-12-26 13:38:35 -08:00
Alexander Matyushentsev
0d4c10bd45 Disable save button while saving application changes 2018-12-26 13:32:47 -08:00
Alexander Matyushentsev
d4e4d7e4b4 Issue #952 - Add helm file if user selected file name from autocompletion dropdown 2018-12-26 10:49:09 -08:00
Jesse Suen
04564add01 Make injected application instance label configurable from default (#944)
* Make injected application instance label configurable from default
Stop removing ksonnet.io/component label, unless using legacy label

* Fix applying of resources when namespace is empty
2018-12-23 22:25:04 -08:00
Zvi Cahana
881d052f0d Prefix controller resource names with 'argocd-' (#917)
* Prefix controller resource names with 'argocd-'

* Regenerate installation manifests

* Rename some additional application-controller occurrences

* Rename [cluster]role[binding] resources

* Regenerate installation manifests
2018-12-20 13:16:01 -08:00
Alexander Matyushentsev
14ec5f6e33 Issue #950 - Application controller don't refresh app after destination update (#951) 2018-12-20 12:48:42 -08:00
lbrictson
6389fc5c6d Update aws-iam-authenticator to new version, fix url (#948) 2018-12-19 16:29:48 -08:00
Alexander Matyushentsev
943bf8c69c Show operation in progress even if controller is down 2018-12-19 16:20:27 -08:00
Alexander Matyushentsev
be732210a4 Fix broken filter after updating app 2018-12-19 14:51:55 -08:00
Alexander Matyushentsev
eee33e336d Correctly drop cluster cache after CRD creation/deletion (#947) 2018-12-19 11:43:21 -08:00
Jesse Suen
1570736631 Diff library handles case where live object has null secret data (#945) 2018-12-19 10:05:04 -08:00
Alexander Matyushentsev
d42fabaa7a Issue #939 - Fix nil dereference error in Diff function (#940) 2018-12-18 15:06:58 -08:00
Alexander Matyushentsev
d60ef39f82 Issue #939 - Fix nil dereference error in Diff function 2018-12-18 10:02:22 -08:00
Alexander Matyushentsev
23121b3528 Issue 914 - Add application force refresh button (#88) 2018-12-17 18:23:55 -08:00
Alexander Matyushentsev
c904fa9092 Issue 914 - Allow invalidating application related cache (#931) 2018-12-17 18:23:35 -08:00
Alexander Matyushentsev
135dce436e Issue 906 - Support setting different base href in UI (#87) 2018-12-14 14:01:02 -08:00
Alexander Matyushentsev
761033ccef Issue 906 - Support setting different base href in UI (#930) 2018-12-14 14:00:43 -08:00
Alexander Matyushentsev
f38a3ac6cd Fix filtering hooks 2018-12-14 10:16:21 -08:00
Alexander Matyushentsev
a1382e107f Fix build issue 2018-12-13 10:02:02 -08:00
Alexander Matyushentsev
3367c879bd Issue #912 - Make ResourceNode 'tags' into a more generic 'info' struct (#86)
* Issue #912 - Make ResourceNode 'tags' into a more generic 'info' struct
2018-12-12 13:17:23 -08:00
Alexander Matyushentsev
5166344d33 Issue #912 - Make ResourceNode 'tags' into a more generic 'info' struct (#926)
* Issue #912 - Make ResourceNode 'tags' into a more generic 'info' struct
2018-12-12 13:16:55 -08:00
Alexander Matyushentsev
a1cc18c285 Issue #927 - Add missing handlings for deprecated extensions group kinds (#928) 2018-12-12 13:16:32 -08:00
Alexander Matyushentsev
34a080faa9 Issue #922 - Fix nil derefrence error in 'argocd app diff' command (#925) 2018-12-12 09:46:53 -08:00
Alexander Matyushentsev
ba8005740a Fix JS error after force app refresh 2018-12-11 13:26:18 -08:00
Alexander Matyushentsev
0d225965ff Issue #909 - add sync and health filters 2018-12-11 12:45:22 -08:00
Alexander Matyushentsev
1deeada249 Issue #910 - Reconstruct tree structure on the flight to avoid inconsistent state (#921) 2018-12-10 14:48:31 -08:00
Alexander Matyushentsev
84863acac9 Issue #915 - Local 'argocd app diff' fails (#920) 2018-12-10 13:56:04 -08:00
Alexander Matyushentsev
ec23932203 Add v0.11.0-rc1 to getting_started.md (#919) 2018-12-10 10:26:36 -08:00
Jesse Suen
483872a190 Fix issue preventing kustomize apps being multi-namespaced (#913) 2018-12-10 02:30:21 -08:00
Alexander Matyushentsev
457e137dda Enforces looses user claims if default role is set (#907) 2018-12-07 17:04:17 -08:00
Alexander Matyushentsev
4a06693994 Server should accept clients with pre-release version (#905) 2018-12-07 16:44:23 -08:00
Alexander Matyushentsev
0f39f1032a Issue #897 - Secret data not redacted in last-applied-configuration (#902) 2018-12-07 15:40:55 -08:00
Alexander Matyushentsev
4f12660c1b Fix discovering cluster wide resources with namespace (#904) 2018-12-07 15:40:41 -08:00
Jesse Suen
832564864f Give 'get' access to the argocd-server cluster role (#903) 2018-12-07 15:26:47 -08:00
Jesse Suen
51638bc6f5 API client watch helper to retry disconnections from API server (#896) 2018-12-07 11:33:58 -08:00
Alexander Matyushentsev
c22aff33ce Issue #417 - Add force delete option for deleting resources 2018-12-07 11:02:40 -08:00
dthomson25
8ea474a3c9 Remove gracePeriod seconds option from API (#900) 2018-12-07 10:50:40 -08:00
Jesse Suen
eb73d5c372 Tweak width of error column 2018-12-07 01:45:13 -08:00
Jesse Suen
2bc9995b61 Add sync and health details to app header (#85) 2018-12-06 21:59:26 -08:00
Jesse Suen
689c498549 Add protection from malformed project policies being sent to casbin (#888)
Group and role name validation (resolves #843)
2018-12-06 16:11:59 -08:00
Tom Wieczorek
eb2a716661 Update to kustomize 1.0.11 (#889) 2018-12-06 16:00:29 -08:00
dthomson25
0af3836f74 Add force delete option to API (#891) 2018-12-06 16:00:10 -08:00
Alexander Matyushentsev
7188823ade Issue #770 - Helm value files on App details page (#84) 2018-12-06 15:33:27 -08:00
Alexander Matyushentsev
11b0c2848c Issue #770 - Support loading app details by directory (#893) 2018-12-06 15:32:43 -08:00
Michael Goodness
636968d381 Add initContainer volumeMount to custom tooling docs (#892) 2018-12-06 15:32:34 -08:00
Alexander Matyushentsev
7eb211eb94 Issue #760 - Properly read watch events to avoid nil pointer errors (#890) 2018-12-06 15:20:37 -08:00
Alexander Matyushentsev
10f4a22192 Issue #741 - Trim repo URL in app creation wizard 2018-12-06 10:45:14 -08:00
Alexander Matyushentsev
07111fa952 Issue #732 - Cmd+Click should open app in new tab 2018-12-06 08:52:12 -08:00
Jesse Suen
5cedfb8ead CLI support for multi-namespaced applications (#886)
Make `argocd relogin` unnecessary when updating password
Print application details as part of `app wait`, `app sync` (issue #737)
2018-12-05 22:23:13 -08:00
Stephen Haynes
c20a49c531 Enable --auto-prune for app create if --sync-policy is automated (#887) 2018-12-05 21:59:16 -08:00
Alexander Matyushentsev
874fe69683 Issue #887 - OIDC config needs to be able to reference .keys (#885) 2018-12-05 18:38:01 -08:00
Alexander Matyushentsev
cfefec06a9 Add declarative argocd setup docs (#813)
* Add declarative argocd setup docs

* Add Helm repositories documentation
2018-12-05 17:48:19 -08:00
Jesse Suen
0a7d14040d Update release notes for v0.11 and add more documentation (#883) 2018-12-05 17:07:13 -08:00
Alexander Matyushentsev
adf522454e Issue #821 - Login button when external OIDC provider is configured 2018-12-05 12:00:24 -08:00
Alexander Matyushentsev
974ab11b76 Issue #874 - Helm repositories config missing username/password (#882) 2018-12-05 11:36:43 -08:00
Stephen Haynes
7d40d228da build cli with packr (#875) 2018-12-04 22:42:37 -08:00
Alexander Matyushentsev
d7b89f5a7c Remove parameters field from ApplicationStatus (#83) 2018-12-04 22:29:14 -08:00
Alexander Matyushentsev
c73ea2de1d Remove parameters field from ApplicationStatus (#872)
* Remove parameters field from ApplicationStatus

* Remove unnecessary override parameters validation
2018-12-04 22:28:58 -08:00
Alexander Matyushentsev
39f8662beb Gracefully handle application deletion in UI 2018-12-04 15:30:45 -08:00
Alexander Matyushentsev
c308165816 Application controller does not save application parameters in app crd (#871) 2018-12-04 13:50:07 -08:00
Alexander Matyushentsev
bf157fd794 Fix editing parameters with multiple '.' character in name 2018-12-04 13:47:43 -08:00
Alexander Matyushentsev
4c62c19230 Upgrade argo-ui version 2018-12-04 11:13:33 -08:00
Alexander Matyushentsev
38720b2e46 Fix flaky e2e test (#870) 2018-12-04 10:38:57 -08:00
Alexander Matyushentsev
6f0f9ec1ba Animate application resource changes 2018-12-04 10:35:51 -08:00
Alexander Matyushentsev
e7b2e9f639 Issue #868 - Filter out extensions group resources which are mirrored in apps group (#869) 2018-12-04 10:06:42 -08:00
Jesse Suen
3c8da80fa4 Accommodate rework of application status datastructure 2018-12-04 10:03:50 -08:00
Jesse Suen
a9f18abb41 Proper support for resource lifecycle hooks
Add ability to perform a dry-run sync
Refactor models to use renamed types
2018-12-04 10:03:50 -08:00
Jesse Suen
cbaf8a0bc8 Promote resources field in ComparisonStatus to application.status
Fix pruning/syncing when changing application namespace
Rename DeploymentInfo to RevisionHistory to be consistent with k8s
2018-12-04 10:03:01 -08:00
Jesse Suen
f5861aa708 Refactor, consolidate and rename resource type datastructures 2018-12-04 10:03:01 -08:00
dthomson25
2fba6abc8d Add local diff back (#863) 2018-12-04 09:45:42 -08:00
Stephen Haynes
f762188b89 build application-controller with packr (#866) 2018-12-03 17:29:45 -08:00
Alexander Matyushentsev
4a1590c0bd Fix null pointer exception during app events loading 2018-12-03 15:33:35 -08:00
Alexander Matyushentsev
d987416c9b Issue #747 - Declaratively add helm repositories (#864) 2018-12-03 15:15:37 -08:00
Alexander Matyushentsev
2b89f6fb71 Issue #858 - Support loading resource events for multi-network apps (#81) 2018-12-03 14:54:06 -08:00
Alexander Matyushentsev
246392f0f6 Issue #858 - Support loading resource events for multi-network apps (#865) 2018-12-03 14:53:11 -08:00
Alexander Matyushentsev
e5fd75cdd2 Issue #740 - Render synced to revision 2018-12-03 14:18:12 -08:00
Alexander Matyushentsev
59eb3ab749 Issue #822 - No error indication when insufficient permissions to create tokens 2018-12-03 13:52:46 -08:00
Jesse Suen
0693a6dd70 Use standard Scheme Convert function instead of the kubectl based converter (#860) 2018-12-03 10:36:50 -08:00
Jesse Suen
4fa33f300b Proper treatment of resource lifecycle hooks: (#859)
* do not allow hooks to affect Synced or Health status
* do not delete hooks during a sync --prune
* add health statuses for jobs and pods
2018-12-03 10:27:43 -08:00
Jesse Suen
2c8e9fa9ac Switch to k8s recommended app.kubernetes.io/instance label (#857)
Remove ability to set helm release name
Reorganize Argo CD constants
2018-11-30 23:54:01 -08:00
Jesse Suen
d67fd59f65 Remove ability to set helm release name (#80) 2018-11-30 23:10:17 -08:00
Alexander Matyushentsev
6a90de738c Switch to never DataLoader version 2018-11-30 22:43:46 -08:00
Alexander Matyushentsev
cf757831b6 Issue #853 - pod logs does not work in multi namespaced apps (#79) 2018-11-30 15:40:18 -08:00
Alexander Matyushentsev
6ac3e8ec45 Issue #853 - pod logs does not work in multi namespaced apps (#855) 2018-11-30 15:40:01 -08:00
Alexander Matyushentsev
c66b444213 Fix app diff command (#854) 2018-11-30 15:39:49 -08:00
Jesse Suen
64be0913ad Only run helm dependency build when necessary (issue #786) (#851) 2018-11-30 13:51:31 -08:00
Jesse Suen
ec70110ab2 Normalize app spec during controller reconciliation and API server create/update (#848) 2018-11-30 13:50:27 -08:00
Alexander Matyushentsev
93ad11095a Resources events streaming bug fixes: panic (#699), stale cache detection, restaring bad watchers (#852) 2018-11-30 11:29:12 -08:00
Jesse Suen
26af75061e Remove git URL normalization in favor of fuzzy equivalence (issue #838) (#849) 2018-11-30 10:41:47 -08:00
Jesse Suen
c48b9f8edd Rename 'controlled resources' to 'managed resources' (#78)
Rename 'resources tree' to 'resource tree'
2018-11-30 10:38:12 -08:00
Jesse Suen
83fb5fb388 Rename 'controlled resources' to 'managed resources' (#850)
Rename 'resources tree' to 'resource tree'
2018-11-30 10:32:31 -08:00
Alexander Matyushentsev
dfb3451000 Fix missing app comparison, health status icons 2018-11-30 10:09:25 -08:00
Alexander Matyushentsev
6dede28f72 Issue #696 - Support apps with static namespaces in resources (#842) 2018-11-29 15:34:46 -08:00
Jesse Suen
419a40beac Support project whitelists/blacklists rendering and editing (#77)
Support adding/removing of project role groups
Remove obsolete rollback result from models
Support new style of structured application sources
2018-11-29 13:13:13 -08:00
Zvi Cahana
800c4b1d48 Build argocd-util as a statically linked binary (#845) 2018-11-29 12:57:31 -08:00
Alexander Matyushentsev
15032dd3b9 Fix null pointer exception on resource details panel 2018-11-28 16:29:27 -08:00
Jesse Suen
3a9196ce18 gRPC API client and gateway now supply user-agent. Require client min version as v0.11 (#841)
With this change, the gRPC api client and grpc-gateway now supply a user-agent, `argocd-client/X.Y.Z`, with their all requests. This enables us to discern various versions of the CLI as the requestor, and reject requests from incompatible clients. We assume legacy clients as clients that only supply a single user-agent, grpc-go/1.15.0.
2018-11-28 14:06:02 -08:00
Jesse Suen
76c5df087a Update kustomize base when setting image tags (#833) 2018-11-28 13:55:38 -08:00
Alexander Matyushentsev
649152c97a Use /<app>/resource-tree and /<app>/controlled-resources apis 2018-11-28 13:38:19 -08:00
Alexander Matyushentsev
6368a3e548 Refactor application controller (#840)
* Refactor application controller
2018-11-28 13:38:02 -08:00
Jesse Suen
c387dca4fb Present a 'deletion' operation while application is deleting (#76) 2018-11-27 14:39:56 -08:00
Jesse Suen
d9b0e6b234 Update link to download argocd CLI directly from API server (#75) 2018-11-27 14:39:38 -08:00
Jesse Suen
8372d751fd Handle case where jwtTokens is omitted from the payload (#74) 2018-11-27 14:39:26 -08:00
Jesse Suen
cde040e10f Serve CLI binaries directly from API server (#837) 2018-11-27 13:39:06 -08:00
Jesse Suen
477ca61da5 Resolve ambiguous revisions in API server when initiating syncs (issue #818) (#834)
Incorporate revision information into event messages
2018-11-27 13:38:00 -08:00
Zvi Cahana
2b23812e6e Relax validation to permit app with no manifests (#832) 2018-11-27 02:52:46 -08:00
Tom Wieczorek
b53ad60b48 Split up CRD manifests into their own folder (#674)
This way, CRD and app deployments can be separated, e.g. if someone wishes to install Argo CD multiple times.

Also: Make update-manifests.sh fail-fast and more resilient against spaces in paths and user's CDPATH settings.
2018-11-26 14:40:15 -08:00
Jesse Suen
db92f0b569 Explicitly check for namespace before running auth reconcile (#826) 2018-11-24 11:31:09 -08:00
Jesse Suen
456ae3ab84 Support the ability to map OIDC groups to project roles (issue #742) (#817)
Fix CLI usability of `argocd proj list` (issue #769)
Use constants for RBAC resources and actions (issue #453)
Introduce RBAC policy enforcer backed by project informer cache
Introduce `argocd proj get PROJECT`
2018-11-23 11:31:20 -08:00
Jesse Suen
9347f4157e Special case secrets to base64 encode stringData before performing diff (issue #763)
When performing a diff, and the group kind is a v1.Secret, we will base64 encode the stringData field (if present) to the data field before sending to the diffing library. This way we will prevent false positives of OutOfSync secrets which are really Synced when factoring in stringData.
2018-11-21 12:00:44 -08:00
Jesse Suen
3b447a19ea Support for Pods as a sync hook (#801)
Add app label to pod metadata in job.spec.template.labels
Fix issue where hooks could bypass a project whitelist/blacklist (issue #794)
Fix issue where deletion of hooks did not perform a cascaded deletion (issue #797)
2018-11-21 11:58:08 -08:00
Alexander Matyushentsev
a70cab7ac1 Fix repository settings deserialization (#812) 2018-11-19 13:00:07 -08:00
Jesse Suen
4b2aecc9bc Ignore metadata.namespace in config when performing two-way diff (issue #784) (#810) 2018-11-19 12:47:10 -08:00
Jesse Suen
9cb445a71a Diff view shows incorrect base/value comparison (issue #725) (#809) 2018-11-19 12:41:53 -08:00
Jesse Suen
bcd9cd6cd7 Reorder auth reconcile after apply to prevent namespace creation (#808) 2018-11-19 12:40:37 -08:00
Jesse Suen
16ff90c070 Defer deletion of app object until all resources have been deleted (issue #636) (#807)
Purge app cache after deletion is successful (issue #802)
2018-11-19 12:25:45 -08:00
Jesse Suen
925f9486e3 Restructure application sources to separate types (#799) 2018-11-17 16:20:25 -08:00
Jesse Suen
b439424cef Use default server addresses. Use an imagePullPolicy of Always for manifests (#796) 2018-11-17 16:00:55 -08:00
Alexander Matyushentsev
12423e9358 Issue #621 - Fix child resource deletion (#800) 2018-11-17 11:42:33 -08:00
Jesse Suen
bb82919131 Fix make all target and use archiveLogs workflow feature (#795) 2018-11-16 18:14:52 -08:00
Alexander Matyushentsev
be4f9d85ae Issue #782 - Application type is incorrectly inferred as 'directory' if app source path starts with '.' (#789) 2018-11-16 17:12:44 -08:00
Alexander Matyushentsev
275b9e194d Issue #355 - Treat 'crd-install' hooks as normal k8s resource (#792) 2018-11-16 17:12:21 -08:00
Alexander Matyushentsev
0a752fb61f Issue #621 - Load resources from API (#73) 2018-11-16 17:10:48 -08:00
Alexander Matyushentsev
44087fa1b5 Issue #621 - Remove resources state from application CRD (#758) 2018-11-16 17:10:04 -08:00
Will Medlar
d3043461a6 Fix typo in documentation for hook delete policy (#793) 2018-11-16 12:20:28 -08:00
Alexander Matyushentsev
3f7a0d3c97 Issue #790 - Fix application controller panic (#791) 2018-11-16 10:48:49 -08:00
Jesse Suen
361931f104 Move to single master image for all argocd services (issue #762) 2018-11-15 18:11:10 -08:00
Jesse Suen
641b7fd060 Bump up the default status/operation processors to 20/10 respectively 2018-11-15 18:11:10 -08:00
Jesse Suen
17bcb3bdbf Update docs to describe how to customize repo-server (issue #772) (#778) 2018-11-15 14:34:39 -08:00
Jesse Suen
7520a8a4f8 Update CHANGELOG and docs to point to v0.10.6 (#777) 2018-11-14 19:08:36 -08:00
Jesse Suen
8734f287eb Fix issue preventing in-cluster app sync due to go-client changes (issue #774) (#775) 2018-11-14 18:13:54 -08:00
Conor Fennell
7552a3610f add metrics label for service monitor discovery (#765) 2018-11-14 11:55:47 -08:00
Jesse Suen
f4387d5394 Update CHANGELOG and docs to point to v0.10.5 install manifests (#771) 2018-11-13 19:41:51 -08:00
Alexander Matyushentsev
16be7e708f Issue #768 - Fix application wizard crash (#72) 2018-11-13 15:15:17 -08:00
Conor Fennell
ffa0c340b8 add argo cluster permission to view logs (#766) 2018-11-13 08:46:46 -08:00
Conor Fennell
34aad3f0df add project label to all metrics (#767)
* add project label to all metrics

* fix metrics files formatting
2018-11-13 08:41:38 -08:00
Niclas Mietz
49e022a2c0 Update getting_started to latest argo-cd version (#761)
Signed-off-by: solidnerd <niclas@mietz.io>
2018-11-10 10:14:59 -08:00
Alexander Matyushentsev
317d2a8aa8 Issue #536 - Declarative setup and configuration of ArgoCD (#745)
* Issue #536 - Declarative setup and configuration of ArgoCD

* Add missing rules to application-controller role

* Fix broken test; update install manifests
2018-11-09 09:58:07 -08:00
Will Medlar
f52589c128 Return partial settings from configmap if the argocd secret is not found (#755) 2018-11-08 08:31:39 -08:00
Jesse Suen
75d2c57688 Health check is not discerning apiVersion when assessing CRDs (issue #753) (#754) 2018-11-07 17:21:22 -08:00
Alessandro Marrella
92d0df1412 Updated helm (#749) 2018-11-07 11:29:01 -08:00
Taylor D. Edmiston
34bb60f064 Make Argo CD naming consistent (#694)
* Make Argo CD naming consistent

* Change ArgoCD to Argo CD on new lines
2018-11-05 11:29:01 -08:00
Chris Garland
09e4c32832 Allow 'syncApplication' action to reference target revision rather then hard-coding to 'HEAD' (#69) 2018-11-01 13:15:43 -07:00
Benoit Sigoure
1206926ac2 Update version to v0.10.3 in getting started guide. (#739) 2018-11-01 13:13:49 -07:00
dthomson25
7298289f3a Show operation without status.operationStatus existing (#70) 2018-11-01 11:27:11 -07:00
Alexander Matyushentsev
136cf5be52 Issue #697 - Use /v1/applications field selection feature (#68) 2018-10-30 10:26:47 -07:00
Alexander Matyushentsev
958096aaa8 Issue #697 - Ability to perform field selection in API (#736) 2018-10-30 10:20:29 -07:00
dthomson25
d5023bc195 Support adding name prefix for helm and kustomize (#67) 2018-10-30 09:59:32 -07:00
dthomson25
2c8c2fcd64 Support adding name prefix in helm and kustomize (#735) 2018-10-29 16:05:22 -07:00
Andrew Merenbach
d7b3a5c6eb Use presence of components dir in ksonnet validation app validation (#734) 2018-10-29 14:42:49 -07:00
Jesse Suen
5c7a3329f3 Support for external OIDC providers and implicit login flows (#727) 2018-10-29 01:36:53 -07:00
Andrew Merenbach
a0b5af0dae Revert "Validate Ksonnet apps through component dir presence (#708)" (#730)
This reverts commit 1844be638b.
2018-10-29 00:13:51 -07:00
Alexander Matyushentsev
37c25383b7 Fix applying TLS version settings (#731) 2018-10-28 23:28:39 -07:00
Jesse Suen
2498f60c57 Update dependencies to k8s v1.12 and client-go v9.0 (#729)
Update dependencies to k8s v1.12 and client-go v9.0 (resolves #353)
Fix issue where applications could not be deleted on k8s v1.12 (resolves #718)
Refactor k8s dynamic resource libraries to promote code reuse
2018-10-28 22:46:13 -07:00
Tom Wieczorek
7e390e76d0 Update to kustomize 1.0.10 (#728) (#728)
See also kubernetes-sigs/kustomize#514
2018-10-26 17:33:38 -07:00
Alexander Matyushentsev
e94a551ec2 Show confirmation message only if sync is successful (#66) 2018-10-25 13:04:16 -07:00
Tom Wieczorek
ce7d02c94a Update to kustomize 1.0.9 (#722) 2018-10-25 11:48:34 -07:00
dthomson25
b578de77f7 Fix app refresh err when k8s patch is too slow (#724) 2018-10-25 10:55:57 -07:00
Mario Duarte
d055efba3c Fix nil pointer dereference in util/health (#723) 2018-10-25 10:19:38 -07:00
Alexander Matyushentsev
93bc108a24 Issue #670 - Allow using Sets the value of different fields in kustomization file. (#720) 2018-10-25 09:13:22 -07:00
Alexander Matyushentsev
3fd528de2b Changelog for v0.10.1 release (#719) 2018-10-24 13:56:39 -07:00
Andrew Merenbach
1844be638b Validate Ksonnet apps through component dir presence (#708) 2018-10-24 10:59:22 -07:00
Alexander Matyushentsev
dca1996640 Issue #657 - Use codecov to collect test coverage (#717) 2018-10-23 14:42:41 -07:00
Jesse Suen
cb3656b45c Handle case where OIDC settings become invalid after dex server restart (issue #710) (#715) 2018-10-23 13:45:27 -07:00
Alexander Matyushentsev
127cf77db4 Fix sso relogin redirect 2018-10-22 23:37:04 -07:00
Jesse Suen
5c2eaf202e Update getting_started to use v0.10.0 (#714) 2018-10-21 00:33:27 -07:00
Jesse Suen
5abba4f85b git clean also needs to clean files under gitignore (issue #711) (#712) 2018-10-19 22:10:37 -07:00
Jesse Suen
22b77f5b34 RBAC for cluster wide install was missing permissions to list events across namespaces (resolves #704) (#705) 2018-10-19 00:04:03 -07:00
Alexander Matyushentsev
c76db90437 Issue #628 - Remove RollbackOperation in favor of Sync with ParameterOverrides (#706) 2018-10-18 20:23:22 -07:00
Alexander Matyushentsev
4c2d4d11ef Issue #707 - Application details page don't allow editing parameter if parameter name has '.' (#65) 2018-10-18 20:13:38 -07:00
Alexander Matyushentsev
89690b1e97 Issue #508 - Support fine grained sync in UI (#64) 2018-10-18 20:13:06 -07:00
Alexander Matyushentsev
080f7ff4e0 Add 0.10 changelog (#700) 2018-10-18 18:21:49 -07:00
Alexander Matyushentsev
ddbb39bb22 Issue #693 - Input type text instead of password on Connect repo panel (#63) 2018-10-17 10:00:31 -07:00
Alexander Matyushentsev
c5730c8f5f Issue #672 - Metrics endpoint not reachable through the metrics kubernetes service (#692) 2018-10-17 09:44:12 -07:00
Alexander Matyushentsev
a775f48cf0 Issue #655 - Generate role token click resets policy changes (#62) 2018-10-16 17:22:33 -07:00
Alexander Matyushentsev
8e10610173 Issue #685 - Better update conflict error handing during app editing in UI (#61) 2018-10-16 17:16:41 -07:00
Alexander Matyushentsev
d46f284d9f Issue #690 - Increase GRPC message limit (#691) 2018-10-16 16:34:26 -07:00
Alexander Matyushentsev
221f19ae15 Add argocd-util cluster-kubeconfig command (#689) 2018-10-16 16:17:58 -07:00
Alexander Matyushentsev
550cb277df Issue #686 - Resource is always out of sync if it has only 'ksonnet.io/component' label (#688) 2018-10-15 12:57:30 -07:00
Alexander Matyushentsev
9c79af9340 Issue #682 - Operation stuck in 'in progress' state if application has no resources (#684) 2018-10-11 11:18:17 -04:00
Alexander Matyushentsev
9356994d6a Issue #681 - Display init container logs (#60) 2018-10-10 17:53:08 -04:00
Alexander Matyushentsev
36b8abe601 Issue #683 - Resource nodes are 'jumping' on app details page (#59) 2018-10-10 17:51:50 -04:00
Andrew Merenbach
1ba52c8880 Allow more fine-grained sync (closes #508) (#666) 2018-10-10 10:12:20 -07:00
Alexander Matyushentsev
c570186a6f Issue 348 - Redirect to /auth/login instead of /login when SSO token expires (#58) 2018-10-10 12:18:00 -04:00
Andrew Merenbach
92629067f7 Upgrade testify (#667)
* Update Gopkg.toml

* Update Gopkg.lock
2018-10-08 11:01:00 -07:00
Alexander Matyushentsev
93a808e65a Issue #627 - Cluster watch needs to be restarted when CRDs get created (#678) 2018-10-05 13:18:12 -04:00
Alexander Matyushentsev
bf99b251f8 Issue #679 - Default project is created without permission to deploy cluster level resources (#680) 2018-10-05 11:42:54 -04:00
Alexander Matyushentsev
db686b67ec Issue #669 - Sync always suggest using latest revision instead of target (#57) 2018-10-04 14:20:15 -04:00
Alexander Matyushentsev
40e04ab639 Issue #624 - Support ability to use a helm values files from a URL (#56) 2018-10-04 13:18:41 -04:00
Alexander Matyushentsev
1891d7cde7 Support public not-connected repo in app creation UI (#55) 2018-10-04 12:46:54 -04:00
Alexander Matyushentsev
f491540636 Issue #426 - Support public not-connected repo in app creation UI (#675) 2018-10-04 12:46:39 -04:00
Alexander Matyushentsev
98d224a5ec Move form-form components to argo-ui; Use autocomplete component (#54) 2018-10-02 12:54:17 -04:00
dthomson25
f62bd58fae Limit source and destination options to permissions in project (#53) 2018-10-02 11:03:36 -04:00
dthomson25
7f84f7d541 Add project get permission automatically to roles (#665) 2018-10-01 12:44:06 -07:00
dthomson25
1ff4548a2c Load params dyanamically for rollback (#52) 2018-09-28 15:45:34 -07:00
Alexander Matyushentsev
42b01f7126 Add v0.9.2 changelog (#662) 2018-09-28 13:14:06 -04:00
Andrew Merenbach
7e5c17939b Add errgroup dependency for Packr (#648) 2018-09-27 18:27:09 -07:00
Alexander Matyushentsev
d6937ec629 Issue #650 - Temporary ignore service catalog resources (#661) 2018-09-27 20:58:45 -04:00
Andrew Merenbach
f5a32f47d3 Update generated files (#660) 2018-09-27 13:07:16 -07:00
Jesse Suen
316fcc6126 Fix issue where argocd-server logged credentials in plain text during repo add (issue #653) 2018-09-27 12:48:23 -07:00
Jesse Suen
e163177a12 Switch to go-git for all remote git interactions including auth (issue #651) 2018-09-27 12:48:23 -07:00
Jesse Suen
1fe257c71e Do not append .git extension during normalization for Azure hosted git (issue #643) (#645) 2018-09-27 11:54:04 -07:00
Andrew Merenbach
1eaa813f28 Use ksonnet CLI instead of ksonnet libs (#590) (#626) 2018-09-27 11:52:08 -07:00
dthomson25
924dad8980 Normalize policies by always adding space after comma (#659) 2018-09-27 11:24:48 -07:00
dthomson25
1ba10a1a20 Remove default params from app history (#649) 2018-09-27 11:24:25 -07:00
dthomson25
ba36b3f63b Insert whitespaces after commas in policies (#51) 2018-09-27 11:04:19 -07:00
Alexander Matyushentsev
f353236c8a Move DataLoader and NotificationError components to argo-ui libarary (#50) 2018-09-27 13:03:35 -04:00
Stephen Haynes
ab02e10791 update to kustomize 1.0.8 (#644) 2018-09-26 14:24:59 -07:00
Jesse Suen
dd94e5e5c3 Add version check during release to ensure compiled version is accurate (#646) 2018-09-26 07:40:42 -07:00
Jesse Suen
1fcb90c4d9 Documentation clarifications and fixes (#642) 2018-09-25 08:01:41 -07:00
Alexander Matyushentsev
523c7ddf82 Update getting_started.md with new version; update releasing steps (#641) 2018-09-24 15:43:06 -07:00
Jesse Suen
3577a68d2d Update documentation with auto-sync and projects (issue #521) (#616) 2018-09-24 15:27:30 -07:00
Alexander Matyushentsev
d963f5fcc5 Issue #639 - Repo server unable to execute ls-remote for private repos (#640) 2018-09-24 14:20:52 -07:00
dthomson25
1bcc4d3991 Change textarea for policies to interactive UI (#48) 2018-09-24 09:42:15 -07:00
Alexander Matyushentsev
b06ae9ea47 Issue #615 - Ability to modify application from UI (#49)
* Issue #615 - Ability to modify application from UI
2018-09-20 16:43:57 -07:00
dthomson25
7fd326eb21 Add create and delete JWT tokens functionality (#45) 2018-09-18 23:54:46 -07:00
Alexander Matyushentsev
2a8fccc6cd Fix JS error in project edit UI (#47) 2018-09-18 09:51:41 -07:00
Alexander Matyushentsev
1295a89911 Issue #566 - indicate when operation is in progress or has failed (#46) 2018-09-17 15:07:58 -07:00
dthomson25
3e2f205045 Implement project role functionality (#43) 2018-09-14 09:51:20 -07:00
Alexander Matyushentsev
eff5421ce4 Issue #601 - Fix NPE in getResourceLabels function (#44) 2018-09-13 15:13:10 -07:00
Alexander Matyushentsev
857ac806ae Issue #573 - Projects filter does not work when application got changed (#42) 2018-09-10 17:13:23 -07:00
Alexander Matyushentsev
0f7ae16eb6 Issue #562 - App creation wizard should allow specifying source revision (#41) 2018-09-10 16:49:54 -07:00
Alexander Matyushentsev
c31a756517 Issue #396 - provide a YAML view of resources (#40) 2018-09-10 14:41:19 -07:00
Andrew Merenbach
e09453d6e4 Merge pull request #39 from merenbach/hide-no-override-label
Only label overrides > 0
2018-09-07 16:44:58 -07:00
Andrew Merenbach
9177011abd Only label overrides > 0 2018-09-07 16:11:46 -07:00
Andrew Merenbach
9e45d5c8db Merge pull request #38 from merenbach/503-indicate-overrides
Label apps with overrides
2018-09-07 11:40:29 -07:00
Andrew Merenbach
fca687f5fb Satisfy linter, thanks @alexmt 2018-09-07 11:35:44 -07:00
Andrew Merenbach
1223955cba Add count of component parameter overrides 2018-09-07 10:00:57 -07:00
Andrew Merenbach
636c896b90 Use switch statement instead of if-else 2018-09-07 09:50:32 -07:00
Andrew Merenbach
2fa93fd694 Merge pull request #37 from merenbach/539-indicate-notready-pods
Show number of ready containers
2018-09-07 08:33:12 -07:00
Andrew Merenbach
7893e6461b Use index signature instead of map, thanks @alexmt 2018-09-06 16:42:59 -07:00
Andrew Merenbach
1bad5b3179 Fix linter errors, thanks @alexmt 2018-09-06 16:41:50 -07:00
Andrew Merenbach
a0330d439c Rm spurious newline 2018-09-06 16:11:12 -07:00
Andrew Merenbach
3d831c1db7 Simplify filter even more 2018-09-06 16:08:33 -07:00
Andrew Merenbach
613e294f15 Simplify filter 2018-09-06 16:07:55 -07:00
Andrew Merenbach
013d37f23a Refactor code, thanks @alexmt 2018-09-06 16:05:55 -07:00
Andrew Merenbach
a38f293246 Add typing to new function, thanks @alexmt 2018-09-06 15:30:25 -07:00
Andrew Merenbach
f9c39fbc3b Show number of ready containers 2018-09-06 15:16:42 -07:00
Alexander Matyushentsev
a85ff52115 Issue 499 - Support helm values files in App creation wizard (#35) 2018-09-06 00:37:41 +03:00
Alexander Matyushentsev
c359a24017 Issue 457 - Improve resource diff rendering (#36) 2018-09-06 00:37:27 +03:00
Jesse Suen
7816430fd7 Project deletion was not waiting for confirmation before deletion (#34) 2018-09-01 00:08:22 -07:00
Jesse Suen
3e4ed83112 Add ability edit projects with * sources and destinations (#33) 2018-09-01 00:08:10 -07:00
Jesse Suen
617d7be300 UI support for deleting an application resource using the new endpoint (#32) 2018-08-15 12:55:31 -07:00
Jesse Suen
108dbb8efd App create wizard support for kustomize apps (#31) 2018-08-15 12:55:20 -07:00
Alexander Matyushentsev
40fdda3f5a Issue #458 - Render events on project details page (#30) 2018-08-10 03:01:42 +03:00
Alexander Matyushentsev
c451919511 Issue #458 - Project management UI (#29) 2018-08-09 23:11:55 +03:00
Alexander Matyushentsev
4f6b686ed7 Upgrade argo-ui version 2018-08-08 14:41:17 -07:00
Alexander Matyushentsev
455993b164 Issue #458 - add projects list page (#28) 2018-08-04 21:34:55 +03:00
Alexander Matyushentsev
ec47a07195 Fix npe error in app wizard 2018-08-03 11:45:31 -07:00
Alexander Matyushentsev
9cbfc37774 Merge pull request #27 from alexmt/459-app-wizard-improvement
Issue #459 - Improve application creation wizard
2018-08-03 21:33:24 +03:00
Alexander Matyushentsev
1928548346 Issue #459 - Improve application creation wizard 2018-08-03 11:30:08 -07:00
Alexander Matyushentsev
bc90faa69f Merge pull request #26 from alexmt/474-list-apps
Issue #474 - Load app details on the fly
2018-08-03 20:10:58 +03:00
Alexander Matyushentsev
29563434df Issue #474 - Load app details on the fly 2018-08-03 09:45:25 -07:00
Alexander Matyushentsev
eca1789ad1 Merge pull request #25 from alexmt/446-loading-error-notification
Issue #446 - Improve data loading errors notification
2018-08-03 00:51:00 +03:00
Alexander Matyushentsev
7c60ff0201 Issue #446 - Improve data loading errors notification 2018-08-02 14:07:49 -07:00
Alexander Matyushentsev
a930b4fdca Fix linter warning 2018-08-02 08:41:39 -07:00
Alexander Matyushentsev
9c6125deef Merge pull request #24 from alexmt/463-empty-component
Issue #463 - Support parameters with empty component name
2018-08-01 08:07:01 +03:00
Alexander Matyushentsev
26d390e2bd Issue #463 - Support parameters with empty component name 2018-07-31 22:06:22 -07:00
Andrew Merenbach
363ca3febb Merge pull request #23 from merenbach/fix-application-card
Update colors for application cards
2018-07-31 17:12:57 -07:00
Andrew Merenbach
6c648ef0d8 Update colors for application cards 2018-07-31 16:18:59 -07:00
Alexander Matyushentsev
3d9943c7b3 Fix wizard back navigration if drop-in directory/helm selected 2018-07-27 13:34:37 -07:00
Alexander Matyushentsev
a48b1bcbae Merge pull request #22 from alexmt/443-helm-app
Issue #443 - UI changes for selecting Helm and manifest app directories
2018-07-25 21:08:39 +03:00
Alexander Matyushentsev
1483ee4c8c Issue #443 - UI changes for selecting Helm and manifest app directories 2018-07-25 11:04:18 -07:00
Alexander Matyushentsev
ab505fddcd Merge pull request #21 from alexmt/442-app-project
Issue 442 - UI does not allow to select project
2018-07-25 19:49:02 +03:00
Alexander Matyushentsev
62158a0c06 Issue 442 - UI does not allow to select project 2018-07-25 09:40:10 -07:00
Alexander Matyushentsev
83d0c4b084 Merge pull request #20 from alexmt/340-app-events-ui
Issue #340 - render application events
2018-07-24 20:13:32 +03:00
Alexander Matyushentsev
95b237bdc5 Issue #340 - render application events 2018-07-23 09:02:15 -07:00
Alexander Matyushentsev
2e1db8f69b Merge pull request #19 from alexmt/351-sso-error-message
Issue #351 - render sso error message
2018-07-18 00:48:54 +03:00
Alexander Matyushentsev
66a182e743 Issue #351 - render sso error message 2018-07-17 14:16:29 -07:00
Alexander Matyushentsev
28580b09c3 Merge pull request #18 from alexmt/406-terminate-button
Issue #406 - add button to terminate a operation
2018-07-16 20:02:38 +03:00
Alexander Matyushentsev
72bcad4810 Explicitly define function return type 2018-07-16 10:00:49 -07:00
Alexander Matyushentsev
6862fe3551 Issue #406 - add button to terminate a operation 2018-07-16 09:41:33 -07:00
Alexander Matyushentsev
71b02e3bcd Merge pull request #17 from alexmt/402-deployment-override-history
Issue #402 - App deployment history don't display parameter overrides
2018-07-14 01:23:50 +03:00
Alexander Matyushentsev
af88064c2a Merge pull request #16 from alexmt/400-swagger-link
Issue #400 - Provide a link to swagger UI
2018-07-14 01:17:20 +03:00
Alexander Matyushentsev
658a16fb78 Issue #402 - App deployment history don't display parameter overrides 2018-07-13 15:16:40 -07:00
Alexander Matyushentsev
bc2c2a5189 Issue #400 - Provide a link to swagger UI 2018-07-13 14:55:27 -07:00
Alexander Matyushentsev
7ea4d5a957 Merge pull request #15 from alexmt/bug-fixes
UI Bug fixes
2018-07-13 02:02:31 +03:00
Alexander Matyushentsev
1db0fbdedc Render sync hooks and operation status message 2018-07-12 15:38:56 -07:00
Alexander Matyushentsev
3a25697349 Add revision to app summary panel 2018-07-12 15:38:29 -07:00
Alexander Matyushentsev
4c80d6bc34 Set cascade to true in app delete popup 2018-07-12 15:37:56 -07:00
Alexander Matyushentsev
49f342ad43 Merge pull request #14 from alexmt/bug-fixes
Various UI bug fixes
2018-07-13 00:23:28 +03:00
Alexander Matyushentsev
e849321f62 Fix connect repo URL in app creation wizard 2018-07-12 13:55:31 -07:00
Alexander Matyushentsev
6ded5c5cfe Fix health/comparsion status icons 2018-07-12 13:53:23 -07:00
Alexander Matyushentsev
191f737d5f Remove unnecessary margins on application details page 2018-07-12 08:34:38 -07:00
Alexander Matyushentsev
4a03d1120f Merge pull request #13 from alexmt/290-cluster-list-page
Issue #290 - Cluster list page
2018-07-12 02:47:43 +03:00
Alexander Matyushentsev
5bbc94188c Issue #290 - Cluster list page 2018-07-11 16:32:50 -07:00
Andrew Merenbach
bf9f634613 Merge pull request #12 from merenbach/update-status-on-sync
Refactor app sync and delete
2018-07-11 13:57:12 -07:00
Andrew Merenbach
73452f7b10 Rm spurious app update, thanks @alexmt 2018-07-11 12:57:18 -07:00
Andrew Merenbach
eb92001626 Fix await/then redundancy, thanks @alexmt 2018-07-11 12:53:14 -07:00
Andrew Merenbach
5b5fadce77 Use promises instead of success callback 2018-07-11 11:51:22 -07:00
Alexander Matyushentsev
87f706aa1e Fix linter warning 2018-07-11 11:35:36 -07:00
Alexander Matyushentsev
4b36f0e211 Fix javascript exception caused by missing check 2018-07-11 11:34:45 -07:00
Andrew Merenbach
b575f45c11 Merge pull request #11 from merenbach/label-terminating-pods
Label terminating pods
2018-07-11 11:01:39 -07:00
Alexander Matyushentsev
3900d11454 Merge pull request #9 from alexmt/277-condition-types
Issue #277 - support error/warning/info condition types
2018-07-11 20:58:41 +03:00
Alexander Matyushentsev
3434f5e601 Merge pull request #10 from alexmt/341-app-refresh-btn
Issue #341 - add refresh button in app view
2018-07-11 20:58:12 +03:00
Andrew Merenbach
8381581821 Check metadata for deletionTimestamp 2018-07-11 10:55:14 -07:00
Andrew Merenbach
e7ef4dbc4f Update package dependencies 2018-07-11 10:55:14 -07:00
Alexander Matyushentsev
42778b5a91 Issue #341 - add refresh button in app view 2018-07-11 10:55:12 -07:00
Alexander Matyushentsev
ac89d49bea Issue #277 - support error/warning/info condition types 2018-07-11 10:43:27 -07:00
Alexander Matyushentsev
9e43ed4293 Merge pull request #8 from alexmt/337-remember-filtering
Issue #337 - remember my resource filtering preferences
2018-07-11 19:52:55 +03:00
Alexander Matyushentsev
d37b09b6bc Fix linter errors 2018-07-11 09:31:05 -07:00
Andrew Merenbach
5e60a65fc6 Merge pull request #5 from merenbach/support-force-delete
Support cascading delete
2018-07-10 16:42:00 -07:00
Andrew Merenbach
92125c51b6 Behold the glory of an anonymous component 2018-07-10 16:07:47 -07:00
Alexander Matyushentsev
4301fc6b58 Issue #337 - remember my resource filtering preferences 2018-07-10 15:16:23 -07:00
Andrew Merenbach
da1223aa57 Get working, but checkbox UI does not update 2018-07-10 15:09:09 -07:00
Alexander Matyushentsev
4330130017 Merge pull request #7 from alexmt/306-allow-redeploy-latest
Issue #306 - UI should allow redeploying most recent successful deployment from history
2018-07-11 00:52:23 +03:00
Andrew Merenbach
db8528c037 Another step 2018-07-10 14:51:05 -07:00
Andrew Merenbach
5cad0db347 Take initial steps toward checkbox for cascade 2018-07-10 14:51:05 -07:00
Andrew Merenbach
658f72fe84 Clean up query construction, thanks @alexmt 2018-07-10 14:51:05 -07:00
Andrew Merenbach
ee375a0224 Use proper backend var name for cascade 2018-07-10 14:51:05 -07:00
Andrew Merenbach
e3a912a46f Pass app context to show prompts in shared code 2018-07-10 14:51:05 -07:00
Andrew Merenbach
b94f3895db Support cascading now 2018-07-10 14:51:05 -07:00
Andrew Merenbach
4404df3903 Fix popup 2018-07-10 14:51:05 -07:00
Andrew Merenbach
a502d5215a Rm unnecessary semicolon, thanks linter 2018-07-10 14:51:05 -07:00
Andrew Merenbach
b64143d314 Factor out common app delete functionality 2018-07-10 14:51:05 -07:00
Andrew Merenbach
0148112676 Tweak error message 2018-07-10 14:51:05 -07:00
Alexander Matyushentsev
ceb838d559 Issue #306 - UI should allow redeploying most recent successful deployment from history 2018-07-10 12:35:18 -07:00
Alexander Matyushentsev
a30aff9454 Issue #352 - resource names are almost always truncated 2018-07-10 11:45:50 -07:00
Alexander Matyushentsev
47c756b243 Upgrade argo-ui dependency 2018-07-10 11:11:13 -07:00
Alexander Matyushentsev
afe84768a5 Remove unnecessary left side border on app status panel 2018-07-10 11:10:38 -07:00
Andrew Merenbach
6da644b669 Merge pull request #4 from merenbach/show-application-conditions
Place conditions into app details page
2018-07-09 15:40:00 -07:00
Andrew Merenbach
a02941cb99 Satisfy linter 2018-07-09 15:37:53 -07:00
Andrew Merenbach
4c8f02e35d Use table instead of white boxes 2018-07-09 13:40:43 -07:00
Andrew Merenbach
a7d2fddd07 Break out condition table into columns 2018-07-09 11:32:15 -07:00
Andrew Merenbach
01a3ce70cb Rm debugging test conditions 2018-07-09 10:52:28 -07:00
Andrew Merenbach
92adcf107c Tweak warning display, thanks @alexmt 2018-07-09 10:48:44 -07:00
Andrew Merenbach
cbf7b70a8d Add missing key, rm unneeded code, thanks @alexmt 2018-07-09 10:17:44 -07:00
Andrew Merenbach
579c230969 Add slideout conditions panel 2018-07-05 13:55:48 -07:00
Andrew Merenbach
561843d006 Display warning count at top of panel 2018-07-05 13:55:47 -07:00
Andrew Merenbach
f83ae97fbd Place conditions into app details page 2018-07-05 13:55:47 -07:00
Andrew Merenbach
35afec5884 Merge pull request #6 from merenbach/fix-events-truncation
Don't truncate columns in events table
2018-07-05 13:54:06 -07:00
Andrew Merenbach
ae41dba29f Don't truncate columns in events table 2018-07-05 12:24:44 -07:00
Andrew Merenbach
ebf808b0f9 Merge pull request #3 from merenbach/rm-app-url-namespace
Rm app url namespace
2018-06-28 13:58:03 -07:00
Andrew Merenbach
8a284f1726 Rm namespace from routing 2018-06-28 13:39:39 -07:00
Andrew Merenbach
530320ca6e Remove app URL namespace 2018-06-28 11:48:35 -07:00
Alexander Matyushentsev
e71bdcfdd6 Render project on app details page; implement filtering on app list page 2018-06-25 23:29:17 -07:00
Alexander Matyushentsev
fc49ca3438 Support option for app sync operation on app details page #289 2018-06-14 14:04:24 -07:00
Alexander Matyushentsev
a688d38165 Issue #231 - Display pod status on application details page 2018-06-14 12:40:36 -07:00
Alexander Matyushentsev
a3379dceec Issue #286 - Resource events tab on application details page 2018-06-14 10:29:51 -07:00
Alexander Matyushentsev
f5ad24f352 Restore missing loading indicator on application list page 2018-06-13 14:10:49 -07:00
Alexander Matyushentsev
ae8834a6f2 Fix NPE error 2018-06-12 15:38:32 -07:00
Alexander Matyushentsev
ccd6863ad4 Improve error messages 2018-06-12 11:15:59 -07:00
Alexander Matyushentsev
57ad86a222 Add health status details message 2018-06-12 09:25:50 -07:00
Alexander Matyushentsev
d8d32ec1f5 Visalize ksonnet app loading state on app creation wizard 2018-06-12 09:22:09 -07:00
Alexander Matyushentsev
56d06482fe Bug fixing: don't reset filter on app details page; add health/sync status icons to application list page 2018-06-11 11:23:18 -07:00
Andrew Merenbach
309f44a079 Merge pull request #2 from merenbach/app-list-redesign
Application list redesign
2018-06-07 10:27:02 -07:00
Andrew Merenbach
9401f94b78 Rename vars for clarity 2018-06-07 10:17:44 -07:00
Andrew Merenbach
fab12da4e7 Satisfy linter 2018-06-07 10:16:44 -07:00
Alexander Matyushentsev
4bd49b0bf6 Move logout button to right top corner 2018-06-07 10:16:32 -07:00
Alexander Matyushentsev
a972f76224 Reset app creation wizard state 2018-06-07 10:04:03 -07:00
Andrew Merenbach
f28cd3f709 Handle date subtraction now 2018-06-07 09:51:26 -07:00
Andrew Merenbach
c87d6ec182 Add app delete code 2018-06-06 17:20:50 -07:00
Andrew Merenbach
d4e781d48f Actually sync when requested 2018-06-06 17:17:19 -07:00
Andrew Merenbach
6e5efa1e09 Update spacing, sizing, casing 2018-06-06 17:03:14 -07:00
Andrew Merenbach
326489ff60 Add dropdown 2018-06-06 10:13:45 -07:00
Andrew Merenbach
62a7c160ab Fix indentation 2018-06-06 10:11:21 -07:00
Andrew Merenbach
13937ac7f9 Get 2-up layout 2018-06-06 09:24:02 -07:00
Andrew Merenbach
9128daf883 Follow BEM conventions for class names, thanks @alexmt 2018-06-06 09:24:02 -07:00
Andrew Merenbach
6caa019231 Use proper color names, thanks @alexmt 2018-06-06 09:24:02 -07:00
Andrew Merenbach
4055960757 Get border colors correct 2018-06-06 09:24:02 -07:00
Andrew Merenbach
88fa8bb8b2 Flesh out initial cell design a bit 2018-06-06 09:24:01 -07:00
Andrew Merenbach
269fcbb091 Start redesigning app list 2018-06-06 09:23:34 -07:00
Alexander Matyushentsev
a97ac8fadf Merge branch 'master' of github.com:argoproj/argo-cd-ui 2018-06-05 15:10:15 -07:00
Alexander Matyushentsev
93cbef4aeb Implement Application creation wizard 2018-06-05 15:09:44 -07:00
Alexander Matyushentsev
929f30c58b Issue #241 - Repositories list page 2018-06-04 11:57:28 -07:00
Andrew Merenbach
e59f5b1ba4 Merge pull request #1 from merenbach/update-bootstrap
Update upath plus getting started instructions in README
2018-05-30 08:51:31 -07:00
Andrew Merenbach
20c8b0cec9 Update upath to version 1.1.0 to resolve Node 10 incompatibility 2018-05-30 08:28:12 -07:00
Andrew Merenbach
9c0dc4e865 Fix README, thanks @alexmt 2018-05-30 08:27:55 -07:00
Andrew Merenbach
28e68a2a3c Clean up instructions a little more 2018-05-29 17:24:28 -07:00
Andrew Merenbach
a39d3f28e2 Update getting started instructions in README 2018-05-29 17:21:00 -07:00
Alexander Matyushentsev
2ba7eb83d2 Remove last redux dependency 2018-05-29 13:50:00 -07:00
Alexander Matyushentsev
d8129ba59f Move notification manager and popup manager to argo-ui 2018-05-29 13:43:37 -07:00
Alexander Matyushentsev
360c7e051e Fix default resource kind filtering bug 2018-05-24 17:03:24 -07:00
Alexander Matyushentsev
9a3425cfcd Issue #232 - Resource filtering on Application Details page 2018-05-24 16:00:39 -07:00
Alexander Matyushentsev
f5b0af521c Issue #235 - Allow viewing pod side car container logs 2018-05-24 12:47:34 -07:00
Alexander Matyushentsev
658126b7bc Issue #230 - Display operation state on application details page 2018-05-24 10:35:29 -07:00
Alexander Matyushentsev
196d168b65 Add confirmation message before starting application rollback 2018-05-23 11:53:32 -07:00
Alexander Matyushentsev
d71927a006 Extract notification manager implementation into separate class 2018-05-23 11:50:30 -07:00
Alexander Matyushentsev
8e8017531a Show confirmation message prior deleting application/pod 2018-05-23 11:39:40 -07:00
Alexander Matyushentsev
8be2660994 Render resource manifest on app details page 2018-05-23 10:05:04 -07:00
Alexander Matyushentsev
a34bae8905 Remove redux from app 2018-05-23 09:26:55 -07:00
Alexander Matyushentsev
01aaae9774 Remove redux usage from login page code 2018-05-23 09:08:35 -07:00
Alexander Matyushentsev
9e7a02e2b2 Remove redux usage from app list page code 2018-05-23 08:46:57 -07:00
Alexander Matyushentsev
470d4f1dec Remove redux usage from app details page code 2018-05-23 08:17:06 -07:00
Alexander Matyushentsev
65c2c6bb78 Remove redux-form usage 2018-05-22 13:47:06 -07:00
Alexander Matyushentsev
62b68a8892 Issue #184 - Allow downloading of argocd binaries directly from API server 2018-05-17 14:04:43 -07:00
Alexander Matyushentsev
c4c9ee4427 Rename recent deployments to history 2018-05-17 08:08:04 -07:00
Alexander Matyushentsev
44790ad1e1 Implement application status ui 2018-05-15 11:37:44 -07:00
Alexander Matyushentsev
9e3727a037 Issue #189 - switch to Spec.Destination.Server/Namespace fields 2018-05-14 10:53:09 -07:00
Alexander Matyushentsev
6721909257 Issue #118 - Provide return URL during sso authentication 2018-05-14 10:47:03 -07:00
Alexander Matyushentsev
26ffea9bed Issue #191 - ArgoCD UI s/rollback/history/ and s/deploy/sync/ 2018-05-14 10:15:02 -07:00
Alexander Matyushentsev
d8fb318253 Render health status icon on application details page 2018-05-14 10:11:46 -07:00
Alexander Matyushentsev
bb5dde23b8 SSO Login Button 2018-05-04 09:15:53 -07:00
Alexander Matyushentsev
94b2b0c208 Add env variable 2018-04-24 15:49:21 -07:00
Alexander Matyushentsev
e7a9f311c7 Update rollback UI 2018-04-24 13:37:52 -07:00
Alexander Matyushentsev
8156680b70 Allow specifying cluster and namespace during app creation 2018-04-20 15:51:30 -07:00
Alexander Matyushentsev
4d74e57bb6 Implement application login/logout 2018-04-19 15:48:11 -07:00
Alexander Matyushentsev
8ba3bf1e5f Merge branch 'master' of github.com:argoproj/argo-cd-ui 2018-04-18 14:29:01 -07:00
Alexander Matyushentsev
e16b3a25b3 Implement simple application creation/deletion form 2018-04-18 14:28:34 -07:00
Jesse Suen
972d5ff493 Add README.md 2018-04-17 16:49:02 -07:00
Alexander Matyushentsev
059f4e0748 Render additional details for pods and servies on application details page 2018-04-11 13:08:24 -07:00
Alexander Matyushentsev
9ae501c7ca Implement delete pod action 2018-04-09 10:46:12 -07:00
Alexander Matyushentsev
dffac4069d Implement logs rendering on application details page 2018-04-06 13:21:55 -07:00
Alexander Matyushentsev
5527b3a852 Improve application resources tree component: add resource kind labels, improve app icon 2018-04-06 09:44:41 -07:00
Alexander Matyushentsev
537e28a0ce Application details page should render resources tree 2018-04-06 09:14:03 -07:00
Alexander Matyushentsev
5382968864 Implement rollback UI draft 2018-03-29 09:41:59 -07:00
Alexander Matyushentsev
994474aead Render application deployment parameters 2018-03-26 15:34:55 -07:00
Alexander Matyushentsev
f38c1b3106 Implement ability to deploy any revision using web ui 2018-03-08 11:20:15 -08:00
Alexander Matyushentsev
ff3b5cc3c4 Add cluster URL and fix app namespace rendering on app list and app details pages 2018-03-01 15:13:11 -08:00
Alexander Matyushentsev
c9242b84f8 Change application details page title 2018-03-01 14:36:32 -08:00
Alexander Matyushentsev
94c8ff5e1b Implement deploy action on application details page 2018-03-01 11:20:27 -08:00
Alexander Matyushentsev
e2e5a7715c Fix status name typo 2018-03-01 08:37:13 -08:00
Alexander Matyushentsev
7fc6628934 Use resources field to render application resources status 2018-03-01 08:32:57 -08:00
Alexander Matyushentsev
f834803946 Add dockerfile and production build script 2018-02-28 20:47:26 -08:00
Alexander Matyushentsev
172aa7e47c Close stream connection when user navigate away from applications list page 2018-02-28 11:27:58 -08:00
Alexander Matyushentsev
6ea5b671e7 Implement applications list and application details page live update 2018-02-28 10:38:02 -08:00
Alexander Matyushentsev
80f373bc59 Implement components rendering on application details page 2018-02-28 09:10:12 -08:00
Alexander Matyushentsev
7de1908f48 Add lint command 2018-02-27 21:45:36 -08:00
Alexander Matyushentsev
d8ff73b702 Implement application details page 2018-02-27 14:14:59 -08:00
Alexander Matyushentsev
a0880c58a9 Implement applications list page 2018-02-27 13:32:13 -08:00
Alexander Matyushentsev
eab17ce9fb Initial commit 2018-02-26 19:23:14 -08:00
1524 changed files with 215067 additions and 312972 deletions

View File

@@ -1,107 +0,0 @@
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: argo-cd-ci-
spec:
entrypoint: argo-cd-ci
arguments:
parameters:
- name: revision
value: master
- name: repo
value: https://github.com/argoproj/argo-cd.git
templates:
- name: argo-cd-ci
steps:
- - name: build
template: ci-dind
arguments:
parameters:
- name: cmd
value: "{{item}}"
withItems:
- make controller-image server-image repo-server-image
- name: test
template: ci-builder
arguments:
parameters:
- name: cmd
value: "{{item}}"
withItems:
- dep ensure && make cli lint
- name: test-coverage
template: ci-builder
arguments:
parameters:
- name: cmd
value: "dep ensure && go get github.com/mattn/goveralls && make test-coverage"
- name: test-e2e
template: ci-builder
arguments:
parameters:
- name: cmd
value: "dep ensure && make test-e2e"
- name: ci-builder
inputs:
parameters:
- name: cmd
artifacts:
- name: code
path: /go/src/github.com/argoproj/argo-cd
git:
repo: "{{workflow.parameters.repo}}"
revision: "{{workflow.parameters.revision}}"
container:
image: argoproj/argo-cd-ci-builder:latest
command: [sh, -c]
args: ["mkfifo pipe; tee /tmp/logs.txt < pipe & {{inputs.parameters.cmd}} > pipe"]
workingDir: /go/src/github.com/argoproj/argo-cd
env:
- name: COVERALLS_TOKEN
valueFrom:
secretKeyRef:
name: coverall-token
key: coverall-token
resources:
requests:
memory: 1024Mi
cpu: 200m
outputs:
artifacts:
- name: logs
path: /tmp/logs.txt
- name: ci-dind
inputs:
parameters:
- name: cmd
artifacts:
- name: code
path: /go/src/github.com/argoproj/argo-cd
git:
repo: "{{workflow.parameters.repo}}"
revision: "{{workflow.parameters.revision}}"
container:
image: argoproj/argo-cd-ci-builder:latest
command: [sh, -c]
args: ["mkfifo pipe; tee /tmp/logs.txt < pipe & until docker ps; do sleep 3; done && {{inputs.parameters.cmd}} > pipe"]
workingDir: /go/src/github.com/argoproj/argo-cd
env:
- name: DOCKER_HOST
value: 127.0.0.1
resources:
requests:
memory: 1024Mi
cpu: 200m
sidecars:
- name: dind
image: docker:17.10-dind
securityContext:
privileged: true
mirrorVolumeMounts: true
outputs:
artifacts:
- name: logs
path: /tmp/logs.txt

17
.codecov.yml Normal file
View File

@@ -0,0 +1,17 @@
ignore:
- "**/*.pb.go"
- "**/*.pb.gw.go"
- "**/*generated.go"
- "**/*generated.deepcopy.go"
- "**/*_test.go"
- "pkg/apis/client/.*"
- "pkg/client/.*"
- "vendor/.*"
coverage:
status:
# we've found this not to be useful
patch: off
project:
default:
# allow test coverage to drop by 2%, assume that it's typically due to CI problems
threshold: 2

View File

@@ -1,4 +1,13 @@
# Prevent vendor directory from being copied to ensure we are not not pulling unexpected cruft from
# a user's workspace, and are only building off of what is locked by dep.
vendor
dist
.vscode/
.idea/
.DS_Store
vendor/
dist/
*.iml
# delve debug binaries
cmd/**/debug
debug.test
coverage.out
ui/node_modules/

43
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@@ -0,0 +1,43 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: 'bug'
assignees: ''
---
If you are trying to resolve an environment-specific issue or have a one-off question about the edge case that does not require a feature then please consider asking a question in argocd slack [channel](https://argoproj.github.io/community/join-slack).
Checklist:
* [ ] I've searched in the docs and FAQ for my answer: https://bit.ly/argocd-faq.
* [ ] I've included steps to reproduce the bug.
* [ ] I've pasted the output of `argocd version`.
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
A list of the steps required to reproduce the issue. Best of all, give us the URL to a repository that exhibits this issue.
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Version**
```shell
Paste the output from `argocd version` here.
```
**Logs**
```
Paste any relevant application logs here.
```

12
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@@ -0,0 +1,12 @@
blank_issues_enabled: false
contact_links:
- name: Have you read the docs?
url: https://argo-cd.readthedocs.io/
about: Much help can be found in the docs
- name: Ask a question
url: https://github.com/argoproj/argo-cd/discussions/new
about: Ask a question or start a discussion about Argo CD
- name: Chat on Slack
url: https://argoproj.github.io/community/join-slack
about: Maybe chatting with the community can help

View File

@@ -0,0 +1,18 @@
---
name: Enhancement proposal
about: Propose an enhancement for this project
title: ''
labels: 'enhancement'
assignees: ''
---
# Summary
What change you think needs making.
# Motivation
Please give examples of your use case, e.g. when would you use this.
# Proposal
How do you think this should be implemented?

1
.github/no-response.yml vendored Normal file
View File

@@ -0,0 +1 @@
# See https://github.com/probot/no-response

17
.github/pull_request_template.md vendored Normal file
View File

@@ -0,0 +1,17 @@
Note on DCO:
If the DCO action in the integration test fails, one or more of your commits are not signed off. Please click on the *Details* link next to the DCO action for instructions on how to resolve this.
Checklist:
* [ ] Either (a) I've created an [enhancement proposal](https://github.com/argoproj/argo-cd/issues/new/choose) and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
* [ ] The title of the PR states what changed and the related issues number (used for the release note).
* [ ] I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
* [ ] I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
* [ ] Does this PR require documentation updates?
* [ ] I've updated documentation as required by this PR.
* [ ] Optional. My organization is added to USERS.md.
* [ ] I have signed off all my commits as required by [DCO](https://github.com/argoproj/argoproj/tree/master/community#contributing-to-argo)
* [ ] I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
* [ ] My build is green ([troubleshooting builds](https://argo-cd.readthedocs.io/en/latest/developer-guide/ci/)).

4
.github/stale.yml vendored Normal file
View File

@@ -0,0 +1,4 @@
# See https://github.com/probot/stale
# See https://github.com/probot/stale
exemptLabels:
- backlog

427
.github/workflows/ci-build.yaml vendored Normal file
View File

@@ -0,0 +1,427 @@
name: Integration tests
on:
push:
branches:
- 'master'
- 'release-*'
- '!release-1.4'
- '!release-1.5'
pull_request:
branches:
- 'master'
jobs:
build-docker:
name: Build Docker image
runs-on: ubuntu-latest
if: github.head_ref != ''
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build Docker image
run: |
make image
check-go:
name: Ensure Go modules synchronicity
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Golang
uses: actions/setup-go@v1
with:
go-version: '1.14.12'
- name: Download all Go modules
run: |
go mod download
- name: Check for tidyness of go.mod and go.sum
run: |
go mod tidy
git diff --exit-code -- .
build-go:
name: Build & cache Go code
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Golang
uses: actions/setup-go@v1
with:
go-version: '1.14.12'
- name: Restore go build cache
uses: actions/cache@v1
with:
path: ~/.cache/go-build
key: ${{ runner.os }}-go-build-v1-${{ github.run_id }}
- name: Download all Go modules
run: |
go mod download
- name: Compile all packages
run: make build-local
lint-go:
name: Lint Go code
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.29
args: --timeout 5m --exclude SA5011
test-go:
name: Run unit tests for Go packages
runs-on: ubuntu-latest
needs:
- build-go
steps:
- name: Create checkout directory
run: mkdir -p ~/go/src/github.com/argoproj
- name: Checkout code
uses: actions/checkout@v2
- name: Create symlink in GOPATH
run: ln -s $(pwd) ~/go/src/github.com/argoproj/argo-cd
- name: Setup Golang
uses: actions/setup-go@v1
with:
go-version: '1.14.12'
- name: Install required packages
run: |
sudo apt-get install git -y
- name: Switch to temporal branch so we re-attach head
run: |
git switch -c temporal-pr-branch
git status
- name: Fetch complete history for blame information
run: |
git fetch --prune --no-tags --depth=1 origin +refs/heads/*:refs/remotes/origin/*
- name: Add ~/go/bin to PATH
run: |
echo "/home/runner/go/bin" >> $GITHUB_PATH
- name: Add /usr/local/bin to PATH
run: |
echo "/usr/local/bin" >> $GITHUB_PATH
- name: Restore go build cache
uses: actions/cache@v1
with:
path: ~/.cache/go-build
key: ${{ runner.os }}-go-build-v1-${{ github.run_id }}
- name: Install all tools required for building & testing
run: |
make install-test-tools-local
- name: Setup git username and email
run: |
git config --global user.name "John Doe"
git config --global user.email "john.doe@example.com"
- name: Download and vendor all required packages
run: |
go mod download
- name: Run all unit tests
run: make test-local
- name: Generate code coverage artifacts
uses: actions/upload-artifact@v2
with:
name: code-coverage
path: coverage.out
- name: Generate test results artifacts
uses: actions/upload-artifact@v2
with:
name: test-results
path: test-results/
test-go-race:
name: Run unit tests with -race, for Go packages
runs-on: ubuntu-latest
needs:
- build-go
steps:
- name: Create checkout directory
run: mkdir -p ~/go/src/github.com/argoproj
- name: Checkout code
uses: actions/checkout@v2
- name: Create symlink in GOPATH
run: ln -s $(pwd) ~/go/src/github.com/argoproj/argo-cd
- name: Setup Golang
uses: actions/setup-go@v1
with:
go-version: '1.14.12'
- name: Install required packages
run: |
sudo apt-get install git -y
- name: Switch to temporal branch so we re-attach head
run: |
git switch -c temporal-pr-branch
git status
- name: Fetch complete history for blame information
run: |
git fetch --prune --no-tags --depth=1 origin +refs/heads/*:refs/remotes/origin/*
- name: Add ~/go/bin to PATH
run: |
echo "/home/runner/go/bin" >> $GITHUB_PATH
- name: Add /usr/local/bin to PATH
run: |
echo "/usr/local/bin" >> $GITHUB_PATH
- name: Restore go build cache
uses: actions/cache@v1
with:
path: ~/.cache/go-build
key: ${{ runner.os }}-go-build-v1-${{ github.run_id }}
- name: Install all tools required for building & testing
run: |
make install-test-tools-local
- name: Setup git username and email
run: |
git config --global user.name "John Doe"
git config --global user.email "john.doe@example.com"
- name: Download and vendor all required packages
run: |
go mod download
- name: Run all unit tests
run: make test-race-local
- name: Generate test results artifacts
uses: actions/upload-artifact@v2
with:
name: race-results
path: test-results/
codegen:
name: Check changes to generated code
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Golang
uses: actions/setup-go@v1
with:
go-version: '1.14.12'
- name: Create symlink in GOPATH
run: |
mkdir -p ~/go/src/github.com/argoproj
cp -a ../argo-cd ~/go/src/github.com/argoproj
- name: Add ~/go/bin to PATH
run: |
echo "/home/runner/go/bin" >> $GITHUB_PATH
- name: Add /usr/local/bin to PATH
run: |
echo "/usr/local/bin" >> $GITHUB_PATH
- name: Download & vendor dependencies
run: |
# We need to vendor go modules for codegen yet
go mod download
go mod vendor -v
working-directory: /home/runner/go/src/github.com/argoproj/argo-cd
- name: Install toolchain for codegen
run: |
make install-codegen-tools-local
make install-go-tools-local
working-directory: /home/runner/go/src/github.com/argoproj/argo-cd
- name: Initialize local Helm
run: |
helm2 init --client-only
- name: Run codegen
run: |
set -x
export GOPATH=$(go env GOPATH)
git checkout -- go.mod go.sum
make codegen-local
working-directory: /home/runner/go/src/github.com/argoproj/argo-cd
- name: Check nothing has changed
run: |
set -xo pipefail
git diff --exit-code -- . ':!go.sum' ':!go.mod' ':!assets/swagger.json' | tee codegen.patch
working-directory: /home/runner/go/src/github.com/argoproj/argo-cd
build-ui:
name: Build, test & lint UI code
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup NodeJS
uses: actions/setup-node@v1
with:
node-version: '12.18.4'
- name: Restore node dependency cache
id: cache-dependencies
uses: actions/cache@v1
with:
path: ui/node_modules
key: ${{ runner.os }}-node-dep-v2-${{ hashFiles('**/yarn.lock') }}
- name: Install node dependencies
run: |
cd ui && yarn install --frozen-lockfile --ignore-optional --non-interactive
- name: Build UI code
run: |
yarn test
yarn build
env:
NODE_ENV: production
working-directory: ui/
- name: Run ESLint
run: yarn lint
working-directory: ui/
analyze:
name: Process & analyze test artifacts
runs-on: ubuntu-latest
needs:
- test-go
- build-ui
env:
sonar_secret: ${{ secrets.SONAR_TOKEN }}
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Restore node dependency cache
id: cache-dependencies
uses: actions/cache@v1
with:
path: ui/node_modules
key: ${{ runner.os }}-node-dep-v2-${{ hashFiles('**/yarn.lock') }}
- name: Remove other node_modules directory
run: |
rm -rf ui/node_modules/argo-ui/node_modules
- name: Create test-results directory
run: |
mkdir -p test-results
- name: Get code coverage artifiact
uses: actions/download-artifact@v2
with:
name: code-coverage
- name: Get test result artifact
uses: actions/download-artifact@v2
with:
name: test-results
path: test-results
- name: Upload code coverage information to codecov.io
uses: codecov/codecov-action@v1
with:
file: coverage.out
- name: Perform static code analysis using SonarCloud
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SCANNER_VERSION: 4.2.0.1873
SCANNER_PATH: /tmp/cache/scanner
OS: linux
run: |
# We do not use the provided action, because it does contain an old
# version of the scanner, and also takes time to build.
set -e
mkdir -p ${SCANNER_PATH}
export SONAR_USER_HOME=${SCANNER_PATH}/.sonar
if [[ ! -x "${SCANNER_PATH}/sonar-scanner-${SCANNER_VERSION}-${OS}/bin/sonar-scanner" ]]; then
curl -Ol https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SCANNER_VERSION}-${OS}.zip
unzip -qq -o sonar-scanner-cli-${SCANNER_VERSION}-${OS}.zip -d ${SCANNER_PATH}
fi
chmod +x ${SCANNER_PATH}/sonar-scanner-${SCANNER_VERSION}-${OS}/bin/sonar-scanner
chmod +x ${SCANNER_PATH}/sonar-scanner-${SCANNER_VERSION}-${OS}/jre/bin/java
# Explicitly set NODE_MODULES
export NODE_MODULES=${PWD}/ui/node_modules
export NODE_PATH=${PWD}/ui/node_modules
${SCANNER_PATH}/sonar-scanner-${SCANNER_VERSION}-${OS}/bin/sonar-scanner
if: env.sonar_secret != ''
test-e2e:
name: Run end-to-end tests
runs-on: ubuntu-latest
strategy:
matrix:
k3s-version: [v1.20.2, v1.19.2, v1.18.9, v1.17.11, v1.16.15]
needs:
- build-go
env:
GOPATH: /home/runner/go
ARGOCD_FAKE_IN_CLUSTER: "true"
ARGOCD_SSH_DATA_PATH: "/tmp/argo-e2e/app/config/ssh"
ARGOCD_TLS_DATA_PATH: "/tmp/argo-e2e/app/config/tls"
ARGOCD_E2E_SSH_KNOWN_HOSTS: "../fixture/certs/ssh_known_hosts"
ARGOCD_E2E_K3S: "true"
ARGOCD_IN_CI: "true"
ARGOCD_E2E_APISERVER_PORT: "8088"
ARGOCD_SERVER: "127.0.0.1:8088"
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Golang
uses: actions/setup-go@v1
with:
go-version: '1.14.12'
- name: Install K3S
env:
INSTALL_K3S_VERSION: ${{ matrix.k3s-version }}+k3s1
run: |
set -x
curl -sfL https://get.k3s.io | sh -
sudo chmod -R a+rw /etc/rancher/k3s
sudo mkdir -p $HOME/.kube && sudo chown -R runner $HOME/.kube
sudo k3s kubectl config view --raw > $HOME/.kube/config
sudo chown runner $HOME/.kube/config
kubectl version
- name: Restore go build cache
uses: actions/cache@v1
with:
path: ~/.cache/go-build
key: ${{ runner.os }}-go-build-v1-${{ github.run_id }}
- name: Add ~/go/bin to PATH
run: |
echo "/home/runner/go/bin" >> $GITHUB_PATH
- name: Add /usr/local/bin to PATH
run: |
echo "/usr/local/bin" >> $GITHUB_PATH
- name: Download Go dependencies
run: |
go mod download
go get github.com/mattn/goreman
- name: Install all tools required for building & testing
run: |
make install-test-tools-local
- name: Setup git username and email
run: |
git config --global user.name "John Doe"
git config --global user.email "john.doe@example.com"
- name: Pull Docker image required for tests
run: |
docker pull quay.io/dexidp/dex:v2.25.0
docker pull argoproj/argo-cd-ci-builder:v1.0.0
docker pull redis:5.0.10-alpine
- name: Create target directory for binaries in the build-process
run: |
mkdir -p dist
chown runner dist
- name: Run E2E server and wait for it being available
timeout-minutes: 30
run: |
set -x
# Something is weird in GH runners -- there's a phantom listener for
# port 8080 which is not visible in netstat -tulpen, but still there
# with a HTTP listener. We have API server listening on port 8088
# instead.
make start-e2e-local 2>&1 | sed -r "s/[[:cntrl:]]\[[0-9]{1,3}m//g" > /tmp/e2e-server.log &
count=1
until curl -f http://127.0.0.1:8088/healthz; do
sleep 10;
if test $count -ge 60; then
echo "Timeout"
exit 1
fi
count=$((count+1))
done
- name: Run E2E testsuite
run: |
set -x
make test-e2e-local
- name: Upload e2e-server logs
uses: actions/upload-artifact@v2
with:
name: e2e-server-k8s${{ matrix.k3s-version }}.log
path: /tmp/e2e-server.log
if: ${{ failure() }}

52
.github/workflows/codeql.yml vendored Normal file
View File

@@ -0,0 +1,52 @@
name: "Code scanning - action"
on:
push:
pull_request:
schedule:
- cron: '0 19 * * 0'
jobs:
CodeQL-Build:
# CodeQL runs on ubuntu-latest and windows-latest
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2
# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
# Override language selection by uncommenting this and choosing your languages
# with:
# languages: go, javascript, csharp, python, cpp, java
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

30
.github/workflows/gh-pages.yaml vendored Normal file
View File

@@ -0,0 +1,30 @@
name: Deploy
on:
push:
branches:
- master
pull_request:
branches:
- 'master'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.x
- name: build
run: |
pip install -r docs/requirements.txt
mkdocs build
- name: deploy
if: ${{ github.event_name == 'push' }}
uses: peaceiris/actions-gh-pages@v2.5.0
env:
PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: ./site

50
.github/workflows/image.yaml vendored Normal file
View File

@@ -0,0 +1,50 @@
name: Image
on:
push:
branches:
- master
jobs:
publish:
runs-on: ubuntu-latest
env:
GOPATH: /home/runner/work/argo-cd/argo-cd
steps:
- uses: actions/setup-go@v1
with:
go-version: '1.14.12'
- uses: actions/checkout@master
with:
path: src/github.com/argoproj/argo-cd
# get image tag
- run: echo ::set-output name=tag::$(cat ./VERSION)-${GITHUB_SHA::8}
working-directory: ./src/github.com/argoproj/argo-cd
id: image
# build
- run: |
docker images -a --format "{{.ID}}" | xargs -I {} docker rmi {}
make image DEV_IMAGE=true DOCKER_PUSH=false IMAGE_NAMESPACE=docker.pkg.github.com/argoproj/argo-cd IMAGE_TAG=${{ steps.image.outputs.tag }}
working-directory: ./src/github.com/argoproj/argo-cd
# publish
- run: |
docker login docker.pkg.github.com --username $USERNAME --password $PASSWORD
docker push docker.pkg.github.com/argoproj/argo-cd/argocd:${{ steps.image.outputs.tag }}
env:
USERNAME: ${{ secrets.USERNAME }}
PASSWORD: ${{ secrets.TOKEN }}
# deploy
- run: git clone "https://$TOKEN@github.com/argoproj/argoproj-deployments"
env:
TOKEN: ${{ secrets.TOKEN }}
- run: |
docker run -v $(pwd):/src -w /src --rm -t lyft/kustomizer:v3.3.0 kustomize edit set image quay.io/argoproj/argocd=docker.pkg.github.com/argoproj/argo-cd/argocd:${{ steps.image.outputs.tag }}
git config --global user.email 'ci@argoproj.com'
git config --global user.name 'CI'
git diff --exit-code && echo 'Already deployed' || (git commit -am 'Upgrade argocd to ${{ steps.image.outputs.tag }}' && git push)
working-directory: argoproj-deployments/argocd
# TODO: clean up old images once github supports it: https://github.community/t5/How-to-use-Git-and-GitHub/Deleting-images-from-Github-Package-Registry/m-p/41202/thread-id/9811

311
.github/workflows/release.yaml vendored Normal file
View File

@@ -0,0 +1,311 @@
name: Create ArgoCD release
on:
push:
tags:
- 'release-v*'
- '!release-v1.5*'
- '!release-v1.4*'
- '!release-v1.3*'
- '!release-v1.2*'
- '!release-v1.1*'
- '!release-v1.0*'
- '!release-v0*'
jobs:
prepare-release:
name: Perform automatic release on trigger ${{ github.ref }}
runs-on: ubuntu-latest
env:
# The name of the tag as supplied by the GitHub event
SOURCE_TAG: ${{ github.ref }}
# The image namespace where Docker image will be published to
IMAGE_NAMESPACE: argoproj
# Whether to create & push image and release assets
DRY_RUN: false
# Whether a draft release should be created, instead of public one
DRAFT_RELEASE: false
# Whether to update homebrew with this release as well
# Set RELEASE_HOMEBREW_TOKEN secret in repository for this to work - needs
# access to public repositories
UPDATE_HOMEBREW: false
# Name of the GitHub user for Git config
GIT_USERNAME: argo-bot
# E-Mail of the GitHub user for Git config
GIT_EMAIL: argoproj@gmail.com
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Check if the published tag is well formed and setup vars
run: |
set -xue
# Target version must match major.minor.patch and optional -rcX suffix
# where X must be a number.
TARGET_VERSION=${SOURCE_TAG#*release-v}
if ! echo "${TARGET_VERSION}" | egrep '^[0-9]+\.[0-9]+\.[0-9]+(-rc[0-9]+)*$'; then
echo "::error::Target version '${TARGET_VERSION}' is malformed, refusing to continue." >&2
exit 1
fi
# Target branch is the release branch we're going to operate on
# Its name is 'release-<major>.<minor>'
TARGET_BRANCH="release-${TARGET_VERSION%\.[0-9]*}"
# The release tag is the source tag, minus the release- prefix
RELEASE_TAG="${SOURCE_TAG#*release-}"
# Whether this is a pre-release (indicated by -rc suffix)
PRE_RELEASE=false
if echo "${RELEASE_TAG}" | egrep -- '-rc[0-9]+$'; then
PRE_RELEASE=true
fi
# We must not have a release trigger within the same release branch,
# because that means a release for this branch is already running.
if git tag -l | grep "release-v${TARGET_VERSION%\.[0-9]*}" | grep -v "release-v${TARGET_VERSION}"; then
echo "::error::Another release for branch ${TARGET_BRANCH} is currently in progress."
exit 1
fi
# Ensure that release do not yet exist
if git rev-parse ${RELEASE_TAG}; then
echo "::error::Release tag ${RELEASE_TAG} already exists in repository. Refusing to continue."
exit 1
fi
# Make the variables available in follow-up steps
echo "TARGET_VERSION=${TARGET_VERSION}" >> $GITHUB_ENV
echo "TARGET_BRANCH=${TARGET_BRANCH}" >> $GITHUB_ENV
echo "RELEASE_TAG=${RELEASE_TAG}" >> $GITHUB_ENV
echo "PRE_RELEASE=${PRE_RELEASE}" >> $GITHUB_ENV
- name: Check if our release tag has a correct annotation
run: |
set -ue
# Fetch all tag information as well
git fetch --prune --tags --force
echo "=========== BEGIN COMMIT MESSAGE ============="
git show ${SOURCE_TAG}
echo "============ END COMMIT MESSAGE =============="
# Quite dirty hack to get the release notes from the annotated tag
# into a temporary file.
RELEASE_NOTES=$(mktemp -p /tmp release-notes.XXXXXX)
prefix=true
begin=false
git show ${SOURCE_TAG} | while read line; do
# Whatever is in commit history for the tag, we only want that
# annotation from our tag. We discard everything else.
if test "$begin" = "false"; then
if echo "$line" | grep -q "tag ${SOURCE_TAG#refs/tags/}"; then begin="true"; fi
continue
fi
if test "$prefix" = "true"; then
if test -z "$line"; then prefix=false; fi
else
if echo "$line" | egrep -q '^commit [0-9a-f]+'; then
break
fi
echo "$line" >> ${RELEASE_NOTES}
fi
done
# For debug purposes
echo "============BEGIN RELEASE NOTES================="
cat ${RELEASE_NOTES}
echo "=============END RELEASE NOTES=================="
# Too short release notes are suspicious. We need at least 100 bytes.
relNoteLen=$(stat -c '%s' $RELEASE_NOTES)
if test $relNoteLen -lt 100; then
echo "::error::No release notes provided in tag annotation (or tag is not annotated)"
exit 1
fi
# Check for magic string '## Quick Start' in head of release notes
if ! head -2 ${RELEASE_NOTES} | grep -iq '## Quick Start'; then
echo "::error::Release notes seem invalid, quick start section not found."
exit 1
fi
# We store path to temporary release notes file for later reading, we
# need it when creating release.
echo "RELEASE_NOTES=${RELEASE_NOTES}" >> $GITHUB_ENV
- name: Setup Golang
uses: actions/setup-go@v1
with:
go-version: '1.14.12'
- name: Setup Git author information
run: |
set -ue
git config --global user.email "${GIT_EMAIL}"
git config --global user.name "${GIT_USERNAME}"
- name: Checkout corresponding release branch
run: |
set -ue
echo "Switching to release branch '${TARGET_BRANCH}'"
if ! git checkout ${TARGET_BRANCH}; then
echo "::error::Checking out release branch '${TARGET_BRANCH}' for target version '${TARGET_VERSION}' (tagged '${RELEASE_TAG}') failed. Does it exist in repo?"
exit 1
fi
- name: Create VERSION information
run: |
set -ue
echo "Bumping version from $(cat VERSION) to ${TARGET_VERSION}"
echo "${TARGET_VERSION}" > VERSION
git commit -m "Bump version to ${TARGET_VERSION}" VERSION
- name: Generate new set of manifests
run: |
set -ue
make install-codegen-tools-local
helm2 init --client-only
make manifests-local VERSION=${TARGET_VERSION}
git diff
git commit manifests/ -m "Bump version to ${TARGET_VERSION}"
- name: Create the release tag
run: |
set -ue
echo "Creating release ${RELEASE_TAG}"
git tag ${RELEASE_TAG}
- name: Build Docker image for release
run: |
set -ue
git clean -fd
mkdir -p dist/
make image IMAGE_TAG="${TARGET_VERSION}" DOCKER_PUSH=false
make release-cli
chmod +x ./dist/argocd-linux-amd64
./dist/argocd-linux-amd64 version --client
if: ${{ env.DRY_RUN != 'true' }}
- name: Push docker image to repository
env:
DOCKER_USERNAME: ${{ secrets.RELEASE_DOCKERHUB_USERNAME }}
DOCKER_TOKEN: ${{ secrets.RELEASE_DOCKERHUB_TOKEN }}
QUAY_USERNAME: ${{ secrets.RELEASE_QUAY_USERNAME }}
QUAY_TOKEN: ${{ secrets.RELEASE_QUAY_TOKEN }}
run: |
set -ue
docker login --username "${DOCKER_USERNAME}" --password "${DOCKER_TOKEN}"
docker push ${IMAGE_NAMESPACE}/argocd:v${TARGET_VERSION}
docker login quay.io --username "${QUAY_USERNAME}" --password "${QUAY_TOKEN}"
docker tag ${IMAGE_NAMESPACE}/argocd:v${TARGET_VERSION} quay.io/${IMAGE_NAMESPACE}/argocd:v${TARGET_VERSION}
docker push quay.io/${IMAGE_NAMESPACE}/argocd:v${TARGET_VERSION}
if: ${{ env.DRY_RUN != 'true' }}
- name: Read release notes file
id: release-notes
uses: juliangruber/read-file-action@v1
with:
path: ${{ env.RELEASE_NOTES }}
- name: Push changes to release branch
run: |
set -ue
git push origin ${TARGET_BRANCH}
git push origin ${RELEASE_TAG}
- name: Create GitHub release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
id: create_release
with:
tag_name: ${{ env.RELEASE_TAG }}
release_name: ${{ env.RELEASE_TAG }}
draft: ${{ env.DRAFT_RELEASE }}
prerelease: ${{ env.PRE_RELEASE }}
body: ${{ steps.release-notes.outputs.content }}
- name: Upload argocd-linux-amd64 binary to release assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/argocd-linux-amd64
asset_name: argocd-linux-amd64
asset_content_type: application/octet-stream
if: ${{ env.DRY_RUN != 'true' }}
- name: Upload argocd-darwin-amd64 binary to release assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/argocd-darwin-amd64
asset_name: argocd-darwin-amd64
asset_content_type: application/octet-stream
if: ${{ env.DRY_RUN != 'true' }}
- name: Upload argocd-windows-amd64 binary to release assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/argocd-windows-amd64.exe
asset_name: argocd-windows-amd64.exe
asset_content_type: application/octet-stream
if: ${{ env.DRY_RUN != 'true' }}
# include argocd-util as part of release artifacts (argoproj/argo-cd#5174)
- name: Upload argocd-util-linux-amd64 binary to release assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/argocd-linux-amd64
asset_name: argocd-util-linux-amd64
asset_content_type: application/octet-stream
if: ${{ env.DRY_RUN != 'true' }}
- name: Upload argocd-util-darwin-amd64 binary to release assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/argocd-darwin-amd64
asset_name: argocd-util-darwin-amd64
asset_content_type: application/octet-stream
if: ${{ env.DRY_RUN != 'true' }}
- name: Upload argocd-util-windows-amd64 binary to release assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/argocd-windows-amd64.exe
asset_name: argocd-util-windows-amd64.exe
asset_content_type: application/octet-stream
if: ${{ env.DRY_RUN != 'true' }}
- name: Update homebrew formula
env:
HOMEBREW_TOKEN: ${{ secrets.RELEASE_HOMEBREW_TOKEN }}
uses: dawidd6/action-homebrew-bump-formula@v3
with:
token: ${{env.HOMEBREW_TOKEN}}
formula: argocd
if: ${{ env.HOMEBREW_TOKEN != '' && env.UPDATE_HOMEBREW == 'true' && env.PRE_RELEASE != 'true' }}
- name: Delete original request tag from repository
run: |
set -ue
git push --delete origin ${SOURCE_TAG}
if: ${{ always() }}

12
.gitignore vendored
View File

@@ -3,8 +3,20 @@
.DS_Store
vendor/
dist/
site/
*.iml
# delve debug binaries
cmd/**/debug
debug.test
coverage.out
test-results
.scannerwork
.scratch
node_modules/
# ignore built binaries
cmd/argocd/argocd
cmd/argocd-application-controller/argocd-application-controller
cmd/argocd-repo-server/argocd-repo-server
cmd/argocd-server/argocd-server
cmd/argocd-util/argocd-util

22
.golangci.yml Normal file
View File

@@ -0,0 +1,22 @@
run:
timeout: 2m
skip-files:
- ".*\\.pb\\.go"
skip-dirs:
- pkg/client/
- vendor/
linters:
enable:
- vet
- deadcode
- goimports
- varcheck
- structcheck
- ineffassign
- unconvert
- unparam
linters-settings:
goimports:
local-prefixes: github.com/argoproj/argo-cd
service:
golangci-lint-version: 1.21.0

7
.readthedocs.yml Normal file
View File

@@ -0,0 +1,7 @@
version: 2
formats: all
mkdocs:
fail_on_warning: false
python:
install:
- requirements: docs/requirements.txt

File diff suppressed because it is too large Load Diff

View File

@@ -1,77 +0,0 @@
## Requirements
Make sure you have following tools installed
* [docker](https://docs.docker.com/install/#supported-platforms)
* [golang](https://golang.org/)
* [dep](https://github.com/golang/dep)
* [protobuf](https://developers.google.com/protocol-buffers/)
* [ksonnet](https://github.com/ksonnet/ksonnet#install)
* [helm](https://github.com/helm/helm/releases)
* [kustomize](https://github.com/kubernetes-sigs/kustomize/releases)
* [go-swagger](https://github.com/go-swagger/go-swagger/blob/master/docs/install.md)
* [jq](https://stedolan.github.io/jq/)
* [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/).
```
$ brew tap go-swagger/go-swagger
$ brew install go dep protobuf kubectl ksonnet/tap/ks kubernetes-helm jq go-swagger
$ go get -u github.com/golang/protobuf/protoc-gen-go
$ go get -u github.com/go-swagger/go-swagger/cmd/swagger
$ go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
$ go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
```
Nice to have [gometalinter](https://github.com/alecthomas/gometalinter) and [goreman](https://github.com/mattn/goreman):
```
$ go get -u gopkg.in/alecthomas/gometalinter.v2 github.com/mattn/goreman && gometalinter.v2 --install
```
## Building
```
$ go get -u github.com/argoproj/argo-cd
$ dep ensure
$ make
```
NOTE: The make command can take a while, and we recommend building the specific component you are working on
* `make cli` - Make the argocd CLI tool
* `make server` - Make the API/repo/controller server
* `make codegen` - Builds protobuf and swagger files
* `make argocd-util` - Make the administrator's utility, used for certain tasks such as import/export
## Generating ArgoCD manifests for a specific image repository/tag
During development, the `update-manifests.sh` script, can be used to conveniently regenerate the
ArgoCD installation manifests with a customized image namespace and tag. This enables developers
to easily apply manifests which are using the images that they pushed into their personal container
repository.
```
$ IMAGE_NAMESPACE=jessesuen IMAGE_TAG=latest ./hack/update-manifests.sh
$ kubectl apply -n argocd -f ./manifests/install.yaml
```
## Running locally
You need to have access to kubernetes cluster (including [minikube](https://kubernetes.io/docs/tasks/tools/install-minikube/) or [docker edge](https://docs.docker.com/docker-for-mac/install/) ) in order to run Argo CD on your laptop:
* install kubectl: `brew install kubectl`
* make sure `kubectl` is connected to your cluster (e.g. `kubectl get pods` should work).
* install application CRD using following command:
```
$ kubectl create -f install/manifests/01_application-crd.yaml
```
* start Argo CD services using [goreman](https://github.com/mattn/goreman):
```
$ goreman start
```
## Troubleshooting
* Ensure argocd is installed: ./dist/argocd install
* Ensure you're logged in: ./dist/argocd login --username admin --password <whatever password you set at install> localhost:8080
* Ensure that roles are configured: kubectl create -f install/manifests/02c_argocd-rbac-cm.yaml
* Ensure minikube is running: minikube stop && minikube start
* Ensure Argo CD is aware of minikube: ./dist/argocd cluster add minikube

View File

@@ -1,12 +1,19 @@
ARG BASE_IMAGE=ubuntu:20.10
####################################################################################################
# Builder image
# Initial stage which pulls prepares build dependencies and CLI tooling we need for our final image
# Also used as the image in CI jobs so needs all dependencies
####################################################################################################
FROM golang:1.10.3 as builder
FROM golang:1.14.12 as builder
RUN echo 'deb http://deb.debian.org/debian buster-backports main' >> /etc/apt/sources.list
RUN apt-get update && apt-get install -y \
openssh-server \
nginx \
fcgiwrap \
git \
git-lfs \
make \
wget \
gcc \
@@ -16,121 +23,118 @@ RUN apt-get update && apt-get install -y \
WORKDIR /tmp
# Install docker
ENV DOCKER_VERSION=18.06.0
RUN curl -O https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_VERSION}-ce.tgz && \
tar -xzf docker-${DOCKER_VERSION}-ce.tgz && \
mv docker/docker /usr/local/bin/docker && \
rm -rf ./docker
# Install dep
ENV DEP_VERSION=0.5.0
RUN wget https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64 -O /usr/local/bin/dep && \
chmod +x /usr/local/bin/dep
# Install gometalinter
RUN curl -sLo- https://github.com/alecthomas/gometalinter/releases/download/v2.0.5/gometalinter-2.0.5-linux-amd64.tar.gz | \
tar -xzC "$GOPATH/bin" --exclude COPYING --exclude README.md --strip-components 1 -f- && \
ln -s $GOPATH/bin/gometalinter $GOPATH/bin/gometalinter.v2
# Install packr
ENV PACKR_VERSION=1.13.2
RUN wget https://github.com/gobuffalo/packr/releases/download/v${PACKR_VERSION}/packr_${PACKR_VERSION}_linux_amd64.tar.gz && \
tar -vxf packr*.tar.gz -C /tmp/ && \
mv /tmp/packr /usr/local/bin/packr
# Install kubectl
RUN curl -L -o /usr/local/bin/kubectl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && \
chmod +x /usr/local/bin/kubectl
# Install ksonnet
# NOTE: we frequently switch between tip of master ksonnet vs. official builds. Comment/uncomment
# the corresponding section to switch between the two options:
# Option 1: build ksonnet ourselves
#RUN go get -v -u github.com/ksonnet/ksonnet && mv ${GOPATH}/bin/ksonnet /usr/local/bin/ks
# Option 2: use official tagged ksonnet release
ENV KSONNET_VERSION=0.11.0
RUN wget https://github.com/ksonnet/ksonnet/releases/download/v${KSONNET_VERSION}/ks_${KSONNET_VERSION}_linux_amd64.tar.gz && \
tar -C /tmp/ -xf ks_${KSONNET_VERSION}_linux_amd64.tar.gz && \
mv /tmp/ks_${KSONNET_VERSION}_linux_amd64/ks /usr/local/bin/ks
# Install helm
ENV HELM_VERSION=2.9.1
RUN wget https://storage.googleapis.com/kubernetes-helm/helm-v${HELM_VERSION}-linux-amd64.tar.gz && \
tar -C /tmp/ -xf helm-v${HELM_VERSION}-linux-amd64.tar.gz && \
mv /tmp/linux-amd64/helm /usr/local/bin/helm
# Install kustomize
ENV KUSTOMIZE_VERSION=1.0.7
RUN curl -L -o /usr/local/bin/kustomize https://github.com/kubernetes-sigs/kustomize/releases/download/v${KUSTOMIZE_VERSION}/kustomize_${KUSTOMIZE_VERSION}_linux_amd64 && \
chmod +x /usr/local/bin/kustomize
ENV AWS_IAM_AUTHENTICATOR_VERSION=0.3.0
RUN curl -L -o /usr/local/bin/aws-iam-authenticator https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v0.3.0/heptio-authenticator-aws_${AWS_IAM_AUTHENTICATOR_VERSION}_linux_amd64 && \
chmod +x /usr/local/bin/aws-iam-authenticator
ADD hack/install.sh .
ADD hack/installers installers
ADD hack/tool-versions.sh .
RUN ./install.sh packr-linux
RUN ./install.sh ksonnet-linux
RUN ./install.sh helm2-linux
RUN ./install.sh helm-linux
RUN ./install.sh kustomize-linux
####################################################################################################
# ArgoCD Build stage which performs the actual build of ArgoCD binaries
# Argo CD Base - used as the base for both the release and dev argocd images
####################################################################################################
FROM golang:1.10.3 as argocd-build
FROM $BASE_IMAGE as argocd-base
COPY --from=builder /usr/local/bin/dep /usr/local/bin/dep
COPY --from=builder /usr/local/bin/packr /usr/local/bin/packr
USER root
# A dummy directory is created under $GOPATH/src/dummy so we are able to use dep
# to install all the packages of our dep lock file
COPY Gopkg.toml ${GOPATH}/src/dummy/Gopkg.toml
COPY Gopkg.lock ${GOPATH}/src/dummy/Gopkg.lock
RUN cd ${GOPATH}/src/dummy && \
dep ensure -vendor-only && \
mv vendor/* ${GOPATH}/src/ && \
rmdir vendor
# Perform the build
WORKDIR /go/src/github.com/argoproj/argo-cd
COPY . .
ARG MAKE_TARGET="cli server controller repo-server argocd-util"
RUN make ${MAKE_TARGET}
####################################################################################################
# Final image
####################################################################################################
FROM debian:9.5-slim
ENV DEBIAN_FRONTEND=noninteractive
RUN groupadd -g 999 argocd && \
useradd -r -u 999 -g argocd argocd && \
mkdir -p /home/argocd && \
chown argocd:argocd /home/argocd && \
chown argocd:0 /home/argocd && \
chmod g=u /home/argocd && \
chmod g=u /etc/passwd && \
apt-get update && \
apt-get install -y git && \
apt-get dist-upgrade -y && \
apt-get install -y git git-lfs python3-pip tini gpg && \
apt-get clean && \
pip3 install awscli==1.18.80 && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY hack/git-ask-pass.sh /usr/local/bin/git-ask-pass.sh
COPY hack/gpg-wrapper.sh /usr/local/bin/gpg-wrapper.sh
COPY hack/git-verify-wrapper.sh /usr/local/bin/git-verify-wrapper.sh
COPY --from=builder /usr/local/bin/ks /usr/local/bin/ks
COPY --from=builder /usr/local/bin/helm2 /usr/local/bin/helm2
COPY --from=builder /usr/local/bin/helm /usr/local/bin/helm
COPY --from=builder /usr/local/bin/kubectl /usr/local/bin/kubectl
COPY --from=builder /usr/local/bin/kustomize /usr/local/bin/kustomize
COPY --from=builder /usr/local/bin/aws-iam-authenticator /usr/local/bin/aws-iam-authenticator
# script to add current (possibly arbitrary) user to /etc/passwd at runtime
# (if it's not already there, to be openshift friendly)
COPY uid_entrypoint.sh /usr/local/bin/uid_entrypoint.sh
# support for mounting configuration from a configmap
RUN mkdir -p /app/config/ssh && \
touch /app/config/ssh/ssh_known_hosts && \
ln -s /app/config/ssh/ssh_known_hosts /etc/ssh/ssh_known_hosts
RUN mkdir -p /app/config/tls
RUN mkdir -p /app/config/gpg/source && \
mkdir -p /app/config/gpg/keys && \
chown argocd /app/config/gpg/keys && \
chmod 0700 /app/config/gpg/keys
# workaround ksonnet issue https://github.com/ksonnet/ksonnet/issues/298
ENV USER=argocd
COPY --from=argocd-build /go/src/github.com/argoproj/argo-cd/dist/* /usr/local/bin/
# Symlink argocd binaries under root for backwards compatibility that expect it under /
RUN ln -s /usr/local/bin/argocd /argocd && \
ln -s /usr/local/bin/argocd-server /argocd-server && \
ln -s /usr/local/bin/argocd-util /argocd-util && \
ln -s /usr/local/bin/argocd-application-controller /argocd-application-controller && \
ln -s /usr/local/bin/argocd-repo-server /argocd-repo-server
USER argocd
RUN helm init --client-only
USER 999
WORKDIR /home/argocd
ARG BINARY
CMD ${BINARY}
####################################################################################################
# Argo CD UI stage
####################################################################################################
FROM node:12.18.4 as argocd-ui
WORKDIR /src
ADD ["ui/package.json", "ui/yarn.lock", "./"]
RUN yarn install
ADD ["ui/", "."]
ARG ARGO_VERSION=latest
ENV ARGO_VERSION=$ARGO_VERSION
RUN NODE_ENV='production' yarn build
####################################################################################################
# Argo CD Build stage which performs the actual build of Argo CD binaries
####################################################################################################
FROM golang:1.14.12 as argocd-build
COPY --from=builder /usr/local/bin/packr /usr/local/bin/packr
WORKDIR /go/src/github.com/argoproj/argo-cd
COPY go.mod go.mod
COPY go.sum go.sum
RUN go mod download
# Perform the build
COPY . .
RUN make argocd-all
ARG BUILD_ALL_CLIS=true
RUN if [ "$BUILD_ALL_CLIS" = "true" ] ; then \
make BIN_NAME=argocd-darwin-amd64 GOOS=darwin argocd-all && \
make BIN_NAME=argocd-windows-amd64.exe GOOS=windows argocd-all \
; fi
####################################################################################################
# Final image
####################################################################################################
FROM argocd-base
COPY --from=argocd-build /go/src/github.com/argoproj/argo-cd/dist/argocd* /usr/local/bin/
COPY --from=argocd-ui ./src/dist/app /shared/app
USER root
RUN ln -s /usr/local/bin/argocd /usr/local/bin/argocd-util
RUN ln -s /usr/local/bin/argocd /usr/local/bin/argocd-server
RUN ln -s /usr/local/bin/argocd /usr/local/bin/argocd-repo-server
RUN ln -s /usr/local/bin/argocd /usr/local/bin/argocd-application-controller
RUN ln -s /usr/local/bin/argocd /usr/local/bin/argocd-dex
USER 999

19
Dockerfile.dev Normal file
View File

@@ -0,0 +1,19 @@
####################################################################################################
# argocd-dev
####################################################################################################
FROM argocd-base
COPY argocd /usr/local/bin/
COPY argocd-darwin-amd64 /usr/local/bin/
COPY argocd-windows-amd64.exe /usr/local/bin/
USER root
RUN ln -s /usr/local/bin/argocd /usr/local/bin/argocd-server
RUN ln -s /usr/local/bin/argocd /usr/local/bin/argocd-repo-server
RUN ln -s /usr/local/bin/argocd /usr/local/bin/argocd-application-controller
RUN ln -s /usr/local/bin/argocd /usr/local/bin/argocd-dex
RUN ln -s /usr/local/bin/argocd /usr/local/bin/argocd-util
RUN ln -s /usr/local/bin/argocd-darwin-amd64 /usr/local/bin/argocd-util-darwin-amd64
RUN ln -s /usr/local/bin/argocd-windows-amd64.exe /usr/local/bin/argocd-util-windows-amd64.exe
USER 999
COPY --from=argocd-ui ./src/dist/app /shared/app

1565
Gopkg.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,76 +0,0 @@
# Packages should only be added to the following list when we use them *outside* of our go code.
# (e.g. we want to build the binary to invoke as part of the build process, such as in
# generate-proto.sh). Normal use of golang packages should be added via `dep ensure`, and pinned
# with a [[constraint]] or [[override]] when version is important.
required = [
"github.com/golang/protobuf/protoc-gen-go",
"github.com/gogo/protobuf/protoc-gen-gofast",
"github.com/gogo/protobuf/protoc-gen-gogofast",
"k8s.io/code-generator/cmd/go-to-protobuf",
"github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway",
"github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger",
]
[[constraint]]
name = "google.golang.org/grpc"
version = "1.15.0"
[[constraint]]
name = "github.com/gogo/protobuf"
version = "1.1.1"
# override github.com/grpc-ecosystem/go-grpc-middleware's constraint on master
[[override]]
name = "github.com/golang/protobuf"
version = "1.2.0"
[[constraint]]
name = "github.com/grpc-ecosystem/grpc-gateway"
version = "v1.3.1"
# prometheus does not believe in semversioning yet
[[constraint]]
name = "github.com/prometheus/client_golang"
revision = "7858729281ec582767b20e0d696b6041d995d5e0"
[[constraint]]
branch = "release-1.10"
name = "k8s.io/api"
# override ksonnet dependency
[[override]]
branch = "release-1.10"
name = "k8s.io/apimachinery"
[[constraint]]
name = "k8s.io/apiextensions-apiserver"
branch = "release-1.10"
[[constraint]]
branch = "release-1.10"
name = "k8s.io/code-generator"
[[constraint]]
branch = "release-7.0"
name = "k8s.io/client-go"
[[constraint]]
name = "github.com/stretchr/testify"
version = "1.2.1"
[[constraint]]
name = "github.com/ksonnet/ksonnet"
version = "v0.11.0"
[[constraint]]
name = "github.com/gobuffalo/packr"
version = "v1.11.0"
# override ksonnet's logrus dependency
[[override]]
name = "github.com/sirupsen/logrus"
revision = "ea8897e79973357ba785ac2533559a6297e83c44"
[[constraint]]
branch = "master"
name = "github.com/argoproj/pkg"

528
Makefile
View File

@@ -1,33 +1,144 @@
PACKAGE=github.com/argoproj/argo-cd
PACKAGE=github.com/argoproj/argo-cd/common
CURRENT_DIR=$(shell pwd)
DIST_DIR=${CURRENT_DIR}/dist
CLI_NAME=argocd
UTIL_CLI_NAME=argocd-util
BIN_NAME=argocd
HOST_OS:=$(shell go env GOOS)
HOST_ARCH:=$(shell go env GOARCH)
VERSION=$(shell cat ${CURRENT_DIR}/VERSION)
BUILD_DATE=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
GIT_COMMIT=$(shell git rev-parse HEAD)
GIT_TAG=$(shell if [ -z "`git status --porcelain`" ]; then git describe --exact-match --tags HEAD 2>/dev/null; fi)
GIT_TREE_STATE=$(shell if [ -z "`git status --porcelain`" ]; then echo "clean" ; else echo "dirty"; fi)
PACKR_CMD=$(shell if [ "`which packr`" ]; then echo "packr"; else echo "go run vendor/github.com/gobuffalo/packr/packr/main.go"; fi)
PACKR_CMD=$(shell if [ "`which packr`" ]; then echo "packr"; else echo "go run github.com/gobuffalo/packr/packr"; fi)
VOLUME_MOUNT=$(shell if test "$(go env GOOS)" = "darwin"; then echo ":delegated"; elif test selinuxenabled; then echo ":delegated"; else echo ""; fi)
KUBECTL_VERSION=$(shell go list -m all | grep k8s.io/client-go | cut -d ' ' -f5)
GOPATH?=$(shell if test -x `which go`; then go env GOPATH; else echo "$(HOME)/go"; fi)
GOCACHE?=$(HOME)/.cache/go-build
DOCKER_SRCDIR?=$(GOPATH)/src
DOCKER_WORKDIR?=/go/src/github.com/argoproj/argo-cd
ARGOCD_PROCFILE?=Procfile
# Strict mode has been disabled in latest versions of mkdocs-material.
# Thus pointing to the older image of mkdocs-material matching the version used by argo-cd.
MKDOCS_DOCKER_IMAGE?=squidfunk/mkdocs-material:4.1.1
MKDOCS_RUN_ARGS?=
# Configuration for building argocd-test-tools image
TEST_TOOLS_NAMESPACE?=
TEST_TOOLS_IMAGE=argocd-test-tools
TEST_TOOLS_TAG?=latest
ifdef TEST_TOOLS_NAMESPACE
TEST_TOOLS_PREFIX=${TEST_TOOLS_NAMESPACE}/
endif
# You can change the ports where ArgoCD components will be listening on by
# setting the appropriate environment variables before running make.
ARGOCD_E2E_APISERVER_PORT?=8080
ARGOCD_E2E_REPOSERVER_PORT?=8081
ARGOCD_E2E_REDIS_PORT?=6379
ARGOCD_E2E_DEX_PORT?=5556
ARGOCD_E2E_YARN_HOST?=localhost
ARGOCD_IN_CI?=false
ARGOCD_TEST_E2E?=true
ARGOCD_LINT_GOGC?=20
# Depending on where we are (legacy or non-legacy pwd), we need to use
# different Docker volume mounts for our source tree
LEGACY_PATH=$(GOPATH)/src/github.com/argoproj/argo-cd
ifeq ("$(PWD)","$(LEGACY_PATH)")
DOCKER_SRC_MOUNT="$(DOCKER_SRCDIR):/go/src$(VOLUME_MOUNT)"
else
DOCKER_SRC_MOUNT="$(PWD):/go/src/github.com/argoproj/argo-cd$(VOLUME_MOUNT)"
endif
# Runs any command in the argocd-test-utils container in server mode
# Server mode container will start with uid 0 and drop privileges during runtime
define run-in-test-server
docker run --rm -it \
--name argocd-test-server \
-u $(shell id -u):$(shell id -g) \
-e USER_ID=$(shell id -u) \
-e HOME=/home/user \
-e GOPATH=/go \
-e GOCACHE=/tmp/go-build-cache \
-e ARGOCD_IN_CI=$(ARGOCD_IN_CI) \
-e ARGOCD_E2E_TEST=$(ARGOCD_E2E_TEST) \
-e ARGOCD_E2E_YARN_HOST=$(ARGOCD_E2E_YARN_HOST) \
-v ${DOCKER_SRC_MOUNT} \
-v ${GOPATH}/pkg/mod:/go/pkg/mod${VOLUME_MOUNT} \
-v ${GOCACHE}:/tmp/go-build-cache${VOLUME_MOUNT} \
-v ${HOME}/.kube:/home/user/.kube${VOLUME_MOUNT} \
-v /tmp:/tmp${VOLUME_MOUNT} \
-w ${DOCKER_WORKDIR} \
-p ${ARGOCD_E2E_APISERVER_PORT}:8080 \
-p 4000:4000 \
$(TEST_TOOLS_PREFIX)$(TEST_TOOLS_IMAGE):$(TEST_TOOLS_TAG) \
bash -c "$(1)"
endef
# Runs any command in the argocd-test-utils container in client mode
define run-in-test-client
docker run --rm -it \
--name argocd-test-client \
-u $(shell id -u):$(shell id -g) \
-e HOME=/home/user \
-e GOPATH=/go \
-e ARGOCD_E2E_K3S=$(ARGOCD_E2E_K3S) \
-e GOCACHE=/tmp/go-build-cache \
-e ARGOCD_LINT_GOGC=$(ARGOCD_LINT_GOGC) \
-v ${DOCKER_SRC_MOUNT} \
-v ${GOPATH}/pkg/mod:/go/pkg/mod${VOLUME_MOUNT} \
-v ${GOCACHE}:/tmp/go-build-cache${VOLUME_MOUNT} \
-v ${HOME}/.kube:/home/user/.kube${VOLUME_MOUNT} \
-v /tmp:/tmp${VOLUME_MOUNT} \
-w ${DOCKER_WORKDIR} \
$(TEST_TOOLS_PREFIX)$(TEST_TOOLS_IMAGE):$(TEST_TOOLS_TAG) \
bash -c "$(1)"
endef
#
define exec-in-test-server
docker exec -it -u $(shell id -u):$(shell id -g) -e ARGOCD_E2E_K3S=$(ARGOCD_E2E_K3S) argocd-test-server $(1)
endef
PATH:=$(PATH):$(PWD)/hack
# docker image publishing options
DOCKER_PUSH?=false
IMAGE_NAMESPACE?=
# perform static compilation
STATIC_BUILD?=true
# build development images
DEV_IMAGE?=false
ARGOCD_GPG_ENABLED?=true
ARGOCD_E2E_APISERVER_PORT?=8080
override LDFLAGS += \
-X ${PACKAGE}.version=${VERSION} \
-X ${PACKAGE}.buildDate=${BUILD_DATE} \
-X ${PACKAGE}.gitCommit=${GIT_COMMIT} \
-X ${PACKAGE}.gitTreeState=${GIT_TREE_STATE}
-X ${PACKAGE}.gitTreeState=${GIT_TREE_STATE}\
-X ${PACKAGE}.gitTreeState=${GIT_TREE_STATE}\
-X ${PACKAGE}.kubectlVersion=${KUBECTL_VERSION}
ifeq (${STATIC_BUILD}, true)
override LDFLAGS += -extldflags "-static"
endif
# docker image publishing options
DOCKER_PUSH=false
IMAGE_TAG=latest
ifneq (${GIT_TAG},)
IMAGE_TAG=${GIT_TAG}
LDFLAGS += -X ${PACKAGE}.gitTag=${GIT_TAG}
endif
ifneq (${IMAGE_NAMESPACE},)
override LDFLAGS += -X ${PACKAGE}/install.imageNamespace=${IMAGE_NAMESPACE}
endif
ifneq (${IMAGE_TAG},)
override LDFLAGS += -X ${PACKAGE}/install.imageTag=${IMAGE_TAG}
else
IMAGE_TAG?=latest
endif
ifeq (${DOCKER_PUSH},true)
@@ -41,99 +152,289 @@ IMAGE_PREFIX=${IMAGE_NAMESPACE}/
endif
.PHONY: all
all: cli server-image controller-image repo-server-image argocd-util
all: cli image argocd-util
# We have some legacy requirements for being checked out within $GOPATH.
# The ensure-gopath target can be used as dependency to ensure we are running
# within these boundaries.
.PHONY: ensure-gopath
ensure-gopath:
ifneq ("$(PWD)","$(LEGACY_PATH)")
@echo "Due to legacy requirements for codegen, repository needs to be checked out within \$$GOPATH"
@echo "Location of this repo should be '$(LEGACY_PATH)' but is '$(PWD)'"
@exit 1
endif
.PHONY: gogen
gogen: ensure-gopath
export GO111MODULE=off
go generate ./util/argo/...
.PHONY: protogen
protogen:
protogen: ensure-gopath
export GO111MODULE=off
./hack/generate-proto.sh
.PHONY: openapigen
openapigen: ensure-gopath
export GO111MODULE=off
./hack/update-openapi.sh
.PHONY: clientgen
clientgen:
clientgen: ensure-gopath
export GO111MODULE=off
./hack/update-codegen.sh
.PHONY: clidocsgen
clidocsgen: ensure-gopath
go run tools/cmd-docs/main.go
.PHONY: codegen-local
codegen-local: ensure-gopath mod-vendor-local gogen protogen clientgen openapigen clidocsgen manifests-local
rm -rf vendor/
.PHONY: codegen
codegen: protogen clientgen
codegen: test-tools-image
$(call run-in-test-client,make codegen-local)
# NOTE: we use packr to do the build instead of go, since we embed .yaml files into the go binary.
# This enables ease of maintenance of the yaml files.
.PHONY: cli
cli: clean-debug
${PACKR_CMD} build -v -i -ldflags '${LDFLAGS} -extldflags "-static"' -o ${DIST_DIR}/${CLI_NAME} ./cmd/argocd
cli: test-tools-image
$(call run-in-test-client, GOOS=${HOST_OS} GOARCH=${HOST_ARCH} make cli-local)
.PHONY: cli-linux
cli-linux: clean-debug
docker build --iidfile /tmp/argocd-linux-id --target argocd-build --build-arg MAKE_TARGET="cli IMAGE_TAG=$(IMAGE_TAG) IMAGE_NAMESPACE=$(IMAGE_NAMESPACE) CLI_NAME=argocd-linux-amd64" .
docker create --name tmp-argocd-linux `cat /tmp/argocd-linux-id`
docker cp tmp-argocd-linux:/go/src/github.com/argoproj/argo-cd/dist/argocd-linux-amd64 dist/
.PHONY: cli-local
cli-local: clean-debug
CGO_ENABLED=0 ${PACKR_CMD} build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/${CLI_NAME} ./cmd
.PHONY: cli-argocd
cli-argocd:
go build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/${CLI_NAME} ./cmd
.PHONY: release-cli
release-cli: clean-debug image
docker create --name tmp-argocd-linux $(IMAGE_PREFIX)argocd:$(IMAGE_TAG)
docker cp tmp-argocd-linux:/usr/local/bin/argocd ${DIST_DIR}/argocd-linux-amd64
docker cp tmp-argocd-linux:/usr/local/bin/argocd-darwin-amd64 ${DIST_DIR}/argocd-darwin-amd64
docker cp tmp-argocd-linux:/usr/local/bin/argocd-windows-amd64.exe ${DIST_DIR}/argocd-windows-amd64.exe
docker rm tmp-argocd-linux
.PHONY: cli-darwin
cli-darwin: clean-debug
docker build --iidfile /tmp/argocd-darwin-id --target argocd-build --build-arg MAKE_TARGET="cli GOOS=darwin IMAGE_TAG=$(IMAGE_TAG) IMAGE_NAMESPACE=$(IMAGE_NAMESPACE) CLI_NAME=argocd-darwin-amd64" .
docker create --name tmp-argocd-darwin `cat /tmp/argocd-darwin-id`
docker cp tmp-argocd-darwin:/go/src/github.com/argoproj/argo-cd/dist/argocd-darwin-amd64 dist/
docker rm tmp-argocd-darwin
.PHONY: argocd-util
argocd-util: clean-debug
CGO_ENABLED=0 go build -v -i -ldflags '${LDFLAGS} -extldflags "-static"' -o ${DIST_DIR}/argocd-util ./cmd/argocd-util
# Build argocd-util as a statically linked binary, so it could run within the alpine-based dex container (argoproj/argo-cd#844)
CGO_ENABLED=0 ${PACKR_CMD} build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/${UTIL_CLI_NAME} ./cmd
.PHONY: manifests
manifests:
# .PHONY: dev-tools-image
# dev-tools-image:
# docker build -t $(DEV_TOOLS_PREFIX)$(DEV_TOOLS_IMAGE) . -f hack/Dockerfile.dev-tools
# docker tag $(DEV_TOOLS_PREFIX)$(DEV_TOOLS_IMAGE) $(DEV_TOOLS_PREFIX)$(DEV_TOOLS_IMAGE):$(DEV_TOOLS_VERSION)
.PHONY: test-tools-image
test-tools-image:
docker build --build-arg UID=$(shell id -u) -t $(TEST_TOOLS_PREFIX)$(TEST_TOOLS_IMAGE) -f test/container/Dockerfile .
docker tag $(TEST_TOOLS_PREFIX)$(TEST_TOOLS_IMAGE) $(TEST_TOOLS_PREFIX)$(TEST_TOOLS_IMAGE):$(TEST_TOOLS_TAG)
.PHONY: manifests-local
manifests-local:
./hack/update-manifests.sh
.PHONY: manifests
manifests: test-tools-image
$(call run-in-test-client,make manifests-local IMAGE_NAMESPACE='${IMAGE_NAMESPACE}' IMAGE_TAG='${IMAGE_TAG}')
# consolidated binary for cli, util, server, repo-server, controller
.PHONY: argocd-all
argocd-all: clean-debug
CGO_ENABLED=0 ${PACKR_CMD} build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/${BIN_NAME} ./cmd
# NOTE: we use packr to do the build instead of go, since we embed swagger files and policy.csv
# files into the go binary
.PHONY: server
server: clean-debug
CGO_ENABLED=0 ${PACKR_CMD} build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/argocd-server ./cmd/argocd-server
.PHONY: server-image
server-image:
docker build --build-arg BINARY=argocd-server -t $(IMAGE_PREFIX)argocd-server:$(IMAGE_TAG) .
@if [ "$(DOCKER_PUSH)" = "true" ] ; then docker push $(IMAGE_PREFIX)argocd-server:$(IMAGE_TAG) ; fi
CGO_ENABLED=0 ${PACKR_CMD} build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/argocd-server ./cmd
.PHONY: repo-server
repo-server:
CGO_ENABLED=0 go build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/argocd-repo-server ./cmd/argocd-repo-server
.PHONY: repo-server-image
repo-server-image:
docker build --build-arg BINARY=argocd-repo-server -t $(IMAGE_PREFIX)argocd-repo-server:$(IMAGE_TAG) .
@if [ "$(DOCKER_PUSH)" = "true" ] ; then docker push $(IMAGE_PREFIX)argocd-repo-server:$(IMAGE_TAG) ; fi
CGO_ENABLED=0 ${PACKR_CMD} build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/argocd-repo-server ./cmd
.PHONY: controller
controller:
CGO_ENABLED=0 go build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/argocd-application-controller ./cmd/argocd-application-controller
CGO_ENABLED=0 ${PACKR_CMD} build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/argocd-application-controller ./cmd
.PHONY: controller-image
controller-image:
docker build --build-arg BINARY=argocd-application-controller -t $(IMAGE_PREFIX)argocd-application-controller:$(IMAGE_TAG) .
@if [ "$(DOCKER_PUSH)" = "true" ] ; then docker push $(IMAGE_PREFIX)argocd-application-controller:$(IMAGE_TAG) ; fi
.PHONY: packr
packr:
go build -o ${DIST_DIR}/packr github.com/gobuffalo/packr/packr/
.PHONY: cli-image
cli-image:
docker build --build-arg BINARY=argocd -t $(IMAGE_PREFIX)argocd-cli:$(IMAGE_TAG) .
@if [ "$(DOCKER_PUSH)" = "true" ] ; then docker push $(IMAGE_PREFIX)argocd-cli:$(IMAGE_TAG) ; fi
.PHONY: image
ifeq ($(DEV_IMAGE), true)
# The "dev" image builds the binaries from the users desktop environment (instead of in Docker)
# which speeds up builds. Dockerfile.dev needs to be copied into dist to perform the build, since
# the dist directory is under .dockerignore.
IMAGE_TAG="dev-$(shell git describe --always --dirty)"
image: packr
docker build -t argocd-base --target argocd-base .
docker build -t argocd-ui --target argocd-ui .
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 dist/packr build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/argocd ./cmd
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 dist/packr build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/argocd-darwin-amd64 ./cmd
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 dist/packr build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/argocd-windows-amd64.exe ./cmd
ln -sfn ${DIST_DIR}/argocd ${DIST_DIR}/argocd-server
ln -sfn ${DIST_DIR}/argocd ${DIST_DIR}/argocd-application-controller
ln -sfn ${DIST_DIR}/argocd ${DIST_DIR}/argocd-repo-server
ln -sfn ${DIST_DIR}/argocd ${DIST_DIR}/argocd-dex
ln -sfn ${DIST_DIR}/argocd ${DIST_DIR}/argocd-util
ln -sfn ${DIST_DIR}/argocd-darwin-amd64 ${DIST_DIR}/argocd-util-darwin-amd64
ln -sfn ${DIST_DIR}/argocd-windows-amd64.exe ${DIST_DIR}/argocd-util-windows-amd64.exe
cp Dockerfile.dev dist
docker build -t $(IMAGE_PREFIX)argocd:$(IMAGE_TAG) -f dist/Dockerfile.dev dist
else
image:
docker build -t $(IMAGE_PREFIX)argocd:$(IMAGE_TAG) .
endif
@if [ "$(DOCKER_PUSH)" = "true" ] ; then docker push $(IMAGE_PREFIX)argocd:$(IMAGE_TAG) ; fi
.PHONY: armimage
# The "BUILD_ALL_CLIS" argument is to skip building the CLIs for darwin and windows
# which would take a really long time.
armimage:
docker build -t $(IMAGE_PREFIX)argocd:$(IMAGE_TAG)-arm . --build-arg BUILD_ALL_CLIS="false"
.PHONY: builder-image
builder-image:
docker build -t $(IMAGE_PREFIX)argo-cd-ci-builder:$(IMAGE_TAG) --target builder .
@if [ "$(DOCKER_PUSH)" = "true" ] ; then docker push $(IMAGE_PREFIX)argo-cd-ci-builder:$(IMAGE_TAG) ; fi
.PHONY: mod-download
mod-download: test-tools-image
$(call run-in-test-client,go mod download)
.PHONY: mod-download-local
mod-download-local:
go mod download
.PHONY: mod-vendor
mod-vendor: test-tools-image
$(call run-in-test-client,go mod vendor)
.PHONY: mod-vendor-local
mod-vendor-local: mod-download-local
go mod vendor
# Deprecated - replace by install-local-tools
.PHONY: install-lint-tools
install-lint-tools:
./hack/install.sh lint-tools
# Run linter on the code
.PHONY: lint
lint:
gometalinter.v2 --config gometalinter.json ./...
lint: test-tools-image
$(call run-in-test-client,make lint-local)
# Run linter on the code (local version)
.PHONY: lint-local
lint-local:
golangci-lint --version
# NOTE: If you get a "Killed" OOM message, try reducing the value of GOGC
# See https://github.com/golangci/golangci-lint#memory-usage-of-golangci-lint
GOGC=$(ARGOCD_LINT_GOGC) GOMAXPROCS=2 golangci-lint run --fix --verbose --timeout 300s
.PHONY: lint-ui
lint-ui: test-tools-image
$(call run-in-test-client,make lint-ui-local)
.PHONY: lint-ui-local
lint-ui-local:
cd ui && yarn lint
# Build all Go code
.PHONY: build
build: test-tools-image
mkdir -p $(GOCACHE)
$(call run-in-test-client, make build-local)
# Build all Go code (local version)
.PHONY: build-local
build-local:
go build -v `go list ./... | grep -v 'resource_customizations\|test/e2e'`
# Run all unit tests
#
# If TEST_MODULE is set (to fully qualified module name), only this specific
# module will be tested.
.PHONY: test
test:
go test -v `go list ./... | grep -v "github.com/argoproj/argo-cd/test/e2e"`
test: test-tools-image
mkdir -p $(GOCACHE)
$(call run-in-test-client,make TEST_MODULE=$(TEST_MODULE) test-local)
.PHONY: test-coverage
test-coverage:
go test -v -covermode=count -coverprofile=coverage.out `go list ./... | grep -v "github.com/argoproj/argo-cd/test/e2e"`
@if [ "$(COVERALLS_TOKEN)" != "" ] ; then goveralls -ignore `find . -name '*.pb*.go' | grep -v vendor/ | sed 's!^./!!' | paste -d, -s -` -coverprofile=coverage.out -service=argo-ci -repotoken "$(COVERALLS_TOKEN)"; else echo 'No COVERALLS_TOKEN env var specified. Skipping submission to Coveralls.io'; fi
# Run all unit tests (local version)
.PHONY: test-local
test-local:
if test "$(TEST_MODULE)" = ""; then \
./hack/test.sh -coverprofile=coverage.out `go list ./... | grep -v 'test/e2e'`; \
else \
./hack/test.sh -coverprofile=coverage.out "$(TEST_MODULE)"; \
fi
.PHONY: test-race
test-race: test-tools-image
mkdir -p $(GOCACHE)
$(call run-in-test-client,make TEST_MODULE=$(TEST_MODULE) test-race-local)
# Run all unit tests, with data race detection, skipping known failures (local version)
.PHONY: test-race-local
test-race-local:
if test "$(TEST_MODULE)" = ""; then \
./hack/test.sh -race -coverprofile=coverage.out `go list ./... | grep -v 'test/e2e'`; \
else \
./hack/test.sh -race -coverprofile=coverage.out "$(TEST_MODULE)"; \
fi
# Run the E2E test suite. E2E test servers (see start-e2e target) must be
# started before.
.PHONY: test-e2e
test-e2e:
go test -v -failfast -timeout 20m ./test/e2e
$(call exec-in-test-server,make test-e2e-local)
# Run the E2E test suite (local version)
.PHONY: test-e2e-local
test-e2e-local: cli-local
# NO_PROXY ensures all tests don't go out through a proxy if one is configured on the test system
export GO111MODULE=off
ARGOCD_GPG_ENABLED=true NO_PROXY=* ./hack/test.sh -timeout 20m -v ./test/e2e
# Spawns a shell in the test server container for debugging purposes
debug-test-server: test-tools-image
$(call run-in-test-server,/bin/bash)
# Spawns a shell in the test client container for debugging purposes
debug-test-client: test-tools-image
$(call run-in-test-client,/bin/bash)
# Starts e2e server in a container
.PHONY: start-e2e
start-e2e: test-tools-image
docker version
mkdir -p ${GOCACHE}
$(call run-in-test-server,make ARGOCD_PROCFILE=test/container/Procfile start-e2e-local)
# Starts e2e server locally (or within a container)
.PHONY: start-e2e-local
start-e2e-local:
kubectl create ns argocd-e2e || true
kubectl config set-context --current --namespace=argocd-e2e
kustomize build test/manifests/base | kubectl apply -f -
# Create GPG keys and source directories
if test -d /tmp/argo-e2e/app/config/gpg; then rm -rf /tmp/argo-e2e/app/config/gpg/*; fi
mkdir -p /tmp/argo-e2e/app/config/gpg/keys && chmod 0700 /tmp/argo-e2e/app/config/gpg/keys
mkdir -p /tmp/argo-e2e/app/config/gpg/source && chmod 0700 /tmp/argo-e2e/app/config/gpg/source
# set paths for locally managed ssh known hosts and tls certs data
ARGOCD_SSH_DATA_PATH=/tmp/argo-e2e/app/config/ssh \
ARGOCD_TLS_DATA_PATH=/tmp/argo-e2e/app/config/tls \
ARGOCD_GPG_DATA_PATH=/tmp/argo-e2e/app/config/gpg/source \
ARGOCD_GNUPGHOME=/tmp/argo-e2e/app/config/gpg/keys \
ARGOCD_GPG_ENABLED=true \
ARGOCD_E2E_DISABLE_AUTH=false \
ARGOCD_ZJWT_FEATURE_FLAG=always \
ARGOCD_IN_CI=$(ARGOCD_IN_CI) \
ARGOCD_E2E_TEST=true \
goreman -f $(ARGOCD_PROCFILE) start ${ARGOCD_START}
# Cleans VSCode debug.test files from sub-dirs to prevent them from being included in packr boxes
.PHONY: clean-debug
@@ -144,13 +445,104 @@ clean-debug:
clean: clean-debug
-rm -rf ${CURRENT_DIR}/dist
.PHONY: precheckin
precheckin: test lint
.PHONY: start
start: test-tools-image
docker version
$(call run-in-test-server,make ARGOCD_PROCFILE=test/container/Procfile start-local ARGOCD_START=${ARGOCD_START})
# Starts a local instance of ArgoCD
.PHONY: start-local
start-local: mod-vendor-local dep-ui-local
# check we can connect to Docker to start Redis
killall goreman || true
kubectl create ns argocd || true
rm -rf /tmp/argocd-local
mkdir -p /tmp/argocd-local
mkdir -p /tmp/argocd-local/gpg/keys && chmod 0700 /tmp/argocd-local/gpg/keys
mkdir -p /tmp/argocd-local/gpg/source
ARGOCD_ZJWT_FEATURE_FLAG=always \
ARGOCD_IN_CI=false \
ARGOCD_GPG_ENABLED=true \
ARGOCD_E2E_TEST=false \
goreman -f $(ARGOCD_PROCFILE) start ${ARGOCD_START}
# Runs pre-commit validation with the virtualized toolchain
.PHONY: pre-commit
pre-commit: codegen build lint test
# Runs pre-commit validation with the local toolchain
.PHONY: pre-commit-local
pre-commit-local: codegen-local build-local lint-local test-local
.PHONY: release-precheck
release-precheck: manifests
@if [ "$(GIT_TREE_STATE)" != "clean" ]; then echo 'git tree state is $(GIT_TREE_STATE)' ; exit 1; fi
@if [ -z "$(GIT_TAG)" ]; then echo 'commit must be tagged to perform release' ; exit 1; fi
@if [ "$(GIT_TAG)" != "v`cat VERSION`" ]; then echo 'VERSION does not match git tag'; exit 1; fi
.PHONY: release
release: release-precheck precheckin cli-darwin cli-linux server-image controller-image repo-server-image cli-image
release: pre-commit release-precheck image release-cli
.PHONY: build-docs-local
build-docs-local:
mkdocs build
.PHONY: build-docs
build-docs:
docker run ${MKDOCS_RUN_ARGS} --rm -it -p 8000:8000 -v ${CURRENT_DIR}:/docs ${MKDOCS_DOCKER_IMAGE} build
.PHONY: serve-docs-local
serve-docs-local:
mkdocs serve
.PHONY: serve-docs
serve-docs:
docker run ${MKDOCS_RUN_ARGS} --rm -it -p 8000:8000 -v ${CURRENT_DIR}:/docs ${MKDOCS_DOCKER_IMAGE} serve -a 0.0.0.0:8000
.PHONY: lint-docs
lint-docs:
# https://github.com/dkhamsing/awesome_bot
find docs -name '*.md' -exec grep -l http {} + | xargs docker run --rm -v $(PWD):/mnt:ro dkhamsing/awesome_bot -t 3 --allow-dupe --allow-redirect --white-list `cat white-list | grep -v "#" | tr "\n" ','` --skip-save-results --
# Verify that kubectl can connect to your K8s cluster from Docker
.PHONY: verify-kube-connect
verify-kube-connect: test-tools-image
$(call run-in-test-client,kubectl version)
# Show the Go version of local and virtualized environments
.PHONY: show-go-version
show-go-version: test-tools-image
@echo -n "Local Go version: "
@go version
@echo -n "Docker Go version: "
$(call run-in-test-client,go version)
# Installs all tools required to build and test ArgoCD locally
.PHONY: install-tools-local
install-tools-local: install-test-tools-local install-codegen-tools-local install-go-tools-local
# Installs all tools required for running unit & end-to-end tests (Linux packages)
.PHONY: install-test-tools-local
install-test-tools-local:
sudo ./hack/install.sh packr-linux
sudo ./hack/install.sh kustomize-linux
sudo ./hack/install.sh ksonnet-linux
sudo ./hack/install.sh helm2-linux
sudo ./hack/install.sh helm-linux
# Installs all tools required for running codegen (Linux packages)
.PHONY: install-codegen-tools-local
install-codegen-tools-local:
sudo ./hack/install.sh codegen-tools
# Installs all tools required for running codegen (Go packages)
.PHONY: install-go-tools-local
install-go-tools-local:
./hack/install.sh codegen-go-tools
.PHONY: dep-ui
dep-ui: test-tools-image
$(call run-in-test-client,make dep-ui-local)
dep-ui-local:
cd ui && yarn install

11
OWNERS
View File

@@ -3,6 +3,15 @@ owners:
- jessesuen
approvers:
- alexec
- alexmt
- dthomson25
- jannfis
- jessesuen
- merenbach
- mayzhang2000
- rachelwang20
reviewers:
- jgwest
- wtam2018
- tetchel

View File

@@ -1,4 +1,8 @@
controller: go run ./cmd/argocd-application-controller/main.go
api-server: go run ./cmd/argocd-server/main.go --insecure --disable-auth
repo-server: go run ./cmd/argocd-repo-server/main.go --loglevel debug
dex: sh -c "go run ./cmd/argocd-util/main.go gendexcfg -o `pwd`/dist/dex.yaml && docker run --rm -p 5556:5556 -p 5557:5557 -v `pwd`/dist/dex.yaml:/dex.yaml quay.io/coreos/dex:v2.10.0 serve /dex.yaml"
controller: sh -c "FORCE_LOG_COLORS=1 ARGOCD_FAKE_IN_CLUSTER=true ARGOCD_TLS_DATA_PATH=${ARGOCD_TLS_DATA_PATH:-/tmp/argocd-local/tls} ARGOCD_SSH_DATA_PATH=${ARGOCD_SSH_DATA_PATH:-/tmp/argocd-local/ssh} ARGOCD_BINARY_NAME=argocd-application-controller go run ./cmd/main.go --loglevel debug --redis localhost:${ARGOCD_E2E_REDIS_PORT:-6379} --repo-server localhost:${ARGOCD_E2E_REPOSERVER_PORT:-8081}"
api-server: sh -c "FORCE_LOG_COLORS=1 ARGOCD_FAKE_IN_CLUSTER=true ARGOCD_TLS_DATA_PATH=${ARGOCD_TLS_DATA_PATH:-/tmp/argocd-local/tls} ARGOCD_SSH_DATA_PATH=${ARGOCD_SSH_DATA_PATH:-/tmp/argocd-local/ssh} ARGOCD_BINARY_NAME=argocd-server go run ./cmd/main.go --loglevel debug --redis localhost:${ARGOCD_E2E_REDIS_PORT:-6379} --disable-auth=${ARGOCD_E2E_DISABLE_AUTH:-'true'} --insecure --dex-server http://localhost:${ARGOCD_E2E_DEX_PORT:-5556} --repo-server localhost:${ARGOCD_E2E_REPOSERVER_PORT:-8081} --port ${ARGOCD_E2E_APISERVER_PORT:-8080} --staticassets ui/dist/app"
dex: sh -c "ARGOCD_BINARY_NAME=argocd-dex go run github.com/argoproj/argo-cd/cmd gendexcfg -o `pwd`/dist/dex.yaml && docker run --rm -p ${ARGOCD_E2E_DEX_PORT:-5556}:${ARGOCD_E2E_DEX_PORT:-5556} -v `pwd`/dist/dex.yaml:/dex.yaml ghcr.io/dexidp/dex:v2.27.0 serve /dex.yaml"
redis: docker run --rm --name argocd-redis -i -p ${ARGOCD_E2E_REDIS_PORT:-6379}:${ARGOCD_E2E_REDIS_PORT:-6379} redis:5.0.10-alpine --save "" --appendonly no --port ${ARGOCD_E2E_REDIS_PORT:-6379}
repo-server: sh -c "FORCE_LOG_COLORS=1 ARGOCD_FAKE_IN_CLUSTER=true ARGOCD_GNUPGHOME=${ARGOCD_GNUPGHOME:-/tmp/argocd-local/gpg/keys} ARGOCD_GPG_DATA_PATH=${ARGOCD_GPG_DATA_PATH:-/tmp/argocd-local/gpg/source} ARGOCD_TLS_DATA_PATH=${ARGOCD_TLS_DATA_PATH:-/tmp/argocd-local/tls} ARGOCD_SSH_DATA_PATH=${ARGOCD_SSH_DATA_PATH:-/tmp/argocd-local/ssh} ARGOCD_BINARY_NAME=argocd-repo-server go run ./cmd/main.go --loglevel debug --port ${ARGOCD_E2E_REPOSERVER_PORT:-8081} --redis localhost:${ARGOCD_E2E_REDIS_PORT:-6379}"
ui: sh -c 'cd ui && ${ARGOCD_E2E_YARN_CMD:-yarn} start'
git-server: test/fixture/testrepos/start-git.sh
dev-mounter: [[ "$ARGOCD_E2E_TEST" != "true" ]] && go run hack/dev-mounter/main.go --configmap argocd-ssh-known-hosts-cm=${ARGOCD_SSH_DATA_PATH:-/tmp/argocd-local/ssh} --configmap argocd-tls-certs-cm=${ARGOCD_TLS_DATA_PATH:-/tmp/argocd-local/tls} --configmap argocd-gpg-keys-cm=${ARGOCD_GPG_DATA_PATH:-/tmp/argocd-local/gpg/source}

View File

@@ -1,4 +1,8 @@
[![Coverage Status](https://coveralls.io/repos/github/argoproj/argo-cd/badge.svg?branch=master)](https://coveralls.io/github/argoproj/argo-cd?branch=master)
[![Integration tests](https://github.com/argoproj/argo-cd/workflows/Integration%20tests/badge.svg?branch=master)](https://github.com/argoproj/argo-cd/actions?query=workflow%3A%22Integration+tests%22)
[![slack](https://img.shields.io/badge/slack-argoproj-brightgreen.svg?logo=slack)](https://argoproj.github.io/community/join-slack)
[![codecov](https://codecov.io/gh/argoproj/argo-cd/branch/master/graph/badge.svg)](https://codecov.io/gh/argoproj/argo-cd)
[![Release Version](https://img.shields.io/github/v/release/argoproj/argo-cd?label=argo-cd)](https://github.com/argoproj/argo-cd/releases/latest)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/4486/badge)](https://bestpractices.coreinfrastructure.org/projects/4486)
# Argo CD - Declarative Continuous Delivery for Kubernetes
@@ -6,72 +10,44 @@
Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes.
![Argo CD UI](docs/argocd-ui.gif)
![Argo CD UI](docs/assets/argocd-ui.gif)
[![Argo CD Demo](https://img.youtube.com/vi/0WAm0y2vLIo/0.jpg)](https://youtu.be/0WAm0y2vLIo)
## Why Argo CD?
Application definitions, configurations, and environments should be declarative and version controlled.
Application deployment and lifecycle management should be automated, auditable, and easy to understand.
1. Application definitions, configurations, and environments should be declarative and version controlled.
1. Application deployment and lifecycle management should be automated, auditable, and easy to understand.
## Getting Started
## Who uses Argo CD?
Follow our [getting started guide](docs/getting_started.md). Further [documentation](docs/)
is provided for additional features.
[Official Argo CD user list](USERS.md)
## How it works
## Documentation
Argo CD follows the **GitOps** pattern of using git repositories as the source of truth for defining
the desired application state. Kubernetes manifests can be specified in several ways:
* [ksonnet](https://ksonnet.io) applications
* [kustomize](https://kustomize.io) applications
* [helm](https://helm.sh) charts
* Plain directory of YAML/json manifests
To learn more about Argo CD [go to the complete documentation](https://argo-cd.readthedocs.io/).
Check live demo at https://cd.apps.argoproj.io/.
Argo CD automates the deployment of the desired application states in the specified target environments.
Application deployments can track updates to branches, tags, or pinned to a specific version of
manifests at a git commit. See [tracking strategies](docs/tracking_strategies.md) for additional
details about the different tracking strategies available.
## Community Blogs and Presentations
For a quick 10 minute overview of ArgoCD, check out the demo presented to the Sig Apps community
meeting:
[![Alt text](https://img.youtube.com/vi/aWDIQMbp1cc/0.jpg)](https://youtu.be/aWDIQMbp1cc?t=1m4s)
## Architecture
![Argo CD Architecture](docs/argocd_architecture.png)
Argo CD is implemented as a kubernetes controller which continuously monitors running applications
and compares the current, live state against the desired target state (as specified in the git repo).
A deployed application whose live state deviates from the target state is considered `OutOfSync`.
Argo CD reports & visualizes the differences, while providing facilities to automatically or
manually sync the live state back to the desired target state. Any modifications made to the desired
target state in the git repo can be automatically applied and reflected in the specified target
environments.
For additional details, see [architecture overview](docs/architecture.md).
## Features
* Automated deployment of applications to specified target environments
* Flexibility in support for multiple config management tools (Ksonnet, Kustomize, Helm, plain-YAML)
* Continuous monitoring of deployed applications
* Automated or manual syncing of applications to its desired state
* Web and CLI based visualization of applications and differences between live vs. desired state
* Rollback/Roll-anywhere to any application state committed in the git repository
* Health assessment statuses on all components of the application
* SSO Integration (OIDC, OAuth2, LDAP, SAML 2.0, GitLab, Microsoft, LinkedIn)
* Webhook Integration (GitHub, BitBucket, GitLab)
* PreSync, Sync, PostSync hooks to support complex application rollouts (e.g.blue/green & canary upgrades)
* Audit trails for application events and API calls
* Parameter overrides for overriding ksonnet/helm parameters in git
* Service account/access key management for CI pipelines
## Development Status
* Argo CD is being used in production to deploy SaaS services at Intuit
## Roadmap
* Auto-sync toggle to directly apply git state changes to live state
* Revamped UI, and feature parity with CLI
* Customizable application actions
1. [Automation of Everything - How To Combine Argo Events, Workflows & Pipelines, CD, and Rollouts](https://youtu.be/XNXJtxkUKeY)
1. [Environments Based On Pull Requests (PRs): Using Argo CD To Apply GitOps Principles On Previews](https://youtu.be/cpAaI8p4R60)
1. [Argo CD: Applying GitOps Principles To Manage Production Environment In Kubernetes](https://youtu.be/vpWQeoaiRM4)
1. [Creating Temporary Preview Environments Based On Pull Requests With Argo CD And Codefresh](https://codefresh.io/continuous-deployment/creating-temporary-preview-environments-based-pull-requests-argo-cd-codefresh/)
1. [Tutorial: Everything You Need To Become A GitOps Ninja](https://www.youtube.com/watch?v=r50tRQjisxw) 90m tutorial on GitOps and Argo CD.
1. [Comparison of Argo CD, Spinnaker, Jenkins X, and Tekton](https://www.inovex.de/blog/spinnaker-vs-argo-cd-vs-tekton-vs-jenkins-x/)
1. [Simplify and Automate Deployments Using GitOps with IBM Multicloud Manager 3.1.2](https://medium.com/ibm-cloud/simplify-and-automate-deployments-using-gitops-with-ibm-multicloud-manager-3-1-2-4395af317359)
1. [GitOps for Kubeflow using Argo CD](https://v0-6.kubeflow.org/docs/use-cases/gitops-for-kubeflow/)
1. [GitOps Toolsets on Kubernetes with CircleCI and Argo CD](https://www.digitalocean.com/community/tutorials/webinar-series-gitops-tool-sets-on-kubernetes-with-circleci-and-argo-cd)
1. [Simplify and Automate Deployments Using GitOps with IBM Multicloud Manager](https://www.ibm.com/blogs/bluemix/2019/02/simplify-and-automate-deployments-using-gitops-with-ibm-multicloud-manager-3-1-2/)
1. [CI/CD in Light Speed with K8s and Argo CD](https://www.youtube.com/watch?v=OdzH82VpMwI&feature=youtu.be)
1. [Machine Learning as Code](https://www.youtube.com/watch?v=VXrGp5er1ZE&t=0s&index=135&list=PLj6h78yzYM2PZf9eA7bhWnIh_mK1vyOfU). Among other things, describes how Kubeflow uses Argo CD to implement GitOPs for ML
1. [Argo CD - GitOps Continuous Delivery for Kubernetes](https://www.youtube.com/watch?v=aWDIQMbp1cc&feature=youtu.be&t=1m4s)
1. [Introduction to Argo CD : Kubernetes DevOps CI/CD](https://www.youtube.com/watch?v=2WSJF7d8dUg&feature=youtu.be)
1. [GitOps Deployment and Kubernetes - using ArgoCD](https://medium.com/riskified-technology/gitops-deployment-and-kubernetes-f1ab289efa4b)
1. [Deploy Argo CD with Ingress and TLS in Three Steps: No YAML Yak Shaving Required](https://itnext.io/deploy-argo-cd-with-ingress-and-tls-in-three-steps-no-yaml-yak-shaving-required-bc536d401491)
1. [GitOps Continuous Delivery with Argo and Codefresh](https://codefresh.io/events/cncf-member-webinar-gitops-continuous-delivery-argo-codefresh/)
1. [Stay up to date with ArgoCD and Renovate](https://mjpitz.com/blog/2020/12/03/renovate-your-gitops/)
1. [Setting up Argo CD with Helm](https://www.arthurkoziel.com/setting-up-argocd-with-helm/)
1. [Applied GitOps with ArgoCD](https://thenewstack.io/applied-gitops-with-argocd/)
1. [Solving configuration drift using GitOps with Argo CD](https://www.cncf.io/blog/2020/12/17/solving-configuration-drift-using-gitops-with-argo-cd/)

47
SECURITY.md Normal file
View File

@@ -0,0 +1,47 @@
# Security Policy for Argo CD
Version: **v1.0 (2020-02-26)**
## Preface
As a deployment tool, Argo CD needs to have production access which makes
security a very important topic. The Argoproj team takes security very
seriously and is continuously working on improving it.
## Supported Versions
We currently support the most recent release (`N`, e.g. `1.8`) and the release
previous to the most recent one (`N-1`, e.g. `1.7`). With the release of
`N+1`, `N-1` drops out of support and `N` becomes `N-1`.
We regularly perform patch releases (e.g. `1.8.5` and `1.7.12`) for the
supported versions, which will contain fixes for security vulnerabilities and
important bugs. Prior releases might receive critical security fixes on a best
effort basis, however, it cannot be guaranteed that security fixes get
back-ported to these unsupported versions.
In rare cases, where a security fix needs complex re-design of a feature or is
otherwise very intrusive, and there's a workaround available, we may decide to
provide a forward-fix only, e.g. to be released the next minor release, instead
of releasing it within a patch branch for the currently supported releases.
## Reporting a Vulnerability
If you find a security related bug in ArgoCD, we kindly ask you for responsible
disclosure and for giving us appropriate time to react, analyze and develop a
fix to mitigate the found security vulnerability.
We will do our best to react quickly on your inquiry, and to coordinate a fix
and disclosure with you. Sometimes, it might take a little longer for us to
react (e.g. out of office conditions), so please bear with us in these cases.
We will publish security advisiories using the Git Hub SA feature to keep our
community well informed, and will credit you for your findings (unless you
prefer to stay anonymous, of course).
Please report vulnerabilities by e-mail to all of the following people:
* jfischer@redhat.com
* Jesse_Suen@intuit.com
* Alexander_Matyushentsev@intuit.com
* Edward_Lee@intuit.com

8
SECURITY_CONTACTS Normal file
View File

@@ -0,0 +1,8 @@
# Defined below are the security contacts for this repo.
#
# DO NOT REPORT SECURITY VULNERABILITIES DIRECTLY TO THESE NAMES, FOLLOW THE
# INSTRUCTIONS AT https://argo-cd.readthedocs.io/en/latest/security_considerations/#reporting-vulnerabilities
alexmt
edlee2121
jessesuen

120
USERS.md Normal file
View File

@@ -0,0 +1,120 @@
## Who uses Argo CD?
As the Argo Community grows, we'd like to keep track of our users. Please send a PR with your organization name if you are using Argo CD.
Currently, the following organizations are **officially** using Argo CD:
1. [127Labs](https://127labs.com/)
1. [3Rein](https://www.3rein.com/)
1. [7shifts](https://www.7shifts.com/)
1. [Adevinta](https://www.adevinta.com/)
1. [ANSTO - Australian Synchrotron](https://www.synchrotron.org.au/)
1. [AppDirect](https://www.appdirect.com)
1. [Arctiq Inc.](https://www.arctiq.ca)
1. [ARZ Allgemeines Rechenzentrum GmbH ](https://www.arz.at/)
1. [Baloise](https://www.baloise.com)
1. [BCDevExchange DevOps Platform](https://bcdevexchange.org/DevOpsPlatform)
1. [Beat](https://thebeat.co/en/)
1. [Beez Innovation Labs](https://www.beezlabs.com/)
1. [BioBox Analytics](https://biobox.io)
1. [Camptocamp](https://camptocamp.com)
1. [CARFAX](https://www.carfax.com)
1. [Celonis](https://www.celonis.com/)
1. [Codefresh](https://www.codefresh.io/)
1. [Codility](https://www.codility.com/)
1. [Commonbond](https://commonbond.co/)
1. [CROZ d.o.o.](https://croz.net/)
1. [CyberAgent](https://www.cyberagent.co.jp/en/)
1. [Cybozu](https://cybozu-global.com)
1. [D2iQ](https://www.d2iq.com)
1. [Devtron Labs](https://github.com/devtron-labs/devtron)
1. [EDF Renewables](https://www.edf-re.com/)
1. [edX](https://edx.org)
1. [Electronic Arts Inc. ](https://www.ea.com)
1. [Elium](https://www.elium.com)
1. [END.](https://www.endclothing.com/)
1. [Energisme](https://energisme.com/)
1. [Fave](https://myfave.com)
1. [Future PLC](https://www.futureplc.com/)
1. [Garner](https://www.garnercorp.com)
1. [GMETRI](https://gmetri.com/)
1. [Greenpass](https://www.greenpass.com.br/)
1. [Healy](https://www.healyworld.net)
1. [hipages](https://hipages.com.au/)
1. [Honestbank](https://honestbank.com)
1. [IBM](https://www.ibm.com/)
1. [InsideBoard](https://www.insideboard.com)
1. [Intuit](https://www.intuit.com/)
1. [JovianX](https://www.jovianx.com/)
1. [Kasa](https://kasa.co.kr/)
1. [Keptn](https://keptn.sh)
1. [Kinguin](https://www.kinguin.net/)
1. [KintoHub](https://www.kintohub.com/)
1. [KompiTech GmbH](https://www.kompitech.com/)
1. [LexisNexis](https://www.lexisnexis.com/)
1. [LINE](https://linecorp.com/en/)
1. [Lytt](https://www.lytt.co/)
1. [Major League Baseball](https://mlb.com)
1. [Mambu](https://www.mambu.com/)
1. [Max Kelsen](https://www.maxkelsen.com/)
1. [MindSpore](https://mindspore.cn)
1. [Mirantis](https://mirantis.com/)
1. [Moengage](https://www.moengage.com/)
1. [Money Forward](https://corp.moneyforward.com/en/)
1. [MOO Print](https://www.moo.com/)
1. [MTN Group](https://www.mtn.com/)
1. [New Relic](https://newrelic.com/)
1. [Nextdoor](https://nextdoor.com/)
1. [Nikkei](https://www.nikkei.co.jp/nikkeiinfo/en/)
1. [Octadesk](https://octadesk.com)
1. [openEuler](https://openeuler.org)
1. [openGauss](https://opengauss.org/)
1. [openLooKeng](https://openlookeng.io)
1. [OpenSaaS Studio](https://opensaas.studio)
1. [Opensurvey](https://www.opensurvey.co.kr/)
1. [Optoro](https://www.optoro.com/)
1. [Orbital Insight](https://orbitalinsight.com/)
1. [PayPay](https://paypay.ne.jp/)
1. [Peloton Interactive](https://www.onepeloton.com/)
1. [Pipefy](https://www.pipefy.com/)
1. [Preferred Networks](https://preferred.jp/en/)
1. [Prudential](https://prudential.com.sg)
1. [PUBG](https://www.pubg.com)
1. [Qonto](https://qonto.com)
1. [QuintoAndar](https://quintoandar.com.br)
1. [Quipper](https://www.quipper.com/)
1. [Recreation.gov](https://www.recreation.gov/)
1. [Red Hat](https://www.redhat.com/)
1. [Riskified](https://www.riskified.com/)
1. [Robotinfra](https://www.robotinfra.com)
1. [Saildrone](https://www.saildrone.com/)
1. [Saloodo! GmbH](https://www.saloodo.com)
1. [Speee](https://speee.jp/)
1. [Spendesk](https://spendesk.com/)
1. [Sumo Logic](https://sumologic.com/)
1. [Swisscom](https://www.swisscom.ch)
1. [Swissquote](https://github.com/swissquote)
1. [Syncier](https://syncier.com/)
1. [TableCheck](https://tablecheck.com/)
1. [Tailor Brands](https://www.tailorbrands.com)
1. [Tesla](https://tesla.com/)
1. [ThousandEyes](https://www.thousandeyes.com/)
1. [Ticketmaster](https://ticketmaster.com)
1. [Tiger Analytics](https://www.tigeranalytics.com/)
1. [Toss](https://toss.im/en)
1. [tru.ID](https://tru.id)
1. [Twilio SendGrid](https://sendgrid.com)
1. [tZERO](https://www.tzero.com/)
1. [UBIO](https://ub.io/)
1. [UFirstGroup](https://www.ufirstgroup.com/en/)
1. [Universidad Mesoamericana](https://www.umes.edu.gt/)
1. [Viaduct](https://www.viaduct.ai/)
1. [Virtuo](https://www.govirtuo.com/)
1. [VISITS Technologies](https://visits.world/en)
1. [Volvo Cars](https://www.volvocars.com/)
1. [VSHN - The DevOps Company](https://vshn.ch/)
1. [Walkbase](https://www.walkbase.com/)
1. [WeMo Scooter](https://www.wemoscooter.com/)
1. [Whitehat Berlin](https://whitehat.berlin) by Guido Maria Serra +Fenaroli
1. [Yieldlab](https://www.yieldlab.de/)
1. [Sap Labs] (http://sap.com)

View File

@@ -1 +1 @@
0.9.0
1.9.0

24
assets/badge.svg Normal file
View File

@@ -0,0 +1,24 @@
<svg width="131" height="20" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" >
<defs>
<filter id="dropShadow">
<feDropShadow dx="0.2" dy="0.4" stdDeviation="0.2" flood-color="#333" flood-opacity="0.5"/>
</filter>
</defs>
<clipPath id="roundedCorners">
<rect width="100%" height="100%" rx="3" opacity="1" />
</clipPath>
<g clip-path="url(#roundedCorners)">
<rect id="leftRect" fill="#555" x="0" y="0" width="74" height="20" />
<rect id="rightRect" fill="#4c1" x="74" y="0" width="57" height="20" />
<rect id="revisionRect" fill="#4c1" x="131" y="0" width="62" height="20" display="none"/>
</g>
<g fill="#fff" style="filter: url(#dropShadow);" text-anchor="middle" font-family="DejaVu Sans, sans-serif" font-size="90">
<image x="5" y="3" width="14" height="14" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB8AAAAeCAYAAADU8sWcAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAABPAAAATwFjiv3XAAACC2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS40LjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyI+CiAgICAgICAgIDx0aWZmOlJlc29sdXRpb25Vbml0PjI8L3RpZmY6UmVzb2x1dGlvblVuaXQ+CiAgICAgICAgIDx0aWZmOkNvbXByZXNzaW9uPjE8L3RpZmY6Q29tcHJlc3Npb24+CiAgICAgICAgIDx0aWZmOk9yaWVudGF0aW9uPjE8L3RpZmY6T3JpZW50YXRpb24+CiAgICAgICAgIDx0aWZmOlBob3RvbWV0cmljSW50ZXJwcmV0YXRpb24+MjwvdGlmZjpQaG90b21ldHJpY0ludGVycHJldGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KD0UqkwAACpZJREFUSA11VnmQFcUZ//qY4527by92WWTXwHKqEJDDg0MQUioKSWopK4oaS9RAlMofUSPGbFlBSaViKomgQSNmIdECkUS8ophdozEJArKoKCsgIFlY2Pu9N29mero7X78FxCR2Vb8309PTv+/4fb9vCHz1II2Nm+jmzYul2bJsdlMyO7LyPGlZtYqQck1ZHCgwLZWiROeJgB7bDzpYb/7o0y/emzXv4Pts8+ZGBUC0uf/vQf57wdw3NTVRnOYFfXvj6pJcadkUmbDGRoxVSEItSYAQQrUmRBP81VoRpkFTJUMuZA/3g/28q3dn89b7u885D4348vgf8NPAxY033LJmSlDizlSOU94f6UhoHaZdC/3QCHWON2gDYBhAYyRAWgyD4QSi1815f29++vv/+CoD2Lm2nAFGl8mndzyxMMgk5/iW6xzPi/xVk+oyE8+vLNt14FR/0uYW14ox0IwUJ4ZAaUpAaaBEYByiyLbikWWNnnThvPIxu+L717auVeb81tbWsyk4C34u8I3LnlhcSCameMzykg7TwzOJGIYWQj+M+voLYcSo/hxY1E65FECUq4G4RFP0nSjMCMVAIIKUnOHkw90L6qq/vXvbh02trV8yoBh2E0NMY9GiG+58fIGXTF6epyw7JOnamZQbz/tCnDrVVzgqqdwTT0ZTdWDN0wPpMh3ZPZqHLSw98C7Y4RwtnAodsTwGAg0ppkcxrlkYJFID+Z0bn/zelsFImzQRXfScNJFiOG689dcT/FT6GzlqedVJTHRpPH6yz/PyfTlx2IrLCpvSdWrv5OXkX9fOJB/Mnaz3XzItap+yMDoyZgEE7F1SceIghryeRNwnTBkEqhRIxiLF6bCpDXNybW2v/ruxcTzbt2+zZmfCvWT+zxNhbek3cxaPlyYsXVWSSHT25rxC3o+OWK6aDn7sZ3r79ZNY28w45Esxuhw5RjmVvEQPlIwgR8bOiE7VdrPaA2+TeGEEhFbhtAEmG5pzk5WqqbWTPv7jC8sLpgxNSRWZrUeWTAgor7EY9ytTiURvzg8GskGU5xxKkc33yDcX1yc7x3ijLxF+zZgoEljgCrSiXOWIG/WGrjifHxl1V9iyeKwW1lHNo5SKmDmcYinivwhjVpkor55sQj9+/D4MO9bpLW8RN6zJzMvbPDUkHaecE368N1+IUUJfIm5hPf1w2kTedlm/LgntmqEWEQGT3ScJYUh2NIxiiWupSUFasor1VgzXvPATfv6BC3Roq0E9MLqAXKQcAe1rqi/dv+q3DwQUw6djY6tiAaG1jLEw7nAn64WhcStPqZqpA6chap8aage077GwbQcJDx8Awq3T3DHlbeijUHWwytHFuuizCTergdQ+YocxLRHVPNcESRAJxqo60nbSvExvvvWx23MCVvucDyRt5hitwDRHHG09pZiaT7MlSUdUhtQGZttYRdwA4WnFQjFnDA4LX7UdIlgMYpaouBgGMnuBKVN/ZhgBRCMVynNAHOfRm777q4UcrW3EZxcEnD/kclYlpVaFKFIZrIRtluvdls/G9InnLZ9fpLXoJjwZAzZkDJ5mjkIj8HTCKETH9oD0eoikMSDQ5cTrLrUg4QoaFlxUH5MdYy6yAFAaYBHed6ODkMPOkMcFZggZKa0SkaL/jMeDpq5D1Vez9693V/wNUg1jQRY8yLX8BcSba8AaOgyBOdqtQBz7DNj8lZCeNY9SN6aiD3bTOc89s2iliDVvKa3uGxf6doQAxYE2oBbm0HQPG5IxqKhOg9ZpSSQj+pDU+jv5t7913spV5c70GcqLJwgMGw6ZJUuBLbgHPW0D4rgQdewDvnAllN58B0D918AvzVBn3jWi/p4Hq2/s+et1URgBRlVRMGVvBtITfwyuyYPAoIRmWSIrEqjZW1Ml/qN7dtRWzptfBzXDoaeri6TicWhes8Zsg9iMOaAyU0D3fw4qdSEkrryquP77xx+HZCwG3T09HEZfCBUXTxh125H9VZ9SHp1OfZF4aEWI9MM1AhmiVCmaIwV6a2F5ge2q8s7OBB8ytPiOZduw6pFHYOS4cUUQGsNWXj4MVLYdaGU9UAQ0o2H8eHh49WpAITReKqdmGC0PsvF2JB4Gu+i5RqKg5JSi82mOnu9GYGEhwbFjSOXadJII7Pa6Ed3hwU8igAU8lU7D/ffdZ1pFEUT19YI+sR9oZgLIjo8h6usDu2oIzJpxOc4ZphKQtoqFxw6LzxIV/RMxkabSUPAJRz3A5oc50x9T7Lf3xkR0R0xGSS+IRIFQOUUUkqvGXdR5tGXnLmjbYXI0OLCJykIBvFe2ABVHgCQqgMpjkH9xE9IY7cSgGd0w+8mOVjiy68DOh+sauusiwSM8F11nlhCm39/SvP7ux4qNZVfba/0TJ183Is9opWtxEXe5E/cC+Y5bf+CilmczqaC/JigEOjjYTrwtzwB8tAn4kJFGMIEmy0B98gb4B7tAYimHncd19ObLrP25rW0/rb76pQqsoKTEkKJgoT64biCObVx35xvGGz67qYW3Nl0RWYH/ftxmo7pyfpSoKFFjEiLxhE73jXaueHXlGw+PZ68rS8pQ01QlodUjTqcAfcQo8qGjQB36EwQfbFAuF8wjZbmNtStefZ4nC0uibKIHez92AeZEUln5wocGuLGxyUbg2cVEFp5a9pFz11MH/ZCP6M0V8gmbxWZL35K2paFmUmjDgCXAMQkjqv8wgFMGBFVSCw8g1wWsrB5IBrTDAvB0eaAkhVHCeGzSQDUm3bE9/1hs/d7dBhy5aSqAaNNWN6Mvdn9+e0KGfl8hZCd6vBwqABmISKSkCgkqr/a6QMWrwLpsKaYWhfrwi1ikfWBNvQmUhXItAlznICMlcopFFNXcEA25wBw/EIms2L4O1onZs5u46abFUsILDWhAc/OKo7H+/OtuEFqaUcsmIE8CR47zEMsSuJvRQcceODVmOqR/uAHKftAC6R+9AKcmzgVxci9qexwLTIDZ34+MR6FVErXECXw7kc+3/G7j8gPG0dbWJmQnum1+zDj3U2rJ0rWzvFRynu/YskMTb5vetmwI7xyeg7R0g072ynEGwa0PwZTRDbDn0GGI1j0Ii2pCKPCyqJTl+eei9tOl5Kr1eU2seuG5ZMBv2fjUIMkQymAWC6jouQE3jdlYZa43PLnsLbcn++eYVwi6FCQktTCEmO3QAx2rhOllAl6bOwsahg2FDTMvhRklWVSUMkxcWEyHJFbUqyCW9AtRSV//K18AF4XmbOWeBTegCF78ujTXf3hm+XvTeo49G8/67Sg+A0a0OGc6CDzIlFbDL3+8GPYuuxLWP7AYysprIQx9YNjdzAglyVkD3qGvd3dsWvv0infM2qBj53zr49rZsJsNZwa2WeTTFxtP3L1oe1VCzh3AWqOM2FJJsFBwbMuCUAgQyAqGrVVJ7Zdwyz2RZS/X/GbrguJ5eNYgyhfnncH5v+DmYcft18Y1T5S7fl9jPMN+4aM6IpeQPmgxThNA5AnuJFhIeI2tHafiNqEUW1XQL+8NrfRznENP1drNuTOA5/5/KezmAZ4zaJBSdVaUvQk5PsNTeqfrMsKQOui5LGKibBAjmKgSRk/RIMlc8BiWCLbI95Dx05jybrMkfsh+xfgPf+hH0AC4OlsAAAAASUVORK5CYII="/>
<text id="leftText" x="435" y="140" transform="scale(.1)" textLength="470"></text>
<text id="rightText" x="995" y="140" transform="scale(.1)" textLength="470"></text>
<text id="revisionText" x="1550" y="140" font-family="monospace" transform="scale(.1)" font-size="110" display="none"></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@@ -7,14 +7,22 @@
# p, <user/group>, <resource>, <action>, <object>
p, role:readonly, applications, get, */*, allow
p, role:readonly, certificates, get, *, allow
p, role:readonly, clusters, get, *, allow
p, role:readonly, repositories, get, *, allow
p, role:readonly, projects, get, *, allow
p, role:readonly, accounts, get, *, allow
p, role:readonly, gpgkeys, get, *, allow
p, role:admin, applications, create, */*, allow
p, role:admin, applications, update, */*, allow
p, role:admin, applications, delete, */*, allow
p, role:admin, applications, sync, */*, allow
p, role:admin, applications, override, */*, allow
p, role:admin, applications, action/*, */*, allow
p, role:admin, certificates, create, *, allow
p, role:admin, certificates, update, *, allow
p, role:admin, certificates, delete, *, allow
p, role:admin, clusters, create, *, allow
p, role:admin, clusters, update, *, allow
p, role:admin, clusters, delete, *, allow
@@ -24,6 +32,9 @@ p, role:admin, repositories, delete, *, allow
p, role:admin, projects, create, *, allow
p, role:admin, projects, update, *, allow
p, role:admin, projects, delete, *, allow
p, role:admin, accounts, update, *, allow
p, role:admin, gpgkeys, create, *, allow
p, role:admin, gpgkeys, delete, *, allow
g, role:admin, role:readonly
g, admin, role:admin
1 # Built-in policy which defines two roles: role:readonly and role:admin,
7 # p, <user/group>, <resource>, <action>, <object>
8 p, role:readonly, applications, get, */*, allow
9 p, role:readonly, clusters, get, *, allow p, role:readonly, certificates, get, *, allow
10 p, role:readonly, clusters, get, *, allow
11 p, role:readonly, repositories, get, *, allow
12 p, role:readonly, projects, get, *, allow
13 p, role:admin, applications, create, */*, allow p, role:readonly, accounts, get, *, allow
14 p, role:readonly, gpgkeys, get, *, allow
15 p, role:admin, applications, create, */*, allow
16 p, role:admin, applications, update, */*, allow
17 p, role:admin, applications, delete, */*, allow
18 p, role:admin, applications, sync, */*, allow
19 p, role:admin, clusters, create, *, allow p, role:admin, applications, override, */*, allow
20 p, role:admin, clusters, update, *, allow p, role:admin, applications, action/*, */*, allow
21 p, role:admin, certificates, create, *, allow
22 p, role:admin, certificates, update, *, allow
23 p, role:admin, certificates, delete, *, allow
24 p, role:admin, clusters, create, *, allow
25 p, role:admin, clusters, update, *, allow
26 p, role:admin, clusters, delete, *, allow
27 p, role:admin, repositories, create, *, allow
28 p, role:admin, repositories, update, *, allow
32 p, role:admin, projects, delete, *, allow
33 g, role:admin, role:readonly p, role:admin, accounts, update, *, allow
34 g, admin, role:admin p, role:admin, gpgkeys, create, *, allow
35 p, role:admin, gpgkeys, delete, *, allow
36 g, role:admin, role:readonly
37 g, admin, role:admin
38
39
40

View File

@@ -11,4 +11,4 @@ g = _, _
e = some(where (p.eft == allow)) && !some(where (p.eft == deny))
[matchers]
m = g(r.sub, p.sub) && keyMatch(r.res, p.res) && keyMatch(r.act, p.act) && keyMatch(r.obj, p.obj)
m = g(r.sub, p.sub) && globMatch(r.res, p.res) && globMatch(r.act, p.act) && globMatch(r.obj, p.obj)

6496
assets/swagger.json Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,151 @@
package commands
import (
"context"
"math"
"time"
"github.com/argoproj/pkg/stats"
"github.com/go-redis/redis/v8"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
cmdutil "github.com/argoproj/argo-cd/cmd/util"
"github.com/argoproj/argo-cd/common"
"github.com/argoproj/argo-cd/controller"
"github.com/argoproj/argo-cd/controller/sharding"
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
appclientset "github.com/argoproj/argo-cd/pkg/client/clientset/versioned"
"github.com/argoproj/argo-cd/reposerver/apiclient"
cacheutil "github.com/argoproj/argo-cd/util/cache"
appstatecache "github.com/argoproj/argo-cd/util/cache/appstate"
"github.com/argoproj/argo-cd/util/cli"
"github.com/argoproj/argo-cd/util/env"
"github.com/argoproj/argo-cd/util/errors"
kubeutil "github.com/argoproj/argo-cd/util/kube"
"github.com/argoproj/argo-cd/util/settings"
)
const (
// CLIName is the name of the CLI
cliName = "argocd-application-controller"
// Default time in seconds for application resync period
defaultAppResyncPeriod = 180
)
func NewCommand() *cobra.Command {
var (
clientConfig clientcmd.ClientConfig
appResyncPeriod int64
repoServerAddress string
repoServerTimeoutSeconds int
selfHealTimeoutSeconds int
statusProcessors int
operationProcessors int
glogLevel int
metricsPort int
metricsCacheExpiration time.Duration
kubectlParallelismLimit int64
cacheSrc func() (*appstatecache.Cache, error)
redisClient *redis.Client
)
var command = cobra.Command{
Use: cliName,
Short: "Run ArgoCD Application Controller",
Long: "ArgoCD application controller is a Kubernetes controller that continuously monitors running applications and compares the current, live state against the desired target state (as specified in the repo). This command runs Application Controller in the foreground. It can be configured by following options.",
DisableAutoGenTag: true,
RunE: func(c *cobra.Command, args []string) error {
cli.SetLogFormat(cmdutil.LogFormat)
cli.SetLogLevel(cmdutil.LogLevel)
cli.SetGLogLevel(glogLevel)
config, err := clientConfig.ClientConfig()
errors.CheckError(err)
errors.CheckError(v1alpha1.SetK8SConfigDefaults(config))
kubeClient := kubernetes.NewForConfigOrDie(config)
appClient := appclientset.NewForConfigOrDie(config)
namespace, _, err := clientConfig.Namespace()
errors.CheckError(err)
resyncDuration := time.Duration(appResyncPeriod) * time.Second
repoClientset := apiclient.NewRepoServerClientset(repoServerAddress, repoServerTimeoutSeconds)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
cache, err := cacheSrc()
errors.CheckError(err)
cache.Cache.SetClient(cacheutil.NewTwoLevelClient(cache.Cache.GetClient(), 10*time.Minute))
settingsMgr := settings.NewSettingsManager(ctx, kubeClient, namespace)
kubectl := kubeutil.NewKubectl()
clusterFilter := getClusterFilter()
appController, err := controller.NewApplicationController(
namespace,
settingsMgr,
kubeClient,
appClient,
repoClientset,
cache,
kubectl,
resyncDuration,
time.Duration(selfHealTimeoutSeconds)*time.Second,
metricsPort,
metricsCacheExpiration,
kubectlParallelismLimit,
clusterFilter)
errors.CheckError(err)
cacheutil.CollectMetrics(redisClient, appController.GetMetricsServer())
vers := common.GetVersion()
log.Infof("Application Controller (version: %s, built: %s) starting (namespace: %s)", vers.Version, vers.BuildDate, namespace)
stats.RegisterStackDumper()
stats.StartStatsTicker(10 * time.Minute)
stats.RegisterHeapDumper("memprofile")
go appController.Run(ctx, statusProcessors, operationProcessors)
// Wait forever
select {}
},
}
clientConfig = cli.AddKubectlFlagsToCmd(&command)
command.Flags().Int64Var(&appResyncPeriod, "app-resync", defaultAppResyncPeriod, "Time period in seconds for application resync.")
command.Flags().StringVar(&repoServerAddress, "repo-server", common.DefaultRepoServerAddr, "Repo server address.")
command.Flags().IntVar(&repoServerTimeoutSeconds, "repo-server-timeout-seconds", 60, "Repo server RPC call timeout seconds.")
command.Flags().IntVar(&statusProcessors, "status-processors", 1, "Number of application status processors")
command.Flags().IntVar(&operationProcessors, "operation-processors", 1, "Number of application operation processors")
command.Flags().StringVar(&cmdutil.LogFormat, "logformat", "text", "Set the logging format. One of: text|json")
command.Flags().StringVar(&cmdutil.LogLevel, "loglevel", "info", "Set the logging level. One of: debug|info|warn|error")
command.Flags().IntVar(&glogLevel, "gloglevel", 0, "Set the glog logging level")
command.Flags().IntVar(&metricsPort, "metrics-port", common.DefaultPortArgoCDMetrics, "Start metrics server on given port")
command.Flags().DurationVar(&metricsCacheExpiration, "metrics-cache-expiration", 0*time.Second, "Prometheus metrics cache expiration (disabled by default. e.g. 24h0m0s)")
command.Flags().IntVar(&selfHealTimeoutSeconds, "self-heal-timeout-seconds", 5, "Specifies timeout between application self heal attempts")
command.Flags().Int64Var(&kubectlParallelismLimit, "kubectl-parallelism-limit", 20, "Number of allowed concurrent kubectl fork/execs. Any value less the 1 means no limit.")
cacheSrc = appstatecache.AddCacheFlagsToCmd(&command, func(client *redis.Client) {
redisClient = client
})
return &command
}
func getClusterFilter() func(cluster *v1alpha1.Cluster) bool {
replicas := env.ParseNumFromEnv(common.EnvControllerReplicas, 0, 0, math.MaxInt32)
shard := env.ParseNumFromEnv(common.EnvControllerShard, -1, -math.MaxInt32, math.MaxInt32)
var clusterFilter func(cluster *v1alpha1.Cluster) bool
if replicas > 1 {
if shard < 0 {
var err error
shard, err = sharding.InferShard()
errors.CheckError(err)
}
log.Infof("Processing clusters from shard %d", shard)
clusterFilter = sharding.GetClusterFilter(replicas, shard)
} else {
log.Info("Processing all cluster shards")
}
return clusterFilter
}

View File

@@ -1,109 +0,0 @@
package main
import (
"context"
"flag"
"fmt"
"os"
"strconv"
"time"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
// load the gcp plugin (required to authenticate against GKE clusters).
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
// load the oidc plugin (required to authenticate with OpenID Connect).
_ "k8s.io/client-go/plugin/pkg/client/auth/oidc"
"github.com/argoproj/argo-cd"
"github.com/argoproj/argo-cd/controller"
"github.com/argoproj/argo-cd/errors"
appclientset "github.com/argoproj/argo-cd/pkg/client/clientset/versioned"
"github.com/argoproj/argo-cd/reposerver"
"github.com/argoproj/argo-cd/util/cli"
"github.com/argoproj/argo-cd/util/stats"
)
const (
// CLIName is the name of the CLI
cliName = "argocd-application-controller"
// Default time in seconds for application resync period
defaultAppResyncPeriod = 180
)
func newCommand() *cobra.Command {
var (
clientConfig clientcmd.ClientConfig
appResyncPeriod int64
repoServerAddress string
statusProcessors int
operationProcessors int
logLevel string
glogLevel int
)
var command = cobra.Command{
Use: cliName,
Short: "application-controller is a controller to operate on applications CRD",
RunE: func(c *cobra.Command, args []string) error {
level, err := log.ParseLevel(logLevel)
errors.CheckError(err)
log.SetLevel(level)
// Set the glog level for the k8s go-client
_ = flag.CommandLine.Parse([]string{})
_ = flag.Lookup("logtostderr").Value.Set("true")
_ = flag.Lookup("v").Value.Set(strconv.Itoa(glogLevel))
config, err := clientConfig.ClientConfig()
errors.CheckError(err)
kubeClient := kubernetes.NewForConfigOrDie(config)
appClient := appclientset.NewForConfigOrDie(config)
namespace, _, err := clientConfig.Namespace()
errors.CheckError(err)
resyncDuration := time.Duration(appResyncPeriod) * time.Second
repoClientset := reposerver.NewRepositoryServerClientset(repoServerAddress)
appController := controller.NewApplicationController(
namespace,
kubeClient,
appClient,
repoClientset,
resyncDuration)
secretController := controller.NewSecretController(kubeClient, repoClientset, resyncDuration, namespace)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
log.Infof("Application Controller (version: %s) starting (namespace: %s)", argocd.GetVersion(), namespace)
stats.RegisterStackDumper()
stats.StartStatsTicker(10 * time.Minute)
stats.RegisterHeapDumper("memprofile")
go secretController.Run(ctx)
go appController.Run(ctx, statusProcessors, operationProcessors)
// Wait forever
select {}
},
}
clientConfig = cli.AddKubectlFlagsToCmd(&command)
command.Flags().Int64Var(&appResyncPeriod, "app-resync", defaultAppResyncPeriod, "Time period in seconds for application resync.")
command.Flags().StringVar(&repoServerAddress, "repo-server", "localhost:8081", "Repo server address.")
command.Flags().IntVar(&statusProcessors, "status-processors", 1, "Number of application status processors")
command.Flags().IntVar(&operationProcessors, "operation-processors", 1, "Number of application operation processors")
command.Flags().StringVar(&logLevel, "loglevel", "info", "Set the logging level. One of: debug|info|warn|error")
command.Flags().IntVar(&glogLevel, "gloglevel", 0, "Set the glog logging level")
return &command
}
func main() {
if err := newCommand().Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
}

View File

@@ -0,0 +1,202 @@
package commands
import (
"context"
"fmt"
"io/ioutil"
"os"
"os/exec"
"syscall"
"github.com/ghodss/yaml"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
cmdutil "github.com/argoproj/argo-cd/cmd/util"
"github.com/argoproj/argo-cd/util/cli"
"github.com/argoproj/argo-cd/util/dex"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/settings"
)
const (
cliName = "argocd-dex"
)
func NewCommand() *cobra.Command {
var command = &cobra.Command{
Use: cliName,
Short: "argocd-dex tools used by Argo CD",
Long: "argocd-dex has internal utility tools used by Argo CD",
DisableAutoGenTag: true,
Run: func(c *cobra.Command, args []string) {
c.HelpFunc()(c, args)
},
}
command.AddCommand(NewRunDexCommand())
command.AddCommand(NewGenDexConfigCommand())
command.Flags().StringVar(&cmdutil.LogFormat, "logformat", "text", "Set the logging format. One of: text|json")
command.Flags().StringVar(&cmdutil.LogLevel, "loglevel", "info", "Set the logging level. One of: debug|info|warn|error")
return command
}
func NewRunDexCommand() *cobra.Command {
var (
clientConfig clientcmd.ClientConfig
)
var command = cobra.Command{
Use: "rundex",
Short: "Runs dex generating a config using settings from the Argo CD configmap and secret",
RunE: func(c *cobra.Command, args []string) error {
_, err := exec.LookPath("dex")
errors.CheckError(err)
config, err := clientConfig.ClientConfig()
errors.CheckError(err)
namespace, _, err := clientConfig.Namespace()
errors.CheckError(err)
kubeClientset := kubernetes.NewForConfigOrDie(config)
settingsMgr := settings.NewSettingsManager(context.Background(), kubeClientset, namespace)
prevSettings, err := settingsMgr.GetSettings()
errors.CheckError(err)
updateCh := make(chan *settings.ArgoCDSettings, 1)
settingsMgr.Subscribe(updateCh)
for {
var cmd *exec.Cmd
dexCfgBytes, err := dex.GenerateDexConfigYAML(prevSettings)
errors.CheckError(err)
if len(dexCfgBytes) == 0 {
log.Infof("dex is not configured")
} else {
err = ioutil.WriteFile("/tmp/dex.yaml", dexCfgBytes, 0644)
errors.CheckError(err)
log.Debug(redactor(string(dexCfgBytes)))
cmd = exec.Command("dex", "serve", "/tmp/dex.yaml")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err = cmd.Start()
errors.CheckError(err)
}
// loop until the dex config changes
for {
newSettings := <-updateCh
newDexCfgBytes, err := dex.GenerateDexConfigYAML(newSettings)
errors.CheckError(err)
if string(newDexCfgBytes) != string(dexCfgBytes) {
prevSettings = newSettings
log.Infof("dex config modified. restarting dex")
if cmd != nil && cmd.Process != nil {
err = cmd.Process.Signal(syscall.SIGTERM)
errors.CheckError(err)
_, err = cmd.Process.Wait()
errors.CheckError(err)
}
break
} else {
log.Infof("dex config unmodified")
}
}
}
},
}
clientConfig = cli.AddKubectlFlagsToCmd(&command)
return &command
}
func NewGenDexConfigCommand() *cobra.Command {
var (
clientConfig clientcmd.ClientConfig
out string
)
var command = cobra.Command{
Use: "gendexcfg",
Short: "Generates a dex config from Argo CD settings",
RunE: func(c *cobra.Command, args []string) error {
config, err := clientConfig.ClientConfig()
errors.CheckError(err)
namespace, _, err := clientConfig.Namespace()
errors.CheckError(err)
kubeClientset := kubernetes.NewForConfigOrDie(config)
settingsMgr := settings.NewSettingsManager(context.Background(), kubeClientset, namespace)
settings, err := settingsMgr.GetSettings()
errors.CheckError(err)
dexCfgBytes, err := dex.GenerateDexConfigYAML(settings)
errors.CheckError(err)
if len(dexCfgBytes) == 0 {
log.Infof("dex is not configured")
return nil
}
if out == "" {
dexCfg := make(map[string]interface{})
err := yaml.Unmarshal(dexCfgBytes, &dexCfg)
errors.CheckError(err)
if staticClientsInterface, ok := dexCfg["staticClients"]; ok {
if staticClients, ok := staticClientsInterface.([]interface{}); ok {
for i := range staticClients {
staticClient := staticClients[i]
if mappings, ok := staticClient.(map[string]interface{}); ok {
for key := range mappings {
if key == "secret" {
mappings[key] = "******"
}
}
staticClients[i] = mappings
}
}
dexCfg["staticClients"] = staticClients
}
}
errors.CheckError(err)
maskedDexCfgBytes, err := yaml.Marshal(dexCfg)
errors.CheckError(err)
fmt.Print(string(maskedDexCfgBytes))
} else {
err = ioutil.WriteFile(out, dexCfgBytes, 0644)
errors.CheckError(err)
}
return nil
},
}
clientConfig = cli.AddKubectlFlagsToCmd(&command)
command.Flags().StringVarP(&out, "out", "o", "", "Output to the specified file instead of stdout")
return &command
}
func iterateStringFields(obj interface{}, callback func(name string, val string) string) {
if mapField, ok := obj.(map[string]interface{}); ok {
for field, val := range mapField {
if strVal, ok := val.(string); ok {
mapField[field] = callback(field, strVal)
} else {
iterateStringFields(val, callback)
}
}
} else if arrayField, ok := obj.([]interface{}); ok {
for i := range arrayField {
iterateStringFields(arrayField[i], callback)
}
}
}
func redactor(dirtyString string) string {
config := make(map[string]interface{})
err := yaml.Unmarshal([]byte(dirtyString), &config)
errors.CheckError(err)
iterateStringFields(config, func(name string, val string) string {
if name == "clientSecret" || name == "secret" || name == "bindPW" {
return "********"
} else {
return val
}
})
data, err := yaml.Marshal(config)
errors.CheckError(err)
return string(data)
}

View File

@@ -0,0 +1,161 @@
package commands
import (
"fmt"
"math"
"net"
"net/http"
"os"
"time"
"github.com/argoproj/pkg/stats"
"github.com/go-redis/redis/v8"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"google.golang.org/grpc/health/grpc_health_v1"
cmdutil "github.com/argoproj/argo-cd/cmd/util"
"github.com/argoproj/argo-cd/common"
"github.com/argoproj/argo-cd/reposerver"
"github.com/argoproj/argo-cd/reposerver/apiclient"
reposervercache "github.com/argoproj/argo-cd/reposerver/cache"
"github.com/argoproj/argo-cd/reposerver/metrics"
"github.com/argoproj/argo-cd/reposerver/repository"
cacheutil "github.com/argoproj/argo-cd/util/cache"
"github.com/argoproj/argo-cd/util/cli"
"github.com/argoproj/argo-cd/util/env"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/gpg"
"github.com/argoproj/argo-cd/util/healthz"
ioutil "github.com/argoproj/argo-cd/util/io"
"github.com/argoproj/argo-cd/util/tls"
)
const (
// CLIName is the name of the CLI
cliName = "argocd-repo-server"
gnuPGSourcePath = "/app/config/gpg/source"
defaultPauseGenerationAfterFailedGenerationAttempts = 3
defaultPauseGenerationOnFailureForMinutes = 60
defaultPauseGenerationOnFailureForRequests = 0
)
func getGnuPGSourcePath() string {
if path := os.Getenv("ARGOCD_GPG_DATA_PATH"); path != "" {
return path
} else {
return gnuPGSourcePath
}
}
func getPauseGenerationAfterFailedGenerationAttempts() int {
return env.ParseNumFromEnv(common.EnvPauseGenerationAfterFailedAttempts, defaultPauseGenerationAfterFailedGenerationAttempts, 0, math.MaxInt32)
}
func getPauseGenerationOnFailureForMinutes() int {
return env.ParseNumFromEnv(common.EnvPauseGenerationMinutes, defaultPauseGenerationOnFailureForMinutes, 0, math.MaxInt32)
}
func getPauseGenerationOnFailureForRequests() int {
return env.ParseNumFromEnv(common.EnvPauseGenerationRequests, defaultPauseGenerationOnFailureForRequests, 0, math.MaxInt32)
}
func NewCommand() *cobra.Command {
var (
parallelismLimit int64
listenPort int
metricsPort int
cacheSrc func() (*reposervercache.Cache, error)
tlsConfigCustomizerSrc func() (tls.ConfigCustomizer, error)
redisClient *redis.Client
)
var command = cobra.Command{
Use: cliName,
Short: "Run ArgoCD Repository Server",
Long: "ArgoCD Repository Server is an internal service which maintains a local cache of the Git repository holding the application manifests, and is responsible for generating and returning the Kubernetes manifests. This command runs Repository Server in the foreground. It can be configured by following options.",
DisableAutoGenTag: true,
RunE: func(c *cobra.Command, args []string) error {
cli.SetLogFormat(cmdutil.LogFormat)
cli.SetLogLevel(cmdutil.LogLevel)
tlsConfigCustomizer, err := tlsConfigCustomizerSrc()
errors.CheckError(err)
cache, err := cacheSrc()
errors.CheckError(err)
metricsServer := metrics.NewMetricsServer()
cacheutil.CollectMetrics(redisClient, metricsServer)
server, err := reposerver.NewServer(metricsServer, cache, tlsConfigCustomizer, repository.RepoServerInitConstants{
ParallelismLimit: parallelismLimit,
PauseGenerationAfterFailedGenerationAttempts: getPauseGenerationAfterFailedGenerationAttempts(),
PauseGenerationOnFailureForMinutes: getPauseGenerationOnFailureForMinutes(),
PauseGenerationOnFailureForRequests: getPauseGenerationOnFailureForRequests(),
})
errors.CheckError(err)
grpc := server.CreateGRPC()
listener, err := net.Listen("tcp", fmt.Sprintf(":%d", listenPort))
errors.CheckError(err)
healthz.ServeHealthCheck(http.DefaultServeMux, func(r *http.Request) error {
if val, ok := r.URL.Query()["full"]; ok && len(val) > 0 && val[0] == "true" {
// connect to itself to make sure repo server is able to serve connection
// used by liveness probe to auto restart repo server
// see https://github.com/argoproj/argo-cd/issues/5110 for more information
conn, err := apiclient.NewConnection(fmt.Sprintf("localhost:%d", listenPort), 60)
if err != nil {
return err
}
defer ioutil.Close(conn)
client := grpc_health_v1.NewHealthClient(conn)
res, err := client.Check(r.Context(), &grpc_health_v1.HealthCheckRequest{})
if err != nil {
return err
}
if res.Status != grpc_health_v1.HealthCheckResponse_SERVING {
return fmt.Errorf("grpc health check status is '%v'", res.Status)
}
return nil
}
return nil
})
http.Handle("/metrics", metricsServer.GetHandler())
go func() { errors.CheckError(http.ListenAndServe(fmt.Sprintf(":%d", metricsPort), nil)) }()
if gpg.IsGPGEnabled() {
log.Infof("Initializing GnuPG keyring at %s", common.GetGnuPGHomePath())
err = gpg.InitializeGnuPG()
errors.CheckError(err)
log.Infof("Populating GnuPG keyring with keys from %s", getGnuPGSourcePath())
added, removed, err := gpg.SyncKeyRingFromDirectory(getGnuPGSourcePath())
errors.CheckError(err)
log.Infof("Loaded %d (and removed %d) keys from keyring", len(added), len(removed))
go func() { errors.CheckError(reposerver.StartGPGWatcher(getGnuPGSourcePath())) }()
}
log.Infof("argocd-repo-server %s serving on %s", common.GetVersion(), listener.Addr())
stats.RegisterStackDumper()
stats.StartStatsTicker(10 * time.Minute)
stats.RegisterHeapDumper("memprofile")
err = grpc.Serve(listener)
errors.CheckError(err)
return nil
},
}
command.Flags().StringVar(&cmdutil.LogFormat, "logformat", "text", "Set the logging format. One of: text|json")
command.Flags().StringVar(&cmdutil.LogLevel, "loglevel", "info", "Set the logging level. One of: debug|info|warn|error")
command.Flags().Int64Var(&parallelismLimit, "parallelismlimit", 0, "Limit on number of concurrent manifests generate requests. Any value less the 1 means no limit.")
command.Flags().IntVar(&listenPort, "port", common.DefaultPortRepoServer, "Listen on given port for incoming connections")
command.Flags().IntVar(&metricsPort, "metrics-port", common.DefaultPortRepoServerMetrics, "Start metrics server on given port")
tlsConfigCustomizerSrc = tls.AddTLSFlagsToCmd(&command)
cacheSrc = reposervercache.AddCacheFlagsToCmd(&command, func(client *redis.Client) {
redisClient = client
})
return &command
}

View File

@@ -1,85 +0,0 @@
package main
import (
"fmt"
"net"
"os"
"time"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/argoproj/argo-cd"
"github.com/argoproj/argo-cd/errors"
"github.com/argoproj/argo-cd/reposerver"
"github.com/argoproj/argo-cd/reposerver/repository"
"github.com/argoproj/argo-cd/util/cache"
"github.com/argoproj/argo-cd/util/git"
"github.com/argoproj/argo-cd/util/ksonnet"
"github.com/argoproj/argo-cd/util/stats"
"github.com/argoproj/argo-cd/util/tls"
)
const (
// CLIName is the name of the CLI
cliName = "argocd-repo-server"
port = 8081
)
func newCommand() *cobra.Command {
var (
logLevel string
tlsConfigCustomizerSrc func() (tls.ConfigCustomizer, error)
)
var command = cobra.Command{
Use: cliName,
Short: "Run argocd-repo-server",
RunE: func(c *cobra.Command, args []string) error {
level, err := log.ParseLevel(logLevel)
errors.CheckError(err)
log.SetLevel(level)
tlsConfigCustomizer, err := tlsConfigCustomizerSrc()
errors.CheckError(err)
server, err := reposerver.NewServer(git.NewFactory(), newCache(), tlsConfigCustomizer)
errors.CheckError(err)
grpc := server.CreateGRPC()
listener, err := net.Listen("tcp", fmt.Sprintf(":%d", port))
errors.CheckError(err)
ksVers, err := ksonnet.KsonnetVersion()
errors.CheckError(err)
log.Infof("argocd-repo-server %s serving on %s", argocd.GetVersion(), listener.Addr())
log.Infof("ksonnet version: %s", ksVers)
stats.RegisterStackDumper()
stats.StartStatsTicker(10 * time.Minute)
stats.RegisterHeapDumper("memprofile")
err = grpc.Serve(listener)
errors.CheckError(err)
return nil
},
}
command.Flags().StringVar(&logLevel, "loglevel", "info", "Set the logging level. One of: debug|info|warn|error")
tlsConfigCustomizerSrc = tls.AddTLSFlagsToCmd(&command)
return &command
}
func newCache() cache.Cache {
return cache.NewInMemoryCache(repository.DefaultRepoCacheExpiration)
// client := redis.NewClient(&redis.Options{
// Addr: "localhost:6379",
// Password: "",
// DB: 0,
// })
// return cache.NewRedisCache(client, repository.DefaultRepoCacheExpiration)
}
func main() {
if err := newCommand().Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
}

View File

@@ -0,0 +1,161 @@
package commands
import (
"context"
"time"
"github.com/argoproj/pkg/stats"
"github.com/go-redis/redis/v8"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
cmdutil "github.com/argoproj/argo-cd/cmd/util"
"github.com/argoproj/argo-cd/common"
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
appclientset "github.com/argoproj/argo-cd/pkg/client/clientset/versioned"
"github.com/argoproj/argo-cd/reposerver/apiclient"
"github.com/argoproj/argo-cd/server"
servercache "github.com/argoproj/argo-cd/server/cache"
"github.com/argoproj/argo-cd/util/cli"
"github.com/argoproj/argo-cd/util/env"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/kube"
"github.com/argoproj/argo-cd/util/tls"
)
const (
failureRetryCountEnv = "ARGOCD_K8S_RETRY_COUNT"
failureRetryPeriodMilliSecondsEnv = "ARGOCD_K8S_RETRY_DURATION_MILLISECONDS"
)
var (
failureRetryCount = 0
failureRetryPeriodMilliSeconds = 100
)
func init() {
failureRetryCount = env.ParseNumFromEnv(failureRetryCountEnv, failureRetryCount, 0, 10)
failureRetryPeriodMilliSeconds = env.ParseNumFromEnv(failureRetryPeriodMilliSecondsEnv, failureRetryPeriodMilliSeconds, 0, 1000)
}
// NewCommand returns a new instance of an argocd command
func NewCommand() *cobra.Command {
var (
redisClient *redis.Client
insecure bool
listenPort int
metricsPort int
glogLevel int
clientConfig clientcmd.ClientConfig
repoServerTimeoutSeconds int
staticAssetsDir string
baseHRef string
rootPath string
repoServerAddress string
dexServerAddress string
disableAuth bool
enableGZip bool
tlsConfigCustomizerSrc func() (tls.ConfigCustomizer, error)
cacheSrc func() (*servercache.Cache, error)
frameOptions string
)
var command = &cobra.Command{
Use: cliName,
Short: "Run the ArgoCD API server",
Long: "The API server is a gRPC/REST server which exposes the API consumed by the Web UI, CLI, and CI/CD systems. This command runs API server in the foreground. It can be configured by following options.",
DisableAutoGenTag: true,
Run: func(c *cobra.Command, args []string) {
cli.SetLogFormat(cmdutil.LogFormat)
cli.SetLogLevel(cmdutil.LogLevel)
cli.SetGLogLevel(glogLevel)
config, err := clientConfig.ClientConfig()
errors.CheckError(err)
errors.CheckError(v1alpha1.SetK8SConfigDefaults(config))
namespace, _, err := clientConfig.Namespace()
errors.CheckError(err)
tlsConfigCustomizer, err := tlsConfigCustomizerSrc()
errors.CheckError(err)
cache, err := cacheSrc()
errors.CheckError(err)
kubeclientset := kubernetes.NewForConfigOrDie(config)
appclientsetConfig, err := clientConfig.ClientConfig()
errors.CheckError(err)
errors.CheckError(v1alpha1.SetK8SConfigDefaults(appclientsetConfig))
if failureRetryCount > 0 {
appclientsetConfig = kube.AddFailureRetryWrapper(appclientsetConfig, failureRetryCount, failureRetryPeriodMilliSeconds)
}
appclientset := appclientset.NewForConfigOrDie(appclientsetConfig)
repoclientset := apiclient.NewRepoServerClientset(repoServerAddress, repoServerTimeoutSeconds)
if rootPath != "" {
if baseHRef != "" && baseHRef != rootPath {
log.Warnf("--basehref and --rootpath had conflict: basehref: %s rootpath: %s", baseHRef, rootPath)
}
baseHRef = rootPath
}
argoCDOpts := server.ArgoCDServerOpts{
Insecure: insecure,
ListenPort: listenPort,
MetricsPort: metricsPort,
Namespace: namespace,
StaticAssetsDir: staticAssetsDir,
BaseHRef: baseHRef,
RootPath: rootPath,
KubeClientset: kubeclientset,
AppClientset: appclientset,
RepoClientset: repoclientset,
DexServerAddr: dexServerAddress,
DisableAuth: disableAuth,
EnableGZip: enableGZip,
TLSConfigCustomizer: tlsConfigCustomizer,
Cache: cache,
XFrameOptions: frameOptions,
RedisClient: redisClient,
}
stats.RegisterStackDumper()
stats.StartStatsTicker(10 * time.Minute)
stats.RegisterHeapDumper("memprofile")
for {
ctx := context.Background()
ctx, cancel := context.WithCancel(ctx)
argocd := server.NewServer(ctx, argoCDOpts)
argocd.Run(ctx, listenPort, metricsPort)
cancel()
}
},
}
clientConfig = cli.AddKubectlFlagsToCmd(command)
command.Flags().BoolVar(&insecure, "insecure", false, "Run server without TLS")
command.Flags().StringVar(&staticAssetsDir, "staticassets", "", "Static assets directory path")
command.Flags().StringVar(&baseHRef, "basehref", "/", "Value for base href in index.html. Used if Argo CD is running behind reverse proxy under subpath different from /")
command.Flags().StringVar(&rootPath, "rootpath", "", "Used if Argo CD is running behind reverse proxy under subpath different from /")
command.Flags().StringVar(&cmdutil.LogFormat, "logformat", "text", "Set the logging format. One of: text|json")
command.Flags().StringVar(&cmdutil.LogLevel, "loglevel", "info", "Set the logging level. One of: debug|info|warn|error")
command.Flags().IntVar(&glogLevel, "gloglevel", 0, "Set the glog logging level")
command.Flags().StringVar(&repoServerAddress, "repo-server", common.DefaultRepoServerAddr, "Repo server address")
command.Flags().StringVar(&dexServerAddress, "dex-server", common.DefaultDexServerAddr, "Dex server address")
command.Flags().BoolVar(&disableAuth, "disable-auth", false, "Disable client authentication")
command.Flags().BoolVar(&enableGZip, "enable-gzip", false, "Enable GZIP compression")
command.AddCommand(cli.NewVersionCmd(cliName))
command.Flags().IntVar(&listenPort, "port", common.DefaultPortAPIServer, "Listen on given port")
command.Flags().IntVar(&metricsPort, "metrics-port", common.DefaultPortArgoCDAPIServerMetrics, "Start metrics on given port")
command.Flags().IntVar(&repoServerTimeoutSeconds, "repo-server-timeout-seconds", 60, "Repo server RPC call timeout seconds.")
command.Flags().StringVar(&frameOptions, "x-frame-options", "sameorigin", "Set X-Frame-Options header in HTTP responses to `value`. To disable, set to \"\".")
tlsConfigCustomizerSrc = tls.AddTLSFlagsToCmd(command)
cacheSrc = servercache.AddCacheFlagsToCmd(command, func(client *redis.Client) {
redisClient = client
})
return command
}

View File

@@ -1,97 +0,0 @@
package commands
import (
"context"
"flag"
"strconv"
"time"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
"github.com/argoproj/argo-cd/errors"
appclientset "github.com/argoproj/argo-cd/pkg/client/clientset/versioned"
"github.com/argoproj/argo-cd/reposerver"
"github.com/argoproj/argo-cd/server"
"github.com/argoproj/argo-cd/util/cli"
"github.com/argoproj/argo-cd/util/stats"
"github.com/argoproj/argo-cd/util/tls"
)
// NewCommand returns a new instance of an argocd command
func NewCommand() *cobra.Command {
var (
insecure bool
logLevel string
glogLevel int
clientConfig clientcmd.ClientConfig
staticAssetsDir string
repoServerAddress string
disableAuth bool
tlsConfigCustomizerSrc func() (tls.ConfigCustomizer, error)
)
var command = &cobra.Command{
Use: cliName,
Short: "Run the argocd API server",
Long: "Run the argocd API server",
Run: func(c *cobra.Command, args []string) {
level, err := log.ParseLevel(logLevel)
errors.CheckError(err)
log.SetLevel(level)
// Set the glog level for the k8s go-client
_ = flag.CommandLine.Parse([]string{})
_ = flag.Lookup("logtostderr").Value.Set("true")
_ = flag.Lookup("v").Value.Set(strconv.Itoa(glogLevel))
config, err := clientConfig.ClientConfig()
errors.CheckError(err)
namespace, _, err := clientConfig.Namespace()
errors.CheckError(err)
tlsConfigCustomizer, err := tlsConfigCustomizerSrc()
errors.CheckError(err)
kubeclientset := kubernetes.NewForConfigOrDie(config)
appclientset := appclientset.NewForConfigOrDie(config)
repoclientset := reposerver.NewRepositoryServerClientset(repoServerAddress)
argoCDOpts := server.ArgoCDServerOpts{
Insecure: insecure,
Namespace: namespace,
StaticAssetsDir: staticAssetsDir,
KubeClientset: kubeclientset,
AppClientset: appclientset,
RepoClientset: repoclientset,
DisableAuth: disableAuth,
TLSConfigCustomizer: tlsConfigCustomizer,
}
stats.RegisterStackDumper()
stats.StartStatsTicker(10 * time.Minute)
stats.RegisterHeapDumper("memprofile")
for {
argocd := server.NewServer(argoCDOpts)
ctx := context.Background()
ctx, cancel := context.WithCancel(ctx)
argocd.Run(ctx, 8080)
cancel()
}
},
}
clientConfig = cli.AddKubectlFlagsToCmd(command)
command.Flags().BoolVar(&insecure, "insecure", false, "Run server without TLS")
command.Flags().StringVar(&staticAssetsDir, "staticassets", "", "Static assets directory path")
command.Flags().StringVar(&logLevel, "loglevel", "info", "Set the logging level. One of: debug|info|warn|error")
command.Flags().IntVar(&glogLevel, "gloglevel", 0, "Set the glog logging level")
command.Flags().StringVar(&repoServerAddress, "repo-server", "localhost:8081", "Repo server address.")
command.Flags().BoolVar(&disableAuth, "disable-auth", false, "Disable client authentication")
command.AddCommand(cli.NewVersionCmd(cliName))
tlsConfigCustomizerSrc = tls.AddTLSFlagsToCmd(command)
return command
}

View File

@@ -1,16 +0,0 @@
package main
import (
commands "github.com/argoproj/argo-cd/cmd/argocd-server/commands"
"github.com/argoproj/argo-cd/errors"
// load the gcp plugin (required to authenticate against GKE clusters).
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
// load the oidc plugin (required to authenticate with OpenID Connect).
_ "k8s.io/client-go/plugin/pkg/client/auth/oidc"
)
func main() {
err := commands.NewCommand().Execute()
errors.CheckError(err)
}

View File

@@ -0,0 +1,346 @@
package commands
import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os"
"sort"
"time"
appstatecache "github.com/argoproj/argo-cd/util/cache/appstate"
"github.com/ghodss/yaml"
"github.com/spf13/cobra"
apiv1 "k8s.io/api/core/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/client-go/kubernetes"
kubecache "k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/clientcmd"
"github.com/argoproj/argo-cd/common"
"github.com/argoproj/argo-cd/controller"
"github.com/argoproj/argo-cd/controller/cache"
"github.com/argoproj/argo-cd/controller/metrics"
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
appclientset "github.com/argoproj/argo-cd/pkg/client/clientset/versioned"
appinformers "github.com/argoproj/argo-cd/pkg/client/informers/externalversions"
"github.com/argoproj/argo-cd/reposerver/apiclient"
cacheutil "github.com/argoproj/argo-cd/util/cache"
"github.com/argoproj/argo-cd/util/cli"
"github.com/argoproj/argo-cd/util/config"
"github.com/argoproj/argo-cd/util/db"
"github.com/argoproj/argo-cd/util/errors"
kubeutil "github.com/argoproj/argo-cd/util/kube"
"github.com/argoproj/argo-cd/util/settings"
)
func NewAppsCommand() *cobra.Command {
var command = &cobra.Command{
Use: "apps",
Short: "Utility commands operate on ArgoCD applications",
Run: func(c *cobra.Command, args []string) {
c.HelpFunc()(c, args)
},
}
command.AddCommand(NewReconcileCommand())
command.AddCommand(NewDiffReconcileResults())
return command
}
type appReconcileResult struct {
Name string `json:"name"`
Health *v1alpha1.HealthStatus `json:"health"`
Sync *v1alpha1.SyncStatus `json:"sync"`
Conditions []v1alpha1.ApplicationCondition `json:"conditions"`
}
type reconcileResults struct {
Applications []appReconcileResult `json:"applications"`
}
func (r *reconcileResults) getAppsMap() map[string]appReconcileResult {
res := map[string]appReconcileResult{}
for i := range r.Applications {
res[r.Applications[i].Name] = r.Applications[i]
}
return res
}
func printLine(format string, a ...interface{}) {
_, _ = fmt.Printf(format+"\n", a...)
}
func NewDiffReconcileResults() *cobra.Command {
var command = &cobra.Command{
Use: "diff-reconcile-results PATH1 PATH2",
Short: "Compare results of two reconciliations and print diff.",
Run: func(c *cobra.Command, args []string) {
if len(args) != 2 {
c.HelpFunc()(c, args)
os.Exit(1)
}
path1 := args[0]
path2 := args[1]
var res1 reconcileResults
var res2 reconcileResults
errors.CheckError(config.UnmarshalLocalFile(path1, &res1))
errors.CheckError(config.UnmarshalLocalFile(path2, &res2))
errors.CheckError(diffReconcileResults(res1, res2))
},
}
return command
}
func toUnstructured(val interface{}) (*unstructured.Unstructured, error) {
data, err := json.Marshal(val)
if err != nil {
return nil, err
}
res := make(map[string]interface{})
err = json.Unmarshal(data, &res)
if err != nil {
return nil, err
}
return &unstructured.Unstructured{Object: res}, nil
}
type diffPair struct {
name string
first *unstructured.Unstructured
second *unstructured.Unstructured
}
func diffReconcileResults(res1 reconcileResults, res2 reconcileResults) error {
var pairs []diffPair
resMap1 := res1.getAppsMap()
resMap2 := res2.getAppsMap()
for k, v := range resMap1 {
firstUn, err := toUnstructured(v)
if err != nil {
return err
}
var secondUn *unstructured.Unstructured
second, ok := resMap2[k]
if ok {
secondUn, err = toUnstructured(second)
if err != nil {
return err
}
delete(resMap2, k)
}
pairs = append(pairs, diffPair{name: k, first: firstUn, second: secondUn})
}
for k, v := range resMap2 {
secondUn, err := toUnstructured(v)
if err != nil {
return err
}
pairs = append(pairs, diffPair{name: k, first: nil, second: secondUn})
}
sort.Slice(pairs, func(i, j int) bool {
return pairs[i].name < pairs[j].name
})
for _, item := range pairs {
printLine(item.name)
_ = cli.PrintDiff(item.name, item.first, item.second)
}
return nil
}
func NewReconcileCommand() *cobra.Command {
var (
clientConfig clientcmd.ClientConfig
selector string
repoServerAddress string
outputFormat string
refresh bool
)
var command = &cobra.Command{
Use: "get-reconcile-results PATH",
Short: "Reconcile all applications and stores reconciliation summary in the specified file.",
Run: func(c *cobra.Command, args []string) {
// get rid of logging error handler
runtime.ErrorHandlers = runtime.ErrorHandlers[1:]
if len(args) != 1 {
c.HelpFunc()(c, args)
os.Exit(1)
}
outputPath := args[0]
errors.CheckError(os.Setenv(common.EnvVarFakeInClusterConfig, "true"))
cfg, err := clientConfig.ClientConfig()
errors.CheckError(err)
namespace, _, err := clientConfig.Namespace()
errors.CheckError(err)
var result []appReconcileResult
if refresh {
if repoServerAddress == "" {
printLine("Repo server is not provided, trying to port-forward to argocd-repo-server pod.")
repoServerPort, err := kubeutil.PortForward("app.kubernetes.io/name=argocd-repo-server", 8081, namespace)
errors.CheckError(err)
repoServerAddress = fmt.Sprintf("localhost:%d", repoServerPort)
}
repoServerClient := apiclient.NewRepoServerClientset(repoServerAddress, 60)
appClientset := appclientset.NewForConfigOrDie(cfg)
kubeClientset := kubernetes.NewForConfigOrDie(cfg)
result, err = reconcileApplications(kubeClientset, appClientset, namespace, repoServerClient, selector, newLiveStateCache)
errors.CheckError(err)
} else {
appClientset := appclientset.NewForConfigOrDie(cfg)
result, err = getReconcileResults(appClientset, namespace, selector)
}
errors.CheckError(saveToFile(err, outputFormat, reconcileResults{Applications: result}, outputPath))
},
}
clientConfig = cli.AddKubectlFlagsToCmd(command)
command.Flags().StringVar(&repoServerAddress, "repo-server", "", "Repo server address.")
command.Flags().StringVar(&selector, "l", "", "Label selector")
command.Flags().StringVar(&outputFormat, "o", "yaml", "Output format (yaml|json)")
command.Flags().BoolVar(&refresh, "refresh", false, "If set to true then recalculates apps reconciliation")
return command
}
func saveToFile(err error, outputFormat string, result reconcileResults, outputPath string) error {
errors.CheckError(err)
var data []byte
switch outputFormat {
case "yaml":
if data, err = yaml.Marshal(result); err != nil {
return err
}
case "json":
if data, err = json.Marshal(result); err != nil {
return err
}
default:
return fmt.Errorf("format %s is not supported", outputFormat)
}
return ioutil.WriteFile(outputPath, data, 0644)
}
func getReconcileResults(appClientset appclientset.Interface, namespace string, selector string) ([]appReconcileResult, error) {
appsList, err := appClientset.ArgoprojV1alpha1().Applications(namespace).List(context.Background(), v1.ListOptions{LabelSelector: selector})
if err != nil {
return nil, err
}
var items []appReconcileResult
for _, app := range appsList.Items {
items = append(items, appReconcileResult{
Name: app.Name,
Conditions: app.Status.Conditions,
Health: &app.Status.Health,
Sync: &app.Status.Sync,
})
}
return items, nil
}
func reconcileApplications(
kubeClientset kubernetes.Interface,
appClientset appclientset.Interface,
namespace string,
repoServerClient apiclient.Clientset,
selector string,
createLiveStateCache func(argoDB db.ArgoDB, appInformer kubecache.SharedIndexInformer, settingsMgr *settings.SettingsManager, server *metrics.MetricsServer) cache.LiveStateCache,
) ([]appReconcileResult, error) {
settingsMgr := settings.NewSettingsManager(context.Background(), kubeClientset, namespace)
argoDB := db.NewDB(namespace, settingsMgr, kubeClientset)
appInformerFactory := appinformers.NewFilteredSharedInformerFactory(
appClientset,
1*time.Hour,
namespace,
func(options *v1.ListOptions) {},
)
appInformer := appInformerFactory.Argoproj().V1alpha1().Applications().Informer()
projInformer := appInformerFactory.Argoproj().V1alpha1().AppProjects().Informer()
go appInformer.Run(context.Background().Done())
go projInformer.Run(context.Background().Done())
if !kubecache.WaitForCacheSync(context.Background().Done(), appInformer.HasSynced, projInformer.HasSynced) {
return nil, fmt.Errorf("failed to sync cache")
}
appLister := appInformerFactory.Argoproj().V1alpha1().Applications().Lister()
projLister := appInformerFactory.Argoproj().V1alpha1().AppProjects().Lister()
server, err := metrics.NewMetricsServer("", appLister, func(obj interface{}) bool {
return true
}, func(r *http.Request) error {
return nil
})
if err != nil {
return nil, err
}
stateCache := createLiveStateCache(argoDB, appInformer, settingsMgr, server)
if err := stateCache.Init(); err != nil {
return nil, err
}
cache := appstatecache.NewCache(
cacheutil.NewCache(cacheutil.NewInMemoryCache(1*time.Minute)),
1*time.Minute,
)
appStateManager := controller.NewAppStateManager(
argoDB, appClientset, repoServerClient, namespace, kubeutil.NewKubectl(), settingsMgr, stateCache, projInformer, server, cache, time.Second)
appsList, err := appClientset.ArgoprojV1alpha1().Applications(namespace).List(context.Background(), v1.ListOptions{LabelSelector: selector})
if err != nil {
return nil, err
}
sort.Slice(appsList.Items, func(i, j int) bool {
return appsList.Items[i].Spec.Destination.Server < appsList.Items[j].Spec.Destination.Server
})
var items []appReconcileResult
prevServer := ""
for _, app := range appsList.Items {
if prevServer != app.Spec.Destination.Server {
if prevServer != "" {
if clusterCache, err := stateCache.GetClusterCache(prevServer); err == nil {
clusterCache.Invalidate()
}
}
printLine("Reconciling apps of %s", app.Spec.Destination.Server)
prevServer = app.Spec.Destination.Server
}
printLine(app.Name)
proj, err := projLister.AppProjects(namespace).Get(app.Spec.Project)
if err != nil {
return nil, err
}
res := appStateManager.CompareAppState(&app, proj, app.Spec.Source.TargetRevision, app.Spec.Source, false, nil)
items = append(items, appReconcileResult{
Name: app.Name,
Conditions: app.Status.Conditions,
Health: res.GetHealthStatus(),
Sync: res.GetSyncStatus(),
})
}
return items, nil
}
func newLiveStateCache(argoDB db.ArgoDB, appInformer kubecache.SharedIndexInformer, settingsMgr *settings.SettingsManager, server *metrics.MetricsServer) cache.LiveStateCache {
return cache.NewLiveStateCache(argoDB, appInformer, settingsMgr, kubeutil.NewKubectl(), server, func(managedByApp map[string]bool, ref apiv1.ObjectReference) {}, nil)
}

View File

@@ -0,0 +1,182 @@
package commands
import (
"testing"
"github.com/argoproj/argo-cd/test"
clustermocks "github.com/argoproj/gitops-engine/pkg/cache/mocks"
"github.com/argoproj/gitops-engine/pkg/health"
"github.com/argoproj/gitops-engine/pkg/utils/kube"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
kubefake "k8s.io/client-go/kubernetes/fake"
"k8s.io/client-go/tools/cache"
"github.com/argoproj/argo-cd/common"
statecache "github.com/argoproj/argo-cd/controller/cache"
cachemocks "github.com/argoproj/argo-cd/controller/cache/mocks"
"github.com/argoproj/argo-cd/controller/metrics"
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
appfake "github.com/argoproj/argo-cd/pkg/client/clientset/versioned/fake"
"github.com/argoproj/argo-cd/reposerver/apiclient"
"github.com/argoproj/argo-cd/reposerver/apiclient/mocks"
"github.com/argoproj/argo-cd/util/db"
"github.com/argoproj/argo-cd/util/settings"
)
func TestGetReconcileResults(t *testing.T) {
appClientset := appfake.NewSimpleClientset(&v1alpha1.Application{
ObjectMeta: metav1.ObjectMeta{
Name: "test",
Namespace: "default",
},
Status: v1alpha1.ApplicationStatus{
Health: v1alpha1.HealthStatus{Status: health.HealthStatusHealthy},
Sync: v1alpha1.SyncStatus{Status: v1alpha1.SyncStatusCodeOutOfSync},
},
})
result, err := getReconcileResults(appClientset, "default", "")
if !assert.NoError(t, err) {
return
}
expectedResults := []appReconcileResult{{
Name: "test",
Health: &v1alpha1.HealthStatus{Status: health.HealthStatusHealthy},
Sync: &v1alpha1.SyncStatus{Status: v1alpha1.SyncStatusCodeOutOfSync},
}}
assert.ElementsMatch(t, expectedResults, result)
}
func TestGetReconcileResults_Refresh(t *testing.T) {
cm := corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: "argocd-cm",
Namespace: "default",
Labels: map[string]string{
"app.kubernetes.io/part-of": "argocd",
},
},
}
proj := &v1alpha1.AppProject{
ObjectMeta: metav1.ObjectMeta{
Name: "default",
Namespace: "default",
},
Spec: v1alpha1.AppProjectSpec{Destinations: []v1alpha1.ApplicationDestination{{Namespace: "*", Server: "*"}}},
}
app := &v1alpha1.Application{
ObjectMeta: metav1.ObjectMeta{
Name: "test",
Namespace: "default",
},
Spec: v1alpha1.ApplicationSpec{
Project: "default",
Destination: v1alpha1.ApplicationDestination{
Server: common.KubernetesInternalAPIServerAddr,
Namespace: "default",
},
},
}
appClientset := appfake.NewSimpleClientset(app, proj)
deployment := test.NewDeployment()
kubeClientset := kubefake.NewSimpleClientset(deployment, &cm)
clusterCache := clustermocks.ClusterCache{}
clusterCache.On("IsNamespaced", mock.Anything).Return(true, nil)
repoServerClient := mocks.RepoServerServiceClient{}
repoServerClient.On("GenerateManifest", mock.Anything, mock.Anything).Return(&apiclient.ManifestResponse{
Manifests: []string{test.DeploymentManifest},
}, nil)
repoServerClientset := mocks.Clientset{RepoServerServiceClient: &repoServerClient}
liveStateCache := cachemocks.LiveStateCache{}
liveStateCache.On("GetManagedLiveObjs", mock.Anything, mock.Anything).Return(map[kube.ResourceKey]*unstructured.Unstructured{
kube.GetResourceKey(deployment): deployment,
}, nil)
liveStateCache.On("GetVersionsInfo", mock.Anything).Return("v1.2.3", nil, nil)
liveStateCache.On("Init").Return(nil, nil)
liveStateCache.On("GetClusterCache", mock.Anything).Return(&clusterCache, nil)
liveStateCache.On("IsNamespaced", mock.Anything, mock.Anything).Return(true, nil)
result, err := reconcileApplications(kubeClientset, appClientset, "default", &repoServerClientset, "",
func(argoDB db.ArgoDB, appInformer cache.SharedIndexInformer, settingsMgr *settings.SettingsManager, server *metrics.MetricsServer) statecache.LiveStateCache {
return &liveStateCache
},
)
if !assert.NoError(t, err) {
return
}
assert.Equal(t, result[0].Health.Status, health.HealthStatusMissing)
assert.Equal(t, result[0].Sync.Status, v1alpha1.SyncStatusCodeOutOfSync)
}
func TestDiffReconcileResults_NoDifferences(t *testing.T) {
logs, err := captureStdout(func() {
assert.NoError(t, diffReconcileResults(
reconcileResults{Applications: []appReconcileResult{{
Name: "app1",
Sync: &v1alpha1.SyncStatus{Status: v1alpha1.SyncStatusCodeOutOfSync},
}}},
reconcileResults{Applications: []appReconcileResult{{
Name: "app1",
Sync: &v1alpha1.SyncStatus{Status: v1alpha1.SyncStatusCodeOutOfSync},
}}},
))
})
assert.NoError(t, err)
assert.Equal(t, "app1\n", logs)
}
func TestDiffReconcileResults_DifferentApps(t *testing.T) {
logs, err := captureStdout(func() {
assert.NoError(t, diffReconcileResults(
reconcileResults{Applications: []appReconcileResult{{
Name: "app1",
Sync: &v1alpha1.SyncStatus{Status: v1alpha1.SyncStatusCodeOutOfSync},
}, {
Name: "app2",
Sync: &v1alpha1.SyncStatus{Status: v1alpha1.SyncStatusCodeOutOfSync},
}}},
reconcileResults{Applications: []appReconcileResult{{
Name: "app1",
Sync: &v1alpha1.SyncStatus{Status: v1alpha1.SyncStatusCodeOutOfSync},
}, {
Name: "app3",
Sync: &v1alpha1.SyncStatus{Status: v1alpha1.SyncStatusCodeOutOfSync},
}}},
))
})
assert.NoError(t, err)
assert.Equal(t, `app1
app2
1,9d0
< conditions: null
< health: null
< name: app2
< sync:
< comparedTo:
< destination: {}
< source:
< repoURL: ""
< status: OutOfSync
app3
0a1,9
> conditions: null
> health: null
> name: app3
> sync:
> comparedTo:
> destination: {}
> source:
> repoURL: ""
> status: OutOfSync
`, logs)
}

View File

@@ -0,0 +1,547 @@
package commands
import (
"bufio"
"context"
"fmt"
"io"
"io/ioutil"
"os"
"reflect"
"github.com/argoproj/gitops-engine/pkg/utils/kube"
"github.com/ghodss/yaml"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
apiv1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
cmdutil "github.com/argoproj/argo-cd/cmd/util"
"github.com/argoproj/argo-cd/common"
"github.com/argoproj/argo-cd/util/cli"
"github.com/argoproj/argo-cd/util/db"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/settings"
)
const (
// CLIName is the name of the CLI
cliName = "argocd-util"
// YamlSeparator separates sections of a YAML file
yamlSeparator = "---\n"
)
var (
configMapResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "configmaps"}
secretResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "secrets"}
applicationsResource = schema.GroupVersionResource{Group: "argoproj.io", Version: "v1alpha1", Resource: "applications"}
appprojectsResource = schema.GroupVersionResource{Group: "argoproj.io", Version: "v1alpha1", Resource: "appprojects"}
)
// NewCommand returns a new instance of an argocd command
func NewCommand() *cobra.Command {
var (
pathOpts = clientcmd.NewDefaultPathOptions()
)
var command = &cobra.Command{
Use: cliName,
Short: "argocd-util tools used by Argo CD",
Long: "argocd-util has internal utility tools used by Argo CD",
DisableAutoGenTag: true,
Run: func(c *cobra.Command, args []string) {
c.HelpFunc()(c, args)
},
}
command.AddCommand(cli.NewVersionCmd(cliName))
command.AddCommand(NewImportCommand())
command.AddCommand(NewExportCommand())
command.AddCommand(NewClusterConfig())
command.AddCommand(NewProjectsCommand())
command.AddCommand(NewSettingsCommand())
command.AddCommand(NewAppsCommand())
command.AddCommand(NewRBACCommand())
command.AddCommand(NewGenerateConfigCommand(pathOpts))
command.Flags().StringVar(&cmdutil.LogFormat, "logformat", "text", "Set the logging format. One of: text|json")
command.Flags().StringVar(&cmdutil.LogLevel, "loglevel", "info", "Set the logging level. One of: debug|info|warn|error")
return command
}
// NewImportCommand defines a new command for exporting Kubernetes and Argo CD resources.
func NewImportCommand() *cobra.Command {
var (
clientConfig clientcmd.ClientConfig
prune bool
dryRun bool
)
var command = cobra.Command{
Use: "import SOURCE",
Short: "Import Argo CD data from stdin (specify `-') or a file",
Run: func(c *cobra.Command, args []string) {
if len(args) != 1 {
c.HelpFunc()(c, args)
os.Exit(1)
}
config, err := clientConfig.ClientConfig()
errors.CheckError(err)
config.QPS = 100
config.Burst = 50
errors.CheckError(err)
namespace, _, err := clientConfig.Namespace()
errors.CheckError(err)
acdClients := newArgoCDClientsets(config, namespace)
var input []byte
if in := args[0]; in == "-" {
input, err = ioutil.ReadAll(os.Stdin)
} else {
input, err = ioutil.ReadFile(in)
}
errors.CheckError(err)
var dryRunMsg string
if dryRun {
dryRunMsg = " (dry run)"
}
// pruneObjects tracks live objects and it's current resource version. any remaining
// items in this map indicates the resource should be pruned since it no longer appears
// in the backup
pruneObjects := make(map[kube.ResourceKey]unstructured.Unstructured)
configMaps, err := acdClients.configMaps.List(context.Background(), metav1.ListOptions{})
errors.CheckError(err)
// referencedSecrets holds any secrets referenced in the argocd-cm configmap. These
// secrets need to be imported too
var referencedSecrets map[string]bool
for _, cm := range configMaps.Items {
if isArgoCDConfigMap(cm.GetName()) {
pruneObjects[kube.ResourceKey{Group: "", Kind: "ConfigMap", Name: cm.GetName()}] = cm
}
if cm.GetName() == common.ArgoCDConfigMapName {
referencedSecrets = getReferencedSecrets(cm)
}
}
secrets, err := acdClients.secrets.List(context.Background(), metav1.ListOptions{})
errors.CheckError(err)
for _, secret := range secrets.Items {
if isArgoCDSecret(referencedSecrets, secret) {
pruneObjects[kube.ResourceKey{Group: "", Kind: "Secret", Name: secret.GetName()}] = secret
}
}
applications, err := acdClients.applications.List(context.Background(), metav1.ListOptions{})
errors.CheckError(err)
for _, app := range applications.Items {
pruneObjects[kube.ResourceKey{Group: "argoproj.io", Kind: "Application", Name: app.GetName()}] = app
}
projects, err := acdClients.projects.List(context.Background(), metav1.ListOptions{})
errors.CheckError(err)
for _, proj := range projects.Items {
pruneObjects[kube.ResourceKey{Group: "argoproj.io", Kind: "AppProject", Name: proj.GetName()}] = proj
}
// Create or replace existing object
backupObjects, err := kube.SplitYAML(input)
errors.CheckError(err)
for _, bakObj := range backupObjects {
gvk := bakObj.GroupVersionKind()
key := kube.ResourceKey{Group: gvk.Group, Kind: gvk.Kind, Name: bakObj.GetName()}
liveObj, exists := pruneObjects[key]
delete(pruneObjects, key)
var dynClient dynamic.ResourceInterface
switch bakObj.GetKind() {
case "Secret":
dynClient = acdClients.secrets
case "ConfigMap":
dynClient = acdClients.configMaps
case "AppProject":
dynClient = acdClients.projects
case "Application":
dynClient = acdClients.applications
}
if !exists {
if !dryRun {
_, err = dynClient.Create(context.Background(), bakObj, metav1.CreateOptions{})
errors.CheckError(err)
}
fmt.Printf("%s/%s %s created%s\n", gvk.Group, gvk.Kind, bakObj.GetName(), dryRunMsg)
} else if specsEqual(*bakObj, liveObj) {
fmt.Printf("%s/%s %s unchanged%s\n", gvk.Group, gvk.Kind, bakObj.GetName(), dryRunMsg)
} else {
if !dryRun {
newLive := updateLive(bakObj, &liveObj)
_, err = dynClient.Update(context.Background(), newLive, metav1.UpdateOptions{})
errors.CheckError(err)
}
fmt.Printf("%s/%s %s updated%s\n", gvk.Group, gvk.Kind, bakObj.GetName(), dryRunMsg)
}
}
// Delete objects not in backup
for key := range pruneObjects {
if prune {
var dynClient dynamic.ResourceInterface
switch key.Kind {
case "Secret":
dynClient = acdClients.secrets
case "AppProject":
dynClient = acdClients.projects
case "Application":
dynClient = acdClients.applications
default:
log.Fatalf("Unexpected kind '%s' in prune list", key.Kind)
}
if !dryRun {
err = dynClient.Delete(context.Background(), key.Name, metav1.DeleteOptions{})
errors.CheckError(err)
}
fmt.Printf("%s/%s %s pruned%s\n", key.Group, key.Kind, key.Name, dryRunMsg)
} else {
fmt.Printf("%s/%s %s needs pruning\n", key.Group, key.Kind, key.Name)
}
}
},
}
clientConfig = cli.AddKubectlFlagsToCmd(&command)
command.Flags().BoolVar(&dryRun, "dry-run", false, "Print what will be performed")
command.Flags().BoolVar(&prune, "prune", false, "Prune secrets, applications and projects which do not appear in the backup")
return &command
}
type argoCDClientsets struct {
configMaps dynamic.ResourceInterface
secrets dynamic.ResourceInterface
applications dynamic.ResourceInterface
projects dynamic.ResourceInterface
}
func newArgoCDClientsets(config *rest.Config, namespace string) *argoCDClientsets {
dynamicIf, err := dynamic.NewForConfig(config)
errors.CheckError(err)
return &argoCDClientsets{
configMaps: dynamicIf.Resource(configMapResource).Namespace(namespace),
secrets: dynamicIf.Resource(secretResource).Namespace(namespace),
applications: dynamicIf.Resource(applicationsResource).Namespace(namespace),
projects: dynamicIf.Resource(appprojectsResource).Namespace(namespace),
}
}
// NewExportCommand defines a new command for exporting Kubernetes and Argo CD resources.
func NewExportCommand() *cobra.Command {
var (
clientConfig clientcmd.ClientConfig
out string
)
var command = cobra.Command{
Use: "export",
Short: "Export all Argo CD data to stdout (default) or a file",
Run: func(c *cobra.Command, args []string) {
config, err := clientConfig.ClientConfig()
errors.CheckError(err)
namespace, _, err := clientConfig.Namespace()
errors.CheckError(err)
var writer io.Writer
if out == "-" {
writer = os.Stdout
} else {
f, err := os.Create(out)
errors.CheckError(err)
bw := bufio.NewWriter(f)
writer = bw
defer func() {
err = bw.Flush()
errors.CheckError(err)
err = f.Close()
errors.CheckError(err)
}()
}
acdClients := newArgoCDClientsets(config, namespace)
acdConfigMap, err := acdClients.configMaps.Get(context.Background(), common.ArgoCDConfigMapName, metav1.GetOptions{})
errors.CheckError(err)
export(writer, *acdConfigMap)
acdRBACConfigMap, err := acdClients.configMaps.Get(context.Background(), common.ArgoCDRBACConfigMapName, metav1.GetOptions{})
errors.CheckError(err)
export(writer, *acdRBACConfigMap)
acdKnownHostsConfigMap, err := acdClients.configMaps.Get(context.Background(), common.ArgoCDKnownHostsConfigMapName, metav1.GetOptions{})
errors.CheckError(err)
export(writer, *acdKnownHostsConfigMap)
acdTLSCertsConfigMap, err := acdClients.configMaps.Get(context.Background(), common.ArgoCDTLSCertsConfigMapName, metav1.GetOptions{})
errors.CheckError(err)
export(writer, *acdTLSCertsConfigMap)
referencedSecrets := getReferencedSecrets(*acdConfigMap)
secrets, err := acdClients.secrets.List(context.Background(), metav1.ListOptions{})
errors.CheckError(err)
for _, secret := range secrets.Items {
if isArgoCDSecret(referencedSecrets, secret) {
export(writer, secret)
}
}
projects, err := acdClients.projects.List(context.Background(), metav1.ListOptions{})
errors.CheckError(err)
for _, proj := range projects.Items {
export(writer, proj)
}
applications, err := acdClients.applications.List(context.Background(), metav1.ListOptions{})
errors.CheckError(err)
for _, app := range applications.Items {
export(writer, app)
}
},
}
clientConfig = cli.AddKubectlFlagsToCmd(&command)
command.Flags().StringVarP(&out, "out", "o", "-", "Output to the specified file instead of stdout")
return &command
}
// getReferencedSecrets examines the argocd-cm config for any referenced repo secrets and returns a
// map of all referenced secrets.
func getReferencedSecrets(un unstructured.Unstructured) map[string]bool {
var cm apiv1.ConfigMap
err := runtime.DefaultUnstructuredConverter.FromUnstructured(un.Object, &cm)
errors.CheckError(err)
referencedSecrets := make(map[string]bool)
// Referenced repository secrets
if reposRAW, ok := cm.Data["repositories"]; ok {
repos := make([]settings.Repository, 0)
err := yaml.Unmarshal([]byte(reposRAW), &repos)
errors.CheckError(err)
for _, cred := range repos {
if cred.PasswordSecret != nil {
referencedSecrets[cred.PasswordSecret.Name] = true
}
if cred.SSHPrivateKeySecret != nil {
referencedSecrets[cred.SSHPrivateKeySecret.Name] = true
}
if cred.UsernameSecret != nil {
referencedSecrets[cred.UsernameSecret.Name] = true
}
if cred.TLSClientCertDataSecret != nil {
referencedSecrets[cred.TLSClientCertDataSecret.Name] = true
}
if cred.TLSClientCertKeySecret != nil {
referencedSecrets[cred.TLSClientCertKeySecret.Name] = true
}
}
}
// Referenced repository credentials secrets
if reposRAW, ok := cm.Data["repository.credentials"]; ok {
creds := make([]settings.RepositoryCredentials, 0)
err := yaml.Unmarshal([]byte(reposRAW), &creds)
errors.CheckError(err)
for _, cred := range creds {
if cred.PasswordSecret != nil {
referencedSecrets[cred.PasswordSecret.Name] = true
}
if cred.SSHPrivateKeySecret != nil {
referencedSecrets[cred.SSHPrivateKeySecret.Name] = true
}
if cred.UsernameSecret != nil {
referencedSecrets[cred.UsernameSecret.Name] = true
}
if cred.TLSClientCertDataSecret != nil {
referencedSecrets[cred.TLSClientCertDataSecret.Name] = true
}
if cred.TLSClientCertKeySecret != nil {
referencedSecrets[cred.TLSClientCertKeySecret.Name] = true
}
}
}
return referencedSecrets
}
// isArgoCDSecret returns whether or not the given secret is a part of Argo CD configuration
// (e.g. argocd-secret, repo credentials, or cluster credentials)
func isArgoCDSecret(repoSecretRefs map[string]bool, un unstructured.Unstructured) bool {
secretName := un.GetName()
if secretName == common.ArgoCDSecretName {
return true
}
if repoSecretRefs != nil {
if _, ok := repoSecretRefs[secretName]; ok {
return true
}
}
if labels := un.GetLabels(); labels != nil {
if _, ok := labels[common.LabelKeySecretType]; ok {
return true
}
}
if annotations := un.GetAnnotations(); annotations != nil {
if annotations[common.AnnotationKeyManagedBy] == common.AnnotationValueManagedByArgoCD {
return true
}
}
return false
}
// isArgoCDConfigMap returns true if the configmap name is one of argo cd's well known configmaps
func isArgoCDConfigMap(name string) bool {
switch name {
case common.ArgoCDConfigMapName, common.ArgoCDRBACConfigMapName, common.ArgoCDKnownHostsConfigMapName, common.ArgoCDTLSCertsConfigMapName:
return true
}
return false
}
// specsEqual returns if the spec, data, labels, annotations, and finalizers of the two
// supplied objects are equal, indicating that no update is necessary during importing
func specsEqual(left, right unstructured.Unstructured) bool {
if !reflect.DeepEqual(left.GetAnnotations(), right.GetAnnotations()) {
return false
}
if !reflect.DeepEqual(left.GetLabels(), right.GetLabels()) {
return false
}
if !reflect.DeepEqual(left.GetFinalizers(), right.GetFinalizers()) {
return false
}
switch left.GetKind() {
case "Secret", "ConfigMap":
leftData, _, _ := unstructured.NestedMap(left.Object, "data")
rightData, _, _ := unstructured.NestedMap(right.Object, "data")
return reflect.DeepEqual(leftData, rightData)
case "AppProject":
leftSpec, _, _ := unstructured.NestedMap(left.Object, "spec")
rightSpec, _, _ := unstructured.NestedMap(right.Object, "spec")
return reflect.DeepEqual(leftSpec, rightSpec)
case "Application":
leftSpec, _, _ := unstructured.NestedMap(left.Object, "spec")
rightSpec, _, _ := unstructured.NestedMap(right.Object, "spec")
leftStatus, _, _ := unstructured.NestedMap(left.Object, "status")
rightStatus, _, _ := unstructured.NestedMap(right.Object, "status")
// reconciledAt and observedAt are constantly changing and we ignore any diff there
delete(leftStatus, "reconciledAt")
delete(rightStatus, "reconciledAt")
delete(leftStatus, "observedAt")
delete(rightStatus, "observedAt")
return reflect.DeepEqual(leftSpec, rightSpec) && reflect.DeepEqual(leftStatus, rightStatus)
}
return false
}
// updateLive replaces the live object's finalizers, spec, annotations, labels, and data from the
// backup object but leaves all other fields intact (status, other metadata, etc...)
func updateLive(bak, live *unstructured.Unstructured) *unstructured.Unstructured {
newLive := live.DeepCopy()
newLive.SetAnnotations(bak.GetAnnotations())
newLive.SetLabels(bak.GetLabels())
newLive.SetFinalizers(bak.GetFinalizers())
switch live.GetKind() {
case "Secret", "ConfigMap":
newLive.Object["data"] = bak.Object["data"]
case "AppProject":
newLive.Object["spec"] = bak.Object["spec"]
case "Application":
newLive.Object["spec"] = bak.Object["spec"]
if _, ok := bak.Object["status"]; ok {
newLive.Object["status"] = bak.Object["status"]
}
}
return newLive
}
// export writes the unstructured object and removes extraneous cruft from output before writing
func export(w io.Writer, un unstructured.Unstructured) {
name := un.GetName()
finalizers := un.GetFinalizers()
apiVersion := un.GetAPIVersion()
kind := un.GetKind()
labels := un.GetLabels()
annotations := un.GetAnnotations()
unstructured.RemoveNestedField(un.Object, "metadata")
un.SetName(name)
un.SetFinalizers(finalizers)
un.SetAPIVersion(apiVersion)
un.SetKind(kind)
un.SetLabels(labels)
un.SetAnnotations(annotations)
data, err := yaml.Marshal(un.Object)
errors.CheckError(err)
_, err = w.Write(data)
errors.CheckError(err)
_, err = w.Write([]byte(yamlSeparator))
errors.CheckError(err)
}
// NewClusterConfig returns a new instance of `argocd-util kubeconfig` command
func NewClusterConfig() *cobra.Command {
var (
clientConfig clientcmd.ClientConfig
)
var command = &cobra.Command{
Use: "kubeconfig CLUSTER_URL OUTPUT_PATH",
Short: "Generates kubeconfig for the specified cluster",
DisableAutoGenTag: true,
Run: func(c *cobra.Command, args []string) {
if len(args) != 2 {
c.HelpFunc()(c, args)
os.Exit(1)
}
serverUrl := args[0]
output := args[1]
conf, err := clientConfig.ClientConfig()
errors.CheckError(err)
namespace, _, err := clientConfig.Namespace()
errors.CheckError(err)
kubeclientset, err := kubernetes.NewForConfig(conf)
errors.CheckError(err)
cluster, err := db.NewDB(namespace, settings.NewSettingsManager(context.Background(), kubeclientset, namespace), kubeclientset).GetCluster(context.Background(), serverUrl)
errors.CheckError(err)
err = kube.WriteKubeConfig(cluster.RawRestConfig(), namespace, output)
errors.CheckError(err)
},
}
clientConfig = cli.AddKubectlFlagsToCmd(command)
return command
}
func iterateStringFields(obj interface{}, callback func(name string, val string) string) {
if mapField, ok := obj.(map[string]interface{}); ok {
for field, val := range mapField {
if strVal, ok := val.(string); ok {
mapField[field] = callback(field, strVal)
} else {
iterateStringFields(val, callback)
}
}
} else if arrayField, ok := obj.([]interface{}); ok {
for i := range arrayField {
iterateStringFields(arrayField[i], callback)
}
}
}
func redactor(dirtyString string) string {
config := make(map[string]interface{})
err := yaml.Unmarshal([]byte(dirtyString), &config)
errors.CheckError(err)
iterateStringFields(config, func(name string, val string) string {
if name == "clientSecret" || name == "secret" || name == "bindPW" {
return "********"
} else {
return val
}
})
data, err := yaml.Marshal(config)
errors.CheckError(err)
return string(data)
}

View File

@@ -0,0 +1,359 @@
package commands
import (
"context"
"fmt"
"io/ioutil"
"os"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
apiv1 "k8s.io/api/core/v1"
apierr "k8s.io/apimachinery/pkg/api/errors"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes/fake"
"k8s.io/client-go/tools/clientcmd"
cmdutil "github.com/argoproj/argo-cd/cmd/util"
"github.com/argoproj/argo-cd/common"
argoappv1 "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/util/cli"
"github.com/argoproj/argo-cd/util/db"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/git"
"github.com/argoproj/argo-cd/util/settings"
)
const (
ArgoCDNamespace = "argocd"
repoSecretPrefix = "repo"
)
func NewGenerateConfigCommand(pathOpts *clientcmd.PathOptions) *cobra.Command {
var command = &cobra.Command{
Use: "config",
Short: "Generate declarative configuration files",
Run: func(c *cobra.Command, args []string) {
c.HelpFunc()(c, args)
},
}
command.AddCommand(NewGenAppConfigCommand())
command.AddCommand(NewGenProjectConfigCommand())
command.AddCommand(NewGenClusterConfigCommand(pathOpts))
command.AddCommand(NewGenRepoConfigCommand())
return command
}
// NewGenAppConfigCommand generates declarative configuration file for given application
func NewGenAppConfigCommand() *cobra.Command {
var (
appOpts cmdutil.AppOptions
fileURL string
appName string
labels []string
outputFormat string
)
var command = &cobra.Command{
Use: "app APPNAME",
Short: "Generate declarative config for an application",
Example: `
# Generate declarative config for a directory app
argocd-util config app guestbook --repo https://github.com/argoproj/argocd-example-apps.git --path guestbook --dest-namespace default --dest-server https://kubernetes.default.svc --directory-recurse
# Generate declarative config for a Jsonnet app
argocd-util config app jsonnet-guestbook --repo https://github.com/argoproj/argocd-example-apps.git --path jsonnet-guestbook --dest-namespace default --dest-server https://kubernetes.default.svc --jsonnet-ext-str replicas=2
# Generate declarative config for a Helm app
argocd-util config app helm-guestbook --repo https://github.com/argoproj/argocd-example-apps.git --path helm-guestbook --dest-namespace default --dest-server https://kubernetes.default.svc --helm-set replicaCount=2
# Generate declarative config for a Helm app from a Helm repo
argocd-util config app nginx-ingress --repo https://kubernetes-charts.storage.googleapis.com --helm-chart nginx-ingress --revision 1.24.3 --dest-namespace default --dest-server https://kubernetes.default.svc
# Generate declarative config for a Kustomize app
argocd-util config app kustomize-guestbook --repo https://github.com/argoproj/argocd-example-apps.git --path kustomize-guestbook --dest-namespace default --dest-server https://kubernetes.default.svc --kustomize-image gcr.io/heptio-images/ks-guestbook-demo:0.1
# Generate declarative config for a app using a custom tool:
argocd-util config app ksane --repo https://github.com/argoproj/argocd-example-apps.git --path plugins/kasane --dest-namespace default --dest-server https://kubernetes.default.svc --config-management-plugin kasane
`,
Run: func(c *cobra.Command, args []string) {
app, err := cmdutil.ConstructApp(fileURL, appName, labels, args, appOpts, c.Flags())
errors.CheckError(err)
if app.Name == "" {
c.HelpFunc()(c, args)
os.Exit(1)
}
var printResources []interface{}
printResources = append(printResources, app)
errors.CheckError(cmdutil.PrintResources(printResources, outputFormat))
},
}
command.Flags().StringVar(&appName, "name", "", "A name for the app, ignored if a file is set (DEPRECATED)")
command.Flags().StringVarP(&fileURL, "file", "f", "", "Filename or URL to Kubernetes manifests for the app")
command.Flags().StringArrayVarP(&labels, "label", "l", []string{}, "Labels to apply to the app")
command.Flags().StringVarP(&outputFormat, "output", "o", "yaml", "Output format. One of: json|yaml")
// Only complete files with appropriate extension.
err := command.Flags().SetAnnotation("file", cobra.BashCompFilenameExt, []string{"json", "yaml", "yml"})
errors.CheckError(err)
cmdutil.AddAppFlags(command, &appOpts)
return command
}
// NewGenProjectConfigCommand generates declarative configuration file for given project
func NewGenProjectConfigCommand() *cobra.Command {
var (
opts cmdutil.ProjectOpts
fileURL string
outputFormat string
)
var command = &cobra.Command{
Use: "proj PROJECT",
Short: "Generate declarative config for a project",
Run: func(c *cobra.Command, args []string) {
proj, err := cmdutil.ConstructAppProj(fileURL, args, opts, c)
errors.CheckError(err)
var printResources []interface{}
printResources = append(printResources, proj)
errors.CheckError(cmdutil.PrintResources(printResources, outputFormat))
},
}
command.Flags().StringVarP(&fileURL, "file", "f", "", "Filename or URL to Kubernetes manifests for the project")
command.Flags().StringVarP(&outputFormat, "output", "o", "yaml", "Output format. One of: json|yaml")
err := command.Flags().SetAnnotation("file", cobra.BashCompFilenameExt, []string{"json", "yaml", "yml"})
if err != nil {
log.Fatal(err)
}
cmdutil.AddProjFlags(command, &opts)
return command
}
func NewGenClusterConfigCommand(pathOpts *clientcmd.PathOptions) *cobra.Command {
var (
clusterOpts cmdutil.ClusterOptions
bearerToken string
outputFormat string
)
var command = &cobra.Command{
Use: "cluster CONTEXT",
Short: "Generate declarative config for a cluster",
Run: func(c *cobra.Command, args []string) {
var configAccess clientcmd.ConfigAccess = pathOpts
if len(args) == 0 {
log.Error("Choose a context name from:")
cmdutil.PrintKubeContexts(configAccess)
os.Exit(1)
}
cfgAccess, err := configAccess.GetStartingConfig()
errors.CheckError(err)
contextName := args[0]
clstContext := cfgAccess.Contexts[contextName]
if clstContext == nil {
log.Fatalf("Context %s does not exist in kubeconfig", contextName)
}
overrides := clientcmd.ConfigOverrides{
Context: *clstContext,
}
clientConfig := clientcmd.NewDefaultClientConfig(*cfgAccess, &overrides)
conf, err := clientConfig.ClientConfig()
errors.CheckError(err)
kubeClientset := fake.NewSimpleClientset()
var awsAuthConf *argoappv1.AWSAuthConfig
var execProviderConf *argoappv1.ExecProviderConfig
if clusterOpts.AwsClusterName != "" {
awsAuthConf = &argoappv1.AWSAuthConfig{
ClusterName: clusterOpts.AwsClusterName,
RoleARN: clusterOpts.AwsRoleArn,
}
} else if clusterOpts.ExecProviderCommand != "" {
execProviderConf = &argoappv1.ExecProviderConfig{
Command: clusterOpts.ExecProviderCommand,
Args: clusterOpts.ExecProviderArgs,
Env: clusterOpts.ExecProviderEnv,
APIVersion: clusterOpts.ExecProviderAPIVersion,
InstallHint: clusterOpts.ExecProviderInstallHint,
}
} else if bearerToken == "" {
bearerToken = "bearer-token"
}
if clusterOpts.Name != "" {
contextName = clusterOpts.Name
}
clst := cmdutil.NewCluster(contextName, clusterOpts.Namespaces, conf, bearerToken, awsAuthConf, execProviderConf)
if clusterOpts.InCluster {
clst.Server = common.KubernetesInternalAPIServerAddr
}
if clusterOpts.Shard >= 0 {
clst.Shard = &clusterOpts.Shard
}
settingsMgr := settings.NewSettingsManager(context.Background(), kubeClientset, ArgoCDNamespace)
argoDB := db.NewDB(ArgoCDNamespace, settingsMgr, kubeClientset)
_, err = argoDB.CreateCluster(context.Background(), clst)
errors.CheckError(err)
secName, err := db.ServerToSecretName(clst.Server)
errors.CheckError(err)
secret, err := kubeClientset.CoreV1().Secrets(ArgoCDNamespace).Get(context.Background(), secName, v1.GetOptions{})
errors.CheckError(err)
cmdutil.ConvertSecretData(secret)
var printResources []interface{}
printResources = append(printResources, secret)
errors.CheckError(cmdutil.PrintResources(printResources, outputFormat))
},
}
command.PersistentFlags().StringVar(&pathOpts.LoadingRules.ExplicitPath, pathOpts.ExplicitFileFlag, pathOpts.LoadingRules.ExplicitPath, "use a particular kubeconfig file")
command.Flags().StringVar(&bearerToken, "bearer-token", "", "Authentication token that should be used to access K8S API server")
command.Flags().StringVarP(&outputFormat, "output", "o", "yaml", "Output format. One of: json|yaml")
cmdutil.AddClusterFlags(command, &clusterOpts)
return command
}
func NewGenRepoConfigCommand() *cobra.Command {
var (
repoOpts cmdutil.RepoOptions
outputFormat string
)
// For better readability and easier formatting
var repoAddExamples = `
# Add a Git repository via SSH using a private key for authentication, ignoring the server's host key:
argocd-util config repo git@git.example.com:repos/repo --insecure-ignore-host-key --ssh-private-key-path ~/id_rsa
# Add a Git repository via SSH on a non-default port - need to use ssh:// style URLs here
argocd-util config repo ssh://git@git.example.com:2222/repos/repo --ssh-private-key-path ~/id_rsa
# Add a private Git repository via HTTPS using username/password and TLS client certificates:
argocd-util config repo https://git.example.com/repos/repo --username git --password secret --tls-client-cert-path ~/mycert.crt --tls-client-cert-key-path ~/mycert.key
# Add a private Git repository via HTTPS using username/password without verifying the server's TLS certificate
argocd-util config repo https://git.example.com/repos/repo --username git --password secret --insecure-skip-server-verification
# Add a public Helm repository named 'stable' via HTTPS
argocd-util config repo https://kubernetes-charts.storage.googleapis.com --type helm --name stable
# Add a private Helm repository named 'stable' via HTTPS
argocd-util config repo https://kubernetes-charts.storage.googleapis.com --type helm --name stable --username test --password test
# Add a private Helm OCI-based repository named 'stable' via HTTPS
argocd-util config repo helm-oci-registry.cn-zhangjiakou.cr.aliyuncs.com --type helm --name stable --enable-oci --username test --password test
`
var command = &cobra.Command{
Use: "repo REPOURL",
Short: "Generate declarative config for a repo",
Example: repoAddExamples,
Run: func(c *cobra.Command, args []string) {
if len(args) != 1 {
c.HelpFunc()(c, args)
os.Exit(1)
}
// Repository URL
repoOpts.Repo.Repo = args[0]
// Specifying ssh-private-key-path is only valid for SSH repositories
if repoOpts.SshPrivateKeyPath != "" {
if ok, _ := git.IsSSHURL(repoOpts.Repo.Repo); ok {
keyData, err := ioutil.ReadFile(repoOpts.SshPrivateKeyPath)
if err != nil {
log.Fatal(err)
}
repoOpts.Repo.SSHPrivateKey = string(keyData)
} else {
err := fmt.Errorf("--ssh-private-key-path is only supported for SSH repositories.")
errors.CheckError(err)
}
}
// tls-client-cert-path and tls-client-cert-key-key-path must always be
// specified together
if (repoOpts.TlsClientCertPath != "" && repoOpts.TlsClientCertKeyPath == "") || (repoOpts.TlsClientCertPath == "" && repoOpts.TlsClientCertKeyPath != "") {
err := fmt.Errorf("--tls-client-cert-path and --tls-client-cert-key-path must be specified together")
errors.CheckError(err)
}
// Specifying tls-client-cert-path is only valid for HTTPS repositories
if repoOpts.TlsClientCertPath != "" {
if git.IsHTTPSURL(repoOpts.Repo.Repo) {
tlsCertData, err := ioutil.ReadFile(repoOpts.TlsClientCertPath)
errors.CheckError(err)
tlsCertKey, err := ioutil.ReadFile(repoOpts.TlsClientCertKeyPath)
errors.CheckError(err)
repoOpts.Repo.TLSClientCertData = string(tlsCertData)
repoOpts.Repo.TLSClientCertKey = string(tlsCertKey)
} else {
err := fmt.Errorf("--tls-client-cert-path is only supported for HTTPS repositories")
errors.CheckError(err)
}
}
// Set repository connection properties only when creating repository, not
// when creating repository credentials.
// InsecureIgnoreHostKey is deprecated and only here for backwards compat
repoOpts.Repo.InsecureIgnoreHostKey = repoOpts.InsecureIgnoreHostKey
repoOpts.Repo.Insecure = repoOpts.InsecureSkipServerVerification
repoOpts.Repo.EnableLFS = repoOpts.EnableLfs
repoOpts.Repo.EnableOCI = repoOpts.EnableOci
if repoOpts.Repo.Type == "helm" && repoOpts.Repo.Name == "" {
errors.CheckError(fmt.Errorf("must specify --name for repos of type 'helm'"))
}
// If the user set a username, but didn't supply password via --password,
// then we prompt for it
if repoOpts.Repo.Username != "" && repoOpts.Repo.Password == "" {
repoOpts.Repo.Password = cli.PromptPassword(repoOpts.Repo.Password)
}
argoCDCM := &apiv1.ConfigMap{
TypeMeta: v1.TypeMeta{
Kind: "ConfigMap",
APIVersion: "v1",
},
ObjectMeta: v1.ObjectMeta{
Name: common.ArgoCDConfigMapName,
Namespace: ArgoCDNamespace,
Labels: map[string]string{
"app.kubernetes.io/part-of": "argocd",
},
},
}
kubeClientset := fake.NewSimpleClientset(argoCDCM)
settingsMgr := settings.NewSettingsManager(context.Background(), kubeClientset, ArgoCDNamespace)
argoDB := db.NewDB(ArgoCDNamespace, settingsMgr, kubeClientset)
var printResources []interface{}
_, err := argoDB.CreateRepository(context.Background(), &repoOpts.Repo)
errors.CheckError(err)
secret, err := kubeClientset.CoreV1().Secrets(ArgoCDNamespace).Get(context.Background(), db.RepoURLToSecretName(repoSecretPrefix, repoOpts.Repo.Repo), v1.GetOptions{})
if err != nil {
if !apierr.IsNotFound(err) {
errors.CheckError(err)
}
} else {
cmdutil.ConvertSecretData(secret)
printResources = append(printResources, secret)
}
cm, err := kubeClientset.CoreV1().ConfigMaps(ArgoCDNamespace).Get(context.Background(), common.ArgoCDConfigMapName, v1.GetOptions{})
errors.CheckError(err)
printResources = append(printResources, cm)
errors.CheckError(cmdutil.PrintResources(printResources, outputFormat))
},
}
command.Flags().StringVarP(&outputFormat, "output", "o", "yaml", "Output format. One of: json|yaml")
cmdutil.AddRepoFlags(command, &repoOpts)
return command
}

View File

@@ -0,0 +1,144 @@
package commands
import (
"bufio"
"io"
"io/ioutil"
"os"
"strings"
"github.com/ghodss/yaml"
"github.com/spf13/cobra"
rbacv1 "k8s.io/api/rbac/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/discovery"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/tools/clientcmd"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/util/cli"
// load the gcp plugin (required to authenticate against GKE clusters).
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
// load the oidc plugin (required to authenticate with OpenID Connect).
_ "k8s.io/client-go/plugin/pkg/client/auth/oidc"
// load the azure plugin (required to authenticate with AKS clusters).
_ "k8s.io/client-go/plugin/pkg/client/auth/azure"
)
// NewProjectAllowListGenCommand generates a project from clusterRole
func NewProjectAllowListGenCommand() *cobra.Command {
var (
clientConfig clientcmd.ClientConfig
out string
)
var command = &cobra.Command{
Use: "generate-allow-list CLUSTERROLE_PATH PROJ_NAME",
Short: "Generates project allow list from the specified clusterRole file",
Run: func(c *cobra.Command, args []string) {
if len(args) != 2 {
c.HelpFunc()(c, args)
os.Exit(1)
}
clusterRoleFileName := args[0]
projName := args[1]
var writer io.Writer
if out == "-" {
writer = os.Stdout
} else {
f, err := os.Create(out)
errors.CheckError(err)
bw := bufio.NewWriter(f)
writer = bw
defer func() {
err = bw.Flush()
errors.CheckError(err)
err = f.Close()
errors.CheckError(err)
}()
}
globalProj := generateProjectAllowList(clientConfig, clusterRoleFileName, projName)
yamlBytes, err := yaml.Marshal(globalProj)
errors.CheckError(err)
_, err = writer.Write(yamlBytes)
errors.CheckError(err)
},
}
clientConfig = cli.AddKubectlFlagsToCmd(command)
command.Flags().StringVarP(&out, "out", "o", "-", "Output to the specified file instead of stdout")
return command
}
func generateProjectAllowList(clientConfig clientcmd.ClientConfig, clusterRoleFileName string, projName string) v1alpha1.AppProject {
yamlBytes, err := ioutil.ReadFile(clusterRoleFileName)
errors.CheckError(err)
var obj unstructured.Unstructured
err = yaml.Unmarshal(yamlBytes, &obj)
errors.CheckError(err)
clusterRole := &rbacv1.ClusterRole{}
err = scheme.Scheme.Convert(&obj, clusterRole, nil)
errors.CheckError(err)
config, err := clientConfig.ClientConfig()
errors.CheckError(err)
disco, err := discovery.NewDiscoveryClientForConfig(config)
errors.CheckError(err)
serverResources, err := disco.ServerPreferredResources()
errors.CheckError(err)
resourceList := make([]metav1.GroupKind, 0)
for _, rule := range clusterRole.Rules {
if len(rule.APIGroups) <= 0 {
continue
}
canCreate := false
for _, verb := range rule.Verbs {
if strings.EqualFold(verb, "Create") {
canCreate = true
break
}
}
if !canCreate {
continue
}
ruleApiGroup := rule.APIGroups[0]
for _, ruleResource := range rule.Resources {
for _, apiResourcesList := range serverResources {
gv, err := schema.ParseGroupVersion(apiResourcesList.GroupVersion)
if err != nil {
gv = schema.GroupVersion{}
}
if ruleApiGroup == gv.Group {
for _, apiResource := range apiResourcesList.APIResources {
if apiResource.Name == ruleResource {
resourceList = append(resourceList, metav1.GroupKind{Group: ruleApiGroup, Kind: apiResource.Kind})
}
}
}
}
}
}
globalProj := v1alpha1.AppProject{
TypeMeta: metav1.TypeMeta{
Kind: "AppProject",
APIVersion: "argoproj.io/v1alpha1",
},
ObjectMeta: metav1.ObjectMeta{Name: projName},
Spec: v1alpha1.AppProjectSpec{},
}
globalProj.Spec.NamespaceResourceWhitelist = resourceList
return globalProj
}

View File

@@ -0,0 +1,57 @@
package commands
import (
"reflect"
"testing"
"github.com/stretchr/testify/assert"
"github.com/undefinedlabs/go-mpatch"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/discovery"
restclient "k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
)
func TestProjectAllowListGen(t *testing.T) {
useMock := true
rules := clientcmd.NewDefaultClientConfigLoadingRules()
overrides := &clientcmd.ConfigOverrides{}
clientConfig := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(rules, overrides)
if useMock {
var patchClientConfig *mpatch.Patch
patchClientConfig, err := mpatch.PatchInstanceMethodByName(reflect.TypeOf(clientConfig), "ClientConfig", func(*clientcmd.DeferredLoadingClientConfig) (*restclient.Config, error) {
return nil, nil
})
assert.NoError(t, err)
patch, err := mpatch.PatchMethod(discovery.NewDiscoveryClientForConfig, func(c *restclient.Config) (*discovery.DiscoveryClient, error) {
return &discovery.DiscoveryClient{LegacyPrefix: "/api"}, nil
})
assert.NoError(t, err)
var patchSeverPreferedResources *mpatch.Patch
discoClient := &discovery.DiscoveryClient{}
patchSeverPreferedResources, err = mpatch.PatchInstanceMethodByName(reflect.TypeOf(discoClient), "ServerPreferredResources", func(*discovery.DiscoveryClient) ([]*metav1.APIResourceList, error) {
res := metav1.APIResource{
Name: "services",
Kind: "Service",
}
resourceList := []*metav1.APIResourceList{{APIResources: []metav1.APIResource{res}}}
return resourceList, nil
})
assert.NoError(t, err)
defer func() {
err = patchClientConfig.Unpatch()
assert.NoError(t, err)
err = patch.Unpatch()
assert.NoError(t, err)
err = patchSeverPreferedResources.Unpatch()
err = patch.Unpatch()
}()
}
globalProj := generateProjectAllowList(clientConfig, "testdata/test_clusterrole.yaml", "testproj")
assert.True(t, len(globalProj.Spec.NamespaceResourceWhitelist) > 0)
}

View File

@@ -0,0 +1,194 @@
package commands
import (
"context"
"fmt"
"os"
"path/filepath"
"strings"
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
appclientset "github.com/argoproj/argo-cd/pkg/client/clientset/versioned"
appclient "github.com/argoproj/argo-cd/pkg/client/clientset/versioned/typed/application/v1alpha1"
"github.com/argoproj/argo-cd/util/cli"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/gitops-engine/pkg/utils/kube"
"github.com/spf13/cobra"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/tools/clientcmd"
)
func NewProjectsCommand() *cobra.Command {
var command = &cobra.Command{
Use: "projects",
Short: "Utility commands operate on ArgoCD Projects",
Run: func(c *cobra.Command, args []string) {
c.HelpFunc()(c, args)
},
}
command.AddCommand(NewUpdatePolicyRuleCommand())
command.AddCommand(NewProjectAllowListGenCommand())
return command
}
func globMatch(pattern string, val string) bool {
if pattern == "*" {
return true
}
if ok, err := filepath.Match(pattern, val); ok && err == nil {
return true
}
return false
}
func getModification(modification string, resource string, scope string, permission string) (func(string, string) string, error) {
switch modification {
case "set":
if scope == "" {
return nil, fmt.Errorf("Flag --group cannot be empty if permission should be set in role")
}
if permission == "" {
return nil, fmt.Errorf("Flag --permission cannot be empty if permission should be set in role")
}
return func(proj string, action string) string {
return fmt.Sprintf("%s, %s, %s/%s, %s", resource, action, proj, scope, permission)
}, nil
case "remove":
return func(proj string, action string) string {
return ""
}, nil
}
return nil, fmt.Errorf("modification %s is not supported", modification)
}
func saveProject(updated v1alpha1.AppProject, orig v1alpha1.AppProject, projectsIf appclient.AppProjectInterface, dryRun bool) error {
fmt.Printf("===== %s ======\n", updated.Name)
target, err := kube.ToUnstructured(&updated)
errors.CheckError(err)
live, err := kube.ToUnstructured(&orig)
if err != nil {
return err
}
_ = cli.PrintDiff(updated.Name, target, live)
if !dryRun {
_, err = projectsIf.Update(context.Background(), &updated, v1.UpdateOptions{})
if err != nil {
return err
}
}
return nil
}
func formatPolicy(proj string, role string, permission string) string {
return fmt.Sprintf("p, proj:%s:%s, %s", proj, role, permission)
}
func split(input string, delimiter string) []string {
parts := strings.Split(input, delimiter)
for i := range parts {
parts[i] = strings.TrimSpace(parts[i])
}
return parts
}
func NewUpdatePolicyRuleCommand() *cobra.Command {
var (
clientConfig clientcmd.ClientConfig
resource string
scope string
rolePattern string
permission string
dryRun bool
)
var command = &cobra.Command{
Use: "update-role-policy PROJECT_GLOB MODIFICATION ACTION",
Short: "Implement bulk project role update. Useful to back-fill existing project policies or remove obsolete actions.",
Example: ` # Add policy that allows executing any action (action/*) to roles which name matches to *deployer* in all projects
argocd-util projects update-role-policy '*' set 'action/*' --role '*deployer*' --resource applications --scope '*' --permission allow
# Remove policy that which manages running (action/*) from all roles which name matches *deployer* in all projects
argocd-util projects update-role-policy '*' remove override --role '*deployer*'
`,
Run: func(c *cobra.Command, args []string) {
if len(args) != 3 {
c.HelpFunc()(c, args)
os.Exit(1)
}
projectGlob := args[0]
modificationType := args[1]
action := args[2]
config, err := clientConfig.ClientConfig()
errors.CheckError(err)
config.QPS = 100
config.Burst = 50
namespace, _, err := clientConfig.Namespace()
errors.CheckError(err)
appclients := appclientset.NewForConfigOrDie(config)
modification, err := getModification(modificationType, resource, scope, permission)
errors.CheckError(err)
projIf := appclients.ArgoprojV1alpha1().AppProjects(namespace)
err = updateProjects(projIf, projectGlob, rolePattern, action, modification, dryRun)
errors.CheckError(err)
},
}
command.Flags().StringVar(&resource, "resource", "", "Resource e.g. 'applications'")
command.Flags().StringVar(&scope, "scope", "", "Resource scope e.g. '*'")
command.Flags().StringVar(&rolePattern, "role", "*", "Role name pattern e.g. '*deployer*'")
command.Flags().StringVar(&permission, "permission", "", "Action permission")
command.Flags().BoolVar(&dryRun, "dry-run", true, "Dry run")
clientConfig = cli.AddKubectlFlagsToCmd(command)
return command
}
func updateProjects(projIf appclient.AppProjectInterface, projectGlob string, rolePattern string, action string, modification func(string, string) string, dryRun bool) error {
projects, err := projIf.List(context.Background(), v1.ListOptions{})
if err != nil {
return err
}
for _, proj := range projects.Items {
if !globMatch(projectGlob, proj.Name) {
continue
}
origProj := proj.DeepCopy()
updated := false
for i, role := range proj.Spec.Roles {
if !globMatch(rolePattern, role.Name) {
continue
}
actionPolicyIndex := -1
for i := range role.Policies {
parts := split(role.Policies[i], ",")
if len(parts) != 6 || parts[3] != action {
continue
}
actionPolicyIndex = i
break
}
policyPermission := modification(proj.Name, action)
if actionPolicyIndex == -1 && policyPermission != "" {
updated = true
role.Policies = append(role.Policies, formatPolicy(proj.Name, role.Name, policyPermission))
} else if actionPolicyIndex > -1 && policyPermission == "" {
updated = true
role.Policies = append(role.Policies[:actionPolicyIndex], role.Policies[actionPolicyIndex+1:]...)
} else if actionPolicyIndex > -1 && policyPermission != "" {
updated = true
role.Policies[actionPolicyIndex] = formatPolicy(proj.Name, role.Name, policyPermission)
}
proj.Spec.Roles[i] = role
}
if updated {
err = saveProject(proj, *origProj, projIf, dryRun)
if err != nil {
return err
}
}
}
return nil
}

View File

@@ -0,0 +1,79 @@
package commands
import (
"context"
"testing"
"github.com/stretchr/testify/assert"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/pkg/client/clientset/versioned/fake"
)
const (
namespace = "default"
)
func newProj(name string, roleNames ...string) *v1alpha1.AppProject {
var roles []v1alpha1.ProjectRole
for i := range roleNames {
roles = append(roles, v1alpha1.ProjectRole{Name: roleNames[i]})
}
return &v1alpha1.AppProject{ObjectMeta: v1.ObjectMeta{
Name: name,
Namespace: namespace,
}, Spec: v1alpha1.AppProjectSpec{
Roles: roles,
}}
}
func TestUpdateProjects_FindMatchingProject(t *testing.T) {
clientset := fake.NewSimpleClientset(newProj("foo", "test"), newProj("bar", "test"))
modification, err := getModification("set", "*", "*", "allow")
assert.NoError(t, err)
err = updateProjects(clientset.ArgoprojV1alpha1().AppProjects(namespace), "ba*", "*", "set", modification, false)
assert.NoError(t, err)
fooProj, err := clientset.ArgoprojV1alpha1().AppProjects(namespace).Get(context.Background(), "foo", v1.GetOptions{})
assert.NoError(t, err)
assert.Len(t, fooProj.Spec.Roles[0].Policies, 0)
barProj, err := clientset.ArgoprojV1alpha1().AppProjects(namespace).Get(context.Background(), "bar", v1.GetOptions{})
assert.NoError(t, err)
assert.EqualValues(t, barProj.Spec.Roles[0].Policies, []string{"p, proj:bar:test, *, set, bar/*, allow"})
}
func TestUpdateProjects_FindMatchingRole(t *testing.T) {
clientset := fake.NewSimpleClientset(newProj("proj", "foo", "bar"))
modification, err := getModification("set", "*", "*", "allow")
assert.NoError(t, err)
err = updateProjects(clientset.ArgoprojV1alpha1().AppProjects(namespace), "*", "fo*", "set", modification, false)
assert.NoError(t, err)
proj, err := clientset.ArgoprojV1alpha1().AppProjects(namespace).Get(context.Background(), "proj", v1.GetOptions{})
assert.NoError(t, err)
assert.EqualValues(t, proj.Spec.Roles[0].Policies, []string{"p, proj:proj:foo, *, set, proj/*, allow"})
assert.Len(t, proj.Spec.Roles[1].Policies, 0)
}
func TestGetModification_SetPolicy(t *testing.T) {
modification, err := getModification("set", "*", "*", "allow")
assert.NoError(t, err)
policy := modification("proj", "myaction")
assert.Equal(t, "*, myaction, proj/*, allow", policy)
}
func TestGetModification_RemovePolicy(t *testing.T) {
modification, err := getModification("remove", "*", "*", "allow")
assert.NoError(t, err)
policy := modification("proj", "myaction")
assert.Equal(t, "", policy)
}
func TestGetModification_NotSupported(t *testing.T) {
_, err := getModification("bar", "*", "*", "allow")
assert.Errorf(t, err, "modification bar is not supported")
}

View File

@@ -0,0 +1,374 @@
package commands
import (
"context"
"fmt"
"io/ioutil"
"os"
"github.com/ghodss/yaml"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
corev1 "k8s.io/api/core/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
"github.com/argoproj/argo-cd/common"
"github.com/argoproj/argo-cd/server/rbacpolicy"
"github.com/argoproj/argo-cd/util/assets"
"github.com/argoproj/argo-cd/util/cli"
"github.com/argoproj/argo-cd/util/rbac"
)
// Provide a mapping of short-hand resource names to their RBAC counterparts
var resourceMap map[string]string = map[string]string{
"account": rbacpolicy.ResourceAccounts,
"app": rbacpolicy.ResourceApplications,
"apps": rbacpolicy.ResourceApplications,
"application": rbacpolicy.ResourceApplications,
"cert": rbacpolicy.ResourceCertificates,
"certs": rbacpolicy.ResourceCertificates,
"certificate": rbacpolicy.ResourceCertificates,
"cluster": rbacpolicy.ResourceClusters,
"gpgkey": rbacpolicy.ResourceGPGKeys,
"key": rbacpolicy.ResourceGPGKeys,
"proj": rbacpolicy.ResourceProjects,
"projs": rbacpolicy.ResourceProjects,
"project": rbacpolicy.ResourceProjects,
"repo": rbacpolicy.ResourceRepositories,
"repos": rbacpolicy.ResourceRepositories,
"repository": rbacpolicy.ResourceRepositories,
}
// List of allowed RBAC resources
var validRBACResources map[string]bool = map[string]bool{
rbacpolicy.ResourceAccounts: true,
rbacpolicy.ResourceApplications: true,
rbacpolicy.ResourceCertificates: true,
rbacpolicy.ResourceClusters: true,
rbacpolicy.ResourceGPGKeys: true,
rbacpolicy.ResourceProjects: true,
rbacpolicy.ResourceRepositories: true,
}
// List of allowed RBAC actions
var validRBACActions map[string]bool = map[string]bool{
rbacpolicy.ActionAction: true,
rbacpolicy.ActionCreate: true,
rbacpolicy.ActionDelete: true,
rbacpolicy.ActionGet: true,
rbacpolicy.ActionOverride: true,
rbacpolicy.ActionSync: true,
rbacpolicy.ActionUpdate: true,
}
// NewRBACCommand is the command for 'rbac'
func NewRBACCommand() *cobra.Command {
var command = &cobra.Command{
Use: "rbac",
Short: "Validate and test RBAC configuration",
Run: func(c *cobra.Command, args []string) {
c.HelpFunc()(c, args)
},
}
command.AddCommand(NewRBACCanCommand())
command.AddCommand(NewRBACValidateCommand())
return command
}
// NewRBACCanRoleCommand is the command for 'rbac can-role'
func NewRBACCanCommand() *cobra.Command {
var (
policyFile string
defaultRole string
useBuiltin bool
strict bool
quiet bool
subject string
action string
resource string
subResource string
clientConfig clientcmd.ClientConfig
)
var command = &cobra.Command{
Use: "can ROLE/SUBJECT ACTION RESOURCE [SUB-RESOURCE]",
Short: "Check RBAC permissions for a role or subject",
Long: `
Check whether a given role or subject has appropriate RBAC permissions to do
something.
`,
Example: `
# Check whether role some:role has permissions to create an application in the
# 'default' project, using a local policy.csv file
argocd-util rbac can some:role create application 'default/app' --policy-file policy.csv
# Policy file can also be K8s config map with data keys like argocd-rbac-cm,
# i.e. 'policy.csv' and (optionally) 'policy.default'
argocd-util rbac can some:role create application 'default/app' --policy-file argocd-rbac-cm.yaml
# If --policy-file is not given, the ConfigMap 'argocd-rbac-cm' from K8s is
# used. You need to specify the argocd namespace, and make sure that your
# current Kubernetes context is pointing to the cluster Argo CD is running in
argocd-util rbac can some:role create application 'default/app' --namespace argocd
# You can override a possibly configured default role
argocd-util rbac can someuser create application 'default/app' --default-role role:readonly
`,
Run: func(c *cobra.Command, args []string) {
if len(args) < 3 || len(args) > 4 {
c.HelpFunc()(c, args)
os.Exit(1)
}
subject = args[0]
action = args[1]
resource = args[2]
if len(args) > 3 {
subResource = args[3]
}
userPolicy := ""
builtinPolicy := ""
var newDefaultRole string
namespace, nsOverride, err := clientConfig.Namespace()
if err != nil {
log.Fatalf("could not create k8s client: %v", err)
}
// Exactly one of --namespace or --policy-file must be given.
if (!nsOverride && policyFile == "") || (nsOverride && policyFile != "") {
c.HelpFunc()(c, args)
log.Fatalf("please provide exactly one of --policy-file or --namespace")
}
restConfig, err := clientConfig.ClientConfig()
if err != nil {
log.Fatalf("could not create k8s client: %v", err)
}
realClientset, err := kubernetes.NewForConfig(restConfig)
if err != nil {
log.Fatalf("could not create k8s client: %v", err)
}
userPolicy, newDefaultRole = getPolicy(policyFile, realClientset, namespace)
// Use built-in policy as augmentation if requested
if useBuiltin {
builtinPolicy = assets.BuiltinPolicyCSV
}
// If no explicit default role was given, but we have one defined from
// a policy, use this to check for enforce.
if newDefaultRole != "" && defaultRole == "" {
defaultRole = newDefaultRole
}
res := checkPolicy(subject, action, resource, subResource, builtinPolicy, userPolicy, defaultRole, strict)
if res {
if !quiet {
fmt.Println("Yes")
}
os.Exit(0)
} else {
if !quiet {
fmt.Println("No")
}
os.Exit(1)
}
},
}
clientConfig = cli.AddKubectlFlagsToCmd(command)
command.Flags().StringVar(&policyFile, "policy-file", "", "path to the policy file to use")
command.Flags().StringVar(&defaultRole, "default-role", "", "name of the default role to use")
command.Flags().BoolVar(&useBuiltin, "use-builtin-policy", true, "whether to also use builtin-policy")
command.Flags().BoolVar(&strict, "strict", true, "whether to perform strict check on action and resource names")
command.Flags().BoolVarP(&quiet, "quiet", "q", false, "quiet mode - do not print results to stdout")
return command
}
// NewRBACValidateCommand returns a new rbac validate command
func NewRBACValidateCommand() *cobra.Command {
var (
policyFile string
)
var command = &cobra.Command{
Use: "validate --policy-file=POLICYFILE",
Short: "Validate RBAC policy",
Long: `
Validates an RBAC policy for being syntactically correct. The policy must be
a local file, and in either CSV or K8s ConfigMap format.
`,
Run: func(c *cobra.Command, args []string) {
if policyFile == "" {
c.HelpFunc()(c, args)
log.Fatalf("Please specify policy to validate using --policy-file")
}
userPolicy, _ := getPolicy(policyFile, nil, "")
if userPolicy != "" {
if err := rbac.ValidatePolicy(userPolicy); err == nil {
fmt.Printf("Policy is valid.\n")
os.Exit(0)
} else {
fmt.Printf("Policy is invalid: %v\n", err)
os.Exit(1)
}
}
},
}
command.Flags().StringVar(&policyFile, "policy-file", "", "path to the policy file to use")
return command
}
// Load user policy file if requested or use Kubernetes client to get the
// appropriate ConfigMap from the current context
func getPolicy(policyFile string, kubeClient kubernetes.Interface, namespace string) (userPolicy string, defaultRole string) {
var err error
if policyFile != "" {
// load from file
userPolicy, defaultRole, err = getPolicyFromFile(policyFile)
if err != nil {
log.Fatalf("could not read policy file: %v", err)
}
} else {
cm, err := getPolicyConfigMap(kubeClient, namespace)
if err != nil {
log.Fatalf("could not get configmap: %v", err)
}
userPolicy, defaultRole = getPolicyFromConfigMap(cm)
}
return userPolicy, defaultRole
}
// getPolicyFromFile loads a RBAC policy from given path
func getPolicyFromFile(policyFile string) (string, string, error) {
var (
userPolicy string
defaultRole string
)
upol, err := ioutil.ReadFile(policyFile)
if err != nil {
log.Fatalf("error opening policy file: %v", err)
return "", "", err
}
// Try to unmarshal the input file as ConfigMap first. If it succeeds, we
// assume config map input. Otherwise, we treat it as
var upolCM *corev1.ConfigMap
err = yaml.Unmarshal(upol, &upolCM)
if err != nil {
userPolicy = string(upol)
} else {
userPolicy, defaultRole = getPolicyFromConfigMap(upolCM)
}
return userPolicy, defaultRole, nil
}
// Retrieve policy information from a ConfigMap
func getPolicyFromConfigMap(cm *corev1.ConfigMap) (string, string) {
var (
userPolicy string
defaultRole string
ok bool
)
userPolicy, ok = cm.Data[rbac.ConfigMapPolicyCSVKey]
if !ok {
userPolicy = ""
}
if defaultRole == "" {
defaultRole, ok = cm.Data[rbac.ConfigMapPolicyDefaultKey]
if !ok {
defaultRole = ""
}
}
return userPolicy, defaultRole
}
// getPolicyConfigMap fetches the RBAC config map from K8s cluster
func getPolicyConfigMap(client kubernetes.Interface, namespace string) (*corev1.ConfigMap, error) {
cm, err := client.CoreV1().ConfigMaps(namespace).Get(context.Background(), common.ArgoCDRBACConfigMapName, v1.GetOptions{})
if err != nil {
return nil, err
}
return cm, nil
}
// checkPolicy checks whether given subject is allowed to execute specified
// action against specified resource
func checkPolicy(subject, action, resource, subResource, builtinPolicy, userPolicy, defaultRole string, strict bool) bool {
enf := rbac.NewEnforcer(nil, "argocd", "argocd-rbac-cm", nil)
enf.SetDefaultRole(defaultRole)
if builtinPolicy != "" {
if err := enf.SetBuiltinPolicy(builtinPolicy); err != nil {
log.Fatalf("could not set built-in policy: %v", err)
return false
}
}
if userPolicy != "" {
if err := rbac.ValidatePolicy(userPolicy); err != nil {
log.Fatalf("invalid user policy: %v", err)
return false
}
if err := enf.SetUserPolicy(userPolicy); err != nil {
log.Fatalf("could not set user policy: %v", err)
return false
}
}
// User could have used a mutation of the resource name (i.e. 'cert' for
// 'certificate') - let's resolve it to the valid resource.
realResource := resolveRBACResourceName(resource)
// If in strict mode, validate that given RBAC resource and action are
// actually valid tokens.
if strict {
if !isValidRBACResource(realResource) {
log.Fatalf("error in RBAC request: '%s' is not a valid resource name", realResource)
}
if !isValidRBACAction(action) {
log.Fatalf("error in RBAC request: '%s' is not a valid action name", action)
}
}
// Application resources have a special notation - for simplicity's sake,
// if user gives no sub-resource (or specifies simple '*'), we construct
// the required notation by setting subresource to '*/*'.
if realResource == rbacpolicy.ResourceApplications {
if subResource == "*" || subResource == "" {
subResource = "*/*"
}
}
return enf.Enforce(subject, realResource, action, subResource)
}
// resolveRBACResourceName resolves a user supplied value to a valid RBAC
// resource name. If no mapping is found, returns the value verbatim.
func resolveRBACResourceName(name string) string {
if res, ok := resourceMap[name]; ok {
return res
} else {
return name
}
}
// isValidRBACAction checks whether a given action is a valid RBAC action
func isValidRBACAction(action string) bool {
_, ok := validRBACActions[action]
return ok
}
// isValidRBACResource checks whether a given resource is a valid RBAC resource
func isValidRBACResource(resource string) bool {
_, ok := validRBACResources[resource]
return ok
}

View File

@@ -0,0 +1,91 @@
package commands
import (
"io/ioutil"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes/fake"
"github.com/argoproj/argo-cd/util/assets"
)
func Test_isValidRBACAction(t *testing.T) {
for k := range validRBACActions {
t.Run(k, func(t *testing.T) {
ok := isValidRBACAction(k)
assert.True(t, ok)
})
}
t.Run("invalid", func(t *testing.T) {
ok := isValidRBACAction("invalid")
assert.False(t, ok)
})
}
func Test_isValidRBACResource(t *testing.T) {
for k := range validRBACResources {
t.Run(k, func(t *testing.T) {
ok := isValidRBACResource(k)
assert.True(t, ok)
})
}
t.Run("invalid", func(t *testing.T) {
ok := isValidRBACResource("invalid")
assert.False(t, ok)
})
}
func Test_PolicyFromCSV(t *testing.T) {
uPol, dRole := getPolicy("testdata/rbac/policy.csv", nil, "")
require.NotEmpty(t, uPol)
require.Empty(t, dRole)
}
func Test_PolicyFromYAML(t *testing.T) {
uPol, dRole := getPolicy("testdata/rbac/argocd-rbac-cm.yaml", nil, "")
require.NotEmpty(t, uPol)
require.Equal(t, "role:unknown", dRole)
}
func Test_PolicyFromK8s(t *testing.T) {
data, err := ioutil.ReadFile("testdata/rbac/policy.csv")
require.NoError(t, err)
kubeclientset := fake.NewSimpleClientset(&v1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: "argocd-rbac-cm",
Namespace: "argocd",
},
Data: map[string]string{
"policy.csv": string(data),
"policy.default": "role:unknown",
},
})
uPol, dRole := getPolicy("", kubeclientset, "argocd")
require.NotEmpty(t, uPol)
require.Equal(t, "role:unknown", dRole)
t.Run("get applications", func(t *testing.T) {
ok := checkPolicy("role:user", "get", "applications", "*/*", assets.BuiltinPolicyCSV, uPol, dRole, true)
require.True(t, ok)
})
t.Run("get clusters", func(t *testing.T) {
ok := checkPolicy("role:user", "get", "clusters", "*", assets.BuiltinPolicyCSV, uPol, dRole, true)
require.True(t, ok)
})
t.Run("get certificates", func(t *testing.T) {
ok := checkPolicy("role:user", "get", "certificates", "*", assets.BuiltinPolicyCSV, uPol, dRole, true)
require.False(t, ok)
})
t.Run("get certificates by default role", func(t *testing.T) {
ok := checkPolicy("role:user", "get", "certificates", "*", assets.BuiltinPolicyCSV, uPol, "role:readonly", true)
require.True(t, ok)
})
t.Run("get certificates by default role without builtin policy", func(t *testing.T) {
ok := checkPolicy("role:user", "get", "certificates", "*", "", uPol, "role:readonly", true)
require.False(t, ok)
})
}

View File

@@ -0,0 +1,94 @@
package commands
import (
"testing"
"github.com/stretchr/testify/assert"
)
var textToRedact = `
connectors:
- config:
clientID: aabbccddeeff00112233
clientSecret: |
theSecret
orgs:
- name: your-github-org
redirectURI: https://argocd.example.com/api/dex/callback
id: github
name: GitHub
type: github
- config:
bindDN: uid=serviceaccount,cn=users,dc=example,dc=com
bindPW: theSecret
host: ldap.example.com:636
id: ldap
name: LDAP
type: ldap
grpc:
addr: 0.0.0.0:5557
telemetry:
http: 0.0.0.0:5558
issuer: https://argocd.example.com/api/dex
oauth2:
skipApprovalScreen: true
staticClients:
- id: argo-cd
name: Argo CD
redirectURIs:
- https://argocd.example.com/auth/callback
secret: Dis9M-GA11oTwZVQQWdDklPQw-sWXZkWJFyyEhMs
- id: argo-cd-cli
name: Argo CD CLI
public: true
redirectURIs:
- http://localhost
storage:
type: memory
web:
http: 0.0.0.0:5556`
var expectedRedaction = `connectors:
- config:
clientID: aabbccddeeff00112233
clientSecret: '********'
orgs:
- name: your-github-org
redirectURI: https://argocd.example.com/api/dex/callback
id: github
name: GitHub
type: github
- config:
bindDN: uid=serviceaccount,cn=users,dc=example,dc=com
bindPW: '********'
host: ldap.example.com:636
id: ldap
name: LDAP
type: ldap
grpc:
addr: 0.0.0.0:5557
issuer: https://argocd.example.com/api/dex
oauth2:
skipApprovalScreen: true
staticClients:
- id: argo-cd
name: Argo CD
redirectURIs:
- https://argocd.example.com/auth/callback
secret: '********'
- id: argo-cd-cli
name: Argo CD CLI
public: true
redirectURIs:
- http://localhost
storage:
type: memory
telemetry:
http: 0.0.0.0:5558
web:
http: 0.0.0.0:5556
`
func TestSecretsRedactor(t *testing.T) {
assert.Equal(t, expectedRedaction, redactor(textToRedact))
}

View File

@@ -0,0 +1,545 @@
package commands
import (
"bytes"
"context"
"fmt"
"io/ioutil"
"os"
"reflect"
"sort"
"strconv"
"strings"
"text/tabwriter"
healthutil "github.com/argoproj/gitops-engine/pkg/health"
"github.com/ghodss/yaml"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
corev1 "k8s.io/api/core/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/kubernetes/fake"
"k8s.io/client-go/tools/clientcmd"
"github.com/argoproj/argo-cd/common"
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/util/argo/normalizers"
"github.com/argoproj/argo-cd/util/cli"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/lua"
"github.com/argoproj/argo-cd/util/settings"
)
type settingsOpts struct {
argocdCMPath string
argocdSecretPath string
loadClusterSettings bool
clientConfig clientcmd.ClientConfig
}
type commandContext interface {
createSettingsManager() (*settings.SettingsManager, error)
}
func collectLogs(callback func()) string {
log.SetLevel(log.DebugLevel)
out := bytes.Buffer{}
log.SetOutput(&out)
defer log.SetLevel(log.FatalLevel)
callback()
return out.String()
}
func setSettingsMeta(obj v1.Object) {
obj.SetNamespace("default")
labels := obj.GetLabels()
if labels == nil {
labels = make(map[string]string)
}
labels["app.kubernetes.io/part-of"] = "argocd"
obj.SetLabels(labels)
}
func (opts *settingsOpts) createSettingsManager() (*settings.SettingsManager, error) {
var argocdCM *corev1.ConfigMap
if opts.argocdCMPath == "" && !opts.loadClusterSettings {
return nil, fmt.Errorf("either --argocd-cm-path must be provided or --load-cluster-settings must be set to true")
} else if opts.argocdCMPath == "" {
realClientset, ns, err := opts.getK8sClient()
if err != nil {
return nil, err
}
argocdCM, err = realClientset.CoreV1().ConfigMaps(ns).Get(context.Background(), common.ArgoCDConfigMapName, v1.GetOptions{})
if err != nil {
return nil, err
}
} else {
data, err := ioutil.ReadFile(opts.argocdCMPath)
if err != nil {
return nil, err
}
err = yaml.Unmarshal(data, &argocdCM)
if err != nil {
return nil, err
}
}
setSettingsMeta(argocdCM)
var argocdSecret *corev1.Secret
if opts.argocdSecretPath != "" {
data, err := ioutil.ReadFile(opts.argocdSecretPath)
if err != nil {
return nil, err
}
err = yaml.Unmarshal(data, &argocdSecret)
if err != nil {
return nil, err
}
setSettingsMeta(argocdSecret)
} else if opts.loadClusterSettings {
realClientset, ns, err := opts.getK8sClient()
if err != nil {
return nil, err
}
argocdSecret, err = realClientset.CoreV1().Secrets(ns).Get(context.Background(), common.ArgoCDSecretName, v1.GetOptions{})
if err != nil {
return nil, err
}
} else {
argocdSecret = &corev1.Secret{
ObjectMeta: v1.ObjectMeta{
Name: common.ArgoCDSecretName,
},
Data: map[string][]byte{
"admin.password": []byte("test"),
"server.secretkey": []byte("test"),
},
}
}
setSettingsMeta(argocdSecret)
clientset := fake.NewSimpleClientset(argocdSecret, argocdCM)
manager := settings.NewSettingsManager(context.Background(), clientset, "default")
errors.CheckError(manager.ResyncInformers())
return manager, nil
}
func (opts *settingsOpts) getK8sClient() (*kubernetes.Clientset, string, error) {
namespace, _, err := opts.clientConfig.Namespace()
if err != nil {
return nil, "", err
}
restConfig, err := opts.clientConfig.ClientConfig()
if err != nil {
return nil, "", err
}
realClientset, err := kubernetes.NewForConfig(restConfig)
if err != nil {
return nil, "", err
}
return realClientset, namespace, nil
}
func NewSettingsCommand() *cobra.Command {
var (
opts settingsOpts
)
var command = &cobra.Command{
Use: "settings",
Short: "Provides set of commands for settings validation and troubleshooting",
Run: func(c *cobra.Command, args []string) {
c.HelpFunc()(c, args)
},
}
log.SetLevel(log.FatalLevel)
command.AddCommand(NewValidateSettingsCommand(&opts))
command.AddCommand(NewResourceOverridesCommand(&opts))
opts.clientConfig = cli.AddKubectlFlagsToCmd(command)
command.PersistentFlags().StringVar(&opts.argocdCMPath, "argocd-cm-path", "", "Path to local argocd-cm.yaml file")
command.PersistentFlags().StringVar(&opts.argocdSecretPath, "argocd-secret-path", "", "Path to local argocd-secret.yaml file")
command.PersistentFlags().BoolVar(&opts.loadClusterSettings, "load-cluster-settings", false,
"Indicates that config map and secret should be loaded from cluster unless local file path is provided")
return command
}
type settingValidator func(manager *settings.SettingsManager) (string, error)
func joinValidators(validators ...settingValidator) settingValidator {
return func(manager *settings.SettingsManager) (string, error) {
var errorStrs []string
var summaries []string
for i := range validators {
summary, err := validators[i](manager)
if err != nil {
errorStrs = append(errorStrs, err.Error())
}
if summary != "" {
summaries = append(summaries, summary)
}
}
if len(errorStrs) > 0 {
return "", fmt.Errorf("%s", strings.Join(errorStrs, "\n"))
}
return strings.Join(summaries, "\n"), nil
}
}
var validatorsByGroup = map[string]settingValidator{
"general": joinValidators(func(manager *settings.SettingsManager) (string, error) {
general, err := manager.GetSettings()
if err != nil {
return "", err
}
ssoProvider := ""
if general.DexConfig != "" {
if _, err := settings.UnmarshalDexConfig(general.DexConfig); err != nil {
return "", fmt.Errorf("invalid dex.config: %v", err)
}
ssoProvider = "Dex"
} else if general.OIDCConfigRAW != "" {
if _, err := settings.UnmarshalOIDCConfig(general.OIDCConfigRAW); err != nil {
return "", fmt.Errorf("invalid oidc.config: %v", err)
}
ssoProvider = "OIDC"
}
var summary string
if ssoProvider != "" {
summary = fmt.Sprintf("%s is configured", ssoProvider)
if general.URL == "" {
summary = summary + " ('url' field is missing)"
}
} else if ssoProvider != "" && general.URL != "" {
} else {
summary = "SSO is not configured"
}
return summary, nil
}, func(manager *settings.SettingsManager) (string, error) {
_, err := manager.GetAppInstanceLabelKey()
return "", err
}, func(manager *settings.SettingsManager) (string, error) {
_, err := manager.GetHelp()
return "", err
}, func(manager *settings.SettingsManager) (string, error) {
_, err := manager.GetGoogleAnalytics()
return "", err
}),
"plugins": func(manager *settings.SettingsManager) (string, error) {
plugins, err := manager.GetConfigManagementPlugins()
if err != nil {
return "", err
}
return fmt.Sprintf("%d plugins", len(plugins)), nil
},
"kustomize": func(manager *settings.SettingsManager) (string, error) {
opts, err := manager.GetKustomizeSettings()
if err != nil {
return "", err
}
summary := "default options"
if opts.BuildOptions != "" {
summary = opts.BuildOptions
}
if len(opts.Versions) > 0 {
summary = fmt.Sprintf("%s (%d versions)", summary, len(opts.Versions))
}
return summary, err
},
"repositories": joinValidators(func(manager *settings.SettingsManager) (string, error) {
repos, err := manager.GetRepositories()
if err != nil {
return "", err
}
return fmt.Sprintf("%d repositories", len(repos)), nil
}, func(manager *settings.SettingsManager) (string, error) {
creds, err := manager.GetRepositoryCredentials()
if err != nil {
return "", err
}
return fmt.Sprintf("%d repository credentials", len(creds)), nil
}),
"accounts": func(manager *settings.SettingsManager) (string, error) {
accounts, err := manager.GetAccounts()
if err != nil {
return "", err
}
return fmt.Sprintf("%d accounts", len(accounts)), nil
},
"resource-overrides": func(manager *settings.SettingsManager) (string, error) {
overrides, err := manager.GetResourceOverrides()
if err != nil {
return "", err
}
return fmt.Sprintf("%d resource overrides", len(overrides)), nil
},
}
func NewValidateSettingsCommand(cmdCtx commandContext) *cobra.Command {
var (
groups []string
)
var allGroups []string
for k := range validatorsByGroup {
allGroups = append(allGroups, k)
}
sort.Slice(allGroups, func(i, j int) bool {
return allGroups[i] < allGroups[j]
})
var command = &cobra.Command{
Use: "validate",
Short: "Validate settings",
Long: "Validates settings specified in 'argocd-cm' ConfigMap and 'argocd-secret' Secret",
Example: `
#Validates all settings in the specified YAML file
argocd-util settings validate --argocd-cm-path ./argocd-cm.yaml
#Validates accounts and plugins settings in Kubernetes cluster of current kubeconfig context
argocd-util settings validate --group accounts --group plugins --load-cluster-settings`,
Run: func(c *cobra.Command, args []string) {
settingsManager, err := cmdCtx.createSettingsManager()
errors.CheckError(err)
if len(groups) == 0 {
groups = allGroups
}
for i, group := range groups {
validator := validatorsByGroup[group]
logs := collectLogs(func() {
summary, err := validator(settingsManager)
if err != nil {
_, _ = fmt.Fprintf(os.Stdout, "❌ %s\n", group)
_, _ = fmt.Fprintf(os.Stdout, "%s\n", err.Error())
} else {
_, _ = fmt.Fprintf(os.Stdout, "✅ %s\n", group)
if summary != "" {
_, _ = fmt.Fprintf(os.Stdout, "%s\n", summary)
}
}
})
if logs != "" {
_, _ = fmt.Fprintf(os.Stdout, "%s\n", logs)
}
if i != len(groups)-1 {
_, _ = fmt.Fprintf(os.Stdout, "\n")
}
}
},
}
command.Flags().StringArrayVar(&groups, "group", nil, fmt.Sprintf(
"Optional list of setting groups that have to be validated ( one of: %s)", strings.Join(allGroups, ", ")))
return command
}
func NewResourceOverridesCommand(cmdCtx commandContext) *cobra.Command {
var command = &cobra.Command{
Use: "resource-overrides",
Short: "Troubleshoot resource overrides",
Run: func(c *cobra.Command, args []string) {
c.HelpFunc()(c, args)
},
}
command.AddCommand(NewResourceIgnoreDifferencesCommand(cmdCtx))
command.AddCommand(NewResourceActionListCommand(cmdCtx))
command.AddCommand(NewResourceActionRunCommand(cmdCtx))
command.AddCommand(NewResourceHealthCommand(cmdCtx))
return command
}
func executeResourceOverrideCommand(cmdCtx commandContext, args []string, callback func(res unstructured.Unstructured, override v1alpha1.ResourceOverride, overrides map[string]v1alpha1.ResourceOverride)) {
data, err := ioutil.ReadFile(args[0])
errors.CheckError(err)
res := unstructured.Unstructured{}
errors.CheckError(yaml.Unmarshal(data, &res))
settingsManager, err := cmdCtx.createSettingsManager()
errors.CheckError(err)
overrides, err := settingsManager.GetResourceOverrides()
errors.CheckError(err)
gvk := res.GroupVersionKind()
key := gvk.Kind
if gvk.Group != "" {
key = fmt.Sprintf("%s/%s", gvk.Group, gvk.Kind)
}
override, hasOverride := overrides[key]
if !hasOverride {
_, _ = fmt.Printf("No overrides configured for '%s/%s'\n", gvk.Group, gvk.Kind)
return
}
callback(res, override, overrides)
}
func NewResourceIgnoreDifferencesCommand(cmdCtx commandContext) *cobra.Command {
var command = &cobra.Command{
Use: "ignore-differences RESOURCE_YAML_PATH",
Short: "Renders fields excluded from diffing",
Long: "Renders ignored fields using the 'ignoreDifferences' setting specified in the 'resource.customizations' field of 'argocd-cm' ConfigMap",
Example: `
argocd-util settings resource-overrides ignore-differences ./deploy.yaml --argocd-cm-path ./argocd-cm.yaml`,
Run: func(c *cobra.Command, args []string) {
if len(args) < 1 {
c.HelpFunc()(c, args)
os.Exit(1)
}
executeResourceOverrideCommand(cmdCtx, args, func(res unstructured.Unstructured, override v1alpha1.ResourceOverride, overrides map[string]v1alpha1.ResourceOverride) {
gvk := res.GroupVersionKind()
if len(override.IgnoreDifferences.JSONPointers) == 0 {
_, _ = fmt.Printf("Ignore differences are not configured for '%s/%s'\n", gvk.Group, gvk.Kind)
return
}
normalizer, err := normalizers.NewIgnoreNormalizer(nil, overrides)
errors.CheckError(err)
normalizedRes := res.DeepCopy()
logs := collectLogs(func() {
errors.CheckError(normalizer.Normalize(normalizedRes))
})
if logs != "" {
_, _ = fmt.Println(logs)
}
if reflect.DeepEqual(&res, normalizedRes) {
_, _ = fmt.Printf("No fields are ignored by ignoreDifferences settings: \n%s\n", override.IgnoreDifferences)
return
}
_, _ = fmt.Printf("Following fields are ignored:\n\n")
_ = cli.PrintDiff(res.GetName(), &res, normalizedRes)
})
},
}
return command
}
func NewResourceHealthCommand(cmdCtx commandContext) *cobra.Command {
var command = &cobra.Command{
Use: "health RESOURCE_YAML_PATH",
Short: "Assess resource health",
Long: "Assess resource health using the lua script configured in the 'resource.customizations' field of 'argocd-cm' ConfigMap",
Example: `
argocd-util settings resource-overrides health ./deploy.yaml --argocd-cm-path ./argocd-cm.yaml`,
Run: func(c *cobra.Command, args []string) {
if len(args) < 1 {
c.HelpFunc()(c, args)
os.Exit(1)
}
executeResourceOverrideCommand(cmdCtx, args, func(res unstructured.Unstructured, override v1alpha1.ResourceOverride, overrides map[string]v1alpha1.ResourceOverride) {
gvk := res.GroupVersionKind()
if override.HealthLua == "" {
_, _ = fmt.Printf("Health script is not configured for '%s/%s'\n", gvk.Group, gvk.Kind)
return
}
resHealth, err := healthutil.GetResourceHealth(&res, lua.ResourceHealthOverrides(overrides))
errors.CheckError(err)
_, _ = fmt.Printf("STATUS: %s\n", resHealth.Status)
_, _ = fmt.Printf("MESSAGE: %s\n", resHealth.Message)
})
},
}
return command
}
func NewResourceActionListCommand(cmdCtx commandContext) *cobra.Command {
var command = &cobra.Command{
Use: "list-actions RESOURCE_YAML_PATH",
Short: "List available resource actions",
Long: "List actions available for given resource action using the lua scripts configured in the 'resource.customizations' field of 'argocd-cm' ConfigMap and outputs updated fields",
Example: `
argocd-util settings resource-overrides action list /tmp/deploy.yaml --argocd-cm-path ./argocd-cm.yaml`,
Run: func(c *cobra.Command, args []string) {
if len(args) < 1 {
c.HelpFunc()(c, args)
os.Exit(1)
}
executeResourceOverrideCommand(cmdCtx, args, func(res unstructured.Unstructured, override v1alpha1.ResourceOverride, overrides map[string]v1alpha1.ResourceOverride) {
gvk := res.GroupVersionKind()
if override.Actions == "" {
_, _ = fmt.Printf("Actions are not configured for '%s/%s'\n", gvk.Group, gvk.Kind)
return
}
luaVM := lua.VM{ResourceOverrides: overrides}
discoveryScript, err := luaVM.GetResourceActionDiscovery(&res)
errors.CheckError(err)
availableActions, err := luaVM.ExecuteResourceActionDiscovery(&res, discoveryScript)
errors.CheckError(err)
sort.Slice(availableActions, func(i, j int) bool {
return availableActions[i].Name < availableActions[j].Name
})
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
_, _ = fmt.Fprintf(w, "NAME\tENABLED\n")
for _, action := range availableActions {
_, _ = fmt.Fprintf(w, "%s\t%s\n", action.Name, strconv.FormatBool(action.Disabled))
}
_ = w.Flush()
})
},
}
return command
}
func NewResourceActionRunCommand(cmdCtx commandContext) *cobra.Command {
var command = &cobra.Command{
Use: "run-action RESOURCE_YAML_PATH ACTION",
Aliases: []string{"action"},
Short: "Executes resource action",
Long: "Executes resource action using the lua script configured in the 'resource.customizations' field of 'argocd-cm' ConfigMap and outputs updated fields",
Example: `
argocd-util settings resource-overrides action run /tmp/deploy.yaml restart --argocd-cm-path ./argocd-cm.yaml`,
Run: func(c *cobra.Command, args []string) {
if len(args) < 2 {
c.HelpFunc()(c, args)
os.Exit(1)
}
action := args[1]
executeResourceOverrideCommand(cmdCtx, args, func(res unstructured.Unstructured, override v1alpha1.ResourceOverride, overrides map[string]v1alpha1.ResourceOverride) {
gvk := res.GroupVersionKind()
if override.Actions == "" {
_, _ = fmt.Printf("Actions are not configured for '%s/%s'\n", gvk.Group, gvk.Kind)
return
}
luaVM := lua.VM{ResourceOverrides: overrides}
action, err := luaVM.GetResourceAction(&res, action)
errors.CheckError(err)
modifiedRes, err := luaVM.ExecuteResourceAction(&res, action.ActionLua)
errors.CheckError(err)
if reflect.DeepEqual(&res, modifiedRes) {
_, _ = fmt.Printf("No fields had been changed by action: \n%s\n", action.Name)
return
}
_, _ = fmt.Printf("Following fields have been changed:\n\n")
_ = cli.PrintDiff(res.GetName(), &res, modifiedRes)
})
},
}
return command
}

View File

@@ -0,0 +1,383 @@
package commands
import (
"bytes"
"context"
"fmt"
"io"
"io/ioutil"
"os"
"testing"
"github.com/argoproj/argo-cd/common"
utils "github.com/argoproj/argo-cd/util/io"
"github.com/argoproj/argo-cd/util/settings"
"github.com/stretchr/testify/assert"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes/fake"
)
func captureStdout(callback func()) (string, error) {
oldStdout := os.Stdout
oldStderr := os.Stderr
r, w, err := os.Pipe()
if err != nil {
return "", err
}
os.Stdout = w
defer func() {
os.Stdout = oldStdout
os.Stderr = oldStderr
}()
callback()
utils.Close(w)
data, err := ioutil.ReadAll(r)
if err != nil {
return "", err
}
return string(data), err
}
func newSettingsManager(data map[string]string) *settings.SettingsManager {
clientset := fake.NewSimpleClientset(&v1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Namespace: "default",
Name: common.ArgoCDConfigMapName,
Labels: map[string]string{
"app.kubernetes.io/part-of": "argocd",
},
},
Data: data,
}, &v1.Secret{
ObjectMeta: metav1.ObjectMeta{
Namespace: "default",
Name: common.ArgoCDSecretName,
},
Data: map[string][]byte{
"admin.password": []byte("test"),
"server.secretkey": []byte("test"),
},
})
return settings.NewSettingsManager(context.Background(), clientset, "default")
}
type fakeCmdContext struct {
mgr *settings.SettingsManager
// nolint:unused,structcheck
out bytes.Buffer
}
func newCmdContext(data map[string]string) *fakeCmdContext {
return &fakeCmdContext{mgr: newSettingsManager(data)}
}
func (ctx *fakeCmdContext) createSettingsManager() (*settings.SettingsManager, error) {
return ctx.mgr, nil
}
type validatorTestCase struct {
validator string
data map[string]string
containsSummary string
containsError string
}
func TestCreateSettingsManager(t *testing.T) {
f, closer, err := tempFile(`apiVersion: v1
kind: ConfigMap
metadata:
name: argocd-cm
data:
url: https://myargocd.com`)
if !assert.NoError(t, err) {
return
}
defer utils.Close(closer)
opts := settingsOpts{argocdCMPath: f}
settingsManager, err := opts.createSettingsManager()
if !assert.NoError(t, err) {
return
}
argoCDSettings, err := settingsManager.GetSettings()
if !assert.NoError(t, err) {
return
}
assert.Equal(t, "https://myargocd.com", argoCDSettings.URL)
}
func TestValidator(t *testing.T) {
testCases := map[string]validatorTestCase{
"General_SSOIsNotConfigured": {
validator: "general", containsSummary: "SSO is not configured",
},
"General_DexInvalidConfig": {
validator: "general",
data: map[string]string{"dex.config": "abcdefg"},
containsError: "invalid dex.config",
},
"General_OIDCConfigured": {
validator: "general",
data: map[string]string{
"url": "https://myargocd.com",
"oidc.config": `
name: Okta
issuer: https://dev-123456.oktapreview.com
clientID: aaaabbbbccccddddeee
clientSecret: aaaabbbbccccddddeee`,
},
containsSummary: "OIDC is configured",
},
"General_DexConfiguredMissingURL": {
validator: "general",
data: map[string]string{
"dex.config": `connectors:
- type: github
name: GitHub
config:
clientID: aabbccddeeff00112233
clientSecret: aabbccddeeff00112233`,
},
containsSummary: "Dex is configured ('url' field is missing)",
},
"Plugins_ValidConfig": {
validator: "plugins",
data: map[string]string{
"configManagementPlugins": `[{"name": "test1"}, {"name": "test2"}]`,
},
containsSummary: "2 plugins",
},
"Kustomize_ModifiedOptions": {
validator: "kustomize",
containsSummary: "default options",
},
"Kustomize_DefaultOptions": {
validator: "kustomize",
data: map[string]string{
"kustomize.buildOptions": "updated-options (2 versions)",
"kustomize.versions.v123": "binary-123",
"kustomize.versions.v321": "binary-321",
},
containsSummary: "updated-options",
},
"Repositories": {
validator: "repositories",
data: map[string]string{
"repositories": `
- url: https://github.com/argoproj/my-private-repository1
- url: https://github.com/argoproj/my-private-repository2`,
},
containsSummary: "2 repositories",
},
"Accounts": {
validator: "accounts",
data: map[string]string{
"accounts.user1": "apiKey, login",
"accounts.user2": "login",
"accounts.user3": "apiKey",
},
containsSummary: "4 accounts",
},
"ResourceOverrides": {
validator: "resource-overrides",
data: map[string]string{
"resource.customizations": `
admissionregistration.k8s.io/MutatingWebhookConfiguration:
ignoreDifferences: |
jsonPointers:
- /webhooks/0/clientConfig/caBundle`,
},
containsSummary: "2 resource overrides",
},
}
for name := range testCases {
tc := testCases[name]
t.Run(name, func(t *testing.T) {
validator, ok := validatorsByGroup[tc.validator]
if !assert.True(t, ok) {
return
}
summary, err := validator(newSettingsManager(tc.data))
if tc.containsSummary != "" {
assert.NoError(t, err)
assert.Contains(t, summary, tc.containsSummary)
} else if tc.containsError != "" {
if assert.Error(t, err) {
assert.Contains(t, err.Error(), tc.containsError)
}
}
})
}
}
const (
testDeploymentYAML = `apiVersion: v1
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 0`
)
func tempFile(content string) (string, io.Closer, error) {
f, err := ioutil.TempFile("", "*.yaml")
if err != nil {
return "", nil, err
}
_, err = f.Write([]byte(content))
if err != nil {
_ = os.Remove(f.Name())
return "", nil, err
}
return f.Name(), utils.NewCloser(func() error {
return os.Remove(f.Name())
}), nil
}
func TestValidateSettingsCommand_NoErrors(t *testing.T) {
cmd := NewValidateSettingsCommand(newCmdContext(map[string]string{}))
out, err := captureStdout(func() {
err := cmd.Execute()
assert.NoError(t, err)
})
assert.NoError(t, err)
for k := range validatorsByGroup {
assert.Contains(t, out, fmt.Sprintf("✅ %s", k))
}
}
func TestResourceOverrideIgnoreDifferences(t *testing.T) {
f, closer, err := tempFile(testDeploymentYAML)
if !assert.NoError(t, err) {
return
}
defer utils.Close(closer)
t.Run("NoOverridesConfigured", func(t *testing.T) {
cmd := NewResourceOverridesCommand(newCmdContext(map[string]string{}))
out, err := captureStdout(func() {
cmd.SetArgs([]string{"ignore-differences", f})
err := cmd.Execute()
assert.NoError(t, err)
})
assert.NoError(t, err)
assert.Contains(t, out, "No overrides configured")
})
t.Run("DataIgnored", func(t *testing.T) {
cmd := NewResourceOverridesCommand(newCmdContext(map[string]string{
"resource.customizations": `apps/Deployment:
ignoreDifferences: |
jsonPointers:
- /spec`}))
out, err := captureStdout(func() {
cmd.SetArgs([]string{"ignore-differences", f})
err := cmd.Execute()
assert.NoError(t, err)
})
assert.NoError(t, err)
assert.Contains(t, out, "< spec:")
})
}
func TestResourceOverrideHealth(t *testing.T) {
f, closer, err := tempFile(testDeploymentYAML)
if !assert.NoError(t, err) {
return
}
defer utils.Close(closer)
t.Run("NoHealthAssessment", func(t *testing.T) {
cmd := NewResourceOverridesCommand(newCmdContext(map[string]string{
"resource.customizations": `apps/Deployment: {}`}))
out, err := captureStdout(func() {
cmd.SetArgs([]string{"health", f})
err := cmd.Execute()
assert.NoError(t, err)
})
assert.NoError(t, err)
assert.Contains(t, out, "Health script is not configured")
})
t.Run("HealthAssessmentConfigured", func(t *testing.T) {
cmd := NewResourceOverridesCommand(newCmdContext(map[string]string{
"resource.customizations": `apps/Deployment:
health.lua: |
return { status = "Progressing" }
`}))
out, err := captureStdout(func() {
cmd.SetArgs([]string{"health", f})
err := cmd.Execute()
assert.NoError(t, err)
})
assert.NoError(t, err)
assert.Contains(t, out, "Progressing")
})
}
func TestResourceOverrideAction(t *testing.T) {
f, closer, err := tempFile(testDeploymentYAML)
if !assert.NoError(t, err) {
return
}
defer utils.Close(closer)
t.Run("NoActions", func(t *testing.T) {
cmd := NewResourceOverridesCommand(newCmdContext(map[string]string{
"resource.customizations": `apps/Deployment: {}`}))
out, err := captureStdout(func() {
cmd.SetArgs([]string{"run-action", f, "test"})
err := cmd.Execute()
assert.NoError(t, err)
})
assert.NoError(t, err)
assert.Contains(t, out, "Actions are not configured")
})
t.Run("ActionConfigured", func(t *testing.T) {
cmd := NewResourceOverridesCommand(newCmdContext(map[string]string{
"resource.customizations": `apps/Deployment:
actions: |
discovery.lua: |
actions = {}
actions["resume"] = {["disabled"] = false}
actions["restart"] = {["disabled"] = false}
return actions
definitions:
- name: test
action.lua: |
obj.metadata.labels["test"] = 'updated'
return obj
`}))
out, err := captureStdout(func() {
cmd.SetArgs([]string{"run-action", f, "test"})
err := cmd.Execute()
assert.NoError(t, err)
})
assert.NoError(t, err)
assert.Contains(t, out, "test: updated")
out, err = captureStdout(func() {
cmd.SetArgs([]string{"list-actions", f})
err := cmd.Execute()
assert.NoError(t, err)
})
assert.NoError(t, err)
assert.Contains(t, out, `NAME ENABLED
restart false
resume false
`)
})
}

View File

@@ -0,0 +1,19 @@
apiVersion: v1
data:
policy.csv: |
p, role:user, clusters, get, *, allow
p, role:user, clusters, get, https://kubernetes*, deny
p, role:user, projects, get, *, allow
p, role:user, applications, get, *, allow
p, role:user, applications, create, */*, allow
p, role:user, applications, delete, *, allow
p, role:user, applications, delete, */guestbook, deny
g, test, role:user
policy.default: role:unknown
kind: ConfigMap
metadata:
labels:
app.kubernetes.io/name: argocd-rbac-cm
app.kubernetes.io/part-of: argocd
name: argocd-rbac-cm
namespace: argocd

View File

@@ -0,0 +1,9 @@
p, role:user, clusters, get, *, allow
p, role:user, clusters, get, https://kubernetes*, deny
p, role:user, projects, get, *, allow
p, role:user, applications, get, *, allow
p, role:user, applications, create, */*, allow
p, role:user, applications, delete, *, allow
p, role:user, applications, delete, */guestbook, deny
p, role:test, certificates, get, *, allow
g, test, role:user
1 p, role:user, clusters, get, *, allow
2 p, role:user, clusters, get, https://kubernetes*, deny
3 p, role:user, projects, get, *, allow
4 p, role:user, applications, get, *, allow
5 p, role:user, applications, create, */*, allow
6 p, role:user, applications, delete, *, allow
7 p, role:user, applications, delete, */guestbook, deny
8 p, role:test, certificates, get, *, allow
9 g, test, role:user

View File

@@ -0,0 +1,787 @@
aggregationRule:
clusterRoleSelectors:
- matchLabels:
rbac.authorization.k8s.io/aggregate-to-admin: "true"
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
kubernetes.io/bootstrapping: rbac-defaults
name: admin
rules:
- apiGroups:
- argoproj.io
resources:
- workflows
- workflows/finalizers
- workflowtemplates
- workflowtemplates/finalizers
- cronworkflows
- cronworkflows/finalizers
- clusterworkflowtemplates
- clusterworkflowtemplates/finalizers
verbs:
- create
- delete
- deletecollection
- get
- list
- patch
- update
- watch
- apiGroups:
- argoproj.io
resources:
- gateways
- gateways/finalizers
- sensors
- sensors/finalizers
- eventsources
- eventsources/finalizers
- eventbuses
- eventbuses/finalizers
verbs:
- create
- delete
- deletecollection
- get
- list
- patch
- update
- watch
- apiGroups:
- argoproj.io
resources:
- rollouts
- rollouts/scale
- experiments
- analysistemplates
- clusteranalysistemplates
- analysisruns
verbs:
- create
- delete
- deletecollection
- get
- list
- patch
- update
- watch
- apiGroups:
- metrics.k8s.io
resources:
- pods
verbs:
- get
- list
- watch
- apiGroups:
- iammanager.keikoproj.io
resources:
- iamroles
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- pods/attach
- pods/exec
- pods/portforward
- pods/proxy
- secrets
- services/proxy
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- serviceaccounts
verbs:
- impersonate
- apiGroups:
- ""
resources:
- pods
- pods/attach
- pods/exec
- pods/portforward
- pods/proxy
verbs:
- create
- delete
- deletecollection
- patch
- update
- apiGroups:
- ""
resources:
- configmaps
- endpoints
- persistentvolumeclaims
- replicationcontrollers
- replicationcontrollers/scale
- secrets
- serviceaccounts
- services
- services/proxy
verbs:
- create
- delete
- deletecollection
- patch
- update
- apiGroups:
- apps
resources:
- daemonsets
- deployments
- deployments/rollback
- deployments/scale
- replicasets
- replicasets/scale
- statefulsets
- statefulsets/scale
verbs:
- create
- delete
- deletecollection
- patch
- update
- apiGroups:
- autoscaling
resources:
- horizontalpodautoscalers
verbs:
- create
- delete
- deletecollection
- patch
- update
- apiGroups:
- batch
resources:
- cronjobs
- jobs
verbs:
- create
- delete
- deletecollection
- patch
- update
- apiGroups:
- extensions
resources:
- daemonsets
- deployments
- deployments/rollback
- deployments/scale
- ingresses
- networkpolicies
- replicasets
- replicasets/scale
- replicationcontrollers/scale
verbs:
- create
- delete
- deletecollection
- patch
- update
- apiGroups:
- policy
resources:
- poddisruptionbudgets
verbs:
- create
- delete
- deletecollection
- patch
- update
- apiGroups:
- networking.k8s.io
resources:
- networkpolicies
verbs:
- create
- delete
- deletecollection
- patch
- update
- apiGroups:
- networking.k8s.io
resources:
- ingresses
verbs:
- create
- apiGroups:
- networking.k8s.io
resources:
- ingresses
verbs:
- delete
- apiGroups:
- networking.k8s.io
resources:
- ingresses
verbs:
- deletecollection
- apiGroups:
- networking.k8s.io
resources:
- ingresses
verbs:
- patch
- apiGroups:
- networking.k8s.io
resources:
- ingresses
verbs:
- update
- apiGroups:
- argoproj.io
resources:
- workflows
- workflows/finalizers
- workflowtemplates
- workflowtemplates/finalizers
- cronworkflows
- cronworkflows/finalizers
- clusterworkflowtemplates
- clusterworkflowtemplates/finalizers
verbs:
- get
- list
- watch
- apiGroups:
- argoproj.io
resources:
- gateways
- gateways/finalizers
- sensors
- sensors/finalizers
- eventsources
- eventsources/finalizers
- eventbuses
- eventbuses/finalizers
verbs:
- get
- list
- watch
- apiGroups:
- argoproj.io
resources:
- rollouts
- rollouts/scale
- experiments
- analysistemplates
- clusteranalysistemplates
- analysisruns
verbs:
- get
- list
- watch
- apiGroups:
- ""
resourceNames:
- prometheus-k8s-prometheus-1
- prometheus-k8s-prometheus-0
resources:
- pods/portforward
verbs:
- create
- apiGroups:
- networking.istio.io
resources:
- virtualservices
- destinationrules
- serviceentries
- envoyfilters
- gateways
- sidecars
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- configmaps
- endpoints
- persistentvolumeclaims
- pods
- replicationcontrollers
- replicationcontrollers/scale
- serviceaccounts
- services
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- bindings
- events
- limitranges
- namespaces/status
- pods/log
- pods/status
- replicationcontrollers/status
- resourcequotas
- resourcequotas/status
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- namespaces
verbs:
- get
- list
- watch
- apiGroups:
- apps
resources:
- daemonsets
- deployments
- deployments/scale
- replicasets
- replicasets/scale
- statefulsets
- statefulsets/scale
verbs:
- get
- list
- watch
- apiGroups:
- autoscaling
resources:
- horizontalpodautoscalers
verbs:
- get
- list
- watch
- apiGroups:
- batch
resources:
- cronjobs
- jobs
verbs:
- get
- list
- watch
- apiGroups:
- extensions
resources:
- daemonsets
- deployments
- deployments/scale
- ingresses
- networkpolicies
- replicasets
- replicasets/scale
- replicationcontrollers/scale
verbs:
- get
- list
- watch
- apiGroups:
- policy
resources:
- poddisruptionbudgets
verbs:
- get
- list
- watch
- apiGroups:
- networking.k8s.io
resources:
- networkpolicies
verbs:
- get
- list
- watch
- apiGroups:
- apps
resources:
- controllerrevisions
verbs:
- get
- apiGroups:
- apps
resources:
- controllerrevisions
verbs:
- list
- apiGroups:
- apps
resources:
- controllerrevisions
verbs:
- watch
- apiGroups:
- networking.k8s.io
resources:
- ingresses
verbs:
- get
- apiGroups:
- networking.k8s.io
resources:
- ingresses
verbs:
- list
- apiGroups:
- networking.k8s.io
resources:
- ingresses
verbs:
- watch
- apiGroups:
- ""
resources:
- persistentvolumeclaims/status
verbs:
- get
- apiGroups:
- ""
resources:
- persistentvolumeclaims/status
verbs:
- list
- apiGroups:
- ""
resources:
- persistentvolumeclaims/status
verbs:
- watch
- apiGroups:
- ""
resources:
- services/status
verbs:
- get
- apiGroups:
- ""
resources:
- services/status
verbs:
- list
- apiGroups:
- ""
resources:
- services/status
verbs:
- watch
- apiGroups:
- apps
resources:
- daemonsets/status
verbs:
- get
- apiGroups:
- apps
resources:
- daemonsets/status
verbs:
- list
- apiGroups:
- apps
resources:
- daemonsets/status
verbs:
- watch
- apiGroups:
- apps
resources:
- deployments/status
verbs:
- get
- apiGroups:
- apps
resources:
- deployments/status
verbs:
- list
- apiGroups:
- apps
resources:
- deployments/status
verbs:
- watch
- apiGroups:
- apps
resources:
- replicasets/status
verbs:
- get
- apiGroups:
- apps
resources:
- replicasets/status
verbs:
- list
- apiGroups:
- apps
resources:
- replicasets/status
verbs:
- watch
- apiGroups:
- apps
resources:
- statefulsets/status
verbs:
- get
- apiGroups:
- apps
resources:
- statefulsets/status
verbs:
- list
- apiGroups:
- apps
resources:
- statefulsets/status
verbs:
- watch
- apiGroups:
- autoscaling
resources:
- horizontalpodautoscalers/status
verbs:
- get
- apiGroups:
- autoscaling
resources:
- horizontalpodautoscalers/status
verbs:
- list
- apiGroups:
- autoscaling
resources:
- horizontalpodautoscalers/status
verbs:
- watch
- apiGroups:
- batch
resources:
- cronjobs/status
verbs:
- get
- apiGroups:
- batch
resources:
- cronjobs/status
verbs:
- list
- apiGroups:
- batch
resources:
- cronjobs/status
verbs:
- watch
- apiGroups:
- batch
resources:
- jobs/status
verbs:
- get
- apiGroups:
- batch
resources:
- jobs/status
verbs:
- list
- apiGroups:
- batch
resources:
- jobs/status
verbs:
- watch
- apiGroups:
- extensions
resources:
- daemonsets/status
verbs:
- get
- apiGroups:
- extensions
resources:
- daemonsets/status
verbs:
- list
- apiGroups:
- extensions
resources:
- daemonsets/status
verbs:
- watch
- apiGroups:
- extensions
resources:
- deployments/status
verbs:
- get
- apiGroups:
- extensions
resources:
- deployments/status
verbs:
- list
- apiGroups:
- extensions
resources:
- deployments/status
verbs:
- watch
- apiGroups:
- extensions
resources:
- ingresses/status
verbs:
- get
- apiGroups:
- extensions
resources:
- ingresses/status
verbs:
- list
- apiGroups:
- extensions
resources:
- ingresses/status
verbs:
- watch
- apiGroups:
- extensions
resources:
- replicasets/status
verbs:
- get
- apiGroups:
- extensions
resources:
- replicasets/status
verbs:
- list
- apiGroups:
- extensions
resources:
- replicasets/status
verbs:
- watch
- apiGroups:
- policy
resources:
- poddisruptionbudgets/status
verbs:
- get
- apiGroups:
- policy
resources:
- poddisruptionbudgets/status
verbs:
- list
- apiGroups:
- policy
resources:
- poddisruptionbudgets/status
verbs:
- watch
- apiGroups:
- networking.k8s.io
resources:
- ingresses/status
verbs:
- get
- apiGroups:
- networking.k8s.io
resources:
- ingresses/status
verbs:
- list
- apiGroups:
- networking.k8s.io
resources:
- ingresses/status
verbs:
- watch
- apiGroups:
- ""
resources:
- events
verbs:
- create
- patch
- apiGroups:
- extensions
- networking.k8s.io
resources:
- ingresses/status
verbs:
- update
- apiGroups:
- monitoring.coreos.com
resources:
- prometheusrules
verbs:
- get
- watch
- list
- update
- delete
- create
- apiGroups:
- hpa.orkaproj.io
resources:
- hpaalgoes
verbs:
- get
- watch
- list
- update
- delete
- create
- apiGroups:
- networking.istio.io
resources:
- virtualservices
- destinationrules
- serviceentries
- envoyfilters
- gateways
- sidecars
verbs:
- get
- list
- create
- update
- delete
- patch
- watch
- apiGroups:
- authorization.k8s.io
resources:
- localsubjectaccessreviews
verbs:
- create
- apiGroups:
- rbac.authorization.k8s.io
resources:
- rolebindings
- roles
verbs:
- create
- delete
- deletecollection
- get
- list
- patch
- update
- watch

View File

@@ -1,385 +0,0 @@
package main
import (
"context"
"fmt"
"io/ioutil"
"os"
"os/exec"
"strings"
"syscall"
"github.com/argoproj/argo-cd/common"
"github.com/argoproj/argo-cd/errors"
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
appclientset "github.com/argoproj/argo-cd/pkg/client/clientset/versioned"
"github.com/argoproj/argo-cd/util/cli"
"github.com/argoproj/argo-cd/util/db"
"github.com/argoproj/argo-cd/util/dex"
"github.com/argoproj/argo-cd/util/settings"
"github.com/ghodss/yaml"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
apiv1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
// load the gcp plugin (required to authenticate against GKE clusters).
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
// load the oidc plugin (required to authenticate with OpenID Connect).
_ "k8s.io/client-go/plugin/pkg/client/auth/oidc"
)
const (
// CLIName is the name of the CLI
cliName = "argocd-util"
// YamlSeparator separates sections of a YAML file
yamlSeparator = "\n---\n"
)
// NewCommand returns a new instance of an argocd command
func NewCommand() *cobra.Command {
var (
logLevel string
)
var command = &cobra.Command{
Use: cliName,
Short: "argocd-util has internal tools used by ArgoCD",
Run: func(c *cobra.Command, args []string) {
c.HelpFunc()(c, args)
},
}
command.AddCommand(cli.NewVersionCmd(cliName))
command.AddCommand(NewRunDexCommand())
command.AddCommand(NewGenDexConfigCommand())
command.AddCommand(NewImportCommand())
command.AddCommand(NewExportCommand())
command.AddCommand(NewSettingsCommand())
command.Flags().StringVar(&logLevel, "loglevel", "info", "Set the logging level. One of: debug|info|warn|error")
return command
}
func NewRunDexCommand() *cobra.Command {
var (
clientConfig clientcmd.ClientConfig
)
var command = cobra.Command{
Use: "rundex",
Short: "Runs dex generating a config using settings from the ArgoCD configmap and secret",
RunE: func(c *cobra.Command, args []string) error {
_, err := exec.LookPath("dex")
errors.CheckError(err)
config, err := clientConfig.ClientConfig()
errors.CheckError(err)
namespace, _, err := clientConfig.Namespace()
errors.CheckError(err)
kubeClientset := kubernetes.NewForConfigOrDie(config)
settingsMgr := settings.NewSettingsManager(kubeClientset, namespace)
settings, err := settingsMgr.GetSettings()
errors.CheckError(err)
ctx := context.Background()
settingsMgr.StartNotifier(ctx, settings)
updateCh := make(chan struct{}, 1)
settingsMgr.Subscribe(updateCh)
for {
var cmd *exec.Cmd
dexCfgBytes, err := dex.GenerateDexConfigYAML(settings)
errors.CheckError(err)
if len(dexCfgBytes) == 0 {
log.Infof("dex is not configured")
} else {
err = ioutil.WriteFile("/tmp/dex.yaml", dexCfgBytes, 0644)
errors.CheckError(err)
log.Info(string(dexCfgBytes))
cmd = exec.Command("dex", "serve", "/tmp/dex.yaml")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err = cmd.Start()
errors.CheckError(err)
}
// loop until the dex config changes
for {
<-updateCh
newDexCfgBytes, err := dex.GenerateDexConfigYAML(settings)
errors.CheckError(err)
if string(newDexCfgBytes) != string(dexCfgBytes) {
log.Infof("dex config modified. restarting dex")
if cmd != nil && cmd.Process != nil {
err = cmd.Process.Signal(syscall.SIGTERM)
errors.CheckError(err)
_, err = cmd.Process.Wait()
errors.CheckError(err)
}
break
} else {
log.Infof("dex config unmodified")
}
}
}
},
}
clientConfig = cli.AddKubectlFlagsToCmd(&command)
return &command
}
func NewGenDexConfigCommand() *cobra.Command {
var (
clientConfig clientcmd.ClientConfig
out string
)
var command = cobra.Command{
Use: "gendexcfg",
Short: "Generates a dex config from ArgoCD settings",
RunE: func(c *cobra.Command, args []string) error {
config, err := clientConfig.ClientConfig()
errors.CheckError(err)
namespace, _, err := clientConfig.Namespace()
errors.CheckError(err)
kubeClientset := kubernetes.NewForConfigOrDie(config)
settingsMgr := settings.NewSettingsManager(kubeClientset, namespace)
settings, err := settingsMgr.GetSettings()
errors.CheckError(err)
dexCfgBytes, err := dex.GenerateDexConfigYAML(settings)
errors.CheckError(err)
if len(dexCfgBytes) == 0 {
log.Infof("dex is not configured")
return nil
}
if out == "" {
fmt.Printf(string(dexCfgBytes))
} else {
err = ioutil.WriteFile(out, dexCfgBytes, 0644)
errors.CheckError(err)
}
return nil
},
}
clientConfig = cli.AddKubectlFlagsToCmd(&command)
command.Flags().StringVarP(&out, "out", "o", "", "Output to the specified file instead of stdout")
return &command
}
// NewImportCommand defines a new command for exporting Kubernetes and Argo CD resources.
func NewImportCommand() *cobra.Command {
var (
clientConfig clientcmd.ClientConfig
)
var command = cobra.Command{
Use: "import SOURCE",
Short: "Import Argo CD data from stdin (specify `-') or a file",
RunE: func(c *cobra.Command, args []string) error {
if len(args) != 1 {
c.HelpFunc()(c, args)
os.Exit(1)
}
var (
input []byte
err error
newSettings *settings.ArgoCDSettings
newRepos []*v1alpha1.Repository
newClusters []*v1alpha1.Cluster
newApps []*v1alpha1.Application
newRBACCM *apiv1.ConfigMap
)
if in := args[0]; in == "-" {
input, err = ioutil.ReadAll(os.Stdin)
errors.CheckError(err)
} else {
input, err = ioutil.ReadFile(in)
errors.CheckError(err)
}
inputStrings := strings.Split(string(input), yamlSeparator)
err = yaml.Unmarshal([]byte(inputStrings[0]), &newSettings)
errors.CheckError(err)
err = yaml.Unmarshal([]byte(inputStrings[1]), &newRepos)
errors.CheckError(err)
err = yaml.Unmarshal([]byte(inputStrings[2]), &newClusters)
errors.CheckError(err)
err = yaml.Unmarshal([]byte(inputStrings[3]), &newApps)
errors.CheckError(err)
err = yaml.Unmarshal([]byte(inputStrings[4]), &newRBACCM)
errors.CheckError(err)
config, err := clientConfig.ClientConfig()
errors.CheckError(err)
namespace, _, err := clientConfig.Namespace()
errors.CheckError(err)
kubeClientset := kubernetes.NewForConfigOrDie(config)
settingsMgr := settings.NewSettingsManager(kubeClientset, namespace)
err = settingsMgr.SaveSettings(newSettings)
errors.CheckError(err)
db := db.NewDB(namespace, kubeClientset)
_, err = kubeClientset.CoreV1().ConfigMaps(namespace).Create(newRBACCM)
errors.CheckError(err)
for _, repo := range newRepos {
_, err := db.CreateRepository(context.Background(), repo)
if err != nil {
log.Warn(err)
}
}
for _, cluster := range newClusters {
_, err := db.CreateCluster(context.Background(), cluster)
if err != nil {
log.Warn(err)
}
}
appClientset := appclientset.NewForConfigOrDie(config)
for _, app := range newApps {
out, err := appClientset.ArgoprojV1alpha1().Applications(namespace).Create(app)
errors.CheckError(err)
log.Println(out)
}
return nil
},
}
clientConfig = cli.AddKubectlFlagsToCmd(&command)
return &command
}
// NewExportCommand defines a new command for exporting Kubernetes and Argo CD resources.
func NewExportCommand() *cobra.Command {
var (
clientConfig clientcmd.ClientConfig
out string
)
var command = cobra.Command{
Use: "export",
Short: "Export all Argo CD data to stdout (default) or a file",
RunE: func(c *cobra.Command, args []string) error {
config, err := clientConfig.ClientConfig()
errors.CheckError(err)
namespace, _, err := clientConfig.Namespace()
errors.CheckError(err)
kubeClientset := kubernetes.NewForConfigOrDie(config)
settingsMgr := settings.NewSettingsManager(kubeClientset, namespace)
settings, err := settingsMgr.GetSettings()
errors.CheckError(err)
// certificate data is included in secrets that are exported alongside
settings.Certificate = nil
db := db.NewDB(namespace, kubeClientset)
clusters, err := db.ListClusters(context.Background())
errors.CheckError(err)
repos, err := db.ListRepositories(context.Background())
errors.CheckError(err)
appClientset := appclientset.NewForConfigOrDie(config)
apps, err := appClientset.ArgoprojV1alpha1().Applications(namespace).List(metav1.ListOptions{})
errors.CheckError(err)
rbacCM, err := kubeClientset.CoreV1().ConfigMaps(namespace).Get(common.ArgoCDRBACConfigMapName, metav1.GetOptions{})
errors.CheckError(err)
// remove extraneous cruft from output
rbacCM.ObjectMeta = metav1.ObjectMeta{
Name: rbacCM.ObjectMeta.Name,
}
// remove extraneous cruft from output
for idx, app := range apps.Items {
apps.Items[idx].ObjectMeta = metav1.ObjectMeta{
Name: app.ObjectMeta.Name,
Finalizers: app.ObjectMeta.Finalizers,
}
apps.Items[idx].Status = v1alpha1.ApplicationStatus{
History: app.Status.History,
}
apps.Items[idx].Operation = nil
}
// take a list of exportable objects, marshal them to YAML,
// and return a string joined by a delimiter
output := func(delimiter string, oo ...interface{}) string {
out := make([]string, 0)
for _, o := range oo {
data, err := yaml.Marshal(o)
errors.CheckError(err)
out = append(out, string(data))
}
return strings.Join(out, delimiter)
}(yamlSeparator, settings, repos.Items, clusters.Items, apps.Items, rbacCM)
if out == "-" {
fmt.Println(output)
} else {
err = ioutil.WriteFile(out, []byte(output), 0644)
errors.CheckError(err)
}
return nil
},
}
clientConfig = cli.AddKubectlFlagsToCmd(&command)
command.Flags().StringVarP(&out, "out", "o", "-", "Output to the specified file instead of stdout")
return &command
}
// NewSettingsCommand returns a new instance of `argocd-util settings` command
func NewSettingsCommand() *cobra.Command {
var (
clientConfig clientcmd.ClientConfig
updateSuperuser bool
superuserPassword string
updateSignature bool
)
var command = &cobra.Command{
Use: "settings",
Short: "Creates or updates ArgoCD settings",
Long: "Creates or updates ArgoCD settings",
Run: func(c *cobra.Command, args []string) {
conf, err := clientConfig.ClientConfig()
errors.CheckError(err)
namespace, wasSpecified, err := clientConfig.Namespace()
errors.CheckError(err)
if !(wasSpecified) {
namespace = "argocd"
}
kubeclientset, err := kubernetes.NewForConfig(conf)
errors.CheckError(err)
settingsMgr := settings.NewSettingsManager(kubeclientset, namespace)
_, err = settings.UpdateSettings(superuserPassword, settingsMgr, updateSignature, updateSuperuser, namespace)
errors.CheckError(err)
},
}
command.Flags().BoolVar(&updateSuperuser, "update-superuser", false, "force updating the superuser password")
command.Flags().StringVar(&superuserPassword, "superuser-password", "", "password for super user")
command.Flags().BoolVar(&updateSignature, "update-signature", false, "force updating the server-side token signing signature")
clientConfig = cli.AddKubectlFlagsToCmd(command)
return command
}
func main() {
if err := NewCommand().Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
}

View File

@@ -2,17 +2,29 @@ package commands
import (
"context"
"encoding/json"
"fmt"
"os"
"syscall"
"strconv"
"strings"
"text/tabwriter"
"time"
"github.com/argoproj/argo-cd/errors"
argocdclient "github.com/argoproj/argo-cd/pkg/apiclient"
"github.com/argoproj/argo-cd/server/account"
"github.com/argoproj/argo-cd/util"
"github.com/argoproj/argo-cd/util/settings"
timeutil "github.com/argoproj/pkg/time"
"github.com/ghodss/yaml"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"golang.org/x/crypto/ssh/terminal"
argocdclient "github.com/argoproj/argo-cd/pkg/apiclient"
accountpkg "github.com/argoproj/argo-cd/pkg/apiclient/account"
"github.com/argoproj/argo-cd/pkg/apiclient/session"
"github.com/argoproj/argo-cd/server/rbacpolicy"
"github.com/argoproj/argo-cd/util/cli"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/io"
"github.com/argoproj/argo-cd/util/localconfig"
sessionutil "github.com/argoproj/argo-cd/util/session"
)
func NewAccountCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
@@ -25,11 +37,18 @@ func NewAccountCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
},
}
command.AddCommand(NewAccountUpdatePasswordCommand(clientOpts))
command.AddCommand(NewAccountGetUserInfoCommand(clientOpts))
command.AddCommand(NewAccountCanICommand(clientOpts))
command.AddCommand(NewAccountListCommand(clientOpts))
command.AddCommand(NewAccountGenerateTokenCommand(clientOpts))
command.AddCommand(NewAccountGetCommand(clientOpts))
command.AddCommand(NewAccountDeleteTokenCommand(clientOpts))
return command
}
func NewAccountUpdatePasswordCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
account string
currentPassword string
newPassword string
)
@@ -41,34 +60,341 @@ func NewAccountUpdatePasswordCommand(clientOpts *argocdclient.ClientOptions) *co
c.HelpFunc()(c, args)
os.Exit(1)
}
acdClient := argocdclient.NewClientOrDie(clientOpts)
conn, usrIf := acdClient.NewAccountClientOrDie()
defer io.Close(conn)
if currentPassword == "" {
userInfo := getCurrentAccount(acdClient)
if userInfo.Iss == sessionutil.SessionManagerClaimsIssuer && currentPassword == "" {
fmt.Print("*** Enter current password: ")
password, err := terminal.ReadPassword(syscall.Stdin)
password, err := terminal.ReadPassword(int(os.Stdin.Fd()))
errors.CheckError(err)
currentPassword = string(password)
fmt.Print("\n")
}
if newPassword == "" {
var err error
newPassword, err = settings.ReadAndConfirmPassword()
newPassword, err = cli.ReadAndConfirmPassword()
errors.CheckError(err)
}
updatePasswordRequest := account.UpdatePasswordRequest{
updatePasswordRequest := accountpkg.UpdatePasswordRequest{
NewPassword: newPassword,
CurrentPassword: currentPassword,
Name: account,
}
conn, usrIf := argocdclient.NewClientOrDie(clientOpts).NewAccountClientOrDie()
defer util.Close(conn)
_, err := usrIf.UpdatePassword(context.Background(), &updatePasswordRequest)
ctx := context.Background()
_, err := usrIf.UpdatePassword(ctx, &updatePasswordRequest)
errors.CheckError(err)
fmt.Printf("Password updated\n")
if account == "" || account == userInfo.Username {
// Get a new JWT token after updating the password
localCfg, err := localconfig.ReadLocalConfig(clientOpts.ConfigPath)
errors.CheckError(err)
configCtx, err := localCfg.ResolveContext(clientOpts.Context)
errors.CheckError(err)
claims, err := configCtx.User.Claims()
errors.CheckError(err)
tokenString := passwordLogin(acdClient, claims.Subject, newPassword)
localCfg.UpsertUser(localconfig.User{
Name: localCfg.CurrentContext,
AuthToken: tokenString,
})
err = localconfig.WriteLocalConfig(*localCfg, clientOpts.ConfigPath)
errors.CheckError(err)
fmt.Printf("Context '%s' updated\n", localCfg.CurrentContext)
}
},
}
command.Flags().StringVar(&currentPassword, "current-password", "", "current password you wish to change")
command.Flags().StringVar(&newPassword, "new-password", "", "new password you want to update to")
command.Flags().StringVar(&account, "account", "", "an account name that should be updated. Defaults to current user account")
return command
}
func NewAccountGetUserInfoCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
output string
)
var command = &cobra.Command{
Use: "get-user-info",
Short: "Get user info",
Run: func(c *cobra.Command, args []string) {
if len(args) != 0 {
c.HelpFunc()(c, args)
os.Exit(1)
}
conn, client := argocdclient.NewClientOrDie(clientOpts).NewSessionClientOrDie()
defer io.Close(conn)
ctx := context.Background()
response, err := client.GetUserInfo(ctx, &session.GetUserInfoRequest{})
errors.CheckError(err)
switch output {
case "yaml":
yamlBytes, err := yaml.Marshal(response)
errors.CheckError(err)
fmt.Println(string(yamlBytes))
case "json":
jsonBytes, err := json.MarshalIndent(response, "", " ")
errors.CheckError(err)
fmt.Println(string(jsonBytes))
case "":
fmt.Printf("Logged In: %v\n", response.LoggedIn)
if response.LoggedIn {
fmt.Printf("Username: %s\n", response.Username)
fmt.Printf("Issuer: %s\n", response.Iss)
fmt.Printf("Groups: %v\n", strings.Join(response.Groups, ","))
}
default:
log.Fatalf("Unknown output format: %s", output)
}
},
}
command.Flags().StringVarP(&output, "output", "o", "", "Output format. One of: yaml, json")
return command
}
func NewAccountCanICommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
return &cobra.Command{
Use: "can-i ACTION RESOURCE SUBRESOURCE",
Short: "Can I",
Example: fmt.Sprintf(`
# Can I sync any app?
argocd account can-i sync applications '*'
# Can I update a project?
argocd account can-i update projects 'default'
# Can I create a cluster?
argocd account can-i create clusters '*'
Actions: %v
Resources: %v
`, rbacpolicy.Actions, rbacpolicy.Resources),
Run: func(c *cobra.Command, args []string) {
if len(args) != 3 {
c.HelpFunc()(c, args)
os.Exit(1)
}
conn, client := argocdclient.NewClientOrDie(clientOpts).NewAccountClientOrDie()
defer io.Close(conn)
ctx := context.Background()
response, err := client.CanI(ctx, &accountpkg.CanIRequest{
Action: args[0],
Resource: args[1],
Subresource: args[2],
})
errors.CheckError(err)
fmt.Println(response.Value)
},
}
}
func printAccountNames(accounts []*accountpkg.Account) {
for _, p := range accounts {
fmt.Println(p.Name)
}
}
func printAccountsTable(items []*accountpkg.Account) {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
fmt.Fprintf(w, "NAME\tENABLED\tCAPABILITIES\n")
for _, a := range items {
fmt.Fprintf(w, "%s\t%v\t%s\n", a.Name, a.Enabled, strings.Join(a.Capabilities, ", "))
}
_ = w.Flush()
}
func NewAccountListCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
output string
)
cmd := &cobra.Command{
Use: "list",
Short: "List accounts",
Example: "argocd account list",
Run: func(c *cobra.Command, args []string) {
conn, client := argocdclient.NewClientOrDie(clientOpts).NewAccountClientOrDie()
defer io.Close(conn)
ctx := context.Background()
response, err := client.ListAccounts(ctx, &accountpkg.ListAccountRequest{})
errors.CheckError(err)
switch output {
case "yaml", "json":
err := PrintResourceList(response.Items, output, false)
errors.CheckError(err)
case "name":
printAccountNames(response.Items)
case "wide", "":
printAccountsTable(response.Items)
default:
errors.CheckError(fmt.Errorf("unknown output format: %s", output))
}
},
}
cmd.Flags().StringVarP(&output, "output", "o", "wide", "Output format. One of: json|yaml|wide|name")
return cmd
}
func getCurrentAccount(clientset argocdclient.Client) session.GetUserInfoResponse {
conn, client := clientset.NewSessionClientOrDie()
defer io.Close(conn)
userInfo, err := client.GetUserInfo(context.Background(), &session.GetUserInfoRequest{})
errors.CheckError(err)
return *userInfo
}
func NewAccountGetCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
output string
account string
)
cmd := &cobra.Command{
Use: "get",
Short: "Get account details",
Example: `# Get the currently logged in account details
argocd account get
# Get details for an account by name
argocd account get --account <account-name>`,
Run: func(c *cobra.Command, args []string) {
clientset := argocdclient.NewClientOrDie(clientOpts)
if account == "" {
account = getCurrentAccount(clientset).Username
}
conn, client := clientset.NewAccountClientOrDie()
defer io.Close(conn)
acc, err := client.GetAccount(context.Background(), &accountpkg.GetAccountRequest{Name: account})
errors.CheckError(err)
switch output {
case "yaml", "json":
err := PrintResourceList(acc, output, true)
errors.CheckError(err)
case "name":
fmt.Println(acc.Name)
case "wide", "":
printAccountDetails(acc)
default:
errors.CheckError(fmt.Errorf("unknown output format: %s", output))
}
},
}
cmd.Flags().StringVarP(&output, "output", "o", "wide", "Output format. One of: json|yaml|wide|name")
cmd.Flags().StringVarP(&account, "account", "a", "", "Account name. Defaults to the current account.")
return cmd
}
func printAccountDetails(acc *accountpkg.Account) {
fmt.Printf(printOpFmtStr, "Name:", acc.Name)
fmt.Printf(printOpFmtStr, "Enabled:", strconv.FormatBool(acc.Enabled))
fmt.Printf(printOpFmtStr, "Capabilities:", strings.Join(acc.Capabilities, ", "))
fmt.Println("\nTokens:")
if len(acc.Tokens) == 0 {
fmt.Println("NONE")
} else {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
fmt.Fprintf(w, "ID\tISSUED AT\tEXPIRING AT\n")
for _, t := range acc.Tokens {
expiresAtFormatted := "never"
if t.ExpiresAt > 0 {
expiresAt := time.Unix(t.ExpiresAt, 0)
expiresAtFormatted = expiresAt.Format(time.RFC3339)
if expiresAt.Before(time.Now()) {
expiresAtFormatted = fmt.Sprintf("%s (expired)", expiresAtFormatted)
}
}
fmt.Fprintf(w, "%s\t%s\t%s\n", t.Id, time.Unix(t.IssuedAt, 0).Format(time.RFC3339), expiresAtFormatted)
}
_ = w.Flush()
}
}
func NewAccountGenerateTokenCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
account string
expiresIn string
id string
)
cmd := &cobra.Command{
Use: "generate-token",
Short: "Generate account token",
Example: `# Generate token for the currently logged in account
argocd account generate-token
# Generate token for the account with the specified name
argocd account generate-token --account <account-name>`,
Run: func(c *cobra.Command, args []string) {
clientset := argocdclient.NewClientOrDie(clientOpts)
conn, client := clientset.NewAccountClientOrDie()
defer io.Close(conn)
if account == "" {
account = getCurrentAccount(clientset).Username
}
expiresIn, err := timeutil.ParseDuration(expiresIn)
errors.CheckError(err)
response, err := client.CreateToken(context.Background(), &accountpkg.CreateTokenRequest{
Name: account,
ExpiresIn: int64(expiresIn.Seconds()),
Id: id,
})
errors.CheckError(err)
fmt.Println(response.Token)
},
}
cmd.Flags().StringVarP(&account, "account", "a", "", "Account name. Defaults to the current account.")
cmd.Flags().StringVarP(&expiresIn, "expires-in", "e", "0s", "Duration before the token will expire. (Default: No expiration)")
cmd.Flags().StringVar(&id, "id", "", "Optional token id. Fallback to uuid if not value specified.")
return cmd
}
func NewAccountDeleteTokenCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
account string
)
cmd := &cobra.Command{
Use: "delete-token",
Short: "Deletes account token",
Example: `# Delete token of the currently logged in account
argocd account delete-token ID
# Delete token of the account with the specified name
argocd account generate-token --account <account-name>`,
Run: func(c *cobra.Command, args []string) {
if len(args) != 1 {
c.HelpFunc()(c, args)
os.Exit(1)
}
id := args[0]
clientset := argocdclient.NewClientOrDie(clientOpts)
conn, client := clientset.NewAccountClientOrDie()
defer io.Close(conn)
if account == "" {
account = getCurrentAccount(clientset).Username
}
_, err := client.DeleteToken(context.Background(), &accountpkg.DeleteTokenRequest{Name: account, Id: id})
errors.CheckError(err)
},
}
cmd.Flags().StringVarP(&account, "account", "a", "", "Account name. Defaults to the current account.")
return cmd
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,174 @@
package commands
import (
"context"
"encoding/json"
"fmt"
"os"
"strconv"
"text/tabwriter"
"github.com/ghodss/yaml"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
argocdclient "github.com/argoproj/argo-cd/pkg/apiclient"
applicationpkg "github.com/argoproj/argo-cd/pkg/apiclient/application"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/io"
)
type DisplayedAction struct {
Group string
Kind string
Name string
Action string
Disabled bool
}
// NewApplicationResourceActionsCommand returns a new instance of an `argocd app actions` command
func NewApplicationResourceActionsCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "actions",
Short: "Manage Resource actions",
Run: func(c *cobra.Command, args []string) {
c.HelpFunc()(c, args)
os.Exit(1)
},
}
command.AddCommand(NewApplicationResourceActionsListCommand(clientOpts))
command.AddCommand(NewApplicationResourceActionsRunCommand(clientOpts))
return command
}
// NewApplicationResourceActionsListCommand returns a new instance of an `argocd app actions list` command
func NewApplicationResourceActionsListCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var namespace string
var kind string
var group string
var resourceName string
var output string
var command = &cobra.Command{
Use: "list APPNAME",
Short: "Lists available actions on a resource",
}
command.Run = func(c *cobra.Command, args []string) {
if len(args) != 1 {
c.HelpFunc()(c, args)
os.Exit(1)
}
appName := args[0]
conn, appIf := argocdclient.NewClientOrDie(clientOpts).NewApplicationClientOrDie()
defer io.Close(conn)
ctx := context.Background()
resources, err := appIf.ManagedResources(ctx, &applicationpkg.ResourcesQuery{ApplicationName: &appName})
errors.CheckError(err)
filteredObjects := filterResources(command, resources.Items, group, kind, namespace, resourceName, true)
var availableActions []DisplayedAction
for i := range filteredObjects {
obj := filteredObjects[i]
gvk := obj.GroupVersionKind()
availActionsForResource, err := appIf.ListResourceActions(ctx, &applicationpkg.ApplicationResourceRequest{
Name: &appName,
Namespace: obj.GetNamespace(),
ResourceName: obj.GetName(),
Group: gvk.Group,
Kind: gvk.Kind,
})
errors.CheckError(err)
for _, action := range availActionsForResource.Actions {
displayAction := DisplayedAction{
Group: gvk.Group,
Kind: gvk.Kind,
Name: obj.GetName(),
Action: action.Name,
Disabled: action.Disabled,
}
availableActions = append(availableActions, displayAction)
}
}
switch output {
case "yaml":
yamlBytes, err := yaml.Marshal(availableActions)
errors.CheckError(err)
fmt.Println(string(yamlBytes))
case "json":
jsonBytes, err := json.MarshalIndent(availableActions, "", " ")
errors.CheckError(err)
fmt.Println(string(jsonBytes))
case "":
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
fmt.Fprintf(w, "GROUP\tKIND\tNAME\tACTION\tDISABLED\n")
for _, action := range availableActions {
fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\n", action.Group, action.Kind, action.Name, action.Action, strconv.FormatBool(action.Disabled))
}
_ = w.Flush()
}
}
command.Flags().StringVar(&resourceName, "resource-name", "", "Name of resource")
command.Flags().StringVar(&kind, "kind", "", "Kind")
command.Flags().StringVar(&group, "group", "", "Group")
command.Flags().StringVar(&namespace, "namespace", "", "Namespace")
command.Flags().StringVarP(&output, "out", "o", "", "Output format. One of: yaml, json")
return command
}
// NewApplicationResourceActionsRunCommand returns a new instance of an `argocd app actions run` command
func NewApplicationResourceActionsRunCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var namespace string
var resourceName string
var kind string
var group string
var all bool
var command = &cobra.Command{
Use: "run APPNAME ACTION",
Short: "Runs an available action on resource(s)",
}
command.Flags().StringVar(&resourceName, "resource-name", "", "Name of resource")
command.Flags().StringVar(&namespace, "namespace", "", "Namespace")
command.Flags().StringVar(&kind, "kind", "", "Kind")
command.Flags().StringVar(&group, "group", "", "Group")
errors.CheckError(command.MarkFlagRequired("kind"))
command.Flags().BoolVar(&all, "all", false, "Indicates whether to run the action on multiple matching resources")
command.Run = func(c *cobra.Command, args []string) {
if len(args) != 2 {
c.HelpFunc()(c, args)
os.Exit(1)
}
appName := args[0]
actionName := args[1]
conn, appIf := argocdclient.NewClientOrDie(clientOpts).NewApplicationClientOrDie()
defer io.Close(conn)
ctx := context.Background()
resources, err := appIf.ManagedResources(ctx, &applicationpkg.ResourcesQuery{ApplicationName: &appName})
errors.CheckError(err)
filteredObjects := filterResources(command, resources.Items, group, kind, namespace, resourceName, all)
var resGroup = filteredObjects[0].GroupVersionKind().Group
for i := range filteredObjects[1:] {
if filteredObjects[i].GroupVersionKind().Group != resGroup {
log.Fatal("Ambiguous resource group. Use flag --group to specify resource group explicitly.")
}
}
for i := range filteredObjects {
obj := filteredObjects[i]
gvk := obj.GroupVersionKind()
objResourceName := obj.GetName()
_, err := appIf.RunResourceAction(context.Background(), &applicationpkg.ResourceActionRunRequest{
Name: &appName,
Namespace: obj.GetNamespace(),
ResourceName: objResourceName,
Group: gvk.Group,
Kind: gvk.Kind,
Action: actionName,
})
errors.CheckError(err)
}
}
return command
}

321
cmd/argocd/commands/cert.go Normal file
View File

@@ -0,0 +1,321 @@
package commands
import (
"context"
"crypto/x509"
"fmt"
"os"
"sort"
"strings"
"text/tabwriter"
"github.com/spf13/cobra"
argocdclient "github.com/argoproj/argo-cd/pkg/apiclient"
certificatepkg "github.com/argoproj/argo-cd/pkg/apiclient/certificate"
appsv1 "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
certutil "github.com/argoproj/argo-cd/util/cert"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/io"
)
// NewCertCommand returns a new instance of an `argocd repo` command
func NewCertCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "cert",
Short: "Manage repository certificates and SSH known hosts entries",
Run: func(c *cobra.Command, args []string) {
c.HelpFunc()(c, args)
os.Exit(1)
},
Example: ` # Add a TLS certificate for cd.example.com to ArgoCD cert store from a file
argocd cert add-tls --from ~/mycert.pem cd.example.com
# Add a TLS certificate for cd.example.com to ArgoCD via stdin
cat ~/mycert.pem | argocd cert add-tls cd.example.com
# Add SSH known host entries for cd.example.com to ArgoCD by scanning host
ssh-keyscan cd.example.com | argocd cert add-ssh --batch
# List all known TLS certificates
argocd cert list --cert-type https
# Remove all TLS certificates for cd.example.com
argocd cert rm --cert-type https cd.example.com
# Remove all certificates and SSH known host entries for cd.example.com
argocd cert rm cd.example.com
`,
}
command.AddCommand(NewCertAddSSHCommand(clientOpts))
command.AddCommand(NewCertAddTLSCommand(clientOpts))
command.AddCommand(NewCertListCommand(clientOpts))
command.AddCommand(NewCertRemoveCommand(clientOpts))
return command
}
func NewCertAddTLSCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
fromFile string
upsert bool
)
var command = &cobra.Command{
Use: "add-tls SERVERNAME",
Short: "Add TLS certificate data for connecting to repository server SERVERNAME",
Run: func(c *cobra.Command, args []string) {
conn, certIf := argocdclient.NewClientOrDie(clientOpts).NewCertClientOrDie()
defer io.Close(conn)
if len(args) != 1 {
c.HelpFunc()(c, args)
os.Exit(1)
}
var certificateArray []string
var err error
if fromFile != "" {
fmt.Printf("Reading TLS certificate data in PEM format from '%s'\n", fromFile)
certificateArray, err = certutil.ParseTLSCertificatesFromPath(fromFile)
} else {
fmt.Println("Enter TLS certificate data in PEM format. Press CTRL-D when finished.")
certificateArray, err = certutil.ParseTLSCertificatesFromStream(os.Stdin)
}
errors.CheckError(err)
certificateList := make([]appsv1.RepositoryCertificate, 0)
subjectMap := make(map[string]*x509.Certificate)
for _, entry := range certificateArray {
// We want to make sure to only send valid certificate data to the
// server, so we decode the certificate into X509 structure before
// further processing it.
x509cert, err := certutil.DecodePEMCertificateToX509(entry)
errors.CheckError(err)
// TODO: We need a better way to detect duplicates sent in the stream,
// maybe by using fingerprints? For now, no two certs with the same
// subject may be sent.
if subjectMap[x509cert.Subject.String()] != nil {
fmt.Printf("ERROR: Cert with subject '%s' already seen in the input stream.\n", x509cert.Subject.String())
continue
} else {
subjectMap[x509cert.Subject.String()] = x509cert
}
}
serverName := args[0]
if len(certificateArray) > 0 {
certificateList = append(certificateList, appsv1.RepositoryCertificate{
ServerName: serverName,
CertType: "https",
CertData: []byte(strings.Join(certificateArray, "\n")),
})
certificates, err := certIf.CreateCertificate(context.Background(), &certificatepkg.RepositoryCertificateCreateRequest{
Certificates: &appsv1.RepositoryCertificateList{
Items: certificateList,
},
Upsert: upsert,
})
errors.CheckError(err)
fmt.Printf("Created entry with %d PEM certificates for repository server %s\n", len(certificates.Items), serverName)
} else {
fmt.Printf("No valid certificates have been detected in the stream.\n")
}
},
}
command.Flags().StringVar(&fromFile, "from", "", "read TLS certificate data from file (default is to read from stdin)")
command.Flags().BoolVar(&upsert, "upsert", false, "Replace existing TLS certificate if certificate is different in input")
return command
}
// NewCertAddCommand returns a new instance of an `argocd cert add` command
func NewCertAddSSHCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
fromFile string
batchProcess bool
upsert bool
certificates []appsv1.RepositoryCertificate
)
var command = &cobra.Command{
Use: "add-ssh --batch",
Short: "Add SSH known host entries for repository servers",
Run: func(c *cobra.Command, args []string) {
conn, certIf := argocdclient.NewClientOrDie(clientOpts).NewCertClientOrDie()
defer io.Close(conn)
var sshKnownHostsLists []string
var err error
// --batch is a flag, but it is mandatory for now.
if batchProcess {
if fromFile != "" {
fmt.Printf("Reading SSH known hosts entries from file '%s'\n", fromFile)
sshKnownHostsLists, err = certutil.ParseSSHKnownHostsFromPath(fromFile)
} else {
fmt.Println("Enter SSH known hosts entries, one per line. Press CTRL-D when finished.")
sshKnownHostsLists, err = certutil.ParseSSHKnownHostsFromStream(os.Stdin)
}
} else {
err = fmt.Errorf("You need to specify --batch or specify --help for usage instructions")
}
errors.CheckError(err)
if len(sshKnownHostsLists) == 0 {
errors.CheckError(fmt.Errorf("No valid SSH known hosts data found."))
}
for _, knownHostsEntry := range sshKnownHostsLists {
_, certSubType, certData, err := certutil.TokenizeSSHKnownHostsEntry(knownHostsEntry)
errors.CheckError(err)
hostnameList, _, err := certutil.KnownHostsLineToPublicKey(knownHostsEntry)
errors.CheckError(err)
// Each key could be valid for multiple hostnames
for _, hostname := range hostnameList {
certificate := appsv1.RepositoryCertificate{
ServerName: hostname,
CertType: "ssh",
CertSubType: certSubType,
CertData: certData,
}
certificates = append(certificates, certificate)
}
}
certList := &appsv1.RepositoryCertificateList{Items: certificates}
response, err := certIf.CreateCertificate(context.Background(), &certificatepkg.RepositoryCertificateCreateRequest{
Certificates: certList,
Upsert: upsert,
})
errors.CheckError(err)
fmt.Printf("Successfully created %d SSH known host entries\n", len(response.Items))
},
}
command.Flags().StringVar(&fromFile, "from", "", "Read SSH known hosts data from file (default is to read from stdin)")
command.Flags().BoolVar(&batchProcess, "batch", false, "Perform batch processing by reading in SSH known hosts data (mandatory flag)")
command.Flags().BoolVar(&upsert, "upsert", false, "Replace existing SSH server public host keys if key is different in input")
return command
}
// NewCertRemoveCommand returns a new instance of an `argocd cert rm` command
func NewCertRemoveCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
certType string
certSubType string
certQuery certificatepkg.RepositoryCertificateQuery
)
var command = &cobra.Command{
Use: "rm REPOSERVER",
Short: "Remove certificate of TYPE for REPOSERVER",
Run: func(c *cobra.Command, args []string) {
if len(args) < 1 {
c.HelpFunc()(c, args)
os.Exit(1)
}
conn, certIf := argocdclient.NewClientOrDie(clientOpts).NewCertClientOrDie()
defer io.Close(conn)
hostNamePattern := args[0]
// Prevent the user from specifying a wildcard as hostname as precaution
// measure -- the user could still use "?*" or any other pattern to
// remove all certificates, but it's less likely that it happens by
// accident.
if hostNamePattern == "*" {
err := fmt.Errorf("A single wildcard is not allowed as REPOSERVER name.")
errors.CheckError(err)
}
certQuery = certificatepkg.RepositoryCertificateQuery{
HostNamePattern: hostNamePattern,
CertType: certType,
CertSubType: certSubType,
}
removed, err := certIf.DeleteCertificate(context.Background(), &certQuery)
errors.CheckError(err)
if len(removed.Items) > 0 {
for _, cert := range removed.Items {
fmt.Printf("Removed cert for '%s' of type '%s' (subtype '%s')\n", cert.ServerName, cert.CertType, cert.CertSubType)
}
} else {
fmt.Println("No certificates were removed (none matched the given patterns)")
}
},
}
command.Flags().StringVar(&certType, "cert-type", "", "Only remove certs of given type (ssh, https)")
command.Flags().StringVar(&certSubType, "cert-sub-type", "", "Only remove certs of given sub-type (only for ssh)")
return command
}
// NewCertListCommand returns a new instance of an `argocd cert rm` command
func NewCertListCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
certType string
hostNamePattern string
sortOrder string
output string
)
var command = &cobra.Command{
Use: "list",
Short: "List configured certificates",
Run: func(c *cobra.Command, args []string) {
if certType != "" {
switch certType {
case "ssh":
case "https":
default:
fmt.Println("cert-type must be either ssh or https")
os.Exit(1)
}
}
conn, certIf := argocdclient.NewClientOrDie(clientOpts).NewCertClientOrDie()
defer io.Close(conn)
certificates, err := certIf.ListCertificates(context.Background(), &certificatepkg.RepositoryCertificateQuery{HostNamePattern: hostNamePattern, CertType: certType})
errors.CheckError(err)
switch output {
case "yaml", "json":
err := PrintResourceList(certificates.Items, output, false)
errors.CheckError(err)
case "wide", "":
printCertTable(certificates.Items, sortOrder)
default:
errors.CheckError(fmt.Errorf("unknown output format: %s", output))
}
},
}
command.Flags().StringVarP(&output, "output", "o", "wide", "Output format. One of: json|yaml|wide")
command.Flags().StringVar(&sortOrder, "sort", "", "set display sort order for output format wide. One of: hostname|type")
command.Flags().StringVar(&certType, "cert-type", "", "only list certificates of given type, valid: 'ssh','https'")
command.Flags().StringVar(&hostNamePattern, "hostname-pattern", "", "only list certificates for hosts matching given glob-pattern")
return command
}
// Print table of certificate info
func printCertTable(certs []appsv1.RepositoryCertificate, sortOrder string) {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
fmt.Fprintf(w, "HOSTNAME\tTYPE\tSUBTYPE\tINFO\n")
if sortOrder == "hostname" || sortOrder == "" {
sort.Slice(certs, func(i, j int) bool {
return certs[i].ServerName < certs[j].ServerName
})
} else if sortOrder == "type" {
sort.Slice(certs, func(i, j int) bool {
return certs[i].CertType < certs[j].CertType
})
}
for _, c := range certs {
fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", c.ServerName, c.CertType, c.CertSubType, c.CertInfo)
}
_ = w.Flush()
}

View File

@@ -3,24 +3,23 @@ package commands
import (
"context"
"fmt"
"io/ioutil"
"os"
"sort"
"strings"
"text/tabwriter"
"github.com/argoproj/argo-cd/common"
"github.com/argoproj/argo-cd/errors"
argocdclient "github.com/argoproj/argo-cd/pkg/apiclient"
argoappv1 "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/server/cluster"
"github.com/argoproj/argo-cd/util"
"github.com/ghodss/yaml"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
cmdutil "github.com/argoproj/argo-cd/cmd/util"
"github.com/argoproj/argo-cd/common"
argocdclient "github.com/argoproj/argo-cd/pkg/apiclient"
clusterpkg "github.com/argoproj/argo-cd/pkg/apiclient/cluster"
argoappv1 "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/util/clusterauth"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/io"
)
// NewClusterCommand returns a new instance of an `argocd cluster` command
@@ -32,38 +31,49 @@ func NewClusterCommand(clientOpts *argocdclient.ClientOptions, pathOpts *clientc
c.HelpFunc()(c, args)
os.Exit(1)
},
Example: ` # List all known clusters in JSON format:
argocd cluster list -o json
# Add a target cluster configuration to ArgoCD. The context must exist in your kubectl config:
argocd cluster add example-cluster
# Get specific details about a cluster in plain text (wide) format:
argocd cluster get example-cluster -o wide
# Remove a target cluster context from ArgoCD
argocd cluster rm example-cluster
`,
}
command.AddCommand(NewClusterAddCommand(clientOpts, pathOpts))
command.AddCommand(NewClusterGetCommand(clientOpts))
command.AddCommand(NewClusterListCommand(clientOpts))
command.AddCommand(NewClusterRemoveCommand(clientOpts))
command.AddCommand(NewClusterRotateAuthCommand(clientOpts))
return command
}
// NewClusterAddCommand returns a new instance of an `argocd cluster add` command
func NewClusterAddCommand(clientOpts *argocdclient.ClientOptions, pathOpts *clientcmd.PathOptions) *cobra.Command {
var (
inCluster bool
upsert bool
awsRoleArn string
awsClusterName string
clusterOpts cmdutil.ClusterOptions
)
var command = &cobra.Command{
Use: "add",
Use: "add CONTEXT",
Short: fmt.Sprintf("%s cluster add CONTEXT", cliName),
Run: func(c *cobra.Command, args []string) {
var configAccess clientcmd.ConfigAccess = pathOpts
if len(args) == 0 {
log.Error("Choose a context name from:")
printKubeContexts(configAccess)
cmdutil.PrintKubeContexts(configAccess)
os.Exit(1)
}
config, err := configAccess.GetStartingConfig()
errors.CheckError(err)
clstContext := config.Contexts[args[0]]
contextName := args[0]
clstContext := config.Contexts[contextName]
if clstContext == nil {
log.Fatalf("Context %s does not exist in kubeconfig", args[0])
log.Fatalf("Context %s does not exist in kubeconfig", contextName)
}
overrides := clientcmd.ConfigOverrides{
@@ -75,183 +85,232 @@ func NewClusterAddCommand(clientOpts *argocdclient.ClientOptions, pathOpts *clie
managerBearerToken := ""
var awsAuthConf *argoappv1.AWSAuthConfig
if awsClusterName != "" {
var execProviderConf *argoappv1.ExecProviderConfig
if clusterOpts.AwsClusterName != "" {
awsAuthConf = &argoappv1.AWSAuthConfig{
ClusterName: awsClusterName,
RoleARN: awsRoleArn,
ClusterName: clusterOpts.AwsClusterName,
RoleARN: clusterOpts.AwsRoleArn,
}
} else if clusterOpts.ExecProviderCommand != "" {
execProviderConf = &argoappv1.ExecProviderConfig{
Command: clusterOpts.ExecProviderCommand,
Args: clusterOpts.ExecProviderArgs,
Env: clusterOpts.ExecProviderEnv,
APIVersion: clusterOpts.ExecProviderAPIVersion,
InstallHint: clusterOpts.ExecProviderInstallHint,
}
} else {
// Install RBAC resources for managing the cluster
clientset, err := kubernetes.NewForConfig(conf)
errors.CheckError(err)
managerBearerToken, err = common.InstallClusterManagerRBAC(clientset)
if clusterOpts.ServiceAccount != "" {
managerBearerToken, err = clusterauth.GetServiceAccountBearerToken(clientset, clusterOpts.SystemNamespace, clusterOpts.ServiceAccount)
} else {
managerBearerToken, err = clusterauth.InstallClusterManagerRBAC(clientset, clusterOpts.SystemNamespace, clusterOpts.Namespaces)
}
errors.CheckError(err)
}
conn, clusterIf := argocdclient.NewClientOrDie(clientOpts).NewClusterClientOrDie()
defer util.Close(conn)
clst := NewCluster(args[0], conf, managerBearerToken, awsAuthConf)
if inCluster {
defer io.Close(conn)
if clusterOpts.Name != "" {
contextName = clusterOpts.Name
}
clst := cmdutil.NewCluster(contextName, clusterOpts.Namespaces, conf, managerBearerToken, awsAuthConf, execProviderConf)
if clusterOpts.InCluster {
clst.Server = common.KubernetesInternalAPIServerAddr
}
clstCreateReq := cluster.ClusterCreateRequest{
Cluster: clst,
Upsert: upsert,
if clusterOpts.Shard >= 0 {
clst.Shard = &clusterOpts.Shard
}
clst, err = clusterIf.Create(context.Background(), &clstCreateReq)
clstCreateReq := clusterpkg.ClusterCreateRequest{
Cluster: clst,
Upsert: clusterOpts.Upsert,
}
_, err = clusterIf.Create(context.Background(), &clstCreateReq)
errors.CheckError(err)
fmt.Printf("Cluster '%s' added\n", clst.Name)
fmt.Printf("Cluster '%s' added\n", clst.Server)
},
}
command.PersistentFlags().StringVar(&pathOpts.LoadingRules.ExplicitPath, pathOpts.ExplicitFileFlag, pathOpts.LoadingRules.ExplicitPath, "use a particular kubeconfig file")
command.Flags().BoolVar(&inCluster, "in-cluster", false, "Indicates ArgoCD resides inside this cluster and should connect using the internal k8s hostname (kubernetes.default.svc)")
command.Flags().BoolVar(&upsert, "upsert", false, "Override an existing cluster with the same name even if the spec differs")
command.Flags().StringVar(&awsClusterName, "aws-cluster-name", "", "AWS Cluster name if set then aws-iam-authenticator will be used to access cluster")
command.Flags().StringVar(&awsRoleArn, "aws-role-arn", "", "Optional AWS role arn. If set then AWS IAM Authenticator assume a role to perform cluster operations instead of the default AWS credential provider chain.")
command.Flags().BoolVar(&clusterOpts.Upsert, "upsert", false, "Override an existing cluster with the same name even if the spec differs")
command.Flags().StringVar(&clusterOpts.ServiceAccount, "service-account", "", fmt.Sprintf("System namespace service account to use for kubernetes resource management. If not set then default \"%s\" SA will be created", clusterauth.ArgoCDManagerServiceAccount))
command.Flags().StringVar(&clusterOpts.SystemNamespace, "system-namespace", common.DefaultSystemNamespace, "Use different system namespace")
cmdutil.AddClusterFlags(command, &clusterOpts)
return command
}
func printKubeContexts(ca clientcmd.ConfigAccess) {
config, err := ca.GetStartingConfig()
errors.CheckError(err)
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
defer func() { _ = w.Flush() }()
columnNames := []string{"CURRENT", "NAME", "CLUSTER", "SERVER"}
_, err = fmt.Fprintf(w, "%s\n", strings.Join(columnNames, "\t"))
errors.CheckError(err)
// sort names so output is deterministic
contextNames := make([]string, 0)
for name := range config.Contexts {
contextNames = append(contextNames, name)
}
sort.Strings(contextNames)
if config.Clusters == nil {
return
}
for _, name := range contextNames {
// ignore malformed kube config entries
context := config.Contexts[name]
if context == nil {
continue
}
cluster := config.Clusters[context.Cluster]
if cluster == nil {
continue
}
prefix := " "
if config.CurrentContext == name {
prefix = "*"
}
_, err := fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", prefix, name, context.Cluster, cluster.Server)
errors.CheckError(err)
}
}
func NewCluster(name string, conf *rest.Config, managerBearerToken string, awsAuthConf *argoappv1.AWSAuthConfig) *argoappv1.Cluster {
tlsClientConfig := argoappv1.TLSClientConfig{
Insecure: conf.TLSClientConfig.Insecure,
ServerName: conf.TLSClientConfig.ServerName,
CertData: conf.TLSClientConfig.CertData,
KeyData: conf.TLSClientConfig.KeyData,
CAData: conf.TLSClientConfig.CAData,
}
if len(conf.TLSClientConfig.CertData) == 0 && conf.TLSClientConfig.CertFile != "" {
data, err := ioutil.ReadFile(conf.TLSClientConfig.CertFile)
errors.CheckError(err)
tlsClientConfig.CertData = data
}
if len(conf.TLSClientConfig.KeyData) == 0 && conf.TLSClientConfig.KeyFile != "" {
data, err := ioutil.ReadFile(conf.TLSClientConfig.KeyFile)
errors.CheckError(err)
tlsClientConfig.KeyData = data
}
if len(conf.TLSClientConfig.CAData) == 0 && conf.TLSClientConfig.CAFile != "" {
data, err := ioutil.ReadFile(conf.TLSClientConfig.CAFile)
errors.CheckError(err)
tlsClientConfig.CAData = data
}
clst := argoappv1.Cluster{
Server: conf.Host,
Name: name,
Config: argoappv1.ClusterConfig{
BearerToken: managerBearerToken,
TLSClientConfig: tlsClientConfig,
AWSAuthConfig: awsAuthConf,
},
}
return &clst
}
// NewClusterGetCommand returns a new instance of an `argocd cluster get` command
func NewClusterGetCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
output string
)
var command = &cobra.Command{
Use: "get",
Short: "Get cluster information",
Use: "get SERVER",
Short: "Get cluster information",
Example: `argocd cluster get https://12.34.567.89`,
Run: func(c *cobra.Command, args []string) {
if len(args) == 0 {
c.HelpFunc()(c, args)
os.Exit(1)
}
conn, clusterIf := argocdclient.NewClientOrDie(clientOpts).NewClusterClientOrDie()
defer util.Close(conn)
defer io.Close(conn)
clusters := make([]argoappv1.Cluster, 0)
for _, clusterName := range args {
clst, err := clusterIf.Get(context.Background(), &cluster.ClusterQuery{Server: clusterName})
clst, err := clusterIf.Get(context.Background(), &clusterpkg.ClusterQuery{Server: clusterName})
errors.CheckError(err)
yamlBytes, err := yaml.Marshal(clst)
clusters = append(clusters, *clst)
}
switch output {
case "yaml", "json":
err := PrintResourceList(clusters, output, true)
errors.CheckError(err)
fmt.Printf("%v", string(yamlBytes))
case "wide", "":
printClusterDetails(clusters)
case "server":
printClusterServers(clusters)
default:
errors.CheckError(fmt.Errorf("unknown output format: %s", output))
}
},
}
// we have yaml as default to not break backwards-compatibility
command.Flags().StringVarP(&output, "output", "o", "yaml", "Output format. One of: json|yaml|wide|server")
return command
}
func strWithDefault(value string, def string) string {
if value == "" {
return def
}
return value
}
func formatNamespaces(cluster argoappv1.Cluster) string {
if len(cluster.Namespaces) == 0 {
return "all namespaces"
}
return strings.Join(cluster.Namespaces, ", ")
}
func printClusterDetails(clusters []argoappv1.Cluster) {
for _, cluster := range clusters {
fmt.Printf("Cluster information\n\n")
fmt.Printf(" Server URL: %s\n", cluster.Server)
fmt.Printf(" Server Name: %s\n", strWithDefault(cluster.Name, "-"))
fmt.Printf(" Server Version: %s\n", cluster.ServerVersion)
fmt.Printf(" Namespaces: %s\n", formatNamespaces(cluster))
fmt.Printf("\nTLS configuration\n\n")
fmt.Printf(" Client cert: %v\n", string(cluster.Config.TLSClientConfig.CertData) != "")
fmt.Printf(" Cert validation: %v\n", !cluster.Config.TLSClientConfig.Insecure)
fmt.Printf("\nAuthentication\n\n")
fmt.Printf(" Basic authentication: %v\n", cluster.Config.Username != "")
fmt.Printf(" oAuth authentication: %v\n", cluster.Config.BearerToken != "")
fmt.Printf(" AWS authentication: %v\n", cluster.Config.AWSAuthConfig != nil)
fmt.Println()
}
}
// NewClusterRemoveCommand returns a new instance of an `argocd cluster list` command
func NewClusterRemoveCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "rm",
Short: "Remove cluster credentials",
Use: "rm SERVER",
Short: "Remove cluster credentials",
Example: `argocd cluster rm https://12.34.567.89`,
Run: func(c *cobra.Command, args []string) {
if len(args) == 0 {
c.HelpFunc()(c, args)
os.Exit(1)
}
conn, clusterIf := argocdclient.NewClientOrDie(clientOpts).NewClusterClientOrDie()
defer util.Close(conn)
defer io.Close(conn)
// clientset, err := kubernetes.NewForConfig(conf)
// errors.CheckError(err)
for _, clusterName := range args {
// TODO(jessesuen): find the right context and remove manager RBAC artifacts
// err := common.UninstallClusterManagerRBAC(clientset)
// err := clusterauth.UninstallClusterManagerRBAC(clientset)
// errors.CheckError(err)
_, err := clusterIf.Delete(context.Background(), &cluster.ClusterQuery{Server: clusterName})
_, err := clusterIf.Delete(context.Background(), &clusterpkg.ClusterQuery{Server: clusterName})
errors.CheckError(err)
fmt.Printf("Cluster '%s' removed\n", clusterName)
}
},
}
return command
}
// Print table of cluster information
func printClusterTable(clusters []argoappv1.Cluster) {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
_, _ = fmt.Fprintf(w, "SERVER\tNAME\tVERSION\tSTATUS\tMESSAGE\n")
for _, c := range clusters {
server := c.Server
if len(c.Namespaces) > 0 {
server = fmt.Sprintf("%s (%d namespaces)", c.Server, len(c.Namespaces))
}
_, _ = fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\n", server, c.Name, c.ServerVersion, c.ConnectionState.Status, c.ConnectionState.Message)
}
_ = w.Flush()
}
// Print list of cluster servers
func printClusterServers(clusters []argoappv1.Cluster) {
for _, c := range clusters {
fmt.Println(c.Server)
}
}
// NewClusterListCommand returns a new instance of an `argocd cluster rm` command
func NewClusterListCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
output string
)
var command = &cobra.Command{
Use: "list",
Short: "List configured clusters",
Run: func(c *cobra.Command, args []string) {
conn, clusterIf := argocdclient.NewClientOrDie(clientOpts).NewClusterClientOrDie()
defer util.Close(conn)
clusters, err := clusterIf.List(context.Background(), &cluster.ClusterQuery{})
defer io.Close(conn)
clusters, err := clusterIf.List(context.Background(), &clusterpkg.ClusterQuery{})
errors.CheckError(err)
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
fmt.Fprintf(w, "SERVER\tNAME\tSTATUS\tMESSAGE\n")
for _, c := range clusters.Items {
fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", c.Server, c.Name, c.ConnectionState.Status, c.ConnectionState.Message)
switch output {
case "yaml", "json":
err := PrintResourceList(clusters.Items, output, false)
errors.CheckError(err)
case "server":
printClusterServers(clusters.Items)
case "wide", "":
printClusterTable(clusters.Items)
default:
errors.CheckError(fmt.Errorf("unknown output format: %s", output))
}
_ = w.Flush()
},
}
command.Flags().StringVarP(&output, "output", "o", "wide", "Output format. One of: json|yaml|wide|server")
return command
}
// NewClusterRotateAuthCommand returns a new instance of an `argocd cluster rotate-auth` command
func NewClusterRotateAuthCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "rotate-auth SERVER",
Short: fmt.Sprintf("%s cluster rotate-auth SERVER", cliName),
Example: fmt.Sprintf("%s cluster rotate-auth https://12.34.567.89", cliName),
Run: func(c *cobra.Command, args []string) {
if len(args) != 1 {
c.HelpFunc()(c, args)
os.Exit(1)
}
conn, clusterIf := argocdclient.NewClientOrDie(clientOpts).NewClusterClientOrDie()
defer io.Close(conn)
clusterQuery := clusterpkg.ClusterQuery{
Server: args[0],
}
_, err := clusterIf.RotateAuth(context.Background(), &clusterQuery)
errors.CheckError(err)
fmt.Printf("Cluster '%s' rotated auth\n", clusterQuery.Server)
},
}
return command

View File

@@ -0,0 +1,31 @@
package commands
import (
"testing"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
)
func Test_printClusterTable(t *testing.T) {
printClusterTable([]v1alpha1.Cluster{
{
Server: "my-server",
Name: "my-name",
Config: v1alpha1.ClusterConfig{
Username: "my-username",
Password: "my-password",
BearerToken: "my-bearer-token",
TLSClientConfig: v1alpha1.TLSClientConfig{},
AWSAuthConfig: nil,
},
ConnectionState: v1alpha1.ConnectionState{
Status: "my-status",
Message: "my-message",
ModifiedAt: &metav1.Time{},
},
ServerVersion: "my-version",
},
})
}

View File

@@ -1,5 +1,72 @@
package commands
import (
"encoding/json"
"fmt"
"reflect"
"github.com/ghodss/yaml"
)
const (
cliName = "argocd"
// DefaultSSOLocalPort is the localhost port to listen on for the temporary web server performing
// the OAuth2 login flow.
DefaultSSOLocalPort = 8085
)
// PrintResource prints a single resource in YAML or JSON format to stdout according to the output format
func PrintResource(resource interface{}, output string) error {
switch output {
case "json":
jsonBytes, err := json.MarshalIndent(resource, "", " ")
if err != nil {
return err
}
fmt.Println(string(jsonBytes))
case "yaml":
yamlBytes, err := yaml.Marshal(resource)
if err != nil {
return err
}
fmt.Print(string(yamlBytes))
default:
return fmt.Errorf("unknown output format: %s", output)
}
return nil
}
// PrintResourceList marshals & prints a list of resources to stdout according to the output format
func PrintResourceList(resources interface{}, output string, single bool) error {
kt := reflect.ValueOf(resources)
// Sometimes, we want to marshal the first resource of a slice or array as single item
if kt.Kind() == reflect.Slice || kt.Kind() == reflect.Array {
if single && kt.Len() == 1 {
return PrintResource(kt.Index(0).Interface(), output)
}
// If we have a zero len list, prevent printing "null"
if kt.Len() == 0 {
return PrintResource([]string{}, output)
}
}
switch output {
case "json":
jsonBytes, err := json.MarshalIndent(resources, "", " ")
if err != nil {
return err
}
fmt.Println(string(jsonBytes))
case "yaml":
yamlBytes, err := yaml.Marshal(resources)
if err != nil {
return err
}
fmt.Print(string(yamlBytes))
default:
return fmt.Errorf("unknown output format: %s", output)
}
return nil
}

View File

@@ -0,0 +1,142 @@
package commands
import (
"io/ioutil"
"os"
"testing"
"github.com/stretchr/testify/assert"
)
// Be careful with tabs vs. spaces in the following expected formats. Indents
// should all be spaces, no tabs.
const expectYamlSingle = `bar: ""
baz: foo
foo: bar
`
const expectJsonSingle = `{
"bar": "",
"baz": "foo",
"foo": "bar"
}
`
const expectYamlList = `one:
bar: ""
baz: foo
foo: bar
two:
bar: ""
baz: foo
foo: bar
`
const expectJsonList = `{
"one": {
"bar": "",
"baz": "foo",
"foo": "bar"
},
"two": {
"bar": "",
"baz": "foo",
"foo": "bar"
}
}
`
// Rather dirty hack to capture stdout from PrintResource() and PrintResourceList()
func captureOutput(f func() error) (string, error) {
stdout := os.Stdout
r, w, err := os.Pipe()
if err != nil {
return "", err
}
os.Stdout = w
err = f()
w.Close()
if err != nil {
os.Stdout = stdout
return "", err
}
str, err := ioutil.ReadAll(r)
os.Stdout = stdout
if err != nil {
return "", err
}
return string(str), err
}
func Test_PrintResource(t *testing.T) {
testResource := map[string]string{
"foo": "bar",
"bar": "",
"baz": "foo",
}
str, err := captureOutput(func() error {
err := PrintResource(testResource, "yaml")
return err
})
assert.NoError(t, err)
assert.Equal(t, str, expectYamlSingle)
str, err = captureOutput(func() error {
err := PrintResource(testResource, "json")
return err
})
assert.NoError(t, err)
assert.Equal(t, str, expectJsonSingle)
err = PrintResource(testResource, "unknown")
assert.Error(t, err)
}
func Test_PrintResourceList(t *testing.T) {
testResource := map[string]map[string]string{
"one": {
"foo": "bar",
"bar": "",
"baz": "foo",
},
"two": {
"foo": "bar",
"bar": "",
"baz": "foo",
},
}
testResource2 := make([]map[string]string, 0)
testResource2 = append(testResource2, testResource["one"])
str, err := captureOutput(func() error {
err := PrintResourceList(testResource, "yaml", false)
return err
})
assert.NoError(t, err)
assert.Equal(t, str, expectYamlList)
str, err = captureOutput(func() error {
err := PrintResourceList(testResource, "json", false)
return err
})
assert.NoError(t, err)
assert.Equal(t, str, expectJsonList)
str, err = captureOutput(func() error {
err := PrintResourceList(testResource2, "yaml", true)
return err
})
assert.NoError(t, err)
assert.Equal(t, str, expectYamlSingle)
str, err = captureOutput(func() error {
err := PrintResourceList(testResource2, "json", true)
return err
})
assert.NoError(t, err)
assert.Equal(t, str, expectJsonSingle)
err = PrintResourceList(testResource, "unknown", false)
assert.Error(t, err)
}

View File

@@ -0,0 +1,233 @@
package commands
import (
"fmt"
"io"
"os"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
const (
bashCompletionFunc = `
__argocd_list_apps() {
local -a argocd_out
if argocd_out=($(argocd app list --output name 2>/dev/null)); then
COMPREPLY+=( $( compgen -W "${argocd_out[*]}" -- "$cur" ) )
fi
}
__argocd_list_app_history() {
local app=$1
local -a argocd_out
if argocd_out=($(argocd app history $app --output id 2>/dev/null)); then
COMPREPLY+=( $( compgen -W "${argocd_out[*]}" -- "$cur" ) )
fi
}
__argocd_app_rollback() {
local -a command
for comp_word in "${COMP_WORDS[@]}"; do
if [[ $comp_word =~ ^-.*$ ]]; then
continue
fi
command+=($comp_word)
done
# fourth arg is app (if present): e.g.- argocd app rollback guestbook
local app=${command[3]}
local id=${command[4]}
if [[ -z $app || $app == $cur ]]; then
__argocd_list_apps
elif [[ -z $id || $id == $cur ]]; then
__argocd_list_app_history $app
fi
}
__argocd_list_servers() {
local -a argocd_out
if argocd_out=($(argocd cluster list --output server 2>/dev/null)); then
COMPREPLY+=( $( compgen -W "${argocd_out[*]}" -- "$cur" ) )
fi
}
__argocd_list_repos() {
local -a argocd_out
if argocd_out=($(argocd repo list --output url 2>/dev/null)); then
COMPREPLY+=( $( compgen -W "${argocd_out[*]}" -- "$cur" ) )
fi
}
__argocd_list_projects() {
local -a argocd_out
if argocd_out=($(argocd proj list --output name 2>/dev/null)); then
COMPREPLY+=( $( compgen -W "${argocd_out[*]}" -- "$cur" ) )
fi
}
__argocd_list_namespaces() {
local -a argocd_out
if argocd_out=($(kubectl get namespaces --no-headers 2>/dev/null | cut -f1 -d' ' 2>/dev/null)); then
COMPREPLY+=( $( compgen -W "${argocd_out[*]}" -- "$cur" ) )
fi
}
__argocd_proj_server_namespace() {
local -a command
for comp_word in "${COMP_WORDS[@]}"; do
if [[ $comp_word =~ ^-.*$ ]]; then
continue
fi
command+=($comp_word)
done
# expect something like this: argocd proj add-destination PROJECT SERVER NAMESPACE
local project=${command[3]}
local server=${command[4]}
local namespace=${command[5]}
if [[ -z $project || $project == $cur ]]; then
__argocd_list_projects
elif [[ -z $server || $server == $cur ]]; then
__argocd_list_servers
elif [[ -z $namespace || $namespace == $cur ]]; then
__argocd_list_namespaces
fi
}
__argocd_list_project_role() {
local project="$1"
local -a argocd_out
if argocd_out=($(argocd proj role list "$project" --output=name 2>/dev/null)); then
COMPREPLY+=( $( compgen -W "${argocd_out[*]}" -- "$cur" ) )
fi
}
__argocd_proj_role(){
local -a command
for comp_word in "${COMP_WORDS[@]}"; do
if [[ $comp_word =~ ^-.*$ ]]; then
continue
fi
command+=($comp_word)
done
# expect something like this: argocd proj role add-policy PROJECT ROLE-NAME
local project=${command[4]}
local role=${command[5]}
if [[ -z $project || $project == $cur ]]; then
__argocd_list_projects
elif [[ -z $role || $role == $cur ]]; then
__argocd_list_project_role $project
fi
}
__argocd_custom_func() {
case ${last_command} in
argocd_app_delete | \
argocd_app_diff | \
argocd_app_edit | \
argocd_app_get | \
argocd_app_history | \
argocd_app_manifests | \
argocd_app_patch-resource | \
argocd_app_set | \
argocd_app_sync | \
argocd_app_terminate-op | \
argocd_app_unset | \
argocd_app_wait | \
argocd_app_create)
__argocd_list_apps
return
;;
argocd_app_rollback)
__argocd_app_rollback
return
;;
argocd_cluster_get | \
argocd_cluster_rm | \
argocd_login | \
argocd_cluster_add)
__argocd_list_servers
return
;;
argocd_repo_rm | \
argocd_repo_add)
__argocd_list_repos
return
;;
argocd_proj_add-destination | \
argocd_proj_remove-destination)
__argocd_proj_server_namespace
return
;;
argocd_proj_add-source | \
argocd_proj_remove-source | \
argocd_proj_allow-cluster-resource | \
argocd_proj_allow-namespace-resource | \
argocd_proj_deny-cluster-resource | \
argocd_proj_deny-namespace-resource | \
argocd_proj_delete | \
argocd_proj_edit | \
argocd_proj_get | \
argocd_proj_set | \
argocd_proj_role_list)
__argocd_list_projects
return
;;
argocd_proj_role_remove-policy | \
argocd_proj_role_add-policy | \
argocd_proj_role_create | \
argocd_proj_role_delete | \
argocd_proj_role_get | \
argocd_proj_role_create-token | \
argocd_proj_role_delete-token)
__argocd_proj_role
return
;;
*)
;;
esac
}
`
)
func NewCompletionCommand() *cobra.Command {
var command = &cobra.Command{
Use: "completion SHELL",
Short: "output shell completion code for the specified shell (bash or zsh)",
Long: `Write bash or zsh shell completion code to standard output.
For bash, ensure you have bash completions installed and enabled.
To access completions in your current shell, run
$ source <(argocd completion bash)
Alternatively, write it to a file and source in .bash_profile
For zsh, output to a file in a directory referenced by the $fpath shell
variable.
`,
Run: func(cmd *cobra.Command, args []string) {
if len(args) != 1 {
cmd.HelpFunc()(cmd, args)
os.Exit(1)
}
shell := args[0]
rootCommand := NewCommand()
rootCommand.BashCompletionFunction = bashCompletionFunc
availableCompletions := map[string]func(io.Writer) error{
"bash": rootCommand.GenBashCompletion,
"zsh": rootCommand.GenZshCompletion,
}
completion, ok := availableCompletions[shell]
if !ok {
fmt.Printf("Invalid shell '%s'. The supported shells are bash and zsh.\n", shell)
os.Exit(1)
}
if err := completion(os.Stdout); err != nil {
log.Fatal(err)
}
},
}
return command
}

View File

@@ -8,25 +8,43 @@ import (
"strings"
"text/tabwriter"
"github.com/argoproj/argo-cd/errors"
argocdclient "github.com/argoproj/argo-cd/pkg/apiclient"
"github.com/argoproj/argo-cd/util/localconfig"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
argocdclient "github.com/argoproj/argo-cd/pkg/apiclient"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/localconfig"
)
// NewContextCommand returns a new instance of an `argocd ctx` command
func NewContextCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var delete bool
var command = &cobra.Command{
Use: "context",
Use: "context [CONTEXT]",
Aliases: []string{"ctx"},
Short: "Switch between contexts",
Run: func(c *cobra.Command, args []string) {
localCfg, err := localconfig.ReadLocalConfig(clientOpts.ConfigPath)
errors.CheckError(err)
if delete {
if len(args) == 0 {
c.HelpFunc()(c, args)
os.Exit(1)
}
err := deleteContext(args[0], clientOpts.ConfigPath)
errors.CheckError(err)
return
}
if len(args) == 0 {
printArgoCDContexts(clientOpts.ConfigPath)
return
}
ctxName := args[0]
argoCDDir, err := localconfig.DefaultConfigDir()
errors.CheckError(err)
prevCtxFile := path.Join(argoCDDir, ".prev-ctx")
@@ -36,8 +54,6 @@ func NewContextCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
errors.CheckError(err)
ctxName = string(prevCtxBytes)
}
localCfg, err := localconfig.ReadLocalConfig(clientOpts.ConfigPath)
errors.CheckError(err)
if localCfg.CurrentContext == ctxName {
fmt.Printf("Already at context '%s'\n", localCfg.CurrentContext)
return
@@ -47,6 +63,7 @@ func NewContextCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
}
prevCtx := localCfg.CurrentContext
localCfg.CurrentContext = ctxName
err = localconfig.WriteLocalConfig(*localCfg, clientOpts.ConfigPath)
errors.CheckError(err)
err = ioutil.WriteFile(prevCtxFile, []byte(prevCtx), 0644)
@@ -54,9 +71,43 @@ func NewContextCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
fmt.Printf("Switched to context '%s'\n", localCfg.CurrentContext)
},
}
command.Flags().BoolVar(&delete, "delete", false, "Delete the context instead of switching to it")
return command
}
func deleteContext(context, configPath string) error {
localCfg, err := localconfig.ReadLocalConfig(configPath)
errors.CheckError(err)
if localCfg == nil {
return fmt.Errorf("Nothing to logout from")
}
serverName, ok := localCfg.RemoveContext(context)
if !ok {
return fmt.Errorf("Context %s does not exist", context)
}
_ = localCfg.RemoveUser(context)
_ = localCfg.RemoveServer(serverName)
if localCfg.IsEmpty() {
err = localconfig.DeleteLocalConfig(configPath)
errors.CheckError(err)
} else {
if localCfg.CurrentContext == context {
localCfg.CurrentContext = ""
}
err = localconfig.ValidateLocalConfig(*localCfg)
if err != nil {
return fmt.Errorf("Error in logging out")
}
err = localconfig.WriteLocalConfig(*localCfg, configPath)
errors.CheckError(err)
}
fmt.Printf("Context '%s' deleted\n", context)
return nil
}
func printArgoCDContexts(configPath string) {
localCfg, err := localconfig.ReadLocalConfig(configPath)
errors.CheckError(err)

View File

@@ -0,0 +1,81 @@
package commands
import (
"io/ioutil"
"os"
"testing"
"github.com/stretchr/testify/assert"
"github.com/argoproj/argo-cd/util/localconfig"
)
const testConfig = `contexts:
- name: argocd1.example.com:443
server: argocd1.example.com:443
user: argocd1.example.com:443
- name: argocd2.example.com:443
server: argocd2.example.com:443
user: argocd2.example.com:443
- name: localhost:8080
server: localhost:8080
user: localhost:8080
current-context: localhost:8080
servers:
- server: argocd1.example.com:443
- server: argocd2.example.com:443
- plain-text: true
server: localhost:8080
users:
- auth-token: vErrYS3c3tReFRe$hToken
name: argocd1.example.com:443
refresh-token: vErrYS3c3tReFRe$hToken
- auth-token: vErrYS3c3tReFRe$hToken
name: argocd2.example.com:443
refresh-token: vErrYS3c3tReFRe$hToken
- auth-token: vErrYS3c3tReFRe$hToken
name: localhost:8080`
const testConfigFilePath = "./testdata/config"
func TestContextDelete(t *testing.T) {
// Write the test config file
err := ioutil.WriteFile(testConfigFilePath, []byte(testConfig), os.ModePerm)
assert.NoError(t, err)
localConfig, err := localconfig.ReadLocalConfig(testConfigFilePath)
assert.NoError(t, err)
assert.Equal(t, localConfig.CurrentContext, "localhost:8080")
assert.Contains(t, localConfig.Contexts, localconfig.ContextRef{Name: "localhost:8080", Server: "localhost:8080", User: "localhost:8080"})
// Delete a non-current context
err = deleteContext("argocd1.example.com:443", testConfigFilePath)
assert.NoError(t, err)
localConfig, err = localconfig.ReadLocalConfig(testConfigFilePath)
assert.NoError(t, err)
assert.Equal(t, localConfig.CurrentContext, "localhost:8080")
assert.NotContains(t, localConfig.Contexts, localconfig.ContextRef{Name: "argocd1.example.com:443", Server: "argocd1.example.com:443", User: "argocd1.example.com:443"})
assert.NotContains(t, localConfig.Servers, localconfig.Server{Server: "argocd1.example.com:443"})
assert.NotContains(t, localConfig.Users, localconfig.User{AuthToken: "vErrYS3c3tReFRe$hToken", Name: "argocd1.example.com:443"})
assert.Contains(t, localConfig.Contexts, localconfig.ContextRef{Name: "argocd2.example.com:443", Server: "argocd2.example.com:443", User: "argocd2.example.com:443"})
assert.Contains(t, localConfig.Contexts, localconfig.ContextRef{Name: "localhost:8080", Server: "localhost:8080", User: "localhost:8080"})
// Delete the current context
err = deleteContext("localhost:8080", testConfigFilePath)
assert.NoError(t, err)
localConfig, err = localconfig.ReadLocalConfig(testConfigFilePath)
assert.NoError(t, err)
assert.Equal(t, localConfig.CurrentContext, "")
assert.NotContains(t, localConfig.Contexts, localconfig.ContextRef{Name: "localhost:8080", Server: "localhost:8080", User: "localhost:8080"})
assert.NotContains(t, localConfig.Servers, localconfig.Server{PlainText: true, Server: "localhost:8080"})
assert.NotContains(t, localConfig.Users, localconfig.User{AuthToken: "vErrYS3c3tReFRe$hToken", Name: "localhost:8080"})
assert.Contains(t, localConfig.Contexts, localconfig.ContextRef{Name: "argocd2.example.com:443", Server: "argocd2.example.com:443", User: "argocd2.example.com:443"})
// Write the file again so that no conflicts are made in git
err = ioutil.WriteFile(testConfigFilePath, []byte(testConfig), os.ModePerm)
assert.NoError(t, err)
}

162
cmd/argocd/commands/gpg.go Normal file
View File

@@ -0,0 +1,162 @@
package commands
import (
"context"
"fmt"
"io/ioutil"
"os"
"strings"
"text/tabwriter"
"github.com/spf13/cobra"
argocdclient "github.com/argoproj/argo-cd/pkg/apiclient"
gpgkeypkg "github.com/argoproj/argo-cd/pkg/apiclient/gpgkey"
appsv1 "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/util/errors"
argoio "github.com/argoproj/argo-cd/util/io"
)
// NewGPGCommand returns a new instance of an `argocd repo` command
func NewGPGCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "gpg",
Short: "Manage GPG keys used for signature verification",
Run: func(c *cobra.Command, args []string) {
c.HelpFunc()(c, args)
os.Exit(1)
},
Example: ``,
}
command.AddCommand(NewGPGListCommand(clientOpts))
command.AddCommand(NewGPGGetCommand(clientOpts))
command.AddCommand(NewGPGAddCommand(clientOpts))
command.AddCommand(NewGPGDeleteCommand(clientOpts))
return command
}
// NewGPGListCommand lists all configured public keys from the server
func NewGPGListCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
output string
)
var command = &cobra.Command{
Use: "list",
Short: "List configured GPG public keys",
Run: func(c *cobra.Command, args []string) {
conn, gpgIf := argocdclient.NewClientOrDie(clientOpts).NewGPGKeyClientOrDie()
defer argoio.Close(conn)
keys, err := gpgIf.List(context.Background(), &gpgkeypkg.GnuPGPublicKeyQuery{})
errors.CheckError(err)
switch output {
case "yaml", "json":
err := PrintResourceList(keys.Items, output, false)
errors.CheckError(err)
case "wide", "":
printKeyTable(keys.Items)
default:
errors.CheckError(fmt.Errorf("unknown output format: %s", output))
}
},
}
command.Flags().StringVarP(&output, "output", "o", "wide", "Output format. One of: json|yaml|wide")
return command
}
// NewGPGGetCommand retrieves a single public key from the server
func NewGPGGetCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
output string
)
var command = &cobra.Command{
Use: "get KEYID",
Short: "Get the GPG public key with ID <KEYID> from the server",
Run: func(c *cobra.Command, args []string) {
if len(args) != 1 {
errors.CheckError(fmt.Errorf("Missing KEYID argument"))
}
conn, gpgIf := argocdclient.NewClientOrDie(clientOpts).NewGPGKeyClientOrDie()
defer argoio.Close(conn)
key, err := gpgIf.Get(context.Background(), &gpgkeypkg.GnuPGPublicKeyQuery{KeyID: args[0]})
errors.CheckError(err)
switch output {
case "yaml", "json":
err := PrintResourceList(key, output, false)
errors.CheckError(err)
case "wide", "":
fmt.Printf("Key ID: %s\n", key.KeyID)
fmt.Printf("Key fingerprint: %s\n", key.Fingerprint)
fmt.Printf("Key subtype: %s\n", strings.ToUpper(key.SubType))
fmt.Printf("Key owner: %s\n", key.Owner)
fmt.Printf("Key data follows until EOF:\n%s\n", key.KeyData)
default:
errors.CheckError(fmt.Errorf("unknown output format: %s", output))
}
},
}
command.Flags().StringVarP(&output, "output", "o", "wide", "Output format. One of: json|yaml|wide")
return command
}
// NewGPGAddCommand adds a public key to the server's configuration
func NewGPGAddCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
fromFile string
)
var command = &cobra.Command{
Use: "add",
Short: "Adds a GPG public key to the server's keyring",
Run: func(c *cobra.Command, args []string) {
if fromFile == "" {
errors.CheckError(fmt.Errorf("--from is mandatory"))
}
keyData, err := ioutil.ReadFile(fromFile)
if err != nil {
errors.CheckError(err)
}
conn, gpgIf := argocdclient.NewClientOrDie(clientOpts).NewGPGKeyClientOrDie()
defer argoio.Close(conn)
resp, err := gpgIf.Create(context.Background(), &gpgkeypkg.GnuPGPublicKeyCreateRequest{Publickey: &appsv1.GnuPGPublicKey{KeyData: string(keyData)}})
errors.CheckError(err)
fmt.Printf("Created %d key(s) from input file", len(resp.Created.Items))
if len(resp.Skipped) > 0 {
fmt.Printf(", and %d key(s) were skipped because they exist already", len(resp.Skipped))
}
fmt.Printf(".\n")
},
}
command.Flags().StringVarP(&fromFile, "from", "f", "", "Path to the file that contains the GPG public key to import")
return command
}
// NewGPGDeleteCommand removes a key from the server's keyring
func NewGPGDeleteCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "rm KEYID",
Short: "Removes a GPG public key from the server's keyring",
Run: func(c *cobra.Command, args []string) {
if len(args) != 1 {
errors.CheckError(fmt.Errorf("Missing KEYID argument"))
}
conn, gpgIf := argocdclient.NewClientOrDie(clientOpts).NewGPGKeyClientOrDie()
defer argoio.Close(conn)
_, err := gpgIf.Delete(context.Background(), &gpgkeypkg.GnuPGPublicKeyQuery{KeyID: args[0]})
errors.CheckError(err)
fmt.Printf("Deleted key with key ID %s\n", args[0])
},
}
return command
}
// Print table of certificate info
func printKeyTable(keys []appsv1.GnuPGPublicKey) {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
fmt.Fprintf(w, "KEYID\tTYPE\tIDENTITY\n")
for _, k := range keys {
fmt.Fprintf(w, "%s\t%s\t%s\n", k.KeyID, strings.ToUpper(k.SubType), k.Owner)
}
_ = w.Flush()
}

View File

@@ -2,28 +2,34 @@ package commands
import (
"context"
"crypto/tls"
"crypto/sha256"
"encoding/base64"
"fmt"
"net"
"html"
"net/http"
"os"
"strconv"
"strings"
"time"
"github.com/argoproj/argo-cd/common"
"github.com/argoproj/argo-cd/errors"
argocdclient "github.com/argoproj/argo-cd/pkg/apiclient"
"github.com/argoproj/argo-cd/server/session"
"github.com/argoproj/argo-cd/server/settings"
"github.com/argoproj/argo-cd/util"
"github.com/argoproj/argo-cd/util/cli"
grpc_util "github.com/argoproj/argo-cd/util/grpc"
"github.com/argoproj/argo-cd/util/localconfig"
jwt "github.com/dgrijalva/jwt-go"
"github.com/coreos/go-oidc"
"github.com/dgrijalva/jwt-go/v4"
log "github.com/sirupsen/logrus"
"github.com/skratchdot/open-golang/open"
"github.com/spf13/cobra"
"golang.org/x/oauth2"
argocdclient "github.com/argoproj/argo-cd/pkg/apiclient"
sessionpkg "github.com/argoproj/argo-cd/pkg/apiclient/session"
settingspkg "github.com/argoproj/argo-cd/pkg/apiclient/settings"
"github.com/argoproj/argo-cd/util/cli"
"github.com/argoproj/argo-cd/util/errors"
grpc_util "github.com/argoproj/argo-cd/util/grpc"
"github.com/argoproj/argo-cd/util/io"
jwtutil "github.com/argoproj/argo-cd/util/jwt"
"github.com/argoproj/argo-cd/util/localconfig"
oidcutil "github.com/argoproj/argo-cd/util/oidc"
"github.com/argoproj/argo-cd/util/rand"
)
// NewLoginCommand returns a new instance of `argocd login` command
@@ -33,46 +39,63 @@ func NewLoginCommand(globalClientOpts *argocdclient.ClientOptions) *cobra.Comman
username string
password string
sso bool
ssoPort int
)
var command = &cobra.Command{
Use: "login SERVER",
Short: "Log in to Argo CD",
Long: "Log in to Argo CD",
Run: func(c *cobra.Command, args []string) {
if len(args) == 0 {
var server string
if len(args) != 1 && !globalClientOpts.PortForward {
c.HelpFunc()(c, args)
os.Exit(1)
}
server := args[0]
tlsTestResult, err := grpc_util.TestTLS(server)
errors.CheckError(err)
if !tlsTestResult.TLS {
if !globalClientOpts.PlainText {
if !cli.AskToProceed("WARNING: server is not configured with TLS. Proceed (y/n)? ") {
os.Exit(1)
if globalClientOpts.PortForward {
server = "port-forward"
} else {
server = args[0]
tlsTestResult, err := grpc_util.TestTLS(server)
errors.CheckError(err)
if !tlsTestResult.TLS {
if !globalClientOpts.PlainText {
if !cli.AskToProceed("WARNING: server is not configured with TLS. Proceed (y/n)? ") {
os.Exit(1)
}
globalClientOpts.PlainText = true
}
globalClientOpts.PlainText = true
}
} else if tlsTestResult.InsecureErr != nil {
if !globalClientOpts.Insecure {
if !cli.AskToProceed(fmt.Sprintf("WARNING: server certificate had error: %s. Proceed insecurely (y/n)? ", tlsTestResult.InsecureErr)) {
os.Exit(1)
} else if tlsTestResult.InsecureErr != nil {
if !globalClientOpts.Insecure {
if !cli.AskToProceed(fmt.Sprintf("WARNING: server certificate had error: %s. Proceed insecurely (y/n)? ", tlsTestResult.InsecureErr)) {
os.Exit(1)
}
globalClientOpts.Insecure = true
}
globalClientOpts.Insecure = true
}
}
clientOpts := argocdclient.ClientOptions{
ConfigPath: "",
ServerAddr: server,
Insecure: globalClientOpts.Insecure,
PlainText: globalClientOpts.PlainText,
ConfigPath: "",
ServerAddr: server,
Insecure: globalClientOpts.Insecure,
PlainText: globalClientOpts.PlainText,
GRPCWeb: globalClientOpts.GRPCWeb,
GRPCWebRootPath: globalClientOpts.GRPCWebRootPath,
PortForward: globalClientOpts.PortForward,
PortForwardNamespace: globalClientOpts.PortForwardNamespace,
Headers: globalClientOpts.Headers,
}
acdClient := argocdclient.NewClientOrDie(&clientOpts)
setConn, setIf := acdClient.NewSettingsClientOrDie()
defer util.Close(setConn)
defer io.Close(setConn)
if ctxName == "" {
ctxName = server
if globalClientOpts.GRPCWebRootPath != "" {
rootPath := strings.TrimRight(strings.TrimLeft(globalClientOpts.GRPCWebRootPath, "/"), "/")
ctxName = fmt.Sprintf("%s/%s", server, rootPath)
}
}
// Perform the login
@@ -81,19 +104,22 @@ func NewLoginCommand(globalClientOpts *argocdclient.ClientOptions) *cobra.Comman
if !sso {
tokenString = passwordLogin(acdClient, username, password)
} else {
acdSet, err := setIf.Get(context.Background(), &settings.SettingsQuery{})
ctx := context.Background()
httpClient, err := acdClient.HTTPClient()
errors.CheckError(err)
if !ssoConfigured(acdSet) {
log.Fatalf("ArgoCD instance is not configured with SSO")
}
tokenString, refreshToken = oauth2Login(server, clientOpts.PlainText)
ctx = oidc.ClientContext(ctx, httpClient)
acdSet, err := setIf.Get(ctx, &settingspkg.SettingsQuery{})
errors.CheckError(err)
oauth2conf, provider, err := acdClient.OIDCConfig(ctx, acdSet)
errors.CheckError(err)
tokenString, refreshToken = oauth2Login(ctx, ssoPort, acdSet.GetOIDCConfig(), oauth2conf, provider)
}
parser := &jwt.Parser{
SkipClaimsValidation: true,
ValidationHelper: jwt.NewValidationHelper(jwt.WithoutClaimsValidation(), jwt.WithoutAudienceValidation()),
}
claims := jwt.MapClaims{}
_, _, err = parser.ParseUnverified(tokenString, &claims)
_, _, err := parser.ParseUnverified(tokenString, &claims)
errors.CheckError(err)
fmt.Printf("'%s' logged in successfully\n", userDisplayName(claims))
@@ -104,9 +130,11 @@ func NewLoginCommand(globalClientOpts *argocdclient.ClientOptions) *cobra.Comman
localCfg = &localconfig.LocalConfig{}
}
localCfg.UpsertServer(localconfig.Server{
Server: server,
PlainText: globalClientOpts.PlainText,
Insecure: globalClientOpts.Insecure,
Server: server,
PlainText: globalClientOpts.PlainText,
Insecure: globalClientOpts.Insecure,
GRPCWeb: globalClientOpts.GRPCWeb,
GRPCWebRootPath: globalClientOpts.GRPCWebRootPath,
})
localCfg.UpsertUser(localconfig.User{
Name: ctxName,
@@ -130,129 +158,162 @@ func NewLoginCommand(globalClientOpts *argocdclient.ClientOptions) *cobra.Comman
command.Flags().StringVar(&ctxName, "name", "", "name to use for the context")
command.Flags().StringVar(&username, "username", "", "the username of an account to authenticate")
command.Flags().StringVar(&password, "password", "", "the password of an account to authenticate")
command.Flags().BoolVar(&sso, "sso", false, "Perform SSO login")
command.Flags().BoolVar(&sso, "sso", false, "perform SSO login")
command.Flags().IntVar(&ssoPort, "sso-port", DefaultSSOLocalPort, "port to run local OAuth2 login application")
return command
}
func userDisplayName(claims jwt.MapClaims) string {
if email, ok := claims["email"]; ok && email != nil {
return email.(string)
if email := jwtutil.StringField(claims, "email"); email != "" {
return email
}
if name, ok := claims["name"]; ok && name != nil {
return name.(string)
if name := jwtutil.StringField(claims, "name"); name != "" {
return name
}
return claims["sub"].(string)
}
func ssoConfigured(set *settings.Settings) bool {
return set.DexConfig != nil && len(set.DexConfig.Connectors) > 0
}
// getFreePort asks the kernel for a free open port that is ready to use.
func getFreePort() (int, error) {
ln, err := net.Listen("tcp", "[::]:0")
if err != nil {
return 0, err
}
return ln.Addr().(*net.TCPAddr).Port, ln.Close()
return jwtutil.StringField(claims, "sub")
}
// oauth2Login opens a browser, runs a temporary HTTP server to delegate OAuth2 login flow and
// returns the JWT token and a refresh token (if supported)
func oauth2Login(host string, plaintext bool) (string, string) {
ctx := context.Background()
port, err := getFreePort()
func oauth2Login(ctx context.Context, port int, oidcSettings *settingspkg.OIDCConfig, oauth2conf *oauth2.Config, provider *oidc.Provider) (string, string) {
oauth2conf.RedirectURL = fmt.Sprintf("http://localhost:%d/auth/callback", port)
oidcConf, err := oidcutil.ParseConfig(provider)
errors.CheckError(err)
var scheme = "https"
if plaintext {
scheme = "http"
}
conf := &oauth2.Config{
ClientID: common.ArgoCDCLIClientAppID,
Scopes: []string{"openid", "profile", "email", "groups", "offline_access"},
Endpoint: oauth2.Endpoint{
AuthURL: fmt.Sprintf("%s://%s%s/auth", scheme, host, common.DexAPIEndpoint),
TokenURL: fmt.Sprintf("%s://%s%s/token", scheme, host, common.DexAPIEndpoint),
},
RedirectURL: fmt.Sprintf("http://localhost:%d/auth/callback", port),
}
srv := &http.Server{Addr: ":" + strconv.Itoa(port)}
log.Debug("OIDC Configuration:")
log.Debugf(" supported_scopes: %v", oidcConf.ScopesSupported)
log.Debugf(" response_types_supported: %v", oidcConf.ResponseTypesSupported)
// handledRequests ensures we do not handle more requests than necessary
handledRequests := 0
// completionChan is to signal flow completed. Non-empty string indicates error
completionChan := make(chan string)
// stateNonce is an OAuth2 state nonce
stateNonce := rand.RandString(10)
var tokenString string
var refreshToken string
loginCompleted := make(chan struct{})
handleErr := func(w http.ResponseWriter, errMsg string) {
http.Error(w, html.EscapeString(errMsg), http.StatusBadRequest)
completionChan <- errMsg
}
// PKCE implementation of https://tools.ietf.org/html/rfc7636
codeVerifier := rand.RandStringCharset(43, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~")
codeChallengeHash := sha256.Sum256([]byte(codeVerifier))
codeChallenge := base64.RawURLEncoding.EncodeToString(codeChallengeHash[:])
// Authorization redirect callback from OAuth2 auth flow.
// Handles both implicit and authorization code flow
callbackHandler := func(w http.ResponseWriter, r *http.Request) {
defer func() {
loginCompleted <- struct{}{}
}()
log.Debugf("Callback: %s", r.URL)
// Authorization redirect callback from OAuth2 auth flow.
if errMsg := r.FormValue("error"); errMsg != "" {
http.Error(w, errMsg+": "+r.FormValue("error_description"), http.StatusBadRequest)
log.Fatal(errMsg)
if formErr := r.FormValue("error"); formErr != "" {
handleErr(w, fmt.Sprintf("%s: %s", formErr, r.FormValue("error_description")))
return
}
code := r.FormValue("code")
if code == "" {
errMsg := fmt.Sprintf("no code in request: %q", r.Form)
http.Error(w, errMsg, http.StatusBadRequest)
log.Fatal(errMsg)
return
}
tok, err := conf.Exchange(ctx, code)
errors.CheckError(err)
log.Info("Authentication successful")
var ok bool
tokenString, ok = tok.Extra("id_token").(string)
if !ok {
errMsg := "no id_token in token response"
http.Error(w, errMsg, http.StatusInternalServerError)
log.Fatal(errMsg)
handledRequests++
if handledRequests > 2 {
// Since implicit flow will redirect back to ourselves, this counter ensures we do not
// fallinto a redirect loop (e.g. user visits the page by hand)
handleErr(w, "Unable to complete login flow: too many redirects")
return
}
refreshToken, _ = tok.Extra("refresh_token").(string)
log.Debugf("Token: %s", tokenString)
log.Debugf("Refresh Token: %s", tokenString)
if len(r.Form) == 0 {
// If we get here, no form data was set. We presume to be performing an implicit login
// flow where the id_token is contained in a URL fragment, making it inaccessible to be
// read from the request. This javascript will redirect the browser to send the
// fragments as query parameters so our callback handler can read and return token.
fmt.Fprintf(w, `<script>window.location.search = window.location.hash.substring(1)</script>`)
return
}
if state := r.FormValue("state"); state != stateNonce {
handleErr(w, "Unknown state nonce")
return
}
tokenString = r.FormValue("id_token")
if tokenString == "" {
code := r.FormValue("code")
if code == "" {
handleErr(w, fmt.Sprintf("no code in request: %q", r.Form))
return
}
opts := []oauth2.AuthCodeOption{oauth2.SetAuthURLParam("code_verifier", codeVerifier)}
tok, err := oauth2conf.Exchange(ctx, code, opts...)
if err != nil {
handleErr(w, err.Error())
return
}
var ok bool
tokenString, ok = tok.Extra("id_token").(string)
if !ok {
handleErr(w, "no id_token in token response")
return
}
refreshToken, _ = tok.Extra("refresh_token").(string)
}
successPage := `
<div style="height:100px; width:100%!; display:flex; flex-direction: column; justify-content: center; align-items:center; background-color:#2ecc71; color:white; font-size:22"><div>Authentication successful!</div></div>
<p style="margin-top:20px; font-size:18; text-align:center">Authentication was successful, you can now return to CLI. This page will close automatically</p>
<script>window.onload=function(){setTimeout(this.close, 4000)}</script>
`
fmt.Fprintf(w, successPage)
fmt.Fprint(w, successPage)
completionChan <- ""
}
srv := &http.Server{Addr: "localhost:" + strconv.Itoa(port)}
http.HandleFunc("/auth/callback", callbackHandler)
// add transport for self-signed certificate to context
sslcli := &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
},
}
ctx = context.WithValue(ctx, oauth2.HTTPClient, sslcli)
// Redirect user to login & consent page to ask for permission for the scopes specified above.
log.Info("Opening browser for authentication")
url := conf.AuthCodeURL("state", oauth2.AccessTypeOffline)
log.Infof("Authentication URL: %s", url)
fmt.Printf("Opening browser for authentication\n")
var url string
grantType := oidcutil.InferGrantType(oidcConf)
opts := []oauth2.AuthCodeOption{oauth2.AccessTypeOffline}
if claimsRequested := oidcSettings.GetIDTokenClaims(); claimsRequested != nil {
opts = oidcutil.AppendClaimsAuthenticationRequestParameter(opts, claimsRequested)
}
switch grantType {
case oidcutil.GrantTypeAuthorizationCode:
opts = append(opts, oauth2.SetAuthURLParam("code_challenge", codeChallenge))
opts = append(opts, oauth2.SetAuthURLParam("code_challenge_method", "S256"))
url = oauth2conf.AuthCodeURL(stateNonce, opts...)
case oidcutil.GrantTypeImplicit:
url = oidcutil.ImplicitFlowURL(oauth2conf, stateNonce, opts...)
default:
log.Fatalf("Unsupported grant type: %v", grantType)
}
fmt.Printf("Performing %s flow login: %s\n", grantType, url)
time.Sleep(1 * time.Second)
err = open.Run(url)
err = open.Start(url)
errors.CheckError(err)
go func() {
log.Debugf("Listen: %s", srv.Addr)
if err := srv.ListenAndServe(); err != http.ErrServerClosed {
log.Fatalf("listen: %s\n", err)
log.Fatalf("Temporary HTTP server failed: %s", err)
}
}()
<-loginCompleted
errMsg := <-completionChan
if errMsg != "" {
log.Fatal(errMsg)
}
fmt.Printf("Authentication successful\n")
ctx, cancel := context.WithTimeout(ctx, 1*time.Second)
defer cancel()
_ = srv.Shutdown(ctx)
log.Debugf("Token: %s", tokenString)
log.Debugf("Refresh Token: %s", refreshToken)
return tokenString, refreshToken
}
func passwordLogin(acdClient argocdclient.Client, username, password string) string {
username, password = cli.PromptCredentials(username, password)
sessConn, sessionIf := acdClient.NewSessionClientOrDie()
defer util.Close(sessConn)
sessionRequest := session.SessionCreateRequest{
defer io.Close(sessConn)
sessionRequest := sessionpkg.SessionCreateRequest{
Username: username,
Password: password,
}

View File

@@ -0,0 +1,31 @@
package commands
import (
"testing"
"github.com/dgrijalva/jwt-go/v4"
"github.com/stretchr/testify/assert"
)
//
func Test_userDisplayName_email(t *testing.T) {
claims := jwt.MapClaims{"iss": "qux", "sub": "foo", "email": "firstname.lastname@example.com", "groups": []string{"baz"}}
actualName := userDisplayName(claims)
expectedName := "firstname.lastname@example.com"
assert.Equal(t, expectedName, actualName)
}
func Test_userDisplayName_name(t *testing.T) {
claims := jwt.MapClaims{"iss": "qux", "sub": "foo", "name": "Firstname Lastname", "groups": []string{"baz"}}
actualName := userDisplayName(claims)
expectedName := "Firstname Lastname"
assert.Equal(t, expectedName, actualName)
}
func Test_userDisplayName_sub(t *testing.T) {
claims := jwt.MapClaims{"iss": "qux", "sub": "foo", "groups": []string{"baz"}}
actualName := userDisplayName(claims)
expectedName := "foo"
assert.Equal(t, expectedName, actualName)
}

View File

@@ -0,0 +1,50 @@
package commands
import (
"fmt"
"os"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
argocdclient "github.com/argoproj/argo-cd/pkg/apiclient"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/localconfig"
)
// NewLogoutCommand returns a new instance of `argocd logout` command
func NewLogoutCommand(globalClientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "logout CONTEXT",
Short: "Log out from Argo CD",
Long: "Log out from Argo CD",
Run: func(c *cobra.Command, args []string) {
if len(args) == 0 {
c.HelpFunc()(c, args)
os.Exit(1)
}
context := args[0]
localCfg, err := localconfig.ReadLocalConfig(globalClientOpts.ConfigPath)
errors.CheckError(err)
if localCfg == nil {
log.Fatalf("Nothing to logout from")
}
ok := localCfg.RemoveToken(context)
if !ok {
log.Fatalf("Context %s does not exist", context)
}
err = localconfig.ValidateLocalConfig(*localCfg)
if err != nil {
log.Fatalf("Error in logging out: %s", err)
}
err = localconfig.WriteLocalConfig(*localCfg, globalClientOpts.ConfigPath)
errors.CheckError(err)
fmt.Printf("Logged out from '%s'\n", context)
},
}
return command
}

View File

@@ -0,0 +1,41 @@
package commands
import (
"io/ioutil"
"os"
"testing"
"github.com/argoproj/argo-cd/pkg/apiclient"
"github.com/stretchr/testify/assert"
"github.com/argoproj/argo-cd/util/localconfig"
)
func TestLogout(t *testing.T) {
// Write the test config file
err := ioutil.WriteFile(testConfigFilePath, []byte(testConfig), os.ModePerm)
assert.NoError(t, err)
localConfig, err := localconfig.ReadLocalConfig(testConfigFilePath)
assert.NoError(t, err)
assert.Equal(t, localConfig.CurrentContext, "localhost:8080")
assert.Contains(t, localConfig.Contexts, localconfig.ContextRef{Name: "localhost:8080", Server: "localhost:8080", User: "localhost:8080"})
command := NewLogoutCommand(&apiclient.ClientOptions{ConfigPath: testConfigFilePath})
command.Run(nil, []string{"localhost:8080"})
localConfig, err = localconfig.ReadLocalConfig(testConfigFilePath)
assert.NoError(t, err)
assert.Equal(t, localConfig.CurrentContext, "localhost:8080")
assert.NotContains(t, localConfig.Users, localconfig.User{AuthToken: "vErrYS3c3tReFRe$hToken", Name: "localhost:8080"})
assert.Contains(t, localConfig.Contexts, localconfig.ContextRef{Name: "argocd1.example.com:443", Server: "argocd1.example.com:443", User: "argocd1.example.com:443"})
assert.Contains(t, localConfig.Contexts, localconfig.ContextRef{Name: "argocd2.example.com:443", Server: "argocd2.example.com:443", User: "argocd2.example.com:443"})
assert.Contains(t, localConfig.Contexts, localconfig.ContextRef{Name: "localhost:8080", Server: "localhost:8080", User: "localhost:8080"})
// Write the file again so that no conflicts are made in git
err = ioutil.WriteFile(testConfigFilePath, []byte(testConfig), os.ModePerm)
assert.NoError(t, err)
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,505 @@
package commands
import (
"context"
"fmt"
"os"
"strconv"
"text/tabwriter"
"time"
timeutil "github.com/argoproj/pkg/time"
jwtgo "github.com/dgrijalva/jwt-go/v4"
"github.com/spf13/cobra"
argocdclient "github.com/argoproj/argo-cd/pkg/apiclient"
projectpkg "github.com/argoproj/argo-cd/pkg/apiclient/project"
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/io"
"github.com/argoproj/argo-cd/util/jwt"
)
const (
policyTemplate = "p, proj:%s:%s, applications, %s, %s/%s, %s"
)
// NewProjectRoleCommand returns a new instance of the `argocd proj role` command
func NewProjectRoleCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
roleCommand := &cobra.Command{
Use: "role",
Short: "Manage a project's roles",
Run: func(c *cobra.Command, args []string) {
c.HelpFunc()(c, args)
os.Exit(1)
},
}
roleCommand.AddCommand(NewProjectRoleListCommand(clientOpts))
roleCommand.AddCommand(NewProjectRoleGetCommand(clientOpts))
roleCommand.AddCommand(NewProjectRoleCreateCommand(clientOpts))
roleCommand.AddCommand(NewProjectRoleDeleteCommand(clientOpts))
roleCommand.AddCommand(NewProjectRoleCreateTokenCommand(clientOpts))
roleCommand.AddCommand(NewProjectRoleListTokensCommand(clientOpts))
roleCommand.AddCommand(NewProjectRoleDeleteTokenCommand(clientOpts))
roleCommand.AddCommand(NewProjectRoleAddPolicyCommand(clientOpts))
roleCommand.AddCommand(NewProjectRoleRemovePolicyCommand(clientOpts))
roleCommand.AddCommand(NewProjectRoleAddGroupCommand(clientOpts))
roleCommand.AddCommand(NewProjectRoleRemoveGroupCommand(clientOpts))
return roleCommand
}
// NewProjectRoleAddPolicyCommand returns a new instance of an `argocd proj role add-policy` command
func NewProjectRoleAddPolicyCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
opts policyOpts
)
var command = &cobra.Command{
Use: "add-policy PROJECT ROLE-NAME",
Short: "Add a policy to a project role",
Run: func(c *cobra.Command, args []string) {
if len(args) != 2 {
c.HelpFunc()(c, args)
os.Exit(1)
}
projName := args[0]
roleName := args[1]
conn, projIf := argocdclient.NewClientOrDie(clientOpts).NewProjectClientOrDie()
defer io.Close(conn)
proj, err := projIf.Get(context.Background(), &projectpkg.ProjectQuery{Name: projName})
errors.CheckError(err)
role, roleIndex, err := proj.GetRoleByName(roleName)
errors.CheckError(err)
policy := fmt.Sprintf(policyTemplate, proj.Name, role.Name, opts.action, proj.Name, opts.object, opts.permission)
proj.Spec.Roles[roleIndex].Policies = append(role.Policies, policy)
_, err = projIf.Update(context.Background(), &projectpkg.ProjectUpdateRequest{Project: proj})
errors.CheckError(err)
},
}
addPolicyFlags(command, &opts)
return command
}
// NewProjectRoleRemovePolicyCommand returns a new instance of an `argocd proj role remove-policy` command
func NewProjectRoleRemovePolicyCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
opts policyOpts
)
var command = &cobra.Command{
Use: "remove-policy PROJECT ROLE-NAME",
Short: "Remove a policy from a role within a project",
Run: func(c *cobra.Command, args []string) {
if len(args) != 2 {
c.HelpFunc()(c, args)
os.Exit(1)
}
projName := args[0]
roleName := args[1]
conn, projIf := argocdclient.NewClientOrDie(clientOpts).NewProjectClientOrDie()
defer io.Close(conn)
proj, err := projIf.Get(context.Background(), &projectpkg.ProjectQuery{Name: projName})
errors.CheckError(err)
role, roleIndex, err := proj.GetRoleByName(roleName)
errors.CheckError(err)
policyToRemove := fmt.Sprintf(policyTemplate, proj.Name, role.Name, opts.action, proj.Name, opts.object, opts.permission)
duplicateIndex := -1
for i, policy := range role.Policies {
if policy == policyToRemove {
duplicateIndex = i
break
}
}
if duplicateIndex < 0 {
return
}
role.Policies[duplicateIndex] = role.Policies[len(role.Policies)-1]
proj.Spec.Roles[roleIndex].Policies = role.Policies[:len(role.Policies)-1]
_, err = projIf.Update(context.Background(), &projectpkg.ProjectUpdateRequest{Project: proj})
errors.CheckError(err)
},
}
addPolicyFlags(command, &opts)
return command
}
// NewProjectRoleCreateCommand returns a new instance of an `argocd proj role create` command
func NewProjectRoleCreateCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
description string
)
var command = &cobra.Command{
Use: "create PROJECT ROLE-NAME",
Short: "Create a project role",
Run: func(c *cobra.Command, args []string) {
if len(args) != 2 {
c.HelpFunc()(c, args)
os.Exit(1)
}
projName := args[0]
roleName := args[1]
conn, projIf := argocdclient.NewClientOrDie(clientOpts).NewProjectClientOrDie()
defer io.Close(conn)
proj, err := projIf.Get(context.Background(), &projectpkg.ProjectQuery{Name: projName})
errors.CheckError(err)
_, _, err = proj.GetRoleByName(roleName)
if err == nil {
fmt.Printf("Role '%s' already exists\n", roleName)
return
}
proj.Spec.Roles = append(proj.Spec.Roles, v1alpha1.ProjectRole{Name: roleName, Description: description})
_, err = projIf.Update(context.Background(), &projectpkg.ProjectUpdateRequest{Project: proj})
errors.CheckError(err)
fmt.Printf("Role '%s' created\n", roleName)
},
}
command.Flags().StringVarP(&description, "description", "", "", "Project description")
return command
}
// NewProjectRoleDeleteCommand returns a new instance of an `argocd proj role delete` command
func NewProjectRoleDeleteCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "delete PROJECT ROLE-NAME",
Short: "Delete a project role",
Run: func(c *cobra.Command, args []string) {
if len(args) != 2 {
c.HelpFunc()(c, args)
os.Exit(1)
}
projName := args[0]
roleName := args[1]
conn, projIf := argocdclient.NewClientOrDie(clientOpts).NewProjectClientOrDie()
defer io.Close(conn)
proj, err := projIf.Get(context.Background(), &projectpkg.ProjectQuery{Name: projName})
errors.CheckError(err)
_, index, err := proj.GetRoleByName(roleName)
if err != nil {
fmt.Printf("Role '%s' does not exist in project\n", roleName)
return
}
proj.Spec.Roles[index] = proj.Spec.Roles[len(proj.Spec.Roles)-1]
proj.Spec.Roles = proj.Spec.Roles[:len(proj.Spec.Roles)-1]
_, err = projIf.Update(context.Background(), &projectpkg.ProjectUpdateRequest{Project: proj})
errors.CheckError(err)
fmt.Printf("Role '%s' deleted\n", roleName)
},
}
return command
}
func tokenTimeToString(t int64) string {
tokenTimeToString := "Never"
if t > 0 {
tokenTimeToString = time.Unix(t, 0).Format(time.RFC3339)
}
return tokenTimeToString
}
// NewProjectRoleCreateTokenCommand returns a new instance of an `argocd proj role create-token` command
func NewProjectRoleCreateTokenCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
expiresIn string
outputTokenOnly bool
tokenID string
)
var command = &cobra.Command{
Use: "create-token PROJECT ROLE-NAME",
Short: "Create a project token",
Aliases: []string{"token-create"},
Run: func(c *cobra.Command, args []string) {
if len(args) != 2 {
c.HelpFunc()(c, args)
os.Exit(1)
}
projName := args[0]
roleName := args[1]
conn, projIf := argocdclient.NewClientOrDie(clientOpts).NewProjectClientOrDie()
defer io.Close(conn)
if expiresIn == "" {
expiresIn = "0s"
}
duration, err := timeutil.ParseDuration(expiresIn)
errors.CheckError(err)
tokenResponse, err := projIf.CreateToken(context.Background(), &projectpkg.ProjectTokenCreateRequest{
Project: projName,
Role: roleName,
ExpiresIn: int64(duration.Seconds()),
Id: tokenID,
})
errors.CheckError(err)
token, err := jwtgo.Parse(tokenResponse.Token, nil)
if token == nil {
err = fmt.Errorf("received malformed token %v", err)
errors.CheckError(err)
return
}
claims := token.Claims.(jwtgo.MapClaims)
issuedAt, _ := jwt.IssuedAt(claims)
expiresAt := int64(jwt.Float64Field(claims, "exp"))
id := jwt.StringField(claims, "jti")
subject := jwt.StringField(claims, "sub")
if !outputTokenOnly {
fmt.Printf("Create token succeeded for %s.\n", subject)
fmt.Printf(" ID: %s\n Issued At: %s\n Expires At: %s\n",
id, tokenTimeToString(issuedAt), tokenTimeToString(expiresAt),
)
fmt.Println(" Token: " + tokenResponse.Token)
} else {
fmt.Println(tokenResponse.Token)
}
},
}
command.Flags().StringVarP(&expiresIn, "expires-in", "e", "",
"Duration before the token will expire, eg \"12h\", \"7d\". (Default: No expiration)",
)
command.Flags().StringVarP(&tokenID, "id", "i", "", "Token unique identifier. (Default: Random UUID)")
command.Flags().BoolVarP(&outputTokenOnly, "token-only", "t", false, "Output token only - for use in scripts.")
return command
}
func NewProjectRoleListTokensCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
useUnixTime bool
)
var command = &cobra.Command{
Use: "list-tokens PROJECT ROLE-NAME",
Short: "List tokens for a given role.",
Aliases: []string{"list-token", "token-list"},
Run: func(c *cobra.Command, args []string) {
if len(args) != 2 {
c.HelpFunc()(c, args)
os.Exit(1)
}
projName := args[0]
roleName := args[1]
conn, projIf := argocdclient.NewClientOrDie(clientOpts).NewProjectClientOrDie()
defer io.Close(conn)
proj, err := projIf.Get(context.Background(), &projectpkg.ProjectQuery{Name: projName})
errors.CheckError(err)
role, _, err := proj.GetRoleByName(roleName)
errors.CheckError(err)
if len(role.JWTTokens) == 0 {
fmt.Printf("No tokens for %s.%s\n", projName, roleName)
return
}
writer := tabwriter.NewWriter(os.Stdout, 0, 0, 4, ' ', 0)
_, err = fmt.Fprintf(writer, "ID\tISSUED AT\tEXPIRES AT\n")
errors.CheckError(err)
tokenRowFormat := "%s\t%v\t%v\n"
for _, token := range role.JWTTokens {
if useUnixTime {
_, _ = fmt.Fprintf(writer, tokenRowFormat, token.ID, token.IssuedAt, token.ExpiresAt)
} else {
_, _ = fmt.Fprintf(writer, tokenRowFormat, token.ID, tokenTimeToString(token.IssuedAt), tokenTimeToString(token.ExpiresAt))
}
}
err = writer.Flush()
errors.CheckError(err)
},
}
command.Flags().BoolVarP(&useUnixTime, "unixtime", "u", false,
"Print timestamps as Unix time instead of converting. Useful for piping into delete-token.",
)
return command
}
// NewProjectRoleDeleteTokenCommand returns a new instance of an `argocd proj role delete-token` command
func NewProjectRoleDeleteTokenCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "delete-token PROJECT ROLE-NAME ISSUED-AT",
Short: "Delete a project token",
Aliases: []string{"token-delete", "remove-token"},
Run: func(c *cobra.Command, args []string) {
if len(args) != 3 {
c.HelpFunc()(c, args)
os.Exit(1)
}
projName := args[0]
roleName := args[1]
issuedAt, err := strconv.ParseInt(args[2], 10, 64)
errors.CheckError(err)
conn, projIf := argocdclient.NewClientOrDie(clientOpts).NewProjectClientOrDie()
defer io.Close(conn)
_, err = projIf.DeleteToken(context.Background(), &projectpkg.ProjectTokenDeleteRequest{Project: projName, Role: roleName, Iat: issuedAt})
errors.CheckError(err)
},
}
return command
}
// Print list of project role names
func printProjectRoleListName(roles []v1alpha1.ProjectRole) {
for _, role := range roles {
fmt.Println(role.Name)
}
}
// Print table of project roles
func printProjectRoleListTable(roles []v1alpha1.ProjectRole) {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
fmt.Fprintf(w, "ROLE-NAME\tDESCRIPTION\n")
for _, role := range roles {
fmt.Fprintf(w, "%s\t%s\n", role.Name, role.Description)
}
_ = w.Flush()
}
// NewProjectRoleListCommand returns a new instance of an `argocd proj roles list` command
func NewProjectRoleListCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
output string
)
var command = &cobra.Command{
Use: "list PROJECT",
Short: "List all the roles in a project",
Run: func(c *cobra.Command, args []string) {
if len(args) != 1 {
c.HelpFunc()(c, args)
os.Exit(1)
}
projName := args[0]
conn, projIf := argocdclient.NewClientOrDie(clientOpts).NewProjectClientOrDie()
defer io.Close(conn)
project, err := projIf.Get(context.Background(), &projectpkg.ProjectQuery{Name: projName})
errors.CheckError(err)
switch output {
case "json", "yaml":
err := PrintResourceList(project.Spec.Roles, output, false)
errors.CheckError(err)
case "name":
printProjectRoleListName(project.Spec.Roles)
case "wide", "":
printProjectRoleListTable(project.Spec.Roles)
default:
errors.CheckError(fmt.Errorf("unknown output format: %s", output))
}
},
}
command.Flags().StringVarP(&output, "output", "o", "wide", "Output format. One of: json|yaml|wide|name")
return command
}
// NewProjectRoleGetCommand returns a new instance of an `argocd proj roles get` command
func NewProjectRoleGetCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "get PROJECT ROLE-NAME",
Short: "Get the details of a specific role",
Run: func(c *cobra.Command, args []string) {
if len(args) != 2 {
c.HelpFunc()(c, args)
os.Exit(1)
}
projName := args[0]
roleName := args[1]
conn, projIf := argocdclient.NewClientOrDie(clientOpts).NewProjectClientOrDie()
defer io.Close(conn)
proj, err := projIf.Get(context.Background(), &projectpkg.ProjectQuery{Name: projName})
errors.CheckError(err)
role, _, err := proj.GetRoleByName(roleName)
errors.CheckError(err)
printRoleFmtStr := "%-15s%s\n"
fmt.Printf(printRoleFmtStr, "Role Name:", roleName)
fmt.Printf(printRoleFmtStr, "Description:", role.Description)
fmt.Printf("Policies:\n")
fmt.Printf("%s\n", proj.ProjectPoliciesString())
fmt.Printf("JWT Tokens:\n")
// TODO(jessesuen): print groups
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
fmt.Fprintf(w, "ID\tISSUED-AT\tEXPIRES-AT\n")
for _, token := range proj.Status.JWTTokensByRole[roleName].Items {
expiresAt := "<none>"
if token.ExpiresAt > 0 {
expiresAt = humanizeTimestamp(token.ExpiresAt)
}
fmt.Fprintf(w, "%d\t%s\t%s\n", token.IssuedAt, humanizeTimestamp(token.IssuedAt), expiresAt)
}
_ = w.Flush()
},
}
return command
}
// NewProjectRoleAddGroupCommand returns a new instance of an `argocd proj role add-group` command
func NewProjectRoleAddGroupCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "add-group PROJECT ROLE-NAME GROUP-CLAIM",
Short: "Add a group claim to a project role",
Run: func(c *cobra.Command, args []string) {
if len(args) != 3 {
c.HelpFunc()(c, args)
os.Exit(1)
}
projName, roleName, groupName := args[0], args[1], args[2]
conn, projIf := argocdclient.NewClientOrDie(clientOpts).NewProjectClientOrDie()
defer io.Close(conn)
proj, err := projIf.Get(context.Background(), &projectpkg.ProjectQuery{Name: projName})
errors.CheckError(err)
updated, err := proj.AddGroupToRole(roleName, groupName)
errors.CheckError(err)
if !updated {
fmt.Printf("Group '%s' already present in role '%s'\n", groupName, roleName)
return
}
_, err = projIf.Update(context.Background(), &projectpkg.ProjectUpdateRequest{Project: proj})
errors.CheckError(err)
fmt.Printf("Group '%s' added to role '%s'\n", groupName, roleName)
},
}
return command
}
// NewProjectRoleRemoveGroupCommand returns a new instance of an `argocd proj role remove-group` command
func NewProjectRoleRemoveGroupCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "remove-group PROJECT ROLE-NAME GROUP-CLAIM",
Short: "Remove a group claim from a role within a project",
Run: func(c *cobra.Command, args []string) {
if len(args) != 3 {
c.HelpFunc()(c, args)
os.Exit(1)
}
projName, roleName, groupName := args[0], args[1], args[2]
conn, projIf := argocdclient.NewClientOrDie(clientOpts).NewProjectClientOrDie()
defer io.Close(conn)
proj, err := projIf.Get(context.Background(), &projectpkg.ProjectQuery{Name: projName})
errors.CheckError(err)
updated, err := proj.RemoveGroupFromRole(roleName, groupName)
errors.CheckError(err)
if !updated {
fmt.Printf("Group '%s' not present in role '%s'\n", groupName, roleName)
return
}
_, err = projIf.Update(context.Background(), &projectpkg.ProjectUpdateRequest{Project: proj})
errors.CheckError(err)
fmt.Printf("Group '%s' removed from role '%s'\n", groupName, roleName)
},
}
return command
}

View File

@@ -0,0 +1,320 @@
package commands
import (
"context"
"fmt"
"os"
"strconv"
"strings"
"text/tabwriter"
"github.com/spf13/cobra"
argocdclient "github.com/argoproj/argo-cd/pkg/apiclient"
projectpkg "github.com/argoproj/argo-cd/pkg/apiclient/project"
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/io"
)
// NewProjectWindowsCommand returns a new instance of the `argocd proj windows` command
func NewProjectWindowsCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
roleCommand := &cobra.Command{
Use: "windows",
Short: "Manage a project's sync windows",
Run: func(c *cobra.Command, args []string) {
c.HelpFunc()(c, args)
os.Exit(1)
},
}
roleCommand.AddCommand(NewProjectWindowsDisableManualSyncCommand(clientOpts))
roleCommand.AddCommand(NewProjectWindowsEnableManualSyncCommand(clientOpts))
roleCommand.AddCommand(NewProjectWindowsAddWindowCommand(clientOpts))
roleCommand.AddCommand(NewProjectWindowsDeleteCommand(clientOpts))
roleCommand.AddCommand(NewProjectWindowsListCommand(clientOpts))
roleCommand.AddCommand(NewProjectWindowsUpdateCommand(clientOpts))
return roleCommand
}
// NewProjectSyncWindowsDisableManualSyncCommand returns a new instance of an `argocd proj windows disable-manual-sync` command
func NewProjectWindowsDisableManualSyncCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "disable-manual-sync PROJECT ID",
Short: "Disable manual sync for a sync window",
Long: "Disable manual sync for a sync window. Requires ID which can be found by running \"argocd proj windows list PROJECT\"",
Run: func(c *cobra.Command, args []string) {
if len(args) != 2 {
c.HelpFunc()(c, args)
os.Exit(1)
}
projName := args[0]
id, err := strconv.Atoi(args[1])
errors.CheckError(err)
conn, projIf := argocdclient.NewClientOrDie(clientOpts).NewProjectClientOrDie()
defer io.Close(conn)
proj, err := projIf.Get(context.Background(), &projectpkg.ProjectQuery{Name: projName})
errors.CheckError(err)
for i, window := range proj.Spec.SyncWindows {
if id == i {
window.ManualSync = false
}
}
_, err = projIf.Update(context.Background(), &projectpkg.ProjectUpdateRequest{Project: proj})
errors.CheckError(err)
},
}
return command
}
// NewProjectWindowsEnableManualSyncCommand returns a new instance of an `argocd proj windows enable-manual-sync` command
func NewProjectWindowsEnableManualSyncCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "enable-manual-sync PROJECT ID",
Short: "Enable manual sync for a sync window",
Long: "Enable manual sync for a sync window. Requires ID which can be found by running \"argocd proj windows list PROJECT\"",
Run: func(c *cobra.Command, args []string) {
if len(args) != 2 {
c.HelpFunc()(c, args)
os.Exit(1)
}
projName := args[0]
id, err := strconv.Atoi(args[1])
errors.CheckError(err)
conn, projIf := argocdclient.NewClientOrDie(clientOpts).NewProjectClientOrDie()
defer io.Close(conn)
proj, err := projIf.Get(context.Background(), &projectpkg.ProjectQuery{Name: projName})
errors.CheckError(err)
for i, window := range proj.Spec.SyncWindows {
if id == i {
window.ManualSync = true
}
}
_, err = projIf.Update(context.Background(), &projectpkg.ProjectUpdateRequest{Project: proj})
errors.CheckError(err)
},
}
return command
}
// NewProjectWindowsAddWindowCommand returns a new instance of an `argocd proj windows add` command
func NewProjectWindowsAddWindowCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
kind string
schedule string
duration string
applications []string
namespaces []string
clusters []string
manualSync bool
)
var command = &cobra.Command{
Use: "add PROJECT",
Short: "Add a sync window to a project",
Run: func(c *cobra.Command, args []string) {
if len(args) != 1 {
c.HelpFunc()(c, args)
os.Exit(1)
}
projName := args[0]
conn, projIf := argocdclient.NewClientOrDie(clientOpts).NewProjectClientOrDie()
defer io.Close(conn)
proj, err := projIf.Get(context.Background(), &projectpkg.ProjectQuery{Name: projName})
errors.CheckError(err)
err = proj.Spec.AddWindow(kind, schedule, duration, applications, namespaces, clusters, manualSync)
errors.CheckError(err)
_, err = projIf.Update(context.Background(), &projectpkg.ProjectUpdateRequest{Project: proj})
errors.CheckError(err)
},
}
command.Flags().StringVarP(&kind, "kind", "k", "", "Sync window kind, either allow or deny")
command.Flags().StringVar(&schedule, "schedule", "", "Sync window schedule in cron format. (e.g. --schedule \"0 22 * * *\")")
command.Flags().StringVar(&duration, "duration", "", "Sync window duration. (e.g. --duration 1h)")
command.Flags().StringSliceVar(&applications, "applications", []string{}, "Applications that the schedule will be applied to. Comma separated, wildcards supported (e.g. --applications prod-\\*,website)")
command.Flags().StringSliceVar(&namespaces, "namespaces", []string{}, "Namespaces that the schedule will be applied to. Comma separated, wildcards supported (e.g. --namespaces default,\\*-prod)")
command.Flags().StringSliceVar(&clusters, "clusters", []string{}, "Clusters that the schedule will be applied to. Comma separated, wildcards supported (e.g. --clusters prod,staging)")
command.Flags().BoolVar(&manualSync, "manual-sync", false, "Allow manual syncs for both deny and allow windows")
return command
}
// NewProjectWindowsAddWindowCommand returns a new instance of an `argocd proj windows delete` command
func NewProjectWindowsDeleteCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "delete PROJECT ID",
Short: "Delete a sync window from a project. Requires ID which can be found by running \"argocd proj windows list PROJECT\"",
Run: func(c *cobra.Command, args []string) {
if len(args) != 2 {
c.HelpFunc()(c, args)
os.Exit(1)
}
projName := args[0]
id, err := strconv.Atoi(args[1])
errors.CheckError(err)
conn, projIf := argocdclient.NewClientOrDie(clientOpts).NewProjectClientOrDie()
defer io.Close(conn)
proj, err := projIf.Get(context.Background(), &projectpkg.ProjectQuery{Name: projName})
errors.CheckError(err)
err = proj.Spec.DeleteWindow(id)
errors.CheckError(err)
_, err = projIf.Update(context.Background(), &projectpkg.ProjectUpdateRequest{Project: proj})
errors.CheckError(err)
},
}
return command
}
// NewProjectWindowsUpdateCommand returns a new instance of an `argocd proj windows update` command
func NewProjectWindowsUpdateCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
schedule string
duration string
applications []string
namespaces []string
clusters []string
)
var command = &cobra.Command{
Use: "update PROJECT ID",
Short: "Update a project sync window",
Long: "Update a project sync window. Requires ID which can be found by running \"argocd proj windows list PROJECT\"",
Run: func(c *cobra.Command, args []string) {
if len(args) != 2 {
c.HelpFunc()(c, args)
os.Exit(1)
}
projName := args[0]
id, err := strconv.Atoi(args[1])
errors.CheckError(err)
conn, projIf := argocdclient.NewClientOrDie(clientOpts).NewProjectClientOrDie()
defer io.Close(conn)
proj, err := projIf.Get(context.Background(), &projectpkg.ProjectQuery{Name: projName})
errors.CheckError(err)
for i, window := range proj.Spec.SyncWindows {
if id == i {
err := window.Update(schedule, duration, applications, namespaces, clusters)
if err != nil {
errors.CheckError(err)
}
}
}
_, err = projIf.Update(context.Background(), &projectpkg.ProjectUpdateRequest{Project: proj})
errors.CheckError(err)
},
}
command.Flags().StringVar(&schedule, "schedule", "", "Sync window schedule in cron format. (e.g. --schedule \"0 22 * * *\")")
command.Flags().StringVar(&duration, "duration", "", "Sync window duration. (e.g. --duration 1h)")
command.Flags().StringSliceVar(&applications, "applications", []string{}, "Applications that the schedule will be applied to. Comma separated, wildcards supported (e.g. --applications prod-\\*,website)")
command.Flags().StringSliceVar(&namespaces, "namespaces", []string{}, "Namespaces that the schedule will be applied to. Comma separated, wildcards supported (e.g. --namespaces default,\\*-prod)")
command.Flags().StringSliceVar(&clusters, "clusters", []string{}, "Clusters that the schedule will be applied to. Comma separated, wildcards supported (e.g. --clusters prod,staging)")
return command
}
// NewProjectWindowsListCommand returns a new instance of an `argocd proj windows list` command
func NewProjectWindowsListCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
output string
)
var command = &cobra.Command{
Use: "list PROJECT",
Short: "List project sync windows",
Run: func(c *cobra.Command, args []string) {
if len(args) != 1 {
c.HelpFunc()(c, args)
os.Exit(1)
}
projName := args[0]
conn, projIf := argocdclient.NewClientOrDie(clientOpts).NewProjectClientOrDie()
defer io.Close(conn)
proj, err := projIf.Get(context.Background(), &projectpkg.ProjectQuery{Name: projName})
errors.CheckError(err)
switch output {
case "yaml", "json":
err := PrintResourceList(proj.Spec.SyncWindows, output, false)
errors.CheckError(err)
case "wide", "":
printSyncWindows(proj)
default:
errors.CheckError(fmt.Errorf("unknown output format: %s", output))
}
},
}
command.Flags().StringVarP(&output, "output", "o", "wide", "Output format. One of: json|yaml|wide")
return command
}
// Print table of sync window data
func printSyncWindows(proj *v1alpha1.AppProject) {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
var fmtStr string
headers := []interface{}{"ID", "STATUS", "KIND", "SCHEDULE", "DURATION", "APPLICATIONS", "NAMESPACES", "CLUSTERS", "MANUALSYNC"}
fmtStr = "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n"
fmt.Fprintf(w, fmtStr, headers...)
if proj.Spec.SyncWindows.HasWindows() {
for i, window := range proj.Spec.SyncWindows {
vals := []interface{}{
strconv.Itoa(i),
formatBoolOutput(window.Active()),
window.Kind,
window.Schedule,
window.Duration,
formatListOutput(window.Applications),
formatListOutput(window.Namespaces),
formatListOutput(window.Clusters),
formatManualOutput(window.ManualSync),
}
fmt.Fprintf(w, fmtStr, vals...)
}
}
_ = w.Flush()
}
func formatListOutput(list []string) string {
var o string
if len(list) == 0 {
o = "-"
} else {
o = strings.Join(list, ",")
}
return o
}
func formatBoolOutput(active bool) string {
var o string
if active {
o = "Active"
} else {
o = "Inactive"
}
return o
}
func formatManualOutput(active bool) string {
var o string
if active {
o = "Enabled"
} else {
o = "Disabled"
}
return o
}

View File

@@ -1,15 +1,18 @@
package commands
import (
"context"
"fmt"
"os"
jwt "github.com/dgrijalva/jwt-go"
"github.com/coreos/go-oidc"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/argoproj/argo-cd/errors"
argocdclient "github.com/argoproj/argo-cd/pkg/apiclient"
settingspkg "github.com/argoproj/argo-cd/pkg/apiclient/settings"
"github.com/argoproj/argo-cd/util/errors"
argoio "github.com/argoproj/argo-cd/util/io"
"github.com/argoproj/argo-cd/util/localconfig"
"github.com/argoproj/argo-cd/util/session"
)
@@ -18,6 +21,7 @@ import (
func NewReloginCommand(globalClientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
password string
ssoPort int
)
var command = &cobra.Command{
Use: "relogin",
@@ -36,28 +40,36 @@ func NewReloginCommand(globalClientOpts *argocdclient.ClientOptions) *cobra.Comm
configCtx, err := localCfg.ResolveContext(localCfg.CurrentContext)
errors.CheckError(err)
parser := &jwt.Parser{
SkipClaimsValidation: true,
}
claims := jwt.StandardClaims{}
_, _, err = parser.ParseUnverified(configCtx.User.AuthToken, &claims)
errors.CheckError(err)
var tokenString string
var refreshToken string
clientOpts := argocdclient.ClientOptions{
ConfigPath: "",
ServerAddr: configCtx.Server.Server,
Insecure: configCtx.Server.Insecure,
GRPCWeb: globalClientOpts.GRPCWeb,
GRPCWebRootPath: globalClientOpts.GRPCWebRootPath,
PlainText: configCtx.Server.PlainText,
Headers: globalClientOpts.Headers,
}
acdClient := argocdclient.NewClientOrDie(&clientOpts)
claims, err := configCtx.User.Claims()
errors.CheckError(err)
if claims.Issuer == session.SessionManagerClaimsIssuer {
clientOpts := argocdclient.ClientOptions{
ConfigPath: "",
ServerAddr: configCtx.Server.Server,
Insecure: configCtx.Server.Insecure,
PlainText: configCtx.Server.PlainText,
}
acdClient := argocdclient.NewClientOrDie(&clientOpts)
fmt.Printf("Relogging in as '%s'\n", claims.Subject)
tokenString = passwordLogin(acdClient, claims.Subject, password)
} else {
fmt.Println("Reinitiating SSO login")
tokenString, refreshToken = oauth2Login(configCtx.Server.Server, configCtx.Server.PlainText)
setConn, setIf := acdClient.NewSettingsClientOrDie()
defer argoio.Close(setConn)
ctx := context.Background()
httpClient, err := acdClient.HTTPClient()
errors.CheckError(err)
ctx = oidc.ClientContext(ctx, httpClient)
acdSet, err := setIf.Get(ctx, &settingspkg.SettingsQuery{})
errors.CheckError(err)
oauth2conf, provider, err := acdClient.OIDCConfig(ctx, acdSet)
errors.CheckError(err)
tokenString, refreshToken = oauth2Login(ctx, ssoPort, acdSet.GetOIDCConfig(), oauth2conf, provider)
}
localCfg.UpsertUser(localconfig.User{
@@ -71,5 +83,6 @@ func NewReloginCommand(globalClientOpts *argocdclient.ClientOptions) *cobra.Comm
},
}
command.Flags().StringVar(&password, "password", "", "the password of an account to authenticate")
command.Flags().IntVar(&ssoPort, "sso-port", DefaultSSOLocalPort, "port to run local OAuth2 login application")
return command
}

View File

@@ -10,20 +10,21 @@ import (
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/argoproj/argo-cd/errors"
cmdutil "github.com/argoproj/argo-cd/cmd/util"
argocdclient "github.com/argoproj/argo-cd/pkg/apiclient"
repositorypkg "github.com/argoproj/argo-cd/pkg/apiclient/repository"
appsv1 "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/server/repository"
"github.com/argoproj/argo-cd/util"
"github.com/argoproj/argo-cd/util/cli"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/git"
"github.com/argoproj/argo-cd/util/io"
)
// NewRepoCommand returns a new instance of an `argocd repo` command
func NewRepoCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "repo",
Short: "Manage git repository credentials",
Short: "Manage repository connection parameters",
Run: func(c *cobra.Command, args []string) {
c.HelpFunc()(c, args)
os.Exit(1)
@@ -31,6 +32,7 @@ func NewRepoCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
}
command.AddCommand(NewRepoAddCommand(clientOpts))
command.AddCommand(NewRepoGetCommand(clientOpts))
command.AddCommand(NewRepoListCommand(clientOpts))
command.AddCommand(NewRepoRemoveCommand(clientOpts))
return command
@@ -39,56 +41,161 @@ func NewRepoCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
// NewRepoAddCommand returns a new instance of an `argocd repo add` command
func NewRepoAddCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
repo appsv1.Repository
upsert bool
sshPrivateKeyPath string
repoOpts cmdutil.RepoOptions
)
// For better readability and easier formatting
var repoAddExamples = ` # Add a Git repository via SSH using a private key for authentication, ignoring the server's host key:
argocd repo add git@git.example.com:repos/repo --insecure-ignore-host-key --ssh-private-key-path ~/id_rsa
# Add a Git repository via SSH on a non-default port - need to use ssh:// style URLs here
argocd repo add ssh://git@git.example.com:2222/repos/repo --ssh-private-key-path ~/id_rsa
# Add a private Git repository via HTTPS using username/password and TLS client certificates:
argocd repo add https://git.example.com/repos/repo --username git --password secret --tls-client-cert-path ~/mycert.crt --tls-client-cert-key-path ~/mycert.key
# Add a private Git repository via HTTPS using username/password without verifying the server's TLS certificate
argocd repo add https://git.example.com/repos/repo --username git --password secret --insecure-skip-server-verification
# Add a public Helm repository named 'stable' via HTTPS
argocd repo add https://kubernetes-charts.storage.googleapis.com --type helm --name stable
# Add a private Helm repository named 'stable' via HTTPS
argocd repo add https://kubernetes-charts.storage.googleapis.com --type helm --name stable --username test --password test
# Add a private Helm OCI-based repository named 'stable' via HTTPS
argocd repo add helm-oci-registry.cn-zhangjiakou.cr.aliyuncs.com --type helm --name stable --enable-oci --username test --password test
# Add a private Git repository on GitHub.com via GitHub App
argocd repo add https://git.example.com/repos/repo --github-app-id 1 --github-app-installation-id 2 --github-app-private-key-path test.private-key.pem
# Add a private Git repository on GitHub Enterprise via GitHub App
argocd repo add https://ghe.example.com/repos/repo --github-app-id 1 --github-app-installation-id 2 --github-app-private-key-path test.private-key.pem --github-app-enterprise-base-url https://ghe.example.com/api/v3
`
var command = &cobra.Command{
Use: "add REPO",
Short: "Add git repository credentials",
Use: "add REPOURL",
Short: "Add git repository connection parameters",
Example: repoAddExamples,
Run: func(c *cobra.Command, args []string) {
if len(args) != 1 {
c.HelpFunc()(c, args)
os.Exit(1)
}
repo.Repo = args[0]
if sshPrivateKeyPath != "" {
keyData, err := ioutil.ReadFile(sshPrivateKeyPath)
if err != nil {
log.Fatal(err)
// Repository URL
repoOpts.Repo.Repo = args[0]
// Specifying ssh-private-key-path is only valid for SSH repositories
if repoOpts.SshPrivateKeyPath != "" {
if ok, _ := git.IsSSHURL(repoOpts.Repo.Repo); ok {
keyData, err := ioutil.ReadFile(repoOpts.SshPrivateKeyPath)
if err != nil {
log.Fatal(err)
}
repoOpts.Repo.SSHPrivateKey = string(keyData)
} else {
err := fmt.Errorf("--ssh-private-key-path is only supported for SSH repositories.")
errors.CheckError(err)
}
repo.SSHPrivateKey = string(keyData)
}
// First test the repo *without* username/password. This gives us a hint on whether this
// is a private repo.
// NOTE: it is important not to run git commands to test git credentials on the user's
// system since it may mess with their git credential store (e.g. osx keychain).
// See issue #315
err := git.TestRepo(repo.Repo, "", "", repo.SSHPrivateKey)
if err != nil {
if git.IsSSHURL(repo.Repo) {
// If we failed using git SSH credentials, then the repo is automatically bad
log.Fatal(err)
// tls-client-cert-path and tls-client-cert-key-key-path must always be
// specified together
if (repoOpts.TlsClientCertPath != "" && repoOpts.TlsClientCertKeyPath == "") || (repoOpts.TlsClientCertPath == "" && repoOpts.TlsClientCertKeyPath != "") {
err := fmt.Errorf("--tls-client-cert-path and --tls-client-cert-key-path must be specified together")
errors.CheckError(err)
}
// Specifying tls-client-cert-path is only valid for HTTPS repositories
if repoOpts.TlsClientCertPath != "" {
if git.IsHTTPSURL(repoOpts.Repo.Repo) {
tlsCertData, err := ioutil.ReadFile(repoOpts.TlsClientCertPath)
errors.CheckError(err)
tlsCertKey, err := ioutil.ReadFile(repoOpts.TlsClientCertKeyPath)
errors.CheckError(err)
repoOpts.Repo.TLSClientCertData = string(tlsCertData)
repoOpts.Repo.TLSClientCertKey = string(tlsCertKey)
} else {
err := fmt.Errorf("--tls-client-cert-path is only supported for HTTPS repositories")
errors.CheckError(err)
}
// If we can't test the repo, it's probably private. Prompt for credentials and
// let the server test it.
repo.Username, repo.Password = cli.PromptCredentials(repo.Username, repo.Password)
}
// Specifying github-app-private-key-path is only valid for HTTPS repositories
if repoOpts.GithubAppPrivateKeyPath != "" {
if git.IsHTTPSURL(repoOpts.Repo.Repo) {
githubAppPrivateKey, err := ioutil.ReadFile(repoOpts.GithubAppPrivateKeyPath)
errors.CheckError(err)
repoOpts.Repo.GithubAppPrivateKey = string(githubAppPrivateKey)
} else {
err := fmt.Errorf("--github-app-private-key-path is only supported for HTTPS repositories")
errors.CheckError(err)
}
}
// Set repository connection properties only when creating repository, not
// when creating repository credentials.
// InsecureIgnoreHostKey is deprecated and only here for backwards compat
repoOpts.Repo.InsecureIgnoreHostKey = repoOpts.InsecureIgnoreHostKey
repoOpts.Repo.Insecure = repoOpts.InsecureSkipServerVerification
repoOpts.Repo.EnableLFS = repoOpts.EnableLfs
repoOpts.Repo.EnableOCI = repoOpts.EnableOci
repoOpts.Repo.GithubAppId = repoOpts.GithubAppId
repoOpts.Repo.GithubAppInstallationId = repoOpts.GithubAppInstallationId
repoOpts.Repo.GitHubAppEnterpriseBaseURL = repoOpts.GitHubAppEnterpriseBaseURL
if repoOpts.Repo.Type == "helm" && repoOpts.Repo.Name == "" {
errors.CheckError(fmt.Errorf("Must specify --name for repos of type 'helm'"))
}
conn, repoIf := argocdclient.NewClientOrDie(clientOpts).NewRepoClientOrDie()
defer util.Close(conn)
repoCreateReq := repository.RepoCreateRequest{
Repo: &repo,
Upsert: upsert,
defer io.Close(conn)
// If the user set a username, but didn't supply password via --password,
// then we prompt for it
if repoOpts.Repo.Username != "" && repoOpts.Repo.Password == "" {
repoOpts.Repo.Password = cli.PromptPassword(repoOpts.Repo.Password)
}
// We let the server check access to the repository before adding it. If
// it is a private repo, but we cannot access with with the credentials
// that were supplied, we bail out.
//
// Skip validation if we are just adding credentials template, chances
// are high that we do not have the given URL pointing to a valid Git
// repo anyway.
repoAccessReq := repositorypkg.RepoAccessQuery{
Repo: repoOpts.Repo.Repo,
Type: repoOpts.Repo.Type,
Name: repoOpts.Repo.Name,
Username: repoOpts.Repo.Username,
Password: repoOpts.Repo.Password,
SshPrivateKey: repoOpts.Repo.SSHPrivateKey,
TlsClientCertData: repoOpts.Repo.TLSClientCertData,
TlsClientCertKey: repoOpts.Repo.TLSClientCertKey,
Insecure: repoOpts.Repo.IsInsecure(),
EnableOci: repoOpts.Repo.EnableOCI,
GithubAppPrivateKey: repoOpts.Repo.GithubAppPrivateKey,
GithubAppID: repoOpts.Repo.GithubAppId,
GithubAppInstallationID: repoOpts.Repo.GithubAppInstallationId,
GithubAppEnterpriseBaseUrl: repoOpts.Repo.GitHubAppEnterpriseBaseURL,
}
_, err := repoIf.ValidateAccess(context.Background(), &repoAccessReq)
errors.CheckError(err)
repoCreateReq := repositorypkg.RepoCreateRequest{
Repo: &repoOpts.Repo,
Upsert: repoOpts.Upsert,
}
createdRepo, err := repoIf.Create(context.Background(), &repoCreateReq)
errors.CheckError(err)
fmt.Printf("repository '%s' added\n", createdRepo.Repo)
fmt.Printf("Repository '%s' added\n", createdRepo.Repo)
},
}
command.Flags().StringVar(&repo.Username, "username", "", "username to the repository")
command.Flags().StringVar(&repo.Password, "password", "", "password to the repository")
command.Flags().StringVar(&sshPrivateKeyPath, "sshPrivateKeyPath", "", "path to the private ssh key (e.g. ~/.ssh/id_rsa)")
command.Flags().BoolVar(&upsert, "upsert", false, "Override an existing repository with the same name even if the spec differs")
command.Flags().BoolVar(&repoOpts.Upsert, "upsert", false, "Override an existing repository with the same name even if the spec differs")
cmdutil.AddRepoFlags(command, &repoOpts)
return command
}
@@ -96,40 +203,138 @@ func NewRepoAddCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
func NewRepoRemoveCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "rm REPO",
Short: "Remove git repository credentials",
Short: "Remove repository credentials",
Run: func(c *cobra.Command, args []string) {
if len(args) == 0 {
c.HelpFunc()(c, args)
os.Exit(1)
}
conn, repoIf := argocdclient.NewClientOrDie(clientOpts).NewRepoClientOrDie()
defer util.Close(conn)
defer io.Close(conn)
for _, repoURL := range args {
_, err := repoIf.Delete(context.Background(), &repository.RepoQuery{Repo: repoURL})
_, err := repoIf.Delete(context.Background(), &repositorypkg.RepoQuery{Repo: repoURL})
errors.CheckError(err)
fmt.Printf("Repository '%s' removed\n", repoURL)
}
},
}
return command
}
// Print table of repo info
func printRepoTable(repos appsv1.Repositories) {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
_, _ = fmt.Fprintf(w, "TYPE\tNAME\tREPO\tINSECURE\tOCI\tLFS\tCREDS\tSTATUS\tMESSAGE\n")
for _, r := range repos {
var hasCreds string
if !r.HasCredentials() {
hasCreds = "false"
} else {
if r.InheritedCreds {
hasCreds = "inherited"
} else {
hasCreds = "true"
}
}
_, _ = fmt.Fprintf(w, "%s\t%s\t%s\t%v\t%v\t%v\t%s\t%s\t%s\n", r.Type, r.Name, r.Repo, r.IsInsecure(), r.EnableOCI, r.EnableLFS, hasCreds, r.ConnectionState.Status, r.ConnectionState.Message)
}
_ = w.Flush()
}
// Print list of repo urls or url patterns for repository credentials
func printRepoUrls(repos appsv1.Repositories) {
for _, r := range repos {
fmt.Println(r.Repo)
}
}
// NewRepoListCommand returns a new instance of an `argocd repo rm` command
func NewRepoListCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
output string
refresh string
)
var command = &cobra.Command{
Use: "list",
Short: "List configured repositories",
Run: func(c *cobra.Command, args []string) {
conn, repoIf := argocdclient.NewClientOrDie(clientOpts).NewRepoClientOrDie()
defer util.Close(conn)
repos, err := repoIf.List(context.Background(), &repository.RepoQuery{})
errors.CheckError(err)
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
fmt.Fprintf(w, "REPO\tUSER\tSTATUS\tMESSAGE\n")
for _, r := range repos.Items {
fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", r.Repo, r.Username, r.ConnectionState.Status, r.ConnectionState.Message)
defer io.Close(conn)
forceRefresh := false
switch refresh {
case "":
case "hard":
forceRefresh = true
default:
err := fmt.Errorf("--refresh must be one of: 'hard'")
errors.CheckError(err)
}
repos, err := repoIf.List(context.Background(), &repositorypkg.RepoQuery{ForceRefresh: forceRefresh})
errors.CheckError(err)
switch output {
case "yaml", "json":
err := PrintResourceList(repos.Items, output, false)
errors.CheckError(err)
case "url":
printRepoUrls(repos.Items)
// wide is the default
case "wide", "":
printRepoTable(repos.Items)
default:
errors.CheckError(fmt.Errorf("unknown output format: %s", output))
}
_ = w.Flush()
},
}
command.Flags().StringVarP(&output, "output", "o", "wide", "Output format. One of: json|yaml|wide|url")
command.Flags().StringVar(&refresh, "refresh", "", "Force a cache refresh on connection status")
return command
}
// NewRepoGetCommand returns a new instance of an `argocd repo rm` command
func NewRepoGetCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
output string
refresh string
)
var command = &cobra.Command{
Use: "get",
Short: "Get a configured repository by URL",
Run: func(c *cobra.Command, args []string) {
if len(args) != 1 {
c.HelpFunc()(c, args)
os.Exit(1)
}
// Repository URL
repoURL := args[0]
conn, repoIf := argocdclient.NewClientOrDie(clientOpts).NewRepoClientOrDie()
defer io.Close(conn)
forceRefresh := false
switch refresh {
case "":
case "hard":
forceRefresh = true
default:
err := fmt.Errorf("--refresh must be one of: 'hard'")
errors.CheckError(err)
}
repo, err := repoIf.Get(context.Background(), &repositorypkg.RepoQuery{Repo: repoURL, ForceRefresh: forceRefresh})
errors.CheckError(err)
switch output {
case "yaml", "json":
err := PrintResource(repo, output)
errors.CheckError(err)
case "url":
fmt.Println(repo.Repo)
// wide is the default
case "wide", "":
printRepoTable(appsv1.Repositories{repo})
default:
errors.CheckError(fmt.Errorf("unknown output format: %s", output))
}
},
}
command.Flags().StringVarP(&output, "output", "o", "wide", "Output format. One of: json|yaml|wide|url")
command.Flags().StringVar(&refresh, "refresh", "", "Force a cache refresh on connection status")
return command
}

View File

@@ -0,0 +1,227 @@
package commands
import (
"context"
"fmt"
"io/ioutil"
"os"
"text/tabwriter"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
argocdclient "github.com/argoproj/argo-cd/pkg/apiclient"
repocredspkg "github.com/argoproj/argo-cd/pkg/apiclient/repocreds"
appsv1 "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/util/cli"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/git"
"github.com/argoproj/argo-cd/util/io"
)
// NewRepoCredsCommand returns a new instance of an `argocd repocreds` command
func NewRepoCredsCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "repocreds",
Short: "Manage repository connection parameters",
Run: func(c *cobra.Command, args []string) {
c.HelpFunc()(c, args)
os.Exit(1)
},
}
command.AddCommand(NewRepoCredsAddCommand(clientOpts))
command.AddCommand(NewRepoCredsListCommand(clientOpts))
command.AddCommand(NewRepoCredsRemoveCommand(clientOpts))
return command
}
// NewRepoCredsAddCommand returns a new instance of an `argocd repocreds add` command
func NewRepoCredsAddCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
repo appsv1.RepoCreds
upsert bool
sshPrivateKeyPath string
tlsClientCertPath string
tlsClientCertKeyPath string
githubAppPrivateKeyPath string
)
// For better readability and easier formatting
var repocredsAddExamples = ` # Add credentials with user/pass authentication to use for all repositories under https://git.example.com/repos
argocd repocreds add https://git.example.com/repos/ --username git --password secret
# Add credentials with SSH private key authentication to use for all repositories under ssh://git@git.example.com/repos
argocd repocreds add ssh://git@git.example.com/repos/ --ssh-private-key-path ~/.ssh/id_rsa
# Add credentials with GitHub App authentication to use for all repositories under https://github.com/repos
argocd repocreds add https://github.com/repos/ --github-app-id 1 --github-app-installation-id 2 --github-app-private-key-path test.private-key.pem
# Add credentials with GitHub App authentication to use for all repositories under https://ghe.example.com/repos
argocd repocreds add https://ghe.example.com/repos/ --github-app-id 1 --github-app-installation-id 2 --github-app-private-key-path test.private-key.pem --github-app-enterprise-base-url https://ghe.example.com/api/v3
`
var command = &cobra.Command{
Use: "add REPOURL",
Short: "Add git repository connection parameters",
Example: repocredsAddExamples,
Run: func(c *cobra.Command, args []string) {
if len(args) != 1 {
c.HelpFunc()(c, args)
os.Exit(1)
}
// Repository URL
repo.URL = args[0]
// Specifying ssh-private-key-path is only valid for SSH repositories
if sshPrivateKeyPath != "" {
if ok, _ := git.IsSSHURL(repo.URL); ok {
keyData, err := ioutil.ReadFile(sshPrivateKeyPath)
if err != nil {
log.Fatal(err)
}
repo.SSHPrivateKey = string(keyData)
} else {
err := fmt.Errorf("--ssh-private-key-path is only supported for SSH repositories.")
errors.CheckError(err)
}
}
// tls-client-cert-path and tls-client-cert-key-key-path must always be
// specified together
if (tlsClientCertPath != "" && tlsClientCertKeyPath == "") || (tlsClientCertPath == "" && tlsClientCertKeyPath != "") {
err := fmt.Errorf("--tls-client-cert-path and --tls-client-cert-key-path must be specified together")
errors.CheckError(err)
}
// Specifying tls-client-cert-path is only valid for HTTPS repositories
if tlsClientCertPath != "" {
if git.IsHTTPSURL(repo.URL) {
tlsCertData, err := ioutil.ReadFile(tlsClientCertPath)
errors.CheckError(err)
tlsCertKey, err := ioutil.ReadFile(tlsClientCertKeyPath)
errors.CheckError(err)
repo.TLSClientCertData = string(tlsCertData)
repo.TLSClientCertKey = string(tlsCertKey)
} else {
err := fmt.Errorf("--tls-client-cert-path is only supported for HTTPS repositories")
errors.CheckError(err)
}
}
// Specifying github-app-private-key-path is only valid for HTTPS repositories
if githubAppPrivateKeyPath != "" {
if git.IsHTTPSURL(repo.URL) {
githubAppPrivateKey, err := ioutil.ReadFile(githubAppPrivateKeyPath)
errors.CheckError(err)
repo.GithubAppPrivateKey = string(githubAppPrivateKey)
} else {
err := fmt.Errorf("--github-app-private-key-path is only supported for HTTPS repositories")
errors.CheckError(err)
}
}
conn, repoIf := argocdclient.NewClientOrDie(clientOpts).NewRepoCredsClientOrDie()
defer io.Close(conn)
// If the user set a username, but didn't supply password via --password,
// then we prompt for it
if repo.Username != "" && repo.Password == "" {
repo.Password = cli.PromptPassword(repo.Password)
}
repoCreateReq := repocredspkg.RepoCredsCreateRequest{
Creds: &repo,
Upsert: upsert,
}
createdRepo, err := repoIf.CreateRepositoryCredentials(context.Background(), &repoCreateReq)
errors.CheckError(err)
fmt.Printf("Repository credentials for '%s' added\n", createdRepo.URL)
},
}
command.Flags().StringVar(&repo.Username, "username", "", "username to the repository")
command.Flags().StringVar(&repo.Password, "password", "", "password to the repository")
command.Flags().StringVar(&sshPrivateKeyPath, "ssh-private-key-path", "", "path to the private ssh key (e.g. ~/.ssh/id_rsa)")
command.Flags().StringVar(&tlsClientCertPath, "tls-client-cert-path", "", "path to the TLS client cert (must be PEM format)")
command.Flags().StringVar(&tlsClientCertKeyPath, "tls-client-cert-key-path", "", "path to the TLS client cert's key path (must be PEM format)")
command.Flags().Int64Var(&repo.GithubAppId, "github-app-id", 0, "id of the GitHub Application")
command.Flags().Int64Var(&repo.GithubAppInstallationId, "github-app-installation-id", 0, "installation id of the GitHub Application")
command.Flags().StringVar(&githubAppPrivateKeyPath, "github-app-private-key-path", "", "private key of the GitHub Application")
command.Flags().StringVar(&repo.GitHubAppEnterpriseBaseURL, "github-app-enterprise-base-url", "", "base url to use when using GitHub Enterprise (e.g. https://ghe.example.com/api/v3")
command.Flags().BoolVar(&upsert, "upsert", false, "Override an existing repository with the same name even if the spec differs")
return command
}
// NewRepoCredsRemoveCommand returns a new instance of an `argocd repocreds rm` command
func NewRepoCredsRemoveCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "rm CREDSURL",
Short: "Remove repository credentials",
Run: func(c *cobra.Command, args []string) {
if len(args) == 0 {
c.HelpFunc()(c, args)
os.Exit(1)
}
conn, repoIf := argocdclient.NewClientOrDie(clientOpts).NewRepoCredsClientOrDie()
defer io.Close(conn)
for _, repoURL := range args {
_, err := repoIf.DeleteRepositoryCredentials(context.Background(), &repocredspkg.RepoCredsDeleteRequest{Url: repoURL})
errors.CheckError(err)
fmt.Printf("Repository credentials for '%s' removed\n", repoURL)
}
},
}
return command
}
// Print the repository credentials as table
func printRepoCredsTable(repos []appsv1.RepoCreds) {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
fmt.Fprintf(w, "URL PATTERN\tUSERNAME\tSSH_CREDS\tTLS_CREDS\n")
for _, r := range repos {
if r.Username == "" {
r.Username = "-"
}
fmt.Fprintf(w, "%s\t%s\t%v\t%v\n", r.URL, r.Username, r.SSHPrivateKey != "", r.TLSClientCertData != "")
}
_ = w.Flush()
}
// Print list of repo urls or url patterns for repository credentials
func printRepoCredsUrls(repos []appsv1.RepoCreds) {
for _, r := range repos {
fmt.Println(r.URL)
}
}
// NewRepoCredsListCommand returns a new instance of an `argocd repo list` command
func NewRepoCredsListCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
output string
)
var command = &cobra.Command{
Use: "list",
Short: "List configured repository credentials",
Run: func(c *cobra.Command, args []string) {
conn, repoIf := argocdclient.NewClientOrDie(clientOpts).NewRepoCredsClientOrDie()
defer io.Close(conn)
repos, err := repoIf.ListRepositoryCredentials(context.Background(), &repocredspkg.RepoCredsQuery{})
errors.CheckError(err)
switch output {
case "yaml", "json":
err := PrintResourceList(repos.Items, output, false)
errors.CheckError(err)
case "url":
printRepoCredsUrls(repos.Items)
case "wide", "":
printRepoCredsTable(repos.Items)
default:
errors.CheckError(fmt.Errorf("unknown output format: %s", output))
}
},
}
command.Flags().StringVarP(&output, "output", "o", "wide", "Output format. One of: json|yaml|wide|url")
return command
}

View File

@@ -1,13 +1,26 @@
package commands
import (
"github.com/argoproj/argo-cd/errors"
argocdclient "github.com/argoproj/argo-cd/pkg/apiclient"
"github.com/argoproj/argo-cd/util/localconfig"
"github.com/spf13/cobra"
"k8s.io/client-go/tools/clientcmd"
cmdutil "github.com/argoproj/argo-cd/cmd/util"
argocdclient "github.com/argoproj/argo-cd/pkg/apiclient"
"github.com/argoproj/argo-cd/util/cli"
"github.com/argoproj/argo-cd/util/config"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/localconfig"
)
func init() {
cobra.OnInitialize(initConfig)
}
func initConfig() {
cli.SetLogFormat(cmdutil.LogFormat)
cli.SetLogLevel(cmdutil.LogLevel)
}
// NewCommand returns a new instance of an argocd command
func NewCommand() *cobra.Command {
var (
@@ -17,30 +30,44 @@ func NewCommand() *cobra.Command {
var command = &cobra.Command{
Use: cliName,
Short: "argocd controls a ArgoCD server",
Short: "argocd controls a Argo CD server",
Run: func(c *cobra.Command, args []string) {
c.HelpFunc()(c, args)
},
DisableAutoGenTag: true,
}
command.AddCommand(NewCompletionCommand())
command.AddCommand(NewVersionCmd(&clientOpts))
command.AddCommand(NewClusterCommand(&clientOpts, pathOpts))
command.AddCommand(NewApplicationCommand(&clientOpts))
command.AddCommand(NewLoginCommand(&clientOpts))
command.AddCommand(NewReloginCommand(&clientOpts))
command.AddCommand(NewRepoCommand(&clientOpts))
command.AddCommand(NewRepoCredsCommand(&clientOpts))
command.AddCommand(NewContextCommand(&clientOpts))
command.AddCommand(NewProjectCommand(&clientOpts))
command.AddCommand(NewAccountCommand(&clientOpts))
command.AddCommand(NewLogoutCommand(&clientOpts))
command.AddCommand(NewCertCommand(&clientOpts))
command.AddCommand(NewGPGCommand(&clientOpts))
defaultLocalConfigPath, err := localconfig.DefaultLocalConfigPath()
errors.CheckError(err)
command.PersistentFlags().StringVar(&clientOpts.ConfigPath, "config", defaultLocalConfigPath, "Path to ArgoCD config")
command.PersistentFlags().StringVar(&clientOpts.ServerAddr, "server", "", "ArgoCD server address")
command.PersistentFlags().BoolVar(&clientOpts.PlainText, "plaintext", false, "Disable TLS")
command.PersistentFlags().BoolVar(&clientOpts.Insecure, "insecure", false, "Skip server certificate and domain verification")
command.PersistentFlags().StringVar(&clientOpts.CertFile, "server-crt", "", "Server certificate file")
command.PersistentFlags().StringVar(&clientOpts.AuthToken, "auth-token", "", "Authentication token")
command.PersistentFlags().StringVar(&clientOpts.ConfigPath, "config", config.GetFlag("config", defaultLocalConfigPath), "Path to Argo CD config")
command.PersistentFlags().StringVar(&clientOpts.ServerAddr, "server", config.GetFlag("server", ""), "Argo CD server address")
command.PersistentFlags().BoolVar(&clientOpts.PlainText, "plaintext", config.GetBoolFlag("plaintext"), "Disable TLS")
command.PersistentFlags().BoolVar(&clientOpts.Insecure, "insecure", config.GetBoolFlag("insecure"), "Skip server certificate and domain verification")
command.PersistentFlags().StringVar(&clientOpts.CertFile, "server-crt", config.GetFlag("server-crt", ""), "Server certificate file")
command.PersistentFlags().StringVar(&clientOpts.ClientCertFile, "client-crt", config.GetFlag("client-crt", ""), "Client certificate file")
command.PersistentFlags().StringVar(&clientOpts.ClientCertKeyFile, "client-crt-key", config.GetFlag("client-crt-key", ""), "Client certificate key file")
command.PersistentFlags().StringVar(&clientOpts.AuthToken, "auth-token", config.GetFlag("auth-token", ""), "Authentication token")
command.PersistentFlags().BoolVar(&clientOpts.GRPCWeb, "grpc-web", config.GetBoolFlag("grpc-web"), "Enables gRPC-web protocol. Useful if Argo CD server is behind proxy which does not support HTTP2.")
command.PersistentFlags().StringVar(&clientOpts.GRPCWebRootPath, "grpc-web-root-path", config.GetFlag("grpc-web-root-path", ""), "Enables gRPC-web protocol. Useful if Argo CD server is behind proxy which does not support HTTP2. Set web root.")
command.PersistentFlags().StringVar(&cmdutil.LogFormat, "logformat", config.GetFlag("logformat", "text"), "Set the logging format. One of: text|json")
command.PersistentFlags().StringVar(&cmdutil.LogLevel, "loglevel", config.GetFlag("loglevel", "info"), "Set the logging level. One of: debug|info|warn|error")
command.PersistentFlags().StringSliceVarP(&clientOpts.Headers, "header", "H", []string{}, "Sets additional header to all requests made by Argo CD CLI. (Can be repeated multiple times to add multiple headers, also supports comma separated headers)")
command.PersistentFlags().BoolVar(&clientOpts.PortForward, "port-forward", config.GetBoolFlag("port-forward"), "Connect to a random argocd-server port using port forwarding")
command.PersistentFlags().StringVar(&clientOpts.PortForwardNamespace, "port-forward-namespace", config.GetFlag("port-forward-namespace", ""), "Namespace name which should be used for port forwarding")
return command
}

25
cmd/argocd/commands/testdata/config vendored Normal file
View File

@@ -0,0 +1,25 @@
contexts:
- name: argocd1.example.com:443
server: argocd1.example.com:443
user: argocd1.example.com:443
- name: argocd2.example.com:443
server: argocd2.example.com:443
user: argocd2.example.com:443
- name: localhost:8080
server: localhost:8080
user: localhost:8080
current-context: localhost:8080
servers:
- server: argocd1.example.com:443
- server: argocd2.example.com:443
- plain-text: true
server: localhost:8080
users:
- auth-token: vErrYS3c3tReFRe$hToken
name: argocd1.example.com:443
refresh-token: vErrYS3c3tReFRe$hToken
- auth-token: vErrYS3c3tReFRe$hToken
name: argocd2.example.com:443
refresh-token: vErrYS3c3tReFRe$hToken
- auth-token: vErrYS3c3tReFRe$hToken
name: localhost:8080

View File

@@ -4,62 +4,152 @@ import (
"context"
"fmt"
argocd "github.com/argoproj/argo-cd"
"github.com/argoproj/argo-cd/errors"
argocdclient "github.com/argoproj/argo-cd/pkg/apiclient"
"github.com/argoproj/argo-cd/util"
"github.com/golang/protobuf/ptypes/empty"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/argoproj/argo-cd/common"
argocdclient "github.com/argoproj/argo-cd/pkg/apiclient"
"github.com/argoproj/argo-cd/pkg/apiclient/version"
"github.com/argoproj/argo-cd/util/errors"
argoio "github.com/argoproj/argo-cd/util/io"
)
// NewVersionCmd returns a new `version` command to be used as a sub-command to root
func NewVersionCmd(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var short bool
var client bool
var (
short bool
client bool
output string
)
versionCmd := cobra.Command{
Use: "version",
Short: fmt.Sprintf("Print version information"),
Short: "Print version information",
Example: ` # Print the full version of client and server to stdout
argocd version
# Print only full version of the client - no connection to server will be made
argocd version --client
# Print the full version of client and server in JSON format
argocd version -o json
# Print only client and server core version strings in YAML format
argocd version --short -o yaml
`,
Run: func(cmd *cobra.Command, args []string) {
version := argocd.GetVersion()
fmt.Printf("%s: %s\n", cliName, version)
if !short {
fmt.Printf(" BuildDate: %s\n", version.BuildDate)
fmt.Printf(" GitCommit: %s\n", version.GitCommit)
fmt.Printf(" GitTreeState: %s\n", version.GitTreeState)
if version.GitTag != "" {
fmt.Printf(" GitTag: %s\n", version.GitTag)
}
fmt.Printf(" GoVersion: %s\n", version.GoVersion)
fmt.Printf(" Compiler: %s\n", version.Compiler)
fmt.Printf(" Platform: %s\n", version.Platform)
}
if client {
return
}
cv := common.GetVersion()
// Get Server version
conn, versionIf := argocdclient.NewClientOrDie(clientOpts).NewVersionClientOrDie()
defer util.Close(conn)
serverVers, err := versionIf.Version(context.Background(), &empty.Empty{})
errors.CheckError(err)
fmt.Printf("%s: %s\n", "argocd-server", serverVers.Version)
if !short {
fmt.Printf(" BuildDate: %s\n", serverVers.BuildDate)
fmt.Printf(" GitCommit: %s\n", serverVers.GitCommit)
fmt.Printf(" GitTreeState: %s\n", serverVers.GitTreeState)
if version.GitTag != "" {
fmt.Printf(" GitTag: %s\n", serverVers.GitTag)
}
fmt.Printf(" GoVersion: %s\n", serverVers.GoVersion)
fmt.Printf(" Compiler: %s\n", serverVers.Compiler)
fmt.Printf(" Platform: %s\n", serverVers.Platform)
fmt.Printf(" Ksonnet Version: %s\n", serverVers.KsonnetVersion)
}
switch output {
case "yaml", "json":
v := make(map[string]interface{})
if short {
v["client"] = map[string]string{cliName: cv.Version}
} else {
v["client"] = cv
}
if !client {
sv := getServerVersion(clientOpts)
if short {
v["server"] = map[string]string{"argocd-server": sv.Version}
} else {
v["server"] = sv
}
}
err := PrintResource(v, output)
errors.CheckError(err)
case "wide", "short", "":
printClientVersion(&cv, short || (output == "short"))
if !client {
sv := getServerVersion(clientOpts)
printServerVersion(sv, short || (output == "short"))
}
default:
log.Fatalf("unknown output format: %s", output)
}
},
}
versionCmd.Flags().StringVarP(&output, "output", "o", "wide", "Output format. One of: json|yaml|wide|short")
versionCmd.Flags().BoolVar(&short, "short", false, "print just the version number")
versionCmd.Flags().BoolVar(&client, "client", false, "client version only (no server required)")
return &versionCmd
}
func getServerVersion(options *argocdclient.ClientOptions) *version.VersionMessage {
conn, versionIf := argocdclient.NewClientOrDie(options).NewVersionClientOrDie()
defer argoio.Close(conn)
v, err := versionIf.Version(context.Background(), &empty.Empty{})
errors.CheckError(err)
return v
}
func printClientVersion(version *common.Version, short bool) {
fmt.Printf("%s: %s\n", cliName, version)
if short {
return
}
fmt.Printf(" BuildDate: %s\n", version.BuildDate)
fmt.Printf(" GitCommit: %s\n", version.GitCommit)
fmt.Printf(" GitTreeState: %s\n", version.GitTreeState)
if version.GitTag != "" {
fmt.Printf(" GitTag: %s\n", version.GitTag)
}
fmt.Printf(" GoVersion: %s\n", version.GoVersion)
fmt.Printf(" Compiler: %s\n", version.Compiler)
fmt.Printf(" Platform: %s\n", version.Platform)
}
func printServerVersion(version *version.VersionMessage, short bool) {
fmt.Printf("%s: %s\n", "argocd-server", version.Version)
if short {
return
}
if version.BuildDate != "" {
fmt.Printf(" BuildDate: %s\n", version.BuildDate)
}
if version.GitCommit != "" {
fmt.Printf(" GitCommit: %s\n", version.GitCommit)
}
if version.GitTreeState != "" {
fmt.Printf(" GitTreeState: %s\n", version.GitTreeState)
}
if version.GitTag != "" {
fmt.Printf(" GitTag: %s\n", version.GitTag)
}
if version.GoVersion != "" {
fmt.Printf(" GoVersion: %s\n", version.GoVersion)
}
if version.Compiler != "" {
fmt.Printf(" Compiler: %s\n", version.Compiler)
}
if version.Platform != "" {
fmt.Printf(" Platform: %s\n", version.Platform)
}
if version.KsonnetVersion != "" {
fmt.Printf(" Ksonnet Version: %s\n", version.KsonnetVersion)
}
if version.KustomizeVersion != "" {
fmt.Printf(" Kustomize Version: %s\n", version.KustomizeVersion)
}
if version.HelmVersion != "" {
fmt.Printf(" Helm Version: %s\n", version.HelmVersion)
}
if version.KubectlVersion != "" {
fmt.Printf(" Kubectl Version: %s\n", version.KubectlVersion)
}
if version.JsonnetVersion != "" {
fmt.Printf(" Jsonnet Version: %s\n", version.JsonnetVersion)
}
}

View File

@@ -1,16 +0,0 @@
package main
import (
commands "github.com/argoproj/argo-cd/cmd/argocd/commands"
"github.com/argoproj/argo-cd/errors"
// load the gcp plugin (required to authenticate against GKE clusters).
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
// load the oidc plugin (required to authenticate with OpenID Connect).
_ "k8s.io/client-go/plugin/pkg/client/auth/oidc"
)
func main() {
err := commands.NewCommand().Execute()
errors.CheckError(err)
}

64
cmd/main.go Normal file
View File

@@ -0,0 +1,64 @@
package main
import (
"fmt"
"os"
"path/filepath"
"github.com/spf13/cobra"
appcontroller "github.com/argoproj/argo-cd/cmd/argocd-application-controller/commands"
dex "github.com/argoproj/argo-cd/cmd/argocd-dex/commands"
reposerver "github.com/argoproj/argo-cd/cmd/argocd-repo-server/commands"
apiserver "github.com/argoproj/argo-cd/cmd/argocd-server/commands"
util "github.com/argoproj/argo-cd/cmd/argocd-util/commands"
cli "github.com/argoproj/argo-cd/cmd/argocd/commands"
)
const (
binaryNameEnv = "ARGOCD_BINARY_NAME"
)
func main() {
var command *cobra.Command
binaryName := filepath.Base(os.Args[0])
if val := os.Getenv(binaryNameEnv); val != "" {
binaryName = val
}
switch binaryName {
case "argocd", "argocd-linux-amd64", "argocd-darwin-amd64", "argocd-windows-amd64.exe":
command = cli.NewCommand()
case "argocd-util", "argocd-util-linux-amd64", "argocd-util-darwin-amd64", "argocd-util-windows-amd64.exe":
command = util.NewCommand()
case "argocd-server":
command = apiserver.NewCommand()
case "argocd-application-controller":
command = appcontroller.NewCommand()
case "argocd-repo-server":
command = reposerver.NewCommand()
case "argocd-dex":
command = dex.NewCommand()
default:
if len(os.Args[1:]) > 0 {
// trying to guess between argocd and argocd-util by matching sub command
for _, cmd := range []*cobra.Command{cli.NewCommand(), util.NewCommand()} {
if _, _, err := cmd.Find(os.Args[1:]); err == nil {
command = cmd
break
}
}
}
if command == nil {
fmt.Printf("Unknown binary name '%s'.Use '%s' environment variable to specify required binary name "+
"(possible values 'argocd' or 'argocd-util').\n", binaryName, binaryNameEnv)
os.Exit(1)
}
}
if err := command.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
}

558
cmd/util/app.go Normal file
View File

@@ -0,0 +1,558 @@
package util
import (
"bufio"
"fmt"
"io/ioutil"
"net/url"
"os"
"strings"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/argoproj/argo-cd/common"
"github.com/argoproj/argo-cd/pkg/apis/application"
argoappv1 "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/util/config"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/text/label"
)
type AppOptions struct {
repoURL string
appPath string
chart string
env string
revision string
revisionHistoryLimit int
destName string
destServer string
destNamespace string
Parameters []string
valuesFiles []string
values string
releaseName string
helmSets []string
helmSetStrings []string
helmSetFiles []string
helmVersion string
project string
syncPolicy string
syncOptions []string
autoPrune bool
selfHeal bool
allowEmpty bool
namePrefix string
nameSuffix string
directoryRecurse bool
configManagementPlugin string
jsonnetTlaStr []string
jsonnetTlaCode []string
jsonnetExtVarStr []string
jsonnetExtVarCode []string
jsonnetLibs []string
kustomizeImages []string
kustomizeVersion string
kustomizeCommonLabels []string
kustomizeCommonAnnotations []string
pluginEnvs []string
Validate bool
directoryExclude string
directoryInclude string
}
func AddAppFlags(command *cobra.Command, opts *AppOptions) {
command.Flags().StringVar(&opts.repoURL, "repo", "", "Repository URL, ignored if a file is set")
command.Flags().StringVar(&opts.appPath, "path", "", "Path in repository to the app directory, ignored if a file is set")
command.Flags().StringVar(&opts.chart, "helm-chart", "", "Helm Chart name")
command.Flags().StringVar(&opts.env, "env", "", "Application environment to monitor")
command.Flags().StringVar(&opts.revision, "revision", "", "The tracking source branch, tag, commit or Helm chart version the application will sync to")
command.Flags().IntVar(&opts.revisionHistoryLimit, "revision-history-limit", common.RevisionHistoryLimit, "How many items to keep in revision history")
command.Flags().StringVar(&opts.destServer, "dest-server", "", "K8s cluster URL (e.g. https://kubernetes.default.svc)")
command.Flags().StringVar(&opts.destName, "dest-name", "", "K8s cluster Name (e.g. minikube)")
command.Flags().StringVar(&opts.destNamespace, "dest-namespace", "", "K8s target namespace (overrides the namespace specified in the ksonnet app.yaml)")
command.Flags().StringArrayVarP(&opts.Parameters, "parameter", "p", []string{}, "set a parameter override (e.g. -p guestbook=image=example/guestbook:latest)")
command.Flags().StringArrayVar(&opts.valuesFiles, "values", []string{}, "Helm values file(s) to use")
command.Flags().StringVar(&opts.values, "values-literal-file", "", "Filename or URL to import as a literal Helm values block")
command.Flags().StringVar(&opts.releaseName, "release-name", "", "Helm release-name")
command.Flags().StringVar(&opts.helmVersion, "helm-version", "", "Helm version")
command.Flags().StringArrayVar(&opts.helmSets, "helm-set", []string{}, "Helm set values on the command line (can be repeated to set several values: --helm-set key1=val1 --helm-set key2=val2)")
command.Flags().StringArrayVar(&opts.helmSetStrings, "helm-set-string", []string{}, "Helm set STRING values on the command line (can be repeated to set several values: --helm-set-string key1=val1 --helm-set-string key2=val2)")
command.Flags().StringArrayVar(&opts.helmSetFiles, "helm-set-file", []string{}, "Helm set values from respective files specified via the command line (can be repeated to set several values: --helm-set-file key1=path1 --helm-set-file key2=path2)")
command.Flags().StringVar(&opts.project, "project", "", "Application project name")
command.Flags().StringVar(&opts.syncPolicy, "sync-policy", "", "Set the sync policy (one of: none, automated (aliases of automated: auto, automatic))")
command.Flags().StringArrayVar(&opts.syncOptions, "sync-option", []string{}, "Add or remove a sync option, e.g add `Prune=false`. Remove using `!` prefix, e.g. `!Prune=false`")
command.Flags().BoolVar(&opts.autoPrune, "auto-prune", false, "Set automatic pruning when sync is automated")
command.Flags().BoolVar(&opts.selfHeal, "self-heal", false, "Set self healing when sync is automated")
command.Flags().BoolVar(&opts.allowEmpty, "allow-empty", false, "Set allow zero live resources when sync is automated")
command.Flags().StringVar(&opts.namePrefix, "nameprefix", "", "Kustomize nameprefix")
command.Flags().StringVar(&opts.nameSuffix, "namesuffix", "", "Kustomize namesuffix")
command.Flags().StringVar(&opts.kustomizeVersion, "kustomize-version", "", "Kustomize version")
command.Flags().BoolVar(&opts.directoryRecurse, "directory-recurse", false, "Recurse directory")
command.Flags().StringVar(&opts.configManagementPlugin, "config-management-plugin", "", "Config management plugin name")
command.Flags().StringArrayVar(&opts.jsonnetTlaStr, "jsonnet-tla-str", []string{}, "Jsonnet top level string arguments")
command.Flags().StringArrayVar(&opts.jsonnetTlaCode, "jsonnet-tla-code", []string{}, "Jsonnet top level code arguments")
command.Flags().StringArrayVar(&opts.jsonnetExtVarStr, "jsonnet-ext-var-str", []string{}, "Jsonnet string ext var")
command.Flags().StringArrayVar(&opts.jsonnetExtVarCode, "jsonnet-ext-var-code", []string{}, "Jsonnet ext var")
command.Flags().StringArrayVar(&opts.jsonnetLibs, "jsonnet-libs", []string{}, "Additional jsonnet libs (prefixed by repoRoot)")
command.Flags().StringArrayVar(&opts.kustomizeImages, "kustomize-image", []string{}, "Kustomize images (e.g. --kustomize-image node:8.15.0 --kustomize-image mysql=mariadb,alpine@sha256:24a0c4b4a4c0eb97a1aabb8e29f18e917d05abfe1b7a7c07857230879ce7d3d)")
command.Flags().StringArrayVar(&opts.pluginEnvs, "plugin-env", []string{}, "Additional plugin envs")
command.Flags().BoolVar(&opts.Validate, "validate", true, "Validation of repo and cluster")
command.Flags().StringArrayVar(&opts.kustomizeCommonLabels, "kustomize-common-label", []string{}, "Set common labels in Kustomize")
command.Flags().StringArrayVar(&opts.kustomizeCommonAnnotations, "kustomize-common-annotation", []string{}, "Set common labels in Kustomize")
command.Flags().StringVar(&opts.directoryExclude, "directory-exclude", "", "Set glob expression used to exclude files from application source path")
command.Flags().StringVar(&opts.directoryInclude, "directory-include", "", "Set glob expression used to include files from application source path")
}
func SetAppSpecOptions(flags *pflag.FlagSet, spec *argoappv1.ApplicationSpec, appOpts *AppOptions) int {
visited := 0
flags.Visit(func(f *pflag.Flag) {
visited++
switch f.Name {
case "repo":
spec.Source.RepoURL = appOpts.repoURL
case "path":
spec.Source.Path = appOpts.appPath
case "helm-chart":
spec.Source.Chart = appOpts.chart
case "env":
setKsonnetOpt(&spec.Source, &appOpts.env)
case "revision":
spec.Source.TargetRevision = appOpts.revision
case "revision-history-limit":
i := int64(appOpts.revisionHistoryLimit)
spec.RevisionHistoryLimit = &i
case "values":
setHelmOpt(&spec.Source, helmOpts{valueFiles: appOpts.valuesFiles})
case "values-literal-file":
var data []byte
// read uri
parsedURL, err := url.ParseRequestURI(appOpts.values)
if err != nil || !(parsedURL.Scheme == "http" || parsedURL.Scheme == "https") {
data, err = ioutil.ReadFile(appOpts.values)
} else {
data, err = config.ReadRemoteFile(appOpts.values)
}
errors.CheckError(err)
setHelmOpt(&spec.Source, helmOpts{values: string(data)})
case "release-name":
setHelmOpt(&spec.Source, helmOpts{releaseName: appOpts.releaseName})
case "helm-version":
setHelmOpt(&spec.Source, helmOpts{version: appOpts.helmVersion})
case "helm-set":
setHelmOpt(&spec.Source, helmOpts{helmSets: appOpts.helmSets})
case "helm-set-string":
setHelmOpt(&spec.Source, helmOpts{helmSetStrings: appOpts.helmSetStrings})
case "helm-set-file":
setHelmOpt(&spec.Source, helmOpts{helmSetFiles: appOpts.helmSetFiles})
case "directory-recurse":
if spec.Source.Directory != nil {
spec.Source.Directory.Recurse = appOpts.directoryRecurse
} else {
spec.Source.Directory = &argoappv1.ApplicationSourceDirectory{Recurse: appOpts.directoryRecurse}
}
case "directory-exclude":
if spec.Source.Directory != nil {
spec.Source.Directory.Exclude = appOpts.directoryExclude
} else {
spec.Source.Directory = &argoappv1.ApplicationSourceDirectory{Exclude: appOpts.directoryExclude}
}
case "directory-include":
if spec.Source.Directory != nil {
spec.Source.Directory.Include = appOpts.directoryInclude
} else {
spec.Source.Directory = &argoappv1.ApplicationSourceDirectory{Include: appOpts.directoryInclude}
}
case "config-management-plugin":
spec.Source.Plugin = &argoappv1.ApplicationSourcePlugin{Name: appOpts.configManagementPlugin}
case "dest-name":
spec.Destination.Name = appOpts.destName
case "dest-server":
spec.Destination.Server = appOpts.destServer
case "dest-namespace":
spec.Destination.Namespace = appOpts.destNamespace
case "project":
spec.Project = appOpts.project
case "nameprefix":
setKustomizeOpt(&spec.Source, kustomizeOpts{namePrefix: appOpts.namePrefix})
case "namesuffix":
setKustomizeOpt(&spec.Source, kustomizeOpts{nameSuffix: appOpts.nameSuffix})
case "kustomize-image":
setKustomizeOpt(&spec.Source, kustomizeOpts{images: appOpts.kustomizeImages})
case "kustomize-version":
setKustomizeOpt(&spec.Source, kustomizeOpts{version: appOpts.kustomizeVersion})
case "kustomize-common-label":
parsedLabels, err := label.Parse(appOpts.kustomizeCommonLabels)
errors.CheckError(err)
setKustomizeOpt(&spec.Source, kustomizeOpts{commonLabels: parsedLabels})
case "kustomize-common-annotation":
parsedAnnotations, err := label.Parse(appOpts.kustomizeCommonAnnotations)
errors.CheckError(err)
setKustomizeOpt(&spec.Source, kustomizeOpts{commonAnnotations: parsedAnnotations})
case "jsonnet-tla-str":
setJsonnetOpt(&spec.Source, appOpts.jsonnetTlaStr, false)
case "jsonnet-tla-code":
setJsonnetOpt(&spec.Source, appOpts.jsonnetTlaCode, true)
case "jsonnet-ext-var-str":
setJsonnetOptExtVar(&spec.Source, appOpts.jsonnetExtVarStr, false)
case "jsonnet-ext-var-code":
setJsonnetOptExtVar(&spec.Source, appOpts.jsonnetExtVarCode, true)
case "jsonnet-libs":
setJsonnetOptLibs(&spec.Source, appOpts.jsonnetLibs)
case "plugin-env":
setPluginOptEnvs(&spec.Source, appOpts.pluginEnvs)
case "sync-policy":
switch appOpts.syncPolicy {
case "none":
if spec.SyncPolicy != nil {
spec.SyncPolicy.Automated = nil
}
if spec.SyncPolicy.IsZero() {
spec.SyncPolicy = nil
}
case "automated", "automatic", "auto":
if spec.SyncPolicy == nil {
spec.SyncPolicy = &argoappv1.SyncPolicy{}
}
spec.SyncPolicy.Automated = &argoappv1.SyncPolicyAutomated{}
default:
log.Fatalf("Invalid sync-policy: %s", appOpts.syncPolicy)
}
case "sync-option":
if spec.SyncPolicy == nil {
spec.SyncPolicy = &argoappv1.SyncPolicy{}
}
for _, option := range appOpts.syncOptions {
// `!` means remove the option
if strings.HasPrefix(option, "!") {
option = strings.TrimPrefix(option, "!")
spec.SyncPolicy.SyncOptions = spec.SyncPolicy.SyncOptions.RemoveOption(option)
} else {
spec.SyncPolicy.SyncOptions = spec.SyncPolicy.SyncOptions.AddOption(option)
}
}
if spec.SyncPolicy.IsZero() {
spec.SyncPolicy = nil
}
}
})
if flags.Changed("auto-prune") {
if spec.SyncPolicy == nil || spec.SyncPolicy.Automated == nil {
log.Fatal("Cannot set --auto-prune: application not configured with automatic sync")
}
spec.SyncPolicy.Automated.Prune = appOpts.autoPrune
}
if flags.Changed("self-heal") {
if spec.SyncPolicy == nil || spec.SyncPolicy.Automated == nil {
log.Fatal("Cannot set --self-heal: application not configured with automatic sync")
}
spec.SyncPolicy.Automated.SelfHeal = appOpts.selfHeal
}
if flags.Changed("allow-empty") {
if spec.SyncPolicy == nil || spec.SyncPolicy.Automated == nil {
log.Fatal("Cannot set --allow-empty: application not configured with automatic sync")
}
spec.SyncPolicy.Automated.AllowEmpty = appOpts.allowEmpty
}
return visited
}
func setKsonnetOpt(src *argoappv1.ApplicationSource, env *string) {
if src.Ksonnet == nil {
src.Ksonnet = &argoappv1.ApplicationSourceKsonnet{}
}
if env != nil {
src.Ksonnet.Environment = *env
}
if src.Ksonnet.IsZero() {
src.Ksonnet = nil
}
}
type kustomizeOpts struct {
namePrefix string
nameSuffix string
images []string
version string
commonLabels map[string]string
commonAnnotations map[string]string
}
func setKustomizeOpt(src *argoappv1.ApplicationSource, opts kustomizeOpts) {
if src.Kustomize == nil {
src.Kustomize = &argoappv1.ApplicationSourceKustomize{}
}
if opts.version != "" {
src.Kustomize.Version = opts.version
}
if opts.namePrefix != "" {
src.Kustomize.NamePrefix = opts.namePrefix
}
if opts.nameSuffix != "" {
src.Kustomize.NameSuffix = opts.nameSuffix
}
if opts.commonLabels != nil {
src.Kustomize.CommonLabels = opts.commonLabels
}
if opts.commonAnnotations != nil {
src.Kustomize.CommonAnnotations = opts.commonAnnotations
}
for _, image := range opts.images {
src.Kustomize.MergeImage(argoappv1.KustomizeImage(image))
}
if src.Kustomize.IsZero() {
src.Kustomize = nil
}
}
func setPluginOptEnvs(src *argoappv1.ApplicationSource, envs []string) {
if src.Plugin == nil {
src.Plugin = &argoappv1.ApplicationSourcePlugin{}
}
for _, text := range envs {
e, err := argoappv1.NewEnvEntry(text)
if err != nil {
log.Fatal(err)
}
src.Plugin.AddEnvEntry(e)
}
}
type helmOpts struct {
valueFiles []string
values string
releaseName string
version string
helmSets []string
helmSetStrings []string
helmSetFiles []string
}
func setHelmOpt(src *argoappv1.ApplicationSource, opts helmOpts) {
if src.Helm == nil {
src.Helm = &argoappv1.ApplicationSourceHelm{}
}
if len(opts.valueFiles) > 0 {
src.Helm.ValueFiles = opts.valueFiles
}
if len(opts.values) > 0 {
src.Helm.Values = opts.values
}
if opts.releaseName != "" {
src.Helm.ReleaseName = opts.releaseName
}
if opts.version != "" {
src.Helm.Version = opts.version
}
for _, text := range opts.helmSets {
p, err := argoappv1.NewHelmParameter(text, false)
if err != nil {
log.Fatal(err)
}
src.Helm.AddParameter(*p)
}
for _, text := range opts.helmSetStrings {
p, err := argoappv1.NewHelmParameter(text, true)
if err != nil {
log.Fatal(err)
}
src.Helm.AddParameter(*p)
}
for _, text := range opts.helmSetFiles {
p, err := argoappv1.NewHelmFileParameter(text)
if err != nil {
log.Fatal(err)
}
src.Helm.AddFileParameter(*p)
}
if src.Helm.IsZero() {
src.Helm = nil
}
}
func setJsonnetOpt(src *argoappv1.ApplicationSource, tlaParameters []string, code bool) {
if src.Directory == nil {
src.Directory = &argoappv1.ApplicationSourceDirectory{}
}
for _, j := range tlaParameters {
src.Directory.Jsonnet.TLAs = append(src.Directory.Jsonnet.TLAs, argoappv1.NewJsonnetVar(j, code))
}
}
func setJsonnetOptExtVar(src *argoappv1.ApplicationSource, jsonnetExtVar []string, code bool) {
if src.Directory == nil {
src.Directory = &argoappv1.ApplicationSourceDirectory{}
}
for _, j := range jsonnetExtVar {
src.Directory.Jsonnet.ExtVars = append(src.Directory.Jsonnet.ExtVars, argoappv1.NewJsonnetVar(j, code))
}
}
func setJsonnetOptLibs(src *argoappv1.ApplicationSource, libs []string) {
if src.Directory == nil {
src.Directory = &argoappv1.ApplicationSourceDirectory{}
}
src.Directory.Jsonnet.Libs = append(src.Directory.Jsonnet.Libs, libs...)
}
// SetParameterOverrides updates an existing or appends a new parameter override in the application
// If the app is a ksonnet app, then parameters are expected to be in the form: component=param=value
// Otherwise, the app is assumed to be a helm app and is expected to be in the form:
// param=value
func SetParameterOverrides(app *argoappv1.Application, parameters []string) {
if len(parameters) == 0 {
return
}
var sourceType argoappv1.ApplicationSourceType
if st, _ := app.Spec.Source.ExplicitType(); st != nil {
sourceType = *st
} else if app.Status.SourceType != "" {
sourceType = app.Status.SourceType
} else {
// HACK: we don't know the source type, so make an educated guess based on the supplied
// parameter string. This code handles the corner case where app doesn't exist yet, and the
// command is something like: `argocd app create MYAPP -p foo=bar`
// This logic is not foolproof, but when ksonnet is deprecated, this will no longer matter
// since helm will remain as the only source type which has parameters.
if len(strings.SplitN(parameters[0], "=", 3)) == 3 {
sourceType = argoappv1.ApplicationSourceTypeKsonnet
} else if len(strings.SplitN(parameters[0], "=", 2)) == 2 {
sourceType = argoappv1.ApplicationSourceTypeHelm
}
}
switch sourceType {
case argoappv1.ApplicationSourceTypeKsonnet:
if app.Spec.Source.Ksonnet == nil {
app.Spec.Source.Ksonnet = &argoappv1.ApplicationSourceKsonnet{}
}
for _, paramStr := range parameters {
parts := strings.SplitN(paramStr, "=", 3)
if len(parts) != 3 {
log.Fatalf("Expected ksonnet parameter of the form: component=param=value. Received: %s", paramStr)
}
newParam := argoappv1.KsonnetParameter{
Component: parts[0],
Name: parts[1],
Value: parts[2],
}
found := false
for i, cp := range app.Spec.Source.Ksonnet.Parameters {
if cp.Component == newParam.Component && cp.Name == newParam.Name {
found = true
app.Spec.Source.Ksonnet.Parameters[i] = newParam
break
}
}
if !found {
app.Spec.Source.Ksonnet.Parameters = append(app.Spec.Source.Ksonnet.Parameters, newParam)
}
}
case argoappv1.ApplicationSourceTypeHelm:
if app.Spec.Source.Helm == nil {
app.Spec.Source.Helm = &argoappv1.ApplicationSourceHelm{}
}
for _, p := range parameters {
newParam, err := argoappv1.NewHelmParameter(p, false)
if err != nil {
log.Error(err)
continue
}
app.Spec.Source.Helm.AddParameter(*newParam)
}
default:
log.Fatalf("Parameters can only be set against Ksonnet or Helm applications")
}
}
func readAppFromStdin(app *argoappv1.Application) error {
reader := bufio.NewReader(os.Stdin)
err := config.UnmarshalReader(reader, &app)
if err != nil {
return fmt.Errorf("unable to read manifest from stdin: %v", err)
}
return nil
}
func readAppFromURI(fileURL string, app *argoappv1.Application) error {
parsedURL, err := url.ParseRequestURI(fileURL)
if err != nil || !(parsedURL.Scheme == "http" || parsedURL.Scheme == "https") {
err = config.UnmarshalLocalFile(fileURL, &app)
} else {
err = config.UnmarshalRemoteFile(fileURL, &app)
}
return err
}
func ConstructApp(fileURL, appName string, labels, args []string, appOpts AppOptions, flags *pflag.FlagSet) (*argoappv1.Application, error) {
var app argoappv1.Application
if fileURL == "-" {
// read stdin
err := readAppFromStdin(&app)
if err != nil {
return nil, err
}
} else if fileURL != "" {
// read uri
err := readAppFromURI(fileURL, &app)
if err != nil {
return nil, err
}
if len(args) == 1 && args[0] != app.Name {
return nil, fmt.Errorf("app name '%s' does not match app spec metadata.name '%s'", args[0], app.Name)
}
if appName != "" && appName != app.Name {
app.Name = appName
}
if app.Name == "" {
return nil, fmt.Errorf("app.Name is empty. --name argument can be used to provide app.Name")
}
SetAppSpecOptions(flags, &app.Spec, &appOpts)
SetParameterOverrides(&app, appOpts.Parameters)
mergeLabels(&app, labels)
} else {
// read arguments
if len(args) == 1 {
if appName != "" && appName != args[0] {
return nil, fmt.Errorf("--name argument '%s' does not match app name %s", appName, args[0])
}
appName = args[0]
}
app = argoappv1.Application{
TypeMeta: v1.TypeMeta{
Kind: application.ApplicationKind,
APIVersion: application.Group + "/v1alpha1",
},
ObjectMeta: v1.ObjectMeta{
Name: appName,
},
}
SetAppSpecOptions(flags, &app.Spec, &appOpts)
SetParameterOverrides(&app, appOpts.Parameters)
mergeLabels(&app, labels)
}
return &app, nil
}
func mergeLabels(app *argoappv1.Application, labels []string) {
mapLabels, err := label.Parse(labels)
errors.CheckError(err)
mergedLabels := make(map[string]string)
for name, value := range app.GetLabels() {
mergedLabels[name] = value
}
for name, value := range mapLabels {
mergedLabels[name] = value
}
app.SetLabels(mergedLabels)
}

167
cmd/util/app_test.go Normal file
View File

@@ -0,0 +1,167 @@
package util
import (
"testing"
"github.com/spf13/cobra"
"github.com/stretchr/testify/assert"
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
)
func Test_setHelmOpt(t *testing.T) {
t.Run("Zero", func(t *testing.T) {
src := v1alpha1.ApplicationSource{}
setHelmOpt(&src, helmOpts{})
assert.Nil(t, src.Helm)
})
t.Run("ValueFiles", func(t *testing.T) {
src := v1alpha1.ApplicationSource{}
setHelmOpt(&src, helmOpts{valueFiles: []string{"foo"}})
assert.Equal(t, []string{"foo"}, src.Helm.ValueFiles)
})
t.Run("ReleaseName", func(t *testing.T) {
src := v1alpha1.ApplicationSource{}
setHelmOpt(&src, helmOpts{releaseName: "foo"})
assert.Equal(t, "foo", src.Helm.ReleaseName)
})
t.Run("HelmSets", func(t *testing.T) {
src := v1alpha1.ApplicationSource{}
setHelmOpt(&src, helmOpts{helmSets: []string{"foo=bar"}})
assert.Equal(t, []v1alpha1.HelmParameter{{Name: "foo", Value: "bar"}}, src.Helm.Parameters)
})
t.Run("HelmSetStrings", func(t *testing.T) {
src := v1alpha1.ApplicationSource{}
setHelmOpt(&src, helmOpts{helmSetStrings: []string{"foo=bar"}})
assert.Equal(t, []v1alpha1.HelmParameter{{Name: "foo", Value: "bar", ForceString: true}}, src.Helm.Parameters)
})
t.Run("HelmSetFiles", func(t *testing.T) {
src := v1alpha1.ApplicationSource{}
setHelmOpt(&src, helmOpts{helmSetFiles: []string{"foo=bar"}})
assert.Equal(t, []v1alpha1.HelmFileParameter{{Name: "foo", Path: "bar"}}, src.Helm.FileParameters)
})
t.Run("Version", func(t *testing.T) {
src := v1alpha1.ApplicationSource{}
setHelmOpt(&src, helmOpts{version: "v3"})
assert.Equal(t, "v3", src.Helm.Version)
})
}
func Test_setKustomizeOpt(t *testing.T) {
t.Run("No kustomize", func(t *testing.T) {
src := v1alpha1.ApplicationSource{}
setKustomizeOpt(&src, kustomizeOpts{})
assert.Nil(t, src.Kustomize)
})
t.Run("Name prefix", func(t *testing.T) {
src := v1alpha1.ApplicationSource{}
setKustomizeOpt(&src, kustomizeOpts{namePrefix: "test-"})
assert.Equal(t, &v1alpha1.ApplicationSourceKustomize{NamePrefix: "test-"}, src.Kustomize)
})
t.Run("Name suffix", func(t *testing.T) {
src := v1alpha1.ApplicationSource{}
setKustomizeOpt(&src, kustomizeOpts{nameSuffix: "-test"})
assert.Equal(t, &v1alpha1.ApplicationSourceKustomize{NameSuffix: "-test"}, src.Kustomize)
})
t.Run("Images", func(t *testing.T) {
src := v1alpha1.ApplicationSource{}
setKustomizeOpt(&src, kustomizeOpts{images: []string{"org/image:v1", "org/image:v2"}})
assert.Equal(t, &v1alpha1.ApplicationSourceKustomize{Images: v1alpha1.KustomizeImages{v1alpha1.KustomizeImage("org/image:v2")}}, src.Kustomize)
})
t.Run("Version", func(t *testing.T) {
src := v1alpha1.ApplicationSource{}
setKustomizeOpt(&src, kustomizeOpts{version: "v0.1"})
assert.Equal(t, &v1alpha1.ApplicationSourceKustomize{Version: "v0.1"}, src.Kustomize)
})
t.Run("Common labels", func(t *testing.T) {
src := v1alpha1.ApplicationSource{}
setKustomizeOpt(&src, kustomizeOpts{commonLabels: map[string]string{"foo1": "bar1", "foo2": "bar2"}})
assert.Equal(t, &v1alpha1.ApplicationSourceKustomize{CommonLabels: map[string]string{"foo1": "bar1", "foo2": "bar2"}}, src.Kustomize)
})
t.Run("Common annotations", func(t *testing.T) {
src := v1alpha1.ApplicationSource{}
setKustomizeOpt(&src, kustomizeOpts{commonAnnotations: map[string]string{"foo1": "bar1", "foo2": "bar2"}})
assert.Equal(t, &v1alpha1.ApplicationSourceKustomize{CommonAnnotations: map[string]string{"foo1": "bar1", "foo2": "bar2"}}, src.Kustomize)
})
}
func Test_setJsonnetOpt(t *testing.T) {
t.Run("TlaSets", func(t *testing.T) {
src := v1alpha1.ApplicationSource{}
setJsonnetOpt(&src, []string{"foo=bar"}, false)
assert.Equal(t, []v1alpha1.JsonnetVar{{Name: "foo", Value: "bar"}}, src.Directory.Jsonnet.TLAs)
setJsonnetOpt(&src, []string{"bar=baz"}, false)
assert.Equal(t, []v1alpha1.JsonnetVar{{Name: "foo", Value: "bar"}, {Name: "bar", Value: "baz"}}, src.Directory.Jsonnet.TLAs)
})
t.Run("ExtSets", func(t *testing.T) {
src := v1alpha1.ApplicationSource{}
setJsonnetOptExtVar(&src, []string{"foo=bar"}, false)
assert.Equal(t, []v1alpha1.JsonnetVar{{Name: "foo", Value: "bar"}}, src.Directory.Jsonnet.ExtVars)
setJsonnetOptExtVar(&src, []string{"bar=baz"}, false)
assert.Equal(t, []v1alpha1.JsonnetVar{{Name: "foo", Value: "bar"}, {Name: "bar", Value: "baz"}}, src.Directory.Jsonnet.ExtVars)
})
}
func Test_setPluginOptEnvs(t *testing.T) {
t.Run("PluginEnvs", func(t *testing.T) {
src := v1alpha1.ApplicationSource{}
setPluginOptEnvs(&src, []string{"FOO=bar"})
assert.Equal(t, v1alpha1.EnvEntry{Name: "FOO", Value: "bar"}, *src.Plugin.Env[0])
setPluginOptEnvs(&src, []string{"BAR=baz"})
assert.Equal(t, v1alpha1.EnvEntry{Name: "BAR", Value: "baz"}, *src.Plugin.Env[1])
setPluginOptEnvs(&src, []string{"FOO=baz"})
assert.Equal(t, v1alpha1.EnvEntry{Name: "FOO", Value: "baz"}, *src.Plugin.Env[0])
})
}
type appOptionsFixture struct {
spec *v1alpha1.ApplicationSpec
command *cobra.Command
options *AppOptions
}
func (f *appOptionsFixture) SetFlag(key, value string) error {
err := f.command.Flags().Set(key, value)
if err != nil {
return err
}
_ = SetAppSpecOptions(f.command.Flags(), f.spec, f.options)
return err
}
func newAppOptionsFixture() *appOptionsFixture {
fixture := &appOptionsFixture{
spec: &v1alpha1.ApplicationSpec{},
command: &cobra.Command{},
options: &AppOptions{},
}
AddAppFlags(fixture.command, fixture.options)
return fixture
}
func Test_setAppSpecOptions(t *testing.T) {
f := newAppOptionsFixture()
t.Run("SyncPolicy", func(t *testing.T) {
assert.NoError(t, f.SetFlag("sync-policy", "automated"))
assert.NotNil(t, f.spec.SyncPolicy.Automated)
f.spec.SyncPolicy = nil
assert.NoError(t, f.SetFlag("sync-policy", "automatic"))
assert.NotNil(t, f.spec.SyncPolicy.Automated)
f.spec.SyncPolicy = nil
assert.NoError(t, f.SetFlag("sync-policy", "auto"))
assert.NotNil(t, f.spec.SyncPolicy.Automated)
assert.NoError(t, f.SetFlag("sync-policy", "none"))
assert.Nil(t, f.spec.SyncPolicy)
})
t.Run("SyncOptions", func(t *testing.T) {
assert.NoError(t, f.SetFlag("sync-option", "a=1"))
assert.True(t, f.spec.SyncPolicy.SyncOptions.HasOption("a=1"))
// remove the options using !
assert.NoError(t, f.SetFlag("sync-option", "!a=1"))
assert.Nil(t, f.spec.SyncPolicy)
})
}

132
cmd/util/cluster.go Normal file
View File

@@ -0,0 +1,132 @@
package util
import (
"fmt"
"io/ioutil"
"os"
"sort"
"strings"
"text/tabwriter"
"github.com/spf13/cobra"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
argoappv1 "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/util/errors"
)
func PrintKubeContexts(ca clientcmd.ConfigAccess) {
config, err := ca.GetStartingConfig()
errors.CheckError(err)
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
defer func() { _ = w.Flush() }()
columnNames := []string{"CURRENT", "NAME", "CLUSTER", "SERVER"}
_, err = fmt.Fprintf(w, "%s\n", strings.Join(columnNames, "\t"))
errors.CheckError(err)
// sort names so output is deterministic
contextNames := make([]string, 0)
for name := range config.Contexts {
contextNames = append(contextNames, name)
}
sort.Strings(contextNames)
if config.Clusters == nil {
return
}
for _, name := range contextNames {
// ignore malformed kube config entries
context := config.Contexts[name]
if context == nil {
continue
}
cluster := config.Clusters[context.Cluster]
if cluster == nil {
continue
}
prefix := " "
if config.CurrentContext == name {
prefix = "*"
}
_, err := fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", prefix, name, context.Cluster, cluster.Server)
errors.CheckError(err)
}
}
func NewCluster(name string, namespaces []string, conf *rest.Config, managerBearerToken string, awsAuthConf *argoappv1.AWSAuthConfig, execProviderConf *argoappv1.ExecProviderConfig) *argoappv1.Cluster {
tlsClientConfig := argoappv1.TLSClientConfig{
Insecure: conf.TLSClientConfig.Insecure,
ServerName: conf.TLSClientConfig.ServerName,
CAData: conf.TLSClientConfig.CAData,
CertData: conf.TLSClientConfig.CertData,
KeyData: conf.TLSClientConfig.KeyData,
}
if len(conf.TLSClientConfig.CAData) == 0 && conf.TLSClientConfig.CAFile != "" {
data, err := ioutil.ReadFile(conf.TLSClientConfig.CAFile)
errors.CheckError(err)
tlsClientConfig.CAData = data
}
if len(conf.TLSClientConfig.CertData) == 0 && conf.TLSClientConfig.CertFile != "" {
data, err := ioutil.ReadFile(conf.TLSClientConfig.CertFile)
errors.CheckError(err)
tlsClientConfig.CertData = data
}
if len(conf.TLSClientConfig.KeyData) == 0 && conf.TLSClientConfig.KeyFile != "" {
data, err := ioutil.ReadFile(conf.TLSClientConfig.KeyFile)
errors.CheckError(err)
tlsClientConfig.KeyData = data
}
clst := argoappv1.Cluster{
Server: conf.Host,
Name: name,
Namespaces: namespaces,
Config: argoappv1.ClusterConfig{
TLSClientConfig: tlsClientConfig,
AWSAuthConfig: awsAuthConf,
ExecProviderConfig: execProviderConf,
},
}
// Bearer token will preferentially be used for auth if present,
// Even in presence of key/cert credentials
// So set bearer token only if the key/cert data is absent
if len(tlsClientConfig.CertData) == 0 || len(tlsClientConfig.KeyData) == 0 {
clst.Config.BearerToken = managerBearerToken
}
return &clst
}
type ClusterOptions struct {
InCluster bool
Upsert bool
ServiceAccount string
AwsRoleArn string
AwsClusterName string
SystemNamespace string
Namespaces []string
Name string
Shard int64
ExecProviderCommand string
ExecProviderArgs []string
ExecProviderEnv map[string]string
ExecProviderAPIVersion string
ExecProviderInstallHint string
}
func AddClusterFlags(command *cobra.Command, opts *ClusterOptions) {
command.Flags().BoolVar(&opts.InCluster, "in-cluster", false, "Indicates Argo CD resides inside this cluster and should connect using the internal k8s hostname (kubernetes.default.svc)")
command.Flags().StringVar(&opts.AwsClusterName, "aws-cluster-name", "", "AWS Cluster name if set then aws cli eks token command will be used to access cluster")
command.Flags().StringVar(&opts.AwsRoleArn, "aws-role-arn", "", "Optional AWS role arn. If set then AWS IAM Authenticator assumes a role to perform cluster operations instead of the default AWS credential provider chain.")
command.Flags().StringArrayVar(&opts.Namespaces, "namespace", nil, "List of namespaces which are allowed to manage")
command.Flags().StringVar(&opts.Name, "name", "", "Overwrite the cluster name")
command.Flags().Int64Var(&opts.Shard, "shard", -1, "Cluster shard number; inferred from hostname if not set")
command.Flags().StringVar(&opts.ExecProviderCommand, "exec-command", "", "Command to run to provide client credentials to the cluster. You may need to build a custom ArgoCD image to ensure the command is available at runtime.")
command.Flags().StringArrayVar(&opts.ExecProviderArgs, "exec-command-args", nil, "Arguments to supply to the --exec-command executable")
command.Flags().StringToStringVar(&opts.ExecProviderEnv, "exec-command-env", nil, "Environment vars to set when running the --exec-command executable")
command.Flags().StringVar(&opts.ExecProviderAPIVersion, "exec-command-api-version", "", "Preferred input version of the ExecInfo for the --exec-command executable")
command.Flags().StringVar(&opts.ExecProviderInstallHint, "exec-command-install-hint", "", "Text shown to the user when the --exec-command executable doesn't seem to be present")
}

63
cmd/util/cluster_test.go Normal file
View File

@@ -0,0 +1,63 @@
package util
import (
"strings"
"testing"
"github.com/stretchr/testify/assert"
"k8s.io/client-go/rest"
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
)
func Test_newCluster(t *testing.T) {
clusterWithData := NewCluster("test-cluster", []string{"test-namespace"}, &rest.Config{
TLSClientConfig: rest.TLSClientConfig{
Insecure: false,
ServerName: "test-endpoint.example.com",
CAData: []byte("test-ca-data"),
CertData: []byte("test-cert-data"),
KeyData: []byte("test-key-data"),
},
Host: "test-endpoint.example.com",
},
"test-bearer-token",
&v1alpha1.AWSAuthConfig{},
&v1alpha1.ExecProviderConfig{})
assert.Equal(t, "test-cert-data", string(clusterWithData.Config.CertData))
assert.Equal(t, "test-key-data", string(clusterWithData.Config.KeyData))
assert.Equal(t, "", clusterWithData.Config.BearerToken)
clusterWithFiles := NewCluster("test-cluster", []string{"test-namespace"}, &rest.Config{
TLSClientConfig: rest.TLSClientConfig{
Insecure: false,
ServerName: "test-endpoint.example.com",
CAData: []byte("test-ca-data"),
CertFile: "./testdata/test.cert.pem",
KeyFile: "./testdata/test.key.pem",
},
Host: "test-endpoint.example.com",
},
"test-bearer-token",
&v1alpha1.AWSAuthConfig{},
&v1alpha1.ExecProviderConfig{})
assert.True(t, strings.Contains(string(clusterWithFiles.Config.CertData), "test-cert-data"))
assert.True(t, strings.Contains(string(clusterWithFiles.Config.KeyData), "test-key-data"))
assert.Equal(t, "", clusterWithFiles.Config.BearerToken)
clusterWithBearerToken := NewCluster("test-cluster", []string{"test-namespace"}, &rest.Config{
TLSClientConfig: rest.TLSClientConfig{
Insecure: false,
ServerName: "test-endpoint.example.com",
CAData: []byte("test-ca-data"),
},
Host: "test-endpoint.example.com",
},
"test-bearer-token",
&v1alpha1.AWSAuthConfig{},
&v1alpha1.ExecProviderConfig{})
assert.Equal(t, "test-bearer-token", clusterWithBearerToken.Config.BearerToken)
}

80
cmd/util/common.go Normal file
View File

@@ -0,0 +1,80 @@
package util
import (
"encoding/json"
"fmt"
"github.com/ghodss/yaml"
v1 "k8s.io/api/core/v1"
"github.com/argoproj/gitops-engine/pkg/utils/kube"
)
var (
LogFormat string
LogLevel string
)
// PrintResource prints a single resource in YAML or JSON format to stdout according to the output format
func PrintResources(resources []interface{}, output string) error {
for i, resource := range resources {
filteredResource, err := omitFields(resource)
if err != nil {
return err
}
resources[i] = filteredResource
}
switch output {
case "json":
jsonBytes, err := json.MarshalIndent(resources, "", " ")
if err != nil {
return err
}
fmt.Println(string(jsonBytes))
case "yaml":
yamlBytes, err := yaml.Marshal(resources)
if err != nil {
return err
}
fmt.Println(string(yamlBytes))
default:
return fmt.Errorf("unknown output format: %s", output)
}
return nil
}
// omit fields such as status, creationTimestamp and metadata.namespace in k8s objects
func omitFields(resource interface{}) (interface{}, error) {
jsonBytes, err := json.Marshal(resource)
if err != nil {
return nil, err
}
toMap := make(map[string]interface{})
err = json.Unmarshal([]byte(string(jsonBytes)), &toMap)
if err != nil {
return nil, err
}
delete(toMap, "status")
if v, ok := toMap["metadata"]; ok {
if metadata, ok := v.(map[string]interface{}); ok {
delete(metadata, "creationTimestamp")
delete(metadata, "namespace")
}
}
return toMap, nil
}
// ConvertSecretData converts kubernetes secret's data to stringData
func ConvertSecretData(secret *v1.Secret) {
secret.Kind = kube.SecretKind
secret.APIVersion = "v1"
secret.StringData = map[string]string{}
for k, v := range secret.Data {
secret.StringData[k] = string(v)
}
secret.Data = map[string][]byte{}
}

141
cmd/util/project.go Normal file
View File

@@ -0,0 +1,141 @@
package util
import (
"bufio"
"fmt"
"log"
"net/url"
"os"
"strings"
"github.com/spf13/cobra"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/pointer"
"github.com/argoproj/argo-cd/pkg/apis/application"
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/util/config"
"github.com/argoproj/argo-cd/util/gpg"
)
type ProjectOpts struct {
Description string
destinations []string
Sources []string
SignatureKeys []string
orphanedResourcesEnabled bool
orphanedResourcesWarn bool
}
func AddProjFlags(command *cobra.Command, opts *ProjectOpts) {
command.Flags().StringVarP(&opts.Description, "description", "", "", "Project description")
command.Flags().StringArrayVarP(&opts.destinations, "dest", "d", []string{},
"Permitted destination server and namespace (e.g. https://192.168.99.100:8443,default)")
command.Flags().StringArrayVarP(&opts.Sources, "src", "s", []string{}, "Permitted source repository URL")
command.Flags().StringSliceVar(&opts.SignatureKeys, "signature-keys", []string{}, "GnuPG public key IDs for commit signature verification")
command.Flags().BoolVar(&opts.orphanedResourcesEnabled, "orphaned-resources", false, "Enables orphaned resources monitoring")
command.Flags().BoolVar(&opts.orphanedResourcesWarn, "orphaned-resources-warn", false, "Specifies if applications should have a warning condition when orphaned resources detected")
}
func (opts *ProjectOpts) GetDestinations() []v1alpha1.ApplicationDestination {
destinations := make([]v1alpha1.ApplicationDestination, 0)
for _, destStr := range opts.destinations {
parts := strings.Split(destStr, ",")
if len(parts) != 2 {
log.Fatalf("Expected destination of the form: server,namespace. Received: %s", destStr)
} else {
destinations = append(destinations, v1alpha1.ApplicationDestination{
Server: parts[0],
Namespace: parts[1],
})
}
}
return destinations
}
// TODO: Get configured keys and emit warning when a key is specified that is not configured
func (opts *ProjectOpts) GetSignatureKeys() []v1alpha1.SignatureKey {
signatureKeys := make([]v1alpha1.SignatureKey, 0)
for _, keyStr := range opts.SignatureKeys {
if !gpg.IsShortKeyID(keyStr) && !gpg.IsLongKeyID(keyStr) {
log.Fatalf("'%s' is not a valid GnuPG key ID", keyStr)
}
signatureKeys = append(signatureKeys, v1alpha1.SignatureKey{KeyID: gpg.KeyID(keyStr)})
}
return signatureKeys
}
func GetOrphanedResourcesSettings(c *cobra.Command, opts ProjectOpts) *v1alpha1.OrphanedResourcesMonitorSettings {
warnChanged := c.Flag("orphaned-resources-warn").Changed
if opts.orphanedResourcesEnabled || warnChanged {
settings := v1alpha1.OrphanedResourcesMonitorSettings{}
if warnChanged {
settings.Warn = pointer.BoolPtr(opts.orphanedResourcesWarn)
}
return &settings
}
return nil
}
func readProjFromStdin(proj *v1alpha1.AppProject) error {
reader := bufio.NewReader(os.Stdin)
err := config.UnmarshalReader(reader, &proj)
if err != nil {
return fmt.Errorf("unable to read manifest from stdin: %v", err)
}
return nil
}
func readProjFromURI(fileURL string, proj *v1alpha1.AppProject) error {
parsedURL, err := url.ParseRequestURI(fileURL)
if err != nil || !(parsedURL.Scheme == "http" || parsedURL.Scheme == "https") {
err = config.UnmarshalLocalFile(fileURL, &proj)
} else {
err = config.UnmarshalRemoteFile(fileURL, &proj)
}
return err
}
func ConstructAppProj(fileURL string, args []string, opts ProjectOpts, c *cobra.Command) (*v1alpha1.AppProject, error) {
var proj v1alpha1.AppProject
if fileURL == "-" {
// read stdin
err := readProjFromStdin(&proj)
if err != nil {
return nil, err
}
} else if fileURL != "" {
// read uri
err := readProjFromURI(fileURL, &proj)
if err != nil {
return nil, err
}
if len(args) == 1 && args[0] != proj.Name {
return nil, fmt.Errorf("project name '%s' does not match project spec metadata.name '%s'", args[0], proj.Name)
}
} else {
// read arguments
if len(args) == 0 {
c.HelpFunc()(c, args)
os.Exit(1)
}
projName := args[0]
proj = v1alpha1.AppProject{
TypeMeta: v1.TypeMeta{
Kind: application.AppProjectKind,
APIVersion: application.Group + "/v1alpha1",
},
ObjectMeta: v1.ObjectMeta{Name: projName},
Spec: v1alpha1.AppProjectSpec{
Description: opts.Description,
Destinations: opts.GetDestinations(),
SourceRepos: opts.Sources,
SignatureKeys: opts.GetSignatureKeys(),
OrphanedResources: GetOrphanedResourcesSettings(c, opts),
},
}
}
return &proj, nil
}

42
cmd/util/repo.go Normal file
View File

@@ -0,0 +1,42 @@
package util
import (
"github.com/spf13/cobra"
"github.com/argoproj/argo-cd/common"
appsv1 "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
)
type RepoOptions struct {
Repo appsv1.Repository
Upsert bool
SshPrivateKeyPath string
InsecureIgnoreHostKey bool
InsecureSkipServerVerification bool
TlsClientCertPath string
TlsClientCertKeyPath string
EnableLfs bool
EnableOci bool
GithubAppId int64
GithubAppInstallationId int64
GithubAppPrivateKeyPath string
GitHubAppEnterpriseBaseURL string
}
func AddRepoFlags(command *cobra.Command, opts *RepoOptions) {
command.Flags().StringVar(&opts.Repo.Type, "type", common.DefaultRepoType, "type of the repository, \"git\" or \"helm\"")
command.Flags().StringVar(&opts.Repo.Name, "name", "", "name of the repository, mandatory for repositories of type helm")
command.Flags().StringVar(&opts.Repo.Username, "username", "", "username to the repository")
command.Flags().StringVar(&opts.Repo.Password, "password", "", "password to the repository")
command.Flags().StringVar(&opts.SshPrivateKeyPath, "ssh-private-key-path", "", "path to the private ssh key (e.g. ~/.ssh/id_rsa)")
command.Flags().StringVar(&opts.TlsClientCertPath, "tls-client-cert-path", "", "path to the TLS client cert (must be PEM format)")
command.Flags().StringVar(&opts.TlsClientCertKeyPath, "tls-client-cert-key-path", "", "path to the TLS client cert's key path (must be PEM format)")
command.Flags().BoolVar(&opts.InsecureIgnoreHostKey, "insecure-ignore-host-key", false, "disables SSH strict host key checking (deprecated, use --insecure-skip-server-verification instead)")
command.Flags().BoolVar(&opts.InsecureSkipServerVerification, "insecure-skip-server-verification", false, "disables server certificate and host key checks")
command.Flags().BoolVar(&opts.EnableLfs, "enable-lfs", false, "enable git-lfs (Large File Support) on this repository")
command.Flags().BoolVar(&opts.EnableOci, "enable-oci", false, "enable helm-oci (Helm OCI-Based Repository)")
command.Flags().Int64Var(&opts.GithubAppId, "github-app-id", 0, "id of the GitHub Application")
command.Flags().Int64Var(&opts.GithubAppInstallationId, "github-app-installation-id", 0, "installation id of the GitHub Application")
command.Flags().StringVar(&opts.GithubAppPrivateKeyPath, "github-app-private-key-path", "", "private key of the GitHub Application")
command.Flags().StringVar(&opts.GitHubAppEnterpriseBaseURL, "github-app-enterprise-base-url", "", "base url to use when using GitHub Enterprise (e.g. https://ghe.example.com/api/v3")
}

3
cmd/util/testdata/test.cert.pem vendored Normal file
View File

@@ -0,0 +1,3 @@
-----BEGIN CERTIFICATE-----
test-cert-data
-----END CERTIFICATE-----

3
cmd/util/testdata/test.key.pem vendored Normal file
View File

@@ -0,0 +1,3 @@
-----BEGIN RSA PRIVATE KEY-----
test-key-data
-----END RSA PRIVATE KEY-----

View File

@@ -1,109 +1,247 @@
package common
import (
rbacv1 "k8s.io/api/rbac/v1"
"os"
"strconv"
"time"
)
"github.com/argoproj/argo-cd/pkg/apis/application"
// Default service addresses and URLS of Argo CD internal services
const (
// DefaultRepoServerAddr is the gRPC address of the Argo CD repo server
DefaultRepoServerAddr = "argocd-repo-server:8081"
// DefaultDexServerAddr is the HTTP address of the Dex OIDC server, which we run a reverse proxy against
DefaultDexServerAddr = "http://argocd-dex-server:5556"
// DefaultRedisAddr is the default redis address
DefaultRedisAddr = "argocd-redis:6379"
)
// Kubernetes ConfigMap and Secret resource names which hold Argo CD settings
const (
ArgoCDConfigMapName = "argocd-cm"
ArgoCDSecretName = "argocd-secret"
ArgoCDRBACConfigMapName = "argocd-rbac-cm"
// Contains SSH known hosts data for connecting repositories. Will get mounted as volume to pods
ArgoCDKnownHostsConfigMapName = "argocd-ssh-known-hosts-cm"
// Contains TLS certificate data for connecting repositories. Will get mounted as volume to pods
ArgoCDTLSCertsConfigMapName = "argocd-tls-certs-cm"
ArgoCDGPGKeysConfigMapName = "argocd-gpg-keys-cm"
)
// Some default configurables
const (
DefaultSystemNamespace = "kube-system"
DefaultRepoType = "git"
)
// Default listener ports for ArgoCD components
const (
DefaultPortAPIServer = 8080
DefaultPortRepoServer = 8081
DefaultPortArgoCDMetrics = 8082
DefaultPortArgoCDAPIServerMetrics = 8083
DefaultPortRepoServerMetrics = 8084
)
// Default paths on the pod's file system
const (
// The default path where TLS certificates for repositories are located
DefaultPathTLSConfig = "/app/config/tls"
// The default path where SSH known hosts are stored
DefaultPathSSHConfig = "/app/config/ssh"
// Default name for the SSH known hosts file
DefaultSSHKnownHostsName = "ssh_known_hosts"
// Default path to GnuPG home directory
DefaultGnuPgHomePath = "/app/config/gpg/keys"
)
const (
// MetadataPrefix is the prefix used for our labels and annotations
MetadataPrefix = "argocd.argoproj.io"
// SecretTypeRepository indicates a secret type of repository
SecretTypeRepository = "repository"
// SecretTypeCluster indicates a secret type of cluster
SecretTypeCluster = "cluster"
// AuthCookieName is the HTTP cookie name where we store our auth token
AuthCookieName = "argocd.token"
// ResourcesFinalizerName is a number of application CRD finalizer
ResourcesFinalizerName = "resources-finalizer." + MetadataPrefix
DefaultSyncRetryDuration = 5 * time.Second
DefaultSyncRetryMaxDuration = 3 * time.Minute
DefaultSyncRetryFactor = int64(2)
)
// Argo CD application related constants
const (
// KubernetesInternalAPIServerAddr is address of the k8s API server when accessing internal to the cluster
KubernetesInternalAPIServerAddr = "https://kubernetes.default.svc"
// DefaultAppProjectName contains name of 'default' app project, which is available in every Argo CD installation
DefaultAppProjectName = "default"
// ArgoCDAdminUsername is the username of the 'admin' user
ArgoCDAdminUsername = "admin"
// ArgoCDUserAgentName is the default user-agent name used by the gRPC API client library and grpc-gateway
ArgoCDUserAgentName = "argocd-client"
// AuthCookieName is the HTTP cookie name where we store our auth token
AuthCookieName = "argocd.token"
// RevisionHistoryLimit is the max number of successful sync to keep in history
RevisionHistoryLimit = 10
// ChangePasswordSSOTokenMaxAge is the max token age for password change operation
ChangePasswordSSOTokenMaxAge = time.Minute * 5
// GithubAppCredsExpirationDuration is the default time used to cache the GitHub app credentials
GithubAppCredsExpirationDuration = time.Minute * 60
)
const (
ArgoCDAdminUsername = "admin"
ArgoCDSecretName = "argocd-secret"
ArgoCDConfigMapName = "argocd-cm"
ArgoCDRBACConfigMapName = "argocd-rbac-cm"
)
// Dex related constants
const (
// DexAPIEndpoint is the endpoint where we serve the Dex API server
DexAPIEndpoint = "/api/dex"
// LoginEndpoint is ArgoCD's shorthand login endpoint which redirects to dex's OAuth 2.0 provider's consent page
// LoginEndpoint is Argo CD's shorthand login endpoint which redirects to dex's OAuth 2.0 provider's consent page
LoginEndpoint = "/auth/login"
// CallbackEndpoint is ArgoCD's final callback endpoint we reach after OAuth 2.0 login flow has been completed
// LogoutEndpoint is Argo CD's shorthand logout endpoint which invalidates OIDC session after logout
LogoutEndpoint = "/auth/logout"
// CallbackEndpoint is Argo CD's final callback endpoint we reach after OAuth 2.0 login flow has been completed
CallbackEndpoint = "/auth/callback"
// DexCallbackEndpoint is Argo CD's final callback endpoint when Dex is configured
DexCallbackEndpoint = "/api/dex/callback"
// ArgoCDClientAppName is name of the Oauth client app used when registering our web app to dex
ArgoCDClientAppName = "ArgoCD"
ArgoCDClientAppName = "Argo CD"
// ArgoCDClientAppID is the Oauth client ID we will use when registering our app to dex
ArgoCDClientAppID = "argo-cd"
// ArgoCDCLIClientAppName is name of the Oauth client app used when registering our CLI to dex
ArgoCDCLIClientAppName = "ArgoCD CLI"
ArgoCDCLIClientAppName = "Argo CD CLI"
// ArgoCDCLIClientAppID is the Oauth client ID we will use when registering our CLI to dex
ArgoCDCLIClientAppID = "argo-cd-cli"
)
// Resource metadata labels and annotations (keys and values) used by Argo CD components
const (
// LabelKeyAppInstance is the label key to use to uniquely identify the instance of an application
// The Argo CD application name is used as the instance name
LabelKeyAppInstance = "app.kubernetes.io/instance"
// LegacyLabelApplicationName is the legacy label (v0.10 and below) and is superceded by 'app.kubernetes.io/instance'
LabelKeyLegacyApplicationName = "applications.argoproj.io/app-name"
// LabelKeySecretType contains the type of argocd secret (currently: 'cluster')
LabelKeySecretType = "argocd.argoproj.io/secret-type"
// LabelValueSecretTypeCluster indicates a secret type of cluster
LabelValueSecretTypeCluster = "cluster"
// AnnotationCompareOptions is a comma-separated list of options for comparison
AnnotationCompareOptions = "argocd.argoproj.io/compare-options"
// AnnotationKeyRefresh is the annotation key which indicates that app needs to be refreshed. Removed by application controller after app is refreshed.
// Might take values 'normal'/'hard'. Value 'hard' means manifest cache and target cluster state cache should be invalidated before refresh.
AnnotationKeyRefresh = "argocd.argoproj.io/refresh"
// AnnotationKeyManagedBy is annotation name which indicates that k8s resource is managed by an application.
AnnotationKeyManagedBy = "managed-by"
// AnnotationValueManagedByArgoCD is a 'managed-by' annotation value for resources managed by Argo CD
AnnotationValueManagedByArgoCD = "argocd.argoproj.io"
// ResourcesFinalizerName the finalizer value which we inject to finalize deletion of an application
ResourcesFinalizerName = "resources-finalizer.argocd.argoproj.io"
// AnnotationKeyManifestGeneratePaths is an annotation that contains a list of semicolon-separated paths in the
// manifests repository that affects the manifest generation. Paths might be either relative or absolute. The
// absolute path means an absolute path within the repository and the relative path is relative to the application
// source path within the repository.
AnnotationKeyManifestGeneratePaths = "argocd.argoproj.io/manifest-generate-paths"
// AnnotationKeyLinkPrefix tells the UI to add an external link icon to the application node
// that links to the value given in the annotation.
// The annotation key must be followed by a unique identifier. Ex: link.argocd.argoproj.io/dashboard
// It's valid to have multiple annotations that match the prefix.
// Values can simply be a url or they can have
// an optional link title separated by a "|"
// Ex: "http://grafana.example.com/d/yu5UH4MMz/deployments"
// Ex: "Go to Dashboard|http://grafana.example.com/d/yu5UH4MMz/deployments"
AnnotationKeyLinkPrefix = "link.argocd.argoproj.io/"
)
// Environment variables for tuning and debugging Argo CD
const (
// EnvVarSSODebug is an environment variable to enable additional OAuth debugging in the API server
EnvVarSSODebug = "ARGOCD_SSO_DEBUG"
// EnvVarRBACDebug is an environment variable to enable additional RBAC debugging in the API server
EnvVarRBACDebug = "ARGOCD_RBAC_DEBUG"
// DefaultAppProjectName contains name of default app project. The default app project allows deploying application to any cluster.
DefaultAppProjectName = "default"
// EnvVarFakeInClusterConfig is an environment variable to fake an in-cluster RESTConfig using
// the current kubectl context (for development purposes)
EnvVarFakeInClusterConfig = "ARGOCD_FAKE_IN_CLUSTER"
// Overrides the location where SSH known hosts for repo access data is stored
EnvVarSSHDataPath = "ARGOCD_SSH_DATA_PATH"
// Overrides the location where TLS certificate for repo access data is stored
EnvVarTLSDataPath = "ARGOCD_TLS_DATA_PATH"
// Specifies number of git remote operations attempts count
EnvGitAttemptsCount = "ARGOCD_GIT_ATTEMPTS_COUNT"
// Overrides git submodule support, true by default
EnvGitSubmoduleEnabled = "ARGOCD_GIT_MODULES_ENABLED"
// EnvK8sClientQPS is the QPS value used for the kubernetes client (default: 50)
EnvK8sClientQPS = "ARGOCD_K8S_CLIENT_QPS"
// EnvK8sClientBurst is the burst value used for the kubernetes client (default: twice the client QPS)
EnvK8sClientBurst = "ARGOCD_K8S_CLIENT_BURST"
// EnvClusterCacheResyncDuration is the env variable that holds cluster cache re-sync duration
EnvClusterCacheResyncDuration = "ARGOCD_CLUSTER_CACHE_RESYNC_DURATION"
// EnvK8sClientMaxIdleConnections is the number of max idle connections in K8s REST client HTTP transport (default: 500)
EnvK8sClientMaxIdleConnections = "ARGOCD_K8S_CLIENT_MAX_IDLE_CONNECTIONS"
// EnvGnuPGHome is the path to ArgoCD's GnuPG keyring for signature verification
EnvGnuPGHome = "ARGOCD_GNUPGHOME"
// EnvWatchAPIBufferSize is the buffer size used to transfer K8S watch events to watch API consumer
EnvWatchAPIBufferSize = "ARGOCD_WATCH_API_BUFFER_SIZE"
// EnvPauseGenerationAfterFailedAttempts will pause manifest generation after the specified number of failed generation attempts
EnvPauseGenerationAfterFailedAttempts = "ARGOCD_PAUSE_GEN_AFTER_FAILED_ATTEMPTS"
// EnvPauseGenerationMinutes pauses manifest generation for the specified number of minutes, after sufficient manifest generation failures
EnvPauseGenerationMinutes = "ARGOCD_PAUSE_GEN_MINUTES"
// EnvPauseGenerationRequests pauses manifest generation for the specified number of requests, after sufficient manifest generation failures
EnvPauseGenerationRequests = "ARGOCD_PAUSE_GEN_REQUESTS"
// EnvControllerReplicas is the number of controller replicas
EnvControllerReplicas = "ARGOCD_CONTROLLER_REPLICAS"
// EnvControllerShard is the shard number that should be handled by controller
EnvControllerShard = "ARGOCD_CONTROLLER_SHARD"
// EnvEnableGRPCTimeHistogramEnv enables gRPC metrics collection
EnvEnableGRPCTimeHistogramEnv = "ARGOCD_ENABLE_GRPC_TIME_HISTOGRAM"
// EnvGithubAppCredsExpirationDuration controls the caching of Github app credentials. This value is in minutes (default: 60)
EnvGithubAppCredsExpirationDuration = "ARGOCD_GITHUB_APP_CREDS_EXPIRATION_DURATION"
)
const (
// MinClientVersion is the minimum client version that can interface with this API server.
// When introducing breaking changes to the API or datastructures, this number should be bumped.
// The value here may be lower than the current value in VERSION
MinClientVersion = "1.4.0"
// CacheVersion is a objects version cached using util/cache/cache.go.
// Number should be bumped in case of backward incompatible change to make sure cache is invalidated after upgrade.
CacheVersion = "1.8.3"
)
// GetGnuPGHomePath retrieves the path to use for GnuPG home directory, which is either taken from GNUPGHOME environment or a default value
func GetGnuPGHomePath() string {
if gnuPgHome := os.Getenv(EnvGnuPGHome); gnuPgHome == "" {
return DefaultGnuPgHomePath
} else {
return gnuPgHome
}
}
var (
// LabelKeyAppInstance refers to the application instance resource name
LabelKeyAppInstance = MetadataPrefix + "/app-instance"
// LabelKeySecretType contains the type of argocd secret (either 'cluster' or 'repo')
LabelKeySecretType = MetadataPrefix + "/secret-type"
// AnnotationConnectionStatus contains connection state status
AnnotationConnectionStatus = MetadataPrefix + "/connection-status"
// AnnotationConnectionMessage contains additional information about connection status
AnnotationConnectionMessage = MetadataPrefix + "/connection-message"
// AnnotationConnectionModifiedAt contains timestamp when connection state had been modified
AnnotationConnectionModifiedAt = MetadataPrefix + "/connection-modified-at"
// AnnotationHook contains the hook type of a resource
AnnotationHook = MetadataPrefix + "/hook"
// AnnotationHookDeletePolicy is the policy of deleting a hook
AnnotationHookDeletePolicy = MetadataPrefix + "/hook-delete-policy"
// AnnotationHelmHook is the helm hook annotation
AnnotationHelmHook = "helm.sh/hook"
// LabelKeyApplicationControllerInstanceID is the label which allows to separate application among multiple running application controllers.
LabelKeyApplicationControllerInstanceID = application.ApplicationFullName + "/controller-instanceid"
// LabelApplicationName is the label which indicates that resource belongs to application with the specified name
LabelApplicationName = application.ApplicationFullName + "/app-name"
// AnnotationKeyRefresh is the annotation key in the application which is updated with an
// arbitrary value (i.e. timestamp) on a git event, to force the controller to wake up and
// re-evaluate the application
AnnotationKeyRefresh = application.ApplicationFullName + "/refresh"
// K8sClientConfigQPS controls the QPS to be used in K8s REST client configs
K8sClientConfigQPS float32 = 50
// K8sClientConfigBurst controls the burst to be used in K8s REST client configs
K8sClientConfigBurst int = 100
// K8sMaxIdleConnections controls the number of max idle connections in K8s REST client HTTP transport
K8sMaxIdleConnections = 500
// K8sMaxIdleConnections controls the duration of cluster cache refresh
K8SClusterResyncDuration = 12 * time.Hour
)
// ArgoCDManagerServiceAccount is the name of the service account for managing a cluster
const (
ArgoCDManagerServiceAccount = "argocd-manager"
ArgoCDManagerClusterRole = "argocd-manager-role"
ArgoCDManagerClusterRoleBinding = "argocd-manager-role-binding"
)
func init() {
if envQPS := os.Getenv(EnvK8sClientQPS); envQPS != "" {
if qps, err := strconv.ParseFloat(envQPS, 32); err != nil {
K8sClientConfigQPS = float32(qps)
}
}
if envBurst := os.Getenv(EnvK8sClientBurst); envBurst != "" {
if burst, err := strconv.Atoi(envBurst); err != nil {
K8sClientConfigBurst = burst
}
} else {
K8sClientConfigBurst = 2 * int(K8sClientConfigQPS)
}
// ArgoCDManagerPolicyRules are the policies to give argocd-manager
var ArgoCDManagerPolicyRules = []rbacv1.PolicyRule{
{
APIGroups: []string{"*"},
Resources: []string{"*"},
Verbs: []string{"*"},
},
{
NonResourceURLs: []string{"*"},
Verbs: []string{"*"},
},
if envMaxConn := os.Getenv(EnvK8sClientMaxIdleConnections); envMaxConn != "" {
if maxConn, err := strconv.Atoi(envMaxConn); err != nil {
K8sMaxIdleConnections = maxConn
}
}
if clusterResyncDurationStr := os.Getenv(EnvClusterCacheResyncDuration); clusterResyncDurationStr != "" {
if duration, err := time.ParseDuration(clusterResyncDurationStr); err == nil {
K8SClusterResyncDuration = duration
}
}
}

View File

@@ -1,199 +0,0 @@
package common
import (
"fmt"
"time"
log "github.com/sirupsen/logrus"
apiv1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
apierr "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/kubernetes"
)
// CreateServiceAccount creates a service account
func CreateServiceAccount(
clientset kubernetes.Interface,
serviceAccountName string,
namespace string,
) error {
serviceAccount := apiv1.ServiceAccount{
TypeMeta: metav1.TypeMeta{
APIVersion: "v1",
Kind: "ServiceAccount",
},
ObjectMeta: metav1.ObjectMeta{
Name: serviceAccountName,
Namespace: namespace,
},
}
_, err := clientset.CoreV1().ServiceAccounts(namespace).Create(&serviceAccount)
if err != nil {
if !apierr.IsAlreadyExists(err) {
return fmt.Errorf("Failed to create service account %q: %v", serviceAccountName, err)
}
log.Infof("ServiceAccount %q already exists", serviceAccountName)
return nil
}
log.Infof("ServiceAccount %q created", serviceAccountName)
return nil
}
// CreateClusterRole creates a cluster role
func CreateClusterRole(
clientset kubernetes.Interface,
clusterRoleName string,
rules []rbacv1.PolicyRule,
) error {
clusterRole := rbacv1.ClusterRole{
TypeMeta: metav1.TypeMeta{
APIVersion: "rbac.authorization.k8s.io/v1",
Kind: "ClusterRole",
},
ObjectMeta: metav1.ObjectMeta{
Name: clusterRoleName,
},
Rules: rules,
}
crclient := clientset.RbacV1().ClusterRoles()
_, err := crclient.Create(&clusterRole)
if err != nil {
if !apierr.IsAlreadyExists(err) {
return fmt.Errorf("Failed to create ClusterRole %q: %v", clusterRoleName, err)
}
_, err = crclient.Update(&clusterRole)
if err != nil {
return fmt.Errorf("Failed to update ClusterRole %q: %v", clusterRoleName, err)
}
log.Infof("ClusterRole %q updated", clusterRoleName)
} else {
log.Infof("ClusterRole %q created", clusterRoleName)
}
return nil
}
// CreateClusterRoleBinding create a ClusterRoleBinding
func CreateClusterRoleBinding(
clientset kubernetes.Interface,
clusterBindingRoleName,
serviceAccountName,
clusterRoleName string,
namespace string,
) error {
roleBinding := rbacv1.ClusterRoleBinding{
TypeMeta: metav1.TypeMeta{
APIVersion: "rbac.authorization.k8s.io/v1",
Kind: "ClusterRoleBinding",
},
ObjectMeta: metav1.ObjectMeta{
Name: clusterBindingRoleName,
},
RoleRef: rbacv1.RoleRef{
APIGroup: "rbac.authorization.k8s.io",
Kind: "ClusterRole",
Name: clusterRoleName,
},
Subjects: []rbacv1.Subject{
{
Kind: rbacv1.ServiceAccountKind,
Name: serviceAccountName,
Namespace: namespace,
},
},
}
_, err := clientset.RbacV1().ClusterRoleBindings().Create(&roleBinding)
if err != nil {
if !apierr.IsAlreadyExists(err) {
return fmt.Errorf("Failed to create ClusterRoleBinding %s: %v", clusterBindingRoleName, err)
}
log.Infof("ClusterRoleBinding %q already exists", clusterBindingRoleName)
return nil
}
log.Infof("ClusterRoleBinding %q created, bound %q to %q", clusterBindingRoleName, serviceAccountName, clusterRoleName)
return nil
}
// InstallClusterManagerRBAC installs RBAC resources for a cluster manager to operate a cluster. Returns a token
func InstallClusterManagerRBAC(clientset kubernetes.Interface) (string, error) {
const ns = "kube-system"
var err error
err = CreateServiceAccount(clientset, ArgoCDManagerServiceAccount, ns)
if err != nil {
return "", err
}
err = CreateClusterRole(clientset, ArgoCDManagerClusterRole, ArgoCDManagerPolicyRules)
if err != nil {
return "", err
}
err = CreateClusterRoleBinding(clientset, ArgoCDManagerClusterRoleBinding, ArgoCDManagerServiceAccount, ArgoCDManagerClusterRole, ns)
if err != nil {
return "", err
}
var serviceAccount *apiv1.ServiceAccount
var secretName string
err = wait.Poll(500*time.Millisecond, 30*time.Second, func() (bool, error) {
serviceAccount, err = clientset.CoreV1().ServiceAccounts(ns).Get(ArgoCDManagerServiceAccount, metav1.GetOptions{})
if err != nil {
return false, err
}
if len(serviceAccount.Secrets) == 0 {
return false, nil
}
secretName = serviceAccount.Secrets[0].Name
return true, nil
})
if err != nil {
return "", fmt.Errorf("Failed to wait for service account secret: %v", err)
}
secret, err := clientset.CoreV1().Secrets(ns).Get(secretName, metav1.GetOptions{})
if err != nil {
return "", fmt.Errorf("Failed to retrieve secret %q: %v", secretName, err)
}
token, ok := secret.Data["token"]
if !ok {
return "", fmt.Errorf("Secret %q for service account %q did not have a token", secretName, serviceAccount)
}
return string(token), nil
}
// UninstallClusterManagerRBAC removes RBAC resources for a cluster manager to operate a cluster
func UninstallClusterManagerRBAC(clientset kubernetes.Interface) error {
return UninstallRBAC(clientset, "kube-system", ArgoCDManagerClusterRoleBinding, ArgoCDManagerClusterRole, ArgoCDManagerServiceAccount)
}
// UninstallRBAC uninstalls RBAC related resources for a binding, role, and service account
func UninstallRBAC(clientset kubernetes.Interface, namespace, bindingName, roleName, serviceAccount string) error {
if err := clientset.RbacV1().ClusterRoleBindings().Delete(bindingName, &metav1.DeleteOptions{}); err != nil {
if !apierr.IsNotFound(err) {
return fmt.Errorf("Failed to delete ClusterRoleBinding: %v", err)
}
log.Infof("ClusterRoleBinding %q not found", bindingName)
} else {
log.Infof("ClusterRoleBinding %q deleted", bindingName)
}
if err := clientset.RbacV1().ClusterRoles().Delete(roleName, &metav1.DeleteOptions{}); err != nil {
if !apierr.IsNotFound(err) {
return fmt.Errorf("Failed to delete ClusterRole: %v", err)
}
log.Infof("ClusterRole %q not found", roleName)
} else {
log.Infof("ClusterRole %q deleted", roleName)
}
if err := clientset.CoreV1().ServiceAccounts(namespace).Delete(serviceAccount, &metav1.DeleteOptions{}); err != nil {
if !apierr.IsNotFound(err) {
return fmt.Errorf("Failed to delete ServiceAccount: %v", err)
}
log.Infof("ServiceAccount %q in namespace %q not found", serviceAccount, namespace)
} else {
log.Infof("ServiceAccount %q deleted", serviceAccount)
}
return nil
}

68
common/version.go Normal file
View File

@@ -0,0 +1,68 @@
package common
import (
"fmt"
"runtime"
)
// Version information set by link flags during build. We fall back to these sane
// default values when we build outside the Makefile context (e.g. go run, go build, or go test).
var (
version = "99.99.99" // value from VERSION file
buildDate = "1970-01-01T00:00:00Z" // output from `date -u +'%Y-%m-%dT%H:%M:%SZ'`
gitCommit = "" // output from `git rev-parse HEAD`
gitTag = "" // output from `git describe --exact-match --tags HEAD` (if clean tree state)
gitTreeState = "" // determined from `git status --porcelain`. either 'clean' or 'dirty'
kubectlVersion = "" // determined from go.mod file
)
// Version contains Argo version information
type Version struct {
Version string
BuildDate string
GitCommit string
GitTag string
GitTreeState string
GoVersion string
Compiler string
Platform string
KubectlVersion string
}
func (v Version) String() string {
return v.Version
}
// GetVersion returns the version information
func GetVersion() Version {
var versionStr string
if gitCommit != "" && gitTag != "" && gitTreeState == "clean" {
// if we have a clean tree state and the current commit is tagged,
// this is an official release.
versionStr = gitTag
} else {
// otherwise formulate a version string based on as much metadata
// information we have available.
versionStr = "v" + version
if len(gitCommit) >= 7 {
versionStr += "+" + gitCommit[0:7]
if gitTreeState != "clean" {
versionStr += ".dirty"
}
} else {
versionStr += "+unknown"
}
}
return Version{
Version: versionStr,
BuildDate: buildDate,
GitCommit: gitCommit,
GitTag: gitTag,
GitTreeState: gitTreeState,
GoVersion: runtime.Version(),
Compiler: runtime.Compiler,
Platform: fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH),
KubectlVersion: kubectlVersion,
}
}

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More