Skip to content

Commit

Permalink
Add replicas for queue-worker/gateway for OpenFaaS
Browse files Browse the repository at this point in the history
* Allows --gateways and --queue-workers to be set to configure
replicas.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
  • Loading branch information
alexellis committed Dec 17, 2019
1 parent d9cb1fd commit f5390f6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/cmd/openfaas_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ func makeInstallOpenFaaS() *cobra.Command {
openfaas.Flags().Bool("clusterrole", false, "Create a ClusterRole for OpenFaaS instead of a limited scope Role")
openfaas.Flags().Bool("direct-functions", true, "Invoke functions directly from the gateway")

openfaas.Flags().Int("queue-workers", 1, "Replicas of queue-worker")
openfaas.Flags().Int("gateways", 1, "Replicas of gateway")

openfaas.Flags().Bool("helm3", false, "Use helm3 instead of the default helm2")

openfaas.RunE = func(command *cobra.Command, args []string) error {
Expand Down Expand Up @@ -162,18 +165,21 @@ func makeInstallOpenFaaS() *cobra.Command {
}

directFunctions, _ := command.Flags().GetBool("direct-functions")

directFunctionsVal := "true"
if !directFunctions {
directFunctionsVal = "false"
}
gateways, _ := command.Flags().GetInt("gateways")
queueWorkers, _ := command.Flags().GetInt("queue-workers")

overrides["clusterRole"] = clusterRoleVal
overrides["gateway.directFunctions"] = directFunctionsVal
overrides["operator.create"] = createOperatorVal
overrides["openfaasImagePullPolicy"] = pullPolicy
overrides["faasnetes.imagePullPolicy"] = functionPullPolicy
overrides["basicAuthPlugin.replicas"] = "1"
overrides["gateway.replicas"] = fmt.Sprintf("%d", gateways)
overrides["queueWorker.replicas"] = fmt.Sprintf("%d", queueWorkers)

basicAuth, _ := command.Flags().GetBool("basic-auth")

Expand Down

0 comments on commit f5390f6

Please sign in to comment.