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

[docker_img_ctl.j2] make tmpfs mounts optional and add ability to run container by image id #6439

Merged

Conversation

stepanblyschak
Copy link
Collaborator

@stepanblyschak stepanblyschak commented Jan 13, 2021

Signed-off-by: Stepan Blyschak stepanb@nvidia.com

- Why I did it
I made the docker_img_ctl.j2 applicable for more dockers (including application extensions dockers) by adding an option not to mount tmpfs on /tmp/ and /var/tmp/. In some applications /tmp/ is a different docker volume which can't be tmpfs.
Also, I added and ability to pass REPO[:TAG]|[@digest]/IMAGE_ID instead of just REPO name.

- How I did it
Modified docker_img_ctl.j2 and docker makefiles.

- How to verify it
Run it on the switch.

- Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
@lguohan
Copy link
Collaborator

lguohan commented Jan 13, 2021

what is sae dockers?

@stepanblyschak
Copy link
Collaborator Author

@lguohan SAE - SONiC Application Extension

@stepanblyschak
Copy link
Collaborator Author

@lguohan lguohan added the appext Application Extension label Jan 22, 2021
Copy link
Contributor

@rajendra-dendukuri rajendra-dendukuri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend we find a method do the following:

  • All dockers mount /tmp if a certain variable is not defined or not set to a certain value
  • Dockers which don't want /tmp to be mounted, will define the variable
  • The variable is passed to the j2 environment while rendering the docker_image_ctl.j2

This will allow us to minimize the places where /tmp mount logic needs to be specified.

@stepanblyschak
Copy link
Collaborator Author

retest this please

provided

Signed-off-by: Stepan Blyshchak <stepanb@nvidia.com>
{%- if docker_image_name is defined %}
{{docker_image_name}}:latest \
{%- else %}
{{docker_image_id}} \
Copy link
Collaborator

@qiluo-msft qiluo-msft Jan 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why add docker_image_id? I don't find any clue in your PR description. #Closed

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated title and PR description.
With coming app ext feature docker image might not have a 'latest' tag or it might not have a name at all.
So this template is required to accept more general docker_image_id, but preserving compatibility if docker_image_name was passed.

Copy link
Collaborator

@qiluo-msft qiluo-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As comments

@@ -388,13 +390,23 @@ start() {
$REDIS_MNT \
-v /usr/share/sonic/device/$PLATFORM:/usr/share/sonic/platform:ro \
{%- if sonic_asic_platform != "mellanox" %}
{%- if mount_default_tmpfs is defined and mount_default_tmpfs == "y" %}
Copy link
Collaborator

@qiluo-msft qiluo-msft Jan 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and condition is verbose. Is it possible to simplify? #Closed

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, please check the new way:

{%- if mount_default_tmpfs|default("n") == "y" %}

@stepanblyschak stepanblyschak changed the title [docker_img_ctl.j2] remove tmpfs mounts; make it per docker [docker_img_ctl.j2] make tmpfs mounts optional and add ability to run container by image id Jan 30, 2021
Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
@liat-grozovik
Copy link
Collaborator

@rajendra-dendukuri comments were handled. Can you please review and approve?

@lguohan
Copy link
Collaborator

lguohan commented Feb 25, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@liat-grozovik
Copy link
Collaborator

@rajendra-dendukuri your approval is needed. Please provide your feedback.

@liat-grozovik liat-grozovik merged commit 1f7d9e2 into sonic-net:master Mar 16, 2021
raphaelt-nvidia pushed a commit to raphaelt-nvidia/sonic-buildimage that referenced this pull request May 23, 2021
… container by image id (sonic-net#6439)

- Why I did it
I made the docker_img_ctl.j2 applicable for more dockers (including application extensions dockers) by adding an option not to mount tmpfs on /tmp/ and /var/tmp/. In some applications /tmp/ is a different docker volume which can't be tmpfs.
Also, I added and ability to pass REPO[:TAG]|[@digest]/IMAGE_ID instead of just REPO name.

- How I did it
Modified docker_img_ctl.j2 and docker makefiles.

- How to verify it
Run it on the switch.
carl-nokia pushed a commit to carl-nokia/sonic-buildimage that referenced this pull request Aug 7, 2021
… container by image id (sonic-net#6439)

- Why I did it
I made the docker_img_ctl.j2 applicable for more dockers (including application extensions dockers) by adding an option not to mount tmpfs on /tmp/ and /var/tmp/. In some applications /tmp/ is a different docker volume which can't be tmpfs.
Also, I added and ability to pass REPO[:TAG]|[@digest]/IMAGE_ID instead of just REPO name.

- How I did it
Modified docker_img_ctl.j2 and docker makefiles.

- How to verify it
Run it on the switch.
@stepanblyschak stepanblyschak deleted the remove_tmpfs_mnt_from_template branch September 23, 2022 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
appext Application Extension
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants