Skip to content

Commit b5c05d0

Browse files
authored
adapt to stack changes (#490)
1 parent 72ec09b commit b5c05d0

File tree

4 files changed

+62
-54
lines changed

4 files changed

+62
-54
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
22
# tag::snippet[]
33
spec:
4-
authenticationConfig: # <1>
5-
authenticationClass: openldap # <2>
6-
userRegistrationRole: Admin # <3>
4+
clusterConfig:
5+
authentication: # <1>
6+
- authenticationClass: openldap # <2>
7+
userRegistrationRole: Admin # <3>
78
# end::snippet[]
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
---
22
# tag::snippet[]
33
spec:
4-
authentication:
5-
method:
6-
ldap: # <1>
7-
authenticationClass: openldap # <2>
4+
clusterConfig:
5+
authentication:
6+
- authenticationClass: openldap # <1>
87
# end::snippet[]

modules/tutorials/examples/ldap-auth/trino-opa-bundle-snippet.yaml

+9-4
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,14 @@ data:
55
default allow = false
66
77
allow {
8-
input.context.identity.user == "alice"
8+
is_alice
9+
}
10+
extended[i] {
11+
some i
12+
input.action.filterResources[i]
13+
is_alice
914
}
1015
11-
allow {
12-
input.context.identity.user == "bob"
13-
}
16+
is_alice() {
17+
input.context.identity.user == "alice"
18+
}

modules/tutorials/pages/authentication_with_openldap.adoc

+46-43
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,10 @@ command.
2020

2121
=== Superset and Trino Stack
2222

23-
This command will install the latest Stackable release for you, and set up the `trino-superset-s3` Stack. It contains a
24-
Superset instance connected to a Trino instance, and all their dependencies (Minio S3, PostgreSQL). Later in this guide,
23+
This command will install the latest Stackable release for you, and set up the `trino-superset-s3` Stack. It contains a Superset instance connected to a Trino instance, and all their dependencies (Minio S3, PostgreSQL). Later in this guide,
2524
a Superset and Trino instance will be configured to use LDAP.
2625

27-
If you do not have a Kubernetes cluster already, add the `--cluster kind` (or `-c kind`) flag to let stackablectl deploy
28-
one for you.
26+
If you do not have a Kubernetes cluster already, add the `--cluster kind` (or `-c kind`) flag to let stackablectl deploy one for you.
2927

3028
[source,bash]
3129
include::example$ldap-auth/10-install-base.sh[tag=stackablectl-install]
@@ -47,8 +45,7 @@ browser.
4745
You can log into Superset with user _admin_ and password _adminadmin_, and into Trino with user _admin_ and password
4846
_adminadmin_.
4947

50-
These are the current users defined in Superset's and Trino's internal user management. Later you will see that these
51-
users cannot be used for authentication anymore after LDAP authentication has been enabled.
48+
These are the current users defined in Superset's and Trino's internal user management. Later you will see that these users cannot be used for authentication anymore after LDAP authentication has been enabled.
5249

5350
=== OpenLDAP Stack
5451

@@ -72,7 +69,7 @@ LDAP_PASSWORDS: alice,bob
7269

7370
== Steps
7471

75-
Now that you have a couple of data products installed as well as an LDAP server, you can start configuring the products to use LDAP. The following image shows the parts that are already there in blue and the parts you will add in green:
72+
Now that you have a couple of data products as well as the LDAP server installed, you can start configuring the products to use LDAP. The following image shows the parts that are already there in blue and the parts you will add in green:
7673

7774
image::image$openldap-tutorial.drawio.svg[]
7875

@@ -149,13 +146,16 @@ metadata:
149146
name: superset
150147
...
151148
spec:
152-
version: ...
153-
statsdExporterVersion: ...
154-
credentialsSecret: superset-credentials
149+
image:
150+
productVersion: ...
151+
clusterConfig:
152+
listenerClass: ...
153+
credentialsSecret: superset-credentials
154+
mapboxSecret: ...
155155
nodes:
156156
roleGroups:
157157
default:
158-
config:
158+
replicas: 1
159159
...
160160
----
161161
====
@@ -165,12 +165,12 @@ You can now delete the SupersetCluster, you recreate it later with the new confi
165165
[source,bash]
166166
include::example$ldap-auth/40-modify-superset.sh[tag=delete-superset]
167167

168-
Modify your `superset.yaml` to include this new `authenticationConfig` property under the `spec`:
168+
Modify your `superset.yaml` to include this new `authentication` property under the `spec.clusterConfig`:
169169

170170
[source,yaml]
171171
include::example$ldap-auth/superset-auth-snippet.yaml[tag=snippet]
172172

173-
<1> The new `authenticationConfig` section which configures how Superset is authenticating users
173+
<1> The new `authentication` configuration section which configures how Superset is authenticating users
174174
<2> The `authenticationClass` property is referencing the AuthenticationClass `openldap` you created earlier
175175
<3> The default Superset role that users should be assigned to when they log in. Any user will be an Admin
176176

@@ -186,12 +186,15 @@ metadata:
186186
name: superset
187187
...
188188
spec:
189-
version: ...
190-
statsdExporterVersion: ...
191-
credentialsSecret: superset-credentials
192-
authenticationConfig:
193-
authenticationClass: openldap
194-
userRegistrationRole: Admin
189+
image:
190+
productVersion: ...
191+
clusterConfig:
192+
authentication:
193+
- authenticationClass: openldap
194+
userRegistrationRole: Admin
195+
listenerClass: ...
196+
credentialsSecret: superset-credentials
197+
mapboxSecret: ...
195198
nodes:
196199
roleGroups:
197200
default:
@@ -205,15 +208,14 @@ Now deploy the updated superset cluster:
205208
[source,bash]
206209
include::example$ldap-auth/40-modify-superset.sh[tag=apply-superset-cluster]
207210

208-
209211
Connect to superset as before, and try logging in again with username _admin_ and password _adminadmin_, Superset will not accept these credentials anymore. You now have to use LDAP credentials to log in. The OpenLDAP you installed earlier comes with two users, _alice_ (password _alice_) and _bob_ (password _bob_). Log in with any of these users and Superset will accept.
210212

211213
[#trino]
212214
=== Add LDAP configuration to Trino
213215

214216
Trino is configured very similarly to Superset.
215217

216-
Fetch the existing TrinoCluster defintion from the Kubernetes API server and save it into a `trino.yaml` file:
218+
Fetch the existing TrinoCluster definition from the Kubernetes API server and save it into a `trino.yaml` file:
217219

218220
[source,bash]
219221
include::example$ldap-auth/60-modify-trino.sh[tag=get-yaml]
@@ -230,15 +232,16 @@ metadata:
230232
name: trino
231233
...
232234
spec:
233-
version: 396-stackable0.1.0
234-
authentication:
235-
method:
236-
multiUser:
237-
...
238-
opa:
239-
configMapName: opa
240-
package: trino
241-
catalogLabelSelector:
235+
image:
236+
productVersion: ...
237+
clusterConfig:
238+
authentication:
239+
- authenticationClass: trino-users
240+
authorization:
241+
opa:
242+
configMapName: opa
243+
package: trino
244+
catalogLabelSelector:
242245
...
243246
workers:
244247
...
@@ -253,13 +256,12 @@ You can now delete the TrinoCluster. you recreate it later with the new configur
253256
[source,bash]
254257
include::example$ldap-auth/60-modify-trino.sh[tag=delete]
255258

256-
Replace the `multiUser` authentication method in your `trino.yaml` with an `ldap` method that references the `openldap` AuthenticationClass:
259+
Replace the `trino-users` AuthenticationClass in your `trino.yaml` with the `openldap` AuthenticationClass:
257260

258261
[source,yaml]
259262
include::example$ldap-auth/trino-auth-snippet.yaml[tag=snippet]
260263

261-
<1> The new `ldap` authentication method replaces the previous `multiUser` authentication method
262-
<2> The `authenticationClass` property is referencing the AuthenticationClass `openldap` you created earlier
264+
<1> Switch the `authenticationClass` to the AuthenticationClass `openldap` you created earlier
263265

264266
.Your `trino.yaml` should now look similar to this
265267
[%collapsible]
@@ -273,15 +275,16 @@ metadata:
273275
name: trino
274276
...
275277
spec:
276-
version: 396-stackable0.1.0
277-
authentication:
278-
method:
279-
ldap:
280-
authenticationClass: openldap
281-
opa:
282-
configMapName: opa
283-
package: trino
284-
catalogLabelSelector:
278+
image:
279+
productVersion: ...
280+
clusterConfig:
281+
authentication:
282+
- authenticationClass: openldap
283+
authorization:
284+
opa:
285+
configMapName: opa
286+
package: trino
287+
catalogLabelSelector:
285288
...
286289
workers:
287290
...
@@ -316,7 +319,7 @@ Apply this patch:
316319
include::example$ldap-auth/trino-opa-bundle-snippet.yaml[]
317320
----
318321

319-
And apply the new bundle:
322+
And apply the new bundle that lets `alice` do everything and denies `bob` everything:
320323

321324
[source,bash]
322325
include::example$ldap-auth/70-modify-trino-opa-bundle.sh[tag=apply]

0 commit comments

Comments
 (0)