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

Improve insecure registry validation #10493

Merged
merged 1 commit into from
Feb 20, 2021
Merged

Conversation

kadern0
Copy link
Contributor

@kadern0 kadern0 commented Feb 17, 2021

Fixes 8790

Since some people complained about port being mandatory, I've decided to update the code to mimic docker's own validation.

Original discussion here.

Please se bellow the output for different insecure registries specifications:
Incorrect:

./out/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
🎉  minikube 1.17.1 is available! Download it: https://github.com/kubernetes/minikube/releases/tag/v1.17.1
💡  To disable this notice, run: 'minikube config set WantUpdateNotification false'


❌  Exiting due to MK_USAGE: Sorry, the address provided with the --insecure-registry flag is invalid: :. Expected formtas are: <ip>[:<port>], <hostname>[:<port>] or <network>/<netmask>

$ ./out/minikube start --driver=docker --profile=testing3 --insecure-registry=127.0.0.1:
😄  [testing3] 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: 127.0.0.1:. Expected formtas are: <ip>[:<port>], <hostname>[:<port>] or <network>/<netmask>

$ ./out/minikube start --driver=docker --profile=testing3 --insecure-registry=svn://mytest.com
😄  [testing3] 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: svn://mytest.com. Expected formtas are: <ip>[:<port>], <hostname>[:<port>] or <network>/<netmask>

$ ./out/minikube start --driver=docker --profile=testing3 --insecure-registry=1200:0000:AB00:1234:0000:2552:7777:1313:8080
😄  [testing3] 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: 1200:0000:AB00:1234:0000:2552:7777:1313:8080. Expected formtas are: <ip>[:<port>], <hostname>[:<port>] or <network>/<netmask>

$ ./out/minikube start --driver=docker --profile=testing3 --insecure-registry=mytest.com:500000
😄  [testing3] 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: mytest.com:500000. Expected formtas are: <ip>[:<port>], <hostname>[:<port>] or <network>/<netmask>

$ ./out/minikube start --driver=docker --profile=testing3 --insecure-registry=-mytest.com
😄  [testing3] 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: -mytest.com. Expected formtas are: <ip>[:<port>], <hostname>[:<port>] or <network>/<netmask>

Correct:

$ ./out/minikube start --driver=docker --profile=testing3 --insecure-registry=172.16.32.24
😄  [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) ...

$ ./out/minikube start --driver=docker --profile=testing3 --insecure-registry=172.16.32.24
😄  [testing3] minikube v1.13.0 on Ubuntu 20.04
✨  Using the docker driver based on existing profile
👍  Starting control plane node testing3 in cluster testing3


$ ./out/minikube start --driver=docker --profile=testing3 --insecure-registry=172.16.32.24:8080
😄  [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) ...


$ ./out/minikube start --driver=docker --profile=testing3 --insecure-registry=2001:db8::1
😄  [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) ...
^C

$ ./out/minikube start --driver=docker --profile=testing3 --insecure-registry=[2001:db8::1]:80
😄  [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) ...


$ ./out/minikube start --driver=docker --profile=testing3 --insecure-registry=https://mytest.com:80
😄  [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) ...

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 17, 2021
@k8s-ci-robot
Copy link
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.

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 Feb 17, 2021
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Feb 17, 2021
@minikube-bot
Copy link
Collaborator

Can one of the admins verify this patch?

@k8s-ci-robot
Copy link
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

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 20, 2021
@medyagh
Copy link
Member

medyagh commented Feb 20, 2021

thank you for improving this @kadern0

@medyagh medyagh merged commit 77e9751 into kubernetes:master Feb 20, 2021
@medyagh medyagh changed the title Improved insecure registry validation function Improve insecure registry validation Feb 20, 2021
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.

4 participants