Skip to content

Commit 03616ca

Browse files
committed
Enable autoscaler by default for openfaasPro users
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
1 parent de3c524 commit 03616ca

File tree

4 files changed

+31
-30
lines changed

4 files changed

+31
-30
lines changed

chart/openfaas/README.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,15 @@ Get it from arkade:
4848
arkade get helm
4949
```
5050

51-
Or use the helm3 installer:
51+
Or use the Helm installation script:
5252

5353
```bash
5454
curl -sSLf https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
5555
```
5656

57-
We recommend creating two namespaces, one for the OpenFaaS *core services* and one for the *functions*:
57+
We recommend creating two namespaces, one for the OpenFaaS *core services* and one for the *functions*.
58+
59+
You can skip this step if you're using arkade to install OpenFaaS.
5860

5961
```sh
6062
kubectl apply -f https://raw.githubusercontent.com/openfaas/faas-netes/master/namespaces.yml
@@ -70,19 +72,17 @@ helm repo add openfaas https://openfaas.github.io/faas-netes/
7072

7173
Now decide how you want to expose the services and edit the `helm upgrade` command as required.
7274

73-
* To use NodePorts (default) pass no additional flags
74-
* To use a LoadBalancer add `--set serviceType=LoadBalancer`
75-
* To use an IngressController add `--set ingress.enabled=true`
76-
77-
> Note: even without a LoadBalancer or IngressController you can access your gateway at any time via `kubectl port-forward`.
75+
* To use NodePorts/ClusterIP - (the default and best for development, with port-forwarding)
76+
* To use an IngressController add `--set ingress.enabled=true` (recommended for production, for use with TLS)
77+
* To use a LoadBalancer add `--set serviceType=LoadBalancer` (not recommended, since it will expose plain HTTP)
7878

79-
## Deploy OpenFaaS Community Edition
79+
## Deploy OpenFaaS Community Edition (CE)
8080

81-
> The Community Edition is meant for open source developers
81+
> OpenFaaS Community Edition is meant exploration and development.
82+
>
83+
> OpenFaaS Pro has been tuned for production use including flexible auto-scaling, high-available deployments, durability, add-on features, and more.
8284
83-
> OpenFaaS Pro customers should read on to the next section for production deployments.
84-
85-
Now deploy OpenFaaS from the helm chart repo:
85+
Deploy CE from the helm chart repo directly:
8686

8787
```sh
8888
helm repo update \
@@ -101,9 +101,11 @@ PASSWORD=$(kubectl -n openfaas get secret basic-auth -o jsonpath="{.data.basic-a
101101
echo "OpenFaaS admin password: $PASSWORD"
102102
```
103103

104-
## Deploy as an OpenFaaS Pro customer
104+
It is not recommended to disable basic authentication.
105+
106+
## Deploy OpenFaaS Pro
105107

106-
* Create the required secret with your [OpenFaaS Pro license](https://www.openfaas.com/support/):
108+
* Create the required secret with your [OpenFaaS Pro license](https://www.openfaas.com/pricing/):
107109

108110
```bash
109111
kubectl create secret generic \
@@ -502,7 +504,7 @@ yaml) |
502504
| Parameter | Description | Default |
503505
| ----------------------- | ---------------------------------- | ---------------------------------------------------------- |
504506
| `autoscaler.disableHorizontalScaling` | Set to true, to only scale to zero, without scaling replicas between the defined Min and Max count for the function | `false` |
505-
| `autoscaler.enabled ` | Enable the autoscaler | `false` |
507+
| `autoscaler.enabled ` | Enable the autoscaler - if openfaasPro is set to true | `true` |
506508
| `autoscaler.image` | Container image used for the autoscaler | See [values.yaml](./values.yaml) |
507509
| `autoscaler.replicas` | Replicas of the autoscaler | `1` |
508510
| `autoscaler.resources` | Resource limits and requests for the autoscaler pods | See [values.yaml](./values.yaml) |

chart/openfaas/templates/autoscaler-dep.yaml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- if .Values.openfaasPro }}
12
{{- if .Values.autoscaler.enabled }}
23
apiVersion: apps/v1
34
kind: Deployment
@@ -28,29 +29,21 @@ spec:
2829
secret:
2930
secretName: basic-auth
3031
{{- end }}
31-
{{- if .Values.autoscaler.enabled }}
3232
- name: license
3333
secret:
3434
secretName: openfaas-license
35-
{{- end }}
3635
containers:
3736
- name: autoscaler
3837
resources:
3938
{{- .Values.autoscaler.resources | toYaml | nindent 12 }}
40-
{{- if .Values.autoscaler.enabled }}
41-
image: {{ .Values.autoscaler.image }}
42-
{{- else }}
4339
image: {{ .Values.autoscaler.image }}
44-
{{- end }}
4540
imagePullPolicy: {{ .Values.openfaasImagePullPolicy }}
46-
{{- if .Values.autoscaler.enabled }}
4741
command:
4842
- "/usr/bin/autoscaler"
4943
- "-license-file=/var/secrets/license/license"
5044
{{- if eq (or .Values.autoscaler.disableHorizontalScaling false) true }}
5145
- "-horizontal-scaling=false"
5246
{{- end }}
53-
{{- end }}
5447
env:
5548
- name: gateway_url
5649
value: "http://gateway.{{ .Release.Namespace }}:8080/"
@@ -64,11 +57,9 @@ spec:
6457
- name: basic_auth
6558
value: "{{ .Values.basic_auth }}"
6659
volumeMounts:
67-
{{- if .Values.autoscaler.enabled }}
6860
- name: license
6961
readOnly: true
7062
mountPath: "/var/secrets/license"
71-
{{- end }}
7263
- name: auth
7364
readOnly: true
7465
mountPath: "/var/secrets/autoscaler"
@@ -86,3 +77,4 @@ spec:
8677
{{ toYaml . | indent 8 }}
8778
{{- end }}
8879
{{- end }}
80+
{{- end }}

chart/openfaas/values-pro.yaml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,18 @@
44
# Initial configuration to set Pro configurations on
55
openfaasPro: true
66

7-
# The operator mode supports the Function CustomResource
8-
# which enables tooling like ArgoCD / Flux v2
7+
# Recommended operating mode for the OpenFaaS controller aka "faas-netes"
8+
# is operator mode, including a CustomResource for functions.
9+
#
10+
# The operator mode is required for GitOps tooling like ArgoCD / Flux v2
11+
# and to export existing functions for backup purposes.
912
operator:
1013
create: true
1114

12-
# Do not turn off, enables authentication on all core components
15+
# Enable authentication on all OpenFaaS core components.
16+
# You must not turn off basicAuth, however, you can pre-create the
17+
# secret, if you're using a GitOps tool to create a stable secret
18+
# before installing OpenFaaS Pro via this chart
1319
generateBasicAuth: true
1420

1521
# Follow docs at: https://docs.openfaas.com/openfaas-pro/dashboard/
@@ -18,8 +24,9 @@ dashboard:
1824
publicURL: localhost
1925
enabled: true
2026

27+
# The autoscaler is enabled by default
28+
# Learn more:
2129
# https://docs.openfaas.com/architecture/autoscaling/
22-
# The autoscaler is not enabled by default, but should be enabled here
2330
autoscaler:
2431
enabled: true
2532

chart/openfaas/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ openfaasImagePullPolicy: "Always"
4040
autoscaler:
4141
image: ghcr.io/openfaasltd/autoscaler:0.2.7
4242
replicas: 1
43-
enabled: false
43+
enabled: true
4444
resources:
4545
requests:
4646
memory: "128Mi"

0 commit comments

Comments
 (0)