You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "gansheer (via GitHub)" <gi...@apache.org> on 2024/04/10 12:48:53 UTC

[PR] fix(install): No duplicate envvars on operator pod container [camel-k]

gansheer opened a new pull request, #5350:
URL: https://github.com/apache/camel-k/pull/5350

   Ref #5349 
   
   
   
   <!-- Description -->
   
   
   
   
   <!--
   Enter your extended release note in the below block. If the PR requires
   additional action from users switching to the new release, include the string
   "action required". If no release note is required, write "NONE". 
   
   You can (optionally) mark this PR with labels "kind/bug" or "kind/feature" to make sure
   the text is added to the right section of the release notes. 
   -->
   
   **Release Note**
   ```release-note
   fix(install): No duplicate envvars on operator pod container
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(install): No duplicate envvars on operator pod container [camel-k]

Posted by "gansheer (via GitHub)" <gi...@apache.org>.
gansheer commented on code in PR #5350:
URL: https://github.com/apache/camel-k/pull/5350#discussion_r1559593601


##########
pkg/install/operator.go:
##########
@@ -145,7 +145,9 @@ func OperatorOrCollect(ctx context.Context, cmd *cobra.Command, c client.Client,
 						fmt.Fprintln(cmd.ErrOrStderr(), "Warning: could not parse environment variables!")
 					}
 					for i := 0; i < len(d.Spec.Template.Spec.Containers); i++ {
-						d.Spec.Template.Spec.Containers[i].Env = append(d.Spec.Template.Spec.Containers[i].Env, envVars...)
+						for _, envVar := range envVars {
+							envvar.SetVar(&d.Spec.Template.Spec.Containers[i].Env, envVar)

Review Comment:
   Yes, that's its main point.
   https://github.com/apache/camel-k/blob/c5ca3d43b49de8f237a4d527ec106320e95a798a/pkg/util/envvar/envvar.go#L59-L73



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(install): No duplicate envvars on operator pod container [camel-k]

Posted by "squakez (via GitHub)" <gi...@apache.org>.
squakez merged PR #5350:
URL: https://github.com/apache/camel-k/pull/5350


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(install): No duplicate envvars on operator pod container [camel-k]

Posted by "squakez (via GitHub)" <gi...@apache.org>.
squakez commented on PR #5350:
URL: https://github.com/apache/camel-k/pull/5350#issuecomment-2049067625

   I think we need to backport this to `release-2.3.x` as well, thanks.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(install): No duplicate envvars on operator pod container [camel-k]

Posted by "squakez (via GitHub)" <gi...@apache.org>.
squakez commented on code in PR #5350:
URL: https://github.com/apache/camel-k/pull/5350#discussion_r1559456386


##########
pkg/install/operator.go:
##########
@@ -145,7 +145,9 @@ func OperatorOrCollect(ctx context.Context, cmd *cobra.Command, c client.Client,
 						fmt.Fprintln(cmd.ErrOrStderr(), "Warning: could not parse environment variables!")
 					}
 					for i := 0; i < len(d.Spec.Template.Spec.Containers); i++ {
-						d.Spec.Template.Spec.Containers[i].Env = append(d.Spec.Template.Spec.Containers[i].Env, envVars...)
+						for _, envVar := range envVars {
+							envvar.SetVar(&d.Spec.Template.Spec.Containers[i].Env, envVar)

Review Comment:
   Is this func taking care to check if the envvar already exist?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org