Skip to content
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

An admin should be able to specify Secrets, ConfigMaps and PersistentVolumesClaims that need to be provisioned on each user's namespace #20501

Closed
skabashnyuk opened this issue Sep 21, 2021 · 15 comments
Assignees
Labels
area/che-operator Issues and PRs related to Eclipse Che Kubernetes Operator kind/task Internal things, technical debt, and to-do tasks to be performed. severity/P1 Has a major impact to usage or development of the system. sprint/next status/analyzing An issue has been proposed and it is currently being analyzed for effort and implementation approach

Comments

@skabashnyuk
Copy link
Contributor

skabashnyuk commented Sep 21, 2021

Is your task related to a problem? Please describe

There are multiple usecases.

  • Share some application environment variables. JAVA_OPTS, MAVEN_OPTS
  • Share password and login for some database in all workspaces
  • Etc.

Describe the solution you'd like

Secrets and configmaps with predefined set of labels can be propaged to the user's namespace

apiVersion: v1
kind: Secret
metadata:
  name: <secret-name>

  annotations:
    .....
  labels:
    .....
    app.kubernetes.io/part-of: che.eclipse.org
    app.kubernetes.io/component: workspaces-config
type: <type>
data:
  ....
apiVersion: v1
kind: ConfigMap
metadata:
  name: <configmap-name>
  annotations:
    .....
  labels:
    .....
    app.kubernetes.io/part-of: che.eclipse.org
    app.kubernetes.io/component: workspaces-config
type: <type>
data:

Original labels and annotations should be preserved.

Additional context

https://issues.redhat.com/browse/CRW-2120

@skabashnyuk skabashnyuk added kind/task Internal things, technical debt, and to-do tasks to be performed. area/che-server area/devworkspace-che-operator labels Sep 21, 2021
@che-bot che-bot added the status/need-triage An issue that needs to be prioritized by the curator responsible for the triage. See https://github. label Sep 21, 2021
@azatsarynnyy azatsarynnyy added severity/P1 Has a major impact to usage or development of the system. and removed status/need-triage An issue that needs to be prioritized by the curator responsible for the triage. See https://github. labels Sep 21, 2021
@metlos
Copy link
Contributor

metlos commented Sep 22, 2021

As for the instructions on how to map those secrets/configmaps to the workspaces, we should make sure that the DWO labels/annos are used. E.g. devfile/devworkspace-operator#417 and devfile/devworkspace-operator#564

@metlos
Copy link
Contributor

metlos commented Sep 22, 2021

We need to somehow guarantee the order in which the configmaps/secrets would be applied to the workspace.

Imagine an admin would define a "global" configmap with JAVA_OPTS env variable for all workspaces of all users. It is conceivable that some users might want to redefine that env var to something else. They would do that by defining their own configmap in their namespace and labeling it accordingly.

We need to be able to tell DWO in what order it should apply the configmaps such that the "user settings" can override the "global settings".

What do you think about this, @sleshchenko , @l0rd ?

@l0rd
Copy link
Contributor

l0rd commented Sep 22, 2021

@metlos good point. We definitely need to label the target secrets/configmaps as app.kubernetes.io/managed-by: che and app.kubernetes.io/created-by: che-server or something like that.

However I think we can leave the how to merge multiple overlapping secrets/cm out of the scope of this issue.

@che-bot
Copy link
Contributor

che-bot commented Aug 3, 2022

Issues go stale after 180 days of inactivity. lifecycle/stale issues rot after an additional 7 days of inactivity and eventually close.

Mark the issue as fresh with /remove-lifecycle stale in a new comment.

If this issue is safe to close now please do so.

Moderators: Add lifecycle/frozen label to avoid stale mode.

@che-bot che-bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 3, 2022
@l0rd
Copy link
Contributor

l0rd commented Aug 3, 2022

/remove-lifecycle stale

@l0rd
Copy link
Contributor

l0rd commented Aug 3, 2022

@tolusha this is the issue you are currently working on right?

@che-bot che-bot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 3, 2022
@tolusha
Copy link
Contributor

tolusha commented Aug 3, 2022

This one #21605

@l0rd l0rd added area/che-operator Issues and PRs related to Eclipse Che Kubernetes Operator and removed area/devworkspace-che-operator labels Jan 23, 2023
@ibuziuk ibuziuk reopened this Oct 25, 2023
@ibuziuk
Copy link
Member

ibuziuk commented Oct 25, 2023

/remove-lifecycle stale

@ibuziuk ibuziuk added status/analyzing An issue has been proposed and it is currently being analyzed for effort and implementation approach sprint/next labels Oct 25, 2023
@ibuziuk
Copy link
Member

ibuziuk commented Dec 8, 2023

@tolusha @l0rd please consider taking this issue to the next sprint for Team A

@l0rd
Copy link
Contributor

l0rd commented Dec 20, 2023

che-operator should watch for Secrets/ConfigMaps/PersistentVolumeClaims, with the following labels, in the Che namespace:

  labels:
    app.kubernetes.io/part-of: che.eclipse.org
    app.kubernetes.io/component: workspaces-config

For example if, a ConfigMap like the following one is in the Che namespace:

kind: ConfigMap
apiVersion: v1
metadata:
  name: dev-env-variables
  labels:
    app.kubernetes.io/part-of: che.eclipse.org
    app.kubernetes.io/component: workspaces-config
  annotations:
    (...)
data:
  (...)

then the following ConfigMap should be created in every user namespace:

kind: ConfigMap
apiVersion: v1
metadata:
  name: dev-env-variables
  labels:
    app.kubernetes.io/part-of: che.eclipse.org
    app.kubernetes.io/component: workspaces-config
    controller.devfile.io/mount-to-devworkspace: "true"
    controller.devfile.io/watch-secret: "true"
  annotations:
    (...)
data:
  (...)

@l0rd l0rd changed the title An admin should be able to specify secrets or config maps that need to be provisioned on each user's namespace An admin should be able to specify Secrets, ConfigMaps and PersistentVolumesClaims that need to be provisioned on each user's namespace Dec 20, 2023
@tolusha
Copy link
Contributor

tolusha commented Jan 2, 2024

@l0rd
The side effect of syncing PVC is that we will have one extra PV created on the cluster.
Is it ok for us?

@ibuziuk
Copy link
Member

ibuziuk commented Jan 2, 2024

The side effect of syncing PVC is that we will have one extra PV created on the cluster.

will let Mario comment, but I think this should not be a problem since this is how k8s works.

PVC does not automatically create a PV; rather, it either binds to an existing PV or triggers the dynamic provisioning of a new PV based on the specified storage class.

N.B. PV provisioning is dependent on storage class e.g. there are non-dynamic storage classes that would require manual PV creation.

Also, if I remember correctly when PVC does not specify a storageClassName, it will only bind to an existing PV that is not already claimed by another PVC. If there is no matching PV available, the PVC remains pending until a suitable PV is manually created and becomes available.

@l0rd
Copy link
Contributor

l0rd commented Jan 2, 2024

@l0rd The side effect of syncing PVC is that we will have one extra PV created on the cluster. Is it ok for us?

Yes, that's fine. That's something that the Che admin should manage (i.e. should check if it's possible to get an extra PV for every developer).

@tolusha
Copy link
Contributor

tolusha commented Jan 15, 2024

@ibuziuk
I am wondering what we are supposed to do if admin deleted the configmap/secret/pvc in an operator namespace.
Should we remove all the corresponding objects in users namespace?

@ibuziuk
Copy link
Member

ibuziuk commented Jan 15, 2024

@tolusha yes, I belive we should remove the resource from the users' namespaces

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/che-operator Issues and PRs related to Eclipse Che Kubernetes Operator kind/task Internal things, technical debt, and to-do tasks to be performed. severity/P1 Has a major impact to usage or development of the system. sprint/next status/analyzing An issue has been proposed and it is currently being analyzed for effort and implementation approach
Projects
None yet
Development

No branches or pull requests

7 participants