Deploy KeyCape-backed portal login edge
This commit is contained in:
parent
eac9d655b0
commit
9a486c3531
5 changed files with 145 additions and 2 deletions
|
|
@ -54,7 +54,7 @@ spec:
|
|||
# 2026-05-24: direct-imported into railiance01 k3s for the
|
||||
# bootstrap-console OIDC/MFA rollout. Use IfNotPresent while the
|
||||
# HTTP registry push/pull path is being cleaned up.
|
||||
image: 92.205.130.254:32166/coulomb/key-cape:main-e877d27-2
|
||||
image: key-cape:e8b4ede
|
||||
imagePullPolicy: IfNotPresent
|
||||
|
||||
ports:
|
||||
|
|
|
|||
52
sso-mfa/k8s/keycape/register-user-engine-portal.py
Normal file
52
sso-mfa/k8s/keycape/register-user-engine-portal.py
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Idempotently register the user-engine portal in the live KeyCape Secret.
|
||||
|
||||
The complete Secret travels over stdin/stdout between kubectl and this
|
||||
process. Secret values are never printed to the terminal or written to disk.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import base64
|
||||
import json
|
||||
import sys
|
||||
|
||||
import yaml
|
||||
|
||||
CLIENT_ID = "user-engine-portal"
|
||||
CLIENT = {
|
||||
"clientId": CLIENT_ID,
|
||||
"displayName": "User Engine Portal",
|
||||
"redirectUris": ["https://users.92-205-62-239.nip.io/oidc/callback"],
|
||||
"allowedScopes": ["openid", "profile", "email", "groups"],
|
||||
"grantTypes": ["authorization_code"],
|
||||
"clientType": "public",
|
||||
}
|
||||
|
||||
|
||||
def main() -> None:
|
||||
secret = json.load(sys.stdin)
|
||||
encoded = secret.get("data", {}).get("config.yaml")
|
||||
if not encoded:
|
||||
raise SystemExit("keycape-config does not contain config.yaml")
|
||||
config = yaml.safe_load(base64.b64decode(encoded))
|
||||
clients = config.setdefault("clients", [])
|
||||
existing = next(
|
||||
(index for index, client in enumerate(clients) if client.get("clientId") == CLIENT_ID),
|
||||
None,
|
||||
)
|
||||
if existing is None:
|
||||
clients.append(CLIENT)
|
||||
else:
|
||||
clients[existing] = CLIENT
|
||||
rendered = yaml.safe_dump(config, sort_keys=False).encode()
|
||||
secret["data"]["config.yaml"] = base64.b64encode(rendered).decode()
|
||||
secret.pop("status", None)
|
||||
metadata = secret.get("metadata", {})
|
||||
for key in ("creationTimestamp", "managedFields", "resourceVersion", "uid"):
|
||||
metadata.pop(key, None)
|
||||
json.dump(secret, sys.stdout, separators=(",", ":"))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue