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

convert dockerNetworkInspect to a struct #9710

Merged
merged 1 commit into from
Nov 20, 2020

Conversation

valaparthvi
Copy link
Contributor

@valaparthvi valaparthvi commented Nov 15, 2020

fixes #9690

minikube start after the changes

➜  minikube git:(issue9690) ✗ ./out/minikube start
I1118 10:57:25.679592    6343 translate.go:89] Failed to load translation file for en: Asset translations/en.json not found
😄  minikube v1.15.0 on Fedora 32
🆕  Kubernetes 1.19.4 is now available. If you would like to upgrade, specify: --kubernetes-version=v1.19.4
✨  Using the kvm2 driver based on existing profile
💾  Downloading driver docker-machine-driver-kvm2:
    > docker-machine-driver-kvm2.sha256: 65 B / 65 B [-------] 100.00% ? p/s 0s
    > docker-machine-driver-kvm2: 13.56 MiB / 13.56 MiB  100.00% 180.70 KiB p/s
💿  Downloading VM boot image ...
    > minikube-v1.15.0.iso.sha256: 65 B / 65 B [-------------] 100.00% ? p/s 0s
    > minikube-v1.15.0.iso: 181.00 MiB / 181.00 MiB  100.00% 1.92 MiB p/s 1m34s
👍  Starting control plane node minikube in cluster minikube
🔄  Restarting existing kvm2 VM for "minikube" ...
🐳  Preparing Kubernetes v1.18.3 on Docker 19.03.12 ...
🔎  Verifying Kubernetes components...
🌟  Enabled addons: storage-provisioner, default-storageclass, dashboard

❗  /usr/bin/kubectl is version 1.10.0+b3b92b2, which may have incompatibilites with Kubernetes 1.18.3.
    ▪ Want kubectl v1.18.3? Try 'minikube kubectl -- get pods -A'
🏄  Done! kubectl is now configured to use "minikube" cluster and "" namespace by default

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. 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 Nov 15, 2020
@k8s-ci-robot
Copy link
Contributor

Welcome @valaparthvi!

It looks like this is your first PR to kubernetes/minikube 🎉. 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/minikube 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
Copy link
Contributor

Hi @valaparthvi. 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 size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 15, 2020
@minikube-bot
Copy link
Collaborator

Can one of the admins verify this patch?

Copy link
Member

@medyagh medyagh 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 this PR do you mind putting in the PR Descriptipn the After this PR. minikube start output ?

Copy link
Member

@medyagh medyagh left a comment

Choose a reason for hiding this comment

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

Please check the Docker Test failure https://github.com/kubernetes/minikube/pull/9710/checks?check_run_id=1402352846
functional_docker_ubuntu

2020-11-15T11:13:15.4284497Z         	X Exiting due to GUEST_START: Failed to setup kubeconfig: network inspect: error parsing network inspect output: "{\"Name\": \"functional-20201115111211-2491\",\"Driver\": \"bridge\",\"Subnet\": \"192.168.49.0/24\",\"Gateway\": \"192.168.49.1\",\"MTU\": 1500, \"ContainerIPs\": [  \"192.168.49.188/24\",]}\n"

maybe we need to trim the "\n" from the output

020-11-15T11:13:15.3983628Z         ** stderr ** 
2020-11-15T11:13:15.3984110Z         	! Local proxy ignored: not passing HTTP_PROXY=localhost:43067 to docker env.
2020-11-15T11:13:15.4020343Z         	    > preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4: 8.00 MiB /    > preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4: 16.00 MiB     > preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4: 16.00 MiB     > preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4: 16.00 MiB     > preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4: 20.64 MiB     > preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4: 48.00 MiB     > preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4: 66.67 MiB     > preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4: 95.45 MiB     > preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4: 112.00 MiB    > preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4: 130.83 MiB    > preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4: 136.00 MiB    > preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4: 136.00 MiB    > preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4: 136.00 MiB    > preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4: 136.00 MiB    > preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4: 140.72 MiB    > preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4: 167.53 MiB    > preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4: 168.00 MiB    > preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4: 168.00 MiB    > preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4: 168.00 MiB    > preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4: 168.00 MiB    > preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4: 168.00 MiB    > preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4: 176.06 MiB    > preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4: 200.77 MiB    > preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4: 223.39 MiB    > preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4: 251.72 MiB    > preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4: 274.83 MiB    > preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4: 300.73 MiB    > preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4: 333.58 MiB    > preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4: 360.95 MiB    > preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4: 392.23 MiB    > preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4: 425.77 MiB    > preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4: 456.16 MiB    > preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4: 486.35 MiB! Local proxy ignored: not passing HTTP_PROXY=localhost:43067 to docker env.
2020-11-15T11:13:15.4273968Z         	! You appear to be using a proxy, but your NO_PROXY environment does not include the minikube IP (192.168.49.188).
2020-11-15T11:13:15.4282358Z         	E1115 11:13:15.361152    2502 start.go:99] Unable to get host IP: network inspect: error parsing network inspect output: "{\"Name\": \"functional-20201115111211-2491\",\"Driver\": \"bridge\",\"Subnet\": \"192.168.49.0/24\",\"Gateway\": \"192.168.49.1\",\"MTU\": 1500, \"ContainerIPs\": [  \"192.168.49.188/24\",]}\n"
2020-11-15T11:13:15.4284497Z         	X Exiting due to GUEST_START: Failed to setup kubeconfig: network inspect: error parsing network inspect output: "{\"Name\": \"functional-20201115111211-2491\",\"Driver\": \"bridge\",\"Subnet\": \"192.168.49.0/24\",\"Gateway\": \"192.168.49.1\",\"MTU\": 1500, \"ContainerIPs\": [  \"192.168.49.188/24\",]}\n"
2020-11-15T11:13:15.4285484Z         	* 
2020-11-15T11:13:15.4285863Z         	* If the above advice does not help, please let us know: 
2020-11-15T11:13:15.4286883Z         	  - https://github.com/kubernetes/minikube/issues/new/choose
2020-11-15T11:13:15.4287380Z         
2020-11-15T11:13:15.4287632Z         ** /stderr **

@valaparthvi valaparthvi force-pushed the issue9690 branch 3 times, most recently from da025fe to a263462 Compare November 19, 2020 06:31
@valaparthvi
Copy link
Contributor Author

@medyagh Looks like we're good to go. Although I am not completely happy with the format string

{"Name": "{{.Name}}","Driver": "{{.Driver}}","Subnet": "{{range .IPAM.Config}}{{.Subnet}}{{end}}","Gateway": "{{range .IPAM.Config}}{{.Gateway}}{{end}}","MTU": {{(index .Options "com.docker.network.driver.mtu")}},{{$first := true}} "ContainerIPs": [{{range $k,$v := .Containers }}{{if $first}}{{$first = false}}{{else}}, {{end}}"{{$v.IPv4Address}}"{{end}}]}

I do not understand the purpose of defining first variable but it does help in solving the problem we were facing earlier regarding json unmarshall. Also, the error did not occur because of \n but because of a trailing comma in the ContainerIPs array.

I have tried a few different ways to fix this error but none of them seem elegant enough with regards to the current code.

@medyagh
Copy link
Member

medyagh commented Nov 19, 2020

/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 Nov 19, 2020
@minikube-pr-bot
Copy link

kvm2 Driver
error collecting results for kvm2 driver: timing run 0 with Minikube (PR 9710): timing cmd: [/home/performance-monitor/.minikube/minikube-binaries/9710/minikube start --driver=kvm2]: starting cmd: fork/exec /home/performance-monitor/.minikube/minikube-binaries/9710/minikube: exec format error
docker Driver
error collecting results for docker driver: timing run 0 with Minikube (PR 9710): timing cmd: [/home/performance-monitor/.minikube/minikube-binaries/9710/minikube start --driver=docker]: starting cmd: fork/exec /home/performance-monitor/.minikube/minikube-binaries/9710/minikube: exec format error

@medyagh
Copy link
Member

medyagh commented Nov 19, 2020

/retest-this-please

Copy link
Member

@medyagh medyagh 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 @valaparthvi for this PR

@medyagh medyagh changed the title WIP: convert dockerNetworkInspect to a struct convert dockerNetworkInspect to a struct Nov 20, 2020
@k8s-ci-robot k8s-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 Nov 20, 2020
@medyagh medyagh merged commit 131d724 into kubernetes:master Nov 20, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

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 Nov 20, 2020
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. 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.

convert dockerNetworkInspect to a struct
5 participants