Skip to content

Conversation

@camilamacedo86
Copy link
Member

The Helm plugin now reads the kubectl.kubernetes.io/default-container
annotation to determine which container to template, instead of hardcoding
checks for "name: manager". This allows users to customize their container
names while still getting proper Helm templating for image references,
resources, environment variables, security contexts, and arguments.

Falls back to "manager" for backward compatibility with projects that
don't have the annotation.

Fixes #5449

…tainer

names by reading the kubectl.kubernetes.io/default-container annotation
instead of hardcoding "manager"

Generated-by: Cursor/Claude
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: camilamacedo86

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 8, 2026
@camilamacedo86
Copy link
Member Author

/override pull-kubebuilder-e2e-k8s-1-34-0

@k8s-ci-robot
Copy link
Contributor

@camilamacedo86: Overrode contexts on behalf of camilamacedo86: pull-kubebuilder-e2e-k8s-1-34-0

Details

In response to this:

/override pull-kubebuilder-e2e-k8s-1-34-0

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Copy link
Contributor

@AlirezaPourchali AlirezaPourchali left a comment

Choose a reason for hiding this comment

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

i think using the same image name controller:latest would be better!
and also another name for the container instead of my project name, maybe controller-test ?
both inside pkg/plugins/optional/helm/v2alpha/scaffolds/internal/kustomize/helm_templater_test.go

@camilamacedo86
Copy link
Member Author

Hi @AlirezaPourchali

The points raised are addressed now.
WDYT?

Copy link
Contributor

@AlirezaPourchali AlirezaPourchali left a comment

Choose a reason for hiding this comment

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

I noticed you mentioned pushing new changes but I don't see any commits beyond e5ea31cb4 from Feb 8.

While working on this feature myself (I originally opened issue #5449), I tested the current implementation and discovered two bugs that prevent it from working correctly:

Bug 1: Container names are being templated when they shouldn't be
The substituteResourceNamesWithPrefix function templates container names like {{ include "chart.resourceName" ... }}. Container names are internal pod identifiers (not cluster-wide resource names) and should remain literal. This happens because container names with dashes (e.g., osiris-manager, controller-test) match the same regex pattern intended for resource names like project-webhook-service.

Bug 2: Image templating fails with custom container names
Since substituteResourceNamesWithPrefix runs before templateImageReference, the container name gets templated first, breaking the image regex match. This means images don't get templated at all for custom container names.

I've tested fixes for both issues locally and they work well. Rather than ask you to debug and fix these iteratively, I've decided to submit a separate PR (#5463) with the complete working solution. This seemed cleaner than going back and forth on fixes.

I hope you understand - your work on adding getDefaultContainerName() was a great starting point! I just built on that foundation to make it production-ready.

Thanks for tackling this feature! 🙏

@camilamacedo86
Copy link
Member Author

Close in favor of: #5463

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. release-blocker size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

helm/v2-alpha: Helm plugin fails to template deployment fields when container name is not "manager"

3 participants