Repository navigation
Conversation
This was referenced Oct 13, 2026
Merged
The libraries of the relations the charm takes part in, as Charmhub has them. The one exception is tenant_service_info, which is the copy of canonical/tenant-service-operator's pull request that adds the scope a caller is admitted by (LIBPATCH 2).
The Kubernetes charm of the SSO Service, which lets a tenant sign its members in with its own OIDC identity provider. Its code and structure follow tenant-service-operator's. The charm runs the service with its database and migrates it on the leader. It exposes the browser pages and the management API over istio_ingress_route. It is the login and consent provider of a second Hydra, registers Kratos's client there and gives Kratos its one byo-sso provider. It publishes its gRPC address to the login UI, through the interface package in interfaces/sso_service_info, because Charmhub takes no new libraries. It keeps the envelope key in a Juju secret, verifies callers' tokens against the main Hydra or another issuer, applies the CA bundle of receive-ca-cert, and integrates with the observability stack. A Terraform module comes with it. Nothing of the charm is released to Charmhub as a library, so the library release workflow of the skeleton goes.
Unit tests on ops.testing, state in and state out. The integration tests deploy the charm with PostgreSQL alone and cover what it does without the rest of the platform: the integration it blocks on, the database migration and the envelope key through their actions, scaling, and the database integration removed and added again.
nsklikas
force-pushed
the
sso-service-charm
branch
from
October 13, 2026 14:20
584834d to
02c6895
Compare
This was referenced Oct 13, 2026
feat: add Bring Your Own SSO behind byosso_enabled
canonical/identity-platform-login-ui-operator#543
Draft
The job's last step comments its result on the pull request and failed with "Resource not accessible by integration", because the job did not ask for the permission. The format, init and validate steps passed.
Terraform Format and Style 🖌
|
The http_proxy, https_proxy and no_proxy options set HTTP_PROXY, HTTPS_PROXY and NO_PROXY in the workload, as in tenant-service-operator. The image is the build that sends the requests to identity providers through that proxy.
nsklikas
added a commit
to canonical/tenant-service-operator
that referenced
this pull request
Nov 23, 2026
…byte (#65) ## What Two gaps in how the charm applies the CA bundle of `receive-ca-cert` (`_ensure_tls`). Nothing has to merge before this, and nothing waits for it. **A failed update was not always tried again.** The charm keeps a copy of the bundle and acts only when the bundle differs from it. It wrote the copy before it ran `update-ca-certificates` and pushed the result to the workload, and it handled only a failure of the first step, by removing the copy: - when the push to the workload failed (a Pebble error), the hook failed, and the retried hook found the copy equal to the bundle and did nothing: the unit ended active without the CA; - when the bundle was removed and either step failed, the copy was already gone, so the removal was never retried and the workload kept the removed CA. Both steps are now in one `try`, a Pebble error and an `OSError` (a request to Pebble that times out, a missing binary) are caught too, and on failure the earlier copy is put back, so the next reconciliation sees a difference and runs both steps again. **A bundle with CRLF line endings never equalled its copy.** The copy was read as text, which turns `\r\n` into `\n`, so every hook wrote the copy again, ran `update-ca-certificates` and pulled the workload's file to compare. The copy is now read without newline translation. ## Good to know - The CRLF gap did not restart the service: the push happens only when the workload's file differs. - **Not changed**: a restart that fails after a successful push is not forced again on the next hook. - **Not changed**: when the workload container restarts alone, its bundle goes back to the image's while the charm's copy still equals the relation's, so nothing is pushed until the bundle changes or the pod is replaced. - The SSO Service's charm has the same method with the same change (canonical/sso-service-operator#4), and forgets its copy at pebble-ready for the case above. ## Tests - Unit tests, one per decision: a failed push is retried (Pebble down, and Pebble not answering in time), a failed removal is retried, an applied bundle with CRLF line endings is not applied again. Each fails without its part of the fix. - 150 unit tests pass. Not deployed.
sso-service renamed sso_attempts_completed_total to sso_attempts_verified_total, and sso_complete_attempt_refused_total to sso_verify_attempt_refused_total.
nsklikas
added a commit
to canonical/tenant-service-operator
that referenced
this pull request
Nov 23, 2026
) ## What A service that calls the Tenant Service with its own client has to ask for the scope the Tenant Service admits tokens by (`authn_allowed_scope`). So far the operator had to repeat that scope in an option of the calling charm. This charm now publishes it in `tenant-service-info`, next to the URLs. - **`tenant_service_info` library, LIBPATCH 2**: `ProviderData.allowed_scope` (optional, empty by default), a third argument to `update_relations_app_data`, and `get_allowed_scope()` on the requirer. - **The charm publishes its `authn_allowed_scope`.** With the option unset nothing is published. - **The charm observes the library's `ready`**, so a requirer that relates to a running Tenant Service gets the address and the scope at once. - The option's text and the charm specification say that the scope is one scope, and that it is published to related charms, which register it on their clients. Nothing has to merge before this. The SSO Service's charm reads the scope, registers it on its client and asks for it, and has no option for it (canonical/sso-service-operator#4): this pull request goes before that one. ## Good to know - **Either side can be upgraded first.** A requirer on LIBPATCH 1 ignores the field, and a provider on LIBPATCH 1 publishes none, which reads as no scope. - **The `ready` observer closes a gap that `main` has.** Without it the data reached a new requirer at the Tenant Service's next reconciliation, on a settled deployment the next `update-status`: a login UI and an SSO Service each waited about four minutes after their relation was made. It matters more now that the scope travels here. ## Tests - Unit tests: the charm publishes the scope it is configured with, and none without one; the handler runs when a requirer relates. - Deployed with the rest of the platform on MicroK8s (Juju 3.6, Istio, Hydra and Kratos 25.4.0), as a charm packed from this branch and #64 together, with the other charms of the series as they were at that time: a browser suite of 84 sign-in cases passed twice in a row. - On that deployment the scope was in the relation data and on the SSO Service's client at Hydra, a policy read through the SSO Service (which calls the Tenant Service with that token) was answered, and a requirer related to the running charm got the address and the scope within seconds.
nsklikas
added a commit
to canonical/tenant-service-operator
that referenced
this pull request
Nov 23, 2026
## What The body the charm gives Kratos for the registration webhook now cancels the call when the registration came through the `byo-sso` provider, the provider of the login UI's Bring Your Own SSO (canonical/identity-platform-login-ui#993). Such a user was invited to a tenant or admitted by its auto-join, and gets no personal tenant. Kratos skips a webhook whose body evaluates to `error "cancel"`. Every other registration sends the body it sent before. The body compares the end of the request URL's path with the provider's callback path, with or without the trailing slash that Kratos v25 also routes. A provider whose id merely starts with `byo-sso`, and a registration whose query string carries that path, do not cancel. Nothing has to merge before this. The feature as a whole needs it, with the SSO Service's charm (canonical/sso-service-operator#4). ## Good to know - **Best effort, by construction.** Kratos completes the same registration on its generic callback path (`/self-service/methods/oidc/callback`, the provider taken from the state) and on a percent-escaped spelling of the path, and the hook's context does not name the provider. A person who edits their own redirect back from the identity provider gets the webhook sent, and with it a personal tenant next to the tenant that admitted them. Closing that needs the Tenant Service to decide, not the body. - **Not in this change, and a blocker for the feature: the image pin.** The charm still pins tenant-service v0.2.0, and sets the OpenFGA settings the service dropped with its federation. No release of the Tenant Service has the services the login UI and the SSO Service call for Bring Your Own SSO (canonical/tenant-service#140). Until the pin moves to one that does, the feature cannot be turned on with this charm: the login UI's charm would report Active and every tenant lookup would answer `Unimplemented`. ## Tests - A unit test that the charm publishes that condition around the cancel. - How jsonnet evaluates the body is not proven by the suite: the body was evaluated with the go-jsonnet version Kratos uses. The callback cancels, with a slash too; `byo-sso2`, `byo-sso-staging`, the registration URL with the path in its query, and another provider do not. - Deployed with the rest of the platform on MicroK8s (Juju 3.6, Istio, Hydra and Kratos 25.4.0), as a charm packed from this branch and #63 together, with the other charms of the series as they were at that time: a browser suite of 84 sign-in cases passed twice in a row. The deployment ran the image of canonical/tenant-service#140 with `authorization_enabled=false`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The Kubernetes charm of the SSO Service, which holds the SSO connections of Bring Your Own SSO. It is written on tenant-service-operator's code and structure, and it routes over
istio_ingress_routeonly. Its specification is #3: read that first. That pull request is stacked on this one, not under it, becausemainhas no charm yet and its required checks cannot run on a pull request that has only the specification. This pull request shows only the code.pg-database): the leader runs the migrations, and the service does not start with one pending (run-migrationfor a manual run).ui-endpoint-info,hydra-endpoint-info), registers Kratos's client there (byo-sso-client) and hands Kratos its onebyo-ssoprovider (kratos-external-idp). The login UI gets the service's gRPC address (sso-service-info)./sso, and the management API on the internal gateway, which has to authorize each request.get-envelope-key;initial_envelope_key_secret_idto start from a restored key).oauth) or another issuer (authn_issuer, withauthn_jwks_urlor the keys the service discovers), optionally limited by subject or scope.http_proxy,https_proxyandno_proxysetHTTP_PROXY,HTTPS_PROXYandNO_PROXYin the workload. The service also calls Kratos, hydra-sso and the Tenant Service, sono_proxyhas to name the cluster's hosts.logging,tracing,metrics-endpointwith alert rules,grafana-dashboard),receive-ca-cert, and a Terraform module.Where the code differs from tenant-service-operator's, on purpose
Good to know
The interface library is a package. Charmhub takes no new libraries, so
sso_service_infois a Python package in this repository (interfaces/sso_service_info), not a file underlib/. The login UI's charm installs it from git at a commit of this branch (feat: add Bring Your Own SSO behind byosso_enabled identity-platform-login-ui-operator#543), and has to pin it again once this merges. Nothing of it is released to Charmhub, and the library release workflow is removed.The image is a development build,
ghcr.io/canonical/sso-service:bysso-d3b8476c: the SSO Service has no release yet. That build is older than the service's renamed metrics (sso_attempts_verified_total,sso_verify_attempt_refused_total), so the dashboard's panel of attempts stays empty with it. The pin moves to the first release before this merges.Port 50051 serves the sign-in service without a token, as the Tenant Service's port does for its own, and some of the methods write. Nothing closes those ports to other workloads in the cluster: no charm of the platform ships a NetworkPolicy or a mesh policy. The README says the deployment has to.
The public gateway has to be the one the login UI is served on. The charm does not check it.
Kratos's client secret at hydra-sso is in the relation data, as every provider of the
external_providerinterface publishes it today. There is no Juju secret for it.Kratos gets the
byo-ssoprovider as soon as hydra-sso has made the client, whether or not the login UI runs the feature. A login UI with it off shows that provider on its pages, and a click ends in a refusal.The envelope key:
get-envelope-keyreturns it as an action result, which anyone with read access to the model can read. Nothing ties it to the database: an application removed and deployed again under the same name generates a new key for a database whose client secrets the old one sealed. It cannot be rotated.CA certificates: with a provider whose first write is the old unit data (self-signed-certificates does that on a new relation), the unit is active without a usable CA for some minutes after the relation is made.
Smaller limits: the Pebble check has no level, so a pod is Ready whether or not the service runs; the two workload alerts need more traffic than a new deployment has;
PUBLIC_URLlowercases the gateway's host and drops:443, and the redirect URI of a tenant's SSO connections has that spelling.It needs, from other charms: feat: configure Kratos for multitenancy from the login UI's relation kratos-operator#774, feat: accept a login UI that publishes no device-flow URLs hydra-operator#657, feat: publish the scope that admits a caller in tenant-service-info tenant-service-operator#63, feat: skip the registration webhook for the byo-sso provider tenant-service-operator#64 and feat: add Bring Your Own SSO behind byosso_enabled identity-platform-login-ui-operator#543. Where the Tenant Service limits callers by scope and its charm does not publish it, the Tenant Service refuses every call while this charm is active.
The feature also needs a Tenant Service image that has feat: add tenant SSO policy, sign-in context and pending invitations tenant-service#140. tenant-service-operator still pins v0.2.0, which does not.
The Terraform workflow gets the permission to comment on a pull request (
pull-requests: write, as the login UI operator's has): its last step failed without it. It is the last commit here.Tests