generated from ansible-collections/collection_template
-
Notifications
You must be signed in to change notification settings - Fork 135
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
Use resource prefix when apiVersion is v1 #371
Merged
softwarefactory-project-zuul
merged 2 commits into
ansible-collections:main
from
Akasurde:fix-resource-request
Feb 10, 2022
Merged
Use resource prefix when apiVersion is v1 #371
softwarefactory-project-zuul
merged 2 commits into
ansible-collections:main
from
Akasurde:fix-resource-request
Feb 10, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When getting a resource from the core api group, the prefix was not passed, leading the lookup to happen in all api groups. This broad search is not really necessary and leads to problems in some corner cases, for example, when an api is deleted after the api group list is cached. This fix uses the 'api' prefix when the apiVersion is 'v1', as this is almost certainly what the user wants. As a fallback, to retain backwards compatibility, the old behavior is used if the first lookup failed to find a resource. Given that the module defaults to 'v1' for the apiVersion, there are likely many cases where a resource, such as StatefulSet, is used while failing to provide an apiVersion. While technically incorrect, this has worked in most cases, so we probably shouldn't break this behavior.
Akasurde
changed the title
Add changelog fragment
Use resource prefix when apiVersion is v1
Feb 8, 2022
recheck |
regate |
regate |
@gravesm Thanks for the contribution. |
gravesm
added a commit
to gravesm/kubernetes.core
that referenced
this pull request
Jun 8, 2022
This ports 791175d to the refactored code.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SUMMARY
When getting a resource from the core api group, the prefix was not
passed, leading the lookup to happen in all api groups. This broad
search is not really necessary and leads to problems in some corner
cases, for example, when an api is deleted after the api group list is
cached.
This fix uses the 'api' prefix when the apiVersion is 'v1', as this is
almost certainly what the user wants. As a fallback, to retain backwards
compatibility, the old behavior is used if the first lookup failed to
find a resource. Given that the module defaults to 'v1' for the
apiVersion, there are likely many cases where a resource, such as
StatefulSet, is used while failing to provide an apiVersion. While
technically incorrect, this has worked in most cases, so we probably
shouldn't break this behavior.
Fixes #351
ISSUE TYPE
COMPONENT NAME
changelogs/fragments/364-use-resource-prefix.yaml
plugins/module_utils/common.py