ResId.Equals usable for VariableRef.

- Namespace need objRef field in variable declaration
- Add namespace conflict test for variables

The replacement of ResId.GkvnEquals reference by ResId.Equals
highligthed the fact it is no possible yet when looking for
variable targets because the namespace field is not allowed yet.
This commit adds two tests to the namespaces_test.go regarding
that use case.
This commit is contained in:
Jerome Brette
2019-07-07 11:19:20 -05:00
parent 33159c26df
commit dd5674fe6b
2 changed files with 237 additions and 0 deletions

View File

@@ -64,6 +64,8 @@ func (ra *ResAccumulator) GetTransformerConfig() *config.TransformerConfig {
func (ra *ResAccumulator) MergeVars(incoming []types.Var) error {
for _, v := range incoming {
// TODO(jeb): Do not change GvknEquals to Equals until the
// namespace is part of the variable declaration.
matched := ra.resMap.GetMatchingResourcesByOriginalId(
resid.NewResId(v.ObjRef.GVK(), v.ObjRef.Name).GvknEquals)
if len(matched) > 1 {