Skip to content

Commit 2a62684

Browse files
authored
fix: updating the maas-api-auth policy to read from the params.env file instead of being hardcoded (opendatahub-io#527)
During testing on the lates RHOAI operator build noticed that the namespace for our auth policy is still opendatahub. I updated it so it should be pulling from the `params.env` now. Also changes the url to try to make it easier to identify this mistake earlier (fail fast). How did I test: Can change the app_namespace in the `params.env` to whatever `my_totally_correct_namespace` and validate the url looks correct ``` jland@fedora:~/Documents/RedHat/poc/models-as-a-service$ kustomize build deployment/overlays/odh | grep -E "url:|api-keys/validate" url: https://maas-api.my_totally_correct_namespace.svc.cluster.local:8443/internal/v1/api-keys/validate ``` And I checked the actual prams being installed with the operator and that looks right. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Updated internal authentication policy configuration to use overlay-based URL replacement pattern, improving deployment flexibility across environments. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 06285b3 commit 2a62684

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

deployment/base/maas-api/policies/auth-policy.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ spec:
2929
when:
3030
- predicate: request.headers.authorization.startsWith("Bearer sk-oai-")
3131
http:
32-
url: https://maas-api.opendatahub.svc.cluster.local:8443/internal/v1/api-keys/validate
32+
# Overwritten by ODH overlay replacement (app-namespace param). Use placeholder.
33+
url: https://maas-api.placehold.svc.cluster.local:8443/internal/v1/api-keys/validate
3334
method: POST
3435
contentType: application/json
3536
body:

deployment/overlays/odh/kustomization.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,14 @@ replacements:
125125
name: maas-parameters
126126
fieldPath: data.app-namespace
127127
targets:
128+
- select:
129+
kind: AuthPolicy
130+
name: maas-api-auth-policy
131+
fieldPaths:
132+
- spec.rules.metadata.apiKeyValidation.http.url
133+
options:
134+
delimiter: "."
135+
index: 1
128136
- select:
129137
kind: DestinationRule
130138
name: maas-api-backend-tls

0 commit comments

Comments
 (0)