Skip to content

Add custom tags to deployment records through annotations#41

Merged
piceri merged 5 commits intomainfrom
custom-tags
Feb 19, 2026
Merged

Add custom tags to deployment records through annotations#41
piceri merged 5 commits intomainfrom
custom-tags

Conversation

@piceri
Copy link
Contributor

@piceri piceri commented Feb 18, 2026

This PR implements the following:

  • changes runtime-risk annotation to metadata.github.com/runtime-risks
  • Allows custom tags to be added to a deployment records through annotations metadata.github.com/<tag key>
    • Limit of 5 tags per deployment record
    • Limit of 100 characters per key or value
    • Duplicate tags in the ownership chain default to lowest object (ex: pod annotations take president over deployment annotations)

Copilot AI review requested due to automatic review settings February 18, 2026 18:46
@piceri piceri requested a review from a team as a code owner February 18, 2026 18:46
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for custom tags in deployment records through Kubernetes annotations and updates the runtime-risk annotation key to use a new namespace. The changes enable users to attach up to 5 custom key-value tags to deployment records by using annotations with the metadata.github.com/ prefix, with a maximum of 100 characters per key or value. When duplicate tag keys exist in the ownership hierarchy (pod → ReplicaSet → Deployment), values from objects lower in the hierarchy take precedence.

Changes:

  • Updated runtime-risk annotation key from github.com/runtime-risks to metadata.github.com/runtime-risks
  • Added support for custom tags via metadata.github.com/<key> annotations with validation and limits
  • Enhanced metadata aggregation to collect and prioritize tags from pod ownership hierarchy

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
pkg/deploymentrecord/record.go Added Tags field to DeploymentRecord struct and updated NewDeploymentRecord signature to accept tags parameter
pkg/deploymentrecord/client.go Updated error handling to explicitly ignore resp.Body.Close() error for linter compliance
internal/controller/controller.go Added constants for custom tag limits, updated AggregatePodMetadata to include tags, modified extractMetadataFromObject to extract and validate tags with precedence handling, and updated recordContainer to process tags
README.md Updated documentation to reflect new annotation namespace and added comprehensive custom tags documentation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@ajbeattie ajbeattie left a comment

Choose a reason for hiding this comment

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

LGTM. Definitely think a followup with tests for the tag and general metadata logic should be next!

@piceri piceri merged commit 86eb953 into main Feb 19, 2026
6 checks passed
@piceri piceri deleted the custom-tags branch February 19, 2026 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants