Skip to content
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

Jinja #273

Open
4 of 5 tasks
vadim-zabolotniy opened this issue Feb 7, 2023 · 1 comment
Open
4 of 5 tasks

Jinja #273

vadim-zabolotniy opened this issue Feb 7, 2023 · 1 comment
Assignees
Labels
API / Backend feature New feature or request

Comments

@vadim-zabolotniy
Copy link
Collaborator

vadim-zabolotniy commented Feb 7, 2023

Consider replacement of current template engine(Pystache/Chevron) by Jinja.
Requirements:

  • {{ }} - template variable markers.
  • Getting list item by numeric index(need for case with IP in service ingress).
  • Skipping of invalid variable placeholder error(need on 1st render when application Kubernetes entities wasn't created yet).
  • Error rising when variable placeholder is invalid(need on 2nd render when application successfully deployed and context is complete).
  • Optional Keep template variable place holder if it can't be found in context.
@vadim-zabolotniy vadim-zabolotniy self-assigned this Feb 7, 2023
@vadim-zabolotniy vadim-zabolotniy added feature New feature or request API / Backend labels Feb 7, 2023
@vadim-zabolotniy
Copy link
Collaborator Author

vadim-zabolotniy commented Feb 7, 2023

Found issues:

  • Jinja cant work with dashes in variables names. {{components.redis.manifest.Service.redis-master.status.loadBalancer.ingress.0.ip}} here redis-master causes error. As workaround we can specify such keys in quotes(' or ") Service["redis-master"]. This is because Jinja applies to variables same rules as Python to own variables.

Notes:

  • To rise error when template variable is absent pass jinja2.StrictUndefined policy to jinja2.Template initializer, e.g. template = jinja2.Template('template', undefined=jinja2.StrictUndefined)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API / Backend feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant