Skip to content

Commit 17340a2

Browse files
authored
Merge pull request #1 from utilitywarehouse/initial-version
FINS-119: Keda manifests starting with v1.7.0
2 parents 1bd2436 + df0fe8b commit 17340a2

14 files changed

+5473
-675
lines changed

CODEOWNERS

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/cluster/ @utilitywarehouse/system
2+
/namespaced/ @utilitywarehouse/finance-platform

LICENSE

-674
This file was deleted.

README.md

+54-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,55 @@
11
# keda-manifests
2-
Holds manifests for Keda addapted for UW usage
2+
Holds manifests for Keda adapted for UW usage.
3+
Based on the manifests from [Keda releases](https://github.com/kedacore/keda/releases)
4+
5+
## Structure
6+
The high level structure is as follows:
7+
- `/cluster` folder - contains cluster level resources that can only be applied by cluster admins. They must be reviewed by the system team.
8+
- `/namespaced` folder - contains the resources that can be deployed in regular namespaces and can be applied by namespace admins.
9+
10+
## Components
11+
Considering our Kubernetes cluster setup we'll deploy:
12+
- the metrics server can only be one per cluster, as it needs to register as an
13+
[APIService](https://github.com/utilitywarehouse/kubernetes-manifests/blob/master/dev-merit/kube-system/keda/metrics-api-service.yaml)
14+
that handles external metrics. Until wider adoption, this sits in a normal namespace like billing.
15+
- until wider adoption the operator will be deployed in each namespace that wants to leverage Keda.
16+
17+
### RBAC split
18+
At the moment of writing this doc, [Keda releases](https://github.com/kedacore/keda/releases) come with a single global role and a single service account that is used both by the metrics server and by the operator and the permissions are quite loose.
19+
20+
For adapting the RBAC to our clusters, we split it into several pieces:
21+
- the metrics api server will run under the `service account` [keda-metrics-apiserver](https://github.com/utilitywarehouse/keda-manifests/blob/main/namespaced/metrics-apiserver/rbac.yaml#L2)
22+
- the operator in each namespace will run under the `service account` [keda-operator](https://github.com/utilitywarehouse/keda-manifests/blob/main/namespaced/operator/rbac.yaml#L2)
23+
- the `cluster role` [keda-operator](https://github.com/utilitywarehouse/keda-manifests/blob/main/cluster/operator-role.yaml#L2) should be bound to each `keda-operator` service account for accessing cluster wide resources.
24+
- the `role` [keda-operator](https://github.com/utilitywarehouse/keda-manifests/blob/main/namespaced/operator/rbac.yaml#L10) is [bound](https://github.com/utilitywarehouse/keda-manifests/blob/main/namespaced/operator/rbac.yaml#L92) to each `keda-operator` service account for accessing namespaced resources.
25+
- the `cluster role` [keda-metrics-apiserver](https://github.com/utilitywarehouse/keda-manifests/blob/main/cluster/metrics-apiserver-role.yaml#L2) is bound to the `keda-metrics-apiserver` service account for accessing cluster wide keda objects.
26+
- the `cluster role` [keda-external-metrics-reader](https://github.com/utilitywarehouse/keda-manifests/blob/main/cluster/hpa-rbac.yaml#L2) bound to the existing `horizontal-pod-autoscaler` service account for HPA to be able to access external metrics exposed by the keda metrics-apiserver. This is kept as is from the released keda manifests
27+
28+
### Secrets limitation
29+
Using scalers with any means of [authentication through secrets](https://keda.sh/docs/2.7/concepts/authentication/) is `NOT SUPPORTED`.
30+
31+
#### Explanation
32+
In its default RBAC configuration, Keda gives `cluster wide access` for its components to `secrets`.
33+
34+
This is not acceptable to our cluster setup as it would break our namespace isolation approach, and it would pose a serious security risk.
35+
36+
In version 1.7.1, we tried limiting the secrets access to only namespace through a role, but the `keda metrics-apiserver` wants cluster wide access, so this strategy failed.
37+
38+
#### Workaround
39+
So far we've been using the kafka & prometheus scalers which don't require authentication.
40+
41+
If you do need a scaler with authentication here are the proposed solutions:
42+
1. Use a prometheus exporter that exposes the needed metric as a prometheus metric and handles the authentication. After this, just use the prometheus scaler.
43+
2. Use credentials from HashiCorp Vault through [TriggerAuthentication](https://keda.sh/docs/2.7/concepts/authentication/#re-use-credentials-and-delegate-auth-with-triggerauthentication). This requires more setup as we didn't try it yet.
44+
45+
## Upgrade procedure
46+
Due to the RBAC split, the upgrade is not straight forward.
47+
48+
We used the following procedure:
49+
1. diff the Keda manifests between [Keda releases](https://github.com/kedacore/keda/releases). Example: keda [v5.1.0](https://github.com/kedacore/keda/releases/download/v2.5.0/keda-2.5.0.yaml) vs [v.2.7.1](https://github.com/kedacore/keda/releases/download/v2.7.1/keda-2.7.1.yaml)
50+
2. adjust the manifests in this repo, based on the diffs.
51+
3. test the upgrade in the exp1-merit environment where there are 2 namespaces using it: `billing-keda` and `finance-keda`.
52+
53+
Things to check:
54+
- The metrics-apiserver & operators are running fine. Check the logs for this.
55+
- The Horizontal Pod Autoscalers created by Keda can read the external metrics and scale the deployments based on them.

0 commit comments

Comments
 (0)