-
Notifications
You must be signed in to change notification settings - Fork 243
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
Fix issue with variables not substituted in uri
-referenced manifests (#5451)
#5711
Conversation
✅ Deploy Preview for odo-docusaurus-preview canceled.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have moved devfile from using Inlined
to using URI
as discussed during issue preparation. Are there some remaining devfile using Inlined
? I would not like we make regressions on this now :(
I identified the following places:
I was also hesitant on changing this in this PR. That's why the commit is isolated if we want to revert or do this change in a separate issue/PR. Ideally, I think we should come up with a way to easily reuse the same tests against both Inlined and URI-referenced manifests. This is what I tried to accomplish with this loop in |
uri
-referenced manifests (#5451)uri
-referenced manifests (#5451)
To be safe, I just reverted that commit from this PR, but saved it to a separate branch, and will try to include it in a dedicated PR later on. |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: feloy 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 |
The devfile used is the same as devfile-deploy.yaml, except that the the Kubernetes component is referenced via the URI. This is why the same integration test logic is being reused here.
…resource manifest and substitute variables This works with both Inlined or Uri resources. Notes: - Ideally, it would make more sense to rely on the same logic used in Devfile to substitute variables (defined in the 'variables' package), but this function is not exported; and the exported ones substitute variables only in the URI name, not in the content itself (it is not fetched), which is actually the issue we are trying to solve here.
This seems to be a much more realistic case when referencing external Kubernetes manifests. Notes: Some tests, like for `odo deploy`, still test 'Inlined' manifests.
…riablesResolved' As suggested in review, this makes more sense now that we are passing the entire devfile object
…h 'GetK8sManifestWithVariablesSubstituted' Previous name was a bit long ^^
…ameNameError#Error', as suggested in review
This reverts commit df1f19e. This will be done in a separate PR, with ideally changes that should allow to use the same set of tests for testing both Inlined and URI-referenced manifests.
9d78b5c
to
614bc60
Compare
Just rebased onto |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
/lgtm |
/override ci/prow/v4.10-integration-e2e Looks like a problem not related to this PR, but related to the deprovisioning job that tears down the cluster on Prow:
All tests passed on IBM Cloud by the way. |
@rm3l: Overrode contexts on behalf of rm3l: ci/prow/v4.10-integration-e2e In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
redhat-developer#5451) (redhat-developer#5711) * Add integration test highlighting the issue The devfile used is the same as devfile-deploy.yaml, except that the the Kubernetes component is referenced via the URI. This is why the same integration test logic is being reused here. * Add higher-level function in 'libdevfile' allowing to load component resource manifest and substitute variables This works with both Inlined or Uri resources. Notes: - Ideally, it would make more sense to rely on the same logic used in Devfile to substitute variables (defined in the 'variables' package), but this function is not exported; and the exported ones substitute variables only in the URI name, not in the content itself (it is not fetched), which is actually the issue we are trying to solve here. * Switch to using 'uri' Kubernetes components in test Devfiles This seems to be a much more realistic case when referencing external Kubernetes manifests. Notes: Some tests, like for `odo deploy`, still test 'Inlined' manifests. * Pass the component name to 'GetComponentResourceManifestContentWithVariablesResolved' As suggested in review, this makes more sense now that we are passing the entire devfile object * Rename 'GetComponentResourceManifestContentWithVariablesResolved' with 'GetK8sManifestWithVariablesSubstituted' Previous name was a bit long ^^ * Remove extra parentheses in error string returned by 'ComponentsWithSameNameError#Error', as suggested in review * Revert "Switch to using 'uri' Kubernetes components in test Devfiles" This reverts commit df1f19e. This will be done in a separate PR, with ideally changes that should allow to use the same set of tests for testing both Inlined and URI-referenced manifests.
What type of PR is this:
/kind bug
What does this PR do / why we need it:
This fixes the issue reported in #5451, where running
odo deploy
(actually any commands callinglibdevfile.GetK8sComponentAsUnstructured
) using a Devfile containinguri
-referenced manifests containing variables would not succeed, either with a YAML validation error message similar to the line below or with an error (e.g., unresolvable image name) in the manifest once deployed in the cluster:Which issue(s) this PR fixes:
Fixes #5451
PR acceptance criteria:
Unit test
Integration test
Documentation
How to test changes / Special notes to the reviewer:
Refer to the reproduction steps depicted in the original issue for testing this: #5451
From the code perspective, as discussed during one of the Sprint Plannings, this PR is enriching the
libdevfile
package with a newGetK8sManifestWithVariablesSubstituted
function that is responsible for returning the resource manifest from the Kubernetes/OpenShift Devfile component with all variables substituted, rather than havinglibdevfile.GetK8sComponentAsUnstructured
(and few other places in the codebase) fetch the raw manifest from the URI and handle it as is.Also, the implementation aims at leaving room for supporting
OpenShift
components in a near future (scope of #5704).Since this seems a much more realistic scenario of how outer-loop manifests are referenced in Devfiles, this PR also switches to[Will be covered in a separate PR]uri
references in all test Devfiles. This is the purpose of df1f19eNote that tests for
odo deploy
still test bothinlined
(as before) anduri
manifests (scope of this issue).