Skip to content

Commit

Permalink
chore: numaflow server start args in a configmap (#1311)
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Wang <[email protected]>
  • Loading branch information
whynowy committed Nov 1, 2023
1 parent 8ed52b3 commit 3762992
Show file tree
Hide file tree
Showing 14 changed files with 413 additions and 18 deletions.
4 changes: 3 additions & 1 deletion cmd/commands/server-init.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import (
"strings"

"github.com/spf13/cobra"

sharedutil "github.com/numaproj/numaflow/pkg/shared/util"
)

func NewServerInitCommand() *cobra.Command {
Expand Down Expand Up @@ -53,7 +55,7 @@ func NewServerInitCommand() *cobra.Command {
},
}

command.Flags().StringVar(&baseHref, "base-href", "/", "Base href for Numaflow server, defaults to '/'.")
command.Flags().StringVar(&baseHref, "base-href", sharedutil.LookupEnvStringOr("NUMAFLOW_SERVER_BASE_HREF", "/"), "Base href for Numaflow server, defaults to '/'.")
return command
}

Expand Down
16 changes: 8 additions & 8 deletions cmd/commands/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ func NewServerCommand() *cobra.Command {
server.Start()
},
}
command.Flags().BoolVar(&insecure, "insecure", false, "Whether to disable TLS, defaults to false.")
command.Flags().IntVarP(&port, "port", "p", 8443, "Port to listen on, defaults to 8443 or 8080 if insecure is set")
command.Flags().BoolVar(&namespaced, "namespaced", false, "Whether to run in namespaced scope, defaults to false.")
command.Flags().StringVar(&managedNamespace, "managed-namespace", sharedutil.LookupEnvStringOr("NAMESPACE", "numaflow-system"), "The namespace that the server watches when \"--namespaced\" is \"true\".")
command.Flags().StringVar(&baseHref, "base-href", "/", "Base href for Numaflow server, defaults to '/'.")
command.Flags().BoolVar(&disableAuth, "disable-auth", false, "Whether to disable authentication and authorization, defaults to false.")
command.Flags().StringVar(&dexServerAddr, "dex-server-addr", "http://numaflow-dex-server:5556/dex", "The actual address of the Dex server for the reverse proxy to target.")
command.Flags().StringVar(&serverAddr, "server-addr", "https://localhost:8443", "The address of the Numaflow server.")
command.Flags().BoolVar(&insecure, "insecure", sharedutil.LookupEnvBoolOr("NUMAFLOW_SERVER_INSECURE", false), "Whether to disable TLS, defaults to false.")
command.Flags().IntVarP(&port, "port", "p", sharedutil.LookupEnvIntOr("NUMAFLOW_SERVER_PORT_NUMBER", 8443), "Port to listen on, defaults to 8443 or 8080 if insecure is set")
command.Flags().BoolVar(&namespaced, "namespaced", sharedutil.LookupEnvBoolOr("NUMAFLOW_SERVER_NAMESPACED", false), "Whether to run in namespaced scope, defaults to false.")
command.Flags().StringVar(&managedNamespace, "managed-namespace", sharedutil.LookupEnvStringOr("NUMAFLOW_SERVER_MANAGED_NAMESPACE", sharedutil.LookupEnvStringOr("NAMESPACE", "numaflow-system")), "The namespace that the server watches when \"--namespaced\" is \"true\".")
command.Flags().StringVar(&baseHref, "base-href", sharedutil.LookupEnvStringOr("NUMAFLOW_SERVER_BASE_HREF", "/"), "Base href for Numaflow server, defaults to '/'.")
command.Flags().BoolVar(&disableAuth, "disable-auth", sharedutil.LookupEnvBoolOr("NUMAFLOW_SERVER_DISABLE_AUTH", false), "Whether to disable authentication and authorization, defaults to false.")
command.Flags().StringVar(&dexServerAddr, "dex-server-addr", sharedutil.LookupEnvStringOr("NUMAFLOW_SERVER_DEX_SERVER_ADDR", "http://numaflow-dex-server:5556/dex"), "The address of the Dex server.")
command.Flags().StringVar(&serverAddr, "server-addr", sharedutil.LookupEnvStringOr("NUMAFLOW_SERVER_ADDRESS", "https://localhost:8443"), "The external address of the Numaflow server.")
return command
}
63 changes: 62 additions & 1 deletion config/advanced-install/namespaced-numaflow-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ subjects:
name: numaflow-server-sa
---
apiVersion: v1
data:
server.disable.auth: "true"
kind: ConfigMap
metadata:
name: numaflow-server-cmd-params-config
---
apiVersion: v1
data:
rbac-conf.yaml: |
policy.default: role:readonly
Expand Down Expand Up @@ -138,13 +145,60 @@ spec:
containers:
- args:
- server
- --disable-auth=true
- --namespaced
env:
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: NUMAFLOW_SERVER_INSECURE
valueFrom:
configMapKeyRef:
key: server.insecure
name: numaflow-server-cmd-params-config
optional: true
- name: NUMAFLOW_SERVER_PORT_NUMBER
valueFrom:
configMapKeyRef:
key: server.port
name: numaflow-server-cmd-params-config
optional: true
- name: NUMAFLOW_SERVER_NAMESPACED
valueFrom:
configMapKeyRef:
key: server.namespaced
name: numaflow-server-cmd-params-config
optional: true
- name: NUMAFLOW_SERVER_MANAGED_NAMESPACE
valueFrom:
configMapKeyRef:
key: server.managed.namespace
name: numaflow-server-cmd-params-config
optional: true
- name: NUMAFLOW_SERVER_BASE_HREF
valueFrom:
configMapKeyRef:
key: server.base.href
name: numaflow-server-cmd-params-config
optional: true
- name: NUMAFLOW_SERVER_DISABLE_AUTH
valueFrom:
configMapKeyRef:
key: server.disable.auth
name: numaflow-server-cmd-params-config
optional: true
- name: NUMAFLOW_SERVER_DEX_SERVER_ADDR
valueFrom:
configMapKeyRef:
key: server.dex.server
name: numaflow-server-cmd-params-config
optional: true
- name: NUMAFLOW_SERVER_ADDRESS
valueFrom:
configMapKeyRef:
key: server.address
name: numaflow-server-cmd-params-config
optional: true
image: quay.io/numaproj/numaflow:v1.0.0-rc1
imagePullPolicy: Always
livenessProbe:
Expand Down Expand Up @@ -174,6 +228,13 @@ spec:
initContainers:
- args:
- server-init
env:
- name: NUMAFLOW_SERVER_BASE_HREF
valueFrom:
configMapKeyRef:
key: server.base.href
name: numaflow-server-cmd-params-config
optional: true
image: quay.io/numaproj/numaflow:v1.0.0-rc1
imagePullPolicy: Always
name: server-init
Expand Down
63 changes: 63 additions & 0 deletions config/advanced-install/numaflow-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ subjects:
namespace: numaflow-system
---
apiVersion: v1
data:
server.disable.auth: "true"
kind: ConfigMap
metadata:
name: numaflow-server-cmd-params-config
namespace: numaflow-system
---
apiVersion: v1
data:
rbac-conf.yaml: |
policy.default: role:readonly
Expand Down Expand Up @@ -148,6 +156,54 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: NUMAFLOW_SERVER_INSECURE
valueFrom:
configMapKeyRef:
key: server.insecure
name: numaflow-server-cmd-params-config
optional: true
- name: NUMAFLOW_SERVER_PORT_NUMBER
valueFrom:
configMapKeyRef:
key: server.port
name: numaflow-server-cmd-params-config
optional: true
- name: NUMAFLOW_SERVER_NAMESPACED
valueFrom:
configMapKeyRef:
key: server.namespaced
name: numaflow-server-cmd-params-config
optional: true
- name: NUMAFLOW_SERVER_MANAGED_NAMESPACE
valueFrom:
configMapKeyRef:
key: server.managed.namespace
name: numaflow-server-cmd-params-config
optional: true
- name: NUMAFLOW_SERVER_BASE_HREF
valueFrom:
configMapKeyRef:
key: server.base.href
name: numaflow-server-cmd-params-config
optional: true
- name: NUMAFLOW_SERVER_DISABLE_AUTH
valueFrom:
configMapKeyRef:
key: server.disable.auth
name: numaflow-server-cmd-params-config
optional: true
- name: NUMAFLOW_SERVER_DEX_SERVER_ADDR
valueFrom:
configMapKeyRef:
key: server.dex.server
name: numaflow-server-cmd-params-config
optional: true
- name: NUMAFLOW_SERVER_ADDRESS
valueFrom:
configMapKeyRef:
key: server.address
name: numaflow-server-cmd-params-config
optional: true
image: quay.io/numaproj/numaflow:v1.0.0-rc1
imagePullPolicy: Always
livenessProbe:
Expand Down Expand Up @@ -177,6 +233,13 @@ spec:
initContainers:
- args:
- server-init
env:
- name: NUMAFLOW_SERVER_BASE_HREF
valueFrom:
configMapKeyRef:
key: server.base.href
name: numaflow-server-cmd-params-config
optional: true
image: quay.io/numaproj/numaflow:v1.0.0-rc1
imagePullPolicy: Always
name: server-init
Expand Down
1 change: 1 addition & 0 deletions config/base/numaflow-server/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ kind: Kustomization
resources:
- numaflow-server-sa.yaml
- numaflow-server-rbac-config.yaml
- numaflow-server-cmd-params-config.yaml
- numaflow-server-deployment.yaml
- numaflow-server-service.yaml
27 changes: 27 additions & 0 deletions config/base/numaflow-server/numaflow-server-cmd-params-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: numaflow-server-cmd-params-config
data:
### Whether to disable TLS.
# server.insecure: "false"
#
### Port to listen on, defaults to 8443 or 8080 if insecure is set.
# server.port: "8443"
#
### Whether to run in namespaced scope, defaults to false.
# server.namespaced: "false"
#
### The namespace that the server watches when "server.namespaced" is true.
# server.managed.namespace=numaflow-system
### Base href for Numaflow server, defaults to '/'.
# server.base.href: "/"
#
### Whether to disable authentication and authorization, defaults to false.
server.disable.auth: "true"
#
### The address of the Dex server for authentication.
# server.dex.server: http://numaflow-dex-server:5556/dex
#
### The external address of the Numaflow server. This is needed when using Dex for authentication.
# server.address=https://localhost:8443
65 changes: 59 additions & 6 deletions config/base/numaflow-server/numaflow-server-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ spec:
args:
- "server-init"
imagePullPolicy: Always
env:
- name: NUMAFLOW_SERVER_BASE_HREF
valueFrom:
configMapKeyRef:
name: numaflow-server-cmd-params-config
key: server.base.href
optional: true
volumeMounts:
- mountPath: /opt/numaflow
name: env-volume
Expand All @@ -40,8 +47,6 @@ spec:
image: quay.io/numaproj/numaflow:latest
args:
- "server"
# By default, turn off authentication and authorization.
- "--disable-auth=true"
imagePullPolicy: Always
volumeMounts:
- mountPath: /ui/build/runtime-env.js
Expand All @@ -53,10 +58,58 @@ spec:
- mountPath: /etc/numaflow
name: rbac-config
env:
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: NUMAFLOW_SERVER_INSECURE
valueFrom:
configMapKeyRef:
name: numaflow-server-cmd-params-config
key: server.insecure
optional: true
- name: NUMAFLOW_SERVER_PORT_NUMBER
valueFrom:
configMapKeyRef:
name: numaflow-server-cmd-params-config
key: server.port
optional: true
- name: NUMAFLOW_SERVER_NAMESPACED
valueFrom:
configMapKeyRef:
name: numaflow-server-cmd-params-config
key: server.namespaced
optional: true
- name: NUMAFLOW_SERVER_MANAGED_NAMESPACE
valueFrom:
configMapKeyRef:
name: numaflow-server-cmd-params-config
key: server.managed.namespace
optional: true
- name: NUMAFLOW_SERVER_BASE_HREF
valueFrom:
configMapKeyRef:
name: numaflow-server-cmd-params-config
key: server.base.href
optional: true
- name: NUMAFLOW_SERVER_DISABLE_AUTH
valueFrom:
configMapKeyRef:
name: numaflow-server-cmd-params-config
key: server.disable.auth
optional: true
- name: NUMAFLOW_SERVER_DEX_SERVER_ADDR
valueFrom:
configMapKeyRef:
name: numaflow-server-cmd-params-config
key: server.dex.server
optional: true
- name: NUMAFLOW_SERVER_ADDRESS
valueFrom:
configMapKeyRef:
name: numaflow-server-cmd-params-config
key: server.address
optional: true
resources:
limits:
cpu: 500m
Expand Down
Loading

0 comments on commit 3762992

Please sign in to comment.