add suffix field to ResId

This commit is contained in:
zoncoen
2018-11-14 12:43:49 +09:00
parent a8984578e4
commit a14609f730
4 changed files with 161 additions and 39 deletions

View File

@@ -122,8 +122,8 @@ func (m ResMap) DeepCopy(rf *resource.Factory) ResMap {
}
// FilterBy returns a subset ResMap containing ResIds with
// the same namespace and leftmost name prefix as the
// inputId. If inputId is a cluster level resource, this
// the same namespace and leftmost name prefix and rightmost name
// as the inputId. If inputId is a cluster level resource, this
// returns the original ResMap.
func (m ResMap) FilterBy(inputId resid.ResId) ResMap {
if inputId.Gvk().IsClusterKind() {
@@ -131,7 +131,7 @@ func (m ResMap) FilterBy(inputId resid.ResId) ResMap {
}
result := ResMap{}
for id, res := range m {
if id.Namespace() == inputId.Namespace() && id.HasSameLeftmostPrefix(inputId) {
if id.Namespace() == inputId.Namespace() && id.HasSameLeftmostPrefix(inputId) && id.HasSameRightmostSuffix(inputId) {
result[id] = res
}
}