nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: kubernetes/minikube
Pull request #11893 (2021-07-02 20:08:57)

Refactor checkRemotePreloadExists to no longer include caching logic
Previously, checkRemotePreloadExists triggered the caching logic itself. Now this has been moved into PreloadExists.

Related to #11892. Thank you @ilya-zuyev and @spowelljr for the great recommendations!


Patch:
diff --git a/pkg/minikube/download/preload.go b/pkg/minikube/download/preload.go
index ce6500d68..b174b1aec 100644
--- a/pkg/minikube/download/preload.go
+++ b/pkg/minikube/download/preload.go
@@ -106,19 +106,16 @@ var checkRemotePreloadExists = func(k8sVersion, containerRuntime string) bool {
 	resp, err := http.Head(url)
 	if err != nil {
 		klog.Warningf("%s fetch error: %v", url, err)
-		setPreloadState(k8sVersion, containerRuntime, false)
 		return false
 	}
 
 	// note: err won't be set if it's a 404
-	if resp.StatusCode != 200 {
+	if resp.StatusCode != http.StatusOK {
 		klog.Warningf("%s status code: %d", url, resp.StatusCode)
-		setPreloadState(k8sVersion, containerRuntime, false)
 		return false
 	}
 
 	klog.Infof("Found remote preload: %s", url)
-	setPreloadState(k8sVersion, containerRuntime, true)
 	return true
 }
 
@@ -152,7 +149,9 @@ func PreloadExists(k8sVersion, containerRuntime, driverName string, forcePreload
 		return true
 	}
 
-	return checkRemotePreloadExists(k8sVersion, containerRuntime)
+	existence := checkRemotePreloadExists(k8sVersion, containerRuntime)
+	setPreloadState(k8sVersion, containerRuntime, existence)
+	return existence
 }
 
 var checkPreloadExists = PreloadExists


Test patch:
diff --git a/pkg/minikube/download/download_test.go b/pkg/minikube/download/download_test.go
index 3cbe19b6f..03099dce7 100644
--- a/pkg/minikube/download/download_test.go
+++ b/pkg/minikube/download/download_test.go
@@ -208,7 +208,6 @@ func testPreloadExistsCaching(t *testing.T) {
 	checkCalled := false
 	checkRemotePreloadExists = func(k8sVersion, containerRuntime string) bool {
 		checkCalled = true
-		setPreloadState(k8sVersion, containerRuntime, doesPreloadExist)
 		return doesPreloadExist
 	}
 	existence := PreloadExists("v1", "c1", "docker", true)
Repository: kubernetes/minikube
Pull request #13189 (2021-12-17 01:00:34)

Add longer default kubelet housekeeping intervals
Related https://github.com/kubernetes/minikube/issues/13166

We're going to do a little trial run before release to see if increasing kubelet's housekeeping intervals improves CPU usage.

Changed `global-housekeeping-interval` from 1 minute to 1 hour and `housekeeping-interval` from 10 seconds to 5 minutes.


Patch:
diff --git a/pkg/minikube/driver/driver.go b/pkg/minikube/driver/driver.go
index 34e277009..6808c862c 100644
--- a/pkg/minikube/driver/driver.go
+++ b/pkg/minikube/driver/driver.go
@@ -235,7 +235,7 @@ type FlagHints struct {
 
 // FlagDefaults returns suggested defaults based on a driver
 func FlagDefaults(name string) FlagHints {
-	fh := FlagHints{}
+	fh := FlagHints{ExtraOptions: []string{"kubelet.global-housekeeping-interval=60m", "kubelet.housekeeping-interval=5m"}}
 	if name != None {
 		fh.CacheImages = true
 		return fh


Test patch:
diff --git a/pkg/minikube/driver/driver_test.go b/pkg/minikube/driver/driver_test.go
index 021f78c74..67855fb50 100644
--- a/pkg/minikube/driver/driver_test.go
+++ b/pkg/minikube/driver/driver_test.go
@@ -85,7 +85,7 @@ func TestMachineType(t *testing.T) {
 }
 
 func TestFlagDefaults(t *testing.T) {
-	expected := FlagHints{CacheImages: true}
+	expected := FlagHints{CacheImages: true, ExtraOptions: []string{"kubelet.global-housekeeping-interval=60m", "kubelet.housekeeping-interval=5m"}}
 	if diff := cmp.Diff(FlagDefaults(VirtualBox), expected); diff != "" {
 		t.Errorf("defaults mismatch (-want +got):\n%s", diff)
 	}
@@ -98,7 +98,7 @@ func TestFlagDefaults(t *testing.T) {
 
 	expected = FlagHints{
 		CacheImages:  false,
-		ExtraOptions: []string{fmt.Sprintf("kubelet.resolv-conf=%s", tf.Name())},
+		ExtraOptions: []string{"kubelet.global-housekeeping-interval=60m", "kubelet.housekeeping-interval=5m", fmt.Sprintf("kubelet.resolv-conf=%s", tf.Name())},
 	}
 	systemdResolvConf = tf.Name()
 	if diff := cmp.Diff(FlagDefaults(None), expected); diff != "" {