Closed odesenfans closed 3 years ago
Hi, thank you for your comment. I was considering implementing exacly this for a while since it seems to be required, but have not had the time. Since I have not, I would certanly accept a PR where we can collaborate on the basis of this idea.
I was thinking something along the lines of input arguments as,
And methods:
To be added @ line 94 something like,
body = body or self._read_body(
resolve_relative_path(body_filepath or DEFAULT_EXECUTION_OBJECT_PATHS[DEFAULT_EXECTION_OBJECT], 2)
)
assert body is not None and (isinstance(body, (dict, str))), ValueError(
"body must either be a yaml string or a dict"
)
if isinstance(body, str) and self.enable_jijna_in_string_body:
body = self.parse_body_jinja(body)
Requirements:
What do you think?
The best solution would be to use Go templates directly, but jinja2 should do the trick. I don't think there's a good implementation of Go templates in Python so far. I'll take a look tomorrow. :)
Hum, I would actially like to stick with Jinja since other operators are integrated with it. Added support see PR: https://github.com/LamaAni/KubernetesJobOperator/pull/27
Can this be closed?
Yes! Closing it then giving it a try right away.
Hello,
I am currently trying to use this operator for my use cases. Thanks for the work, I really like the possibility of using jobs rather than pods. I use Helm on a regular basis and I wanted to propose a feature that would make this operator work nicely with Helm/Go-templated specification files.
Feature description
Templated specification file Allows to specify fields as Go templated values, a la Helm. The following example is actually exactly how I specify my config/secret volumes in Helm at the moment:
The values themselves could be passed to the constructor of the operator. For example:
Advantages
Interoperability between Helm and Airflow: take your Helm job template file and move it to Airflow. No need for additional work/testing.
Alternatives I considered