forked from opendatahub-io/odh-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow all users to list model registries (opendatahub-io#3034)
- Loading branch information
1 parent
d44fe87
commit bd0f9a9
Showing
20 changed files
with
736 additions
and
149 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { ServiceKind } from '~/k8sTypes'; | ||
|
||
type MockServiceType = { | ||
name?: string; | ||
namespace?: string; | ||
}; | ||
|
||
export const mockModelRegistryService = ({ | ||
name = 'modelregistry-sample', | ||
namespace = 'odh-model-registries', | ||
}: MockServiceType): ServiceKind => ({ | ||
kind: 'Service', | ||
apiVersion: 'v1', | ||
metadata: { | ||
name, | ||
namespace, | ||
}, | ||
spec: { | ||
selector: { | ||
app: name, | ||
component: 'model-registry', | ||
}, | ||
ports: [ | ||
{ | ||
name: 'grpc-api', | ||
protocol: 'TCP', | ||
port: 9090, | ||
targetPort: 9090, | ||
}, | ||
{ | ||
name: 'http-api', | ||
protocol: 'TCP', | ||
port: 8080, | ||
targetPort: 8080, | ||
}, | ||
], | ||
}, | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,238 @@ | ||
import { SelfSubjectRulesReviewKind } from '~/k8sTypes'; | ||
|
||
export const mockSelfSubjectRulesReview = (): SelfSubjectRulesReviewKind => ({ | ||
kind: 'SelfSubjectRulesReview', | ||
apiVersion: 'authorization.k8s.io/v1', | ||
spec: { | ||
namespace: 'odh-model-registries', | ||
}, | ||
status: { | ||
resourceRules: [ | ||
{ | ||
verbs: ['create'], | ||
apiGroups: ['', 'project.openshift.io'], | ||
resources: ['projectrequests'], | ||
}, | ||
{ | ||
verbs: ['impersonate'], | ||
apiGroups: ['authentication.k8s.io'], | ||
resources: ['userextras/scopes.authorization.openshift.io'], | ||
}, | ||
{ | ||
verbs: ['get', 'list', 'watch'], | ||
apiGroups: ['helm.openshift.io'], | ||
resources: ['helmchartrepositories'], | ||
}, | ||
{ | ||
verbs: ['create'], | ||
apiGroups: ['authorization.k8s.io'], | ||
resources: ['selfsubjectaccessreviews', 'selfsubjectrulesreviews'], | ||
}, | ||
{ | ||
verbs: ['create'], | ||
apiGroups: ['authentication.k8s.io'], | ||
resources: ['selfsubjectreviews'], | ||
}, | ||
{ | ||
verbs: ['create'], | ||
apiGroups: ['', 'project.openshift.io'], | ||
resources: ['projectrequests'], | ||
}, | ||
{ | ||
verbs: ['get', 'list', 'watch', 'delete'], | ||
apiGroups: ['oauth.openshift.io'], | ||
resources: ['useroauthaccesstokens'], | ||
}, | ||
{ | ||
verbs: ['get', 'list', 'watch'], | ||
apiGroups: ['snapshot.storage.k8s.io'], | ||
resources: ['volumesnapshotclasses'], | ||
}, | ||
{ | ||
verbs: ['get'], | ||
apiGroups: ['', 'user.openshift.io'], | ||
resources: ['users'], | ||
resourceNames: ['~'], | ||
}, | ||
{ | ||
verbs: ['list'], | ||
apiGroups: ['', 'project.openshift.io'], | ||
resources: ['projectrequests'], | ||
}, | ||
{ | ||
verbs: ['get', 'list'], | ||
apiGroups: ['', 'authorization.openshift.io'], | ||
resources: ['clusterroles'], | ||
}, | ||
{ | ||
verbs: ['get', 'list', 'watch'], | ||
apiGroups: ['rbac.authorization.k8s.io'], | ||
resources: ['clusterroles'], | ||
}, | ||
{ | ||
verbs: ['get', 'list'], | ||
apiGroups: ['storage.k8s.io'], | ||
resources: ['storageclasses'], | ||
}, | ||
{ | ||
verbs: ['list', 'watch'], | ||
apiGroups: ['', 'project.openshift.io'], | ||
resources: ['projects'], | ||
}, | ||
{ | ||
verbs: ['create'], | ||
apiGroups: ['', 'authorization.openshift.io'], | ||
resources: ['selfsubjectrulesreviews'], | ||
}, | ||
{ | ||
verbs: ['create'], | ||
apiGroups: ['authorization.k8s.io'], | ||
resources: ['selfsubjectaccessreviews'], | ||
}, | ||
{ | ||
verbs: ['delete'], | ||
apiGroups: ['', 'oauth.openshift.io'], | ||
resources: ['oauthaccesstokens', 'oauthauthorizetokens'], | ||
}, | ||
{ | ||
verbs: ['create'], | ||
apiGroups: ['', 'build.openshift.io'], | ||
resources: ['builds/source'], | ||
}, | ||
{ | ||
verbs: ['create'], | ||
apiGroups: ['', 'authorization.openshift.io'], | ||
resources: ['selfsubjectrulesreviews'], | ||
}, | ||
{ | ||
verbs: ['create'], | ||
apiGroups: ['authorization.k8s.io'], | ||
resources: ['selfsubjectaccessreviews'], | ||
}, | ||
{ | ||
verbs: ['create', 'get'], | ||
apiGroups: ['', 'build.openshift.io'], | ||
resources: ['buildconfigs/webhooks'], | ||
}, | ||
{ | ||
verbs: ['create'], | ||
apiGroups: ['', 'build.openshift.io'], | ||
resources: ['builds/jenkinspipeline'], | ||
}, | ||
{ | ||
verbs: ['use'], | ||
apiGroups: ['security.openshift.io'], | ||
resources: ['securitycontextconstraints'], | ||
resourceNames: ['restricted-v2'], | ||
}, | ||
{ | ||
verbs: ['get', 'list', 'watch'], | ||
apiGroups: ['console.openshift.io'], | ||
resources: [ | ||
'consoleclidownloads', | ||
'consoleexternalloglinks', | ||
'consolelinks', | ||
'consolenotifications', | ||
'consoleplugins', | ||
'consolequickstarts', | ||
'consolesamples', | ||
'consoleyamlsamples', | ||
], | ||
}, | ||
{ | ||
verbs: ['create'], | ||
apiGroups: ['', 'build.openshift.io'], | ||
resources: ['builds/docker', 'builds/optimizeddocker'], | ||
}, | ||
{ | ||
verbs: ['get'], | ||
apiGroups: [''], | ||
resources: ['services'], | ||
resourceNames: ['modelregistry-sample'], | ||
}, | ||
{ | ||
verbs: ['get'], | ||
apiGroups: [''], | ||
resources: ['services'], | ||
resourceNames: ['dallas-mr'], | ||
}, | ||
], | ||
nonResourceRules: [ | ||
{ | ||
verbs: ['get'], | ||
nonResourceURLs: ['/healthz', '/healthz/'], | ||
}, | ||
{ | ||
verbs: ['get'], | ||
nonResourceURLs: [ | ||
'/version', | ||
'/version/*', | ||
'/api', | ||
'/api/*', | ||
'/apis', | ||
'/apis/*', | ||
'/oapi', | ||
'/oapi/*', | ||
'/openapi/v2', | ||
'/swaggerapi', | ||
'/swaggerapi/*', | ||
'/swagger.json', | ||
'/swagger-2.0.0.pb-v1', | ||
'/osapi', | ||
'/osapi/', | ||
'/.well-known', | ||
'/.well-known/oauth-authorization-server', | ||
'/', | ||
], | ||
}, | ||
{ | ||
verbs: ['get'], | ||
nonResourceURLs: [ | ||
'/version', | ||
'/version/*', | ||
'/api', | ||
'/api/*', | ||
'/apis', | ||
'/apis/*', | ||
'/oapi', | ||
'/oapi/*', | ||
'/openapi/v2', | ||
'/swaggerapi', | ||
'/swaggerapi/*', | ||
'/swagger.json', | ||
'/swagger-2.0.0.pb-v1', | ||
'/osapi', | ||
'/osapi/', | ||
'/.well-known', | ||
'/.well-known/oauth-authorization-server', | ||
'/', | ||
], | ||
}, | ||
{ | ||
verbs: ['get'], | ||
nonResourceURLs: [ | ||
'/api', | ||
'/api/*', | ||
'/apis', | ||
'/apis/*', | ||
'/healthz', | ||
'/livez', | ||
'/openapi', | ||
'/openapi/*', | ||
'/readyz', | ||
'/version', | ||
'/version/', | ||
], | ||
}, | ||
{ | ||
verbs: ['get'], | ||
nonResourceURLs: ['/.well-known', '/.well-known/*'], | ||
}, | ||
{ | ||
verbs: ['get'], | ||
nonResourceURLs: ['/healthz', '/livez', '/readyz', '/version', '/version/'], | ||
}, | ||
], | ||
incomplete: false, | ||
}, | ||
}); |
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
Oops, something went wrong.