mirror of
https://github.com/kairos-io/entangle.git
synced 2025-09-17 14:58:30 +00:00
Don't mutate original Pod's labels
because we don't want to, plus annotations may not fit in labels because they have different character limit. Fix for error about 63 character limit Signed-off-by: Dimitris Karakasilis <jimmykarily@gmail.com>
This commit is contained in:
@@ -60,11 +60,16 @@ func (w *Webhook) Mutate(ctx context.Context, request admission.Request, object
|
|||||||
pod := object.(*corev1.Pod)
|
pod := object.(*corev1.Pod)
|
||||||
|
|
||||||
// Let user use both label and annotations
|
// Let user use both label and annotations
|
||||||
info := pod.Labels
|
info := make(map[string]string)
|
||||||
|
|
||||||
// Annotations take precedence
|
// Annotations take precedence
|
||||||
for ann, v := range pod.Annotations {
|
for k, v := range pod.Labels {
|
||||||
info[ann] = v
|
info[k] = v
|
||||||
|
}
|
||||||
|
|
||||||
|
// Annotations take precedence
|
||||||
|
for k, v := range pod.Annotations {
|
||||||
|
info[k] = v
|
||||||
}
|
}
|
||||||
|
|
||||||
entanglementName, exists := info[EntanglementNameLabel]
|
entanglementName, exists := info[EntanglementNameLabel]
|
||||||
|
Reference in New Issue
Block a user