@@ -42,12 +42,12 @@ func MakeInstallOpenFaaS() *cobra.Command {
42
42
openfaas .Flags ().String ("pull-policy" , "IfNotPresent" , "Pull policy for OpenFaaS core services" )
43
43
openfaas .Flags ().String ("function-pull-policy" , "Always" , "Pull policy for functions" )
44
44
45
- openfaas .Flags ().Bool ("operator" , false , "Create OpenFaaS Operator" )
45
+ openfaas .Flags ().Bool ("operator" , true , "Create OpenFaaS Operator" )
46
46
openfaas .Flags ().Bool ("clusterrole" , false , "Create a ClusterRole for OpenFaaS instead of a limited scope Role" )
47
47
openfaas .Flags ().Bool ("direct-functions" , false , "Invoke functions directly from the gateway, or load-balance via endpoint IPs when set to false" )
48
- openfaas .Flags ().Bool ("autoscaler" , false , "Deploy OpenFaaS with the autoscaler enabled" )
49
- openfaas .Flags ().Bool ( "jetstream " , false , "Deploy OpenFaaS with jetstream queue mode " )
50
- openfaas .Flags ().Bool ("dashboard" , false , "Deploy OpenFaaS with the dashboard enabled" )
48
+ openfaas .Flags ().Bool ("autoscaler" , true , "Deploy OpenFaaS with the autoscaler enabled" )
49
+ openfaas .Flags ().String ( "queue-mode " , "static" , "Configure the consumer mode for the queue-worker: \" static \" or \" function \" " )
50
+ openfaas .Flags ().Bool ("dashboard" , true , "Deploy OpenFaaS with the dashboard enabled" )
51
51
52
52
openfaas .Flags ().Int ("queue-workers" , 1 , "Replicas of queue-worker for HA" )
53
53
openfaas .Flags ().Int ("max-inflight" , 1 , "Max tasks for queue-worker to process in parallel" )
@@ -61,6 +61,8 @@ func MakeInstallOpenFaaS() *cobra.Command {
61
61
62
62
openfaas .Flags ().String ("license-file" , "" , "Path to OpenFaaS Pro license file" )
63
63
64
+ openfaas .Flags ().StringArrayP ("values" , "f" , []string {}, "Specify one or more local values.yaml files for overrides." )
65
+
64
66
openfaas .RunE = func (command * cobra.Command , args []string ) error {
65
67
appOpts := types .DefaultInstallOptions ()
66
68
@@ -77,19 +79,17 @@ func MakeInstallOpenFaaS() *cobra.Command {
77
79
clusterRole , _ := command .Flags ().GetBool ("clusterrole" )
78
80
directFunctions , _ := command .Flags ().GetBool ("direct-functions" )
79
81
autoscaler , _ := command .Flags ().GetBool ("autoscaler" )
80
- jetstream , _ := command .Flags ().GetBool ("jetstream" )
81
82
dashboard , _ := command .Flags ().GetBool ("dashboard" )
82
83
gateways , _ := command .Flags ().GetInt ("gateways" )
83
84
maxInflight , _ := command .Flags ().GetInt ("max-inflight" )
84
85
queueWorkers , _ := command .Flags ().GetInt ("queue-workers" )
85
86
ingressOperator , _ := command .Flags ().GetBool ("ingress-operator" )
86
87
lb , _ := command .Flags ().GetBool ("load-balancer" )
88
+ queueMode , _ := command .Flags ().GetString ("queue-mode" )
89
+ valuesFiles , _ := command .Flags ().GetStringArray ("values" )
87
90
88
91
overrides := map [string ]string {}
89
92
90
- arch := k8s .GetNodeArchitecture ()
91
- valuesSuffix := getValuesSuffix (arch )
92
-
93
93
_ , err := k8s .KubectlTask ("apply" , "-f" ,
94
94
"https://raw.githubusercontent.com/openfaas/faas-netes/master/namespaces.yml" )
95
95
@@ -120,17 +120,14 @@ func MakeInstallOpenFaaS() *cobra.Command {
120
120
overrides ["gateway.logsProviderURL" ] = logUrl
121
121
}
122
122
123
- // If license file is sent, then we assume to set the --pro flag and create the secret
124
- if len (licenseFile ) != 0 {
125
- overrides ["openfaasPro" ] = "true"
126
- secretData := []types.SecretsData {
127
- {Type : types .FromFileSecret , Key : "license" , Value : licenseFile },
128
- }
129
-
130
- proLicense := types .NewGenericSecret ("openfaas-license" , namespace , secretData )
131
- appOpts .WithSecret (proLicense )
123
+ overrides ["openfaasPro" ] = "true"
124
+ secretData := []types.SecretsData {
125
+ {Type : types .FromFileSecret , Key : "license" , Value : licenseFile },
132
126
}
133
127
128
+ proLicense := types .NewGenericSecret ("openfaas-license" , namespace , secretData )
129
+ appOpts .WithSecret (proLicense )
130
+
134
131
if dashboard {
135
132
privateKey , publicKey , err := generateJWTKeyPair ()
136
133
if err != nil {
@@ -146,49 +143,77 @@ func MakeInstallOpenFaaS() *cobra.Command {
146
143
appOpts .WithSecret (dashboardJWT )
147
144
}
148
145
149
- overrides ["clusterRole" ] = strconv .FormatBool (clusterRole )
150
- overrides ["gateway.directFunctions" ] = strconv .FormatBool (directFunctions )
151
- overrides ["operator.create" ] = strconv .FormatBool (createOperator )
152
- overrides ["openfaasImagePullPolicy" ] = pullPolicy
153
- overrides ["faasnetes.imagePullPolicy" ] = functionPullPolicy
154
- overrides ["basicAuthPlugin.replicas" ] = "1"
155
- overrides ["gateway.replicas" ] = fmt .Sprintf ("%d" , gateways )
146
+ overrides ["jetstreamQueueWorker.mode" ] = queueMode
147
+
148
+ if command .Flags ().Changed ("clusterrole" ) {
149
+ overrides ["clusterRole" ] = strconv .FormatBool (clusterRole )
150
+ }
151
+
152
+ if command .Flags ().Changed ("direct-functions" ) {
153
+ overrides ["gateway.directFunctions" ] = strconv .FormatBool (directFunctions )
154
+ }
155
+
156
+ if command .Flags ().Changed ("operator" ) {
157
+ overrides ["operator.create" ] = strconv .FormatBool (createOperator )
158
+ }
159
+
160
+ if command .Flags ().Changed ("pull-policy" ) {
161
+ overrides ["openfaasImagePullPolicy" ] = pullPolicy
162
+ overrides ["faasnetes.imagePullPolicy" ] = functionPullPolicy
163
+ }
164
+
165
+ if command .Flags ().Changed ("gateways" ) {
166
+ overrides ["gateway.replicas" ] = fmt .Sprintf ("%d" , gateways )
167
+ }
168
+
169
+ if command .Flags ().Changed ("queue-workers" ) {
170
+ overrides ["queueWorker.replicas" ] = fmt .Sprintf ("%d" , queueWorkers )
171
+ }
172
+
173
+ if command .Flags ().Changed ("max-inflight" ) {
174
+ overrides ["queueWorker.maxInflight" ] = fmt .Sprintf ("%d" , maxInflight )
175
+ }
176
+
177
+ if command .Flags ().Changed ("autoscaler" ) {
178
+ overrides ["autoscaler.enabled" ] = strconv .FormatBool (autoscaler )
179
+ }
180
+
181
+ if command .Flags ().Changed ("dashboard" ) {
182
+ overrides ["dashboard.enabled" ] = strconv .FormatBool (dashboard )
183
+ }
184
+
156
185
overrides ["ingressOperator.create" ] = strconv .FormatBool (ingressOperator )
157
- overrides ["queueWorker.replicas" ] = fmt .Sprintf ("%d" , queueWorkers )
158
- overrides ["queueWorker.maxInflight" ] = fmt .Sprintf ("%d" , maxInflight )
159
- overrides ["autoscaler.enabled" ] = strconv .FormatBool (autoscaler )
160
- overrides ["dashboard.enabled" ] = strconv .FormatBool (dashboard )
161
- overrides ["dashboard.publicURL" ] = "http://127.0.0.1:8080"
162
186
163
- // the value in the template is "basic_auth" not the more usual basicAuth
164
- overrides ["basic_auth" ] = strconv .FormatBool (basicAuthEnabled )
187
+ if command .Flags ().Changed ("basic-auth" ) {
188
+ overrides ["basic_auth" ] = strconv .FormatBool (basicAuthEnabled )
189
+ }
165
190
166
191
overrides ["serviceType" ] = "NodePort"
167
192
168
193
if lb {
169
194
overrides ["serviceType" ] = "LoadBalancer"
170
195
}
171
196
172
- if jetstream {
173
- overrides ["queueMode" ] = "jetstream"
174
- }
175
-
176
197
customFlags , _ := command .Flags ().GetStringArray ("set" )
177
198
if err := config .MergeFlags (overrides , customFlags ); err != nil {
178
199
return err
179
200
}
180
201
181
202
appOpts .
182
203
WithKubeconfigPath (kubeConfigPath ).
204
+ WithValuesFiles ([]string {`https://raw.githubusercontent.com/openfaas/faas-netes/refs/heads/master/chart/openfaas/values-pro.yaml` }).
183
205
WithOverrides (overrides ).
184
- WithValuesFile (fmt .Sprintf ("values%s.yaml" , valuesSuffix )).
185
206
WithHelmURL ("https://openfaas.github.io/faas-netes/" ).
186
207
WithHelmRepo ("openfaas/openfaas" ).
187
208
WithHelmUpdateRepo (updateRepo ).
188
209
WithNamespace (namespace ).
189
210
WithInstallNamespace (false ).
190
211
WithWait (wait )
191
212
213
+ if len (valuesFiles ) > 0 {
214
+ appOpts .WithValuesFiles (valuesFiles )
215
+ }
216
+
192
217
if _ , err := apps .MakeInstallChart (appOpts ); err != nil {
193
218
return err
194
219
}
@@ -238,11 +263,6 @@ func MakeInstallOpenFaaS() *cobra.Command {
238
263
return err
239
264
}
240
265
241
- _ , err = cmd .Flags ().GetBool ("jetstream" )
242
- if err != nil {
243
- return err
244
- }
245
-
246
266
_ , err = cmd .Flags ().GetBool ("dashboard" )
247
267
if err != nil {
248
268
return err
@@ -321,8 +341,14 @@ func generateJWTKeyPair() ([]byte, []byte, error) {
321
341
return privOut .Bytes (), pubOut .Bytes (), nil
322
342
}
323
343
324
- const OpenFaaSInfoMsg = `# Get the faas-cli
325
- curl -SLsf https://cli.openfaas.com | sudo sh
344
+ const OpenFaaSInfoMsg = `# You've installed OpenFaaS Pro 👍
345
+ # OpenFaaS Standard or for Enterprises is now running (depending on your license)
346
+
347
+ # Read the EULA before continuing:
348
+ https://github.com/openfaas/faas/blob/master/pro/EULA.md
349
+
350
+ # Get the faas-cli
351
+ arkade get faas-cli
326
352
327
353
# Forward the gateway to your machine
328
354
kubectl rollout status -n openfaas deploy/gateway
@@ -332,18 +358,12 @@ kubectl port-forward -n openfaas svc/gateway 8080:8080 &
332
358
PASSWORD=$(kubectl get secret -n openfaas basic-auth -o jsonpath="{.data.basic-auth-password}" | base64 --decode; echo)
333
359
echo -n $PASSWORD | faas-cli login --username admin --password-stdin
334
360
335
- faas-cli store deploy figlet
361
+ faas-cli store deploy env
336
362
faas-cli list
337
-
338
- # For Raspberry Pi
339
- faas-cli store list \
340
- --platform armhf
341
-
342
- faas-cli store deploy figlet \
343
- --platform armhf
363
+ faas-cli describe env
344
364
345
365
# Find out more at:
346
- # https://github. com/openfaas/faas `
366
+ # https://docs.openfaas. com/`
347
367
348
368
const openfaasPostInstallMsg = `=======================================================================
349
369
= OpenFaaS has been installed. =
0 commit comments