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

[FEATURE]: Delete annotations from objects after they are deleted from the namespace #14

Open
shanduur opened this issue Sep 29, 2024 · 2 comments
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature.

Comments

@shanduur
Copy link
Contributor

Is your feature request related to a problem? Please describe.

Currently, when annotations are removed from the namespace, they remain on the previously annotated objects (e.g., Deployments, Services) unless manually removed. This can lead to outdated or incorrect annotations persisting on resources, which might cause confusion or unwanted behavior.

Describe the solution you'd like.

I would like Scribe to automatically remove annotations from resources when they are deleted from the namespace's annotations. This would ensure that resources stay in sync with the current state of the namespace's annotations.

Example:

  1. Namespace example has the following annotation:
    apiVersion: v1
    kind: Namespace
    metadata:
      name: example
      annotations:
        scribe.anza-labs.dev/annotations: |
          app.kubernetes.io/name=example
  2. The annotation is propagated to all resources within the namespace.
  3. Later, the annotation is removed from the namespace:
    apiVersion: v1
    kind: Namespace
    metadata:
      name: example
      annotations:
        scribe.anza-labs.dev/annotations: ""
  4. Scribe should detect the change and remove the app.kubernetes.io/name=example annotation from all relevant resources automatically.

Describe alternatives you've considered.

  1. Manually removing annotations from resources when they are no longer needed, which can be time-consuming and error-prone in large environments.
  2. Using custom scripts or jobs to periodically clean up outdated annotations, but this adds complexity and overhead.

Additional Information

No response

@shanduur shanduur changed the title [FEATURE]: <title> [FEATURE]: Delete annotations from objects after they are deleted from the namespace Sep 29, 2024
@shanduur shanduur added help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature. labels Sep 29, 2024
@Abiji-2020
Copy link

I am interested in this issue.

Proposed solution:

  • We can develop the solution by integrating the watcher for the changes in the namespace annotation by using shared Informer and then we can reconcile for the updating?

@shanduur
Copy link
Contributor Author

shanduur commented Oct 3, 2024

Hi @Abiji-2020! Thanks for reaching out.

I think that the changes to annotations on Namespace should be already watched, so the only thing left is to save annotations in something like scribe.anza-labs.devl/last-applied-annotations and update existing ones based on the diff between namespace and the aforementioned annotation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

2 participants