8000 Added validation for --insecure-registry values by kadern0 · Pull Request #9977 · kubernetes/minikube · GitHub
[go: up one dir, main page]

Skip to content

Added validation for --i 8000 nsecure-registry values - #9977

Merged
medyagh merged 1 commit into
kubernetes:masterfrom
kadern0:issue-8790
Dec 22, 2020
Merged

medyagh merged 1 commit into
kubernetes:masterfrom
kadern0:issue-8790

Conversation

@kadern0
@kadern0 kadern0 commented Dec 17, 2020
Copy link
Copy Markdown
Contributor

Fixes 8790

Original reported behavior (slightly summarized):

minikube start --driver=docker --profile=testing3 --insecure-registry=:
😄  [testing3] minikube v1.13.0 on Ubuntu 20.04
✨  Using the docker driver based on user configuration
👍  Starting control plane node testing3 in cluster testing3
🔥  Creating docker container (CPUs=2, Memory=3900MB) ...
✋  Stopping node "testing3"  ...
🛑  Powering off "testing3" via SSH ...
🔥  Deleting "testing3" in docker ...
🤦  StartHost failed, but will try again: creating host: create: provisioning: ssh command error:

...

❌  Exiting due to RT_DOCKER_RESTART: Failed to start host: creating host: create: provisioning: ssh command error:
command : sudo diff -u /lib/systemd/system/docker.service /lib/systemd/system/docker.service.new || { sudo mv /lib/systemd/system/docker.service.new /lib/systemd/system/docker.service; sudo systemctl -f daemon-reload && sudo systemctl -f enable docker && sudo systemctl -f restart docker; }
err     : Process exited with status 1


...

💡  Suggestion: Remove the invalid --docker-opt or --insecure-registry flag if one was provided
🍿  Related issue: https://github.com/kubernetes/minikube/issues/7070

New behavior:

minikube start --driver=docker --profile=testingt3 --insecure-registry=:
😄  [testingt3] minikube v1.13.0 on Ubuntu 20.04
✨  Using the docker driver based on user configuration

❌  Exiting due to MK_USAGE: Sorry, the address provided with the --insecure-registry flag is invalid: :

Additional validations:

minikube start --driver=docker --profile=testingt --insecure-registry 172.16.23/24
😄  [testingt] minikube v1.13.0 on Ubuntu 20.04
✨  Using the docker driver based on existing profile

❌  Exiting due to MK_USAGE: Sorry, the address provided with the --insecure-registry flag is invalid: 172.16.23/24

minikube start --driver=docker --profile=testingt --insecure-registry 172.16.23/24:asdf
😄  [testingt] minikube v1.13.0 on Ubuntu 20.04
✨  Using the docker driver based on existing profile

❌  Exiting due to MK_USAGE: Sorry, the address provided with the --insecure-registry flag is invalid: 172.16.23/24:asdf
minikube start --driver=docker --profile=testingt --insecure-registry 172.16.23/24:
😄  [testingt] minikube v1.13.0 on Ubuntu 20.04
✨  Using the docker driver based on existing profile

❌  Exiting due to MK_USAGE: Sorry, the address provided with the --insecure-registry flag is invalid: 172.16.23/24:

minikube start --driver=docker --profile=testingt3 --insecure-registry=192.168.100.123
😄  [testingt3] minikube v1.13.0 on Ubuntu 20.04
✨  Using the docker driver based on existing profile

❌  Exiting due to MK_USAGE: Sorry, the address provided with the --insecure-registry flag is invalid: 192.168.100.123

minikube start --driver=docker --profile=testingt3 --insecure-registry=localhost
😄  [testingt3] minikube v1.13.0 on Ubuntu 20.04
✨  Using the docker driver based on existing profile

❌  Exiting due to MK_USAGE: Sorry, the address provided with the --insecure-registry flag is invalid: localhost

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Dec 17, 2020
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Hi @kadern0. Thanks for your PR.

I'm waiting for a kubernetes 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.

Details

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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Dec 17, 2020
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Dec 17, 2020
@minikube-bot
Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

Comment thread cmd/minikube/cmd/start.go Outdated

// This function validates that the --insecure-registry follows one of the following formats:
// "<ip>:<port>" "<hostname>:<port>" "<network>/<netmask>"
func ValidateInsecureRegistry() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this should be a private function -- and probably moved to start_flags.go.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agree with the private function, about the location I've placed it under the "validateRegistryMirror" function since they do pretty much the same. To me it makes sense having both together, what do you think?

Comment thread cmd/minikube/cmd/start.go Resolved
Comment thread cmd/minikube/cmd/start.go Resolved
Comment thread cmd/minikube/cmd/start.go
insecureRegistry []string
apiServerNames []string
apiServerIPs []net.IP
hostRe = regexp.MustCompile(`[\w\.-]+`)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

add a comment here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Do you still want me to add the comment?

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kadern0, medyagh

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

The pull request process is described here

Details 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 Dec 22, 2020
@medyagh
medyagh merged commit c300a05 into kubernetes:master Dec 22, 2020
@crossdot
crossdot commented Feb 3, 2021 •
Copy link
Copy Markdown

Why hostname without port is not allowed? It works fine in previous versions.
Using JFrog Artifactory as image registry and for example localregistry:443/nginx:1.18 in deployment looks terrible.

@kadern0
kadern0 commented Feb 3, 2021
Copy link
Copy Markdown
Contributor Author

@crossdot we are discussing about this on the issue's URL.

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. needs-ok-to-test Indicates a PR that requires an org member to verify it 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.

6 participants

0