Consider namespace when comparing resources

Fixes #6857

Signed-off-by: Fabian Ruff <fabian.ruff@sap.com>
pull/7423/head
Fabian Ruff 5 years ago committed by Matthew Fisher
parent 82ea5aa774
commit 166092fd7e
No known key found for this signature in database
GPG Key ID: 92AA783CBAAE8E3B

@ -415,5 +415,5 @@ func recreate(cfg *Configuration, resources kube.ResourceList) error {
func objectKey(r *resource.Info) string {
gvk := r.Object.GetObjectKind().GroupVersionKind()
return fmt.Sprintf("%s/%s/%s", gvk.GroupVersion().String(), gvk.Kind, r.Name)
return fmt.Sprintf("%s/%s/%s/%s", gvk.GroupVersion().String(), gvk.Kind, r.Namespace, r.Name)
}

@ -167,7 +167,7 @@ func (c *Client) Update(original, target ResourceList, force bool) (*Result, err
}
kind := info.Mapping.GroupVersionKind.Kind
c.Log("Created a new %s called %q\n", kind, info.Name)
c.Log("Created a new %s called %q in %s\n", kind, info.Name, info.Namespace)
return nil
}

@ -81,5 +81,5 @@ func (r ResourceList) Intersect(rs ResourceList) ResourceList {
// isMatchingInfo returns true if infos match on Name and GroupVersionKind.
func isMatchingInfo(a, b *resource.Info) bool {
return a.Name == b.Name && a.Mapping.GroupVersionKind.Kind == b.Mapping.GroupVersionKind.Kind
return a.Name == b.Name && a.Namespace == b.Namespace && a.Mapping.GroupVersionKind.Kind == b.Mapping.GroupVersionKind.Kind
}

Loading…
Cancel
Save