-
Notifications
You must be signed in to change notification settings - Fork 97
✨ external-resources: tagging support #5189
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
base: master
Are you sure you want to change the base?
✨ external-resources: tagging support #5189
Conversation
reconcile/gql_definitions/external_resources/external_resources_namespaces.py
Show resolved
Hide resolved
"app-code": self.namespace["app"].get("appCode", "unknown"), | ||
"cost-center": self.namespace["app"].get("costCenter", "999"), | ||
"service-phase": self.namespace["environment"].get("servicePhase", "prod"), |
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.
why these default values? there is one hard coded default value
qontract-reconcile/reconcile/utils/terrascript_aws_client.py
Lines 289 to 293 in c048032
DEFAULT_TAGS = { | |
"tags": { | |
"app": "app-sre-infra", | |
}, | |
} |
# normalize camelCase keys to kebab-case | ||
key_mapping = { | ||
"appCode": "app-code", | ||
"costCenter": "cost-center", | ||
"servicePhase": "service-phase", | ||
} | ||
normalized_tags = {} | ||
for key, value in resource_tags.items(): | ||
normalized_key = key_mapping.get(key, key) | ||
normalized_tags[normalized_key] = value |
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.
this logic maybe needed in default tags handling as well
@@ -144,13 +144,33 @@ def annotations(self) -> dict[str, str]: | |||
return {} | |||
|
|||
def tags(self, integration: str) -> dict[str, str]: | |||
return { | |||
tags = { |
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.
please update test cases in
def test_spec_tags() -> None: |
Add tagging support to all ERv2-managed external resources:
The compliance mandatory ones:
app-code
cost-center
service-phase
And allow custom tags directly on the external resources via the new
tag
attribute.Ticket: APPSRE-12423
Example dry-run output: