-
Bug
-
Resolution: Unresolved
-
Major
-
None
Consulting the kubernetes plugin readme you'll find the following statements
...
Note that it was previously possible to define containerTemplate but that has been deprecated in favor of the yaml format.
...
and
...
Unlike scripted k8s template, declarative templates do not inherit from parent template. Since the agents declared at stage level can override a global agent, implicit inheritance was leading to confusion.
You need to explicitly declare the inheritance if necessary using the field inheritFrom.
In the following example, nested-pod will only contain the maven container.
...
In the following there's an example about where there's no inheritance happening. But there's no single example about how to use inheritFrom with declarative Pipeline.
Tried to define a name for the outer POD to inherit from using several different things, but seems like I did not find the right place to do so.
Please improve the documentation making it more clear about how to use this feature (if it is supposed to work).
I'm struggling with the same lack of clarity about inheritance in the documentation.
Trying to inherit container/pod configuration from default global template (kubernetes clouds config) in a declarative pipeline I got following results:
Using yaml with unexpected results:
Using deprecated containerTemplate works:
But for both variants, the volume mounts defined globally in default pod template are inherited.
The documentation says:
Note that it was previously possible to define containerTemplate but that has been deprecated in favor of the yaml format.
I'm really confused, containerTemplate is the only config that works as expected but is deprecated since more than 2 years. For sure it is a pain merging all the templates/yamls, but it is also pain trying to find out what works and will work in the future.
So has anybody an idea how to setup a declarative pipeline with inherited container config which will work in the future (not deprecated)?