Skip to content

Commit

Permalink
Merge pull request #49 from briantkennedy/master
Browse files Browse the repository at this point in the history
Fix an issue in types.ReconcileKey.String()
  • Loading branch information
Phillip Wittrock committed Apr 4, 2018
2 parents ed1c5d9 + f53d2c3 commit 6bf7b0b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkg/controller/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,17 @@ type ReconcileKey struct {
}

func (r ReconcileKey) String() string {
if r.Namespace == "" {
return r.Name
}
return r.Namespace + "/" + r.Name
}

// ParseReconcileKey returns the ReconcileKey that has been encoded into a string.
func ParseReconcileKey(key string) (ReconcileKey, error) {
namespace, name, err := cache.SplitMetaNamespaceKey(key)
if err != nil {
return ReconcileKey{}, err
}
return ReconcileKey{Name: name, Namespace: namespace}, nil
}

0 comments on commit 6bf7b0b

Please sign in to comment.