Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions pkg/cluster/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -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?

_, kubeIamInCronJob := job.Annotations[constants.KubeIAmAnnotation]
_, kubeIamInTemplate := job.Spec.JobTemplate.Annotations[constants.KubeIAmAnnotation]
if kubeIamInCronJob || kubeIamInTemplate {
if _, exists := desiredJob.Annotations[constants.KubeIAmAnnotation]; !exists {
patchData, err := json.Marshal(map[string]interface{}{
"metadata": map[string]interface{}{
"annotations": map[string]*string{constants.KubeIAmAnnotation: nil},
},
"spec": map[string]interface{}{
"jobTemplate": map[string]interface{}{
"metadata": map[string]interface{}{
"annotations": map[string]*string{constants.KubeIAmAnnotation: nil},
},
},
},
})
if err != nil {
return fmt.Errorf("could not form patch to remove kube2iam annotation from logical backup job %q: %v", jobName, err)
}
_, err = c.KubeClient.CronJobs(c.Namespace).Patch(context.TODO(), jobName, types.MergePatchType, patchData, metav1.PatchOptions{})
if err != nil {
return fmt.Errorf("could not remove kube2iam annotation from logical backup job %q: %v", jobName, err)
}
}
}
c.LogicalBackupJob = desiredJob
return nil
}
Expand Down