Commit Graph

249 Commits (a72b0e1996b938c8efdd855b46fd87eb469a79f3)

Author SHA1 Message Date
Predrag Rogic 11a8dbf830
fix TestNetworkPlugins tests for Linux with Docker driver 2022-12-07 12:34:14 +00:00
Eng Zer Jun 9d85be1a99
test: use `T.Setenv` to set env vars in tests
This commit replaces `os.Setenv` with `t.Setenv` in tests. The
environment variable is automatically restored to its original value
when the test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.Setenv
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-11-08 10:30:29 +08:00
Steven Powell 6a7be9a0cc
Merge pull request #14763 from spowelljr/fixDuplicateArmPreload
Remove duplicated k8s versions from preload generation
2022-08-10 16:20:27 -07:00
Steven Powell d0fc619adf move RemoveDuplicateStrings to util 2022-08-09 14:27:35 -07:00
Steven Powell 2482b4e4de fix unit tests on macOS arm64 2022-08-08 10:20:13 -07:00
Kian-Meng Ang bc03821826 Fix typos 2022-06-10 15:26:35 -07:00
Steven Powell 2e4ea3c259 replace MkdirTemp with t.TempDir in tests 2022-04-01 19:18:20 -07:00
Nicolas Busseneau 02a43c52e2
virtualbox: change default `host-only-cidr`
We change the default `--host-only-cidr` to `192.168.59.1/24` in order
to be compatible with the new default host-only networking restrictions
implemented in VirtualBox 6.1.28.

This fixes access denied errors on `minikube start` when using
VirtualBox >= 6.1.28:

```
VBoxManage: error: Code E_ACCESSDENIED (0x80070005) - Access denied (extended info not available)
VBoxManage: error: Context: "EnableStaticIPConfig(Bstr(pszIp).raw(), Bstr(pszNetmask).raw())" at line 242 of file VBoxManageHostonly.cpp
```

More details:

VirtualBox 6.1.28 introduced new restrictions on host-only networking:
https://www.virtualbox.org/wiki/Changelog-6.1#v28

Manual: https://www.virtualbox.org/manual/ch06.html#network_hostonly

> On Linux, Mac OS X and Solaris Oracle VM VirtualBox will only allow IP
> addresses in 192.68.56.0/21 range to be assigned to host-only
> adapters. For IPv6 only link-local addresses are allowed. If other
> ranges are desired, they can be enabled by creating
> /etc/vbox/networks.conf and specifying allowed ranges there. For
> example, to allow 10.0.0.0/8 and 192.168.0.0/16 IPv4 ranges as well as
> 2001::/64 range put the following lines into /etc/vbox/networks.conf:
>
>      * 10.0.0.0/8 192.168.0.0/16
>      * 2001::/64
>
> Lines starting with the hash # are ignored. Next example allows any
> addresses, effectively disabling range control:
>
>      * 0.0.0.0/0 ::/0

These new restrictions manifest in the form of the following issue on
`minikube start` due to the default `--host-only-cidr` used by the
VirtualBox driver being `192.168.99.1/24`:

```console
😄  minikube v1.23.2 on Ubuntu 18.04
  Using the virtualbox driver based on user configuration
👍  Starting control plane node minikube in cluster minikube
🔥  Creating virtualbox VM (CPUs=2, Memory=6000MB, Disk=20000MB) ...
🔥  Deleting "minikube" in virtualbox ...
🤦  StartHost failed, but will try again: creating host: create: creating: Error setting up host only network on machine start: /usr/bin/VBoxManage hostonlyif ipconfig vboxnet0 --ip 192.168.99.1 --netmask 255.255.255.0 failed:
VBoxManage: error: Code E_ACCESSDENIED (0x80070005) - Access denied (extended info not available)
VBoxManage: error: Context: "EnableStaticIPConfig(Bstr(pszIp).raw(), Bstr(pszNetmask).raw())" at line 242 of file VBoxManageHostonly.cpp

🔥  Creating virtualbox VM (CPUs=2, Memory=6000MB, Disk=20000MB) ...
😿  Failed to start virtualbox VM. Running "minikube delete" may fix it: creating host: create: creating: Error setting up host only network on machine start: /usr/bin/VBoxManage hostonlyif ipconfig vboxnet1 --ip 192.168.99.1 --netmask 255.255.255.0 failed:
VBoxManage: error: Code E_ACCESSDENIED (0x80070005) - Access denied (extended info not available)
VBoxManage: error: Context: "EnableStaticIPConfig(Bstr(pszIp).raw(), Bstr(pszNetmask).raw())" at line 242 of file VBoxManageHostonly.cpp

  Exiting due to GUEST_PROVISION: Failed to start host: creating host: create: creating: Error setting up host only network on machine start: /usr/bin/VBoxManage hostonlyif ipconfig vboxnet1 --ip 192.168.99.1 --netmask 255.255.255.0 failed:
VBoxManage: error: Code E_ACCESSDENIED (0x80070005) - Access denied (extended info not available)
VBoxManage: error: Context: "EnableStaticIPConfig(Bstr(pszIp).raw(), Bstr(pszNetmask).raw())" at line 242 of file VBoxManageHostonly.cpp

╭───────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                           │
│    😿  If the above advice does not help, please let us know:                             │
│    👉  https://github.com/kubernetes/minikube/issues/new/choose                           │
│                                                                                           │
│    Please run `minikube logs --file=logs.txt` and attach logs.txt to the GitHub issue.    │
│                                                                                           │
╰───────────────────────────────────────────────────────────────────────────────────────────╯
```

While the above is the primary error, other errors will be reported if
the adapter already exists (this happens when the adapter was created
before updating to VirtualBox 6.1.28, on a version of VirtualBox without
the new restrictions). Some examples:

```
 Exiting due to IF_VBOX_NOT_VISIBLE: Failed to start host: creating host: create: creating: Error setting up host only network on machine start: The host-only adapter we just created is not visible. This is a well known VirtualBox bug. You might want to uninstall it and reinstall at least version 5.0.12 that is is supposed to fix this issue
```

```
  minikube is unable to connect to the VM: dial tcp 192.168.99.112:22: i/o timeout

	This is likely due to one of two reasons:

	- VPN or firewall interference
	- virtualbox network configuration issue

	Suggested workarounds:

	- Disable your local VPN or firewall software
	- Configure your local VPN or firewall to allow access to 192.168.99.112
	- Restart or reinstall virtualbox
	- Use an alternative --vm-driver
	- Use --force to override this connectivity check

  Exiting due to GUEST_PROVISION: Failed to validate network: dial tcp 192.168.99.112:22: i/o timeout
```

When switching to a valid CIDR, `minikube start` works as usual:

```console
😄  minikube v1.23.2 on Ubuntu 18.04
  Using the virtualbox driver based on user configuration
👍  Starting control plane node minikube in cluster minikube
🔥  Creating virtualbox VM (CPUs=2, Memory=6000MB, Disk=20000MB) ...
🐳  Preparing Kubernetes v1.22.2 on Docker 20.10.8 ...
    ▪ Generating certificates and keys ...
    ▪ Booting up control plane ...
    ▪ Configuring RBAC rules ...
    ▪ Using image gcr.io/k8s-minikube/storage-provisioner:v5
🔎  Verifying Kubernetes components...
🌟  Enabled addons: storage-provisioner, default-storageclass
🏄  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
```

Signed-off-by: Nicolas Busseneau <nicolas@isovalent.com>
2021-11-02 15:30:46 +01:00
KallyDev 70022d9b2e
Move from deprecated ioutil to os and io packages 2021-10-08 08:57:19 +08:00
Sharif Elgamal 4307e834df address review comments 2021-09-24 11:47:10 -07:00
Sharif Elgamal 1212848649 make cert expiration configurable and add test 2021-09-21 16:17:52 -07:00
Medya Gh 89c7853601 bump go mod libs manually 2021-06-29 15:24:59 -04:00
Medya Gh 1207de734b bump golang lint ci to latest 2021-04-19 15:16:31 -07:00
Ilya Zuyev 275f743e9f support arch in downloadURL 2021-03-19 13:55:11 -07:00
Priya Modali ef2090ac31 Merge branch 'master' of https://github.com/kubernetes/minikube into klog 2020-10-08 10:27:04 -07:00
Anders F Björklund e36c937a34 Do some simple cleanup of the golint complaints
The "magic strings" and enums still needs another approach

Simply echoing everything twice doesn't seem very useful ?
2020-10-04 13:40:33 +02:00
Priya Modali 8d5eb81d38 Fied lint. 2020-09-29 17:10:30 -07:00
Priya Modali 97d96bf925 Switching from glob library to klog library. 2020-09-29 15:49:41 -07:00
Michael Ryan Dempsey 1859274e8a
refactor conversion functions into util 2020-09-01 21:21:07 -07:00
Thomas Stromberg 7f5a06b606 Unwrap unnecessary level of error annotation for improved messages 2020-08-30 20:48:55 -07:00
Thomas Stromberg 53ce804cff retry.Local should respect the maxTime argument 2020-07-07 15:10:30 -07:00
Thomas Stromberg 3fb1cded91 Add retry.Local + retry logging 2020-06-25 09:43:45 -07:00
Thomas Stromberg 436cee2d84 Fix minikube/kubernetes capitalization, make short help consistent 2020-05-07 14:12:10 -07:00
ZouYu 1b2707d086 Add unit test for function ChownR&MaybeChownDirRecursiveToMinikubeUser
Signed-off-by: ZouYu <zouy.fnst@cn.fujitsu.com>
2020-04-22 10:06:57 +08:00
Medya Gh d4b48e1e05 clean up after test dirs 2020-04-14 19:33:26 -07:00
Dan Lorenc d8db21478c Remove unused code.
I was looking for an example of reflect and noticed that this code was unused.
2020-03-31 10:37:04 -05:00
Vincent Link b5d5aa1d52 Parse --disk-size and --memory sizes with binary suffixes 2020-03-24 17:20:59 +01:00
Thomas Strömberg a29c5739ab
Merge pull request #6988 from tstromberg/v1.18.0-beta
Update NewestKubernetesVersion to 1.18.0-beta.2
2020-03-11 17:00:35 -07:00
Thomas Stromberg 71a22787c3 Update Kubernetes image mapping to match v1.18 2020-03-10 20:48:38 -07:00
Thomas Stromberg c6333b95aa Test fixes: Add viper.SetDefault back, and make CalculateSizeInMB return an error instead of exit early 2020-03-10 17:43:56 -07:00
Thomas Stromberg 39670fc06f Add download package & support URL fallback 2020-03-04 17:07:49 -08:00
tstromberg 6f6663ec77 Make filesync unit tests excellent again 2020-02-04 15:06:43 -08:00
tstromberg 3db7713399 Remove more functions from the util package 2020-02-04 13:20:37 -08:00
Thomas Strömberg 5568ab005a
Merge branch 'master' into unthread-start 2020-01-10 09:54:02 -08:00
Thomas Stromberg e5fd7a6a81 Replace integration-test specific hacks with actual protection against racey events 2020-01-09 12:58:10 -08:00
Medya Gh f80572bb4c code review 2020-01-07 13:59:41 -08:00
Medya Gh 860ce25bf2 Add podSubnet to templates 2020-01-07 13:54:00 -08:00
Medya Gh a358aff093 fix ocibinary 2020-01-07 13:52:47 -08:00
Zhou Hao 2167655006 add unit test for GetDNSIP
Signed-off-by: Zhou Hao <zhouhao@cn.fujitsu.com>
2019-12-20 17:32:50 +08:00
Zhou Hao 6a5497510a add unit test for GetServiceClusterIP
Signed-off-by: Zhou Hao <zhouhao@cn.fujitsu.com>
2019-12-20 17:27:24 +08:00
Zhou Hao d864ac3f04 pkg/util: add CalculateSizeInMB test
Signed-off-by: zhouhao <zhouhao@cn.fujitsu.com>
2019-12-19 18:36:05 +08:00
Thomas Stromberg d811f6e428 Remove unused forceID var 2019-12-11 12:10:28 -08:00
Thomas Stromberg 3171493e51 Rename to PathMutexSpec 2019-12-11 12:01:32 -08:00
Thomas Stromberg c5f65baf61 Remove uid from hash name, as it is not necessary now that we lock on filenames rather than descriptive names 2019-12-11 11:52:36 -08:00
Thomas Stromberg 129b6a870b Update log messages 2019-12-11 09:54:44 -08:00
Thomas Stromberg af4e690837 Use sha1 for a larger hash, truncated to 40 chars 2019-12-11 09:14:20 -08:00
Thomas Stromberg cfe0f5a5b7 Use md5 to generate unique lock names 2019-12-11 08:13:12 -08:00
Thomas Stromberg bb28d5c346 Make lock names more specific to avoid conflicts 2019-11-14 10:57:11 -08:00
Medya Gh 6bd5d9b157 Merge remote-tracking branch 'upstream/master' into NewCmdRunner 2019-10-21 11:17:28 -07:00
Thomas Strömberg ce2b0a3b9a
Merge pull request #5471 from xichengliudui/redundantCode
remove the redundant code in util.go
2019-10-17 15:16:40 -07:00