Skip to content

Commit 272f354

Browse files
Add ADR035: User info fetcher CRD changes (#532)
* Add ADR035: User info fetcher CRD changes * more crd docs * wording * Apply suggestions from code review Co-authored-by: Nick <NickLarsenNZ@users.noreply.github.com> * change status to accepted --------- Co-authored-by: Nick <NickLarsenNZ@users.noreply.github.com>
1 parent 42d89e8 commit 272f354

File tree

3 files changed

+81
-1
lines changed

3 files changed

+81
-1
lines changed

modules/contributor/pages/adr/ADR032-oidc-support.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
= ADR032: OIDC Support
22
Felix Hennig <felix.hennig@stackable.tech>
33
v0.2, 2023-11-14
4-
:status: draft
4+
:status: accepted
55

66
* Status: {status}
77
* Deciders:
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
= ADR035: User info fetcher CRD changes
2+
Sebastian Bernauer <sebastian.bernauer@stackable.tech>
3+
v0.1, 2024-01-22
4+
:status: accepted
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+
We could create a new CRD, e.g. UserInfoFetcher and have a controller for it that creates a DaemonSet.
24+
An OpaCluster would then be able to link to a UserInfoFetcher discovery ConfigMap.
25+
26+
* Good, because a UIF instance can be shared across multiple OPA clusters -> Simple and improved caching
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+
Add a new section to OpaCluster that allows users to spin up a UIF as a sidecar within the Opa DaemonSet's Pods.
33+
34+
The CRD is mostly copied from the `oidc` AuthenticationClass introduced in xref:adr/ADR032-oidc-support.adoc[] with the addition of needed credentials for Keycloak as well as the _admin_ and _user_ realms and a very simplistic cache.
35+
The cache might be extended in the future (e.g. to set the maximum number of cache entries or exempt particular users from being cached), which can be done in a non-breaking fashion below `spec.clusterConfig.userInfo.backend.keycloak.cache`.`
36+
37+
[source,yaml]
38+
----
39+
apiVersion: opa.stackable.tech/v1alpha1
40+
kind: OpaCluster
41+
metadata:
42+
name: opa
43+
spec:
44+
image:
45+
productVersion: 0.57.0
46+
clusterConfig:
47+
userInfo:
48+
backend:
49+
keycloak:
50+
hostname: keycloak.my-namespace.svc.cluster.local
51+
port: 8443
52+
tls:
53+
verification:
54+
server:
55+
caCert:
56+
secretClass: tls
57+
clientCredentialsSecret: user-info-fetcher-client-credentials
58+
adminRealm: master
59+
userRealm: master
60+
cache: # optional, enabled by default
61+
entryTimeToLive: 60s # optional, defaults to 60s
62+
servers:
63+
roleGroups:
64+
default: {}
65+
---
66+
apiVersion: v1
67+
kind: Secret
68+
metadata:
69+
name: user-info-fetcher-client-credentials
70+
stringData:
71+
clientId: user-info-fetcher
72+
clientSecret: user-info-fetcher-client-secret
73+
----
74+
75+
* Good, because only accessible via the loopback network interface to OPA clusters -> No authentication or authorization needed.
76+
77+
== Decision Outcome
78+
79+
Chosen option: "Integrate in OpaCluster", because we wanted to avoid the whole authentication and authorization story.

modules/contributor/partials/current_adrs.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@
2929
**** xref:adr/ADR030-allowed-pod-disruptions.adoc[]
3030
**** xref:adr/ADR031-resource-labels.adoc[]
3131
**** xref:adr/ADR032-oidc-support.adoc[]
32+
**** xref:adr/ADR035-user-info-fetcher.adoc[]

0 commit comments

Comments
 (0)