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
feat(kubernetes): added deployment name to pod resource id #4040
Conversation
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.
nice work, but it would be better to add the actual resource ID for the parent reference 🙂
@@ -147,6 +147,9 @@ def _extract_nested_resources_recursive(conf: Dict[str, Any], all_resources: Lis | |||
if not template or not isinstance(template, dict): | |||
all_resources.append(conf) | |||
return | |||
if conf.get('kind') == 'Deployment': | |||
# means this is a Pod resource nested in a Deployment resource | |||
template[PARENT_RESOURCE_KEY_NAME] = conf.get('metadata', {}).get('name', "") |
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.
the idea was to add the resource ID of the parent, then it is easier to query it later.
template[PARENT_RESOURCE_ID_KEY_NAME] = ...
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.
🎄
@@ -147,6 +147,10 @@ def _extract_nested_resources_recursive(conf: Dict[str, Any], all_resources: Lis | |||
if not template or not isinstance(template, dict): | |||
all_resources.append(conf) | |||
return | |||
if conf.get('kind') == 'Deployment': | |||
# means this is a Pod resource nested in a Deployment resource | |||
template[PARENT_RESOURCE_ID_KEY_NAME] = get_resource_id(conf) |
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.
🥇
…wio#4040) * changed pod resource id * use const for parent key name * improve ut * fixed ut * removed empty dict * added parent resource_id
…wio#4040) * changed pod resource id * use const for parent key name * improve ut * fixed ut * removed empty dict * added parent resource_id
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Description
concatenate the Deployment resource's name to the nested Pod's resource id and adding it to the Pod's config in
_parent_resource
Checklist: