Skip to content

Commit

Permalink
fix: Add --tls-certificate-secret-name parameter to server command. F…
Browse files Browse the repository at this point in the history
…ixes #5582  (#9789)

Signed-off-by: vladimir.ivanov <vladimir.ivanov@grasshopperasia.com>
  • Loading branch information
chtcvl committed Nov 30, 2022
1 parent 9cba932 commit 51625c2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
7 changes: 4 additions & 3 deletions cmd/argo/commands/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func NewServerCommand() *cobra.Command {
baseHRef string
secure bool
tlsCertificateSecretName string
htst bool
hsts bool
namespaced bool // --namespaced
managedNamespace string // --managed-namespace
enableOpenBrowser bool
Expand Down Expand Up @@ -153,7 +153,7 @@ See %s`, help.ArgoServer),
opts := apiserver.ArgoServerOpts{
BaseHRef: baseHRef,
TLSConfig: tlsConfig,
HSTS: htst,
HSTS: hsts,
Namespaced: namespaced,
Namespace: namespace,
Clients: clients,
Expand Down Expand Up @@ -217,7 +217,8 @@ See %s`, help.ArgoServer),
command.Flags().StringVar(&baseHRef, "basehref", defaultBaseHRef, "Value for base href in index.html. Used if the server is running behind reverse proxy under subpath different from /. Defaults to the environment variable BASE_HREF.")
// "-e" for encrypt, like zip
command.Flags().BoolVarP(&secure, "secure", "e", true, "Whether or not we should listen on TLS.")
command.Flags().BoolVar(&htst, "hsts", true, "Whether or not we should add a HTTP Secure Transport Security header. This only has effect if secure is enabled.")
command.Flags().StringVar(&tlsCertificateSecretName, "tls-certificate-secret-name", "", "The name of a Kubernetes secret that contains the server certificates")
command.Flags().BoolVar(&hsts, "hsts", true, "Whether or not we should add a HTTP Secure Transport Security header. This only has effect if secure is enabled.")
command.Flags().StringArrayVar(&authModes, "auth-mode", []string{"client"}, "API server authentication mode. Any 1 or more length permutation of: client,server,sso")
command.Flags().StringVar(&configMap, "configmap", common.ConfigMapName, "Name of K8s configmap to retrieve workflow controller configuration")
command.Flags().BoolVar(&namespaced, "namespaced", false, "run as namespaced mode")
Expand Down
1 change: 1 addition & 0 deletions docs/cli/argo_server.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ See https://argoproj.github.io/argo-workflows/argo-server/
--managed-namespace string namespace that watches, default to the installation namespace
--namespaced run as namespaced mode
-p, --port int Port to listen on (default 2746)
--tls-certificate-secret-name string The name of a Kubernetes secret that contains the server certificates
--x-frame-options string Set X-Frame-Options header in HTTP responses. (default "DENY")
```

Expand Down
5 changes: 4 additions & 1 deletion server/apiserver/argoserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,10 @@ func (as *argoServer) newHTTPServer(ctx context.Context, port int, artifactServe
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(MaxGRPCMessageSize)),
}
if as.tlsConfig != nil {
dialOpts = append(dialOpts, grpc.WithTransportCredentials(credentials.NewTLS(as.tlsConfig)))
tlsConfig := as.tlsConfig.Clone()
tlsConfig.InsecureSkipVerify = true
dCreds := credentials.NewTLS(tlsConfig)
dialOpts = append(dialOpts, grpc.WithTransportCredentials(dCreds))
} else {
dialOpts = append(dialOpts, grpc.WithTransportCredentials(insecure.NewCredentials()))
}
Expand Down

0 comments on commit 51625c2

Please sign in to comment.