Fix deep copy for EngineStatus inner Snapshot maps (children, label)
By not copying the maps by value, they will continue to point to the original
@@ -98,9 +98,24 @@ func (e *EngineStatus) DeepCopyInto(to *EngineStatus) {
}
if e.Snapshots != nil {
to.Snapshots = make(map[string]*Snapshot)
- for key, value := range e.Snapshots {
+ for key, source := range e.Snapshots {
to.Snapshots[key] = &Snapshot{}
- *to.Snapshots[key] = *value
+ *to.Snapshots[key] = *source
+ out := to.Snapshots[key]
+
+ if source.Children != nil {
+ out.Children = make(map[string]bool)
+ for key, value := range source.Children {
+ out.Children[key] = value
+ }
+ }
+
+ if source.Labels != nil {
+ out.Labels = make(map[string]string)
+ for key, value := range source.Labels {
+ out.Labels[key] = value
+ }
+ }
}
}
}
