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

implement harbor project day2 configuration #1031

Merged
merged 10 commits into from
May 30, 2023

Conversation

ChristianLoewel
Copy link
Contributor

I decided to implement this as I need the harbor project day2 configuration for myself.

This adds the ability to create, update and delete Harbor projects via Kubernetes resources, including their metadata, group/user memberships and storage quotas.

I tried to provide unit tests, however I don't have much experience with go tests yet and due to the lack of already existing day2 tests to base mine off of I decided against it.

For the implementation I strongly oriented myself on the existing pull request for robotaccount day2, extending the REST client wrapper and using the HarborServerConfiguration CustomResource.

Currently, the operator plainly deletes a harbor project if a corresponding HarborProject CustomResource was deleted. It may be necessary to implement a way to optionally skip deleting the project when deleting the CustomResource. This would allow disabling the operator management of a project without deleting it and would limit the damage of accidental deletions.

I look forward to your feedback.

Signed-off-by: Christian Löwel [email protected]

@MarcelMue
Copy link
Collaborator

I will review the PR soon - please sign the DCO, so CI can be run.

@ChristianLoewel ChristianLoewel force-pushed the harborproject_day2_config branch from 66ef260 to a7d5063 Compare March 28, 2023 13:11
pkg/rest/v2/project.go Fixed Show fixed Hide fixed
@MarcelMue MarcelMue requested a review from thcdrt May 23, 2023 08:21
Copy link
Collaborator

@thcdrt thcdrt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution, I have some suggestions and questions

controllers/goharbor/project/memberships.go Outdated Show resolved Hide resolved
controllers/goharbor/project/memberships.go Outdated Show resolved Hide resolved
controllers/goharbor/project/memberships.go Show resolved Hide resolved
controllers/goharbor/project/memberships.go Outdated Show resolved Hide resolved
pkg/rest/v2/project.go Outdated Show resolved Hide resolved
pkg/rest/v2/project.go Outdated Show resolved Hide resolved
pkg/rest/v2/project.go Outdated Show resolved Hide resolved
@thcdrt
Copy link
Collaborator

thcdrt commented May 24, 2023

@ChristianLoewel can you resolve conflicts please ?

Signed-off-by: Christian Löwel <[email protected]>
Fix wrong ProjectID int conversion

Signed-off-by: Christian Löwel <[email protected]>
minor membership reconciliation code improvements

Signed-off-by: Christian Löwel <[email protected]>
Signed-off-by: Christian Löwel <[email protected]>
Signed-off-by: Christian Löwel <[email protected]>
Signed-off-by: Christian Löwel <[email protected]>
@ChristianLoewel ChristianLoewel force-pushed the harborproject_day2_config branch from aa3e6cb to b0b40f2 Compare May 24, 2023 18:26
@ChristianLoewel
Copy link
Contributor Author

Done! Will create a new pull request in a few weeks with tag retention policy, tag immutability, labels.

@thcdrt
Copy link
Collaborator

thcdrt commented May 25, 2023

@MarcelMue Helm charts tests are broken, is it linked to the move of the CRD out of the chart ?

@MarcelMue
Copy link
Collaborator

@MarcelMue Helm charts tests are broken, is it linked to the move of the CRD out of the chart ?

Something went wrong when rebasing here. This PR currently adds back the entire CRD into the helm chart. See how it adds 40k lines right now - I believe that is why the test is failing.

Signed-off-by: Christian Löwel <[email protected]>
@ChristianLoewel
Copy link
Contributor Author

My bad, wasn't aware of the crd change. I removed it now.

@MarcelMue
Copy link
Collaborator

I am generally very happy with the contribution. I think we should add some testing for the newly added functionalities here (so we test new features in CI). I am happy if this is done in a follow up / collaboration.

Sorry that it took so long to get this PR reviewed / unblocked 🙇‍♂️

@MarcelMue
Copy link
Collaborator

@ChristianLoewel can you provide some manifests (e.g. sample yaml config of CRDs) which you used for testing the added features in #1044 ? It will be helpful later on to more easily add tests.

@ChristianLoewel
Copy link
Contributor Author

Hi, sorry for the delay. I have created some test resources, let me know if you miss any cases.

https://gist.github.com/ChristianLoewel/24fc73b8ac740be5d89283a64df15c53

Tests would be great, I like the idea of the collaboration. Will definitely need your help with that.

@MarcelMue MarcelMue merged commit 02d809c into goharbor:master May 30, 2023
@MarcelMue
Copy link
Collaborator

Thanks for the contribution @ChristianLoewel ! If you want to collaborate more, please feel free to join the #harbor-dev channel in the cncf slack: https://cloud-native.slack.com/messages/harbor-operator-dev/

@chlins
Copy link
Member

chlins commented Jul 24, 2023

Hi, sorry for the delay. I have created some test resources, let me know if you miss any cases.

https://gist.github.com/ChristianLoewel/24fc73b8ac740be5d89283a64df15c53

Tests would be great, I like the idea of the collaboration. Will definitely need your help with that.

@ChristianLoewel Hi, could you please paste the example resources to the documents?

@ChristianLoewel
Copy link
Contributor Author

Hi @chlins, I have created a pull request #1066 to add the examples to the doc.

Additionally, a second PR #1067 fixes a reconciliation issue with HarborProjects I have noticed while using the feature.

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

Successfully merging this pull request may close these issues.

5 participants