Skip to content

Commit f0a27ae

Browse files
committed
feat(argocd client): Add handling of argocd-api-plaintext option
fixes #168 Signed-off-by: Grzegorz Głąb <grzesuav@gmail.com>
1 parent e17621c commit f0a27ae

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

cmd/root.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,11 @@ func init() {
5959
stringFlag(flags, "argocd-api-server-addr", "ArgoCD API Server Address.",
6060
newStringOpts().
6161
withDefault("argocd-server"))
62-
boolFlag(flags, "argocd-api-insecure", "Enable to use insecure connections to the ArgoCD API server.")
62+
boolFlag(flags, "argocd-api-insecure", "Enable to use insecure connections over TLS to the ArgoCD API server.")
6363
stringFlag(flags, "argocd-api-namespace", "ArgoCD namespace where the application watcher will read Custom Resource Definitions (CRD) for Application and ApplicationSet resources.",
6464
newStringOpts().
6565
withDefault("argocd"))
66+
boolFlag(flags, "argocd-api-plaintext", "Enable to use connections with TLS disabled")
6667
stringFlag(flags, "kubernetes-type", "Kubernetes Type One of eks, or local. Defaults to local.",
6768
newStringOpts().
6869
withChoices("eks", "local").

pkg/argo_client/client.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ func NewArgoClient(cfg config.ServerConfig) (*ArgoClient, error) {
2727
AuthToken: cfg.ArgoCDToken,
2828
GRPCWebRootPath: cfg.ArgoCDPathPrefix,
2929
Insecure: cfg.ArgoCDInsecure,
30+
PlainText: cfg.ArgoCDPlainText,
3031
}
3132

3233
log.Info().

pkg/config/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ type ServerConfig struct {
2222
ArgoCDPathPrefix string `mapstructure:"argocd-api-path-prefix"`
2323
ArgoCDInsecure bool `mapstructure:"argocd-api-insecure"`
2424
ArgoCDNamespace string `mapstructure:"argocd-api-namespace"`
25+
ArgoCDPlainText bool `mapstructure:"argocd-api-plaintext"`
2526
KubernetesConfig string `mapstructure:"kubernetes-config"`
2627
KubernetesType string `mapstructure:"kubernetes-type"`
2728
KubernetesClusterID string `mapstructure:"kubernetes-clusterid"`

pkg/config/config_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@ func TestNew(t *testing.T) {
1616
v := viper.New()
1717
v.Set("log-level", "info")
1818
v.Set("argocd-api-insecure", "true")
19+
v.Set("argocd-api-plaintext", "true")
1920
v.Set("worst-conftest-state", "warning")
2021
v.Set("repo-refresh-interval", "10m")
2122

2223
cfg, err := NewWithViper(v)
2324
require.NoError(t, err)
2425
assert.Equal(t, zerolog.InfoLevel, cfg.LogLevel)
2526
assert.Equal(t, true, cfg.ArgoCDInsecure)
27+
assert.Equal(t, true, cfg.ArgoCDPlainText)
2628
assert.Equal(t, pkg.StateWarning, cfg.WorstConfTestState, "worst states can be overridden")
2729
assert.Equal(t, time.Minute*10, cfg.RepoRefreshInterval)
2830
}

0 commit comments

Comments
 (0)