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

Commit

Permalink
feat: support plaintext connection to repo-server (#296)
Browse files Browse the repository at this point in the history
Signed-off-by: Ryota Sakamoto <[email protected]>
  • Loading branch information
ryota-sakamoto authored Jun 4, 2021
1 parent 88205cf commit c461d62
Show file tree
Hide file tree
Showing 7 changed files with 169 additions and 95 deletions.
26 changes: 15 additions & 11 deletions cmd/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,18 @@ const (

func newControllerCommand() *cobra.Command {
var (
clientConfig clientcmd.ClientConfig
processorsCount int
namespace string
appLabelSelector string
logLevel string
logFormat string
metricsPort int
argocdRepoServer string
configMapName string
secretName string
clientConfig clientcmd.ClientConfig
processorsCount int
namespace string
appLabelSelector string
logLevel string
logFormat string
metricsPort int
argocdRepoServer string
argocdRepoServerPlaintext bool
argocdRepoServerStrictTLS bool
configMapName string
secretName string
)
var command = cobra.Command{
Use: "controller",
Expand Down Expand Up @@ -78,7 +80,7 @@ func newControllerCommand() *cobra.Command {
return fmt.Errorf("Unknown log format '%s'", logFormat)
}

argocdService, err := argocd.NewArgoCDService(k8sClient, namespace, argocdRepoServer)
argocdService, err := argocd.NewArgoCDService(k8sClient, namespace, argocdRepoServer, argocdRepoServerPlaintext, argocdRepoServerStrictTLS)
if err != nil {
return err
}
Expand Down Expand Up @@ -115,6 +117,8 @@ func newControllerCommand() *cobra.Command {
command.Flags().StringVar(&logFormat, "logformat", "text", "Set the logging format. One of: text|json")
command.Flags().IntVar(&metricsPort, "metrics-port", defaultMetricsPort, "Metrics port")
command.Flags().StringVar(&argocdRepoServer, "argocd-repo-server", "argocd-repo-server:8081", "Argo CD repo server address")
command.Flags().BoolVar(&argocdRepoServerPlaintext, "argocd-repo-server-plaintext", false, "Use a plaintext client (non-TLS) to connect to repository server")
command.Flags().BoolVar(&argocdRepoServerStrictTLS, "argocd-repo-server-strict-tls", false, "Perform strict validation of TLS certificates when connecting to repo server")
command.Flags().StringVar(&configMapName, "config-map-name", "argocd-notifications-cm", "Set notifications ConfigMap name")
command.Flags().StringVar(&secretName, "secret-name", "argocd-notifications-secret", "Set notifications Secret name")
return &command
Expand Down
8 changes: 6 additions & 2 deletions cmd/tools/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ import (

func NewToolsCommand() *cobra.Command {
var (
argocdRepoServer string
argocdRepoServer string
argocdRepoServerPlaintext bool
argocdRepoServerStrictTLS bool
)

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

0 comments on commit c461d62

Please sign in to comment.