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

add manage offline files script #8956

Merged
merged 1 commit into from
Jun 21, 2022
Merged

add manage offline files script #8956

merged 1 commit into from
Jun 21, 2022

Conversation

ErikJiang
Copy link
Member

@ErikJiang ErikJiang commented Jun 13, 2022

Signed-off-by: bo.jiang bo.jiang@daocloud.io

What type of PR is this?

/kind feature

What this PR does / why we need it:

this script will download all offline files according to temp/files.list and run the nginx container for offline file download.

this is helpful for offline deployment.

Which issue(s) this PR fixes:

Fixes #8954

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Add manage-offline-files.sh to collect necessary files and provides http file download service for offline deployment.

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 13, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @ErikJiang. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 13, 2022
Copy link
Contributor

@cristicalin cristicalin left a comment

Choose a reason for hiding this comment

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

/ok-to-test

contrib/offline/manage-offline-files.sh Show resolved Hide resolved
contrib/offline/manage-offline-files.sh Outdated Show resolved Hide resolved
contrib/offline/manage-offline-files.sh Outdated Show resolved Hide resolved
contrib/offline/nginx.conf Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 13, 2022
Copy link
Contributor

@oomichi oomichi left a comment

Choose a reason for hiding this comment

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

Nice effort, just one comment.

/cc @oomichi

# step 4 : run nginx container server
sudo docker container inspect nginx >/dev/null 2>&1
if [ $? -ne 0 ]; then
sudo docker run \
Copy link
Contributor

Choose a reason for hiding this comment

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

On Kubernetes ecosystem, we are switching from docker to nerdctl to drop docker support.
This can be out of scope from this pull request because the existing scripts are still using docker command.
just wanted to confirm what should be our direction.

Copy link
Member Author

Choose a reason for hiding this comment

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

@oomichi Ok, I see, I can create a separate PR later if we need to switch, since (AFAIK) manage-offline-container-images.sh also uses docker and I can modify it together. 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally we should not depend on a container manager for image manipulation so while containerd is moving toward nerdctl I would personally advise looking into skopeo for image management and for kubespray as a project to adopt skopeo for our container manapulation logic instead of the per-container-manager approach we have today.

Copy link
Member Author

@ErikJiang ErikJiang Jun 14, 2022

Choose a reason for hiding this comment

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

👍That makes sense, skopeo looks like a good option, I'm interested in it and plan to look into it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice information about skopeo.
I checked it a little bit, that seems only for managing container images.
We cannot replace docker run/nerdctl run here with skopeo, right?

Copy link
Member

Choose a reason for hiding this comment

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

we can use code like "https://github.com/automotiveMastermind/numonic/blob/main/hack/build.sh#L91" to support podman , nerdctl and even docker together.

Copy link
Member Author

Choose a reason for hiding this comment

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

@yankay 🤝 this is a great way, I have updated the code.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@cristicalin cristicalin Jun 17, 2022

Choose a reason for hiding this comment

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

Wow this became a long thread. The reason we have the docker run and nerdctl run command in there to fetch files is because we don't have an elegant way to get files out of container images so what we do is $command run <image> -v /tmp:/tmp cp <whatever> /tmp/<whatever> and get the file from the container, it is rather inelegant. My understanding was that nerdctl recently (0.19.0 I think) got the capability to copy files directly from images without the need to run them, maybe skopeo has the same since it is an image manipulation tool.

Overall our current download, cache and offline logic could use a full overhaul with a clean multi-step separation and runtime agnostic code. By this I mean always check the cache for needed items, if items are not in the cache fetch them in a runtime agnostic way and provide a way to populate the cache so that no external connection is needed if the cache is already complete.

Copy link
Member Author

Choose a reason for hiding this comment

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

@oomichi 😄 are there any additional suggestions?

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 18, 2022
Signed-off-by: bo.jiang <bo.jiang@daocloud.io>
@cristicalin
Copy link
Contributor

Looks ok to me now.

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cristicalin, ErikJiang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 19, 2022
@ErikJiang
Copy link
Member Author

@oomichi @floryut PTAL😊

Copy link
Contributor

@oomichi oomichi left a comment

Choose a reason for hiding this comment

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

Thank you for doing this.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 21, 2022
@k8s-ci-robot k8s-ci-robot merged commit 4a92b72 into kubernetes-sigs:master Jun 21, 2022
@ErikJiang ErikJiang deleted the manage-offline-files branch June 21, 2022 12:59
@ErikJiang ErikJiang restored the manage-offline-files branch June 21, 2022 13:10
@ErikJiang ErikJiang deleted the manage-offline-files branch June 21, 2022 13:10
@ErikJiang ErikJiang restored the manage-offline-files branch June 21, 2022 13:10
fungusakafungus pushed a commit to fungusakafungus/kubespray that referenced this pull request Jul 13, 2022
Signed-off-by: bo.jiang <bo.jiang@daocloud.io>
@floryut floryut mentioned this pull request Sep 19, 2022
LuckySB pushed a commit to southbridgeio/kubespray that referenced this pull request Jul 2, 2023
Signed-off-by: bo.jiang <bo.jiang@daocloud.io>
LuckySB pushed a commit to southbridgeio/kubespray that referenced this pull request Jul 6, 2023
Signed-off-by: bo.jiang <bo.jiang@daocloud.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support download files for Offline deployment
7 participants