mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 17:12:51 +00:00
Support for ConfigMap generator with identical names in different namespaces.
- Attempt to account, at build time, for subsequent kubectl apply behavior. (empty or no namespace means default). - Account for the fact that not all objects have a namespace. - Add new Equal method to ResId address merge name conflict - Add GroupByName to resources by namespaces to resolve filenames conflict - Added corresponding unit tests. - Change the fail test for issue #1155
This commit is contained in:
@@ -93,5 +93,25 @@ func (id ResId) GvknEquals(o ResId) bool {
|
||||
// Equals returns true if the other id matches
|
||||
// namespace/Group/Version/Kind/name.
|
||||
func (id ResId) Equals(o ResId) bool {
|
||||
return id.Namespace == o.Namespace && id.GvknEquals(o)
|
||||
return id.IsNsEquals(o) && id.GvknEquals(o)
|
||||
}
|
||||
|
||||
// IsNsEquals returns true if the other id matches namespace
|
||||
// or both are in the default namespace
|
||||
// or both are not namespaceable id.
|
||||
func (id ResId) IsNsEquals(o ResId) bool {
|
||||
return id.Namespace == o.Namespace ||
|
||||
(id.IsInDefaultNs() && o.IsInDefaultNs()) ||
|
||||
(!id.IsNamespaceable() && !o.IsNamespaceable())
|
||||
}
|
||||
|
||||
// IsInDefaultNs returns true if id is a namespable ResId and the Namespace
|
||||
// is either not set or set to "default"
|
||||
func (id ResId) IsInDefaultNs() bool {
|
||||
return id.IsNamespaceable() && (id.Namespace == "" || id.Namespace == "default")
|
||||
}
|
||||
|
||||
// IsNamespaceable returns true if id is a namespable ResId
|
||||
func (id ResId) IsNamespaceable() bool {
|
||||
return id.IsNamespaceableKind()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user