feat(helm): add standard Kubernetes labels to deployments and services#810
feat(helm): add standard Kubernetes labels to deployments and services#810keyuchen21 wants to merge 8 commits intovllm-project:mainfrom
Conversation
Summary of ChangesHello @keyuchen21, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the discoverability and integration of Kubernetes resources managed by the Helm chart for the VLLM production stack. By introducing and applying standard Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Add app.kubernetes.io/* labels to enable proper recognition by Kubernetes tools like Lens. Labels added to: - Engine deployments, services, and scaled objects - Router deployment and service Closes vllm-project#671 Signed-off-by: Keyu_Chen <54015474+km5ar@users.noreply.github.com>
ff46a5a to
7dca228
Compare
There was a problem hiding this comment.
Code Review
This pull request introduces standard Kubernetes labels to deployments and services, which is a great enhancement for better integration with Kubernetes tooling like Lens. The implementation is clean, using Helm helper templates to define and apply the labels consistently.
I've found one critical issue in the service selector for vLLM engines that would prevent traffic from reaching the pods. I've also provided a suggestion to improve the reusability of the chart by avoiding a hardcoded value in the new label definitions. Once the critical issue is addressed, this will be a valuable addition to the chart.
helm/templates/service-vllm.yaml
Outdated
| selector: | ||
| model: "{{ $modelSpec.name }}" | ||
| helm-release-name: "{{ $.Release.Name }}" | ||
| {{- include "chart.engineStandardLabels" (dict "releaseName" $.Release.Name "modelName" $modelSpec.name) | nindent 4 }} |
There was a problem hiding this comment.
The service selector is missing the labels from chart.engineLabels. The corresponding pods in deployment-vllm-multi.yaml include these labels (from servingEngineSpec.labels in values.yaml). Without them in the selector, this service will not select any pods, breaking traffic routing to the vLLM engines. The deployment-vllm-multi.yaml's own selector correctly includes these labels, and the service selector should match it.
{{- include "chart.engineLabels" $ | nindent 4 }}
{{- include "chart.engineStandardLabels" (dict "releaseName" $.Release.Name "modelName" $modelSpec.name) | nindent 4 }}
helm/templates/_helpers.tpl
Outdated
| app.kubernetes.io/name: {{ .modelName }} | ||
| app.kubernetes.io/instance: {{ .releaseName }} | ||
| app.kubernetes.io/component: serving-engine | ||
| app.kubernetes.io/part-of: vllm-production-stack |
There was a problem hiding this comment.
The app.kubernetes.io/part-of label is hardcoded to vllm-production-stack. For better reusability and to follow Helm best practices, it's recommended to derive this from the chart's metadata, for example, using {{ .Chart.Name }}. This would make the chart more self-contained and easier to use in different contexts.
To implement this, you would need to pass the chart name to this helper from all its call sites, e.g., (dict "chartName" .Chart.Name ...).
app.kubernetes.io/part-of: {{ .chartName }}
helm/templates/_helpers.tpl
Outdated
| app.kubernetes.io/name: router | ||
| app.kubernetes.io/instance: {{ .releaseName }} | ||
| app.kubernetes.io/component: router | ||
| app.kubernetes.io/part-of: vllm-production-stack |
There was a problem hiding this comment.
Similar to the engineStandardLabels, the app.kubernetes.io/part-of label is hardcoded here. It should be made dynamic, for instance by using {{ .Chart.Name }} for better chart reusability. This would require passing the chart name to this helper from all its call sites.
app.kubernetes.io/part-of: {{ .chartName }}
- Add missing chart.engineLabels to service-vllm.yaml selector (critical fix) - Make app.kubernetes.io/part-of dynamic using .Chart.Name instead of hardcoded value for better reusability Signed-off-by: Keyu_Chen <54015474+km5ar@users.noreply.github.com>
| namespace: {{ .Release.Namespace }} | ||
| labels: | ||
| {{- include "chart.routerLabels" . | nindent 4 }} | ||
| {{- include "chart.routerStandardLabels" (dict "releaseName" .Release.Name "chartName" .Chart.Name) | nindent 4 }} |
There was a problem hiding this comment.
Hi, Can you put the standard labels ahead of custom labels so that the custom labels can override the standard label if they have the same keys? same with other places defining standard labels
There was a problem hiding this comment.
Good point!!!!, just updated it.
…r labels Place standard Kubernetes labels ahead of custom labels so that custom labels can override standard labels when they share the same keys. Also add standard labels to cache server deployment and service for consistency. Signed-off-by: Keyu Chen <54015474+keyuchen21@users.noreply.github.com>
1e6fd5c to
fa0d980
Compare
Summary
app.kubernetes.io/*labels to enable proper recognition by Kubernetes tools like LensChanges
chart.engineStandardLabelsandchart.routerStandardLabelshelpers in_helpers.tpldeployment-vllm-multi.yamldeployment-router.yamlservice-vllm.yamlservice-router.yamlscaledobject-vllm.yamlTest plan
helm templaterenders all resources correctlyhelm lintpasses with no errorsmodel,helm-release-name)Closes #671