From 2aa75d9e4b62e1f3294440178ee7489fae2bb104 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Madis=20M=C3=A4gi?= Date: Sat, 27 Jul 2024 03:40:41 +0300 Subject: [PATCH] Change to new cluster config --- deployment.yaml | 8 ++++---- inventory-app/common.py | 2 +- inventory-app/oidc.py | 2 +- serviceaccount.yml | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/deployment.yaml b/deployment.yaml index 7ed0d87..f92b7d3 100644 --- a/deployment.yaml +++ b/deployment.yaml @@ -22,7 +22,7 @@ spec: image: inventory-app env: - name: OIDC_USERS_NAMESPACE - value: "oidc-gateway" + value: "default" - name: SLACK_DOORLOG_CALLBACK value: "changeme" - name: SLACK_INVENTORY_CALLBACK @@ -82,11 +82,11 @@ kind: Ingress metadata: name: inventory-app annotations: - kubernetes.io/ingress.class: shared traefik.ingress.kubernetes.io/router.entrypoints: websecure traefik.ingress.kubernetes.io/router.tls: "true" external-dns.alpha.kubernetes.io/target: traefik.codemowers.ee spec: + ingressClassName: shared rules: - host: inventory-app-72zn4.codemowers.ee http: @@ -102,8 +102,8 @@ spec: - hosts: - "*.codemowers.ee" --- -apiVersion: codemowers.io/v1alpha1 -kind: OIDCGWClient +apiVersion: codemowers.cloud/v1beta1 +kind: OIDCClient metadata: name: inventory-app spec: diff --git a/inventory-app/common.py b/inventory-app/common.py index 4ace88b..f4cda30 100644 --- a/inventory-app/common.py +++ b/inventory-app/common.py @@ -33,7 +33,7 @@ class User: def get_users_inner(): config.load_incluster_config() api_instance = client.CustomObjectsApi() - ret = api_instance.list_namespaced_custom_object("codemowers.io", "v1alpha1", OIDC_USERS_NAMESPACE, "oidcgatewayusers") + ret = api_instance.list_namespaced_custom_object("codemowers.cloud", "v1beta1", OIDC_USERS_NAMESPACE, "oidcusers") for item in ret["items"]: username = item['metadata']['name'] display_name = item.get("spec", {}).get("customProfile", {}).get("name", None) diff --git a/inventory-app/oidc.py b/inventory-app/oidc.py index 0ca86a2..7faebd5 100644 --- a/inventory-app/oidc.py +++ b/inventory-app/oidc.py @@ -10,7 +10,7 @@ from functools import wraps page_oidc = Blueprint("oidc", __name__) db = MongoClient(const.MONGO_URI).get_default_database() -gw_uri = os.getenv("OIDC_GATEWAY_URI") +gw_uri = os.getenv("OIDC_IDP_URI") metadata = requests.get(f"{gw_uri}.well-known/openid-configuration").json() def login_required(_f=None, *, groups=[]): diff --git a/serviceaccount.yml b/serviceaccount.yml index b08fd3d..cd63c8d 100644 --- a/serviceaccount.yml +++ b/serviceaccount.yml @@ -6,7 +6,7 @@ metadata: roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole - name: cluster-admin + name: passmower subjects: - kind: ServiceAccount name: oidc-gateway