I have the following code in groovy:
void call(Closure closure) {
pod_template_maven_image = ...
pod_template_maven_m2 = ...
pod_template_nodejs_image = ...
pod_template_sonar_image = ...
toleration_condition = true
def yaml_config = ""
if(toleration_condition){
yaml_config = """
spec:
tolerations:
- key: "my_toleration"
operator: "Equal"
value: "value1"
effect: "NoSchedule"
"""
}
podTemplate(containers: ...,
volumes: ...,
etc...,
yaml: yaml_config,
yamlMergeStrategy: merge()) {
node(POD_LABEL) {
closure()
}
}
}
At the moment, when I run the job in jenking nothing happens, the pod is created whitout error. But the yaml is not added in pod.
We want to add the toleration (yaml_config) in podTemplate depending of toleration_condition value.
I'm new in this area and don't now if is possible. Its is? Whats the best way to do it?
Thanks.
The problem was solved by placing the complete manifest structure, which ended up being automatically merged.
It took less than a year to find out.