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

[FE]: Add label & annotation to the auto-generated RemoteUserBinding to inform that it is managed by syngit #45

Open
damsien opened this issue Dec 23, 2024 · 0 comments
Labels
enhancement Request for enhancement good first issue Good for newcomers

Comments

@damsien
Copy link
Collaborator

damsien commented Dec 23, 2024

Roadmap 2025/01 Add label & annotation to the auto-generated RemoteUserBinding to inform that it is managed by Syngit.
As the developer of my team, I want to make the difference between RemoteUserBindings that have been automatically generated (with the syngit.io/associated-remote-userbinding: "true" annotation) and those who have not. I want to make the difference using a specific label.

What to do

  1. On create

When creating the auto-generated RemoteUserBinding, add the labels managed-by: syngit.io & syngit.io/k8s-user: username. Also, add the annotation syngit.io/controlled-by: webhook/remoteuser-association.

// Create the RemoteUserBinding object
rub.Name = name
rub.Namespace = req.Namespace

The username variable already exists here:

username := req.DeepCopy().UserInfo.Username

  1. On update

After setting the remoteRefs and before updating the RemoteUserBinding.

rub.Spec.RemoteRefs = remoteRefs
updateErr := ruwh.Client.Update(ctx, rub)

Set the `syngit.io/controlled-by: webhook/remoteuser-association annotation again. Since the annotations fields is defined as a map, it will either add it to the map (is removed by the user) or replace the old value (which was the exact same).

Additional context

If you have any questions, please tag @damsien.

@damsien damsien added the enhancement Request for enhancement label Dec 23, 2024
@damsien damsien changed the title [RFE]: [FE]: Add label & annotation to the auto-generated RemoteUserBinding to inform that it is managed by syngit Dec 23, 2024
@damsien damsien added the good first issue Good for newcomers label Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Request for enhancement good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant