Skip to content

Add commonMetadata and podMetadata to Agent/ToolServer specs with reconciliation#79

Merged
g3force merged 2 commits intomainfrom
copilot/add-metadata-to-deployments
Mar 3, 2026
Merged

Add commonMetadata and podMetadata to Agent/ToolServer specs with reconciliation#79
g3force merged 2 commits intomainfrom
copilot/add-metadata-to-deployments

Conversation

Copy link
Contributor

Copilot AI commented Mar 3, 2026

Users have no way to attach custom labels or annotations to the Deployments, Services, or Pods managed by the operator — blocking common cluster patterns like team ownership labels, monitoring annotations, or Istio injection hints.

Changes

New API: EmbeddedMetadata struct

Added api/v1alpha1/common_types.go with a shared EmbeddedMetadata type:

type EmbeddedMetadata struct {
    Labels      map[string]string `json:"labels,omitempty"`
    Annotations map[string]string `json:"annotations,omitempty"`
}

CRD fields added

  • AgentSpec and ToolServerSpec: commonMetadata + podMetadata with full reconciliation
  • AgentGatewaySpec, AiGatewaySpec, ToolGatewaySpec: fields added, reconciliation not implemented

Propagation semantics

Field Deployment Service Pod template
commonMetadata.labels
commonMetadata.annotations
podMetadata.labels
podMetadata.annotations
  • podMetadata overrides commonMetadata on the pod template when keys conflict
  • Operator-managed labels (e.g. app, framework) and selector labels always take precedence

Example usage

spec:
  commonMetadata:
    labels:
      team: platform
    annotations:
      prometheus.io/scrape: "true"
  podMetadata:
    annotations:
      sidecar.istio.io/inject: "true"

Implementation

  • Added applyCommonMetadataToObjectMeta() and buildPodTemplateMetadata() helpers to util.go to avoid duplication between the two reconcilers
  • CRDs regenerated via make manifests && make generate
Original prompt

This section details on the original issue you should resolve

<issue_title>Add metadata to Agents / ToolServers and apply to the deployments</issue_title>
<issue_description>When deploying agents and tools in a cluster, I would like to add some annotations and labels to the deployments or pods.

Proposal: Add commonMetadata and podMetadata to the spec of Agent, ToolServer, AiGateway, AgentGateway and ToolGateway.

Implement the reconciliation for agents and toolServers.</issue_description>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

- Add EmbeddedMetadata struct (labels + annotations) to api/v1alpha1/common_types.go
- Add commonMetadata and podMetadata fields to AgentSpec and ToolServerSpec
- Add commonMetadata and podMetadata fields to AgentGatewaySpec, AiGatewaySpec, ToolGatewaySpec (fields only)
- Regenerate CRDs and deep copy via make manifests && make generate
- Add helper functions applyCommonMetadataToObjectMeta and buildPodTemplateMetadata to util.go
- Update Agent reconciler to apply metadata to Deployment, Service, and pod template
- Update ToolServer reconciler to apply metadata to Deployment, Service, and pod template
- Add integration tests for all metadata scenarios (162 tests all passing)

Co-authored-by: g3force <779094+g3force@users.noreply.github.com>
Copilot AI changed the title [WIP] Add metadata to Agents and ToolServers for deployments Add commonMetadata and podMetadata to Agent/ToolServer specs with reconciliation Mar 3, 2026
@g3force g3force marked this pull request as ready for review March 3, 2026 18:05
@g3force g3force merged commit 6ea021c into main Mar 3, 2026
6 checks passed
@g3force g3force deleted the copilot/add-metadata-to-deployments branch March 3, 2026 19:22
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.

Add metadata to Agents / ToolServers and apply to the deployments

2 participants