Skip to content

clean the kube2iam annotations when the role is empty - #3173

Open
tcondeixa wants to merge 4 commits into
masterfrom
irsa-kube2iam-clean-cronjob-job-annotations
Open

clean the kube2iam annotations when the role is empty#3173
tcondeixa wants to merge 4 commits into
masterfrom
irsa-kube2iam-clean-cronjob-job-annotations

Conversation

@tcondeixa

@tcondeixa tcondeixa commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

clean the kube2iam annotations when the role is empty from the cronjob and job template.

This is a follow up on #3128 to clean up the annotations for kube2iam when not role is passed (or empty).
During the migration we noticed the spilo-logical-backup cronjob and the job template were still with the annotation, this creates confusion.

This PR only deletes the KubeIAmAnnotation to reduce the risk of deleting any other annotation created in another place/time. If preferred I can delete all annotations not present when generating the cronjob

@tcondeixa

Copy link
Copy Markdown
Collaborator Author

@mikkeloscar @FxKu can you help to review this one. I did not test it yet in a cluster but want to be sure we are aligned in the approach.

Comment thread pkg/cluster/sync.go
@@ -1793,6 +1793,31 @@ func (c *Cluster) syncLogicalBackupJob() error {
return fmt.Errorf("could not patch annotations of the logical backup job %q: %v", jobName, err)
}
}

@FxKu FxKu Aug 19, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the code lines before are there to remove annotations. For the pod template here and for the job itself here. Do we really need an extra patch for the KubeIAmAnnotation?

@FxKu

FxKu commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Should we set KubeIAmAnnotation here similar to inside pod template generation?

@tcondeixa

tcondeixa commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator Author

Should we set KubeIAmAnnotation here similar to inside pod template generation?

@mikkeloscar was suggesting to just remove this specific annotation from the cronjob and job template, because it's not needed at all and it can just be simplified. This annotation is only needed inside the pod template when the kube_iam_role is not empty, but this was already addressed in the previous PR.

@FxKu

FxKu commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

The logical backup generation reuses the generatePodTempate function from the stateful set. So it would always re-add the annotation for it to be removed by your code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants