Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ResId.Equals usable for VariableRef. #1327

Merged
merged 2 commits into from
Jul 19, 2019

Conversation

jbrette
Copy link
Contributor

@jbrette jbrette commented Jul 9, 2019

As per request, splitting big PR into smaller ones:

This PR address the issue #1298 . We can't change ResId.GkvnEquals to ResId.Equals yet because the namespace is not part of the variable declaration.

Added a test case demonstrating the umbiguaus variable error causes by that problem

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 9, 2019
@jbrette
Copy link
Contributor Author

jbrette commented Jul 9, 2019

/assign @Liujingfang1

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 9, 2019
@jbrette jbrette force-pushed the residrequals-variables branch from 3d9e3af to f56c5df Compare July 9, 2019 20:00
@jbrette jbrette force-pushed the residrequals-variables branch 7 times, most recently from 5e3bb4f to 08c001f Compare July 17, 2019 21:14
@jbrette
Copy link
Contributor Author

jbrette commented Jul 17, 2019

@Liujingfang1 Gentle push of the PR. Same thing. No actual code change, just a comment to warn a contributor not to change GkvnEqual to Equal until change are done to the definition of the variableRef. Added a test covering for issue 1298.

@tkellen
Copy link
Contributor

tkellen commented Jul 18, 2019

Seconded on the review request @Liujingfang1. Deeply appreciate all your work on kustomize, not trying to be a pest, it would just be wonderful to see a bit of movement on this and @jbrette's associated PRs around "diamond importing".

@jbrette jbrette force-pushed the residrequals-variables branch from 08c001f to b071857 Compare July 18, 2019 21:01
@Liujingfang1
Copy link
Contributor

@jbrette @tkellen Will take a look at this change today. For the diamond importing change, I still have a lot of concern and don't think it is the right way to handle all different cases. There is an issue for adding new fields to merge resources. It can better address the need of merging resources.

@jbrette
Copy link
Contributor Author

jbrette commented Jul 18, 2019

@Liujingfang1 I just rebased this PR. It actually does not change the code and will allow the team to track the eventual change of the variable declaration will solve issue #1298.

Solving the issue 1298 itself will required some work.

// https://github.com/kubernetes-sigs/kustomize/issues/1298
const namespaceNeedInVarMyApp string = `
resources:
- elasticsearch-test-service.yaml
Copy link
Contributor

@Liujingfang1 Liujingfang1 Jul 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test case can be changed to a different layout

  • base with var
  • overlay for test namespace
  • overlay for dev namespace
  • both

This layout currently fails, but I think we should fix it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Liujingfang1 Don't completely understand the request. The PR has two tests. The first one is matching your "base with var". The second called workaround is matching "both".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This layout is a different use case that came into my mind when reviewing this PR. It is not due to the same root cause, but I think we need to fix it.

@jbrette jbrette force-pushed the residrequals-variables branch from b071857 to 1344f1e Compare July 18, 2019 23:36
jbrette added 2 commits July 18, 2019 19:20
- 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.
@jbrette jbrette force-pushed the residrequals-variables branch from 1344f1e to 0bec7b9 Compare July 19, 2019 00:21
@jbrette
Copy link
Contributor Author

jbrette commented Jul 19, 2019

@Liujingfang1 Please merge this PR first.

@jbrette
Copy link
Contributor Author

jbrette commented Jul 19, 2019

@tkellen @Liujingfang1 @monopole We are just getting there. The current PR is just pushing to conflict resolution to the SMPConflictDetector instead of just failing because of conflict in var names or resource Id. So if your are trying to mix patches which are "adding things", it will work. Hence kustomize is just better, not perfect but it can deal with more cases.

So we are just better than before. The real fix will come the day we are able to leverage the ThreeWayMerge from SMP,

If you check in details, the PR is compliant with 1292. The idea is that if the merge could not happen automatically, it would ask for support in the kustomization.yaml in order to solve the merge conflct.

@Liujingfang1
Copy link
Contributor

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 19, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jbrette, Liujingfang1

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 19, 2019
@k8s-ci-robot k8s-ci-robot merged commit d3f8c0d into kubernetes-sigs:master Jul 19, 2019
@jbrette jbrette deleted the residrequals-variables branch July 19, 2019 17:01
@tkellen
Copy link
Contributor

tkellen commented Jul 23, 2019

@jbrette Should this landing fix the usecase I defined in #1316 (comment)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants