This is an automated email from the ASF dual-hosted git repository.

squakez pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git


The following commit(s) were added to refs/heads/main by this push:
     new 7725765b5 Fix #6724: Allow setting enableServiceLinks on the 
Integration pod template
7725765b5 is described below

commit 7725765b5e294ba920ee9baf6c61a84d33acccd3
Author: Luis Sergio Carneiro <[email protected]>
AuthorDate: Thu Jul 23 10:32:54 2026 -0300

    Fix #6724: Allow setting enableServiceLinks on the Integration 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) <[email protected]>
---
 helm/camel-k/crds/camel-k-crds.yaml                          | 12 ++++++++++++
 pkg/apis/camel/v1/integration_types.go                       |  2 ++
 pkg/apis/camel/v1/zz_generated.deepcopy.go                   |  5 +++++
 pkg/client/camel/applyconfiguration/camel/v1/podspec.go      | 10 ++++++++++
 .../config/crd/bases/camel.apache.org_integrations.yaml      |  6 ++++++
 pkg/resources/config/crd/bases/camel.apache.org_pipes.yaml   |  6 ++++++
 pkg/trait/pod_test.go                                        |  8 ++++++++
 7 files changed, 49 insertions(+)

diff --git a/helm/camel-k/crds/camel-k-crds.yaml 
b/helm/camel-k/crds/camel-k-crds.yaml
index dbce9b962..6042d351b 100644
--- a/helm/camel-k/crds/camel-k-crds.yaml
+++ b/helm/camel-k/crds/camel-k-crds.yaml
@@ -15117,6 +15117,12 @@ spec:
                       dnsPolicy:
                         description: DNSPolicy
                         type: string
+                      enableServiceLinks:
+                        description: EnableServiceLinks indicates whether 
information
+                          about services should be injected into the Pod's 
environment
+                          variables, matching the syntax of Docker links. 
Defaults
+                          to true.
+                        type: boolean
                       ephemeralContainers:
                         description: EphemeralContainers
                         items:
@@ -28093,6 +28099,12 @@ spec:
                           dnsPolicy:
                             description: DNSPolicy
                             type: string
+                          enableServiceLinks:
+                            description: EnableServiceLinks indicates whether 
information
+                              about services should be injected into the Pod's 
environment
+                              variables, matching the syntax of Docker links. 
Defaults
+                              to true.
+                            type: boolean
                           ephemeralContainers:
                             description: EphemeralContainers
                             items:
diff --git a/pkg/apis/camel/v1/integration_types.go 
b/pkg/apis/camel/v1/integration_types.go
index a74e53955..b96e340cf 100644
--- a/pkg/apis/camel/v1/integration_types.go
+++ b/pkg/apis/camel/v1/integration_types.go
@@ -327,6 +327,8 @@ type PodSpecTemplate struct {
 type PodSpec struct {
        // AutomountServiceAccountToken
        AutomountServiceAccountToken *bool 
`json:"automountServiceAccountToken,omitempty" 
protobuf:"varint,21,opt,name=automountServiceAccountToken"`
+       // EnableServiceLinks indicates whether information about services 
should be injected into the Pod's environment variables, matching the syntax of 
Docker links. Defaults to true.
+       EnableServiceLinks *bool `json:"enableServiceLinks,omitempty" 
protobuf:"varint,30,opt,name=enableServiceLinks"`
        // Volumes
        Volumes []corev1.Volume `json:"volumes,omitempty" patchMergeKey:"name" 
patchStrategy:"merge,retainKeys" protobuf:"bytes,1,rep,name=volumes"`
        // InitContainers
diff --git a/pkg/apis/camel/v1/zz_generated.deepcopy.go 
b/pkg/apis/camel/v1/zz_generated.deepcopy.go
index f267d2733..778431077 100644
--- a/pkg/apis/camel/v1/zz_generated.deepcopy.go
+++ b/pkg/apis/camel/v1/zz_generated.deepcopy.go
@@ -2749,6 +2749,11 @@ func (in *PodSpec) DeepCopyInto(out *PodSpec) {
                *out = new(bool)
                **out = **in
        }
+       if in.EnableServiceLinks != nil {
+               in, out := &in.EnableServiceLinks, &out.EnableServiceLinks
+               *out = new(bool)
+               **out = **in
+       }
        if in.Volumes != nil {
                in, out := &in.Volumes, &out.Volumes
                *out = make([]corev1.Volume, len(*in))
diff --git a/pkg/client/camel/applyconfiguration/camel/v1/podspec.go 
b/pkg/client/camel/applyconfiguration/camel/v1/podspec.go
index 7e14ad6cf..29f8de035 100644
--- a/pkg/client/camel/applyconfiguration/camel/v1/podspec.go
+++ b/pkg/client/camel/applyconfiguration/camel/v1/podspec.go
@@ -32,6 +32,8 @@ import (
 type PodSpecApplyConfiguration struct {
        // AutomountServiceAccountToken
        AutomountServiceAccountToken *bool 
`json:"automountServiceAccountToken,omitempty"`
+       // EnableServiceLinks indicates whether information about services 
should be injected into the Pod's environment variables, matching the syntax of 
Docker links. Defaults to true.
+       EnableServiceLinks *bool `json:"enableServiceLinks,omitempty"`
        // Volumes
        Volumes []corev1.Volume `json:"volumes,omitempty"`
        // InitContainers
@@ -70,6 +72,14 @@ func (b *PodSpecApplyConfiguration) 
WithAutomountServiceAccountToken(value bool)
        return b
 }
 
+// WithEnableServiceLinks sets the EnableServiceLinks field in the declarative 
configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" 
function invocations.
+// If called multiple times, the EnableServiceLinks field is set to the value 
of the last call.
+func (b *PodSpecApplyConfiguration) WithEnableServiceLinks(value bool) 
*PodSpecApplyConfiguration {
+       b.EnableServiceLinks = &value
+       return b
+}
+
 // WithVolumes adds the given value to the Volumes field in the declarative 
configuration
 // and returns the receiver, so that objects can be build by chaining "With" 
function invocations.
 // If called multiple times, values provided by each call will be appended to 
the Volumes field.
diff --git a/pkg/resources/config/crd/bases/camel.apache.org_integrations.yaml 
b/pkg/resources/config/crd/bases/camel.apache.org_integrations.yaml
index 33d83dd88..a4408a412 100644
--- a/pkg/resources/config/crd/bases/camel.apache.org_integrations.yaml
+++ b/pkg/resources/config/crd/bases/camel.apache.org_integrations.yaml
@@ -1836,6 +1836,12 @@ spec:
                       dnsPolicy:
                         description: DNSPolicy
                         type: string
+                      enableServiceLinks:
+                        description: EnableServiceLinks indicates whether 
information
+                          about services should be injected into the Pod's 
environment
+                          variables, matching the syntax of Docker links. 
Defaults
+                          to true.
+                        type: boolean
                       ephemeralContainers:
                         description: EphemeralContainers
                         items:
diff --git a/pkg/resources/config/crd/bases/camel.apache.org_pipes.yaml 
b/pkg/resources/config/crd/bases/camel.apache.org_pipes.yaml
index 0c41f59ac..b1a629e6d 100644
--- a/pkg/resources/config/crd/bases/camel.apache.org_pipes.yaml
+++ b/pkg/resources/config/crd/bases/camel.apache.org_pipes.yaml
@@ -1843,6 +1843,12 @@ spec:
                           dnsPolicy:
                             description: DNSPolicy
                             type: string
+                          enableServiceLinks:
+                            description: EnableServiceLinks indicates whether 
information
+                              about services should be injected into the Pod's 
environment
+                              variables, matching the syntax of Docker links. 
Defaults
+                              to true.
+                            type: boolean
                           ephemeralContainers:
                             description: EphemeralContainers
                             items:
diff --git a/pkg/trait/pod_test.go b/pkg/trait/pod_test.go
index 68fc25cd5..c48e6d07c 100755
--- a/pkg/trait/pod_test.go
+++ b/pkg/trait/pod_test.go
@@ -112,6 +112,14 @@ func TestAutomountServiceAccountToken(t *testing.T) {
        assert.False(t, *templateSpec.Spec.AutomountServiceAccountToken)
 }
 
+func TestEnableServiceLinks(t *testing.T) {
+       templateString := `enableServiceLinks: false`
+       templateSpec := testPodTemplateSpec(t, templateString)
+
+       assert.NotNil(t, templateSpec.Spec.EnableServiceLinks)
+       assert.False(t, *templateSpec.Spec.EnableServiceLinks)
+}
+
 // nolint: unparam
 func createPodTest(podSpecTemplate string) (*podTrait, *Environment, 
*appsv1.Deployment) {
        trait, _ := newPodTrait().(*podTrait)

Reply via email to