Skip to content

Commit

Permalink
Consider namespace when comparing resources
Browse files Browse the repository at this point in the history
Fixes #6857

Signed-off-by: Fabian Ruff <fabian.ruff@sap.com>
  • Loading branch information
databus23 committed Nov 3, 2019
1 parent bf8318e commit 7f7e90b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/action/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
2 changes: 1 addition & 1 deletion pkg/kube/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/kube/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 7f7e90b

Please sign in to comment.