|
| 1 | += ADR035: User info fetcher CRD changes |
| 2 | +Sebastian Bernauer <sebastian.bernauer@stackable.tech> |
| 3 | +v0.1, 2024-01-22 |
| 4 | +:status: [draft] |
| 5 | + |
| 6 | +* Status: {status} |
| 7 | +* Date: 2024-01-22 |
| 8 | +
|
| 9 | +Technical Story: https://github.com/stackabletech/opa-operator/issues/478 |
| 10 | + |
| 11 | +== Context and Problem Statement |
| 12 | + |
| 13 | +From the https://docs.stackable.tech/home/nightly/opa/usage-guide/user-info-fetcher[documentation for user-info-fetcher]: |
| 14 | + |
| 15 | +> The User info fetcher allows for additional information to be obtained from the configured backend (for example, Keycloak). You can then write Rego rules for OpenPolicyAgent which make an HTTP request to the User info fetcher and make use of the additional information returned for the username or user id. |
| 16 | + |
| 17 | +We need to design a CRD change for users to enable the UIF. |
| 18 | + |
| 19 | +== Considered Options |
| 20 | + |
| 21 | +=== Stand-alone CRD |
| 22 | + |
| 23 | +Create a new CRD, e.g. UserInfoFetcher and have a controller for it that e.g. creates a DaemonSet. |
| 24 | +A OpaCluster would than be able to link to a UserInfoFetcher discovery ConfigMap. |
| 25 | + |
| 26 | +* Good, because a UIF instance can be shared across multiple OPA clusters -> Simplicity and improves caching as well |
| 27 | +* Bad, because OPA clusters would need to authenticate against UIF clusters. |
| 28 | +* Bad, because UIF might need some form of authorization as well |
| 29 | + |
| 30 | +=== Integrate in OpaCluster |
| 31 | + |
| 32 | +A OpaCluster has a new section that allows to spin a UIF as a sidecar within the Opa DaemonSet. |
| 33 | + |
| 34 | +[source,yaml] |
| 35 | +---- |
| 36 | +apiVersion: opa.stackable.tech/v1alpha1 |
| 37 | +kind: OpaCluster |
| 38 | +metadata: |
| 39 | + name: opa |
| 40 | +spec: |
| 41 | + image: |
| 42 | + productVersion: 0.57.0 |
| 43 | + clusterConfig: |
| 44 | + userInfo: |
| 45 | + backend: |
| 46 | + keycloak: |
| 47 | + hostname: keycloak.my-namespace.svc.cluster.local |
| 48 | + port: 8443 |
| 49 | + tls: |
| 50 | + verification: |
| 51 | + server: |
| 52 | + caCert: |
| 53 | + secretClass: tls |
| 54 | + clientCredentialsSecret: user-info-fetcher-client-credentials |
| 55 | + adminRealm: master |
| 56 | + userRealm: master |
| 57 | + cache: # optional, enabled by default |
| 58 | + entryTimeToLive: 60s # optional, defaults to 60s |
| 59 | + servers: |
| 60 | + roleGroups: |
| 61 | + default: {} |
| 62 | +--- |
| 63 | +apiVersion: v1 |
| 64 | +kind: Secret |
| 65 | +metadata: |
| 66 | + name: user-info-fetcher-client-credentials |
| 67 | +stringData: |
| 68 | + clientId: user-info-fetcher |
| 69 | + clientSecret: user-info-fetcher-client-secret |
| 70 | +---- |
| 71 | + |
| 72 | +* Good, because only accessible via loopback to OPA clusters -> No authentication or authorization needed. |
| 73 | + |
| 74 | +== Decision Outcome |
| 75 | + |
| 76 | +Chosen option: "Integrate in OpaCluster", because we wanted to avoid the whole authentication and authorization story. |
0 commit comments