Commit Graph

260 Commits (83419b0eb129c1ba2a2f6a3e9d2b0d0fd5e3bd5f)

Author SHA1 Message Date
Steven Powell 68ed09bedc
Merge pull request #18158 from alessandrocapanna/fix-mask-env-on-start
fix: updated regex on validateNetwork to support special characters.
2024-03-28 10:52:46 -07:00
alessandrocapanna 89f58c8e24
refactor(util): Move maskProxyPassword to pkg/util, update references & tests, introduced MaskProxyPasswordWithKey
refactor(util): Move maskProxyPassword to pkg/util, update references & tests, introduced MaskProxyPasswordWithKey
2024-03-26 23:27:36 +01:00
Predrag Rogic 6f4d0f1f3b
Merge branch 'kubernetes:master' into ha 2024-03-03 18:57:51 +00:00
Steven Powell 4d32230e3e fix lint errors 2024-02-12 17:32:14 -08:00
Predrag Rogic ad7fb3992c
support kubernetes ha cluster topology in minikube 2024-01-07 21:36:17 +00:00
x7upLime e28a1b411b Removes pidfile util 2023-04-22 00:49:30 +03:00
x7upLime 51e46b6d8d Refactors GetPids
Moves GetPids inside cmd/delete.go as a helper function
Adds description
2023-04-22 00:49:30 +03:00
x7upLime 60c3863f87 Changes klog version and adds it to go.sum
uses klog/v2.. hopefully getting rid of the ci error.
2023-04-22 00:48:56 +03:00
x7upLime 3f47e72752 Modularizes killProcess()
adds helper functions for killing one process, given one pid
adds helper function to read pids out of a given pidfile
2023-04-22 00:48:34 +03:00
x7upLime e34548f9ae Adds description to lock.AppendToFile 2023-04-22 00:47:06 +03:00
x7upLime 9d4f296c1f Adjusts mount processes cleaning logic
The delete mechanism called by the --kill flag logic
inside the minikube mount command, relies on a .mount-process file
inside the .minikube dotfolder in home directory.

For this to work, the mount should've been instantiated
by some mechanism that also creates the file; like
k8s.io/minikube/pkg/minikube/node.configureMounts()

To just add the local.WriteFile() logic from configureMounts()
is not enough for the usecase in #15778:
user's consequent "minikube mount" calls would break the cleaning
logic, since the file's content gets overwritten at each new call.
So on subsequent minikube mounts, a call to "minikube mount
--kill=true" would remove just the last pid, leaving the other
mounts unaltered, and no trace of them in any place...(leak?)

For the same mechanism to work here,
we should rely on some local.AppendFile() function, to add
separated pids consequently.
This way only "minikube mount" would use this new append logic,
leaving unaltered the other functions.

We now have a new behaviour for the .mount-process file,
in order to address this, we should modify the delete logic from
cmd/minikube/cmd/delete.go -- killProcess(),
so that we can both kill a single pid, as well as multiple
space-separated pids in the same way.

...

Ah yes..
we're slightly modifying the "minikube mount" RunE anon function,
in order to write the pid into the .mount-process file;
as well as modifying cluster.Mount()'s signature to accept the pid.
That should be more than safe, since cluster.Mount() is used only here
2023-04-22 00:47:06 +03:00
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