Skip to content

Commit

Permalink
Add RBAC for endpoint slices for functions
Browse files Browse the repository at this point in the history
EndpointSlices are more efficient than Endpoints at scale.

Both editions of OpenFaaS Pro will gain support, and CE will
continue to use Endpoints.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
  • Loading branch information
alexellis committed Oct 17, 2023
1 parent 9b66b7e commit 8c93467
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
6 changes: 6 additions & 0 deletions chart/openfaas/templates/controller-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ rules:
- create
- update
- delete
- apiGroups: ["discovery.k8s.io"]
resources: ["endpointslices"]
verbs: ["get", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
Expand Down Expand Up @@ -178,6 +181,9 @@ rules:
- get
- list
- watch
- apiGroups: ["discovery.k8s.io"]
resources: ["endpointslices"]
verbs: ["get", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
Expand Down
2 changes: 2 additions & 0 deletions chart/openfaas/templates/gateway-dep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ spec:
- -operator=true
- "-license-file=/var/secrets/license/license"
env:
- name: reconcile_workers
value: "2"
- name: port
value: "8081"
- name: function_namespace
Expand Down
7 changes: 7 additions & 0 deletions chart/openfaas/templates/operator-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ rules:
- apiGroups: [""]
resources: ["pods", "pods/log", "namespaces", "endpoints"]
verbs: ["get", "list", "watch"]
- apiGroups: ["discovery.k8s.io"]
resources: ["endpointslices"]
verbs: ["get", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
Expand Down Expand Up @@ -132,6 +135,10 @@ rules:
- apiGroups: [""]
resources: ["services"]
verbs: ["get", "list", "watch", "create", "delete", "update"]
# Add discovery for endpointslices
- apiGroups: ["discovery.k8s.io"]
resources: ["endpointslices"]
verbs: ["get", "list", "watch"]
- apiGroups: ["extensions", "apps"]
resources: ["deployments"]
verbs: ["get", "list", "watch", "create", "delete", "update"]
Expand Down
2 changes: 1 addition & 1 deletion chart/openfaas/values-pro.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ clusterRole: true
# you can create a HPA rule to scale on CPU, but you must not scale beyond
# what's been purchased.
gateway:
replicas: 3
replicas: 1
# Required gateway configuration for Istio
# directFunctions: true
# probeFunctions: true
Expand Down
2 changes: 1 addition & 1 deletion chart/openfaas/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ queueMode: "" # Set to `jetstream` to run the async system backed
psp: false

# image pull policy for openfaas components, can change to `IfNotPresent` for an air-gapped environment
openfaasImagePullPolicy: "Always"
openfaasImagePullPolicy: "IfNotPresent"

functions:
imagePullPolicy: "Always" # Image pull policy for deployed functions, for OpenFaaS Pro you can also set: IfNotPresent and Never.
Expand Down

0 comments on commit 8c93467

Please sign in to comment.