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

dind: Added support for local registry to push and pull images #20048

Merged

Conversation

pravisankar
Copy link

  • This will be useful for dev testing router, egress router features.
  • This will also help if we plan to switch dind to use newer openshift
    deployment(kubelet with openshift flags, sdn/ovs/config daemonsets)

@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 20, 2018
@openshift-ci-robot openshift-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 20, 2018
@bparees bparees removed their request for review June 20, 2018 17:30
@imcsk8
Copy link
Contributor

imcsk8 commented Jun 20, 2018

It looks good so far

Copy link
Contributor

@knobunc knobunc left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jun 26, 2018
@knobunc
Copy link
Contributor

knobunc commented Jun 26, 2018

/approve

Ravi Sankar Penta added 2 commits July 3, 2018 00:36
- This will be useful for dev testing router, egress router features.
- This will also help if we plan to switch dind to use newer openshift
deployment(kubelet with openshift flags, sdn/ovs/config daemonsets)
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Jul 3, 2018
@pravisankar pravisankar changed the title WIP: dind: Added support for local registry to push and pull images dind: Added support for local registry to push and pull images Jul 3, 2018
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 3, 2018
@pravisankar
Copy link
Author

Fixed all the pending issues and tested with both docker and crio runtimes.
@knobunc @ironcladlou @imcsk8 this pr is ready for review/merge, PTAL

Ravi Sankar Penta added 2 commits July 3, 2018 01:24
- Restarting docker/crio systemd services needs dbus service to be
up and running otherwise will get this error in some cases:
'Failed to connect to bus: No such file or directory'
- docker.io/openshift/origin-nginx-router image no longer available
@openshift-ci-robot
Copy link

openshift-ci-robot commented Jul 3, 2018

@pravisankar: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/openshift-jenkins/integration b63ffa8 link /test integration

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. I understand the commands that are listed here.

@@ -122,16 +122,6 @@
},
"files": {}
},
"nginx-router": {
Copy link
Contributor

Choose a reason for hiding this comment

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

@rajatchopra do you have any opinion about this?

Copy link
Contributor

Choose a reason for hiding this comment

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

If we have no plan to test nginx then this is fine. We may have to have some way to build and host the nginx image for origin releases though.

Copy link
Author

Choose a reason for hiding this comment

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

Once we have nginx image for origin, we could add again to this script if needed.
Currently this change was done to unblock hack/build-local-images.py script, otherwise it tries to build nginx-router, since the image doesn't exists it fails and it won't proceed building other local images.

fi

if [[ -n "${local_registry}" ]]; then
add-registry-to-runtime "${registry_ip}:${REGISTRY_PORT}" "${container_runtime}"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need to detect if this has already been done

Copy link
Author

Choose a reason for hiding this comment

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

We need to detect if registry entries already exists if adding local registry was a separate dind call. In here, we added local registry as an optional param to dind start. So we are guaranteed that registry entries will not present beforehand.
dind nodes and master are freshly created just few lines above this call. So local registry entries will not be present.

${DOCKER_CMD} run -d -p ${REGISTRY_PORT}:5000 --restart=always --name ${REGISTRY_NAME} registry:2 > /dev/null
echo "Created local registry '${REGISTRY_NAME}' at ${ip}:${REGISTRY_PORT}"

# Build, tag and push local images
Copy link
Contributor

Choose a reason for hiding this comment

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

Should there be a way to do this again later? I think a separate command to add all images to the local registry would be handy.

Copy link
Author

Choose a reason for hiding this comment

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

Yes, that will be useful.
I was thinking instead of a new command, piggybacking on 'refresh' command may be handy because most of the time we need updated openshift binary along with the image changes.

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe a hack/local_registry.sh that performs the registry tasks could be useful

@knobunc
Copy link
Contributor

knobunc commented Jul 12, 2018

/retest
/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 12, 2018
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: knobunc, pravisankar

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

@pravisankar
Copy link
Author

@knobunc @imcsk8
I will create a follow up pr to implement your suggestion in #20048 (comment)

@openshift-merge-robot openshift-merge-robot merged commit 7dec9a3 into openshift:master Jul 13, 2018
pravisankar pushed a commit to pravisankar/origin that referenced this pull request Jul 30, 2018
Based on suggestion from openshift#20048 (comment),
I have simplified adding local registry to dind cluster and now it is a lot more flexible.
Earlier '-l' flag enables local registry and '-m' flag indicates images to be pushed to local registry.
Now, '-l' flag is removed and based on '-m' flag, local registry is created if needed.

Usage:
-m "none" or -m "" will not push any local images but will create local registry for the dind cluster.
-m "all" will push all local images supported by hack/build-local-images.py script
-m "<image1>,<image2>..." will push specified images to local registry

'-m' flag can be used either with dind 'start' or 'refresh' command.
Example:
hack/dind-cluster.sh start -r -m "openshift/origin-haproxy-router,openshift/origin-cli"
hack/dind-cluster.sh refresh -m "openshift/origin-haproxy-router,openshift/origin-cli"
pravisankar pushed a commit to pravisankar/origin that referenced this pull request Jul 30, 2018
Based on suggestion from openshift#20048 (comment),
I have simplified adding local registry to dind cluster and now it is a lot more flexible.
Earlier '-l' flag enables local registry and '-m' flag indicates images to be pushed to local registry.
Now, '-l' flag is removed and based on '-m' flag, local registry is created if needed.

Usage:
-m "none" or -m "" will not push any local images but will create local registry for the dind cluster.
-m "all" will push all local images supported by hack/build-local-images.py script
-m "<image1>,<image2>..." will push specified images to local registry

'-m' flag can be used either with dind 'start' or 'refresh' command.
Example:
hack/dind-cluster.sh start -r -m "openshift/origin-haproxy-router,openshift/origin-cli"
hack/dind-cluster.sh refresh -m "openshift/origin-haproxy-router,openshift/origin-cli"
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. lgtm Indicates that a PR is ready to be merged. 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.

None yet

6 participants