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

Fix and improve manage-offline-container-images script #10857

Conversation

anders-elastisys
Copy link
Contributor

@anders-elastisys anders-elastisys commented Jan 30, 2024

What type of PR is this?

/kind bug

What this PR does / why we need it:

This PR adds some improvements to the contrib/offline/manage-offline-container-images.sh script. Improvements include:

  • New environment variable DESTINATION_REGISTRY for pushing to a registry of your choice instead of the default one created by the script
  • New environment variable IMAGES_FROM_FILE that can be used to read a list of images from a file (e.g. temp/images.list created by the generate_list.sh script) instead of getting images from a cluster
  • New environment variable REGISTRY_PORT to override the local container registry to run on a different port than 5000
  • Getting images from cluster now looks at jobs and cronjobs as these may not always be running as a pod (e.g. created by operators)
  • Added bug fixes such as additional parsing and checks for when working with images that contains the image digest in the tag, as this did not work previously and stopped the script from finishing

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

The script `manage-offline-container-images.sh` now supports additional environment variables, e.g. it is now possible use the script to pull images listed in a file instead of checking images in a running cluster.

@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Jan 30, 2024
Copy link

linux-foundation-easycla bot commented Jan 30, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: anders-elastisys (a9deb22)

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Jan 30, 2024
@k8s-ci-robot
Copy link
Contributor

Welcome @anders-elastisys!

It looks like this is your first PR to kubernetes-sigs/kubespray 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/kubespray has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jan 30, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @anders-elastisys. 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 size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jan 30, 2024
@yankay
Copy link
Member

yankay commented Jan 31, 2024

/ok-to-test

@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 Jan 31, 2024
Copy link
Contributor

@VannTen VannTen left a comment

Choose a reason for hiding this comment

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

Minor nitpicking

contrib/offline/manage-offline-container-images.sh Outdated Show resolved Hide resolved
contrib/offline/manage-offline-container-images.sh Outdated Show resolved Hide resolved
@VannTen
Copy link
Contributor

VannTen commented Feb 12, 2024

/lgtm
(Not that I don't use that script, but I don't spot anything wrong. Not sure if we have that tested in CI ? 🤔 )

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 12, 2024
@anders-elastisys anders-elastisys force-pushed the anders-elastisys/improve-offline-contrib-scripts branch from 8e36038 to 75f15f4 Compare February 13, 2024 07:32
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 13, 2024
@anders-elastisys
Copy link
Contributor Author

@VannTen I could not find any tests for this script, so not sure. I squashed the commits into one, hence the bot detected new changes.

@VannTen
Copy link
Contributor

VannTen commented Feb 13, 2024

Can you add general description of the new variables and why they are needed directly in the commit message please ?

Fixes bug for retrieving images with tags containing image digests.
Script now gets images from jobs and cronjobs as well.
New env variable DESTINATION_REGISTRY to push to another registry
instead of local registry.
New env variable IMAGES_FROM_FILE to pull images listed in a file
instead of getting images from a running k8s environment.
New env variable REGISTRY_PORT to override port (default is 5000).
@anders-elastisys anders-elastisys force-pushed the anders-elastisys/improve-offline-contrib-scripts branch from 75f15f4 to a9deb22 Compare February 13, 2024 10:26
@anders-elastisys
Copy link
Contributor Author

@VannTen PTAL

@VannTen
Copy link
Contributor

VannTen commented Feb 13, 2024

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 13, 2024
@VannTen
Copy link
Contributor

VannTen commented Feb 16, 2024

/assign @mirwan @yankay
(approval)

@k8s-ci-robot
Copy link
Contributor

@VannTen: GitHub didn't allow me to assign the following users: mirwan.

Note that only kubernetes-sigs members with read permissions, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

In response to this:

/assign @mirwan @yankay
(approval)

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.

@yankay
Copy link
Member

yankay commented Feb 18, 2024

Thanks @anders-elastisys
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: anders-elastisys, yankay

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 Feb 18, 2024
@k8s-ci-robot k8s-ci-robot merged commit 8fa5ae1 into kubernetes-sigs:master Feb 18, 2024
65 checks passed
dabeck pushed a commit to fino-digital/kubespray that referenced this pull request May 7, 2024
…10857)

Fixes bug for retrieving images with tags containing image digests.
Script now gets images from jobs and cronjobs as well.
New env variable DESTINATION_REGISTRY to push to another registry
instead of local registry.
New env variable IMAGES_FROM_FILE to pull images listed in a file
instead of getting images from a running k8s environment.
New env variable REGISTRY_PORT to override port (default is 5000).
pedro-peter pushed a commit to pedro-peter/kubespray that referenced this pull request May 8, 2024
…10857)

Fixes bug for retrieving images with tags containing image digests.
Script now gets images from jobs and cronjobs as well.
New env variable DESTINATION_REGISTRY to push to another registry
instead of local registry.
New env variable IMAGES_FROM_FILE to pull images listed in a file
instead of getting images from a running k8s environment.
New env variable REGISTRY_PORT to override port (default is 5000).
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/bug Categorizes issue or PR as related to a bug. 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/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants