Skip to content

Commit 5c8b417

Browse files
authored
Merge branch 'main' into wip-fix-juju-new-version-minimal
Signed-off-by: Ian Booth <ian.booth@canonical.com>
2 parents ec02071 + de324cc commit 5c8b417

13 files changed

Lines changed: 388 additions & 91 deletions

File tree

.github/workflows/ci-uat.yaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -119,16 +119,6 @@ jobs:
119119
echo "Installing terraform from snap"
120120
sudo snap install terraform --classic
121121
fi
122-
- id: cache-image
123-
name: Cache Image Locally
124-
run: |
125-
# Download image for avoiding time out
126-
IMAGE="ghcr.io/canonical/charmed-spark-kyuubi@sha256:9268d19a6eef91914e874734b320fab64908faf0f7adb8856be809bc60ecd1d0"
127-
docker pull $IMAGE
128-
docker save $IMAGE -o image.tar
129-
sudo microk8s ctr images import --base-name $IMAGE image.tar
130-
docker rmi $IMAGE
131-
rm image.tar
132122
- id: tests-integration
133123
name: Run Integration Tests
134124
timeout-minutes: 60

docs/.custom_wordlist.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ https
3131
Intersphinx
3232
io
3333
ip
34+
Jira
3435
Kaggle
3536
kaggle
3637
kubeconfig
@@ -80,6 +81,7 @@ texlive
8081
TOC
8182
toctree
8283
tolerations
84+
Trivy
8385
txt
8486
uncommenting
8587
URL
@@ -94,3 +96,6 @@ xindy
9496
xml
9597
yaml
9698
YouTube
99+
Ory
100+
middleware
101+
Entra

docs/how-to/spark-history-server/auth.md

Lines changed: 69 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -5,89 +5,112 @@ myst:
55
---
66

77
(how-to-spark-history-server-auth)=
8-
# Enable authorization and authentication with the Spark History Server charm
8+
# Enable authentication and authorization with the Spark History Server charm
99

10-
The Charmed Apache Spark solution includes the Spark History charm that enables users to monitor
11-
their applications workflows and logs. Natively, this product does not support authentication and
12-
authorization that is an essential feature in a production environment. To overcome this limitation,
13-
the Spark History Server charm is integrated with the Canonical Identity bundle that offers several
14-
authentication and authorization functionalities with Juju.
10+
Charmed Apache Spark includes the Spark History Server charm, which lets users monitor
11+
application workflows and logs. By default, Spark History Server does not provide
12+
authentication or authorization, both of which are essential in production environments.
13+
To address this limitation, you can integrate the Spark History Server charm with the
14+
Canonical Identity Platform bundle.
1515

1616
## Deploy the Identity Bundle and integrate it with the Spark History Server
1717

18-
In order to enable authentication and authorization on the Spark History Server charm some steps
19-
are needed. Here, we assume that you have already deployed Charmed Apache Spark using
20-
the bundles, as described in the [Charmed Apache Spark deployment guide](how-to-deploy-spark),
21-
that includes a Spark History Server charm, already configured with an object storage backend.
18+
To enable authentication and authorization for Spark History Server, complete the
19+
following steps. This guide assumes you already deployed Charmed Apache Spark as
20+
described in the [Charmed Apache Spark deployment guide](how-to-deploy-spark),
21+
including a Spark History Server charm configured with an object storage backend.
2222

23-
In order to enable authentication, we first need to deploy the
24-
[identity bundle](https://discourse.charmhub.io/t/iam-bundle-deployment-tutorial/11916).
23+
### Deploy the Identity bundle
2524

26-
**_NOTE:_** Please take a look at the Identity Platform tutorial to check that your environment is configured correctly.
25+
Authentication is provided by the
26+
[Canonical Identity Bundle](https://charmhub.io/topics/canonical-identity-platform).
27+
Deploy it by following this
28+
[tutorial](https://charmhub.io/topics/canonical-identity-platform/tutorials/e2e-tutorial),
29+
which installs all required Identity Platform components.
2730

28-
```bash
29-
juju deploy identity-platform --channel edge --trust
30-
```
31+
The deployment includes these charms:
3132

32-
After some minutes the different charms will be deployed and ready to use.
33+
- [Charmed Ory Hydra](https://charmhub.io/hydra): the OAuth/OIDC server.
34+
- [Charmed Ory Kratos](https://charmhub.io/kratos): user management and authentication.
35+
- [Login UI operator](https://charmhub.io/identity-platform-login-ui-operator): middleware that routes requests between services and serves login/error pages.
36+
- [Kratos External IdP Integrator](https://charmhub.io/kratos-external-idp-integrator): integration with external identity providers.
37+
- [Charmed PostgreSQL](https://charmhub.io/postgresql-k8s): SQL database backend.
38+
- [Charmed Traefik](https://charmhub.io/traefik-k8s): ingress controller.
39+
- [Self Signed Certificates](https://charmhub.io/self-signed-certificates): TLS certificate provider for ingress.
3340

34-
One needed step to properly configure the Identity Bundle is to configure which identity provider we
35-
want to use. This can be done by configuring the `kratos-external-idp-integrator` with the
36-
configurations and parameters of your identity provider.
41+
You must also configure the identity provider you want to use. Configure
42+
`kratos-external-idp-integrator` with the parameters for your provider.
3743

38-
The following is an example of configuration for the Azure Identity provider:
44+
Example configuration for Microsoft Entra ID (Azure AD):
3945

4046
```bash
41-
juju config kratos-external-idp-integrator microsoft_tenant_id=<YOUR_TENANT_ID> provider=microsoft client_id=<YOUR_CLIENT_ID> client_secret=<YOUR_CLIENT_SECRETS>.
47+
juju config kratos-external-idp-integrator microsoft_tenant_id=<YOUR_TENANT_ID> provider=microsoft client_id=<YOUR_CLIENT_ID> client_secret=<YOUR_CLIENT_SECRET>
4248
```
4349

44-
More information about supported identity providers and other useful information can be found in the
50+
For supported identity providers and additional details, see the
4551
[How to manage external identity providers guide](https://discourse.charmhub.io/t/how-to-manage-external-identity-providers/11910).
4652

47-
The relation between the Spark History Server and the Identity bundle is handled by another charm
48-
(Oathkeeper) that is offered by the Canonical Identity Team.
49-
This charm enables the protection of endpoints that are behind an ingress, more specifically Traefik.
50-
As the next step, we need to integrate the Spark History Server charm with Traefik.
53+
The connection between Spark History Server and the Identity Platform is handled by
54+
the Charmed OAuth2 Proxy charm. OAuth2 Proxy protects endpoints exposed through
55+
ingress (Traefik).
56+
57+
## Enable authentication with Charmed OAuth2 Proxy
5158

52-
The Identity bundle deployed two instances of Traefik, we will need to use the one named: `traefik-public`
59+
To set up OAuth2 Proxy, first enable the feature in Traefik, expose the forward-auth
60+
offer, and integrate it with Spark History Server through the ingress relation.
5361

5462
```bash
55-
juju integrate spark-history-server-k8s traefik-public
63+
juju config traefik-public enable_experimental_forward_auth=True -m <IDENTITY_MODEL>
64+
juju offer traefik-public:experimental-forward-auth forward-auth -m <IDENTITY_MODEL>
65+
juju integrate spark-history-server-k8s admin/<IDENTITY_MODEL>.ingress
66+
```
67+
68+
Next, deploy OAuth2 Proxy and integrate it with Traefik using the exposed offer:
5669

70+
```bash
71+
juju deploy oauth2-proxy-k8s --channel latest/stable --trust
72+
juju integrate oauth2-proxy-k8s:forward-auth admin/<IDENTITY_MODEL>.forward-auth
5773
```
5874

59-
After it, we can deploy, configure and integrate the Oathkeeper charm with `traefik-public`.
75+
Then integrate Spark History Server with OAuth2 Proxy:
6076

6177
```bash
62-
juju deploy oathkeeper --channel edge --trust
63-
juju config oathkeeper dev=True
64-
juju config traefik-public enable_experimental_forward_auth=True
78+
juju integrate oauth2-proxy-k8s spark-history-server-k8s:oauth2-proxy
6579
```
6680

67-
Now we need to integrate Oathkeeper with the ingress and with the Spark History Server charm.
68-
The Oathkeeper charm will also need to be integrated with the Kratos charm.
81+
Finally, integrate OAuth2 Proxy with the Identity Platform OIDC provider
82+
(Charmed Hydra):
6983

7084
```bash
71-
juju integrate oathkeeper spark-history-server-k8s
72-
juju integrate oathkeeper traefik-public:experimental-forward-auth
73-
juju config kratos dev=true
74-
juju integrate oathkeeper kratos
85+
juju offer hydra:oauth oauth -m <IDENTITY_MODEL>
86+
juju integrate oauth2-proxy-k8s:oauth admin/<IDENTITY_MODEL>.oauth
7587
```
7688

77-
Eventually, you can get the endpoint by running this action:
89+
After integration completes, get the endpoint by running:
7890

7991
```bash
80-
juju run traefik-public/0 show-proxied-endpoints
92+
juju run traefik-public/leader show-proxied-endpoints -m <IDENTITY_MODEL>
8193
```
8294

83-
When you access the link exposed by Traefik, you will be redirected to your desired
84-
identity provider to do the authentication. After a successful authentication,
85-
you will be permitted to access the Spark History server endpoint.
95+
When you open the URL exposed by Traefik, you are redirected to your configured
96+
identity provider for authentication. After successful login, you can access the
97+
Spark History Server endpoint.
8698

8799
## Authorization Management
88100

89-
By default, all authenticated users can access the Spark History Server endpoint. To limit access to a selected set of users, the Spark History Server charm offers the possibility to specify authorized users. This can be done by updating a configuration option. The authorized users (identified by email address) should be specified as a comma-separated list.
101+
By default, all authenticated users can access Spark History Server. To restrict
102+
access, configure an allow-list of authorized users. Provide email addresses as a
103+
comma-separated list:
90104

91105
```bash
92-
juju config spark-history-server-k8s authorized-users="user1@canonical.com, user3@canonical.com"
106+
juju config spark-history-server-k8s authorized-users="user1@canonical.com,user3@canonical.com"
93107
```
108+
109+
## Oathkeeper integration (deprecated)
110+
111+
Previously, authentication in this guide used the `oathkeeper` charm. `oathkeeper`
112+
is now deprecated in favor of Charmed OAuth2 Proxy.
113+
114+
If your deployment still uses `oathkeeper`, migrate by removing integrations with
115+
`oathkeeper`, updating Identity Platform components as described above, and then
116+
integrating `oauth2-proxy-k8s`.

docs/reference/releases/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ myst:
1010
Charmed Apache Spark has the following stable revisions:
1111

1212
* [2](reference-releases-revision-2)
13+
* [4](reference-releases-revision-4)
1314

1415
```{toctree}
1516
:titlesonly:
1617
:hidden:
1718
1819
Revision 2<revision-2.md>
20+
Revision 4<revision-4.md>
1921
```

0 commit comments

Comments
 (0)