Skip to content

Commit 04087eb

Browse files
Polina BunginaSchmaetz
authored andcommitted
func to add or remove annotations
1 parent 317f3de commit 04087eb

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

pkg/cluster/majorversionupgrade.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,22 @@ func (c *Cluster) removeFailuresAnnotation() error {
105105
return nil
106106
}
107107

108+
func (c *Cluster) criticalOperationLabel(pods []v1.Pod, value *string) error {
109+
metadataReq := map[string]map[string]map[string]*string{"metadata": {"labels": {"critical-operation": value}}}
110+
111+
patchReq, err := json.Marshal(metadataReq)
112+
if err != nil {
113+
return fmt.Errorf("could not marshal ObjectMeta: %v", err)
114+
}
115+
for _, pod := range pods {
116+
_, err = c.KubeClient.Pods(c.Namespace).Patch(context.TODO(), pod.Name, types.StrategicMergePatchType, patchReq, metav1.PatchOptions{})
117+
if err != nil {
118+
return err
119+
}
120+
}
121+
return nil
122+
}
123+
108124
/*
109125
Execute upgrade when mode is set to manual or full or when the owning team is allowed for upgrade (and mode is "off").
110126

0 commit comments

Comments
 (0)