-
Notifications
You must be signed in to change notification settings - Fork 350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PodSpecable Integration #1861
PodSpecable Integration #1861
Conversation
I've created custom method for merging resources based on map[string]interface{}. I still need to add more tests and sort out the configmaps. If this will be accepted method could be moved to some |
d7f0fdf
to
792c943
Compare
977b42d
to
1a27a01
Compare
Now that we validated strategic merge patch is a good candidate, we should find the place where the pod template should be stored. It may be worth exploring #2096 as a possible solution, embedding a |
6344db7
to
3afff7a
Compare
I updated the PR also with adding PodTemplateSpec into integration spec (#2096). Pod trait is now enabled when template will be passed. That is possible with |
Thanks a lot. Here are a couple of points:
|
|
I've created a custom PodTemplateSpec based on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Simple and powerful 👍🏼.
I've left a couple of comments. Once cleared, the PR will be good to go 🥳!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes to deploy/olm-catalog/camel-k-dev/1.4.0/
must be removed.
|
||
func testPodTemplateSpec(t *testing.T, template string) corev1.PodTemplateSpec { | ||
trait, environment, _ := createPodTest(template) | ||
//trait.Template = template |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be removed.
17c97cc
to
255a76c
Compare
@nicolaferraro @lburgazzoli would you be kind enough for a quick review now this is ready? |
[source,yaml] | ||
---- | ||
containers: | ||
- name: integration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would this work when you have competing changes to the integration container ?
i.e.
- what would be the result of
kamel run --env TEST_VARIABLE=abc --pod-template template.yaml
? - what woudl happen if the user sets a custom entry point for the integration container ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- TEST_VARIABLE=abc will be overwritten by values from the template, due to changes from the template are actually applied by pod trait in later stages.
- I've tried to add there command from the example:
command: [ "/bin/sh" , "-c", "while true; do echo $(date -u) 'Content from the sidecar altered container' > /var/log/file.txt; sleep 1;done" ]
and nothing really happened. Command hasn't been overwritten due tojvm
trait is executed after thepod
trait.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I think the behavior is ok for the sake of this PR to get merged but I think we need to open some follow up issues and iterate a little bit over the expected behavior as:
- the pod-template is well, a template so I'd expect it not to be "immutable" so, in the cli example I provided above, I'd expect the
TEST_VARIABLE
to reflect what it is set by the--env
flag and not the value from the template. Of course in this case, you know what the template content is so you could workaround this but I'm thinking about a case where the template is configured at an higher level (i.e. IntegrationPlatform) and you don't know if you are overwriting, or if your changes have no effect because the template is overriding some of your config - the fact that a
TEST_VARIABLE
is taken from the template and thecommand
not, make things a little confusing so we should probably limit/document the relation between the template and theintegration
container
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, we need to decide what is the precedence. I see three layers:
- operator
- user provided pod template
- any other user provided options (that affects the integration pod)
The first decision to make is whether the operator is prescriptive or not, that is whether it's possible to override the operator defined spec by the template. Then whether the pod template overwrites other user defined options, or the other way around. For the later, I would be inclined to think it's better from an end-user standpoint to have the specific options have precedence over the more general pod template. For the former, that depends on the level of power we want to delegate to the users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So for now I will add notes into the doc about env variables and the command option. And if this will get merged we might create a follow-up issue to address env variables and other options that could be possibly overwritten by the template option.
reflect changes in the pod trait Add e2e tests to cover pod template with deployment and knative strategy
Thanks! |
This is still WIP. Currently the test is missing and it's only possible to specify the template from the file. Trait is applied only when
IntegrationPhaseRunning
state. I had to moveutil_content
andutil_sources
underutil/source
to being able to use those also in the trait package.Fixes #1657.
Fixes #2096.