Fix #6724: Allow setting enableServiceLinks on the Integration pod template#6725
Open
lsergio wants to merge 1 commit into
Open
Fix #6724: Allow setting enableServiceLinks on the Integration pod template#6725lsergio wants to merge 1 commit into
lsergio wants to merge 1 commit into
Conversation
…pod template Add an EnableServiceLinks *bool field to the curated v1.PodSpec used by spec.template.spec, so users can control the Kubernetes pod-level enableServiceLinks flag (defaults to true) on an Integration. The pod trait applies spec.template.spec as a strategic merge patch onto the workload pod spec, so the new field propagates to Deployment, CronJob and Knative Service pods with no further trait changes. Regenerated the CRDs (integrations, pipes), the Helm CRD bundle, deepcopy and the apply-configuration client. Added a unit test covering enableServiceLinks: false. Note: PodSpecTemplate / v1.PodSpec and the pod trait are deprecated, but this is currently the only mechanism able to set a pod-level flag such as enableServiceLinks (no non-deprecated trait covers it). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Fixes #6724
Users need to control the Kubernetes pod-level
enableServiceLinksflag on anIntegration. When many Services exist in a namespace, Kubernetes injects a
{SVC}_SERVICE_HOST/{SVC}_SERVICE_PORTenv var per Service into everycontainer (the Docker-links compatibility feature). This bloats the environment
and can slow pod startup, so operators commonly want to set
enableServiceLinks: false. There was previously no way to express this on anIntegration.
What this does
Adds an
EnableServiceLinks *boolfield to the curatedv1.PodSpecused byspec.template.spec, mirroring the upstream KubernetesPodSpecfield(json
enableServiceLinks, defaults totrue).The
podtrait marshalsspec.template.specand applies it as astrategic merge patch onto the workload pod spec, so the new field
propagates to Deployment, CronJob and Knative Service pods with no additional
trait logic.
Generated artifacts
Regenerated and committed:
camel.apache.org_integrations.yaml,camel.apache.org_pipes.yamlhelm/camel-k/crds/camel-k-crds.yamlzz_generated.deepcopy.gopodspec.goNote on deprecation
PodSpecTemplate/v1.PodSpecand thepodtrait are markedDeprecated: to be removed in future versions("use container, init-containersor owner traits instead"). I placed the field here because
enableServiceLinksis a pod-level toggle that no current non-deprecated trait can set — the
pod template is genuinely the only mechanism available today. Happy to move it
to a different home (e.g. a dedicated trait) if the maintainers prefer that over
extending the deprecated surface.
Testing
TestEnableServiceLinksinpkg/trait/pod_test.goverifiesenableServiceLinks: falsepropagates to the deployment pod spec.go build,go vet,gofmt, andgolangci-lint(v2.12.2) pass on theaffected packages; full
pkg/traitsuite is green.Suggested reviewers
of the Pod-trait deprecation; best placed to weigh in on the deprecation note.
This change was prepared by Claude Code on behalf of Luis Sergio Carneiro (@lsergio).