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

Add labels to ODS projects for cleanup 🧹 #668

Open
felipecruz91 opened this issue Jan 27, 2021 · 11 comments
Open

Add labels to ODS projects for cleanup 🧹 #668

felipecruz91 opened this issue Jan 27, 2021 · 11 comments
Labels
enhancement New feature or request

Comments

@felipecruz91
Copy link
Contributor

felipecruz91 commented Jan 27, 2021

Is your feature request related to a problem? Please describe.
OpenShift clusters, over time, end up with 100+ ODS projects that are difficult to keep track of what the owner is. This is important when it comes to deleting old and unused projects to free up resources in the cluster.

Describe the solution you'd like
The Prov App could define labels when creating the ODS project in OpenShift. For instance, it could add:

ods.project.owner: [email protected]
ods.project.type: [default|kanban|EDProject]

This way, we could identify what projects belong to what users with oc get projects -l [email protected]

Additional context
The aforementioned fields can be populated from the Prov App form.

Would like to hear your thoughts on this @clemensutschig @michaelsauter

@michaelsauter
Copy link
Member

Sounds interesting - the question is what labels should be applied, and how to make that flexible enough ...

@stitakis
Copy link
Member

I find it interesting too... additionally you will need to modify in ods-core https://github.com/opendevstack/ods-core/blob/master/create-projects/create-projects.sh to add the labels on/after project creation

@felipecruz91
Copy link
Contributor Author

felipecruz91 commented Jan 28, 2021

I've been looking into using the first project admin in the PROJECT_ADMINS list as owner of the project but just realized that labels do not allow using @ as part of it.

$ kubectl label namespace test '[email protected]'
error: invalid label value: "'[email protected]'": a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue',  or 'my_value',  or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?')

So I have replaced the '@' symbol with 'at'.

@metmajer
Copy link
Member

@felipecruz91 we have work in progress with @michaelsauter already using a labelling standard... will have to find it

@michaelsauter
Copy link
Member

@metmajer I think you are referring to opendevstack/ods-quickstarters#512. However, that is about resources within a project, while I believe @felipecruz91 suggestion is for labels on the project itself.

@felipecruz91
Copy link
Contributor Author

felipecruz91 commented Jan 28, 2021

Thanks for clarifying @michaelsauter. My suggestion here is to use ods.project.owner to define what the owner of the project is.

I think it is nice to define the label name following a hierarchy from ods, followed by the type of object project, and finally the subject owner. Hopefully, this will avoid any conflicts or clashes with other labels that the infra team want to specify in the future.

@segator
Copy link

segator commented Jan 28, 2021

what about opendevstack.org/project.owner ?
any metadata is welcome, this will be helpfully in the future for querying and tracability. thanks @felipecruz91 for the idea

@jafarre-bi
Copy link

I've been looking into using the first project admin in the PROJECT_ADMINS list as owner of the project but just realized that labels do not allow using @ as part of it.

$ kubectl label namespace test '[email protected]'
error: invalid label value: "'[email protected]'": a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue',  or 'my_value',  or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?')

So I have replaced the '@' symbol with 'at'.

A project admin user can be defined when provisioning the project, but I am not sure whether it will always be present. Otherwise, the first admin in the group is a good idea.

I like @segator proposal of opendevstack.org/project.owner. An alternative could be project.opendevstack.org/owner or even .../owner.email.

@stitakis stitakis added the enhancement New feature or request label Mar 26, 2021
felipecruz91 added a commit to opendevstack/ods-core that referenced this issue Jul 13, 2021
* Assign the owner as a label to the project

Refers to opendevstack/ods-provisioning-app#668

* Added entry in CHANGELOG.md

* Added double quote to prevent globbing and word splitting

* Updated label to opendevstack.org/project.owner

Co-authored-by: zxBCN Cruz_Martinez <[email protected]>
@stitakis
Copy link
Member

@felipecruz91 is this item still planned for ODS 4.0.0 or we could move it to ODS 4.1.0?

@felipecruz91
Copy link
Contributor Author

@metmajer Would you reply to the previous comment?

@metmajer
Copy link
Member

@felipecruz91 this sounds super useful. However, there were issues with the service account permissions. @clemensutschig knows more. If there is no quick solution ahead, we will have to defer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants