Skip to content
This repository was archived by the owner on Oct 19, 2024. It is now read-only.

Commit c461d62

Browse files
feat: support plaintext connection to repo-server (#296)
Signed-off-by: Ryota Sakamoto <[email protected]>
1 parent 88205cf commit c461d62

File tree

7 files changed

+169
-95
lines changed

7 files changed

+169
-95
lines changed

cmd/controller.go

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,18 @@ const (
2828

2929
func newControllerCommand() *cobra.Command {
3030
var (
31-
clientConfig clientcmd.ClientConfig
32-
processorsCount int
33-
namespace string
34-
appLabelSelector string
35-
logLevel string
36-
logFormat string
37-
metricsPort int
38-
argocdRepoServer string
39-
configMapName string
40-
secretName string
31+
clientConfig clientcmd.ClientConfig
32+
processorsCount int
33+
namespace string
34+
appLabelSelector string
35+
logLevel string
36+
logFormat string
37+
metricsPort int
38+
argocdRepoServer string
39+
argocdRepoServerPlaintext bool
40+
argocdRepoServerStrictTLS bool
41+
configMapName string
42+
secretName string
4143
)
4244
var command = cobra.Command{
4345
Use: "controller",
@@ -78,7 +80,7 @@ func newControllerCommand() *cobra.Command {
7880
return fmt.Errorf("Unknown log format '%s'", logFormat)
7981
}
8082

81-
argocdService, err := argocd.NewArgoCDService(k8sClient, namespace, argocdRepoServer)
83+
argocdService, err := argocd.NewArgoCDService(k8sClient, namespace, argocdRepoServer, argocdRepoServerPlaintext, argocdRepoServerStrictTLS)
8284
if err != nil {
8385
return err
8486
}
@@ -115,6 +117,8 @@ func newControllerCommand() *cobra.Command {
115117
command.Flags().StringVar(&logFormat, "logformat", "text", "Set the logging format. One of: text|json")
116118
command.Flags().IntVar(&metricsPort, "metrics-port", defaultMetricsPort, "Metrics port")
117119
command.Flags().StringVar(&argocdRepoServer, "argocd-repo-server", "argocd-repo-server:8081", "Argo CD repo server address")
120+
command.Flags().BoolVar(&argocdRepoServerPlaintext, "argocd-repo-server-plaintext", false, "Use a plaintext client (non-TLS) to connect to repository server")
121+
command.Flags().BoolVar(&argocdRepoServerStrictTLS, "argocd-repo-server-strict-tls", false, "Perform strict validation of TLS certificates when connecting to repo server")
118122
command.Flags().StringVar(&configMapName, "config-map-name", "argocd-notifications-cm", "Set notifications ConfigMap name")
119123
command.Flags().StringVar(&secretName, "secret-name", "argocd-notifications-secret", "Set notifications Secret name")
120124
return &command

cmd/tools/tools.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ import (
1515

1616
func NewToolsCommand() *cobra.Command {
1717
var (
18-
argocdRepoServer string
18+
argocdRepoServer string
19+
argocdRepoServerPlaintext bool
20+
argocdRepoServerStrictTLS bool
1921
)
2022

2123
var argocdService argocd.Service
@@ -32,11 +34,13 @@ func NewToolsCommand() *cobra.Command {
3234
if err != nil {
3335
log.Fatalf("Failed to parse k8s config: %v", err)
3436
}
35-
argocdService, err = argocd.NewArgoCDService(kubernetes.NewForConfigOrDie(k8sCfg), ns, argocdRepoServer)
37+
argocdService, err = argocd.NewArgoCDService(kubernetes.NewForConfigOrDie(k8sCfg), ns, argocdRepoServer, argocdRepoServerPlaintext, argocdRepoServerStrictTLS)
3638
if err != nil {
3739
log.Fatalf("Failed to initalize Argo CD service: %v", err)
3840
}
3941
})
4042
toolsCommand.PersistentFlags().StringVar(&argocdRepoServer, "argocd-repo-server", "argocd-repo-server:8081", "Argo CD repo server address")
43+
toolsCommand.PersistentFlags().BoolVar(&argocdRepoServerPlaintext, "argocd-repo-server-plaintext", false, "Use a plaintext client (non-TLS) to connect to repository server")
44+
toolsCommand.PersistentFlags().BoolVar(&argocdRepoServerStrictTLS, "argocd-repo-server-strict-tls", false, "Perform strict validation of TLS certificates when connecting to repo server")
4145
return toolsCommand
4246
}

0 commit comments

Comments
 (0)