-
Notifications
You must be signed in to change notification settings - Fork 69
Add tier for -claw namespace #1265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
alexeykazakov
merged 2 commits into
codeready-toolchain:master
from
alexeykazakov:tiers
May 22, 2026
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,35 @@ | ||
| apiVersion: template.openshift.io/v1 | ||
| kind: Template | ||
| metadata: | ||
| name: claw-cluster-resources | ||
| objects: | ||
| - apiVersion: quota.openshift.io/v1 | ||
| kind: ClusterResourceQuota | ||
| metadata: | ||
| name: for-${SPACE_NAME}-claw | ||
| spec: | ||
| quota: | ||
| hard: | ||
| count/deployments.apps: "5" | ||
| count/pods: "10" | ||
| count/routes.route.openshift.io: "3" | ||
| count/services: "5" | ||
| count/secrets: "50" | ||
|
alexeykazakov marked this conversation as resolved.
|
||
| count/configmaps: "10" | ||
| selector: | ||
| annotations: null | ||
| labels: | ||
| matchLabels: | ||
| toolchain.dev.openshift.com/space: ${SPACE_NAME} | ||
| - apiVersion: toolchain.dev.openshift.com/v1alpha1 | ||
| kind: Idler | ||
| metadata: | ||
| name: ${SPACE_NAME}-claw | ||
| spec: | ||
| timeoutSeconds: ${{IDLER_TIMEOUT_SECONDS}} | ||
| parameters: | ||
| - name: SPACE_NAME | ||
| required: true | ||
| - name: IDLER_TIMEOUT_SECONDS | ||
| # 12 hours | ||
| value: "43200" | ||
This file contains hidden or 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,171 @@ | ||
| apiVersion: template.openshift.io/v1 | ||
| kind: Template | ||
| metadata: | ||
| name: claw-claw | ||
| objects: | ||
| - apiVersion: v1 | ||
| kind: Namespace | ||
| metadata: | ||
| annotations: | ||
| openshift.io/description: ${SPACE_NAME}-claw | ||
| openshift.io/display-name: ${SPACE_NAME}-claw | ||
| openshift.io/requester: ${SPACE_NAME} | ||
| labels: | ||
| name: ${SPACE_NAME}-claw | ||
| name: ${SPACE_NAME}-claw | ||
|
|
||
| # Role and RoleBindings for CRT administration (not associated with users) | ||
| - apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: Role | ||
| metadata: | ||
| name: exec-pods | ||
| namespace: ${SPACE_NAME}-claw | ||
| rules: | ||
| - apiGroups: | ||
| - "" | ||
| resources: | ||
| - pods/exec | ||
| verbs: | ||
| - get | ||
| - list | ||
| - watch | ||
| - create | ||
| - delete | ||
| - update | ||
|
alexeykazakov marked this conversation as resolved.
|
||
| - apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: RoleBinding | ||
| metadata: | ||
| name: crtadmin-view | ||
| namespace: ${SPACE_NAME}-claw | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: ClusterRole | ||
| name: view | ||
| subjects: | ||
| - apiGroup: rbac.authorization.k8s.io | ||
| kind: Group | ||
| name: crtadmin-users-view | ||
| - apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: RoleBinding | ||
| metadata: | ||
| name: crtadmin-pods | ||
| namespace: ${SPACE_NAME}-claw | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: Role | ||
| name: exec-pods | ||
| subjects: | ||
| - apiGroup: rbac.authorization.k8s.io | ||
| kind: Group | ||
| name: crtadmin-users-view | ||
|
|
||
| # ResourceQuota — sized for operator workloads (gateway, proxy, device-pairing) | ||
| # plus headroom for future components and rolling updates. | ||
| - apiVersion: v1 | ||
| kind: ResourceQuota | ||
| metadata: | ||
| name: compute-deploy | ||
| namespace: ${SPACE_NAME}-claw | ||
| spec: | ||
| hard: | ||
| limits.cpu: "8" | ||
| limits.memory: 10Gi | ||
| requests.cpu: "1" | ||
| requests.memory: 3Gi | ||
| - apiVersion: v1 | ||
| kind: ResourceQuota | ||
| metadata: | ||
| name: storage | ||
| namespace: ${SPACE_NAME}-claw | ||
| spec: | ||
| hard: | ||
| limits.ephemeral-storage: 5Gi | ||
| requests.storage: 15Gi | ||
| requests.ephemeral-storage: 5Gi | ||
| count/persistentvolumeclaims: "1" | ||
| # LimitRange — default resource requests/limits for containers | ||
| - apiVersion: v1 | ||
| kind: LimitRange | ||
| metadata: | ||
| name: resource-limits | ||
| namespace: ${SPACE_NAME}-claw | ||
| spec: | ||
| limits: | ||
| - type: "Container" | ||
| default: | ||
| cpu: 500m | ||
| memory: 512Mi | ||
| defaultRequest: | ||
| cpu: 10m | ||
| memory: 64Mi | ||
|
|
||
| # NetworkPolicies — sandbox-standard ingress policies | ||
| - apiVersion: networking.k8s.io/v1 | ||
| kind: NetworkPolicy | ||
| metadata: | ||
| name: allow-same-namespace | ||
| namespace: ${SPACE_NAME}-claw | ||
| spec: | ||
| podSelector: {} | ||
| ingress: | ||
| - from: | ||
| - podSelector: {} | ||
| - apiVersion: networking.k8s.io/v1 | ||
| kind: NetworkPolicy | ||
| metadata: | ||
| name: allow-from-openshift-ingress | ||
| namespace: ${SPACE_NAME}-claw | ||
| spec: | ||
| ingress: | ||
| - from: | ||
| - namespaceSelector: | ||
| matchLabels: | ||
| network.openshift.io/policy-group: ingress | ||
| podSelector: {} | ||
| policyTypes: | ||
| - Ingress | ||
| - apiVersion: networking.k8s.io/v1 | ||
| kind: NetworkPolicy | ||
| metadata: | ||
| name: allow-from-openshift-monitoring | ||
| namespace: ${SPACE_NAME}-claw | ||
| spec: | ||
| ingress: | ||
| - from: | ||
| - namespaceSelector: | ||
| matchLabels: | ||
| network.openshift.io/policy-group: monitoring | ||
| podSelector: {} | ||
| policyTypes: | ||
| - Ingress | ||
| - apiVersion: networking.k8s.io/v1 | ||
| kind: NetworkPolicy | ||
| metadata: | ||
| name: allow-from-olm-namespaces | ||
| namespace: ${SPACE_NAME}-claw | ||
| spec: | ||
| ingress: | ||
| - from: | ||
| - namespaceSelector: | ||
| matchLabels: | ||
| openshift.io/scc: anyuid | ||
| podSelector: {} | ||
| policyTypes: | ||
| - Ingress | ||
| - apiVersion: networking.k8s.io/v1 | ||
| kind: NetworkPolicy | ||
| metadata: | ||
| name: allow-from-console-namespaces | ||
| namespace: ${SPACE_NAME}-claw | ||
| spec: | ||
| ingress: | ||
| - from: | ||
| - namespaceSelector: | ||
| matchLabels: | ||
| network.openshift.io/policy-group: console | ||
| podSelector: {} | ||
| policyTypes: | ||
| - Ingress | ||
| parameters: | ||
| - name: SPACE_NAME | ||
| required: true | ||
76 changes: 76 additions & 0 deletions
76
deploy/templates/nstemplatetiers/claw/spacerole_admin.yaml
This file contains hidden or 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,76 @@ | ||
| apiVersion: template.openshift.io/v1 | ||
| kind: Template | ||
| metadata: | ||
| name: claw-spacerole-admin | ||
| objects: | ||
|
|
||
| # RoleBinding to built-in view ClusterRole (read access to most resources, excludes secrets) | ||
| - apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: RoleBinding | ||
| metadata: | ||
| name: ${USERNAME}-view | ||
| namespace: ${NAMESPACE} | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: ClusterRole | ||
| name: view | ||
| subjects: | ||
| - kind: User | ||
| name: ${USERNAME} | ||
|
|
||
| # Custom Role for claw-specific permissions not covered by view | ||
| - apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: Role | ||
| metadata: | ||
| name: claw-user | ||
| namespace: ${NAMESPACE} | ||
| rules: | ||
| - apiGroups: | ||
| - "claw.sandbox.redhat.com" | ||
| resources: | ||
| - claws | ||
| verbs: | ||
| - get | ||
| - list | ||
| - watch | ||
| - create | ||
| - update | ||
| - patch | ||
| - delete | ||
| - apiGroups: | ||
| - "" | ||
| resources: | ||
| - pods/exec | ||
| verbs: | ||
| - get | ||
| - create | ||
| - apiGroups: | ||
| - "" | ||
| resources: | ||
| - secrets | ||
| verbs: | ||
| - get | ||
| - list | ||
| - watch | ||
|
alexeykazakov marked this conversation as resolved.
|
||
| - create | ||
| - update | ||
| - patch | ||
| - delete | ||
| - apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: RoleBinding | ||
| metadata: | ||
| name: ${USERNAME}-claw-user | ||
| namespace: ${NAMESPACE} | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: Role | ||
| name: claw-user | ||
| subjects: | ||
| - kind: User | ||
| name: ${USERNAME} | ||
|
|
||
| parameters: | ||
| - name: NAMESPACE | ||
| required: true | ||
| - name: USERNAME | ||
| required: true | ||
This file contains hidden or 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,23 @@ | ||
| apiVersion: template.openshift.io/v1 | ||
| kind: Template | ||
| metadata: | ||
| name: claw-tier | ||
| objects: | ||
| - kind: NSTemplateTier | ||
| apiVersion: toolchain.dev.openshift.com/v1alpha1 | ||
| metadata: | ||
| name: claw | ||
| namespace: ${NAMESPACE} | ||
| spec: | ||
| clusterResources: | ||
| templateRef: ${CLUSTER_TEMPL_REF} | ||
| namespaces: | ||
| - templateRef: ${CLAW_TEMPL_REF} | ||
| spaceRoles: | ||
| admin: | ||
| templateRef: ${ADMIN_TEMPL_REF} | ||
| parameters: | ||
| - name: NAMESPACE | ||
| - name: CLUSTER_TEMPL_REF | ||
| - name: CLAW_TEMPL_REF | ||
| - name: ADMIN_TEMPL_REF |
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if we would need also a NetworkPolicy for communication between
-clawand-devnamespace, but probably not. WDYT?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be useful so the claw could access services running in -dev. But we would also need to whitelist internal cluster traffic in the proxy to make it work.
PR for the proxy side: codeready-toolchain/claw-operator#139
I also added the NP creation by Dashboard to the design: https://github.com/codeready-toolchain/sandbox-claw-operator/blob/master/docs/proposals/namespace-isolation-checklist.md#8-dashboard-flow
I would probably avoid adding this NP to the -dev template so we don't introduce another NP for all users even if they don't deploy any Claws.