Skip to content

Add deployment annotation for Backstage ingestion#43

Merged
agaetep merged 4 commits into
mainfrom
agaete/deployment-annotation
Apr 13, 2026
Merged

Add deployment annotation for Backstage ingestion#43
agaetep merged 4 commits into
mainfrom
agaete/deployment-annotation

Conversation

@agaetep
Copy link
Copy Markdown
Contributor

@agaetep agaetep commented Apr 13, 2026

Spotify Backstage can pull kubernetes data from components using deployment annotations. This service is missing the name annotation needed to discover it.

Signed-off-by: Antonia Gaete <agaete@linuxfoundation.org>
@agaetep agaetep requested a review from a team as a code owner April 13, 2026 16:38
Copilot AI review requested due to automatic review settings April 13, 2026 16:38
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 13, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ed119d81-c0d6-4866-b752-09d26a4dd223

📥 Commits

Reviewing files that changed from the base of the PR and between dfbf84a and bf89756.

📒 Files selected for processing (1)
  • charts/lfx-v2-query-service/templates/deployment.yaml

Disabled knowledge base sources:

  • Jira integration is disabled

You can enable these sources in your CodeRabbit configuration.


Walkthrough

The Deployment template for lfx-v2-query-service was updated to add the app.kubernetes.io/name: {{ .Chart.Name }} label to the Deployment's metadata.labels and the pod template's spec.template.metadata.labels, while leaving spec.selector.matchLabels unchanged (still only app: lfx-v2-query-service).

Changes

Cohort / File(s) Summary
Kubernetes Deployment template
charts/lfx-v2-query-service/templates/deployment.yaml
Added app.kubernetes.io/name: {{ .Chart.Name }} to metadata.labels and spec.template.metadata.labels. No change to spec.selector.matchLabels (remains app: lfx-v2-query-service).

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title mentions 'annotation' but the actual changes add Kubernetes labels, not annotations. Labels and annotations are distinct Kubernetes concepts. Revise the title to reflect the actual change, such as 'Add Kubernetes label for Backstage discovery' or 'Add app.kubernetes.io/name label to deployment'.
Description check ⚠️ Warning The description refers to 'deployment annotations' needed for Backstage, but the changes actually add labels to the deployment. This is inconsistent with the actual changeset. Update the description to clarify that the change adds Kubernetes labels (specifically app.kubernetes.io/name) rather than annotations.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agaete/deployment-annotation

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

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

Adds metadata intended to enable Spotify Backstage Kubernetes ingestion/discovery for lfx-v2-query-service.

Changes:

  • Adds metadata.labels.app.kubernetes.io/name to the Deployment resource in the Helm chart.

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

Comment on lines 6 to +10
metadata:
name: lfx-v2-query-service
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

PR title/description say Backstage requires a deployment annotation for discovery, but this change adds a standard app.kubernetes.io/name label on the Deployment metadata. If Backstage ingestion is expecting an annotation (or a specific Backstage key like backstage.io/...), this won’t satisfy the stated requirement—please add the correct annotation/key at metadata.annotations (and, if discovery uses labels/selectors, ensure it’s applied to the resources Backstage queries, e.g., Deployment/Service and/or pod template labels as appropriate).

Copilot uses AI. Check for mistakes.
Signed-off-by: Antonia Gaete <agaete@linuxfoundation.org>
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@charts/lfx-v2-query-service/templates/deployment.yaml`:
- Around line 9-10: Add the missing Backstage discovery label by updating the
Deployment metadata labels to include the key backstage.io/kubernetes-id; set
its value to a stable unique identifier for the release (for example derived
from the Helm chart/name or the chart helper used elsewhere such as the fullname
helper), alongside the existing app.kubernetes.io/name (refer to the labels
block and Chart.Name in the deployment template) so Backstage can ingest the
workload.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ac2b22d6-df6e-4142-be17-6d5bacb9f076

📥 Commits

Reviewing files that changed from the base of the PR and between 86b5b95 and dfbf84a.

📒 Files selected for processing (1)
  • charts/lfx-v2-query-service/templates/deployment.yaml

Comment on lines +9 to +10
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot Apr 13, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

For Backstage Kubernetes ingestion, which exact Kubernetes metadata key is required for workload discovery in this case, and must it be an annotation or a label on Deployment metadata?

💡 Result:

The exact Kubernetes metadata key required for workload discovery in Backstage Kubernetes ingestion is backstage.io/kubernetes-id. It must be a label on the Deployment metadata.

Citations:


Backstage requirement unmet: missing the backstage.io/kubernetes-id label.

The PR adds app.kubernetes.io/name for standard Kubernetes labeling, but Backstage Kubernetes ingestion requires a backstage.io/kubernetes-id label on Deployment metadata to discover workloads. Without this label, Backstage ingestion will fail.

Suggested adjustment
 metadata:
   name: lfx-v2-query-service
   namespace: {{ .Release.Namespace }}
   labels:
     app.kubernetes.io/name: {{ .Chart.Name }}
+    backstage.io/kubernetes-id: {{ .Chart.Name }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
backstage.io/kubernetes-id: {{ .Chart.Name }}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@charts/lfx-v2-query-service/templates/deployment.yaml` around lines 9 - 10,
Add the missing Backstage discovery label by updating the Deployment metadata
labels to include the key backstage.io/kubernetes-id; set its value to a stable
unique identifier for the release (for example derived from the Helm chart/name
or the chart helper used elsewhere such as the fullname helper), alongside the
existing app.kubernetes.io/name (refer to the labels block and Chart.Name in the
deployment template) so Backstage can ingest the workload.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This label is added on the backstage side, not on the deployment.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@agaetep, thank you for the clarification! You're right. There are two ways to surface Kubernetes components as part of a Backstage entity. The backstage.io/kubernetes-id annotation can be added to the entity's catalog-info.yaml rather than to the Kubernetes Deployment itself — meaning Backstage-side configuration can handle that mapping without modifying the deployment manifest. My earlier suggestion was incorrect for your setup. The app.kubernetes.io/name label this PR adds is the right approach for your architecture.

(´• ω •`) ʕ•ᴥ•ʔ


✏️ Learnings added
Learnt from: agaetep
Repo: linuxfoundation/lfx-v2-query-service PR: 43
File: charts/lfx-v2-query-service/templates/deployment.yaml:9-10
Timestamp: 2026-04-13T18:55:45.267Z
Learning: For the `lfx-v2-query-service` repository, Backstage Kubernetes ingestion is configured on the Backstage catalog entity side (via `backstage.io/kubernetes-id` annotation in `catalog-info.yaml`), not by adding `backstage.io/kubernetes-id` labels to the Kubernetes Deployment manifest. The Deployment only needs the standard `app.kubernetes.io/name` label for Backstage discovery via label selector.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

Signed-off-by: Antonia Gaete <agaete@linuxfoundation.org>
@agaetep agaetep merged commit 0c7ea50 into main Apr 13, 2026
7 of 9 checks passed
@agaetep agaetep deleted the agaete/deployment-annotation branch April 13, 2026 19:31
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