-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create project level authorino authconfig
* Setup namespace annotations for gatewway/host information used by this namesapce * Generate host pattern based on openshift ingress configs AppDomain * Generate a default AuthConfig file using ServiceAccounts TokenReview process as auth * Rely on endpoint in `osh-model-controller` for anonymous access support releated-to: #58
- Loading branch information
1 parent
3e04a6c
commit 0247d2c
Showing
14 changed files
with
523 additions
and
89 deletions.
There are no files selected for viewing
This file contains 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
package controllers | ||
|
||
const ( | ||
AnnotationServiceMesh = "opendatahub.io/service-mesh" | ||
AnnotationPublicGatewayName = "service-mesh.opendatahub.io/public-gateway-name" | ||
AnnotationPublicGatewayExternalHost = "service-mesh.opendatahub.io/public-gateway-host-external" | ||
AnnotationPublicGatewayInternalHost = "service-mesh.opendatahub.io/public-gateway-host-internal" | ||
LabelMaistraGatewayName = "maistra.io/gateway-name" | ||
LabelMaistraGatewayNamespace = "maistra.io/gateway-namespace" | ||
AnnotationServiceMesh = "opendatahub.io/service-mesh" | ||
AnnotationPublicGatewayName = "service-mesh.opendatahub.io/public-gateway-name" | ||
AnnotationPublicGatewayExternalHost = "service-mesh.opendatahub.io/public-gateway-host-external" | ||
AnnotationPublicGatewayInternalHost = "service-mesh.opendatahub.io/public-gateway-host-internal" | ||
AnnotationProjectModelGatewayHostPatternExternal = "service-mesh.opendatahub.io/model-gateway-hostpattern-external" | ||
AnnotationProjectModelGatewayHostPatternInternal = "service-mesh.opendatahub.io/model-gateway-hostpattern-internal" | ||
LabelMaistraGatewayName = "maistra.io/gateway-name" | ||
LabelMaistraGatewayNamespace = "maistra.io/gateway-namespace" | ||
) |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,74 @@ | ||
apiVersion: authorino.kuadrant.io/v1beta1 | ||
kind: AuthConfig | ||
metadata: | ||
name: odh-dashboard-protection | ||
name: $ODH_NS-protection | ||
namespace: $ODH_NS | ||
labels: | ||
authorino/topic: odh | ||
spec: | ||
hosts: | ||
- "${ODH_ROUTE}" | ||
- "${ODH_ROUTE}" | ||
identity: | ||
- name: kubernetes-users | ||
kubernetes: | ||
audiences: | ||
- "https://kubernetes.default.svc" | ||
- name: authorized-service-accounts | ||
kubernetes: | ||
audiences: | ||
- $ODH_NS-api | ||
- name: anonymous-grpc | ||
priority: 1 | ||
anonymous: {} | ||
when: | ||
- selector: context.request.http.headers.mm-vmodel-id | ||
operator: matches | ||
value: .+ | ||
extendedProperties: | ||
- name: modelid | ||
valueFrom: | ||
authJSON: context.request.http.headers.mm-vmodel-id | ||
- name: anonymous-http | ||
priority: 1 | ||
anonymous: {} | ||
when: | ||
- selector: context.request.http.headers.mm-vmodel-id | ||
operator: matches | ||
value: ^$ | ||
extendedProperties: | ||
- name: modelid | ||
valueFrom: | ||
authJSON: context.request.http.path.@extract:{"sep":"/","pos":2} | ||
metadata: | ||
- name: access | ||
http: | ||
endpoint: http://odh-model-controller-metrics-service.opendatahub.svc.cluster.local:8080/model/?ns={context.request.http.host.@extract:{"sep":".","pos":0}}&modelid={auth.identity.modelid} | ||
#cache: | ||
# key: | ||
# valueFrom: | ||
# authJSON: {context.request.http.host.@extract:{"sep":".","pos":0}}-{auth.identity.modelid} | ||
# ttl: 300 | ||
when: | ||
- selector: auth.identity.anonymous | ||
operator: eq | ||
value: "true" | ||
authorization: | ||
- name: k8s-rbac | ||
kubernetes: | ||
user: | ||
valueFrom: { authJSON: auth.identity.username } | ||
response: | ||
- name: x-auth-data | ||
- name: anonymous | ||
when: | ||
- selector: auth.identity.anonymous | ||
operator: eq | ||
value: "true" | ||
json: | ||
properties: | ||
- name: username | ||
valueFrom: { authJSON: auth.identity.username } | ||
rules: | ||
- selector: auth.metadata.access.anonymous | ||
operator: eq | ||
value: "true" | ||
denyWith: | ||
unauthenticated: | ||
message: | ||
value: "Access denied" | ||
code: 302 | ||
headers: | ||
- name: Location | ||
valueFrom: | ||
authJSON: http://some-service?redirect_to={context.request.http.path} | ||
unauthorized: | ||
message: | ||
value: "Unauthorized" | ||
code: 403 | ||
headers: | ||
- name: Location | ||
valueFrom: | ||
authJSON: http://some-service?redirect_to={context.request.http.path} |
Oops, something went wrong.