-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #105 from stakater/devworkspace-metadata
Adding guide on how to DevWorkspace metadata
- Loading branch information
Showing
8 changed files
with
233 additions
and
19 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
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Templated values in Labels and Annotations | ||
|
||
Templated values are placeholders in your configuration that get replaced with actual data when the CR is processed. Below is a list of currently supported templated values, their descriptions, and where they can be used. | ||
|
||
## Supported templated values | ||
|
||
- `"{{ TENANT.USERNAME }}"` | ||
- **Description**: The username associated with users specified in [Tenant](../tutorials/tenant/create-tenant.md) under `Owners` and `Editors`. | ||
- **Supported in CRs**: | ||
- `Tenant`: Under `sandboxMetadata.labels` and `sandboxMetadata.annotations`. | ||
- `IntegrationConfig`: Under `metadata.sandboxs.labels` and `metadata.sandboxs.annotations`. | ||
- **Example**: | ||
|
||
```yaml | ||
annotation: | ||
che.eclipse.org/username: "{{ TENANT.USERNAME }}" # double quotes are required | ||
``` |
118 changes: 118 additions & 0 deletions
118
content/tutorials/dev-workspace/enabling-openshift-dev-workspace.md
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,118 @@ | ||
# Enabling DevWorkspace for Tenant's sandbox in OpenShift | ||
|
||
## DevWorkspaces metadata via Multi Tenant Operator | ||
|
||
DevWorkspaces require specific metadata on a namespace for it to work in it. With Multi Tenant Operator (MTO), you can create sandbox namespaces for users of a Tenant, and then add the required metadata automatically on all sandboxes. | ||
|
||
## Required metadata for enabling DevWorkspace on sandbox | ||
|
||
```yaml | ||
labels: | ||
app.kubernetes.io/part-of: che.eclipse.org | ||
app.kubernetes.io/component: workspaces-namespace | ||
annotations: | ||
che.eclipse.org/username: <username> | ||
``` | ||
## Automate sandbox metadata for all Tenant users via Tenant CR | ||
With Multi Tenant Operator (MTO), you can set `sandboxMetadata` like below to automate metadata for all sandboxes: | ||
|
||
```yaml | ||
apiVersion: tenantoperator.stakater.com/v1beta2 | ||
kind: Tenant | ||
metadata: | ||
name: bluesky | ||
spec: | ||
owners: | ||
users: | ||
- [email protected] | ||
editors: | ||
users: | ||
- [email protected] | ||
viewers: | ||
users: | ||
- [email protected] | ||
quota: small | ||
sandboxConfig: | ||
enabled: true | ||
private: false | ||
sandboxMetadata: | ||
labels: | ||
app.kubernetes.io/part-of: che.eclipse.org | ||
app.kubernetes.io/component: workspaces-namespace | ||
annotations: | ||
che.eclipse.org/username: "{{ TENANT.USERNAME }}" | ||
``` | ||
|
||
It will create sandbox namespaces and also apply the `sandboxMetadata` for owners and editors. Notice the template `{{ TENANT.USERNAME }}`, it will resolve the username as value of the corresponding annotation. For more info on templated value, see [here](../../reference-guides/templated-metadata-values.md) | ||
|
||
## Automate sandbox metadata for all Tenant users via IntegrationConfig CR | ||
|
||
You can also automate the metadata on all sandbox namespaces by using IntegrationConfig, notice `metadata.sandboxes`: | ||
|
||
```yaml | ||
apiVersion: tenantoperator.stakater.com/v1beta1 | ||
kind: IntegrationConfig | ||
metadata: | ||
name: tenant-operator-config | ||
namespace: multi-tenant-operator | ||
spec: | ||
accessControl: | ||
namespaceAccessPolicy: | ||
deny: | ||
privilegedNamespaces: {} | ||
privileged: | ||
namespaces: | ||
- ^default$ | ||
- ^openshift-* | ||
- ^kube-* | ||
serviceAccounts: | ||
- ^system:serviceaccount:openshift-* | ||
- ^system:serviceaccount:kube-* | ||
- ^system:serviceaccount:stakater-actions-runner-controller:actions-runner-controller-runner-deployment$ | ||
rbac: | ||
tenantRoles: | ||
default: | ||
editor: | ||
clusterRoles: | ||
- edit | ||
owner: | ||
clusterRoles: | ||
- admin | ||
viewer: | ||
clusterRoles: | ||
- view | ||
components: | ||
console: false | ||
ingress: | ||
console: {} | ||
gateway: {} | ||
keycloak: {} | ||
showback: false | ||
integrations: | ||
vault: | ||
accessInfo: | ||
accessorPath: "" | ||
address: "" | ||
roleName: "" | ||
secretRef: | ||
name: "" | ||
namespace: "" | ||
authMethod: kubernetes | ||
config: | ||
ssoClient: "" | ||
enabled: false | ||
metadata: | ||
groups: {} | ||
namespaces: {} | ||
sandboxes: | ||
labels: | ||
app.kubernetes.io/part-of: che.eclipse.org | ||
app.kubernetes.io/component: workspaces-namespace | ||
annotations: | ||
che.eclipse.org/username: "{{ TENANT.USERNAME }}" | ||
``` | ||
|
||
For more info on templated value `"{{ TENANT.USERNAME }}"`, see [here](../../reference-guides/templated-metadata-values.md) |
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,6 +1,8 @@ | ||
# Assigning Common/Specific Metadata | ||
# Assigning metadata | ||
|
||
## Distributing common labels and annotations to tenant namespaces via Tenant Custom Resource | ||
## Assigning Common/Specific Metadata | ||
|
||
### Distributing common labels and annotations to tenant namespaces via Tenant Custom Resource | ||
|
||
Bill now wants to add labels/annotations to all the namespaces for a tenant. To create those labels/annotations Bill will just add them into `commonMetadata.labels`/`commonMetadata.annotations` field in the tenant CR. | ||
|
||
|
@@ -37,7 +39,7 @@ EOF | |
|
||
With the above configuration all tenant namespaces will now contain the mentioned labels and annotations. | ||
|
||
## Distributing specific labels and annotations to tenant namespaces via Tenant Custom Resource | ||
### Distributing specific labels and annotations to tenant namespaces via Tenant Custom Resource | ||
|
||
Bill now wants to add labels/annotations to specific namespaces for a tenant. To create those labels/annotations Bill will just add them into `specificMetadata.labels`/`specificMetadata.annotations` and specific namespaces in `specificMetadata.namespaces` field in the tenant CR. | ||
|
||
|
@@ -76,3 +78,35 @@ EOF | |
``` | ||
|
||
With the above configuration all tenant namespaces will now contain the mentioned labels and annotations. | ||
|
||
## Assigning metadata to all sandboxes | ||
|
||
Bill can choose to apply metadata to sandbox namespaces only by using `sandboxMetadata` property of Tenant CR like below: | ||
|
||
```yaml | ||
apiVersion: tenantoperator.stakater.com/v1beta2 | ||
kind: Tenant | ||
metadata: | ||
name: bluesky | ||
spec: | ||
owners: | ||
users: | ||
- [email protected] | ||
- [email protected] | ||
editors: | ||
users: | ||
- [email protected] | ||
groups: | ||
- alpha | ||
quota: small | ||
sandboxConfig: | ||
enabled: true | ||
private: true | ||
sandboxMetadata: # metadata for all sandbox namespaces | ||
labels: | ||
app.kubernetes.io/part-of: che.eclipse.org | ||
annotations: | ||
che.eclipse.org/username: "{{ TENANT.USERNAME }}" # templated placeholder | ||
``` | ||
We are using a templated annotation here. See more on supported templated values for labels and annotations for specific MTO CRs [here](../../reference-guides/templated-metadata-values.md) |
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 |
---|---|---|
|
@@ -84,3 +84,35 @@ kubectl get namespaces | |
NAME STATUS AGE | ||
bluesky-anna-aurora-sandbox Active 5d5h | ||
``` | ||
|
||
## Set metadata on sandbox namespaces | ||
|
||
If you want to have a common metadata on all sandboxes, you can add `sandboxMetadata` to Tenant like below: | ||
|
||
```yaml | ||
apiVersion: tenantoperator.stakater.com/v1beta2 | ||
kind: Tenant | ||
metadata: | ||
name: bluesky | ||
spec: | ||
owners: | ||
users: | ||
- [email protected] | ||
- [email protected] | ||
editors: | ||
users: | ||
- [email protected] | ||
groups: | ||
- alpha | ||
quota: small | ||
sandboxConfig: | ||
enabled: true | ||
private: true | ||
sandboxMetadata: | ||
labels: | ||
app.kubernetes.io/part-of: che.eclipse.org | ||
annotations: | ||
che.eclipse.org/username: "{{ TENANT.USERNAME }}" # templated placeholder | ||
``` | ||
Note: In above Tenant, we have used a templated annotation value `"{{ TENANT.USERNAME }}"`. It will resolve to user of the respective sandbox namespace. For more info on it, see [here](../../reference-guides/templated-metadata-values.md) |
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