* Add `Prompt`, with `prompts.enabled` setting in `argocd-cm`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Make `SettingsOpts`, `SettingsOpts.ArgocdCMPath`, `SettingsOpts.CreateSettingsManager()` and `commandContext.CreateSettingsManager()` exportable
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Add `prompt_test.go`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Refactor `NewPrompt()` and move into new package `utils`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Update `NewPrompt()` to use local config
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Add `NewConfigurationCommand()`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Move `prompt_test.go`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Remove `prompt_test.go` for now
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Add back and update `prompt_test.go`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Add `configuration_test.go`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Fix linting issues
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Fix linting issues
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Reverse early-termination logic in `Confirm()`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Rename `ArgocdCMPath` to `argocdCMPath`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Rename `SettingsOpts` to `settingsOpts`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Rename `CreateSettingsManager()` to `createSettingsManager()`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Rename `configuration` to `configure`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Further rename `configuration` to `configure`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Remove redundant Argo CD ConfigMap logic
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Fix terminal output spacing
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Make `argocd configure` use local config value as the default value for `--prompts-enabled`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Add global CLI flag `--force-prompts-enabled`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Update existing `prompt_test.go` test cases
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Add test case for `(p *Prompt).Confirm()`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Add test cases for `GetBoolFlagWithFallback()` to `env_test.go`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Format imports
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Further format imports and remove unused variable
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Again format imports
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Add fallback to `GetPromptsEnabled()`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Fix bug in `GetPromptsEnabled()`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Fix missing import
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Add auto-generated docs for `argocd configure`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Add auto-generated docs for new global CLI flag `--force-prompts-enabled`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Update `NewPrompt()` to receive a `bool` rather than `*apiclient.ClientOptions` arg
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Remove arg `fallback` from `GetPromptsEnabled()`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Add arg `useCLIOpts bool` to `GetPromptsEnabled()`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Make `config.LoadFlags()` exportable
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Add tests for `GetPromptsEnabled()`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Fix linting errors in tests
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Run `make codegen-local`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
---------
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
This commit replaces `os.Setenv` with `t.Setenv` in tests. The
environment variable is automatically restored to its original value
when the test and all its subtests complete.
Reference: https://pkg.go.dev/testing#T.Setenv
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
At the time of making this commit, the package `github.com/ghodss/yaml`
is no longer actively maintained.
`sigs.k8s.io/yaml` is a permanent fork of `ghodss/yaml` and is actively
maintained by Kubernetes SIG.
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* Add ksonnet version to version endpoint
I needed to move config.go out of the cli package to fix a circular dependency.
* Remove ksonnetVersion field from the ArgoCD version struct
This change implements SSO support.
dex is run as a sidecar to the ArgoCD API server, which fronts dex using a reverse proxy. The end result is that the ArgoCD acts as an OIDC provider serving under /api/dex. The login flow begins at /auth/login, which redirects to the Dex's OAuth2 consent page and ultimately directed to the IdP provider's login page, where they enter their credentials. After logging in, the OAuth2 redirect flows back to the client app, ultimately reaching /auth/callback, where the OIDC token claims are signed, and persisted in the users's cookie.
The dex configuration YAML is formulated during startup (through the argocd-util utility), with the configuration values taken from the argocd-cm configmap and the argocd-secret.
The build process was refactored to build argocd-util statically, so that it could be run inside off-the-shelf dex, which is built from alpine. Also, build speed was improved by expanding the default make targets in the Dockerfile, to avoid rebuilding each binary from scratch
Session management was refactored to use more bare-bones jwt library constructs, so we could reuse code from the user/password flow vs. OAuth2 flow.
* Initial SSO support. Run dex as sidecar. Generate dex config from ArgoCD cm and secret
* Sign and write SSO claims to JWT cookie during SSO login. Refactor session manager
* Build argo-util statically so it can run in dex sidecar. Redirect after SSO login
* Simplify app creation process to not require communication to dex gRPC server
* Refactor local ~/.argocd/config to be similar to kube configs
* `argo login` will detect TLS issues and prompt user before writing config
* version server is unauthenticated and `argo version` will report server version
* Re-arrange utilities into more granular packages
* Simplify config manager interface into just Get() and Save()
* Support installation into different namespace
* Combine all secrets into single secret
* Use a hard-wired configmap name
* Admin username is no longer configurable