-
Notifications
You must be signed in to change notification settings - Fork 14
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
v2 lib #629
Open
stavros-k
wants to merge
125
commits into
master
Choose a base branch
from
v2-lib
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+5,063
−0
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is how a compose file will look like for a single container {% set tpl = ix_lib.base.render.Render(values) %}
{% set c1 = tpl.add_container(values.consts.app_container_name, "image") %}
{% set perm_container = tpl.deps.perms("perm_container_name") %}
{% set perms_config = {"uid": 1000, "gid": 1000, "mode": "check"} %} # optional
{% set vol_config1 = { .. } %} # this will come from questions
{% set vol_config2 = { .. } %} # this will come from questions
{% do c1.volume_mounts.add_volume_mount("/some/mount/path", vol_config1) %}
{% do c1.volume_mounts.add_volume_mount("/some/mount/path2", vol_config2) %}
{% do perm_container.add_or_skip_action("action_id1", vol_config1, perms_config) %}
{% do perm_container.add_or_skip_action("action_id2", vol_config2, perms_config) %}
{% for store in values.storage.additional_storage %}
{% do c1.volumes.mount_volume(store.mount_path, store) %}
{% endfor %}
{% do c1.ports.add_port(values.network.web_port, values.network.web_port) %}
{% do c1.environment.add_user_envs(values.app.additional_envs) %}
{% do c1.environment.add_env("HOST", "0.0.0.0") %}
{% do c1.environment.add_env("PORT", values.network.web_port) %}
{% do c1.healthcheck.set_test("curl", {"port": values.network.web_port, "path": "/health"}) %}
{# if add_or_skip_action might had parsed config and found no reason to add an action #}
{% if perm_container.has_actions() %}
{% do perm_container.activate() %}
{% do c1.depends.add_dependency(tpl.permissions_container_name(), "service_copleted_successfully") %}
{% endif %}
{{ tpl.render() | tojson }} |
…ice and resource validation checks
I think this is fine for initial review, and potentially merge and start using it on new apps for now. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
V2 lib aims to
So far there are few things that have been added, but few bigs are missing.
Currently the imports are duplicated, once with a relative import and one without inside a try/except block.
That is because in jinja it wont work without the relative import, but pytest wont work with relative imports.
If there is a way to fix that, please let me know!