Switching from glob library to klog library.

pull/9355/head
Priya Modali 2020-09-29 15:49:41 -07:00
parent 11cad2b3e6
commit 97d96bf925
137 changed files with 1009 additions and 982 deletions

View File

@ -17,8 +17,9 @@ limitations under the License.
package config
import (
"github.com/golang/glog"
"github.com/spf13/cobra"
"k8s.io/klog/v2"
)
// AddonsCmd represents the addons command
@ -28,7 +29,7 @@ var AddonsCmd = &cobra.Command{
Long: `addons modifies minikube addons files using subcommands like "minikube addons enable dashboard"`,
Run: func(cmd *cobra.Command, args []string) {
if err := cmd.Help(); err != nil {
glog.Errorf("help: %v", err)
klog.Errorf("help: %v", err)
}
},
}

View File

@ -23,9 +23,9 @@ import (
"sort"
"strings"
"github.com/golang/glog"
"github.com/olekukonko/tablewriter"
"github.com/spf13/cobra"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/assets"
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/exit"
@ -114,7 +114,7 @@ var printAddonsList = func(cc *config.ClusterConfig) {
v, _, err := config.ListProfiles()
if err != nil {
glog.Errorf("list profiles returned error: %v", err)
klog.Errorf("list profiles returned error: %v", err)
}
if len(v) > 1 {
out.T(style.Tip, "To see addons list for other profiles use: `minikube addons -p name list`")

View File

@ -19,8 +19,8 @@ package config
import (
"strings"
"github.com/golang/glog"
"github.com/spf13/cobra"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/driver"
"k8s.io/minikube/pkg/minikube/localpath"
@ -185,7 +185,7 @@ var ConfigCmd = &cobra.Command{
Configurable fields: ` + "\n\n" + configurableFields(),
Run: func(cmd *cobra.Command, args []string) {
if err := cmd.Help(); err != nil {
glog.Errorf("help: %v", err)
klog.Errorf("help: %v", err)
}
},
}

View File

@ -23,6 +23,7 @@ import (
"strconv"
"strings"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/driver"
"k8s.io/minikube/pkg/minikube/exit"
@ -31,7 +32,6 @@ import (
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/minikube/style"
"github.com/golang/glog"
"github.com/olekukonko/tablewriter"
"github.com/spf13/cobra"
)
@ -68,7 +68,7 @@ var printProfilesTable = func() {
}
api, err := machine.NewAPIClient()
if err != nil {
glog.Errorf("failed to get machine api client %v", err)
klog.Errorf("failed to get machine api client %v", err)
}
defer api.Close()
@ -79,7 +79,7 @@ var printProfilesTable = func() {
}
p.Status, err = machine.Status(api, driver.MachineName(*p.Config, cp))
if err != nil {
glog.Warningf("error getting host status for %s: %v", p.Name, err)
klog.Warningf("error getting host status for %s: %v", p.Name, err)
}
validData = append(validData, []string{p.Name, p.Config.Driver, p.Config.KubernetesConfig.ContainerRuntime, cp.IP, strconv.Itoa(cp.Port), p.Config.KubernetesConfig.KubernetesVersion, p.Status})
}
@ -100,14 +100,14 @@ var printProfilesTable = func() {
}
if err != nil {
glog.Warningf("error loading profiles: %v", err)
klog.Warningf("error loading profiles: %v", err)
}
}
var printProfilesJSON = func() {
api, err := machine.NewAPIClient()
if err != nil {
glog.Errorf("failed to get machine api client %v", err)
klog.Errorf("failed to get machine api client %v", err)
}
defer api.Close()
@ -119,7 +119,7 @@ var printProfilesJSON = func() {
}
status, err := machine.Status(api, driver.MachineName(*v.Config, cp))
if err != nil {
glog.Warningf("error getting host status for %s: %v", v.Name, err)
klog.Warningf("error getting host status for %s: %v", v.Name, err)
}
v.Status = status
}

View File

@ -23,8 +23,8 @@ import (
"os"
"strings"
"github.com/golang/glog"
"golang.org/x/crypto/ssh/terminal"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/out"
)
@ -127,7 +127,7 @@ func AskForPasswordValue(s string) string {
}
defer func() {
if err := terminal.Restore(stdInFd, oldState); err != nil {
glog.Errorf("terminal restore failed: %v", err)
klog.Errorf("terminal restore failed: %v", err)
}
}()

View File

@ -26,9 +26,9 @@ import (
"regexp"
"time"
"github.com/golang/glog"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/addons"
"k8s.io/minikube/pkg/minikube/assets"
"k8s.io/minikube/pkg/minikube/style"
@ -61,7 +61,7 @@ var dashboardCmd = &cobra.Command{
for _, n := range co.Config.Nodes {
if err := proxy.ExcludeIP(n.IP); err != nil {
glog.Errorf("Error excluding IP from proxy: %s", err)
klog.Errorf("Error excluding IP from proxy: %s", err)
}
}
@ -118,9 +118,9 @@ var dashboardCmd = &cobra.Command{
}
}
glog.Infof("Success! I will now quietly sit around until kubectl proxy exits!")
klog.Infof("Success! I will now quietly sit around until kubectl proxy exits!")
if err = p.Wait(); err != nil {
glog.Errorf("Wait: %v", err)
klog.Errorf("Wait: %v", err)
}
},
}
@ -143,12 +143,12 @@ func kubectlProxy(kubectlVersion string, contextName string) (*exec.Cmd, string,
return nil, "", errors.Wrap(err, "cmd stdout")
}
glog.Infof("Executing: %s %s", cmd.Path, cmd.Args)
klog.Infof("Executing: %s %s", cmd.Path, cmd.Args)
if err := cmd.Start(); err != nil {
return nil, "", errors.Wrap(err, "proxy start")
}
glog.Infof("Waiting for kubectl to output host:port ...")
klog.Infof("Waiting for kubectl to output host:port ...")
reader := bufio.NewReader(stdoutPipe)
var out []byte
@ -161,12 +161,12 @@ func kubectlProxy(kubectlVersion string, contextName string) (*exec.Cmd, string,
break
}
if timedOut {
glog.Infof("timed out waiting for input: possibly due to an old kubectl version.")
klog.Infof("timed out waiting for input: possibly due to an old kubectl version.")
break
}
out = append(out, r)
}
glog.Infof("proxy stdout: %s", string(out))
klog.Infof("proxy stdout: %s", string(out))
return cmd, hostPortRe.FindString(string(out)), nil
}
@ -203,7 +203,7 @@ func dashboardURL(proxy string, ns string, svc string) string {
// checkURL checks if a URL returns 200 HTTP OK
func checkURL(url string) error {
resp, err := http.Get(url)
glog.Infof("%s response: %v %+v", url, err, resp)
klog.Infof("%s response: %v %+v", url, err, resp)
if err != nil {
return errors.Wrap(err, "checkURL")
}

View File

@ -25,13 +25,13 @@ import (
"strconv"
"github.com/docker/machine/libmachine/mcnerror"
"github.com/golang/glog"
"github.com/mitchellh/go-ps"
"github.com/pkg/errors"
"github.com/docker/machine/libmachine"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"k8s.io/klog/v2"
cmdcfg "k8s.io/minikube/cmd/minikube/cmd/config"
"k8s.io/minikube/pkg/drivers/kic/oci"
"k8s.io/minikube/pkg/minikube/cluster"
@ -96,21 +96,21 @@ func init() {
// shotgun cleanup to delete orphaned docker container data
func deleteContainersAndVolumes(ociBin string) {
if _, err := exec.LookPath(ociBin); err != nil {
glog.Infof("skipping deleteContainersAndVolumes for %s: %v", ociBin, err)
klog.Infof("skipping deleteContainersAndVolumes for %s: %v", ociBin, err)
return
}
glog.Infof("deleting containers and volumes ...")
klog.Infof("deleting containers and volumes ...")
delLabel := fmt.Sprintf("%s=%s", oci.CreatedByLabelKey, "true")
errs := oci.DeleteContainersByLabel(ociBin, delLabel)
if len(errs) > 0 { // it will error if there is no container to delete
glog.Infof("error delete containers by label %q (might be okay): %+v", delLabel, errs)
klog.Infof("error delete containers by label %q (might be okay): %+v", delLabel, errs)
}
errs = oci.DeleteAllVolumesByLabel(ociBin, delLabel)
if len(errs) > 0 { // it will not error if there is nothing to delete
glog.Warningf("error delete volumes by label %q (might be okay): %+v", delLabel, errs)
klog.Warningf("error delete volumes by label %q (might be okay): %+v", delLabel, errs)
}
if ociBin == oci.Podman {
@ -120,7 +120,7 @@ func deleteContainersAndVolumes(ociBin string) {
errs = oci.PruneAllVolumesByLabel(ociBin, delLabel)
if len(errs) > 0 { // it will not error if there is nothing to delete
glog.Warningf("error pruning volumes by label %q (might be okay): %+v", delLabel, errs)
klog.Warningf("error pruning volumes by label %q (might be okay): %+v", delLabel, errs)
}
}
@ -134,7 +134,7 @@ func runDelete(cmd *cobra.Command, args []string) {
validProfiles, invalidProfiles, err := config.ListProfiles()
if err != nil {
glog.Warningf("'error loading profiles in minikube home %q: %v", localpath.MiniPath(), err)
klog.Warningf("'error loading profiles in minikube home %q: %v", localpath.MiniPath(), err)
}
profilesToDelete := append(validProfiles, invalidProfiles...)
// in the case user has more than 1 profile and runs --purge
@ -194,7 +194,7 @@ func runDelete(cmd *cobra.Command, args []string) {
}
func purgeMinikubeDirectory() {
glog.Infof("Purging the '.minikube' directory located at %s", localpath.MiniPath())
klog.Infof("Purging the '.minikube' directory located at %s", localpath.MiniPath())
if err := os.RemoveAll(localpath.MiniPath()); err != nil {
exit.Error(reason.HostPurge, "unable to delete minikube config folder", err)
}
@ -203,7 +203,7 @@ func purgeMinikubeDirectory() {
// DeleteProfiles deletes one or more profiles
func DeleteProfiles(profiles []*config.Profile) []error {
glog.Infof("DeleteProfiles")
klog.Infof("DeleteProfiles")
var errs []error
for _, profile := range profiles {
err := deleteProfile(profile)
@ -236,11 +236,11 @@ func deletePossibleKicLeftOver(cname string, driverName string) {
}
if _, err := exec.LookPath(bin); err != nil {
glog.Infof("skipping deletePossibleKicLeftOver for %s: %v", bin, err)
klog.Infof("skipping deletePossibleKicLeftOver for %s: %v", bin, err)
return
}
glog.Infof("deleting possible KIC leftovers for %s (driver=%s) ...", cname, driverName)
klog.Infof("deleting possible KIC leftovers for %s (driver=%s) ...", cname, driverName)
delLabel := fmt.Sprintf("%s=%s", oci.ProfileLabelKey, cname)
cs, err := oci.ListContainersByLabel(bin, delLabel)
@ -249,7 +249,7 @@ func deletePossibleKicLeftOver(cname string, driverName string) {
out.T(style.DeletingHost, `Deleting container "{{.name}}" ...`, out.V{"name": cname})
err := oci.DeleteContainer(bin, c)
if err != nil { // it will error if there is no container to delete
glog.Errorf("error deleting container %q. You may want to delete it manually :\n%v", cname, err)
klog.Errorf("error deleting container %q. You may want to delete it manually :\n%v", cname, err)
}
}
@ -257,7 +257,7 @@ func deletePossibleKicLeftOver(cname string, driverName string) {
errs := oci.DeleteAllVolumesByLabel(bin, delLabel)
if errs != nil { // it will not error if there is nothing to delete
glog.Warningf("error deleting volumes (might be okay).\nTo see the list of volumes run: 'docker volume ls'\n:%v", errs)
klog.Warningf("error deleting volumes (might be okay).\nTo see the list of volumes run: 'docker volume ls'\n:%v", errs)
}
if bin == oci.Podman {
@ -267,17 +267,17 @@ func deletePossibleKicLeftOver(cname string, driverName string) {
errs = oci.PruneAllVolumesByLabel(bin, delLabel)
if len(errs) > 0 { // it will not error if there is nothing to delete
glog.Warningf("error pruning volume (might be okay):\n%v", errs)
klog.Warningf("error pruning volume (might be okay):\n%v", errs)
}
}
func deleteProfile(profile *config.Profile) error {
glog.Infof("Deleting %s", profile.Name)
klog.Infof("Deleting %s", profile.Name)
register.Reg.SetStep(register.Deleting)
viper.Set(config.ProfileName, profile.Name)
if profile.Config != nil {
glog.Infof("%s configuration: %+v", profile.Name, profile.Config)
klog.Infof("%s configuration: %+v", profile.Name, profile.Config)
// if driver is oci driver, delete containers and volumes
if driver.IsKIC(profile.Config.Driver) {
@ -288,7 +288,7 @@ func deleteProfile(profile *config.Profile) error {
}
}
} else {
glog.Infof("%s has no configuration, will try to make it work anyways", profile.Name)
klog.Infof("%s has no configuration, will try to make it work anyways", profile.Name)
}
api, err := machine.NewAPIClient()
@ -345,7 +345,7 @@ func deleteHosts(api libmachine.API, cc *config.ClusterConfig) {
if err := machine.DeleteHost(api, machineName); err != nil {
switch errors.Cause(err).(type) {
case mcnerror.ErrHostDoesNotExist:
glog.Infof("Host %s does not exist. Proceeding ahead with cleanup.", machineName)
klog.Infof("Host %s does not exist. Proceeding ahead with cleanup.", machineName)
default:
out.FailureT("Failed to delete cluster: {{.error}}", out.V{"error": err})
out.T(style.Notice, `You may need to manually remove the "{{.name}}" VM from your hypervisor`, out.V{"name": machineName})
@ -429,7 +429,7 @@ func uninstallKubernetes(api libmachine.API, cc config.ClusterConfig, n config.N
// Unpause the cluster if necessary to avoid hung kubeadm
_, err = cluster.Unpause(cr, r, nil)
if err != nil {
glog.Errorf("unpause failed: %v", err)
klog.Errorf("unpause failed: %v", err)
}
if err = clusterBootstrapper.DeleteCluster(cc.KubernetesConfig); err != nil {
@ -473,7 +473,7 @@ func handleMultipleDeletionErrors(errors []error) {
deletionError, ok := err.(DeletionError)
if ok {
glog.Errorln(deletionError.Error())
klog.Errorln(deletionError.Error())
} else {
exit.Error(reason.GuestDeletion, "Could not process errors from failed deletion", err)
}
@ -498,12 +498,12 @@ func killMountProcess() error {
return nil
}
glog.Infof("Found %s ...", pidPath)
klog.Infof("Found %s ...", pidPath)
out, err := ioutil.ReadFile(pidPath)
if err != nil {
return errors.Wrap(err, "ReadFile")
}
glog.Infof("pidfile contents: %s", out)
klog.Infof("pidfile contents: %s", out)
pid, err := strconv.Atoi(string(out))
if err != nil {
return errors.Wrap(err, "error parsing pid")
@ -514,7 +514,7 @@ func killMountProcess() error {
return errors.Wrap(err, "ps.FindProcess")
}
if entry == nil {
glog.Infof("Stale pid: %d", pid)
klog.Infof("Stale pid: %d", pid)
if err := os.Remove(pidPath); err != nil {
return errors.Wrap(err, "Removing stale pid")
}
@ -522,15 +522,15 @@ func killMountProcess() error {
}
// We found a process, but it still may not be ours.
glog.Infof("Found process %d: %s", pid, entry.Executable())
klog.Infof("Found process %d: %s", pid, entry.Executable())
proc, err := os.FindProcess(pid)
if err != nil {
return errors.Wrap(err, "os.FindProcess")
}
glog.Infof("Killing pid %d ...", pid)
klog.Infof("Killing pid %d ...", pid)
if err := proc.Kill(); err != nil {
glog.Infof("Kill failed with %v - removing probably stale pid...", err)
klog.Infof("Kill failed with %v - removing probably stale pid...", err)
if err := os.Remove(pidPath); err != nil {
return errors.Wrap(err, "Removing likely stale unkillable pid")
}

View File

@ -28,8 +28,8 @@ import (
"strconv"
"strings"
"github.com/golang/glog"
"github.com/spf13/cobra"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/drivers/kic/oci"
"k8s.io/minikube/pkg/minikube/command"
"k8s.io/minikube/pkg/minikube/constants"
@ -163,7 +163,7 @@ var dockerEnvCmd = &cobra.Command{
}
if ok := isDockerActive(co.CP.Runner); !ok {
glog.Warningf("dockerd is not active will try to restart it...")
klog.Warningf("dockerd is not active will try to restart it...")
mustRestartDocker(cname, co.CP.Runner)
}
@ -195,7 +195,7 @@ var dockerEnvCmd = &cobra.Command{
dockerPath, err := exec.LookPath("docker")
if err != nil {
glog.Warningf("Unable to find docker in path - skipping connectivity check: %v", err)
klog.Warningf("Unable to find docker in path - skipping connectivity check: %v", err)
dockerPath = ""
}
@ -203,7 +203,7 @@ var dockerEnvCmd = &cobra.Command{
out, err := tryDockerConnectivity("docker", ec)
if err != nil { // docker might be up but been loaded with wrong certs/config
// to fix issues like this #8185
glog.Warningf("couldn't connect to docker inside minikube. will try to restart dockerd service... output: %s error: %v", string(out), err)
klog.Warningf("couldn't connect to docker inside minikube. will try to restart dockerd service... output: %s error: %v", string(out), err)
mustRestartDocker(cname, co.CP.Runner)
}
}
@ -281,7 +281,7 @@ func dockerEnvVarsList(ec DockerEnvConfig) []string {
func tryDockerConnectivity(bin string, ec DockerEnvConfig) ([]byte, error) {
c := exec.Command(bin, "version", "--format={{.Server}}")
c.Env = append(os.Environ(), dockerEnvVarsList(ec)...)
glog.Infof("Testing Docker connectivity with: %v", c)
klog.Infof("Testing Docker connectivity with: %v", c)
return c.CombinedOutput()
}

View File

@ -22,8 +22,8 @@ import (
"os/exec"
"syscall"
"github.com/golang/glog"
"github.com/spf13/cobra"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/mustload"
"k8s.io/minikube/pkg/minikube/node"
@ -48,7 +48,7 @@ minikube kubectl -- get pods --namespace kube-system`,
out.ErrLn("Error caching kubectl: %v", err)
}
glog.Infof("Running %s %v", c.Path, args)
klog.Infof("Running %s %v", c.Path, args)
c.Stdin = os.Stdin
c.Stdout = os.Stdout
c.Stderr = os.Stderr

View File

@ -27,9 +27,9 @@ import (
"sync"
"syscall"
"github.com/golang/glog"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/cluster"
"k8s.io/minikube/pkg/minikube/driver"
"k8s.io/minikube/pkg/minikube/exit"
@ -98,7 +98,7 @@ var mountCmd = &cobra.Command{
exit.Message(reason.Usage, "Target directory {{.path}} must be an absolute path", out.V{"path": vmPath})
}
var debugVal int
if glog.V(1) {
if klog.V(1).Enabled() {
debugVal = 1 // ufs.StartServer takes int debug param
}

View File

@ -20,8 +20,8 @@ import (
"fmt"
"os"
"github.com/golang/glog"
"github.com/spf13/cobra"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/driver"
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/mustload"
@ -41,9 +41,9 @@ var nodeListCmd = &cobra.Command{
_, cc := mustload.Partial(cname)
if len(cc.Nodes) < 1 {
glog.Warningf("Did not found any minikube node.")
klog.Warningf("Did not found any minikube node.")
} else {
glog.Infof("%v", cc.Nodes)
klog.Infof("%v", cc.Nodes)
}
for _, n := range cc.Nodes {

View File

@ -19,10 +19,10 @@ package cmd
import (
"strings"
"github.com/golang/glog"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/cluster"
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/cruntime"
@ -54,7 +54,7 @@ func runPause(cmd *cobra.Command, args []string) {
register.SetEventLogPath(localpath.EventLog(ClusterFlagValue()))
register.Reg.SetStep(register.Pausing)
glog.Infof("namespaces: %v keys: %v", namespaces, viper.AllSettings())
klog.Infof("namespaces: %v keys: %v", namespaces, viper.AllSettings())
if allNamespaces {
namespaces = nil // all
} else if len(namespaces) == 0 {

View File

@ -24,10 +24,10 @@ import (
"runtime"
"strings"
"github.com/golang/glog"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"github.com/spf13/viper"
"k8s.io/klog/v2"
"k8s.io/kubectl/pkg/util/templates"
configCmd "k8s.io/minikube/cmd/minikube/cmd/config"
"k8s.io/minikube/pkg/drivers/kic/oci"
@ -103,11 +103,11 @@ func Execute() {
// Universally ensure that we never speak to the wrong DOCKER_HOST
if err := oci.PointToHostDockerDaemon(); err != nil {
glog.Errorf("oci env: %v", err)
klog.Errorf("oci env: %v", err)
}
if err := oci.PointToHostPodman(); err != nil {
glog.Errorf("oci env: %v", err)
klog.Errorf("oci env: %v", err)
}
if err := RootCmd.Execute(); err != nil {
@ -249,7 +249,7 @@ func initConfig() {
if err := viper.ReadInConfig(); err != nil {
// This config file is optional, so don't emit errors if missing
if _, ok := err.(viper.ConfigFileNotFoundError); !ok {
glog.Warningf("Error reading config file at %s: %v", configPath, err)
klog.Warningf("Error reading config file at %s: %v", configPath, err)
}
}
setupViper()
@ -275,6 +275,6 @@ func setupViper() {
func addToPath(dir string) {
new := fmt.Sprintf("%s:%s", dir, os.Getenv("PATH"))
glog.Infof("Updating PATH: %s", dir)
klog.Infof("Updating PATH: %s", dir)
os.Setenv("PATH", new)
}

View File

@ -29,9 +29,9 @@ import (
"text/template"
"time"
"github.com/golang/glog"
"github.com/spf13/cobra"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/drivers/kic/oci"
"k8s.io/minikube/pkg/kapi"
"k8s.io/minikube/pkg/minikube/browser"
@ -154,7 +154,7 @@ func openURLs(svc string, urls []string) {
for _, u := range urls {
_, err := url.Parse(u)
if err != nil {
glog.Warningf("failed to parse url %q: %v (will not open)", u, err)
klog.Warningf("failed to parse url %q: %v (will not open)", u, err)
out.String(fmt.Sprintf("%s\n", u))
continue
}

View File

@ -30,7 +30,6 @@ import (
"github.com/blang/semver"
"github.com/docker/machine/libmachine/ssh"
"github.com/golang/glog"
"github.com/google/go-containerregistry/pkg/authn"
"github.com/google/go-containerregistry/pkg/name"
"github.com/google/go-containerregistry/pkg/v1/remote"
@ -40,6 +39,7 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/viper"
"k8s.io/klog/v2"
cmdcfg "k8s.io/minikube/cmd/minikube/cmd/config"
"k8s.io/minikube/pkg/drivers/kic/oci"
"k8s.io/minikube/pkg/minikube/bootstrapper/bsutil"
@ -100,17 +100,17 @@ func platform() string {
hi, err := gopshost.Info()
if err == nil {
s.WriteString(fmt.Sprintf("%s %s", strings.Title(hi.Platform), hi.PlatformVersion))
glog.Infof("hostinfo: %+v", hi)
klog.Infof("hostinfo: %+v", hi)
} else {
glog.Warningf("gopshost.Info returned error: %v", err)
klog.Warningf("gopshost.Info returned error: %v", err)
s.WriteString(runtime.GOOS)
}
vsys, vrole, err := gopshost.Virtualization()
if err != nil {
glog.Warningf("gopshost.Virtualization returned error: %v", err)
klog.Warningf("gopshost.Virtualization returned error: %v", err)
} else {
glog.Infof("virtualization: %s %s", vsys, vrole)
klog.Infof("virtualization: %s %s", vsys, vrole)
}
// This environment is exotic, let's output a bit more.
@ -207,7 +207,7 @@ func runStart(cmd *cobra.Command, args []string) {
// Delete the existing cluster and try again with the next driver on the list
profile, err := config.LoadProfile(ClusterFlagValue())
if err != nil {
glog.Warningf("%s profile does not exist, trying anyways.", ClusterFlagValue())
klog.Warningf("%s profile does not exist, trying anyways.", ClusterFlagValue())
}
err = deleteProfile(profile)
@ -260,17 +260,17 @@ func runStart(cmd *cobra.Command, args []string) {
}
if err := showKubectlInfo(kubeconfig, starter.Node.KubernetesVersion, starter.Cfg.Name); err != nil {
glog.Errorf("kubectl info: %v", err)
klog.Errorf("kubectl info: %v", err)
}
}
func provisionWithDriver(cmd *cobra.Command, ds registry.DriverState, existing *config.ClusterConfig) (node.Starter, error) {
driverName := ds.Name
glog.Infof("selected driver: %s", driverName)
klog.Infof("selected driver: %s", driverName)
validateDriver(ds, existing)
err := autoSetDriverOptions(cmd, driverName)
if err != nil {
glog.Errorf("Error autoSetOptions : %v", err)
klog.Errorf("Error autoSetOptions : %v", err)
}
validateFlags(cmd, driverName)
@ -455,7 +455,7 @@ func showKubectlInfo(kcs *kubeconfig.Settings, k8sVersion string, machineName st
cluster := semver.MustParse(strings.TrimPrefix(k8sVersion, version.VersionPrefix))
minorSkew := int(math.Abs(float64(int(client.Minor) - int(cluster.Minor))))
glog.Infof("kubectl: %s, cluster: %s (minor skew: %d)", client, cluster, minorSkew)
klog.Infof("kubectl: %s, cluster: %s (minor skew: %d)", client, cluster, minorSkew)
if client.Major != cluster.Major || minorSkew > 1 {
out.Ln("")
@ -611,19 +611,19 @@ func hostDriver(existing *config.ClusterConfig) string {
}
api, err := machine.NewAPIClient()
if err != nil {
glog.Warningf("selectDriver NewAPIClient: %v", err)
klog.Warningf("selectDriver NewAPIClient: %v", err)
return existing.Driver
}
cp, err := config.PrimaryControlPlane(existing)
if err != nil {
glog.Warningf("Unable to get control plane from existing config: %v", err)
klog.Warningf("Unable to get control plane from existing config: %v", err)
return existing.Driver
}
machineName := driver.MachineName(*existing, cp)
h, err := api.Load(machineName)
if err != nil {
glog.Warningf("api.Load failed for %s: %v", machineName, err)
klog.Warningf("api.Load failed for %s: %v", machineName, err)
if existing.VMDriver != "" {
return existing.VMDriver
}
@ -674,7 +674,7 @@ func validateSpecifiedDriver(existing *config.ClusterConfig) {
// validateDriver validates that the selected driver appears sane, exits if not
func validateDriver(ds registry.DriverState, existing *config.ClusterConfig) {
name := ds.Name
glog.Infof("validating driver %q against %+v", name, existing)
klog.Infof("validating driver %q against %+v", name, existing)
if !driver.Supported(name) {
exit.Message(reason.DrvUnsupportedOS, "The driver '{{.driver}}' is not supported on {{.os}}", out.V{"driver": name, "os": runtime.GOOS})
}
@ -685,7 +685,7 @@ func validateDriver(ds registry.DriverState, existing *config.ClusterConfig) {
}
st := ds.State
glog.Infof("status for %s: %+v", name, st)
klog.Infof("status for %s: %+v", name, st)
if st.NeedsImprovement {
out.T(style.Improvement, `For improved {{.driver}} performance, {{.fix}}`, out.V{"driver": driver.FullName(ds.Name), "fix": translate.T(st.Fix)})
@ -725,7 +725,7 @@ func validateDriver(ds registry.DriverState, existing *config.ClusterConfig) {
func selectImageRepository(mirrorCountry string, v semver.Version) (bool, string, error) {
var tryCountries []string
var fallback string
glog.Infof("selecting image repository for country %s ...", mirrorCountry)
klog.Infof("selecting image repository for country %s ...", mirrorCountry)
if mirrorCountry != "" {
localRepos, ok := constants.ImageRepositories[mirrorCountry]
@ -777,7 +777,7 @@ func selectImageRepository(mirrorCountry string, v semver.Version) (bool, string
func validateUser(drvName string) {
u, err := user.Current()
if err != nil {
glog.Errorf("Error getting the current user: %v", err)
klog.Errorf("Error getting the current user: %v", err)
return
}
@ -811,10 +811,10 @@ func validateUser(drvName string) {
func memoryLimits(drvName string) (int, int, error) {
info, cpuErr, memErr, diskErr := machine.CachedHostInfo()
if cpuErr != nil {
glog.Warningf("could not get system cpu info while verifying memory limits, which might be okay: %v", cpuErr)
klog.Warningf("could not get system cpu info while verifying memory limits, which might be okay: %v", cpuErr)
}
if diskErr != nil {
glog.Warningf("could not get system disk info while verifying memory limits, which might be okay: %v", diskErr)
klog.Warningf("could not get system disk info while verifying memory limits, which might be okay: %v", diskErr)
}
if memErr != nil {
@ -878,7 +878,7 @@ func validateRequestedMemorySize(req int, drvName string) {
// TODO: Fix MB vs MiB confusion
sysLimit, containerLimit, err := memoryLimits(drvName)
if err != nil {
glog.Warningf("Unable to query memory limits: %v", err)
klog.Warningf("Unable to query memory limits: %v", err)
}
// Detect if their system doesn't have enough memory to work with.
@ -935,7 +935,7 @@ func validateCPUCount(drvName string) {
// Uses the gopsutil cpu package to count the number of physical cpu cores
ci, err := cpu.Counts(false)
if err != nil {
glog.Warningf("Unable to get CPU info: %v", err)
klog.Warningf("Unable to get CPU info: %v", err)
} else {
cpuCount = ci
}
@ -1085,7 +1085,7 @@ func validateRegistryMirror() {
for _, loc := range registryMirror {
URL, err := url.Parse(loc)
if err != nil {
glog.Errorln("Error Parsing URL: ", err)
klog.Errorln("Error Parsing URL: ", err)
}
if (URL.Scheme != "http" && URL.Scheme != "https") || URL.Path != "" {
exit.Message(reason.Usage, "Sorry, the url provided with the --registry-mirror flag is invalid: {{.url}}", out.V{"url": loc})
@ -1134,10 +1134,10 @@ func autoSetDriverOptions(cmd *cobra.Command, drvName string) (err error) {
if len(hints.ExtraOptions) > 0 {
for _, eo := range hints.ExtraOptions {
if config.ExtraOptions.Exists(eo) {
glog.Infof("skipping extra-config %q.", eo)
klog.Infof("skipping extra-config %q.", eo)
continue
}
glog.Infof("auto setting extra-config to %q.", eo)
klog.Infof("auto setting extra-config to %q.", eo)
err = config.ExtraOptions.Set(eo)
if err != nil {
err = errors.Wrapf(err, "setting extra option %s", eo)
@ -1151,12 +1151,12 @@ func autoSetDriverOptions(cmd *cobra.Command, drvName string) (err error) {
if !cmd.Flags().Changed(containerRuntime) && hints.ContainerRuntime != "" {
viper.Set(containerRuntime, hints.ContainerRuntime)
glog.Infof("auto set %s to %q.", containerRuntime, hints.ContainerRuntime)
klog.Infof("auto set %s to %q.", containerRuntime, hints.ContainerRuntime)
}
if !cmd.Flags().Changed(cmdcfg.Bootstrapper) && hints.Bootstrapper != "" {
viper.Set(cmdcfg.Bootstrapper, hints.Bootstrapper)
glog.Infof("auto set %s to %q.", cmdcfg.Bootstrapper, hints.Bootstrapper)
klog.Infof("auto set %s to %q.", cmdcfg.Bootstrapper, hints.Bootstrapper)
}
@ -1190,7 +1190,7 @@ func validateKubernetesVersion(old *config.ClusterConfig) {
ovs, err := semver.Make(strings.TrimPrefix(old.KubernetesConfig.KubernetesVersion, version.VersionPrefix))
if err != nil {
glog.Errorf("Error parsing old version %q: %v", old.KubernetesConfig.KubernetesVersion, err)
klog.Errorf("Error parsing old version %q: %v", old.KubernetesConfig.KubernetesVersion, err)
}
if nvs.LT(ovs) {
@ -1246,7 +1246,7 @@ func validateDockerStorageDriver(drvName string) {
}
si, err := oci.DaemonInfo(drvName)
if err != nil {
glog.Warningf("Unable to confirm that %s is using overlay2 storage driver; setting preload=false", drvName)
klog.Warningf("Unable to confirm that %s is using overlay2 storage driver; setting preload=false", drvName)
viper.Set(preload, false)
return
}

View File

@ -22,10 +22,10 @@ import (
"time"
"github.com/blang/semver"
"github.com/golang/glog"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/drivers/kic"
"k8s.io/minikube/pkg/minikube/bootstrapper/bsutil"
"k8s.io/minikube/pkg/minikube/bootstrapper/bsutil/kverify"
@ -221,10 +221,10 @@ func generateClusterConfig(cmd *cobra.Command, existing *config.ClusterConfig, k
if existing != nil {
cc = updateExistingConfigFromFlags(cmd, existing)
} else {
glog.Info("no existing cluster config was found, will generate one from the flags ")
klog.Info("no existing cluster config was found, will generate one from the flags ")
sysLimit, containerLimit, err := memoryLimits(drvName)
if err != nil {
glog.Warningf("Unable to query memory limits: %+v", err)
klog.Warningf("Unable to query memory limits: %+v", err)
}
mem := suggestMemoryAllocation(sysLimit, containerLimit, viper.GetInt(nodes))
@ -239,7 +239,7 @@ func generateClusterConfig(cmd *cobra.Command, existing *config.ClusterConfig, k
}
} else {
validateRequestedMemorySize(mem, drvName)
glog.Infof("Using suggested %dMB memory alloc based on sys=%dMB, container=%dMB", mem, sysLimit, containerLimit)
klog.Infof("Using suggested %dMB memory alloc based on sys=%dMB, container=%dMB", mem, sysLimit, containerLimit)
}
diskSize, err := pkgutil.CalculateSizeInMB(viper.GetString(humanReadableDiskSize))
@ -273,7 +273,7 @@ func generateClusterConfig(cmd *cobra.Command, existing *config.ClusterConfig, k
// Backwards compatibility with --enable-default-cni
chosenCNI := viper.GetString(cniFlag)
if viper.GetBool(enableDefaultCNI) && !cmd.Flags().Changed(cniFlag) {
glog.Errorf("Found deprecated --enable-default-cni flag, setting --cni=bridge")
klog.Errorf("Found deprecated --enable-default-cni flag, setting --cni=bridge")
chosenCNI = "bridge"
}
@ -340,12 +340,12 @@ func generateClusterConfig(cmd *cobra.Command, existing *config.ClusterConfig, k
}
if _, ok := cnm.(cni.Disabled); !ok {
glog.Infof("Found %q CNI - setting NetworkPlugin=cni", cnm)
klog.Infof("Found %q CNI - setting NetworkPlugin=cni", cnm)
cc.KubernetesConfig.NetworkPlugin = "cni"
}
}
glog.Infof("config:\n%+v", cc)
klog.Infof("config:\n%+v", cc)
r, err := cruntime.New(cruntime.Config{Type: cc.KubernetesConfig.ContainerRuntime})
if err != nil {
@ -372,19 +372,19 @@ func upgradeExistingConfig(cc *config.ClusterConfig) {
}
if cc.VMDriver != "" && cc.Driver == "" {
glog.Infof("config upgrade: Driver=%s", cc.VMDriver)
klog.Infof("config upgrade: Driver=%s", cc.VMDriver)
cc.Driver = cc.VMDriver
}
if cc.Name == "" {
glog.Infof("config upgrade: Name=%s", ClusterFlagValue())
klog.Infof("config upgrade: Name=%s", ClusterFlagValue())
cc.Name = ClusterFlagValue()
}
if cc.KicBaseImage == "" {
// defaults to kic.BaseImage
cc.KicBaseImage = viper.GetString(kicBaseImage)
glog.Infof("config upgrade: KicBaseImage=%s", cc.KicBaseImage)
klog.Infof("config upgrade: KicBaseImage=%s", cc.KicBaseImage)
}
}
@ -413,10 +413,10 @@ func updateExistingConfigFromFlags(cmd *cobra.Command, existing *config.ClusterC
}
if cc.Memory == 0 {
glog.Info("Existing config file was missing memory. (could be an old minikube config), will use the default value")
klog.Info("Existing config file was missing memory. (could be an old minikube config), will use the default value")
memInMB, err := pkgutil.CalculateSizeInMB(viper.GetString(memory))
if err != nil {
glog.Warningf("error calculate memory size in mb : %v", err)
klog.Warningf("error calculate memory size in mb : %v", err)
}
cc.Memory = memInMB
}
@ -424,7 +424,7 @@ func updateExistingConfigFromFlags(cmd *cobra.Command, existing *config.ClusterC
if cmd.Flags().Changed(memory) {
memInMB, err := pkgutil.CalculateSizeInMB(viper.GetString(memory))
if err != nil {
glog.Warningf("error calculate memory size in mb : %v", err)
klog.Warningf("error calculate memory size in mb : %v", err)
}
if memInMB != cc.Memory {
out.WarningT("You cannot change the memory size for an exiting minikube cluster. Please first delete the cluster.")
@ -435,7 +435,7 @@ func updateExistingConfigFromFlags(cmd *cobra.Command, existing *config.ClusterC
validateRequestedMemorySize(cc.Memory, cc.Driver)
if cc.CPUs == 0 {
glog.Info("Existing config file was missing cpu. (could be an old minikube config), will use the default value")
klog.Info("Existing config file was missing cpu. (could be an old minikube config), will use the default value")
cc.CPUs = viper.GetInt(cpus)
}
if cmd.Flags().Changed(cpus) {
@ -447,7 +447,7 @@ func updateExistingConfigFromFlags(cmd *cobra.Command, existing *config.ClusterC
if cmd.Flags().Changed(humanReadableDiskSize) {
memInMB, err := pkgutil.CalculateSizeInMB(viper.GetString(humanReadableDiskSize))
if err != nil {
glog.Warningf("error calculate disk size in mb : %v", err)
klog.Warningf("error calculate disk size in mb : %v", err)
}
if memInMB != existing.DiskSize {
@ -589,7 +589,7 @@ func updateExistingConfigFromFlags(cmd *cobra.Command, existing *config.ClusterC
if cmd.Flags().Changed(enableDefaultCNI) && !cmd.Flags().Changed(cniFlag) {
if viper.GetBool(enableDefaultCNI) {
glog.Errorf("Found deprecated --enable-default-cni flag, setting --cni=bridge")
klog.Errorf("Found deprecated --enable-default-cni flag, setting --cni=bridge")
cc.KubernetesConfig.CNI = "bridge"
}
}
@ -614,25 +614,25 @@ func updateExistingConfigFromFlags(cmd *cobra.Command, existing *config.ClusterC
// returns map of components to wait for
func interpretWaitFlag(cmd cobra.Command) map[string]bool {
if !cmd.Flags().Changed(waitComponents) {
glog.Infof("Wait components to verify : %+v", kverify.DefaultComponents)
klog.Infof("Wait components to verify : %+v", kverify.DefaultComponents)
return kverify.DefaultComponents
}
waitFlags, err := cmd.Flags().GetStringSlice(waitComponents)
if err != nil {
glog.Warningf("Failed to read --wait from flags: %v.\n Moving on will use the default wait components: %+v", err, kverify.DefaultComponents)
klog.Warningf("Failed to read --wait from flags: %v.\n Moving on will use the default wait components: %+v", err, kverify.DefaultComponents)
return kverify.DefaultComponents
}
if len(waitFlags) == 1 {
// respecting legacy flag before minikube 1.9.0, wait flag was boolean
if waitFlags[0] == "false" || waitFlags[0] == "none" {
glog.Infof("Waiting for no components: %+v", kverify.NoComponents)
klog.Infof("Waiting for no components: %+v", kverify.NoComponents)
return kverify.NoComponents
}
// respecting legacy flag before minikube 1.9.0, wait flag was boolean
if waitFlags[0] == "true" || waitFlags[0] == "all" {
glog.Infof("Waiting for all components: %+v", kverify.AllComponents)
klog.Infof("Waiting for all components: %+v", kverify.AllComponents)
return kverify.AllComponents
}
}
@ -648,9 +648,9 @@ func interpretWaitFlag(cmd cobra.Command) map[string]bool {
}
}
if !seen {
glog.Warningf("The value %q is invalid for --wait flag. valid options are %q", wc, strings.Join(kverify.AllComponentsList, ","))
klog.Warningf("The value %q is invalid for --wait flag. valid options are %q", wc, strings.Join(kverify.AllComponentsList, ","))
}
}
glog.Infof("Waiting for components: %+v", waitComponents)
klog.Infof("Waiting for components: %+v", waitComponents)
return waitComponents
}

View File

@ -31,9 +31,9 @@ import (
"github.com/docker/machine/libmachine"
"github.com/docker/machine/libmachine/state"
"github.com/golang/glog"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/bootstrapper/bsutil/kverify"
"k8s.io/minikube/pkg/minikube/cluster"
"k8s.io/minikube/pkg/minikube/config"
@ -202,21 +202,21 @@ var statusCmd = &cobra.Command{
st, err := nodeStatus(api, *cc, *n)
if err != nil {
glog.Errorf("status error: %v", err)
klog.Errorf("status error: %v", err)
}
statuses = append(statuses, st)
} else {
for _, n := range cc.Nodes {
machineName := driver.MachineName(*cc, n)
glog.Infof("checking status of %s ...", machineName)
klog.Infof("checking status of %s ...", machineName)
st, err := nodeStatus(api, *cc, n)
glog.Infof("%s status: %+v", machineName, st)
klog.Infof("%s status: %+v", machineName, st)
if err != nil {
glog.Errorf("status error: %v", err)
klog.Errorf("status error: %v", err)
}
if st.Host == Nonexistent {
glog.Errorf("The %q host does not exist!", machineName)
klog.Errorf("The %q host does not exist!", machineName)
}
statuses = append(statuses, st)
}
@ -280,7 +280,7 @@ func nodeStatus(api libmachine.API, cc config.ClusterConfig, n config.Node) (*St
}
hs, err := machine.Status(api, name)
glog.Infof("%s host status = %q (err=%v)", name, hs, err)
klog.Infof("%s host status = %q (err=%v)", name, hs, err)
if err != nil {
return st, errors.Wrap(err, "host")
}
@ -293,7 +293,7 @@ func nodeStatus(api libmachine.API, cc config.ClusterConfig, n config.Node) (*St
// If it's not running, quickly bail out rather than delivering conflicting messages
if st.Host != state.Running.String() {
glog.Infof("host is not running, skipping remaining checks")
klog.Infof("host is not running, skipping remaining checks")
st.APIServer = st.Host
st.Kubelet = st.Host
st.Kubeconfig = st.Host
@ -302,7 +302,7 @@ func nodeStatus(api libmachine.API, cc config.ClusterConfig, n config.Node) (*St
// We have a fully operational host, now we can check for details
if _, err := cluster.DriverIP(api, name); err != nil {
glog.Errorf("failed to get driver ip: %v", err)
klog.Errorf("failed to get driver ip: %v", err)
st.Host = state.Error.String()
return st, err
}
@ -326,7 +326,7 @@ func nodeStatus(api libmachine.API, cc config.ClusterConfig, n config.Node) (*St
// Check storage
p, err := machine.DiskUsed(cr, "/var")
if err != nil {
glog.Errorf("failed to get storage capacity of /var: %v", err)
klog.Errorf("failed to get storage capacity of /var: %v", err)
st.Host = state.Error.String()
return st, err
}
@ -335,7 +335,7 @@ func nodeStatus(api libmachine.API, cc config.ClusterConfig, n config.Node) (*St
}
stk := kverify.KubeletStatus(cr)
glog.Infof("%s kubelet status = %s", name, stk)
klog.Infof("%s kubelet status = %s", name, stk)
st.Kubelet = stk.String()
// Early exit for worker nodes
@ -345,21 +345,21 @@ func nodeStatus(api libmachine.API, cc config.ClusterConfig, n config.Node) (*St
hostname, _, port, err := driver.ControlPlaneEndpoint(&cc, &n, host.DriverName)
if err != nil {
glog.Errorf("forwarded endpoint: %v", err)
klog.Errorf("forwarded endpoint: %v", err)
st.Kubeconfig = Misconfigured
} else {
err := kubeconfig.VerifyEndpoint(cc.Name, hostname, port)
if err != nil {
glog.Errorf("kubeconfig endpoint: %v", err)
klog.Errorf("kubeconfig endpoint: %v", err)
st.Kubeconfig = Misconfigured
}
}
sta, err := kverify.APIServerStatus(cr, hostname, port)
glog.Infof("%s apiserver status = %s (err=%v)", name, stk, err)
klog.Infof("%s apiserver status = %s (err=%v)", name, stk, err)
if err != nil {
glog.Errorln("Error apiserver status:", err)
klog.Errorln("Error apiserver status:", err)
st.APIServer = state.Error.String()
} else {
st.APIServer = sta.String()
@ -485,7 +485,7 @@ func clusterState(sts []*Status) ClusterState {
evs, mtime, err := readEventLog(sts[0].Name)
if err != nil {
glog.Errorf("unable to read event log: %v", err)
klog.Errorf("unable to read event log: %v", err)
return cs
}
@ -493,12 +493,12 @@ func clusterState(sts []*Status) ClusterState {
var finalStep map[string]string
for _, ev := range evs {
// glog.Infof("read event: %+v", ev)
// klog.Infof("read event: %+v", ev)
if ev.Type() == "io.k8s.sigs.minikube.step" {
var data map[string]string
err := ev.DataAs(&data)
if err != nil {
glog.Errorf("unable to parse data: %v\nraw data: %s", err, ev.Data())
klog.Errorf("unable to parse data: %v\nraw data: %s", err, ev.Data())
continue
}
@ -508,7 +508,7 @@ func clusterState(sts []*Status) ClusterState {
case string(register.Done):
transientCode = 0
case string(register.Stopping):
glog.Infof("%q == %q", data["name"], register.Stopping)
klog.Infof("%q == %q", data["name"], register.Stopping)
transientCode = Stopping
case string(register.Deleting):
transientCode = Deleting
@ -519,18 +519,18 @@ func clusterState(sts []*Status) ClusterState {
}
finalStep = data
glog.Infof("transient code %d (%q) for step: %+v", transientCode, codeNames[transientCode], data)
klog.Infof("transient code %d (%q) for step: %+v", transientCode, codeNames[transientCode], data)
}
if ev.Type() == "io.k8s.sigs.minikube.error" {
var data map[string]string
err := ev.DataAs(&data)
if err != nil {
glog.Errorf("unable to parse data: %v\nraw data: %s", err, ev.Data())
klog.Errorf("unable to parse data: %v\nraw data: %s", err, ev.Data())
continue
}
exitCode, err := strconv.Atoi(data["exitcode"])
if err != nil {
glog.Errorf("unable to convert exit code to int: %v", err)
klog.Errorf("unable to convert exit code to int: %v", err)
continue
}
transientCode = exitCode
@ -539,13 +539,13 @@ func clusterState(sts []*Status) ClusterState {
n.StatusName = codeNames[n.StatusCode]
}
glog.Infof("transient code %d (%q) for step: %+v", transientCode, codeNames[transientCode], data)
klog.Infof("transient code %d (%q) for step: %+v", transientCode, codeNames[transientCode], data)
}
}
if finalStep != nil {
if mtime.Before(time.Now().Add(-10 * time.Minute)) {
glog.Warningf("event stream is too old (%s) to be considered a transient state", mtime)
klog.Warningf("event stream is too old (%s) to be considered a transient state", mtime)
} else {
cs.Step = strings.TrimSpace(finalStep["name"])
cs.StepDetail = strings.TrimSpace(finalStep["message"])

View File

@ -21,10 +21,10 @@ import (
"github.com/docker/machine/libmachine"
"github.com/docker/machine/libmachine/mcnerror"
"github.com/golang/glog"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/driver"
"k8s.io/minikube/pkg/minikube/exit"
@ -72,7 +72,7 @@ func runStop(cmd *cobra.Command, args []string) {
if stopAll {
validProfiles, _, err := config.ListProfiles()
if err != nil {
glog.Warningf("'error loading profiles in minikube home %q: %v", localpath.MiniPath(), err)
klog.Warningf("'error loading profiles in minikube home %q: %v", localpath.MiniPath(), err)
}
for _, profile := range validProfiles {
profilesToStop = append(profilesToStop, profile.Name)
@ -131,7 +131,7 @@ func stop(api libmachine.API, machineName string) bool {
if err == nil {
return nil
}
glog.Warningf("stop host returned error: %v", err)
klog.Warningf("stop host returned error: %v", err)
switch err := errors.Cause(err).(type) {
case mcnerror.ErrHostDoesNotExist:

View File

@ -23,9 +23,9 @@ import (
"path/filepath"
"strconv"
"github.com/golang/glog"
"github.com/spf13/cobra"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/drivers/kic/oci"
"k8s.io/minikube/pkg/kapi"
"k8s.io/minikube/pkg/minikube/config"
@ -54,9 +54,9 @@ var tunnelCmd = &cobra.Command{
co := mustload.Healthy(cname)
if cleanup {
glog.Info("Checking for tunnels to cleanup...")
klog.Info("Checking for tunnels to cleanup...")
if err := manager.CleanupNotRunningTunnels(); err != nil {
glog.Errorf("error cleaning up: %s", err)
klog.Errorf("error cleaning up: %s", err)
}
}

View File

@ -19,10 +19,10 @@ package cmd
import (
"strings"
"github.com/golang/glog"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/cluster"
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/cruntime"
@ -48,7 +48,7 @@ var unpauseCmd = &cobra.Command{
co := mustload.Running(cname)
register.Reg.SetStep(register.Unpausing)
glog.Infof("namespaces: %v keys: %v", namespaces, viper.AllSettings())
klog.Infof("namespaces: %v keys: %v", namespaces, viper.AllSettings())
if allNamespaces {
namespaces = nil // all
} else {
@ -60,7 +60,7 @@ var unpauseCmd = &cobra.Command{
ids := []string{}
for _, n := range co.Config.Nodes {
glog.Infof("node: %+v", n)
klog.Infof("node: %+v", n)
// Use node-name if available, falling back to cluster name
name := n.Name

View File

@ -26,6 +26,8 @@ import (
// initflag must be imported before any other minikube pkg.
// Fix for https://github.com/kubernetes/minikube/issues/4866
"k8s.io/klog/v2"
_ "k8s.io/minikube/pkg/initflag"
// Register drivers
@ -36,7 +38,6 @@ import (
mlog "github.com/docker/machine/libmachine/log"
"github.com/golang/glog"
"github.com/google/slowjam/pkg/stacklog"
"github.com/pkg/profile"
@ -58,7 +59,7 @@ var (
func main() {
bridgeLogMessages()
defer glog.Flush()
defer klog.Flush()
s := stacklog.MustStartFromEnv("STACKLOG_PATH")
defer s.Stop()
@ -90,7 +91,7 @@ func (lb stdLogBridge) Write(b []byte) (n int, err error) {
// Split "d.go:23: message" into "d.go", "23", and "message".
parts := bytes.SplitN(b, []byte{':'}, 3)
if len(parts) != 3 || len(parts[0]) < 1 || len(parts[2]) < 1 {
glog.Errorf("bad log format: %s", b)
klog.Errorf("bad log format: %s", b)
return
}
@ -101,7 +102,7 @@ func (lb stdLogBridge) Write(b []byte) (n int, err error) {
text = fmt.Sprintf("bad line number: %s", b)
line = 0
}
glog.Infof("stdlog: %s:%d %s", file, line, text)
klog.Infof("stdlog: %s:%d %s", file, line, text)
return len(b), nil
}
@ -111,11 +112,11 @@ type machineLogBridge struct{}
// Write passes machine driver logs to glog
func (lb machineLogBridge) Write(b []byte) (n int, err error) {
if machineLogErrorRe.Match(b) {
glog.Errorf("libmachine: %s", b)
klog.Errorf("libmachine: %s", b)
} else if machineLogWarningRe.Match(b) {
glog.Warningf("libmachine: %s", b)
klog.Warningf("libmachine: %s", b)
} else {
glog.Infof("libmachine: %s", b)
klog.Infof("libmachine: %s", b)
}
return len(b), nil
}

View File

@ -21,7 +21,7 @@ import (
"fmt"
"os"
"github.com/golang/glog"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/storage"
)
@ -36,7 +36,7 @@ func main() {
flag.Parse()
if err := storage.StartStorageProvisioner(pvDir); err != nil {
glog.Exit(err)
klog.Exit(err)
}
}

View File

@ -90,7 +90,7 @@ data:
# Multi-line parsing is required for all the kube logs because very large log
# statements, such as those that include entire object bodies, get split into
# multiple lines by glog.
# multiple lines by klog.
# Example:
# I0204 07:32:30.020537 3368 server.go:1048] POST /stats/container/: (13.972191ms) 200 [[Go-http-client/1.1] 10.244.1.3:40537]

2
go.mod
View File

@ -24,7 +24,6 @@ require (
github.com/evanphx/json-patch v4.5.0+incompatible // indirect
github.com/go-ole/go-ole v1.2.4 // indirect
github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/google/go-cmp v0.4.1
github.com/google/go-containerregistry v0.0.0-20200601195303-96cf69f03a3c
github.com/google/go-github v17.0.0+incompatible
@ -85,6 +84,7 @@ require (
k8s.io/api v0.17.4
k8s.io/apimachinery v0.17.4
k8s.io/client-go v0.17.4
k8s.io/klog/v2 v2.3.0
k8s.io/kubectl v0.0.0
k8s.io/kubernetes v1.18.5
sigs.k8s.io/sig-storage-lib-external-provisioner v4.0.0+incompatible // indirect

4
go.sum
View File

@ -352,6 +352,8 @@ github.com/go-lintpack/lintpack v0.5.2/go.mod h1:NwZuYi2nUHho8XEIZ6SIxihrnPoqBTD
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas=
github.com/go-logr/logr v0.2.0 h1:QvGt2nLcHH0WK9orKa+ppBPAxREcH364nPUedEpK0TY=
github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU=
github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8=
github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI=
github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM=
@ -1638,6 +1640,8 @@ k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUc
k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8=
k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I=
k8s.io/klog/v2 v2.3.0 h1:WmkrnW7fdrm0/DMClc+HIxtftvxVIPAhlVwMQo5yLco=
k8s.io/klog/v2 v2.3.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
k8s.io/kube-aggregator v0.17.3/go.mod h1:1dMwMFQbmH76RKF0614L7dNenMl3dwnUJuOOyZ3GMXA=
k8s.io/kube-controller-manager v0.17.3/go.mod h1:22B/TsgVviuCVuNwUrqgyTi5D4AYjMFaK9c8h1oonkY=
k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a h1:UcxjrRMyNx/i/y8G7kPvLyy7rfbeuf1PYyBf973pgyU=

View File

@ -26,9 +26,9 @@ import (
"strings"
"time"
"github.com/golang/glog"
"github.com/google/go-github/v32/github"
"k8s.io/klog/v2"
)
func main() {
@ -41,20 +41,20 @@ func main() {
// latest rc or beta (vDefault as NewestKubernetesVersion) Kubernetes GitHub Releases
vDefault, vNewest, err := fetchKubernetesReleases()
if err != nil {
glog.Errorf("Fetching current GitHub Releases failed: %v", err)
klog.Errorf("Fetching current GitHub Releases failed: %v", err)
}
if vDefault == "" || vNewest == "" {
glog.Fatalf("Cannot determine current 'DefaultKubernetesVersion' and 'NewestKubernetesVersion'")
klog.Fatalf("Cannot determine current 'DefaultKubernetesVersion' and 'NewestKubernetesVersion'")
}
glog.Infof("Current Kubernetes GitHub Releases: 'stable' is %s and 'latest' is %s", vDefault, vNewest)
klog.Infof("Current Kubernetes GitHub Releases: 'stable' is %s and 'latest' is %s", vDefault, vNewest)
if err := updateKubernetesVersions(vDefault, vNewest); err != nil {
glog.Fatalf("Updating 'DefaultKubernetesVersion' and 'NewestKubernetesVersion' failed: %v", err)
klog.Fatalf("Updating 'DefaultKubernetesVersion' and 'NewestKubernetesVersion' failed: %v", err)
}
glog.Infof("Update successful: 'DefaultKubernetesVersion' was set to %s and 'NewestKubernetesVersion' was set to %s", vDefault, vNewest)
klog.Infof("Update successful: 'DefaultKubernetesVersion' was set to %s and 'NewestKubernetesVersion' was set to %s", vDefault, vNewest)
// Flush before exiting to guarantee all log output is written
glog.Flush()
klog.Flush()
}
// fetchKubernetesReleases returns respective current stable (as vDefault) and

View File

@ -19,8 +19,9 @@ package main
import (
"context"
"github.com/golang/glog"
"github.com/google/go-github/github"
"k8s.io/klog/v2"
)
// RecentK8sVersions returns the most recent k8s version, usually around 30
@ -35,6 +36,6 @@ func RecentK8sVersions() ([]string, error) {
for _, r := range list {
releases = append(releases, r.GetTagName())
}
glog.Infof("Got releases: %v", releases)
klog.Infof("Got releases: %v", releases)
return releases, nil
}

View File

@ -26,10 +26,10 @@ import (
"sync"
"time"
"github.com/golang/glog"
"github.com/pkg/errors"
"github.com/spf13/viper"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/drivers/kic/oci"
"k8s.io/minikube/pkg/kapi"
"k8s.io/minikube/pkg/minikube/assets"
@ -52,7 +52,7 @@ const defaultStorageClassProvisioner = "standard"
// RunCallbacks runs all actions associated to an addon, but does not set it (thread-safe)
func RunCallbacks(cc *config.ClusterConfig, name string, value string) error {
glog.Infof("Setting %s=%s in profile %q", name, value, cc.Name)
klog.Infof("Setting %s=%s in profile %q", name, value, cc.Name)
a, valid := isAddonValid(name)
if !valid {
return errors.Errorf("%s is not a valid addon", name)
@ -94,7 +94,7 @@ func SetAndSave(profile string, name string, value string) error {
return errors.Wrap(err, "set")
}
glog.Infof("Writing out %q config to set %s=%v...", profile, name, value)
klog.Infof("Writing out %q config to set %s=%v...", profile, name, value)
return config.Write(profile, cc)
}
@ -128,7 +128,7 @@ func SetBool(cc *config.ClusterConfig, name string, val string) error {
// enableOrDisableAddon updates addon status executing any commands necessary
func enableOrDisableAddon(cc *config.ClusterConfig, name string, val string) error {
glog.Infof("Setting addon %s=%s in %q", name, val, cc.Name)
klog.Infof("Setting addon %s=%s in %q", name, val, cc.Name)
enable, err := strconv.ParseBool(val)
if err != nil {
return errors.Wrapf(err, "parsing bool: %s", name)
@ -137,7 +137,7 @@ func enableOrDisableAddon(cc *config.ClusterConfig, name string, val string) err
// check addon status before enabling/disabling it
if isAddonAlreadySet(cc, addon, enable) {
glog.Warningf("addon %s should already be in state %v", name, val)
klog.Warningf("addon %s should already be in state %v", name, val)
if !enable {
return nil
}
@ -185,7 +185,7 @@ https://github.com/kubernetes/minikube/issues/7332`, out.V{"driver_name": cc.Dri
mName := driver.MachineName(*cc, cp)
host, err := machine.LoadHost(api, mName)
if err != nil || !machine.IsRunning(api, mName) {
glog.Warningf("%q is not running, setting %s=%v and skipping enablement (err=%v)", mName, addon.Name(), enable, err)
klog.Warningf("%q is not running, setting %s=%v and skipping enablement (err=%v)", mName, addon.Name(), enable, err)
return nil
}
@ -240,15 +240,15 @@ func enableOrDisableAddonInternal(cc *config.ClusterConfig, addon *assets.Addon,
fPath := path.Join(f.GetTargetDir(), f.GetTargetName())
if enable {
glog.Infof("installing %s", fPath)
klog.Infof("installing %s", fPath)
if err := cmd.Copy(f); err != nil {
return err
}
} else {
glog.Infof("Removing %+v", fPath)
klog.Infof("Removing %+v", fPath)
defer func() {
if err := cmd.Remove(f); err != nil {
glog.Warningf("error removing %s; addon should still be disabled as expected", fPath)
klog.Warningf("error removing %s; addon should still be disabled as expected", fPath)
}
}()
}
@ -261,7 +261,7 @@ func enableOrDisableAddonInternal(cc *config.ClusterConfig, addon *assets.Addon,
apply := func() error {
_, err := cmd.RunCmd(kubectlCommand(cc, deployFiles, enable))
if err != nil {
glog.Warningf("apply failed, will retry: %v", err)
klog.Warningf("apply failed, will retry: %v", err)
}
return err
}
@ -271,7 +271,7 @@ func enableOrDisableAddonInternal(cc *config.ClusterConfig, addon *assets.Addon,
// enableOrDisableStorageClasses enables or disables storage classes
func enableOrDisableStorageClasses(cc *config.ClusterConfig, name string, val string) error {
glog.Infof("enableOrDisableStorageClasses %s=%v on %q", name, val, cc.Name)
klog.Infof("enableOrDisableStorageClasses %s=%v on %q", name, val, cc.Name)
enable, err := strconv.ParseBool(val)
if err != nil {
return errors.Wrap(err, "Error parsing boolean")
@ -293,7 +293,7 @@ func enableOrDisableStorageClasses(cc *config.ClusterConfig, name string, val st
return errors.Wrap(err, "getting control plane")
}
if !machine.IsRunning(api, driver.MachineName(*cc, cp)) {
glog.Warningf("%q is not running, writing %s=%v to disk and skipping enablement", driver.MachineName(*cc, cp), name, val)
klog.Warningf("%q is not running, writing %s=%v to disk and skipping enablement", driver.MachineName(*cc, cp), name, val)
return enableOrDisableAddon(cc, name, val)
}
@ -328,7 +328,7 @@ func verifyGCPAuthAddon(cc *config.ClusterConfig, name string, val string) error
}
func verifyAddonStatusInternal(cc *config.ClusterConfig, name string, val string, ns string) error {
glog.Infof("Verifying addon %s=%s in %q", name, val, cc.Name)
klog.Infof("Verifying addon %s=%s in %q", name, val, cc.Name)
enable, err := strconv.ParseBool(val)
if err != nil {
return errors.Wrapf(err, "parsing bool: %s", name)
@ -356,9 +356,9 @@ func Start(wg *sync.WaitGroup, cc *config.ClusterConfig, toEnable map[string]boo
defer wg.Done()
start := time.Now()
glog.Infof("enableAddons start: toEnable=%v, additional=%s", toEnable, additional)
klog.Infof("enableAddons start: toEnable=%v, additional=%s", toEnable, additional)
defer func() {
glog.Infof("enableAddons completed in %s", time.Since(start))
klog.Infof("enableAddons completed in %s", time.Since(start))
}()
// Get the default values of any addons not saved to our config
@ -413,7 +413,7 @@ func Start(wg *sync.WaitGroup, cc *config.ClusterConfig, toEnable map[string]boo
awg.Wait()
for _, a := range toEnableList {
if err := Set(cc, a, "true"); err != nil {
glog.Errorf("store failed: %v", err)
klog.Errorf("store failed: %v", err)
}
}
}

View File

@ -27,8 +27,9 @@ import (
"github.com/docker/machine/libmachine/mcnflag"
"github.com/docker/machine/libmachine/mcnutils"
"github.com/docker/machine/libmachine/ssh"
"github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/util"
)
@ -97,20 +98,20 @@ func Restart(d drivers.Driver) error {
// MakeDiskImage makes a boot2docker VM disk image.
func MakeDiskImage(d *drivers.BaseDriver, boot2dockerURL string, diskSize int) error {
glog.Infof("Making disk image using store path: %s", d.StorePath)
klog.Infof("Making disk image using store path: %s", d.StorePath)
b2 := mcnutils.NewB2dUtils(d.StorePath)
if err := b2.CopyIsoToMachineDir(boot2dockerURL, d.MachineName); err != nil {
return errors.Wrap(err, "copy iso to machine dir")
}
keyPath := d.GetSSHKeyPath()
glog.Infof("Creating ssh key: %s...", keyPath)
klog.Infof("Creating ssh key: %s...", keyPath)
if err := ssh.GenerateSSHKey(keyPath); err != nil {
return errors.Wrap(err, "generate ssh key")
}
diskPath := GetDiskPath(d)
glog.Infof("Creating raw disk image: %s...", diskPath)
klog.Infof("Creating raw disk image: %s...", diskPath)
if _, err := os.Stat(diskPath); os.IsNotExist(err) {
if err := createRawDiskImage(publicSSHKeyPath(d), diskPath, diskSize); err != nil {
return errors.Wrapf(err, "createRawDiskImage(%s)", diskPath)
@ -124,7 +125,7 @@ func MakeDiskImage(d *drivers.BaseDriver, boot2dockerURL string, diskSize int) e
}
func fixMachinePermissions(path string) error {
glog.Infof("Fixing permissions on %s ...", path)
klog.Infof("Fixing permissions on %s ...", path)
if err := os.Chown(path, syscall.Getuid(), syscall.Getegid()); err != nil {
return errors.Wrap(err, "chown dir")
}

View File

@ -28,8 +28,8 @@ import (
"github.com/docker/machine/libmachine/drivers"
"github.com/docker/machine/libmachine/ssh"
"github.com/docker/machine/libmachine/state"
"github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/klog/v2"
pkgdrivers "k8s.io/minikube/pkg/drivers"
"k8s.io/minikube/pkg/drivers/kic/oci"
"k8s.io/minikube/pkg/minikube/assets"
@ -102,14 +102,14 @@ func (d *Driver) Create() error {
exists, err := oci.ContainerExists(d.OCIBinary, params.Name, true)
if err != nil {
glog.Warningf("failed to check if container already exists: %v", err)
klog.Warningf("failed to check if container already exists: %v", err)
}
if exists {
// if container was created by minikube it is safe to delete and recreate it.
if oci.IsCreatedByMinikube(d.OCIBinary, params.Name) {
glog.Info("Found already existing abandoned minikube container, will try to delete.")
klog.Info("Found already existing abandoned minikube container, will try to delete.")
if err := oci.DeleteContainer(d.OCIBinary, params.Name); err != nil {
glog.Errorf("Failed to delete a conflicting minikube container %s. You might need to restart your %s daemon and delete it manually and try again: %v", params.Name, params.OCIBinary, err)
klog.Errorf("Failed to delete a conflicting minikube container %s. You might need to restart your %s daemon and delete it manually and try again: %v", params.Name, params.OCIBinary, err)
}
} else {
// The conflicting container name was not created by minikube
@ -131,12 +131,12 @@ func (d *Driver) Create() error {
return
}
t := time.Now()
glog.Infof("Starting extracting preloaded images to volume ...")
klog.Infof("Starting extracting preloaded images to volume ...")
// Extract preloaded images to container
if err := oci.ExtractTarballToVolume(d.NodeConfig.OCIBinary, download.TarballPath(d.NodeConfig.KubernetesVersion, d.NodeConfig.ContainerRuntime), params.Name, d.NodeConfig.ImageDigest); err != nil {
glog.Infof("Unable to extract preloaded tarball to volume: %v", err)
klog.Infof("Unable to extract preloaded tarball to volume: %v", err)
} else {
glog.Infof("duration metric: took %f seconds to extract preloaded images to volume", time.Since(t).Seconds())
klog.Infof("duration metric: took %f seconds to extract preloaded images to volume", time.Since(t).Seconds())
}
}()
@ -155,7 +155,7 @@ func (d *Driver) Create() error {
// prepareSSH will generate keys and copy to the container so minikube ssh works
func (d *Driver) prepareSSH() error {
keyPath := d.GetSSHKeyPath()
glog.Infof("Creating ssh key for kic: %s...", keyPath)
klog.Infof("Creating ssh key for kic: %s...", keyPath)
if err := ssh.GenerateSSHKey(keyPath); err != nil {
return errors.Wrap(err, "generate ssh key")
}
@ -255,11 +255,11 @@ func (d *Driver) Kill() error {
// on init this doesn't get filled when called from cmd
d.exec = command.NewKICRunner(d.MachineName, d.OCIBinary)
if err := sysinit.New(d.exec).ForceStop("kubelet"); err != nil {
glog.Warningf("couldn't force stop kubelet. will continue with kill anyways: %v", err)
klog.Warningf("couldn't force stop kubelet. will continue with kill anyways: %v", err)
}
if err := oci.ShutDown(d.OCIBinary, d.MachineName); err != nil {
glog.Warningf("couldn't shutdown the container, will continue with kill anyways: %v", err)
klog.Warningf("couldn't shutdown the container, will continue with kill anyways: %v", err)
}
cr := command.NewExecRunner() // using exec runner for interacting with dameon.
@ -272,7 +272,7 @@ func (d *Driver) Kill() error {
// Remove will delete the Kic Node Container
func (d *Driver) Remove() error {
if _, err := oci.ContainerID(d.OCIBinary, d.MachineName); err != nil {
glog.Infof("could not find the container %s to remove it. will try anyways", d.MachineName)
klog.Infof("could not find the container %s to remove it. will try anyways", d.MachineName)
}
if err := oci.DeleteContainer(d.NodeConfig.OCIBinary, d.MachineName); err != nil {
@ -296,7 +296,7 @@ func (d *Driver) Remove() error {
func (d *Driver) Restart() error {
s, err := d.GetState()
if err != nil {
glog.Warningf("get state during restart: %v", err)
klog.Warningf("get state during restart: %v", err)
}
if s == state.Stopped { // don't stop if already stopped
return d.Start()
@ -328,7 +328,7 @@ func (d *Driver) Start() error {
if s != state.Running {
return fmt.Errorf("expected container state be running but got %q", s)
}
glog.Infof("container %q state is running.", d.MachineName)
klog.Infof("container %q state is running.", d.MachineName)
return nil
}
@ -351,35 +351,35 @@ func (d *Driver) Stop() error {
// docker does not send right SIG for systemd to know to stop the systemd.
// to avoid bind address be taken on an upgrade. more info https://github.com/kubernetes/minikube/issues/7171
if err := sysinit.New(d.exec).Stop("kubelet"); err != nil {
glog.Warningf("couldn't stop kubelet. will continue with stop anyways: %v", err)
klog.Warningf("couldn't stop kubelet. will continue with stop anyways: %v", err)
if err := sysinit.New(d.exec).ForceStop("kubelet"); err != nil {
glog.Warningf("couldn't force stop kubelet. will continue with stop anyways: %v", err)
klog.Warningf("couldn't force stop kubelet. will continue with stop anyways: %v", err)
}
}
runtime, err := cruntime.New(cruntime.Config{Type: d.NodeConfig.ContainerRuntime, Runner: d.exec})
if err != nil { // won't return error because:
// even though we can't stop the cotainers inside, we still wanna stop the minikube container itself
glog.Errorf("unable to get container runtime: %v", err)
klog.Errorf("unable to get container runtime: %v", err)
} else {
containers, err := runtime.ListContainers(cruntime.ListOptions{Namespaces: constants.DefaultNamespaces})
if err != nil {
glog.Infof("unable list containers : %v", err)
klog.Infof("unable list containers : %v", err)
}
if len(containers) > 0 {
if err := runtime.StopContainers(containers); err != nil {
glog.Infof("unable to stop containers : %v", err)
klog.Infof("unable to stop containers : %v", err)
}
if err := runtime.KillContainers(containers); err != nil {
glog.Errorf("unable to kill containers : %v", err)
klog.Errorf("unable to kill containers : %v", err)
}
}
glog.Infof("successfully stopped kubernetes!")
klog.Infof("successfully stopped kubernetes!")
}
if err := killAPIServerProc(d.exec); err != nil {
glog.Warningf("couldn't stop kube-apiserver proc: %v", err)
klog.Warningf("couldn't stop kube-apiserver proc: %v", err)
}
cmd := exec.Command(d.NodeConfig.OCIBinary, "stop", d.MachineName)
@ -402,7 +402,7 @@ func killAPIServerProc(runner command.Runner) error {
if err == nil { // this means we might have a running kube-apiserver
pid, err := strconv.Atoi(rr.Stdout.String())
if err == nil { // this means we have a valid pid
glog.Warningf("Found a kube-apiserver running with pid %d, will try to kill the proc", pid)
klog.Warningf("Found a kube-apiserver running with pid %d, will try to kill the proc", pid)
if _, err = runner.RunCmd(exec.Command("pkill", "-9", string(pid))); err != nil {
return errors.Wrap(err, "kill")
}

View File

@ -26,7 +26,7 @@ import (
"strings"
"time"
"github.com/golang/glog"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/style"
)
@ -107,7 +107,7 @@ func runCmd(cmd *exec.Cmd, warnSlow ...bool) (*RunResult, error) {
}
rr := &RunResult{Args: cmd.Args}
glog.Infof("Run: %v", rr.Command())
klog.Infof("Run: %v", rr.Command())
var outb, errb io.Writer
if cmd.Stdout == nil {
@ -149,7 +149,7 @@ func runCmd(cmd *exec.Cmd, warnSlow ...bool) (*RunResult, error) {
}
// Decrease log spam
if elapsed > (1 * time.Second) {
glog.Infof("Completed: %s: (%s)", rr.Command(), elapsed)
klog.Infof("Completed: %s: (%s)", rr.Command(), elapsed)
}
if err == nil {
return rr, nil

View File

@ -21,7 +21,7 @@ import (
"os/exec"
"strings"
"github.com/golang/glog"
"k8s.io/klog/v2"
)
// FailFastError type is an error that could not be solved by trying again
@ -49,30 +49,30 @@ var ErrDaemonInfo = errors.New("daemon info not responding")
func LogContainerDebug(ociBin string, name string) string {
rr, err := containerInspect(ociBin, name)
if err != nil {
glog.Warningf("Filed to get postmortem inspect. %s :%v", rr.Command(), err)
klog.Warningf("Filed to get postmortem inspect. %s :%v", rr.Command(), err)
} else {
glog.Infof("Postmortem inspect (%q): %s", rr.Command(), rr.Output())
klog.Infof("Postmortem inspect (%q): %s", rr.Command(), rr.Output())
}
rr, err = containerLogs(ociBin, name)
if err != nil {
glog.Warningf("Filed to get postmortem logs. %s :%v", rr.Command(), err)
klog.Warningf("Filed to get postmortem logs. %s :%v", rr.Command(), err)
} else {
glog.Infof("Postmortem logs (%q): %s", rr.Command(), rr.Output())
klog.Infof("Postmortem logs (%q): %s", rr.Command(), rr.Output())
}
if ociBin == Docker {
di, err := dockerSystemInfo()
if err != nil {
glog.Warningf("Failed to get postmortem docker info: %v", err)
klog.Warningf("Failed to get postmortem docker info: %v", err)
} else {
glog.Infof("postmortem docker info: %+v", di)
klog.Infof("postmortem docker info: %+v", di)
}
} else {
pi, err := podmanSystemInfo()
if err != nil {
glog.Warningf("couldn't get postmortem info, failed to to run podman info: %v", err)
klog.Warningf("couldn't get postmortem info, failed to to run podman info: %v", err)
} else {
glog.Infof("postmortem podman info: %+v", pi)
klog.Infof("postmortem podman info: %+v", pi)
}
}

View File

@ -25,8 +25,9 @@ import (
"strings"
"github.com/blang/semver"
"github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/klog/v2"
)
// RoutableHostIPFromInside returns the ip/dns of the host that container lives on
@ -55,7 +56,7 @@ func digDNS(ociBin, containerName, dns string) (net.IP, error) {
return ip, errors.Wrapf(err, "resolve dns to ip")
}
glog.Infof("got host ip for mount in container by digging dns: %s", ip.String())
klog.Infof("got host ip for mount in container by digging dns: %s", ip.String())
return ip, nil
}
@ -103,7 +104,7 @@ func dockerGatewayIP(profile string) (net.IP, error) {
}
ip := net.ParseIP(strings.TrimSpace(rr.Stdout.String()))
glog.Infof("got host ip for mount in container by inspect docker network: %s", ip.String())
klog.Infof("got host ip for mount in container by inspect docker network: %s", ip.String())
return ip, nil
}

View File

@ -25,8 +25,9 @@ import (
"bytes"
"github.com/docker/machine/libmachine/state"
"github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/util/retry"
@ -58,11 +59,11 @@ func DeleteContainersByLabel(ociBin string, label string) []error {
// if it doesn't it means docker daemon is stuck and needs restart
if err != nil {
deleteErrs = append(deleteErrs, errors.Wrapf(err, "delete container %s: %s daemon is stuck. please try again!", c, ociBin))
glog.Errorf("%s daemon seems to be stuck. Please try restarting your %s. :%v", ociBin, ociBin, err)
klog.Errorf("%s daemon seems to be stuck. Please try restarting your %s. :%v", ociBin, ociBin, err)
continue
}
if err := ShutDown(ociBin, c); err != nil {
glog.Infof("couldn't shut down %s (might be okay): %v ", c, err)
klog.Infof("couldn't shut down %s (might be okay): %v ", c, err)
}
if _, err := runCmd(exec.Command(ociBin, "rm", "-f", "-v", c)); err != nil {
@ -79,11 +80,11 @@ func DeleteContainer(ociBin string, name string) error {
if err == context.DeadlineExceeded {
out.WarningT("{{.ocibin}} is taking an unsually long time to respond, consider restarting {{.ocibin}}", out.V{"ociBin": ociBin})
} else if err != nil {
glog.Warningf("error getting container status, will try to delete anyways: %v", err)
klog.Warningf("error getting container status, will try to delete anyways: %v", err)
}
// try to delete anyways
if err := ShutDown(ociBin, name); err != nil {
glog.Infof("couldn't shut down %s (might be okay): %v ", name, err)
klog.Infof("couldn't shut down %s (might be okay): %v ", name, err)
}
if _, err := runCmd(exec.Command(ociBin, "rm", "-f", "-v", name)); err != nil {
@ -98,11 +99,11 @@ func PrepareContainerNode(p CreateParams) error {
if err := createVolume(p.OCIBinary, p.Name, p.Name); err != nil {
return errors.Wrapf(err, "creating volume for %s container", p.Name)
}
glog.Infof("Successfully created a %s volume %s", p.OCIBinary, p.Name)
klog.Infof("Successfully created a %s volume %s", p.OCIBinary, p.Name)
if err := prepareVolume(p.OCIBinary, p.Image, p.Name); err != nil {
return errors.Wrapf(err, "preparing volume for %s container", p.Name)
}
glog.Infof("Successfully prepared a %s volume %s", p.OCIBinary, p.Name)
klog.Infof("Successfully prepared a %s volume %s", p.OCIBinary, p.Name)
return nil
}
@ -115,7 +116,7 @@ func CreateContainerNode(p CreateParams) error {
return ErrWindowsContainers
}
if err != nil {
glog.Warningf("error getting dameon info: %v", err)
klog.Warningf("error getting dameon info: %v", err)
return errors.Wrap(err, "daemon info")
}
}
@ -149,7 +150,7 @@ func CreateContainerNode(p CreateParams) error {
if runtime.GOOS == "linux" {
if _, err := os.Stat("/sys/fs/cgroup/memory/memsw.limit_in_bytes"); os.IsNotExist(err) {
// requires CONFIG_MEMCG_SWAP_ENABLED or cgroup_enable=memory in grub
glog.Warning("Your kernel does not support swap limit capabilities or the cgroup is not mounted.")
klog.Warning("Your kernel does not support swap limit capabilities or the cgroup is not mounted.")
memcgSwap = false
}
}
@ -191,7 +192,7 @@ func CreateContainerNode(p CreateParams) error {
}
if !cpuCfsPeriod || !cpuCfsQuota {
// requires CONFIG_CFS_BANDWIDTH
glog.Warning("Your kernel does not support CPU cfs period/quota or the cgroup is not mounted.")
klog.Warning("Your kernel does not support CPU cfs period/quota or the cgroup is not mounted.")
}
}
@ -236,7 +237,7 @@ func CreateContainerNode(p CreateParams) error {
if !iptablesFileExists(p.OCIBinary, p.Name) {
return fmt.Errorf("iptables file doesn't exist, see #8179")
}
glog.Infof("the created container %q has a running status.", p.Name)
klog.Infof("the created container %q has a running status.", p.Name)
return nil
}
@ -513,7 +514,7 @@ func ListContainersByLabel(ociBin string, label string, warnSlow ...bool) ([]str
func PointToHostDockerDaemon() error {
p := os.Getenv(constants.MinikubeActiveDockerdEnv)
if p != "" {
glog.Infof("shell is pointing to dockerd inside minikube. will unset to use host")
klog.Infof("shell is pointing to dockerd inside minikube. will unset to use host")
}
for i := range constants.DockerDaemonEnvs {
@ -531,7 +532,7 @@ func PointToHostDockerDaemon() error {
func PointToHostPodman() error {
p := os.Getenv(constants.MinikubeActivePodmanEnv)
if p != "" {
glog.Infof("shell is pointing to podman inside minikube. will unset to use host")
klog.Infof("shell is pointing to podman inside minikube. will unset to use host")
}
for i := range constants.PodmanRemoteEnvs {
@ -582,7 +583,7 @@ func ContainerStatus(ociBin string, name string, warnSlow ...bool) (state.State,
// to avoid containers getting stuck before delete https://github.com/kubernetes/minikube/issues/7657
func ShutDown(ociBin string, name string) error {
if _, err := runCmd(exec.Command(ociBin, "exec", "--privileged", "-t", name, "/bin/bash", "-c", "sudo init 0")); err != nil {
glog.Infof("error shutdown %s: %v", name, err)
klog.Infof("error shutdown %s: %v", name, err)
}
// helps with allowing docker realize the container is exited and report its status correctly.
time.Sleep(time.Second * 1)
@ -590,19 +591,19 @@ func ShutDown(ociBin string, name string) error {
stopped := func() error {
st, err := ContainerStatus(ociBin, name)
if st == state.Stopped {
glog.Infof("container %s status is %s", name, st)
klog.Infof("container %s status is %s", name, st)
return nil
}
if err != nil {
glog.Infof("temporary error verifying shutdown: %v", err)
klog.Infof("temporary error verifying shutdown: %v", err)
}
glog.Infof("temporary error: container %s status is %s but expect it to be exited", name, st)
klog.Infof("temporary error: container %s status is %s but expect it to be exited", name, st)
return errors.Wrap(err, "couldn't verify cointainer is exited. %v")
}
if err := retry.Expo(stopped, time.Millisecond*500, time.Second*20); err != nil {
return errors.Wrap(err, "verify shutdown")
}
glog.Infof("Successfully shutdown container %s", name)
klog.Infof("Successfully shutdown container %s", name)
return nil
}
@ -613,7 +614,7 @@ func iptablesFileExists(ociBin string, nameOrID string) bool {
file := "/var/lib/dpkg/alternatives/iptables"
_, err := runCmd(exec.Command(ociBin, "exec", nameOrID, "stat", file), false)
if err != nil {
glog.Warningf("error checking if %s exists: %v", file, err)
klog.Warningf("error checking if %s exists: %v", file, err)
return false
}
return true

View File

@ -24,15 +24,16 @@ import (
"runtime"
"strings"
"github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/klog/v2"
)
// DeleteAllVolumesByLabel deletes all volumes that have a specific label
// if there is no volume to delete it will return nil
func DeleteAllVolumesByLabel(ociBin string, label string, warnSlow ...bool) []error {
var deleteErrs []error
glog.Infof("trying to delete all %s volumes with label %s", ociBin, label)
klog.Infof("trying to delete all %s volumes with label %s", ociBin, label)
vs, err := allVolumesByLabel(ociBin, label)
@ -54,7 +55,7 @@ func DeleteAllVolumesByLabel(ociBin string, label string, warnSlow ...bool) []er
// example: docker volume prune -f --filter label=name.minikube.sigs.k8s.io=minikube
func PruneAllVolumesByLabel(ociBin string, label string, warnSlow ...bool) []error {
var deleteErrs []error
glog.Infof("trying to prune all %s volumes with label %s", ociBin, label)
klog.Infof("trying to prune all %s volumes with label %s", ociBin, label)
cmd := exec.Command(ociBin, "volume", "prune", "-f", "--filter", "label="+label)
if _, err := runCmd(cmd, warnSlow...); err != nil {
deleteErrs = append(deleteErrs, errors.Wrapf(err, "prune volume by label %s", label))

View File

@ -22,9 +22,9 @@ import (
"github.com/docker/machine/libmachine/drivers"
"github.com/docker/machine/libmachine/state"
"github.com/golang/glog"
"github.com/pkg/errors"
knet "k8s.io/apimachinery/pkg/util/net"
"k8s.io/klog/v2"
pkgdrivers "k8s.io/minikube/pkg/drivers"
"k8s.io/minikube/pkg/minikube/bootstrapper/bsutil/kverify"
"k8s.io/minikube/pkg/minikube/command"
@ -65,7 +65,7 @@ func NewDriver(c Config) *Driver {
runtime, err := cruntime.New(cruntime.Config{Type: c.ContainerRuntime, Runner: runner})
// Libraries shouldn't panic, but there is no way for drivers to return error :(
if err != nil {
glog.Fatalf("unable to create container runtime: %v", err)
klog.Fatalf("unable to create container runtime: %v", err)
}
return &Driver{
BaseDriver: &drivers.BaseDriver{
@ -127,7 +127,7 @@ func (d *Driver) GetURL() (string, error) {
func (d *Driver) GetState() (state.State, error) {
hostname, port, err := kubeconfig.Endpoint(d.BaseDriver.MachineName)
if err != nil {
glog.Warningf("unable to get port: %v", err)
klog.Warningf("unable to get port: %v", err)
port = constants.APIServerPort
}
@ -148,7 +148,7 @@ func (d *Driver) GetState() (state.State, error) {
// Kill stops a host forcefully, including any containers that we are managing.
func (d *Driver) Kill() error {
if err := sysinit.New(d.exec).ForceStop("kubelet"); err != nil {
glog.Warningf("couldn't force stop kubelet. will continue with kill anyways: %v", err)
klog.Warningf("couldn't force stop kubelet. will continue with kill anyways: %v", err)
}
// First try to gracefully stop containers
@ -182,10 +182,10 @@ func (d *Driver) Remove() error {
if err := d.Kill(); err != nil {
return errors.Wrap(err, "kill")
}
glog.Infof("Removing: %s", cleanupPaths)
klog.Infof("Removing: %s", cleanupPaths)
args := append([]string{"rm", "-rf"}, cleanupPaths...)
if _, err := d.exec.RunCmd(exec.Command("sudo", args...)); err != nil {
glog.Errorf("cleanup incomplete: %v", err)
klog.Errorf("cleanup incomplete: %v", err)
}
return nil
}
@ -212,9 +212,9 @@ func (d *Driver) Start() error {
// Stop a host gracefully, including any containers that we are managing.
func (d *Driver) Stop() error {
if err := sysinit.New(d.exec).Stop("kubelet"); err != nil {
glog.Warningf("couldn't stop kubelet. will continue with stop anyways: %v", err)
klog.Warningf("couldn't stop kubelet. will continue with stop anyways: %v", err)
if err := sysinit.New(d.exec).ForceStop("kubelet"); err != nil {
glog.Warningf("couldn't force stop kubelet. will continue with stop anyways: %v", err)
klog.Warningf("couldn't force stop kubelet. will continue with stop anyways: %v", err)
}
}
containers, err := d.runtime.ListContainers(cruntime.ListOptions{})
@ -226,7 +226,7 @@ func (d *Driver) Stop() error {
return errors.Wrap(err, "stop containers")
}
}
glog.Infof("none driver is stopped!")
klog.Infof("none driver is stopped!")
return nil
}
@ -237,7 +237,7 @@ func (d *Driver) RunSSHCommandFromDriver() error {
// restartKubelet restarts the kubelet
func restartKubelet(cr command.Runner) error {
glog.Infof("restarting kubelet.service ...")
klog.Infof("restarting kubelet.service ...")
c := exec.Command("sudo", "systemctl", "restart", "kubelet.service")
if _, err := cr.RunCmd(c); err != nil {
return err

View File

@ -27,10 +27,10 @@ import (
"strings"
"time"
"github.com/golang/glog"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/cobra/doc"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/out"
)
@ -39,7 +39,7 @@ func Docs(root *cobra.Command, path string) error {
cmds := root.Commands()
for _, c := range cmds {
if c.Hidden {
glog.Infof("Skipping generating doc for %s as it's a hidden command", c.Name())
klog.Infof("Skipping generating doc for %s as it's a hidden command", c.Name())
continue
}
contents, err := DocForCommand(c)
@ -98,7 +98,7 @@ func removeHelpText(buffer *bytes.Buffer) string {
}
// scanner strips the ending newline
if _, err := final.WriteString(line + "\n"); err != nil {
glog.Warningf("error removing help text: %v", err)
klog.Warningf("error removing help text: %v", err)
break
}
}
@ -132,7 +132,7 @@ func generateTitle(command *cobra.Command, w io.Writer) error {
func saveDocForCommand(command *cobra.Command, contents []byte, path string) error {
fp := filepath.Join(path, fmt.Sprintf("%s.md", command.Name()))
if err := os.Remove(fp); err != nil {
glog.Warningf("error removing %s", fp)
klog.Warningf("error removing %s", fp)
}
return ioutil.WriteFile(fp, contents, 0o644)
}

View File

@ -22,7 +22,6 @@ import (
"path"
"time"
"github.com/golang/glog"
apps "k8s.io/api/apps/v1"
core "k8s.io/api/core/v1"
apierr "k8s.io/apimachinery/pkg/api/errors"
@ -35,6 +34,7 @@ import (
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
watchtools "k8s.io/client-go/tools/watch"
"k8s.io/klog/v2"
kconst "k8s.io/kubernetes/cmd/kubeadm/app/constants"
"k8s.io/minikube/pkg/minikube/proxy"
"k8s.io/minikube/pkg/minikube/vmpath"
@ -56,7 +56,7 @@ func ClientConfig(context string) (*rest.Config, error) {
return nil, fmt.Errorf("client config: %v", err)
}
c = proxy.UpdateTransport(c)
glog.V(1).Infof("client config for %s: %+v", context, c)
klog.V(1).Infof("client config for %s: %+v", context, c)
return c, nil
}
@ -72,18 +72,18 @@ func Client(context string) (*kubernetes.Clientset, error) {
// WaitForPods waits for all matching pods to become Running or finish successfully and at least one matching pod exists.
func WaitForPods(c kubernetes.Interface, ns string, selector string, timeOut ...time.Duration) error {
start := time.Now()
glog.Infof("Waiting for pod with label %q in ns %q ...", selector, ns)
klog.Infof("Waiting for pod with label %q in ns %q ...", selector, ns)
lastKnownPodNumber := -1
f := func() (bool, error) {
listOpts := meta.ListOptions{LabelSelector: selector}
pods, err := c.CoreV1().Pods(ns).List(listOpts)
if err != nil {
glog.Infof("temporary error: getting Pods with label selector %q : [%v]\n", selector, err)
klog.Infof("temporary error: getting Pods with label selector %q : [%v]\n", selector, err)
return false, nil
}
if lastKnownPodNumber != len(pods.Items) {
glog.Infof("Found %d Pods for label selector %s\n", len(pods.Items), selector)
klog.Infof("Found %d Pods for label selector %s\n", len(pods.Items), selector)
lastKnownPodNumber = len(pods.Items)
}
@ -93,7 +93,7 @@ func WaitForPods(c kubernetes.Interface, ns string, selector string, timeOut ...
for _, pod := range pods.Items {
if pod.Status.Phase != core.PodRunning && pod.Status.Phase != core.PodSucceeded {
glog.Infof("waiting for pod %q, current state: %s: [%v]\n", selector, pod.Status.Phase, err)
klog.Infof("waiting for pod %q, current state: %s: [%v]\n", selector, pod.Status.Phase, err)
return false, nil
}
}
@ -105,7 +105,7 @@ func WaitForPods(c kubernetes.Interface, ns string, selector string, timeOut ...
t = timeOut[0]
}
err := wait.PollImmediate(kconst.APICallRetryInterval, t, f)
glog.Infof("duration metric: took %s to wait for %s ...", time.Since(start), selector)
klog.Infof("duration metric: took %s to wait for %s ...", time.Since(start), selector)
return err
}
@ -135,7 +135,7 @@ func WaitForRCToStabilize(c kubernetes.Interface, ns, name string, timeout time.
*(rc.Spec.Replicas) == rc.Status.Replicas {
return true, nil
}
glog.Infof("Waiting for rc %s to stabilize, generation %v observed generation %v spec.replicas %d status.replicas %d",
klog.Infof("Waiting for rc %s to stabilize, generation %v observed generation %v spec.replicas %d status.replicas %d",
name, rc.Generation, rc.Status.ObservedGeneration, *(rc.Spec.Replicas), rc.Status.Replicas)
}
return false, nil
@ -168,7 +168,7 @@ func WaitForDeploymentToStabilize(c kubernetes.Interface, ns, name string, timeo
*(dp.Spec.Replicas) == dp.Status.Replicas {
return true, nil
}
glog.Infof("Waiting for deployment %s to stabilize, generation %v observed generation %v spec.replicas %d status.replicas %d",
klog.Infof("Waiting for deployment %s to stabilize, generation %v observed generation %v spec.replicas %d status.replicas %d",
name, dp.Generation, dp.Status.ObservedGeneration, *(dp.Spec.Replicas), dp.Status.Replicas)
}
return false, nil
@ -182,16 +182,16 @@ func WaitForService(c kubernetes.Interface, namespace, name string, exist bool,
_, err := c.CoreV1().Services(namespace).Get(name, meta.GetOptions{})
switch {
case err == nil:
glog.Infof("Service %s in namespace %s found.", name, namespace)
klog.Infof("Service %s in namespace %s found.", name, namespace)
return exist, nil
case apierr.IsNotFound(err):
glog.Infof("Service %s in namespace %s disappeared.", name, namespace)
klog.Infof("Service %s in namespace %s disappeared.", name, namespace)
return !exist, nil
case !IsRetryableAPIError(err):
glog.Info("Non-retryable failure while getting service.")
klog.Info("Non-retryable failure while getting service.")
return false, err
default:
glog.Infof("Get service %s in namespace %s failed: %v", name, namespace, err)
klog.Infof("Get service %s in namespace %s failed: %v", name, namespace, err)
return false, nil
}
})

View File

@ -25,8 +25,9 @@ import (
"path"
"time"
"github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/klog/v2"
)
// MemorySource is the source name used for in-memory copies
@ -92,7 +93,7 @@ func NewMemoryAssetTarget(d []byte, targetPath, permissions string) *MemoryAsset
// NewFileAsset creates a new FileAsset
func NewFileAsset(src, targetDir, targetName, permissions string) (*FileAsset, error) {
glog.V(4).Infof("NewFileAsset: %s -> %s", src, path.Join(targetDir, targetName))
klog.V(4).Infof("NewFileAsset: %s -> %s", src, path.Join(targetDir, targetName))
f, err := os.Open(src)
if err != nil {
@ -105,7 +106,7 @@ func NewFileAsset(src, targetDir, targetName, permissions string) (*FileAsset, e
}
if info.Size() == 0 {
glog.Warningf("NewFileAsset: %s is an empty file!", src)
klog.Warningf("NewFileAsset: %s is an empty file!", src)
}
return &FileAsset{
@ -123,7 +124,7 @@ func NewFileAsset(src, targetDir, targetName, permissions string) (*FileAsset, e
func (f *FileAsset) GetLength() (flen int) {
fi, err := os.Stat(f.SourcePath)
if err != nil {
glog.Errorf("stat(%q) failed: %v", f.SourcePath, err)
klog.Errorf("stat(%q) failed: %v", f.SourcePath, err)
return 0
}
return int(fi.Size())
@ -133,7 +134,7 @@ func (f *FileAsset) GetLength() (flen int) {
func (f *FileAsset) GetModTime() (time.Time, error) {
fi, err := os.Stat(f.SourcePath)
if err != nil {
glog.Errorf("stat(%q) failed: %v", f.SourcePath, err)
klog.Errorf("stat(%q) failed: %v", f.SourcePath, err)
return time.Time{}, err
}
return fi.ModTime(), nil
@ -248,7 +249,7 @@ func (m *BinAsset) loadData(isTemplate bool) error {
m.length = len(contents)
m.reader = bytes.NewReader(contents)
glog.V(1).Infof("Created asset %s with %d bytes", m.SourcePath, m.length)
klog.V(1).Infof("Created asset %s with %d bytes", m.SourcePath, m.length)
if m.length == 0 {
return fmt.Errorf("%s is an empty asset", m.SourcePath)
}

View File

@ -24,9 +24,10 @@ import (
"runtime"
"strings"
"github.com/golang/glog"
"github.com/pkg/errors"
"golang.org/x/sync/errgroup"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/command"
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/constants"
@ -40,10 +41,10 @@ import (
func TransferBinaries(cfg config.KubernetesConfig, c command.Runner, sm sysinit.Manager) error {
ok, err := binariesExist(cfg, c)
if err == nil && ok {
glog.Info("Found k8s binaries, skipping transfer")
klog.Info("Found k8s binaries, skipping transfer")
return nil
}
glog.Infof("Didn't find k8s binaries: %v\nInitiating transfer...", err)
klog.Infof("Didn't find k8s binaries: %v\nInitiating transfer...", err)
dir := binRoot(cfg.KubernetesVersion)
_, err = c.RunCmd(exec.Command("sudo", "mkdir", "-p", dir))
@ -62,7 +63,7 @@ func TransferBinaries(cfg config.KubernetesConfig, c command.Runner, sm sysinit.
if name == "kubelet" && sm.Active(name) {
if err := sm.ForceStop(name); err != nil {
glog.Errorf("unable to stop kubelet: %v", err)
klog.Errorf("unable to stop kubelet: %v", err)
}
}

View File

@ -23,8 +23,8 @@ import (
"strings"
"github.com/blang/semver"
"github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/config"
)
@ -121,7 +121,7 @@ func extraConfigForComponent(component string, opts config.ExtraOptionSlice, ver
for _, opt := range opts {
if opt.Component == component {
if val, ok := versionedOpts[opt.Key]; ok {
glog.Infof("Overwriting default %s=%s with user provided %s=%s for component %s", opt.Key, val, opt.Key, opt.Value, component)
klog.Infof("Overwriting default %s=%s with user provided %s=%s for component %s", opt.Key, val, opt.Key, opt.Value, component)
}
versionedOpts[opt.Key] = opt.Value
}

View File

@ -23,8 +23,8 @@ import (
"path"
"github.com/blang/semver"
"github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/bootstrapper/bsutil/ktmpl"
"k8s.io/minikube/pkg/minikube/cni"
"k8s.io/minikube/pkg/minikube/config"
@ -81,7 +81,7 @@ func GenerateKubeadmYAML(cc config.ClusterConfig, n config.Node, r cruntime.Mana
if overrideCIDR != "" {
podCIDR = overrideCIDR
}
glog.Infof("Using pod CIDR: %s", podCIDR)
klog.Infof("Using pod CIDR: %s", podCIDR)
opts := struct {
CertDir string
@ -147,11 +147,11 @@ func GenerateKubeadmYAML(cc config.ClusterConfig, n config.Node, r cruntime.Mana
if version.GTE(semver.MustParse("1.17.0")) {
configTmpl = ktmpl.V1Beta2
}
glog.Infof("kubeadm options: %+v", opts)
klog.Infof("kubeadm options: %+v", opts)
if err := configTmpl.Execute(&b, opts); err != nil {
return nil, err
}
glog.Infof("kubeadm config:\n%s\n", b.String())
klog.Infof("kubeadm config:\n%s\n", b.String())
return b.Bytes(), nil
}

View File

@ -30,11 +30,11 @@ import (
"time"
"github.com/docker/machine/libmachine/state"
"github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/apimachinery/pkg/version"
"k8s.io/client-go/kubernetes"
"k8s.io/klog/v2"
kconst "k8s.io/kubernetes/cmd/kubeadm/app/constants"
"k8s.io/minikube/pkg/minikube/bootstrapper"
"k8s.io/minikube/pkg/minikube/command"
@ -45,7 +45,7 @@ import (
// WaitForAPIServerProcess waits for api server to be healthy returns error if it doesn't
func WaitForAPIServerProcess(r cruntime.Manager, bs bootstrapper.Bootstrapper, cfg config.ClusterConfig, cr command.Runner, start time.Time, timeout time.Duration) error {
glog.Infof("waiting for apiserver process to appear ...")
klog.Infof("waiting for apiserver process to appear ...")
err := wait.PollImmediate(time.Millisecond*500, timeout, func() (bool, error) {
if time.Since(start) > timeout {
return false, fmt.Errorf("cluster wait timed out during process check")
@ -65,7 +65,7 @@ func WaitForAPIServerProcess(r cruntime.Manager, bs bootstrapper.Bootstrapper, c
if err != nil {
return fmt.Errorf("apiserver process never appeared")
}
glog.Infof("duration metric: took %s to wait for apiserver process to appear ...", time.Since(start))
klog.Infof("duration metric: took %s to wait for apiserver process to appear ...", time.Since(start))
return nil
}
@ -81,7 +81,7 @@ func apiServerPID(cr command.Runner) (int, error) {
// WaitForHealthyAPIServer waits for api server status to be running
func WaitForHealthyAPIServer(r cruntime.Manager, bs bootstrapper.Bootstrapper, cfg config.ClusterConfig, cr command.Runner, client *kubernetes.Clientset, start time.Time, hostname string, port int, timeout time.Duration) error {
glog.Infof("waiting for apiserver healthz status ...")
klog.Infof("waiting for apiserver healthz status ...")
hStart := time.Now()
healthz := func() (bool, error) {
@ -96,7 +96,7 @@ func WaitForHealthyAPIServer(r cruntime.Manager, bs bootstrapper.Bootstrapper, c
status, err := apiServerHealthzNow(hostname, port)
if err != nil {
glog.Warningf("status: %v", err)
klog.Warningf("status: %v", err)
return false, nil
}
if status != state.Running {
@ -114,7 +114,7 @@ func WaitForHealthyAPIServer(r cruntime.Manager, bs bootstrapper.Bootstrapper, c
return false, fmt.Errorf("cluster wait timed out during version check")
}
if err := APIServerVersionMatch(client, cfg.KubernetesConfig.KubernetesVersion); err != nil {
glog.Warningf("api server version match failed: %v", err)
klog.Warningf("api server version match failed: %v", err)
return false, nil
}
return true, nil
@ -124,7 +124,7 @@ func WaitForHealthyAPIServer(r cruntime.Manager, bs bootstrapper.Bootstrapper, c
return fmt.Errorf("controlPlane never updated to %s", cfg.KubernetesConfig.KubernetesVersion)
}
glog.Infof("duration metric: took %s to wait for apiserver health ...", time.Since(hStart))
klog.Infof("duration metric: took %s to wait for apiserver health ...", time.Since(hStart))
return nil
}
@ -134,7 +134,7 @@ func APIServerVersionMatch(client *kubernetes.Clientset, expected string) error
if err != nil {
return errors.Wrap(err, "server version")
}
glog.Infof("control plane version: %s", vi)
klog.Infof("control plane version: %s", vi)
if version.CompareKubeAwareVersionStrings(vi.String(), expected) != 0 {
return fmt.Errorf("controlPane = %q, expected: %q", vi.String(), expected)
}
@ -143,26 +143,26 @@ func APIServerVersionMatch(client *kubernetes.Clientset, expected string) error
// APIServerStatus returns apiserver status in libmachine style state.State
func APIServerStatus(cr command.Runner, hostname string, port int) (state.State, error) {
glog.Infof("Checking apiserver status ...")
klog.Infof("Checking apiserver status ...")
pid, err := apiServerPID(cr)
if err != nil {
glog.Warningf("stopped: unable to get apiserver pid: %v", err)
klog.Warningf("stopped: unable to get apiserver pid: %v", err)
return state.Stopped, nil
}
// Get the freezer cgroup entry for this pid
rr, err := cr.RunCmd(exec.Command("sudo", "egrep", "^[0-9]+:freezer:", fmt.Sprintf("/proc/%d/cgroup", pid)))
if err != nil {
glog.Warningf("unable to find freezer cgroup: %v", err)
klog.Warningf("unable to find freezer cgroup: %v", err)
return apiServerHealthz(hostname, port)
}
freezer := strings.TrimSpace(rr.Stdout.String())
glog.Infof("apiserver freezer: %q", freezer)
klog.Infof("apiserver freezer: %q", freezer)
fparts := strings.Split(freezer, ":")
if len(fparts) != 3 {
glog.Warningf("unable to parse freezer - found %d parts: %s", len(fparts), freezer)
klog.Warningf("unable to parse freezer - found %d parts: %s", len(fparts), freezer)
return apiServerHealthz(hostname, port)
}
@ -172,16 +172,16 @@ func APIServerStatus(cr command.Runner, hostname string, port int) (state.State,
// cat: /sys/fs/cgroup/freezer/actions_job/e62ef4349cc5a70f4b49f8a150ace391da6ad6df27073c83ecc03dbf81fde1ce/kubepods/burstable/poda1de58db0ce81d19df7999f6808def1b/5df53230fe3483fd65f341923f18a477fda92ae9cd71061168130ef164fe479c/freezer.state: No such file or directory\n"*
// TODO: #7770 investigate how to handle this error better.
if strings.Contains(rr.Stderr.String(), "freezer.state: No such file or directory\n") {
glog.Infof("unable to get freezer state (might be okay and be related to #770): %s", rr.Stderr.String())
klog.Infof("unable to get freezer state (might be okay and be related to #770): %s", rr.Stderr.String())
} else {
glog.Warningf("unable to get freezer state: %s", rr.Stderr.String())
klog.Warningf("unable to get freezer state: %s", rr.Stderr.String())
}
return apiServerHealthz(hostname, port)
}
fs := strings.TrimSpace(rr.Stdout.String())
glog.Infof("freezer state: %q", fs)
klog.Infof("freezer state: %q", fs)
if fs == "FREEZING" || fs == "FROZEN" {
return state.Paused, nil
}
@ -218,7 +218,7 @@ func apiServerHealthz(hostname string, port int) (state.State, error) {
// apiServerHealthzNow hits the /healthz endpoint and returns libmachine style state.State
func apiServerHealthzNow(hostname string, port int) (state.State, error) {
url := fmt.Sprintf("https://%s/healthz", net.JoinHostPort(hostname, fmt.Sprint(port)))
glog.Infof("Checking apiserver healthz at %s ...", url)
klog.Infof("Checking apiserver healthz at %s ...", url)
// To avoid: x509: certificate signed by unknown authority
tr := &http.Transport{
Proxy: nil, // Avoid using a proxy to speak to a local host
@ -228,17 +228,17 @@ func apiServerHealthzNow(hostname string, port int) (state.State, error) {
resp, err := client.Get(url)
// Connection refused, usually.
if err != nil {
glog.Infof("stopped: %s: %v", url, err)
klog.Infof("stopped: %s: %v", url, err)
return state.Stopped, nil
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
glog.Warningf("unable to read response body: %s", err)
klog.Warningf("unable to read response body: %s", err)
}
glog.Infof("%s returned %d:\n%s", url, resp.StatusCode, body)
klog.Infof("%s returned %d:\n%s", url, resp.StatusCode, body)
if resp.StatusCode == http.StatusUnauthorized {
return state.Error, fmt.Errorf("%s returned code %d (unauthorized). Check your apiserver authorization settings:\n%s", url, resp.StatusCode, body)
}

View File

@ -20,28 +20,28 @@ package kverify
import (
"time"
"github.com/golang/glog"
"github.com/pkg/errors"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/kubernetes"
"k8s.io/klog/v2"
kconst "k8s.io/kubernetes/cmd/kubeadm/app/constants"
)
// WaitForDefaultSA waits for the default service account to be created.
func WaitForDefaultSA(cs *kubernetes.Clientset, timeout time.Duration) error {
glog.Info("waiting for default service account to be created ...")
klog.Info("waiting for default service account to be created ...")
start := time.Now()
saReady := func() (bool, error) {
// equivalent to manual check of 'kubectl --context profile get serviceaccount default'
sas, err := cs.CoreV1().ServiceAccounts("default").List(meta.ListOptions{})
if err != nil {
glog.Infof("temproary error waiting for default SA: %v", err)
klog.Infof("temproary error waiting for default SA: %v", err)
return false, nil
}
for _, sa := range sas.Items {
if sa.Name == "default" {
glog.Infof("found service account: %q", sa.Name)
klog.Infof("found service account: %q", sa.Name)
return true, nil
}
}
@ -51,6 +51,6 @@ func WaitForDefaultSA(cs *kubernetes.Clientset, timeout time.Duration) error {
return errors.Wrapf(err, "waited %s for SA", time.Since(start))
}
glog.Infof("duration metric: took %s for default service account to be created ...", time.Since(start))
klog.Infof("duration metric: took %s for default service account to be created ...", time.Since(start))
return nil
}

View File

@ -21,11 +21,11 @@ import (
"fmt"
"time"
"github.com/golang/glog"
"github.com/pkg/errors"
v1 "k8s.io/api/core/v1"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/klog/v2"
kconst "k8s.io/kubernetes/cmd/kubeadm/app/constants"
"k8s.io/minikube/pkg/util/retry"
)
@ -98,10 +98,10 @@ func (e *ErrNetworkNotReady) Error() string {
// NodePressure verfies that node is not under disk, memory, pid or network pressure.
func NodePressure(cs *kubernetes.Clientset) error {
glog.Info("verifying NodePressure condition ...")
klog.Info("verifying NodePressure condition ...")
start := time.Now()
defer func() {
glog.Infof("duration metric: took %s to run NodePressure ...", time.Since(start))
klog.Infof("duration metric: took %s to run NodePressure ...", time.Since(start))
}()
var ns *v1.NodeList
@ -118,8 +118,8 @@ func NodePressure(cs *kubernetes.Clientset) error {
}
for _, n := range ns.Items {
glog.Infof("node storage ephemeral capacity is %s", n.Status.Capacity.StorageEphemeral())
glog.Infof("node cpu capacity is %s", n.Status.Capacity.Cpu().AsDec())
klog.Infof("node storage ephemeral capacity is %s", n.Status.Capacity.StorageEphemeral())
klog.Infof("node cpu capacity is %s", n.Status.Capacity.Cpu().AsDec())
for _, c := range n.Status.Conditions {
pc := NodeCondition{Type: c.Type, Status: c.Status, Reason: c.Reason, Message: c.Message}
if pc.DiskPressure() {

View File

@ -21,21 +21,21 @@ import (
"fmt"
"time"
"github.com/golang/glog"
"github.com/pkg/errors"
v1 "k8s.io/api/core/v1"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/kubernetes"
"k8s.io/klog/v2"
kconst "k8s.io/kubernetes/cmd/kubeadm/app/constants"
)
// WaitForNodeReady waits till kube client reports node status as "ready"
func WaitForNodeReady(cs *kubernetes.Clientset, timeout time.Duration) error {
glog.Infof("waiting %s for node status to be ready ...", timeout)
klog.Infof("waiting %s for node status to be ready ...", timeout)
start := time.Now()
defer func() {
glog.Infof("duration metric: took %s to wait for WaitForNodeReady...", time.Since(start))
klog.Infof("duration metric: took %s to wait for WaitForNodeReady...", time.Since(start))
}()
checkReady := func() (bool, error) {
if time.Since(start) > timeout {
@ -43,14 +43,14 @@ func WaitForNodeReady(cs *kubernetes.Clientset, timeout time.Duration) error {
}
ns, err := cs.CoreV1().Nodes().List(meta.ListOptions{})
if err != nil {
glog.Infof("error listing nodes will retry: %v", err)
klog.Infof("error listing nodes will retry: %v", err)
return false, nil
}
for _, n := range ns.Items {
for _, c := range n.Status.Conditions {
if c.Type == v1.NodeReady && c.Status != v1.ConditionTrue {
glog.Infof("node %q has unwanted condition %q : Reason %q Message: %q. will try. ", n.Name, c.Type, c.Reason, c.Message)
klog.Infof("node %q has unwanted condition %q : Reason %q Message: %q. will try. ", n.Name, c.Type, c.Reason, c.Message)
return false, nil
}
}

View File

@ -23,11 +23,11 @@ import (
"time"
"github.com/docker/machine/libmachine/state"
"github.com/golang/glog"
"github.com/pkg/errors"
core "k8s.io/api/core/v1"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/klog/v2"
kconst "k8s.io/kubernetes/cmd/kubeadm/app/constants"
"k8s.io/minikube/pkg/minikube/bootstrapper"
"k8s.io/minikube/pkg/minikube/command"
@ -40,7 +40,7 @@ import (
// WaitForSystemPods verifies essential pods for running kurnetes is running
func WaitForSystemPods(r cruntime.Manager, bs bootstrapper.Bootstrapper, cfg config.ClusterConfig, cr command.Runner, client *kubernetes.Clientset, start time.Time, timeout time.Duration) error {
glog.Info("waiting for kube-system pods to appear ...")
klog.Info("waiting for kube-system pods to appear ...")
pStart := time.Now()
podList := func() error {
@ -52,13 +52,13 @@ func WaitForSystemPods(r cruntime.Manager, bs bootstrapper.Bootstrapper, cfg con
// Wait for any system pod, as waiting for apiserver may block until etcd
pods, err := client.CoreV1().Pods("kube-system").List(meta.ListOptions{})
if err != nil {
glog.Warningf("pod list returned error: %v", err)
klog.Warningf("pod list returned error: %v", err)
return err
}
glog.Infof("%d kube-system pods found", len(pods.Items))
klog.Infof("%d kube-system pods found", len(pods.Items))
for _, pod := range pods.Items {
glog.Infof(podStatusMsg(pod))
klog.Infof(podStatusMsg(pod))
}
if len(pods.Items) < 2 {
@ -71,7 +71,7 @@ func WaitForSystemPods(r cruntime.Manager, bs bootstrapper.Bootstrapper, cfg con
if err := retry.Local(podList, timeout); err != nil {
return fmt.Errorf("apiserver never returned a pod list")
}
glog.Infof("duration metric: took %s to wait for pod list to return data ...", time.Since(pStart))
klog.Infof("duration metric: took %s to wait for pod list to return data ...", time.Since(pStart))
return nil
}
@ -83,10 +83,10 @@ func ExpectAppsRunning(cs *kubernetes.Clientset, expected []string) error {
if err != nil {
return err
}
glog.Infof("%d kube-system pods found", len(pods.Items))
klog.Infof("%d kube-system pods found", len(pods.Items))
for _, pod := range pods.Items {
glog.Infof(podStatusMsg(pod))
klog.Infof(podStatusMsg(pod))
if pod.Status.Phase != core.PodRunning {
continue
@ -113,7 +113,7 @@ func ExpectAppsRunning(cs *kubernetes.Clientset, expected []string) error {
// WaitForAppsRunning waits for expected Apps To be running
func WaitForAppsRunning(cs *kubernetes.Clientset, expected []string, timeout time.Duration) error {
glog.Info("waiting for k8s-apps to be running ...")
klog.Info("waiting for k8s-apps to be running ...")
start := time.Now()
checkRunning := func() error {
@ -123,7 +123,7 @@ func WaitForAppsRunning(cs *kubernetes.Clientset, expected []string, timeout tim
if err := retry.Local(checkRunning, timeout); err != nil {
return errors.Wrapf(err, "expected k8s-apps")
}
glog.Infof("duration metric: took %s to wait for k8s-apps to be running ...", time.Since(start))
klog.Infof("duration metric: took %s to wait for k8s-apps to be running ...", time.Since(start))
return nil
}
@ -158,7 +158,7 @@ func announceProblems(r cruntime.Manager, bs bootstrapper.Bootstrapper, cfg conf
// KubeletStatus checks the kubelet status
func KubeletStatus(cr command.Runner) state.State {
glog.Infof("Checking kubelet status ...")
klog.Infof("Checking kubelet status ...")
active := sysinit.New(cr).Active("kubelet")
if active {
return state.Running

View File

@ -20,8 +20,8 @@ import (
"os/exec"
"strings"
"github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/command"
)
@ -31,12 +31,12 @@ func AdjustResourceLimits(c command.Runner) error {
if err != nil {
return errors.Wrapf(err, "oom_adj check cmd %s. ", rr.Command())
}
glog.Infof("apiserver oom_adj: %s", rr.Stdout.String())
klog.Infof("apiserver oom_adj: %s", rr.Stdout.String())
// oom_adj is already a negative number
if strings.HasPrefix(rr.Stdout.String(), "-") {
return nil
}
glog.Infof("adjusting apiserver oom_adj to -10")
klog.Infof("adjusting apiserver oom_adj to -10")
// Prevent the apiserver from OOM'ing before other pods, as it is our gateway into the cluster.
// It'd be preferable to do this via Kubernetes, but kubeadm doesn't have a way to set pod QoS.

View File

@ -29,12 +29,12 @@ import (
"sort"
"strings"
"github.com/golang/glog"
"github.com/otiai10/copy"
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/tools/clientcmd/api"
"k8s.io/client-go/tools/clientcmd/api/latest"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/drivers/kic/oci"
"k8s.io/minikube/pkg/minikube/assets"
"k8s.io/minikube/pkg/minikube/command"
@ -49,7 +49,7 @@ import (
// SetupCerts gets the generated credentials required to talk to the APIServer.
func SetupCerts(cmd command.Runner, k8s config.KubernetesConfig, n config.Node) ([]assets.CopyableFile, error) {
localPath := localpath.Profile(k8s.ClusterName)
glog.Infof("Setting up %s for IP: %s\n", localPath, n.IP)
klog.Infof("Setting up %s for IP: %s\n", localPath, n.IP)
ccs, err := generateSharedCACerts()
if err != nil {
@ -166,11 +166,11 @@ func generateSharedCACerts() (CACerts, error) {
for _, ca := range caCertSpecs {
if canRead(ca.certPath) && canRead(ca.keyPath) {
glog.Infof("skipping %s CA generation: %s", ca.subject, ca.keyPath)
klog.Infof("skipping %s CA generation: %s", ca.subject, ca.keyPath)
continue
}
glog.Infof("generating %s CA: %s", ca.subject, ca.keyPath)
klog.Infof("generating %s CA: %s", ca.subject, ca.keyPath)
if err := util.GenerateCACert(ca.certPath, ca.keyPath, ca.subject); err != nil {
return cc, errors.Wrap(err, "generate ca cert")
}
@ -266,11 +266,11 @@ func generateProfileCerts(k8s config.KubernetesConfig, n config.Node, ccs CACert
}
if canRead(cp) && canRead(kp) {
glog.Infof("skipping %s signed cert generation: %s", spec.subject, kp)
klog.Infof("skipping %s signed cert generation: %s", spec.subject, kp)
continue
}
glog.Infof("generating %s signed cert: %s", spec.subject, kp)
klog.Infof("generating %s signed cert: %s", spec.subject, kp)
err := util.GenerateSignedCert(
cp, kp, spec.subject,
spec.ips, spec.alternateNames,
@ -281,11 +281,11 @@ func generateProfileCerts(k8s config.KubernetesConfig, n config.Node, ccs CACert
}
if spec.hash != "" {
glog.Infof("copying %s -> %s", cp, spec.certPath)
klog.Infof("copying %s -> %s", cp, spec.certPath)
if err := copy.Copy(cp, spec.certPath); err != nil {
return xfer, errors.Wrap(err, "copy cert")
}
glog.Infof("copying %s -> %s", kp, spec.keyPath)
klog.Infof("copying %s -> %s", kp, spec.keyPath)
if err := copy.Copy(kp, spec.keyPath); err != nil {
return xfer, errors.Wrap(err, "copy key")
}
@ -341,11 +341,11 @@ func collectCACerts() (map[string]string, error) {
if ext == ".crt" || ext == ".pem" {
if info.Size() < 32 {
glog.Warningf("ignoring %s, impossibly tiny %d bytes", fullPath, info.Size())
klog.Warningf("ignoring %s, impossibly tiny %d bytes", fullPath, info.Size())
return nil
}
glog.Infof("found cert: %s (%d bytes)", fullPath, info.Size())
klog.Infof("found cert: %s (%d bytes)", fullPath, info.Size())
validPem, err := isValidPEMCertificate(hostpath)
if err != nil {
@ -386,7 +386,7 @@ func getSubjectHash(cr command.Runner, filePath string) (string, error) {
if err != nil {
return "", err
}
glog.Infof("hashing: %s", lrr.Stdout.String())
klog.Infof("hashing: %s", lrr.Stdout.String())
rr, err := cr.RunCmd(exec.Command("openssl", "x509", "-hash", "-noout", "-in", filePath))
if err != nil {
@ -407,7 +407,7 @@ func installCertSymlinks(cr command.Runner, caCerts map[string]string) error {
}
if !hasSSLBinary && len(caCerts) > 0 {
glog.Warning("OpenSSL not found. Please recreate the cluster with the latest minikube ISO.")
klog.Warning("OpenSSL not found. Please recreate the cluster with the latest minikube ISO.")
}
for _, caCertFile := range caCerts {

View File

@ -33,10 +33,10 @@ import (
"github.com/blang/semver"
"github.com/docker/machine/libmachine"
"github.com/docker/machine/libmachine/state"
"github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/kubernetes"
"k8s.io/klog/v2"
kconst "k8s.io/kubernetes/cmd/kubeadm/app/constants"
"k8s.io/minikube/pkg/drivers/kic/oci"
"k8s.io/minikube/pkg/kapi"
@ -119,10 +119,10 @@ func (k *Bootstrapper) createCompatSymlinks() error {
legacyEtcd := "/data/minikube"
if _, err := k.c.RunCmd(exec.Command("sudo", "test", "-d", legacyEtcd)); err != nil {
glog.Infof("%s skipping compat symlinks: %v", legacyEtcd, err)
klog.Infof("%s skipping compat symlinks: %v", legacyEtcd, err)
return nil
}
glog.Infof("Found %s, creating compatibility symlinks ...", legacyEtcd)
klog.Infof("Found %s, creating compatibility symlinks ...", legacyEtcd)
c := exec.Command("sudo", "ln", "-s", legacyEtcd, bsutil.EtcdDataDir())
if rr, err := k.c.RunCmd(c); err != nil {
@ -144,10 +144,10 @@ func (k *Bootstrapper) clearStaleConfigs(cfg config.ClusterConfig) error {
args := append([]string{"ls", "-la"}, paths...)
rr, err := k.c.RunCmd(exec.Command("sudo", args...))
if err != nil {
glog.Infof("config check failed, skipping stale config cleanup: %v", err)
klog.Infof("config check failed, skipping stale config cleanup: %v", err)
return nil
}
glog.Infof("found existing configuration files:\n%s\n", rr.Stdout.String())
klog.Infof("found existing configuration files:\n%s\n", rr.Stdout.String())
cp, err := config.PrimaryControlPlane(&cfg)
if err != nil {
@ -158,11 +158,11 @@ func (k *Bootstrapper) clearStaleConfigs(cfg config.ClusterConfig) error {
for _, path := range paths {
_, err := k.c.RunCmd(exec.Command("sudo", "grep", endpoint, path))
if err != nil {
glog.Infof("%q may not be in %s - will remove: %v", endpoint, path, err)
klog.Infof("%q may not be in %s - will remove: %v", endpoint, path, err)
_, err := k.c.RunCmd(exec.Command("sudo", "rm", "-f", path))
if err != nil {
glog.Errorf("rm failed: %v", err)
klog.Errorf("rm failed: %v", err)
}
}
}
@ -197,18 +197,18 @@ func (k *Bootstrapper) init(cfg config.ClusterConfig) error {
skipSystemVerification := false
// Allow older kubeadm versions to function with newer Docker releases.
if version.LT(semver.MustParse("1.13.0")) {
glog.Infof("ignoring SystemVerification for kubeadm because of old Kubernetes version %v", version)
klog.Infof("ignoring SystemVerification for kubeadm because of old Kubernetes version %v", version)
skipSystemVerification = true
}
if driver.BareMetal(cfg.Driver) && r.Name() == "Docker" {
if v, err := r.Version(); err == nil && strings.Contains(v, "azure") {
glog.Infof("ignoring SystemVerification for kubeadm because of unknown docker version %s", v)
klog.Infof("ignoring SystemVerification for kubeadm because of unknown docker version %s", v)
skipSystemVerification = true
}
}
// For kic on linux example error: "modprobe: FATAL: Module configs not found in directory /lib/modules/5.2.17-1rodete3-amd64"
if driver.IsKIC(cfg.Driver) {
glog.Infof("ignoring SystemVerification for kubeadm because of %s driver", cfg.Driver)
klog.Infof("ignoring SystemVerification for kubeadm because of %s driver", cfg.Driver)
skipSystemVerification = true
}
if skipSystemVerification {
@ -249,21 +249,21 @@ func (k *Bootstrapper) init(cfg config.ClusterConfig) error {
go func() {
// we need to have cluster role binding before applying overlay to avoid #7428
if err := k.elevateKubeSystemPrivileges(cfg); err != nil {
glog.Errorf("unable to create cluster role binding, some addons might not work: %v", err)
klog.Errorf("unable to create cluster role binding, some addons might not work: %v", err)
}
wg.Done()
}()
go func() {
if err := k.applyNodeLabels(cfg); err != nil {
glog.Warningf("unable to apply node labels: %v", err)
klog.Warningf("unable to apply node labels: %v", err)
}
wg.Done()
}()
go func() {
if err := bsutil.AdjustResourceLimits(k.c); err != nil {
glog.Warningf("unable to adjust resource limits: %v", err)
klog.Warningf("unable to adjust resource limits: %v", err)
}
wg.Done()
}()
@ -321,18 +321,18 @@ func (k *Bootstrapper) unpause(cfg config.ClusterConfig) error {
// StartCluster starts the cluster
func (k *Bootstrapper) StartCluster(cfg config.ClusterConfig) error {
start := time.Now()
glog.Infof("StartCluster: %+v", cfg)
klog.Infof("StartCluster: %+v", cfg)
defer func() {
glog.Infof("StartCluster complete in %s", time.Since(start))
klog.Infof("StartCluster complete in %s", time.Since(start))
}()
// Before we start, ensure that no paused components are lurking around
if err := k.unpause(cfg); err != nil {
glog.Warningf("unpause failed: %v", err)
klog.Warningf("unpause failed: %v", err)
}
if err := bsutil.ExistingConfig(k.c); err == nil {
glog.Infof("found existing configuration files, will attempt cluster restart")
klog.Infof("found existing configuration files, will attempt cluster restart")
rerr := k.restartControlPlane(cfg)
if rerr == nil {
return nil
@ -340,7 +340,7 @@ func (k *Bootstrapper) StartCluster(cfg config.ClusterConfig) error {
out.ErrT(style.Embarrassed, "Unable to restart cluster, will reset it: {{.error}}", out.V{"error": rerr})
if err := k.DeleteCluster(cfg.KubernetesConfig); err != nil {
glog.Warningf("delete failed: %v", err)
klog.Warningf("delete failed: %v", err)
}
// Fall-through to init
}
@ -359,7 +359,7 @@ func (k *Bootstrapper) StartCluster(cfg config.ClusterConfig) error {
if _, ff := err.(*FailFastError); !ff {
out.ErrT(style.Conflict, "initialization failed, will try again: {{.error}}", out.V{"error": err})
if err := k.DeleteCluster(cfg.KubernetesConfig); err != nil {
glog.Warningf("delete failed: %v", err)
klog.Warningf("delete failed: %v", err)
}
return k.init(cfg)
}
@ -379,7 +379,7 @@ func (k *Bootstrapper) client(ip string, port int) (*kubernetes.Clientset, error
endpoint := fmt.Sprintf("https://%s", net.JoinHostPort(ip, strconv.Itoa(port)))
if cc.Host != endpoint {
glog.Warningf("Overriding stale ClientConfig host %s with %s", cc.Host, endpoint)
klog.Warningf("Overriding stale ClientConfig host %s with %s", cc.Host, endpoint)
cc.Host = endpoint
}
c, err := kubernetes.NewForConfig(cc)
@ -412,7 +412,7 @@ func (k *Bootstrapper) WaitForNode(cfg config.ClusterConfig, n config.Node, time
}
if !kverify.ShouldWait(cfg.VerifyComponents) {
glog.Infof("skip waiting for components based on config.")
klog.Infof("skip waiting for components based on config.")
if err := kverify.NodePressure(client); err != nil {
adviseNodePressure(err, cfg.Name, cfg.Driver)
@ -462,7 +462,7 @@ func (k *Bootstrapper) WaitForNode(cfg config.ClusterConfig, n config.Node, time
}
}
glog.Infof("duration metric: took %s to wait for : %+v ...", time.Since(start), cfg.VerifyComponents)
klog.Infof("duration metric: took %s to wait for : %+v ...", time.Since(start), cfg.VerifyComponents)
if err := kverify.NodePressure(client); err != nil {
adviseNodePressure(err, cfg.Name, cfg.Driver)
@ -474,43 +474,43 @@ func (k *Bootstrapper) WaitForNode(cfg config.ClusterConfig, n config.Node, time
// needsReconfigure returns whether or not the cluster needs to be reconfigured
func (k *Bootstrapper) needsReconfigure(conf string, hostname string, port int, client *kubernetes.Clientset, version string) bool {
if rr, err := k.c.RunCmd(exec.Command("sudo", "diff", "-u", conf, conf+".new")); err != nil {
glog.Infof("needs reconfigure: configs differ:\n%s", rr.Output())
klog.Infof("needs reconfigure: configs differ:\n%s", rr.Output())
return true
}
st, err := kverify.APIServerStatus(k.c, hostname, port)
if err != nil {
glog.Infof("needs reconfigure: apiserver error: %v", err)
klog.Infof("needs reconfigure: apiserver error: %v", err)
return true
}
if st != state.Running {
glog.Infof("needs reconfigure: apiserver in state %s", st)
klog.Infof("needs reconfigure: apiserver in state %s", st)
return true
}
if err := kverify.ExpectAppsRunning(client, kverify.AppsRunningList); err != nil {
glog.Infof("needs reconfigure: %v", err)
klog.Infof("needs reconfigure: %v", err)
return true
}
if err := kverify.APIServerVersionMatch(client, version); err != nil {
glog.Infof("needs reconfigure: %v", err)
klog.Infof("needs reconfigure: %v", err)
return true
}
// DANGER: This log message is hard-coded in an integration test!
glog.Infof("The running cluster does not require reconfiguration: %s", hostname)
klog.Infof("The running cluster does not require reconfiguration: %s", hostname)
return false
}
// restartCluster restarts the Kubernetes cluster configured by kubeadm
func (k *Bootstrapper) restartControlPlane(cfg config.ClusterConfig) error {
glog.Infof("restartCluster start")
klog.Infof("restartCluster start")
start := time.Now()
defer func() {
glog.Infof("restartCluster took %s", time.Since(start))
klog.Infof("restartCluster took %s", time.Since(start))
}()
version, err := util.ParseKubernetesVersion(cfg.KubernetesConfig.KubernetesVersion)
@ -526,7 +526,7 @@ func (k *Bootstrapper) restartControlPlane(cfg config.ClusterConfig) error {
}
if err := k.createCompatSymlinks(); err != nil {
glog.Errorf("failed to create compat symlinks: %v", err)
klog.Errorf("failed to create compat symlinks: %v", err)
}
cp, err := config.PrimaryControlPlane(&cfg)
@ -542,7 +542,7 @@ func (k *Bootstrapper) restartControlPlane(cfg config.ClusterConfig) error {
// Save the costly tax of reinstalling Kubernetes if the only issue is a missing kube context
_, err = kubeconfig.UpdateEndpoint(cfg.Name, hostname, port, kubeconfig.PathFromEnv())
if err != nil {
glog.Warningf("unable to update kubeconfig (cluster will likely require a reset): %v", err)
klog.Warningf("unable to update kubeconfig (cluster will likely require a reset): %v", err)
}
client, err := k.client(hostname, port)
@ -553,16 +553,16 @@ func (k *Bootstrapper) restartControlPlane(cfg config.ClusterConfig) error {
// If the cluster is running, check if we have any work to do.
conf := bsutil.KubeadmYamlPath
if !k.needsReconfigure(conf, hostname, port, client, cfg.KubernetesConfig.KubernetesVersion) {
glog.Infof("Taking a shortcut, as the cluster seems to be properly configured")
klog.Infof("Taking a shortcut, as the cluster seems to be properly configured")
return nil
}
if err := k.stopKubeSystem(cfg); err != nil {
glog.Warningf("Failed to stop kube-system containers: port conflicts may arise: %v", err)
klog.Warningf("Failed to stop kube-system containers: port conflicts may arise: %v", err)
}
if err := sysinit.New(k.c).Stop("kubelet"); err != nil {
glog.Warningf("Failed to stop kubelet, this might cause upgrade errors: %v", err)
klog.Warningf("Failed to stop kubelet, this might cause upgrade errors: %v", err)
}
if err := k.clearStaleConfigs(cfg); err != nil {
@ -582,11 +582,11 @@ func (k *Bootstrapper) restartControlPlane(cfg config.ClusterConfig) error {
fmt.Sprintf("%s phase etcd local --config %s", baseCmd, conf),
}
glog.Infof("reconfiguring cluster from %s", conf)
klog.Infof("reconfiguring cluster from %s", conf)
// Run commands one at a time so that it is easier to root cause failures.
for _, c := range cmds {
if _, err := k.c.RunCmd(exec.Command("/bin/bash", "-c", c)); err != nil {
glog.Errorf("%s failed - will try once more: %v", c, err)
klog.Errorf("%s failed - will try once more: %v", c, err)
if _, err := k.c.RunCmd(exec.Command("/bin/bash", "-c", c)); err != nil {
return errors.Wrap(err, "run")
@ -627,12 +627,12 @@ func (k *Bootstrapper) restartControlPlane(cfg config.ClusterConfig) error {
return err
}
if err = retry.Expo(addonPhase, 100*time.Microsecond, 30*time.Second); err != nil {
glog.Warningf("addon install failed, wil retry: %v", err)
klog.Warningf("addon install failed, wil retry: %v", err)
return errors.Wrap(err, "addons")
}
if err := bsutil.AdjustResourceLimits(k.c); err != nil {
glog.Warningf("unable to adjust resource limits: %v", err)
klog.Warningf("unable to adjust resource limits: %v", err)
}
return nil
}
@ -640,9 +640,9 @@ func (k *Bootstrapper) restartControlPlane(cfg config.ClusterConfig) error {
// JoinCluster adds a node to an existing cluster
func (k *Bootstrapper) JoinCluster(cc config.ClusterConfig, n config.Node, joinCmd string) error {
start := time.Now()
glog.Infof("JoinCluster: %+v", cc)
klog.Infof("JoinCluster: %+v", cc)
defer func() {
glog.Infof("JoinCluster complete in %s", time.Since(start))
klog.Infof("JoinCluster complete in %s", time.Since(start))
}()
// Join the master by specifying its token
@ -652,13 +652,13 @@ func (k *Bootstrapper) JoinCluster(cc config.ClusterConfig, n config.Node, joinC
// reset first to clear any possibly existing state
_, err := k.c.RunCmd(exec.Command("/bin/bash", "-c", fmt.Sprintf("%s reset -f", bsutil.InvokeKubeadm(cc.KubernetesConfig.KubernetesVersion))))
if err != nil {
glog.Infof("kubeadm reset failed, continuing anyway: %v", err)
klog.Infof("kubeadm reset failed, continuing anyway: %v", err)
}
out, err := k.c.RunCmd(exec.Command("/bin/bash", "-c", joinCmd))
if err != nil {
if strings.Contains(err.Error(), "status \"Ready\" already exists in the cluster") {
glog.Infof("Node %s already joined the cluster, skip failure.", n.Name)
klog.Infof("Node %s already joined the cluster, skip failure.", n.Name)
} else {
return errors.Wrapf(err, "cmd failed: %s\n%+v\n", joinCmd, out.Output())
}
@ -720,21 +720,21 @@ func (k *Bootstrapper) DeleteCluster(k8s config.KubernetesConfig) error {
rr, derr := k.c.RunCmd(exec.Command("/bin/bash", "-c", cmd))
if derr != nil {
glog.Warningf("%s: %v", rr.Command(), err)
klog.Warningf("%s: %v", rr.Command(), err)
}
if err := sysinit.New(k.c).ForceStop("kubelet"); err != nil {
glog.Warningf("stop kubelet: %v", err)
klog.Warningf("stop kubelet: %v", err)
}
containers, err := cr.ListContainers(cruntime.ListOptions{Namespaces: []string{"kube-system"}})
if err != nil {
glog.Warningf("unable to list kube-system containers: %v", err)
klog.Warningf("unable to list kube-system containers: %v", err)
}
if len(containers) > 0 {
glog.Warningf("found %d kube-system containers to stop", len(containers))
klog.Warningf("found %d kube-system containers to stop", len(containers))
if err := cr.StopContainers(containers); err != nil {
glog.Warningf("error stopping containers: %v", err)
klog.Warningf("error stopping containers: %v", err)
}
}
@ -763,7 +763,7 @@ func (k *Bootstrapper) UpdateCluster(cfg config.ClusterConfig) error {
}
if err := r.Preload(cfg.KubernetesConfig); err != nil {
glog.Infof("preload failed, will try to load cached images: %v", err)
klog.Infof("preload failed, will try to load cached images: %v", err)
}
if cfg.KubernetesConfig.ShouldLoadCachedImages {
@ -802,7 +802,7 @@ func (k *Bootstrapper) UpdateNode(cfg config.ClusterConfig, n config.Node, r cru
return errors.Wrap(err, "generating kubelet service")
}
glog.Infof("kubelet %s config:\n%+v", kubeletCfg, cfg.KubernetesConfig)
klog.Infof("kubelet %s config:\n%+v", kubeletCfg, cfg.KubernetesConfig)
sm := sysinit.New(k.c)
@ -878,7 +878,7 @@ func (k *Bootstrapper) applyNodeLabels(cfg config.ClusterConfig) error {
func (k *Bootstrapper) elevateKubeSystemPrivileges(cfg config.ClusterConfig) error {
start := time.Now()
defer func() {
glog.Infof("duration metric: took %s to wait for elevateKubeSystemPrivileges.", time.Since(start))
klog.Infof("duration metric: took %s to wait for elevateKubeSystemPrivileges.", time.Since(start))
}()
// Allow no more than 5 seconds for creating cluster role bindings
@ -896,7 +896,7 @@ func (k *Bootstrapper) elevateKubeSystemPrivileges(cfg config.ClusterConfig) err
}
// Error from server (AlreadyExists): clusterrolebindings.rbac.authorization.k8s.io "minikube-rbac" already exists
if strings.Contains(rr.Output(), "Error from server (AlreadyExists)") {
glog.Infof("rbac %q already exists not need to re-create.", rbacName)
klog.Infof("rbac %q already exists not need to re-create.", rbacName)
} else {
return errors.Wrapf(err, "apply sa")
}
@ -925,7 +925,7 @@ func (k *Bootstrapper) elevateKubeSystemPrivileges(cfg config.ClusterConfig) err
// stopKubeSystem stops all the containers in the kube-system to prevent #8740 when doing hot upgrade
func (k *Bootstrapper) stopKubeSystem(cfg config.ClusterConfig) error {
glog.Info("stopping kube-system containers ...")
klog.Info("stopping kube-system containers ...")
cr, err := cruntime.New(cruntime.Config{Type: cfg.KubernetesConfig.ContainerRuntime, Runner: k.c})
if err != nil {
return errors.Wrap(err, "new cruntime")
@ -948,7 +948,7 @@ func (k *Bootstrapper) stopKubeSystem(cfg config.ClusterConfig) error {
func adviseNodePressure(err error, name string, drv string) {
if diskErr, ok := err.(*kverify.ErrDiskPressure); ok {
out.ErrLn("")
glog.Warning(diskErr)
klog.Warning(diskErr)
out.WarningT("The node {{.name}} has ran out of disk space.", out.V{"name": name})
// generic advice for all drivers
out.T(style.Tip, "Please free up disk or prune images.")
@ -969,7 +969,7 @@ func adviseNodePressure(err error, name string, drv string) {
if memErr, ok := err.(*kverify.ErrMemoryPressure); ok {
out.ErrLn("")
glog.Warning(memErr)
klog.Warning(memErr)
out.WarningT("The node {{.name}} has ran out of memory.", out.V{"name": name})
out.T(style.Tip, "Check if you have unnecessary pods running by running 'kubectl get po -A")
if driver.IsVM(drv) {
@ -988,7 +988,7 @@ func adviseNodePressure(err error, name string, drv string) {
}
if pidErr, ok := err.(*kverify.ErrPIDPressure); ok {
glog.Warning(pidErr)
klog.Warning(pidErr)
out.ErrLn("")
out.WarningT("The node {{.name}} has ran out of available PIDs.", out.V{"name": name})
out.ErrLn("")
@ -996,7 +996,7 @@ func adviseNodePressure(err error, name string, drv string) {
}
if netErr, ok := err.(*kverify.ErrNetworkNotReady); ok {
glog.Warning(netErr)
klog.Warning(netErr)
out.ErrLn("")
out.WarningT("The node {{.name}} network is not available. Please verify network settings.", out.V{"name": name})
out.ErrLn("")

View File

@ -26,8 +26,8 @@ import (
"github.com/docker/machine/libmachine"
"github.com/docker/machine/libmachine/host"
"github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/drivers/kic/oci"
"k8s.io/minikube/pkg/minikube/driver"
"k8s.io/minikube/pkg/minikube/machine"
@ -164,7 +164,7 @@ func getIPForInterface(name string) (net.IP, error) {
return nil, errors.Errorf("Could not find interface %s inside %+v", name, ints)
}
glog.Infof("Found hyperv interface: %+v\n", i)
klog.Infof("Found hyperv interface: %+v\n", i)
addrs, _ := i.Addrs()
for _, a := range addrs {
if ipnet, ok := a.(*net.IPNet); ok {

View File

@ -24,8 +24,8 @@ import (
"strconv"
"strings"
"github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/command"
)
@ -69,7 +69,7 @@ func Mount(r mountRunner, source string, target string, c *MountConfig) error {
return errors.Wrapf(err, "mount with cmd %s ", rr.Command())
}
glog.Infof("mount successful: %q", rr.Output())
klog.Infof("mount successful: %q", rr.Output())
return nil
}
@ -144,6 +144,6 @@ func Unmount(r mountRunner, target string) error {
if _, err := r.RunCmd(c); err != nil {
return errors.Wrap(err, "unmount")
}
glog.Infof("unmount for %s ran successfully", target)
klog.Infof("unmount for %s ran successfully", target)
return nil
}

View File

@ -19,8 +19,8 @@ package cluster
import (
"time"
"github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/command"
"k8s.io/minikube/pkg/minikube/cruntime"
"k8s.io/minikube/pkg/minikube/sysinit"
@ -61,7 +61,7 @@ func pause(cr cruntime.Manager, r command.Runner, namespaces []string) ([]string
}
if len(ids) == 0 {
glog.Warningf("no running containers to pause")
klog.Warningf("no running containers to pause")
return ids, nil
}
@ -90,7 +90,7 @@ func unpause(cr cruntime.Manager, r command.Runner, namespaces []string) ([]stri
}
if len(ids) == 0 {
glog.Warningf("no paused containers found")
klog.Warningf("no paused containers found")
} else if err := cr.UnpauseContainers(ids); err != nil {
return ids, errors.Wrap(err, "unpause")
}

View File

@ -24,9 +24,9 @@ import (
"path"
"time"
"github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/minikube/pkg/kapi"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/assets"
"k8s.io/minikube/pkg/minikube/command"
"k8s.io/minikube/pkg/minikube/config"
@ -67,11 +67,11 @@ type tmplInput struct {
// New returns a new CNI manager
func New(cc config.ClusterConfig) (Manager, error) {
if cc.KubernetesConfig.NetworkPlugin != "" && cc.KubernetesConfig.NetworkPlugin != "cni" {
glog.Infof("network plugin configured as %q, returning disabled", cc.KubernetesConfig.NetworkPlugin)
klog.Infof("network plugin configured as %q, returning disabled", cc.KubernetesConfig.NetworkPlugin)
return Disabled{}, nil
}
glog.Infof("Creating CNI manager for %q", cc.KubernetesConfig.CNI)
klog.Infof("Creating CNI manager for %q", cc.KubernetesConfig.CNI)
switch cc.KubernetesConfig.CNI {
case "", "auto":
@ -96,25 +96,25 @@ func New(cc config.ClusterConfig) (Manager, error) {
func chooseDefault(cc config.ClusterConfig) Manager {
// For backwards compatibility with older profiles using --enable-default-cni
if cc.KubernetesConfig.EnableDefaultCNI {
glog.Infof("EnableDefaultCNI is true, recommending bridge")
klog.Infof("EnableDefaultCNI is true, recommending bridge")
return Bridge{}
}
if cc.KubernetesConfig.ContainerRuntime != "docker" {
if driver.IsKIC(cc.Driver) {
glog.Infof("%q driver + %s runtime found, recommending kindnet", cc.Driver, cc.KubernetesConfig.ContainerRuntime)
klog.Infof("%q driver + %s runtime found, recommending kindnet", cc.Driver, cc.KubernetesConfig.ContainerRuntime)
return KindNet{cc: cc}
}
glog.Infof("%q driver + %s runtime found, recommending bridge", cc.Driver, cc.KubernetesConfig.ContainerRuntime)
klog.Infof("%q driver + %s runtime found, recommending bridge", cc.Driver, cc.KubernetesConfig.ContainerRuntime)
return Bridge{cc: cc}
}
if len(cc.Nodes) > 1 {
glog.Infof("%d nodes found, recommending kindnet", len(cc.Nodes))
klog.Infof("%d nodes found, recommending kindnet", len(cc.Nodes))
return KindNet{cc: cc}
}
glog.Infof("CNI unnecessary in this configuration, recommending no CNI")
klog.Infof("CNI unnecessary in this configuration, recommending no CNI")
return Disabled{}
}
@ -134,7 +134,7 @@ func applyManifest(cc config.ClusterConfig, r Runner, f assets.CopyableFile) err
defer cancel()
kubectl := kapi.KubectlBinaryPath(cc.KubernetesConfig.KubernetesVersion)
glog.Infof("applying CNI manifest using %s ...", kubectl)
klog.Infof("applying CNI manifest using %s ...", kubectl)
if err := r.Copy(f); err != nil {
return errors.Wrapf(err, "copy")

View File

@ -17,7 +17,7 @@ limitations under the License.
package cni
import (
"github.com/golang/glog"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/driver"
)
@ -35,11 +35,11 @@ func (c Disabled) String() string {
// Apply enables the CNI
func (c Disabled) Apply(r Runner) error {
if driver.IsKIC(c.cc.Driver) && c.cc.KubernetesConfig.ContainerRuntime != "docker" {
glog.Warningf("CNI is recommended for %q driver and %q runtime - expect networking issues", c.cc.Driver, c.cc.KubernetesConfig.ContainerRuntime)
klog.Warningf("CNI is recommended for %q driver and %q runtime - expect networking issues", c.cc.Driver, c.cc.KubernetesConfig.ContainerRuntime)
}
if len(c.cc.Nodes) > 1 {
glog.Warningf("CNI is recommended for multi-node clusters - expect networking issues")
klog.Warningf("CNI is recommended for multi-node clusters - expect networking issues")
}
return nil

View File

@ -20,8 +20,8 @@ import (
"os/exec"
"path/filepath"
"github.com/golang/glog"
"github.com/pkg/errors"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/driver"
)
@ -653,7 +653,7 @@ func (c Flannel) Apply(r Runner) error {
conflict := "/etc/cni/net.d/100-crio-bridge.conf"
_, err := r.RunCmd(exec.Command("sudo", "mv", conflict, filepath.Join(filepath.Dir(conflict), "DISABLED-"+filepath.Base(conflict))))
if err != nil {
glog.Errorf("unable to disable %s: %v", conflict, err)
klog.Errorf("unable to disable %s: %v", conflict, err)
}
}

View File

@ -27,8 +27,8 @@ import (
"strconv"
"time"
"github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/assets"
)
@ -46,7 +46,7 @@ func NewExecRunner() Runner {
// RunCmd implements the Command Runner interface to run a exec.Cmd object
func (*execRunner) RunCmd(cmd *exec.Cmd) (*RunResult, error) {
rr := &RunResult{Args: cmd.Args}
glog.Infof("Run: %v", rr.Command())
klog.Infof("Run: %v", rr.Command())
var outb, errb io.Writer
if cmd.Stdout == nil {
@ -75,7 +75,7 @@ func (*execRunner) RunCmd(cmd *exec.Cmd) (*RunResult, error) {
}
// Decrease log spam
if elapsed > (1 * time.Second) {
glog.Infof("Completed: %s: (%s)", rr.Command(), elapsed)
klog.Infof("Completed: %s: (%s)", rr.Command(), elapsed)
}
if err == nil {
return rr, nil
@ -88,16 +88,16 @@ func (*execRunner) RunCmd(cmd *exec.Cmd) (*RunResult, error) {
func (*execRunner) Copy(f assets.CopyableFile) error {
dst := path.Join(f.GetTargetDir(), f.GetTargetName())
if _, err := os.Stat(dst); err == nil {
glog.Infof("found %s, removing ...", dst)
klog.Infof("found %s, removing ...", dst)
if err := os.Remove(dst); err != nil {
return errors.Wrapf(err, "error removing file %s", dst)
}
}
src := f.GetSourcePath()
glog.Infof("cp: %s --> %s (%d bytes)", src, dst, f.GetLength())
klog.Infof("cp: %s --> %s (%d bytes)", src, dst, f.GetLength())
if f.GetLength() == 0 {
glog.Warningf("0 byte asset: %+v", f)
klog.Warningf("0 byte asset: %+v", f)
}
perms, err := strconv.ParseInt(f.GetPermissions(), 8, 0)
@ -111,6 +111,6 @@ func (*execRunner) Copy(f assets.CopyableFile) error {
// Remove removes a file
func (*execRunner) Remove(f assets.CopyableFile) error {
dst := filepath.Join(f.GetTargetDir(), f.GetTargetName())
glog.Infof("rm: %s", dst)
klog.Infof("rm: %s", dst)
return os.Remove(dst)
}

View File

@ -26,9 +26,9 @@ import (
"golang.org/x/sync/syncmap"
"github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/assets"
)
@ -50,7 +50,7 @@ func NewFakeCommandRunner() *FakeCommandRunner {
// RunCmd implements the Command Runner interface to run a exec.Cmd object
func (f *FakeCommandRunner) RunCmd(cmd *exec.Cmd) (*RunResult, error) {
rr := &RunResult{Args: cmd.Args}
glog.Infof("(FakeCommandRunner) Run: %v", rr.Command())
klog.Infof("(FakeCommandRunner) Run: %v", rr.Command())
start := time.Now()
@ -85,7 +85,7 @@ func (f *FakeCommandRunner) RunCmd(cmd *exec.Cmd) (*RunResult, error) {
// Reduce log spam
if elapsed > (1 * time.Second) {
glog.Infof("(FakeCommandRunner) Done: %v: (%s)", rr.Command(), elapsed)
klog.Infof("(FakeCommandRunner) Done: %v: (%s)", rr.Command(), elapsed)
}
return rr, nil
}
@ -117,7 +117,7 @@ func (f *FakeCommandRunner) SetFileToContents(fileToContents map[string]string)
// SetCommandToOutput stores the file to contents map for the FakeCommandRunner
func (f *FakeCommandRunner) SetCommandToOutput(cmdToOutput map[string]string) {
for k, v := range cmdToOutput {
glog.Infof("fake command %q -> %q", k, v)
klog.Infof("fake command %q -> %q", k, v)
f.cmdMap.Store(k, v)
}
}

View File

@ -29,9 +29,9 @@ import (
"strings"
"time"
"github.com/golang/glog"
"github.com/pkg/errors"
"golang.org/x/crypto/ssh/terminal"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/drivers/kic/oci"
"k8s.io/minikube/pkg/minikube/assets"
)
@ -90,7 +90,7 @@ func (k *kicRunner) RunCmd(cmd *exec.Cmd) (*RunResult, error) {
oc.Env = cmd.Env
rr := &RunResult{Args: cmd.Args}
glog.Infof("Run: %v", rr.Command())
klog.Infof("Run: %v", rr.Command())
var outb, errb io.Writer
if oc.Stdout == nil {
@ -111,7 +111,7 @@ func (k *kicRunner) RunCmd(cmd *exec.Cmd) (*RunResult, error) {
oc.Stderr = errb
oc = oci.PrefixCmd(oc)
glog.Infof("Args: %v", oc.Args)
klog.Infof("Args: %v", oc.Args)
start := time.Now()
@ -120,7 +120,7 @@ func (k *kicRunner) RunCmd(cmd *exec.Cmd) (*RunResult, error) {
if err == nil {
// Reduce log spam
if elapsed > (1 * time.Second) {
glog.Infof("Done: %v: (%s)", oc.Args, elapsed)
klog.Infof("Done: %v: (%s)", oc.Args, elapsed)
}
return rr, nil
}
@ -139,17 +139,17 @@ func (k *kicRunner) Copy(f assets.CopyableFile) error {
if f.GetLength() > 4096 {
exists, err := fileExists(k, f, dst)
if err != nil {
glog.Infof("existence error for %s: %v", dst, err)
klog.Infof("existence error for %s: %v", dst, err)
}
if exists {
glog.Infof("copy: skipping %s (exists)", dst)
klog.Infof("copy: skipping %s (exists)", dst)
return nil
}
}
src := f.GetSourcePath()
if f.GetLength() == 0 {
glog.Warningf("0 byte asset: %+v", f)
klog.Warningf("0 byte asset: %+v", f)
}
perms, err := strconv.ParseInt(f.GetPermissions(), 8, 0)
@ -162,13 +162,13 @@ func (k *kicRunner) Copy(f assets.CopyableFile) error {
fi, err := os.Stat(src)
if err == nil {
if fi.Mode() == os.FileMode(perms) {
glog.Infof("%s (direct): %s --> %s (%d bytes)", k.ociBin, src, dst, f.GetLength())
klog.Infof("%s (direct): %s --> %s (%d bytes)", k.ociBin, src, dst, f.GetLength())
return k.copy(src, dst)
}
// If >1MB, avoid local copy
if fi.Size() > (1024 * 1024) {
glog.Infof("%s (chmod): %s --> %s (%d bytes)", k.ociBin, src, dst, f.GetLength())
klog.Infof("%s (chmod): %s --> %s (%d bytes)", k.ociBin, src, dst, f.GetLength())
if err := k.copy(src, dst); err != nil {
return err
}
@ -176,7 +176,7 @@ func (k *kicRunner) Copy(f assets.CopyableFile) error {
}
}
}
glog.Infof("%s (temp): %s --> %s (%d bytes)", k.ociBin, src, dst, f.GetLength())
klog.Infof("%s (temp): %s --> %s (%d bytes)", k.ociBin, src, dst, f.GetLength())
tf, err := ioutil.TempFile("", "tmpf-memory-asset")
if err != nil {
return errors.Wrap(err, "creating temporary file")
@ -206,7 +206,7 @@ func (k *kicRunner) chmod(dst string, perm string) error {
func copyToPodman(src string, dest string) error {
if runtime.GOOS == "linux" {
cmd := oci.PrefixCmd(exec.Command(oci.Podman, "cp", src, dest))
glog.Infof("Run: %v", cmd)
klog.Infof("Run: %v", cmd)
if out, err := cmd.CombinedOutput(); err != nil {
return errors.Wrapf(err, "podman copy %s into %s, output: %s", src, dest, string(out))
}
@ -221,7 +221,7 @@ func copyToPodman(src string, dest string) error {
path := parts[1]
cmd := exec.Command(oci.Podman, "exec", "-i", container, "tee", path)
cmd.Stdin = file
glog.Infof("Run: %v", cmd)
klog.Infof("Run: %v", cmd)
if err := cmd.Run(); err != nil {
return errors.Wrapf(err, "podman copy %s into %s", src, dest)
}
@ -239,7 +239,7 @@ func copyToDocker(src string, dest string) error {
// Remove removes a file
func (k *kicRunner) Remove(f assets.CopyableFile) error {
dst := path.Join(f.GetTargetDir(), f.GetTargetName())
glog.Infof("rm: %s", dst)
klog.Infof("rm: %s", dst)
_, err := k.RunCmd(exec.Command("sudo", "rm", dst))
return err

View File

@ -26,11 +26,11 @@ import (
"time"
"github.com/docker/machine/libmachine/drivers"
"github.com/golang/glog"
"github.com/kballard/go-shellquote"
"github.com/pkg/errors"
"golang.org/x/crypto/ssh"
"golang.org/x/sync/errgroup"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/assets"
"k8s.io/minikube/pkg/minikube/sshutil"
"k8s.io/minikube/pkg/util/retry"
@ -79,7 +79,7 @@ func (s *SSHRunner) session() (*ssh.Session, error) {
sess, err = client.NewSession()
if err != nil {
glog.Warningf("session error, resetting client: %v", err)
klog.Warningf("session error, resetting client: %v", err)
s.c = nil
return err
}
@ -96,7 +96,7 @@ func (s *SSHRunner) session() (*ssh.Session, error) {
// Remove runs a command to delete a file on the remote.
func (s *SSHRunner) Remove(f assets.CopyableFile) error {
dst := path.Join(f.GetTargetDir(), f.GetTargetName())
glog.Infof("rm: %s", dst)
klog.Infof("rm: %s", dst)
sess, err := s.session()
if err != nil {
@ -122,14 +122,14 @@ func teeSSH(s *ssh.Session, cmd string, outB io.Writer, errB io.Writer) error {
wg.Add(2)
go func() {
if err := teePrefix(ErrPrefix, errPipe, errB, glog.V(8).Infof); err != nil {
glog.Errorf("tee stderr: %v", err)
if err := teePrefix(ErrPrefix, errPipe, errB, klog.V(8).Infof); err != nil {
klog.Errorf("tee stderr: %v", err)
}
wg.Done()
}()
go func() {
if err := teePrefix(OutPrefix, outPipe, outB, glog.V(8).Infof); err != nil {
glog.Errorf("tee stdout: %v", err)
if err := teePrefix(OutPrefix, outPipe, outB, klog.V(8).Infof); err != nil {
klog.Errorf("tee stdout: %v", err)
}
wg.Done()
}()
@ -145,7 +145,7 @@ func (s *SSHRunner) RunCmd(cmd *exec.Cmd) (*RunResult, error) {
}
rr := &RunResult{Args: cmd.Args}
glog.Infof("Run: %v", rr.Command())
klog.Infof("Run: %v", rr.Command())
var outb, errb io.Writer
start := time.Now()
@ -172,7 +172,7 @@ func (s *SSHRunner) RunCmd(cmd *exec.Cmd) (*RunResult, error) {
defer func() {
if err := sess.Close(); err != nil {
if err != io.EOF {
glog.Errorf("session close: %v", err)
klog.Errorf("session close: %v", err)
}
}
}()
@ -185,7 +185,7 @@ func (s *SSHRunner) RunCmd(cmd *exec.Cmd) (*RunResult, error) {
}
// Decrease log spam
if elapsed > (1 * time.Second) {
glog.Infof("Completed: %s: (%s)", rr.Command(), elapsed)
klog.Infof("Completed: %s: (%s)", rr.Command(), elapsed)
}
if err == nil {
return rr, nil
@ -202,19 +202,19 @@ func (s *SSHRunner) Copy(f assets.CopyableFile) error {
if f.GetLength() > 2048 {
exists, err := fileExists(s, f, dst)
if err != nil {
glog.Infof("existence check for %s: %v", dst, err)
klog.Infof("existence check for %s: %v", dst, err)
}
if exists {
glog.Infof("copy: skipping %s (exists)", dst)
klog.Infof("copy: skipping %s (exists)", dst)
return nil
}
}
src := f.GetSourcePath()
glog.Infof("scp %s --> %s (%d bytes)", src, dst, f.GetLength())
klog.Infof("scp %s --> %s (%d bytes)", src, dst, f.GetLength())
if f.GetLength() == 0 {
glog.Warningf("0 byte asset: %+v", f)
klog.Warningf("0 byte asset: %+v", f)
}
sess, err := s.session()
@ -224,7 +224,7 @@ func (s *SSHRunner) Copy(f assets.CopyableFile) error {
defer func() {
if err := sess.Close(); err != nil {
if err != io.EOF {
glog.Errorf("session close: %v", err)
klog.Errorf("session close: %v", err)
}
}
}()
@ -243,7 +243,7 @@ func (s *SSHRunner) Copy(f assets.CopyableFile) error {
header := fmt.Sprintf("C%s %d %s\n", f.GetPermissions(), f.GetLength(), f.GetTargetName())
fmt.Fprint(w, header)
if f.GetLength() == 0 {
glog.Warningf("asked to copy a 0 byte asset: %+v", f)
klog.Warningf("asked to copy a 0 byte asset: %+v", f)
fmt.Fprint(w, "\x00")
return nil
}
@ -262,7 +262,7 @@ func (s *SSHRunner) Copy(f assets.CopyableFile) error {
scp := fmt.Sprintf("sudo test -d %s && sudo scp -t %s", f.GetTargetDir(), f.GetTargetDir())
mtime, err := f.GetModTime()
if err != nil {
glog.Infof("error getting modtime for %s: %v", dst, err)
klog.Infof("error getting modtime for %s: %v", dst, err)
} else if mtime != (time.Time{}) {
scp += fmt.Sprintf(" && sudo touch -d \"%s\" %s", mtime.Format(layout), dst)
}

View File

@ -20,7 +20,7 @@ import (
"fmt"
"strings"
"github.com/golang/glog"
"k8s.io/klog/v2"
)
// ExtraOption is an extra option
@ -45,13 +45,13 @@ func (es *ExtraOptionSlice) Exists(value string) bool {
// The component is the value before the first dot.
componentSplit := strings.SplitN(value, ".", 2)
if len(componentSplit) != 2 {
glog.Errorf("invalid value: must contain at least one period: %q", value)
klog.Errorf("invalid value: must contain at least one period: %q", value)
return false
}
keySplit := strings.SplitN(componentSplit[1], "=", 2)
if len(keySplit) != 2 {
glog.Errorf("invalid value: must contain one equal sign: %q", value)
klog.Errorf("invalid value: must contain one equal sign: %q", value)
return false
}

View File

@ -24,8 +24,8 @@ import (
"regexp"
"strings"
"github.com/golang/glog"
"github.com/spf13/viper"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/drivers/kic/oci"
"k8s.io/minikube/pkg/minikube/localpath"
"k8s.io/minikube/pkg/util/lock"
@ -147,7 +147,7 @@ func SaveProfile(name string, cfg *ClusterConfig, miniHome ...string) error {
return err
}
path := profileFilePath(name, miniHome...)
glog.Infof("Saving config to %s ...", path)
klog.Infof("Saving config to %s ...", path)
if err := os.MkdirAll(filepath.Dir(path), 0700); err != nil {
return err
}

View File

@ -28,8 +28,8 @@ import (
"time"
"github.com/blang/semver"
"github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/assets"
"k8s.io/minikube/pkg/minikube/bootstrapper/images"
"k8s.io/minikube/pkg/minikube/command"
@ -195,7 +195,7 @@ func generateContainerdConfig(cr CommandRunner, imageRepository string, kv semve
func (r *Containerd) Enable(disOthers, _ bool) error {
if disOthers {
if err := disableOthers(r, r.Runner); err != nil {
glog.Warningf("disableOthers: %v", err)
klog.Warningf("disableOthers: %v", err)
}
}
if err := populateCRIConfig(r.Runner, r.SocketPath()); err != nil {
@ -228,7 +228,7 @@ func (r *Containerd) ImageExists(name string, sha string) bool {
// LoadImage loads an image into this runtime
func (r *Containerd) LoadImage(path string) error {
glog.Infof("Loading image: %s", path)
klog.Infof("Loading image: %s", path)
c := exec.Command("sudo", "ctr", "-n=k8s.io", "images", "import", path)
if _, err := r.Runner.RunCmd(c); err != nil {
return errors.Wrapf(err, "ctr images import")
@ -319,7 +319,7 @@ func (r *Containerd) Preload(cfg config.KubernetesConfig) error {
return errors.Wrap(err, "getting images")
}
if containerdImagesPreloaded(r.Runner, images) {
glog.Info("Images already preloaded, skipping extraction")
klog.Info("Images already preloaded, skipping extraction")
return nil
}
@ -342,18 +342,18 @@ func (r *Containerd) Preload(cfg config.KubernetesConfig) error {
if err := r.Runner.Copy(fa); err != nil {
return errors.Wrap(err, "copying file")
}
glog.Infof("Took %f seconds to copy over tarball", time.Since(t).Seconds())
klog.Infof("Took %f seconds to copy over tarball", time.Since(t).Seconds())
t = time.Now()
// extract the tarball to /var in the VM
if rr, err := r.Runner.RunCmd(exec.Command("sudo", "tar", "-I", "lz4", "-C", "/var", "-xvf", dest)); err != nil {
return errors.Wrapf(err, "extracting tarball: %s", rr.Output())
}
glog.Infof("Took %f seconds t extract the tarball", time.Since(t).Seconds())
klog.Infof("Took %f seconds t extract the tarball", time.Since(t).Seconds())
// remove the tarball in the VM
if err := r.Runner.Remove(fa); err != nil {
glog.Infof("error removing tarball: %v", err)
klog.Infof("error removing tarball: %v", err)
}
return r.Restart()
@ -384,7 +384,7 @@ func containerdImagesPreloaded(runner command.Runner, images []string) bool {
var jsonImages crictlImages
err = json.Unmarshal(rr.Stdout.Bytes(), &jsonImages)
if err != nil {
glog.Errorf("failed to unmarshal images, will assume images are not preloaded")
klog.Errorf("failed to unmarshal images, will assume images are not preloaded")
return false
}
@ -405,11 +405,11 @@ func containerdImagesPreloaded(runner command.Runner, images []string) bool {
}
if !found {
glog.Infof("couldn't find preloaded image for %q. assuming images are not preloaded.", i)
klog.Infof("couldn't find preloaded image for %q. assuming images are not preloaded.", i)
return false
}
}
glog.Infof("all images are preloaded for containerd runtime.")
klog.Infof("all images are preloaded for containerd runtime.")
return true
}

View File

@ -25,8 +25,8 @@ import (
"path"
"strings"
"github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/command"
)
@ -38,7 +38,7 @@ type container struct {
// crictlList returns the output of 'crictl ps' in an efficient manner
func crictlList(cr CommandRunner, root string, o ListOptions) (*command.RunResult, error) {
glog.Infof("listing CRI containers in root %s: %+v", root, o)
klog.Infof("listing CRI containers in root %s: %+v", root, o)
// Use -a because otherwise paused containers are missed
baseCmd := []string{"crictl", "ps", "-a", "--quiet"}
@ -73,7 +73,7 @@ func listCRIContainers(cr CommandRunner, root string, o ListOptions) ([]string,
var ids []string
seen := map[string]bool{}
for _, id := range strings.Split(rr.Stdout.String(), "\n") {
glog.Infof("found id: %q", id)
klog.Infof("found id: %q", id)
if id != "" && !seen[id] {
ids = append(ids, id)
seen[id] = true
@ -100,7 +100,7 @@ func listCRIContainers(cr CommandRunner, root string, o ListOptions) ([]string,
return nil, errors.Wrap(err, "runc")
}
content := rr.Stdout.Bytes()
glog.Infof("JSON = %s", content)
klog.Infof("JSON = %s", content)
d := json.NewDecoder(bytes.NewReader(content))
if err := d.Decode(&cs); err != nil {
return nil, err
@ -110,16 +110,16 @@ func listCRIContainers(cr CommandRunner, root string, o ListOptions) ([]string,
return nil, fmt.Errorf("list returned 0 containers, but ps returned %d", len(ids))
}
glog.Infof("list returned %d containers", len(cs))
klog.Infof("list returned %d containers", len(cs))
var fids []string
for _, c := range cs {
glog.Infof("container: %+v", c)
klog.Infof("container: %+v", c)
if !seen[c.ID] {
glog.Infof("skipping %s - not in ps", c.ID)
klog.Infof("skipping %s - not in ps", c.ID)
continue
}
if o.State != All && o.State.String() != c.Status {
glog.Infof("skipping %s: state = %q, want %q", c, c.Status, o.State)
klog.Infof("skipping %s: state = %q, want %q", c, c.Status, o.State)
continue
}
fids = append(fids, c.ID)
@ -176,7 +176,7 @@ func killCRIContainers(cr CommandRunner, ids []string) error {
if len(ids) == 0 {
return nil
}
glog.Infof("Killing containers: %s", ids)
klog.Infof("Killing containers: %s", ids)
crictl := getCrictlPath(cr)
args := append([]string{crictl, "rm"}, ids...)
@ -192,7 +192,7 @@ func stopCRIContainers(cr CommandRunner, ids []string) error {
if len(ids) == 0 {
return nil
}
glog.Infof("Stopping containers: %s", ids)
klog.Infof("Stopping containers: %s", ids)
crictl := getCrictlPath(cr)
args := append([]string{crictl, "stop"}, ids...)

View File

@ -26,8 +26,8 @@ import (
"time"
"github.com/blang/semver"
"github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/assets"
"k8s.io/minikube/pkg/minikube/bootstrapper/images"
"k8s.io/minikube/pkg/minikube/command"
@ -113,7 +113,7 @@ func (r *CRIO) Active() bool {
func (r *CRIO) Enable(disOthers, _ bool) error {
if disOthers {
if err := disableOthers(r, r.Runner); err != nil {
glog.Warningf("disableOthers: %v", err)
klog.Warningf("disableOthers: %v", err)
}
}
if err := populateCRIConfig(r.Runner, r.SocketPath()); err != nil {
@ -149,7 +149,7 @@ func (r *CRIO) ImageExists(name string, sha string) bool {
// LoadImage loads an image into this runtime
func (r *CRIO) LoadImage(path string) error {
glog.Infof("Loading image: %s", path)
klog.Infof("Loading image: %s", path)
c := exec.Command("sudo", "podman", "load", "-i", path)
if _, err := r.Runner.RunCmd(c); err != nil {
return errors.Wrap(err, "crio load image")
@ -237,7 +237,7 @@ func (r *CRIO) Preload(cfg config.KubernetesConfig) error {
return errors.Wrap(err, "getting images")
}
if crioImagesPreloaded(r.Runner, images) {
glog.Info("Images already preloaded, skipping extraction")
klog.Info("Images already preloaded, skipping extraction")
return nil
}
@ -260,18 +260,18 @@ func (r *CRIO) Preload(cfg config.KubernetesConfig) error {
if err := r.Runner.Copy(fa); err != nil {
return errors.Wrap(err, "copying file")
}
glog.Infof("Took %f seconds to copy over tarball", time.Since(t).Seconds())
klog.Infof("Took %f seconds to copy over tarball", time.Since(t).Seconds())
t = time.Now()
// extract the tarball to /var in the VM
if rr, err := r.Runner.RunCmd(exec.Command("sudo", "tar", "-I", "lz4", "-C", "/var", "-xvf", dest)); err != nil {
return errors.Wrapf(err, "extracting tarball: %s", rr.Output())
}
glog.Infof("Took %f seconds t extract the tarball", time.Since(t).Seconds())
klog.Infof("Took %f seconds t extract the tarball", time.Since(t).Seconds())
// remove the tarball in the VM
if err := r.Runner.Remove(fa); err != nil {
glog.Infof("error removing tarball: %v", err)
klog.Infof("error removing tarball: %v", err)
}
return nil
@ -297,7 +297,7 @@ func crioImagesPreloaded(runner command.Runner, images []string) bool {
var jsonImages crictlImages
err = json.Unmarshal(rr.Stdout.Bytes(), &jsonImages)
if err != nil {
glog.Errorf("failed to unmarshal images, will assume images are not preloaded")
klog.Errorf("failed to unmarshal images, will assume images are not preloaded")
return false
}
@ -318,11 +318,11 @@ func crioImagesPreloaded(runner command.Runner, images []string) bool {
}
if !found {
glog.Infof("couldn't find preloaded image for %q. assuming images are not preloaded.", i)
klog.Infof("couldn't find preloaded image for %q. assuming images are not preloaded.", i)
return false
}
}
glog.Infof("all images are preloaded for cri-o runtime.")
klog.Infof("all images are preloaded for cri-o runtime.")
return true
}
@ -332,7 +332,7 @@ func (r *CRIO) ImagesPreloaded(images []string) bool {
// UpdateCRIONet updates CRIO CNI network configuration and restarts it
func UpdateCRIONet(r CommandRunner, cidr string) error {
glog.Infof("Updating CRIO to use CIDR: %q", cidr)
klog.Infof("Updating CRIO to use CIDR: %q", cidr)
ip, net, err := net.ParseCIDR(cidr)
if err != nil {
return errors.Wrap(err, "parse cidr")
@ -351,7 +351,7 @@ func UpdateCRIONet(r CommandRunner, cidr string) error {
// avoids: "Error adding network: failed to set bridge addr: could not add IP address to \"cni0\": permission denied"
sed := fmt.Sprintf("sed -i -e s#%s#%s# -e s#%s#%s# /etc/cni/net.d/*bridge*", oldNet, newNet, oldGw, newGw)
if _, err := r.RunCmd(exec.Command("sudo", "/bin/bash", "-c", sed)); err != nil {
glog.Errorf("netconf update failed: %v", err)
klog.Errorf("netconf update failed: %v", err)
}
return sysinit.New(r).Restart("crio")

View File

@ -22,8 +22,8 @@ import (
"os/exec"
"github.com/blang/semver"
"github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/assets"
"k8s.io/minikube/pkg/minikube/command"
"k8s.io/minikube/pkg/minikube/config"
@ -190,7 +190,7 @@ func disableOthers(me Manager, cr CommandRunner) error {
// Don't disable containerd if we are bound to it
if me.Name() == "Docker" && r.Name() == "containerd" && dockerBoundToContainerd(cr) {
glog.Infof("skipping containerd shutdown because we are bound to it")
klog.Infof("skipping containerd shutdown because we are bound to it")
continue
}
@ -200,7 +200,7 @@ func disableOthers(me Manager, cr CommandRunner) error {
}
if err = r.Disable(); err != nil {
glog.Warningf("disable failed: %v", err)
klog.Warningf("disable failed: %v", err)
}
// Validate that the runtime really is offline - and that Active & Disable are properly written.
@ -216,7 +216,7 @@ func disableOthers(me Manager, cr CommandRunner) error {
func enableIPForwarding(cr CommandRunner) error {
c := exec.Command("sudo", "sysctl", "net.bridge.bridge-nf-call-iptables")
if rr, err := cr.RunCmd(c); err != nil {
glog.Infof("couldn't verify netfilter by %q which might be okay. error: %v", rr.Command(), err)
klog.Infof("couldn't verify netfilter by %q which might be okay. error: %v", rr.Command(), err)
c = exec.Command("sudo", "modprobe", "br_netfilter")
if _, err := cr.RunCmd(c); err != nil {
return errors.Wrapf(err, "br_netfilter")

View File

@ -23,10 +23,10 @@ import (
"strings"
"testing"
"github.com/golang/glog"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/assets"
"k8s.io/minikube/pkg/minikube/command"
)
@ -416,7 +416,7 @@ func (f *FakeRunner) crictl(args []string, _ bool) (string, error) {
// systemctl is a fake implementation of systemctl
func (f *FakeRunner) systemctl(args []string, root bool) (string, error) { // nolint result 0 (string) is always ""
glog.Infof("fake systemctl: %v", args)
klog.Infof("fake systemctl: %v", args)
action := args[0]
if action == "--version" {

View File

@ -23,8 +23,8 @@ import (
"strings"
"time"
"github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/assets"
"k8s.io/minikube/pkg/minikube/bootstrapper/images"
"k8s.io/minikube/pkg/minikube/command"
@ -104,7 +104,7 @@ func (r *Docker) Enable(disOthers, forceSystemd bool) error {
if disOthers {
if err := disableOthers(r, r.Runner); err != nil {
glog.Warningf("disableOthers: %v", err)
klog.Warningf("disableOthers: %v", err)
}
}
@ -149,7 +149,7 @@ func (r *Docker) ImageExists(name string, sha string) bool {
// LoadImage loads an image into this runtime
func (r *Docker) LoadImage(path string) error {
glog.Infof("Loading image: %s", path)
klog.Infof("Loading image: %s", path)
c := exec.Command("docker", "load", "-i", path)
if _, err := r.Runner.RunCmd(c); err != nil {
return errors.Wrap(err, "loadimage docker.")
@ -212,7 +212,7 @@ func (r *Docker) KillContainers(ids []string) error {
if len(ids) == 0 {
return nil
}
glog.Infof("Killing containers: %s", ids)
klog.Infof("Killing containers: %s", ids)
args := append([]string{"rm", "-f"}, ids...)
c := exec.Command("docker", args...)
if _, err := r.Runner.RunCmd(c); err != nil {
@ -226,7 +226,7 @@ func (r *Docker) StopContainers(ids []string) error {
if len(ids) == 0 {
return nil
}
glog.Infof("Stopping containers: %s", ids)
klog.Infof("Stopping containers: %s", ids)
args := append([]string{"stop"}, ids...)
c := exec.Command("docker", args...)
if _, err := r.Runner.RunCmd(c); err != nil {
@ -240,7 +240,7 @@ func (r *Docker) PauseContainers(ids []string) error {
if len(ids) == 0 {
return nil
}
glog.Infof("Pausing containers: %s", ids)
klog.Infof("Pausing containers: %s", ids)
args := append([]string{"pause"}, ids...)
c := exec.Command("docker", args...)
if _, err := r.Runner.RunCmd(c); err != nil {
@ -254,7 +254,7 @@ func (r *Docker) UnpauseContainers(ids []string) error {
if len(ids) == 0 {
return nil
}
glog.Infof("Unpausing containers: %s", ids)
klog.Infof("Unpausing containers: %s", ids)
args := append([]string{"unpause"}, ids...)
c := exec.Command("docker", args...)
if _, err := r.Runner.RunCmd(c); err != nil {
@ -285,7 +285,7 @@ func (r *Docker) SystemLogCmd(len int) string {
// ForceSystemd forces the docker daemon to use systemd as cgroup manager
func (r *Docker) forceSystemd() error {
glog.Infof("Forcing docker to use systemd as cgroup manager...")
klog.Infof("Forcing docker to use systemd as cgroup manager...")
daemonConfig := `{
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
@ -316,13 +316,13 @@ func (r *Docker) Preload(cfg config.KubernetesConfig) error {
return errors.Wrap(err, "getting images")
}
if dockerImagesPreloaded(r.Runner, images) {
glog.Info("Images already preloaded, skipping extraction")
klog.Info("Images already preloaded, skipping extraction")
return nil
}
refStore := docker.NewStorage(r.Runner)
if err := refStore.Save(); err != nil {
glog.Infof("error saving reference store: %v", err)
klog.Infof("error saving reference store: %v", err)
}
tarballPath := download.TarballPath(k8sVersion, cRuntime)
@ -344,7 +344,7 @@ func (r *Docker) Preload(cfg config.KubernetesConfig) error {
if err := r.Runner.Copy(fa); err != nil {
return errors.Wrap(err, "copying file")
}
glog.Infof("Took %f seconds to copy over tarball", time.Since(t).Seconds())
klog.Infof("Took %f seconds to copy over tarball", time.Since(t).Seconds())
// extract the tarball to /var in the VM
if rr, err := r.Runner.RunCmd(exec.Command("sudo", "tar", "-I", "lz4", "-C", "/var", "-xvf", dest)); err != nil {
@ -353,16 +353,16 @@ func (r *Docker) Preload(cfg config.KubernetesConfig) error {
// remove the tarball in the VM
if err := r.Runner.Remove(fa); err != nil {
glog.Infof("error removing tarball: %v", err)
klog.Infof("error removing tarball: %v", err)
}
// save new reference store again
if err := refStore.Save(); err != nil {
glog.Infof("error saving reference store: %v", err)
klog.Infof("error saving reference store: %v", err)
}
// update reference store
if err := refStore.Update(); err != nil {
glog.Infof("error updating reference store: %v", err)
klog.Infof("error updating reference store: %v", err)
}
return r.Restart()
}
@ -378,12 +378,12 @@ func dockerImagesPreloaded(runner command.Runner, images []string) bool {
preloadedImages[i] = struct{}{}
}
glog.Infof("Got preloaded images: %s", rr.Output())
klog.Infof("Got preloaded images: %s", rr.Output())
// Make sure images == imgs
for _, i := range images {
if _, ok := preloadedImages[i]; !ok {
glog.Infof("%s wasn't preloaded", i)
klog.Infof("%s wasn't preloaded", i)
return false
}
}
@ -394,7 +394,7 @@ func dockerBoundToContainerd(runner command.Runner) bool {
// NOTE: assumes systemd
rr, err := runner.RunCmd(exec.Command("sudo", "systemctl", "cat", "docker.service"))
if err != nil {
glog.Warningf("unable to check if docker is bound to containerd")
klog.Warningf("unable to check if docker is bound to containerd")
return false
}

View File

@ -21,8 +21,8 @@ import (
"os/exec"
"path"
"github.com/golang/glog"
"github.com/opencontainers/go-digest"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/assets"
"k8s.io/minikube/pkg/minikube/command"
)
@ -59,7 +59,7 @@ func (s *Storage) Save() error {
// if this command fails, assume the file doesn't exist
rr, err := s.runner.RunCmd(exec.Command("sudo", "cat", referenceStorePath))
if err != nil {
glog.Infof("repositories.json doesn't exist: %v", err)
klog.Infof("repositories.json doesn't exist: %v", err)
return nil
}
contents := rr.Stdout.Bytes()

View File

@ -23,8 +23,8 @@ import (
"runtime"
"github.com/blang/semver"
"github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/localpath"
)
@ -53,7 +53,7 @@ func Binary(binary, version, osName, archName string) (string, error) {
}
if _, err := os.Stat(targetFilepath); err == nil {
glog.Infof("Not caching binary, using %s", url)
klog.Infof("Not caching binary, using %s", url)
return targetFilepath, nil
}

View File

@ -23,9 +23,9 @@ import (
"path/filepath"
"strings"
"github.com/golang/glog"
"github.com/hashicorp/go-getter"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/out"
)
@ -64,7 +64,7 @@ func download(src string, dst string) error {
// Don't bother with getter.MockGetter, as we don't provide a way to inspect the outcome
if mockMode {
glog.Infof("Mock download: %s -> %s", src, dst)
klog.Infof("Mock download: %s -> %s", src, dst)
// Callers expect the file to exist
_, err := os.Create(dst)
return err
@ -75,7 +75,7 @@ func download(src string, dst string) error {
return fmt.Errorf("unmocked download under test")
}
glog.Infof("Downloading: %s -> %s", src, dst)
klog.Infof("Downloading: %s -> %s", src, dst)
if err := client.Get(); err != nil {
return errors.Wrapf(err, "getter: %+v", client)
}

View File

@ -25,9 +25,9 @@ import (
"strings"
"time"
"github.com/golang/glog"
"github.com/juju/mutex"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/localpath"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/style"
@ -52,7 +52,7 @@ func LocalISOResource(isoURL string) string {
u, err := url.Parse(isoURL)
if err != nil {
fake := "file://" + filepath.ToSlash(isoURL)
glog.Errorf("%s is not a URL! Returning %s", isoURL, fake)
klog.Errorf("%s is not a URL! Returning %s", isoURL, fake)
return fake
}
@ -84,7 +84,7 @@ func ISO(urls []string, skipChecksum bool) (string, error) {
for _, url := range urls {
err := downloadISO(url, skipChecksum)
if err != nil {
glog.Errorf("Unable to download %s: %v", url, err)
klog.Errorf("Unable to download %s: %v", url, err)
errs[url] = err.Error()
continue
}
@ -116,7 +116,7 @@ func downloadISO(isoURL string, skipChecksum bool) error {
dst := localISOPath(u)
spec := lock.PathMutexSpec(dst)
spec.Timeout = 10 * time.Minute
glog.Infof("acquiring lock: %+v", spec)
klog.Infof("acquiring lock: %+v", spec)
releaser, err := mutex.Acquire(spec)
if err != nil {
return errors.Wrapf(err, "unable to acquire lock for %+v", spec)

View File

@ -29,9 +29,9 @@ import (
"cloud.google.com/go/storage"
"google.golang.org/api/option"
"github.com/golang/glog"
"github.com/pkg/errors"
"github.com/spf13/viper"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/localpath"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/style"
@ -94,7 +94,7 @@ func PreloadExists(k8sVersion, containerRuntime string, forcePreload ...bool) bo
}
// TODO: debug why this func is being called two times
glog.Infof("Checking if preload exists for k8s version %s and runtime %s", k8sVersion, containerRuntime)
klog.Infof("Checking if preload exists for k8s version %s and runtime %s", k8sVersion, containerRuntime)
if !viper.GetBool("preload") && !force {
return false
}
@ -102,24 +102,24 @@ func PreloadExists(k8sVersion, containerRuntime string, forcePreload ...bool) bo
// Omit remote check if tarball exists locally
targetPath := TarballPath(k8sVersion, containerRuntime)
if _, err := os.Stat(targetPath); err == nil {
glog.Infof("Found local preload: %s", targetPath)
klog.Infof("Found local preload: %s", targetPath)
return true
}
url := remoteTarballURL(k8sVersion, containerRuntime)
resp, err := http.Head(url)
if err != nil {
glog.Warningf("%s fetch error: %v", url, err)
klog.Warningf("%s fetch error: %v", url, err)
return false
}
// note: err won't be set if it's a 404
if resp.StatusCode != 200 {
glog.Warningf("%s status code: %d", url, resp.StatusCode)
klog.Warningf("%s status code: %d", url, resp.StatusCode)
return false
}
glog.Infof("Found remote preload: %s", url)
klog.Infof("Found remote preload: %s", url)
return true
}
@ -128,13 +128,13 @@ func Preload(k8sVersion, containerRuntime string) error {
targetPath := TarballPath(k8sVersion, containerRuntime)
if _, err := os.Stat(targetPath); err == nil {
glog.Infof("Found %s in cache, skipping download", targetPath)
klog.Infof("Found %s in cache, skipping download", targetPath)
return nil
}
// Make sure we support this k8s version
if !PreloadExists(k8sVersion, containerRuntime) {
glog.Infof("Preloaded tarball for k8s version %s does not exist", k8sVersion)
klog.Infof("Preloaded tarball for k8s version %s does not exist", k8sVersion)
return nil
}
@ -157,7 +157,7 @@ func Preload(k8sVersion, containerRuntime string) error {
}
func saveChecksumFile(k8sVersion, containerRuntime string) error {
glog.Infof("saving checksum for %s ...", TarballName(k8sVersion, containerRuntime))
klog.Infof("saving checksum for %s ...", TarballName(k8sVersion, containerRuntime))
ctx := context.Background()
client, err := storage.NewClient(ctx, option.WithoutAuthentication())
if err != nil {
@ -174,7 +174,7 @@ func saveChecksumFile(k8sVersion, containerRuntime string) error {
// verifyChecksum returns true if the checksum of the local binary matches
// the checksum of the remote binary
func verifyChecksum(k8sVersion, containerRuntime, path string) error {
glog.Infof("verifying checksumm of %s ...", path)
klog.Infof("verifying checksumm of %s ...", path)
// get md5 checksum of tarball path
contents, err := ioutil.ReadFile(path)
if err != nil {

View File

@ -23,7 +23,7 @@ import (
"sort"
"strings"
"github.com/golang/glog"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/drivers/kic/oci"
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/registry"
@ -232,16 +232,16 @@ func Suggest(options []registry.DriverState) (registry.DriverState, []registry.D
}
if !ds.State.Healthy {
glog.Infof("not recommending %q due to health: %v", ds.Name, ds.State.Error)
klog.Infof("not recommending %q due to health: %v", ds.Name, ds.State.Error)
continue
}
if ds.Priority <= registry.Discouraged {
glog.Infof("not recommending %q due to priority: %d", ds.Name, ds.Priority)
klog.Infof("not recommending %q due to priority: %d", ds.Name, ds.Priority)
continue
}
if ds.Priority > pick.Priority {
glog.V(1).Infof("%q has a higher priority (%d) than %q (%d)", ds.Name, ds.Priority, pick.Name, pick.Priority)
klog.V(1).Infof("%q has a higher priority (%d) than %q (%d)", ds.Name, ds.Priority, pick.Name, pick.Priority)
pick = ds
}
}
@ -266,9 +266,9 @@ func Suggest(options []registry.DriverState) (registry.DriverState, []registry.D
alternates = append(alternates, ds)
}
}
glog.Infof("Picked: %+v", pick)
glog.Infof("Alternatives: %+v", alternates)
glog.Infof("Rejects: %+v", rejects)
klog.Infof("Picked: %+v", pick)
klog.Infof("Alternatives: %+v", alternates)
klog.Infof("Rejects: %+v", rejects)
return pick, alternates, rejects
}
@ -284,7 +284,7 @@ func Status(name string) registry.DriverState {
// SetLibvirtURI sets the URI to perform libvirt health checks against
func SetLibvirtURI(v string) {
glog.Infof("Setting default libvirt URI to %s", v)
klog.Infof("Setting default libvirt URI to %s", v)
os.Setenv("LIBVIRT_DEFAULT_URI", v)
}

View File

@ -26,10 +26,10 @@ import (
"time"
"github.com/blang/semver"
"github.com/golang/glog"
"github.com/juju/mutex"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/download"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/style"
@ -47,7 +47,7 @@ func InstallOrUpdate(name string, directory string, v semver.Version, interactiv
// Lock before we check for existence to avoid thundering herd issues
spec := lock.PathMutexSpec(executable)
spec.Timeout = 10 * time.Minute
glog.Infof("acquiring lock: %+v", spec)
klog.Infof("acquiring lock: %+v", spec)
releaser, err := mutex.Acquire(spec)
if err != nil {
return errors.Wrapf(err, "unable to acquire lock for %+v", spec)
@ -57,7 +57,7 @@ func InstallOrUpdate(name string, directory string, v semver.Version, interactiv
exists := driverExists(executable)
path, err := validateDriver(executable, v)
if !exists || (err != nil && autoUpdate) {
glog.Warningf("%s: %v", executable, err)
klog.Warningf("%s: %v", executable, err)
path = filepath.Join(directory, executable)
derr := download.Driver(executable, path, v)
if derr != nil {
@ -75,9 +75,9 @@ func fixDriverPermissions(name string, path string, interactive bool) error {
// Using the find command for hyperkit is far easier than cross-platform uid checks in Go.
stdout, err := exec.Command("find", path, "-uid", "0", "-perm", "4755").Output()
glog.Infof("stdout: %s", stdout)
klog.Infof("stdout: %s", stdout)
if err == nil && strings.TrimSpace(string(stdout)) == path {
glog.Infof("%s looks good", path)
klog.Infof("%s looks good", path)
return nil
}
@ -95,14 +95,14 @@ func fixDriverPermissions(name string, path string, interactive bool) error {
for _, c := range cmds {
testArgs := append([]string{"-n"}, c.Args[1:]...)
test := exec.Command("sudo", testArgs...)
glog.Infof("testing: %v", test.Args)
klog.Infof("testing: %v", test.Args)
if err := test.Run(); err != nil {
glog.Infof("%v may require a password: %v", c.Args, err)
klog.Infof("%v may require a password: %v", c.Args, err)
if !interactive {
return fmt.Errorf("%v requires a password, and --interactive=false", c.Args)
}
}
glog.Infof("running: %v", c.Args)
klog.Infof("running: %v", c.Args)
err := c.Run()
if err != nil {
return errors.Wrapf(err, "%v", c.Args)
@ -113,7 +113,7 @@ func fixDriverPermissions(name string, path string, interactive bool) error {
// validateDriver validates if a driver appears to be up-to-date and installed properly
func validateDriver(executable string, v semver.Version) (string, error) {
glog.Infof("Validating %s, PATH=%s", executable, os.Getenv("PATH"))
klog.Infof("Validating %s, PATH=%s", executable, os.Getenv("PATH"))
path, err := exec.LookPath(executable)
if err != nil {
return path, err

View File

@ -21,7 +21,7 @@ import (
"os"
"runtime"
"github.com/golang/glog"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/minikube/style"
@ -30,7 +30,7 @@ import (
// Message outputs a templated message and exits without interpretation
func Message(r reason.Kind, format string, args ...out.V) {
if r.ID == "" {
glog.Errorf("supplied reason has no ID: %+v", r)
klog.Errorf("supplied reason has no ID: %+v", r)
}
if r.Style == style.None {

View File

@ -22,13 +22,13 @@ import (
"path/filepath"
"time"
"github.com/golang/glog"
"github.com/google/go-containerregistry/pkg/name"
v1 "github.com/google/go-containerregistry/pkg/v1"
"github.com/google/go-containerregistry/pkg/v1/tarball"
"github.com/juju/mutex"
"github.com/pkg/errors"
"golang.org/x/sync/errgroup"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/localpath"
"k8s.io/minikube/pkg/util/lock"
@ -39,7 +39,7 @@ func DeleteFromCacheDir(images []string) error {
for _, image := range images {
path := filepath.Join(constants.ImageCacheDir, image)
path = localpath.SanitizeCacheDir(path)
glog.Infoln("Deleting image in cache at ", path)
klog.Infoln("Deleting image in cache at ", path)
if err := os.Remove(path); err != nil {
return err
}
@ -60,17 +60,17 @@ func SaveToDir(images []string, cacheDir string) error {
dst := filepath.Join(cacheDir, image)
dst = localpath.SanitizeCacheDir(dst)
if err := saveToTarFile(image, dst); err != nil {
glog.Errorf("save image to file %q -> %q failed: %v", image, dst, err)
klog.Errorf("save image to file %q -> %q failed: %v", image, dst, err)
return errors.Wrapf(err, "caching image %q", dst)
}
glog.Infof("save to tar file %s -> %s succeeded", image, dst)
klog.Infof("save to tar file %s -> %s succeeded", image, dst)
return nil
})
}
if err := g.Wait(); err != nil {
return errors.Wrap(err, "caching images")
}
glog.Infoln("Successfully saved all images to host disk.")
klog.Infoln("Successfully saved all images to host disk.")
return nil
}
@ -78,7 +78,7 @@ func SaveToDir(images []string, cacheDir string) error {
func saveToTarFile(iname, rawDest string) error {
start := time.Now()
defer func() {
glog.Infof("cache image %q -> %q took %s", iname, rawDest, time.Since(start))
klog.Infof("cache image %q -> %q took %s", iname, rawDest, time.Since(start))
}()
// OS-specific mangling of destination path
@ -89,7 +89,7 @@ func saveToTarFile(iname, rawDest string) error {
spec := lock.PathMutexSpec(dst)
spec.Timeout = 10 * time.Minute
glog.Infof("acquiring lock: %+v", spec)
klog.Infof("acquiring lock: %+v", spec)
releaser, err := mutex.Acquire(spec)
if err != nil {
return errors.Wrapf(err, "unable to acquire lock for %+v", spec)
@ -97,7 +97,7 @@ func saveToTarFile(iname, rawDest string) error {
defer releaser.Release()
if _, err := os.Stat(dst); err == nil {
glog.Infof("%s exists", dst)
klog.Infof("%s exists", dst)
return nil
}
@ -115,7 +115,7 @@ func saveToTarFile(iname, rawDest string) error {
img, err := retrieveImage(ref)
if err != nil {
glog.Warningf("unable to retrieve image: %v", err)
klog.Warningf("unable to retrieve image: %v", err)
}
if img == nil {
return errors.Wrapf(err, "nil image for %s", iname)
@ -126,12 +126,12 @@ func saveToTarFile(iname, rawDest string) error {
return err
}
glog.Infof("%s exists", dst)
klog.Infof("%s exists", dst)
return nil
}
func writeImage(img v1.Image, dst string, ref name.Reference) error {
glog.Infoln("opening: ", dst)
klog.Infoln("opening: ", dst)
f, err := ioutil.TempFile(filepath.Dir(dst), filepath.Base(dst)+".*.tmp")
if err != nil {
return err
@ -142,7 +142,7 @@ func writeImage(img v1.Image, dst string, ref name.Reference) error {
if err == nil {
err = os.Remove(f.Name())
if err != nil {
glog.Warningf("failed to clean up the temp file %s: %v", f.Name(), err)
klog.Warningf("failed to clean up the temp file %s: %v", f.Name(), err)
}
}
}()

View File

@ -28,7 +28,6 @@ import (
"time"
"github.com/docker/docker/client"
"github.com/golang/glog"
"github.com/google/go-containerregistry/pkg/authn"
"github.com/google/go-containerregistry/pkg/name"
v1 "github.com/google/go-containerregistry/pkg/v1"
@ -36,6 +35,7 @@ import (
"github.com/google/go-containerregistry/pkg/v1/remote"
"github.com/google/go-containerregistry/pkg/v1/tarball"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/driver"
"k8s.io/minikube/pkg/minikube/localpath"
@ -54,7 +54,7 @@ func DigestByDockerLib(imgClient *client.Client, imgName string) string {
imgClient.NegotiateAPIVersion(ctx)
img, _, err := imgClient.ImageInspectWithRaw(ctx, imgName)
if err != nil && !client.IsErrNotFound(err) {
glog.Infof("couldn't find image digest %s from local daemon: %v ", imgName, err)
klog.Infof("couldn't find image digest %s from local daemon: %v ", imgName, err)
return ""
}
return img.ID
@ -65,19 +65,19 @@ func DigestByDockerLib(imgClient *client.Client, imgName string) string {
func DigestByGoLib(imgName string) string {
ref, err := name.ParseReference(imgName, name.WeakValidation)
if err != nil {
glog.Infof("error parsing image name %s ref %v ", imgName, err)
klog.Infof("error parsing image name %s ref %v ", imgName, err)
return ""
}
img, err := retrieveImage(ref)
if err != nil {
glog.Infof("error retrieve Image %s ref %v ", imgName, err)
klog.Infof("error retrieve Image %s ref %v ", imgName, err)
return ""
}
cf, err := img.ConfigName()
if err != nil {
glog.Infof("error getting Image config name %s %v ", imgName, err)
klog.Infof("error getting Image config name %s %v ", imgName, err)
return cf.Hex
}
return cf.Hex
@ -89,7 +89,7 @@ func ExistsImageInDaemon(img string) bool {
cmd := exec.Command("docker", "images", "--format", "{{.Repository}}:{{.Tag}}@{{.Digest}}")
if output, err := cmd.Output(); err == nil {
if strings.Contains(string(output), img) {
glog.Infof("Found %s in local docker daemon, skipping pull", img)
klog.Infof("Found %s in local docker daemon, skipping pull", img)
return true
}
}
@ -137,12 +137,12 @@ func Tag(img string) string {
// WriteImageToDaemon write img to the local docker daemon
func WriteImageToDaemon(img string) error {
glog.Infof("Writing %s to local daemon", img)
klog.Infof("Writing %s to local daemon", img)
ref, err := name.ParseReference(img)
if err != nil {
return errors.Wrap(err, "parsing reference")
}
glog.V(3).Infof("Getting image %v", ref)
klog.V(3).Infof("Getting image %v", ref)
i, err := remote.Image(ref)
if err != nil {
if strings.Contains(err.Error(), "GitHub Docker Registry needs login") {
@ -155,7 +155,7 @@ func WriteImageToDaemon(img string) error {
return errors.Wrap(err, "getting remote image")
}
glog.V(3).Infof("Writing image %v", ref)
klog.V(3).Infof("Writing image %v", ref)
_, err = daemon.Write(ref, i)
if err != nil {
return errors.Wrap(err, "writing daemon image")
@ -165,15 +165,15 @@ func WriteImageToDaemon(img string) error {
}
func retrieveImage(ref name.Reference) (v1.Image, error) {
glog.Infof("retrieving image: %+v", ref)
klog.Infof("retrieving image: %+v", ref)
img, err := daemon.Image(ref)
if err == nil {
glog.Infof("found %s locally: %+v", ref.Name(), img)
klog.Infof("found %s locally: %+v", ref.Name(), img)
return img, nil
}
// reference does not exist in the local daemon
if err != nil {
glog.Infof("daemon lookup for %+v: %v", ref, err)
klog.Infof("daemon lookup for %+v: %v", ref, err)
}
platform := defaultPlatform
@ -182,7 +182,7 @@ func retrieveImage(ref name.Reference) (v1.Image, error) {
return img, nil
}
glog.Warningf("authn lookup for %+v (trying anon): %+v", ref, err)
klog.Warningf("authn lookup for %+v (trying anon): %+v", ref, err)
img, err = remote.Image(ref)
return img, err
}

View File

@ -17,9 +17,9 @@ limitations under the License.
package kubeconfig
import (
"github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/client-go/tools/clientcmd/api"
"k8s.io/klog/v2"
)
// UnsetCurrentContext unsets the current-context from minikube to "" on minikube stop
@ -71,7 +71,7 @@ func DeleteContext(machineName string, configPath ...string) error {
}
if kcfg == nil || api.IsConfigEmpty(kcfg) {
glog.V(2).Info("kubeconfig is empty")
klog.V(2).Info("kubeconfig is empty")
return nil
}

View File

@ -25,11 +25,11 @@ import (
"path/filepath"
"strconv"
"github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/tools/clientcmd/api"
"k8s.io/client-go/tools/clientcmd/api/latest"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/localpath"
pkgutil "k8s.io/minikube/pkg/util"
@ -70,7 +70,7 @@ func PathFromEnv() string {
if kubeConfigFile != "" {
return kubeConfigFile
}
glog.Infof("Ignoring empty entry in %s env var", constants.KubeconfigEnvVar)
klog.Infof("Ignoring empty entry in %s env var", constants.KubeconfigEnvVar)
}
return constants.KubeconfigPath
}
@ -90,7 +90,7 @@ func Endpoint(contextName string, configPath ...string) (string, int, error) {
return "", 0, errors.Errorf("%q does not appear in %s", contextName, path)
}
glog.Infof("found %q server: %q", contextName, cluster.Server)
klog.Infof("found %q server: %q", contextName, cluster.Server)
u, err := url.Parse(cluster.Server)
if err != nil {
return "", 0, errors.Wrap(err, "url parse")
@ -114,7 +114,7 @@ func UpdateEndpoint(contextName string, hostname string, port int, confpath stri
if err == nil {
return false, nil
}
glog.Infof("verify returned: %v", err)
klog.Infof("verify returned: %v", err)
cfg, err := readOrNew(confpath)
if err != nil {
@ -125,7 +125,7 @@ func UpdateEndpoint(contextName string, hostname string, port int, confpath stri
// if the cluster setting is missed in the kubeconfig, create new one
if _, ok := cfg.Clusters[contextName]; !ok {
glog.Infof("%q context is missing from %s - will repair!", contextName, confpath)
klog.Infof("%q context is missing from %s - will repair!", contextName, confpath)
lp := localpath.Profile(contextName)
gp := localpath.MiniPath()
kcs := &Settings{
@ -161,7 +161,7 @@ func writeToFile(config runtime.Object, configPath ...string) error {
}
if config == nil {
glog.Errorf("could not write to '%s': config can't be nil", fPath)
klog.Errorf("could not write to '%s': config can't be nil", fPath)
}
// encode config to YAML

View File

@ -21,10 +21,10 @@ import (
"path/filepath"
"sync/atomic"
"github.com/golang/glog"
"github.com/juju/mutex"
"github.com/pkg/errors"
"k8s.io/client-go/tools/clientcmd/api"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/util/lock"
)
@ -120,7 +120,7 @@ func PopulateFromSettings(cfg *Settings, apiCfg *api.Config) error {
// If no CurrentContext is set, the given name will be used.
func Update(kcs *Settings) error {
spec := lock.PathMutexSpec(filepath.Join(kcs.filePath(), "settings.Update"))
glog.Infof("acquiring lock: %+v", spec)
klog.Infof("acquiring lock: %+v", spec)
releaser, err := mutex.Acquire(spec)
if err != nil {
return errors.Wrapf(err, "unable to acquire lock for %+v", spec)
@ -128,7 +128,7 @@ func Update(kcs *Settings) error {
defer releaser.Release()
// read existing config or create new if does not exist
glog.Infoln("Updating kubeconfig: ", kcs.filePath())
klog.Infoln("Updating kubeconfig: ", kcs.filePath())
kcfg, err := readOrNew(kcs.filePath())
if err != nil {
return err

View File

@ -23,10 +23,10 @@ import (
"runtime"
"strings"
"github.com/golang/glog"
"github.com/otiai10/copy"
"github.com/pkg/errors"
"k8s.io/client-go/util/homedir"
"k8s.io/klog/v2"
)
// MinikubeHome is the name of the minikube home directory environment variable.
@ -76,9 +76,9 @@ func ClientCert(name string) string {
// minikube v1.5.x
legacy := filepath.Join(MiniPath(), "client.crt")
if _, err := os.Stat(legacy); err == nil {
glog.Infof("copying %s -> %s", legacy, new)
klog.Infof("copying %s -> %s", legacy, new)
if err := copy.Copy(legacy, new); err != nil {
glog.Errorf("failed copy %s -> %s: %v", legacy, new, err)
klog.Errorf("failed copy %s -> %s: %v", legacy, new, err)
return legacy
}
}
@ -96,9 +96,9 @@ func ClientKey(name string) string {
// minikube v1.5.x
legacy := filepath.Join(MiniPath(), "client.key")
if _, err := os.Stat(legacy); err == nil {
glog.Infof("copying %s -> %s", legacy, new)
klog.Infof("copying %s -> %s", legacy, new)
if err := copy.Copy(legacy, new); err != nil {
glog.Errorf("failed copy %s -> %s: %v", legacy, new, err)
klog.Errorf("failed copy %s -> %s: %v", legacy, new, err)
return legacy
}
}
@ -125,7 +125,7 @@ func SanitizeCacheDir(image string) string {
if runtime.GOOS == "windows" && hasWindowsDriveLetter(image) {
// not sanitize Windows drive letter.
s := image[:2] + strings.Replace(image[2:], ":", "_", -1)
glog.Infof("windows sanitize: %s -> %s", image, s)
klog.Infof("windows sanitize: %s -> %s", image, s)
return s
}
// ParseReference cannot have a : in the directory path

View File

@ -27,8 +27,8 @@ import (
"sort"
"strings"
"github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/bootstrapper"
"k8s.io/minikube/pkg/minikube/command"
"k8s.io/minikube/pkg/minikube/config"
@ -117,14 +117,14 @@ func FindProblems(r cruntime.Manager, bs bootstrapper.Bootstrapper, cfg config.C
pMap := map[string][]string{}
cmds := logCommands(r, bs, cfg, lookBackwardsCount, false)
for name := range cmds {
glog.Infof("Gathering logs for %s ...", name)
klog.Infof("Gathering logs for %s ...", name)
var b bytes.Buffer
c := exec.Command("/bin/bash", "-c", cmds[name])
c.Stderr = &b
c.Stdout = &b
if rr, err := cr.RunCmd(c); err != nil {
glog.Warningf("failed %s: command: %s %v output: %s", name, rr.Command(), err, rr.Output())
klog.Warningf("failed %s: command: %s %v output: %s", name, rr.Command(), err, rr.Output())
continue
}
scanner := bufio.NewScanner(&b)
@ -132,7 +132,7 @@ func FindProblems(r cruntime.Manager, bs bootstrapper.Bootstrapper, cfg config.C
for scanner.Scan() {
l := scanner.Text()
if IsProblem(l) {
glog.Warningf("Found %s problem: %s", name, l)
klog.Warningf("Found %s problem: %s", name, l)
problems = append(problems, l)
}
}
@ -178,7 +178,7 @@ func Output(r cruntime.Manager, bs bootstrapper.Bootstrapper, cfg config.Cluster
c.Stdout = &b
c.Stderr = &b
if rr, err := runner.RunCmd(c); err != nil {
glog.Errorf("command %s failed with error: %v output: %q", rr.Command(), err, rr.Output())
klog.Errorf("command %s failed with error: %v output: %q", rr.Command(), err, rr.Output())
failed = append(failed, name)
continue
}
@ -200,12 +200,12 @@ func logCommands(r cruntime.Manager, bs bootstrapper.Bootstrapper, cfg config.Cl
for _, pod := range importantPods {
ids, err := r.ListContainers(cruntime.ListOptions{Name: pod})
if err != nil {
glog.Errorf("Failed to list containers for %q: %v", pod, err)
klog.Errorf("Failed to list containers for %q: %v", pod, err)
continue
}
glog.Infof("%d containers: %s", len(ids), ids)
klog.Infof("%d containers: %s", len(ids), ids)
if len(ids) == 0 {
glog.Warningf("No container was found matching %q", pod)
klog.Warningf("No container was found matching %q", pod)
continue
}
for _, i := range ids {

View File

@ -27,9 +27,9 @@ import (
"github.com/docker/docker/client"
"github.com/docker/machine/libmachine/state"
"github.com/golang/glog"
"github.com/pkg/errors"
"golang.org/x/sync/errgroup"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/assets"
"k8s.io/minikube/pkg/minikube/bootstrapper"
"k8s.io/minikube/pkg/minikube/command"
@ -71,14 +71,14 @@ func LoadImages(cc *config.ClusterConfig, runner command.Runner, images []string
// Skip loading images if images already exist
if cr.ImagesPreloaded(images) {
glog.Infof("Images are preloaded, skipping loading")
klog.Infof("Images are preloaded, skipping loading")
return nil
}
glog.Infof("LoadImages start: %s", images)
klog.Infof("LoadImages start: %s", images)
start := time.Now()
defer func() {
glog.Infof("LoadImages completed in %s", time.Since(start))
klog.Infof("LoadImages completed in %s", time.Since(start))
}()
var g errgroup.Group
@ -87,7 +87,7 @@ func LoadImages(cc *config.ClusterConfig, runner command.Runner, images []string
if cr.Name() == "Docker" {
imgClient, err = client.NewClientWithOpts(client.FromEnv) // image client
if err != nil {
glog.Infof("couldn't get a local image daemon which might be ok: %v", err)
klog.Infof("couldn't get a local image daemon which might be ok: %v", err)
}
}
@ -102,14 +102,14 @@ func LoadImages(cc *config.ClusterConfig, runner command.Runner, images []string
if err == nil {
return nil
}
glog.Infof("%q needs transfer: %v", image, err)
klog.Infof("%q needs transfer: %v", image, err)
return transferAndLoadImage(runner, cc.KubernetesConfig, image, cacheDir)
})
}
if err := g.Wait(); err != nil {
return errors.Wrap(err, "loading cached images")
}
glog.Infoln("Successfully loaded all cached images")
klog.Infoln("Successfully loaded all cached images")
return nil
}
@ -188,7 +188,7 @@ func CacheAndLoadImages(images []string) error {
c, err := config.Load(pName)
if err != nil {
// Non-fatal because it may race with profile deletion
glog.Errorf("Failed to load profile %q: %v", pName, err)
klog.Errorf("Failed to load profile %q: %v", pName, err)
failed = append(failed, pName)
continue
}
@ -198,7 +198,7 @@ func CacheAndLoadImages(images []string) error {
status, err := Status(api, m)
if err != nil {
glog.Warningf("error getting status for %s: %v", m, err)
klog.Warningf("error getting status for %s: %v", m, err)
failed = append(failed, m)
continue
}
@ -206,7 +206,7 @@ func CacheAndLoadImages(images []string) error {
if status == state.Running.String() { // the not running hosts will load on next start
h, err := api.Load(m)
if err != nil {
glog.Warningf("Failed to load machine %q: %v", m, err)
klog.Warningf("Failed to load machine %q: %v", m, err)
failed = append(failed, m)
continue
}
@ -217,15 +217,15 @@ func CacheAndLoadImages(images []string) error {
err = LoadImages(c, cr, images, constants.ImageCacheDir)
if err != nil {
failed = append(failed, m)
glog.Warningf("Failed to load cached images for profile %s. make sure the profile is running. %v", pName, err)
klog.Warningf("Failed to load cached images for profile %s. make sure the profile is running. %v", pName, err)
}
succeeded = append(succeeded, m)
}
}
}
glog.Infof("succeeded pushing to: %s", strings.Join(succeeded, " "))
glog.Infof("failed pushing to: %s", strings.Join(failed, " "))
klog.Infof("succeeded pushing to: %s", strings.Join(succeeded, " "))
klog.Infof("failed pushing to: %s", strings.Join(failed, " "))
// Live pushes are not considered a failure
return nil
}
@ -238,7 +238,7 @@ func transferAndLoadImage(cr command.Runner, k8s config.KubernetesConfig, imgNam
}
src := filepath.Join(cacheDir, imgName)
src = localpath.SanitizeCacheDir(src)
glog.Infof("Loading image from cache: %s", src)
klog.Infof("Loading image from cache: %s", src)
filename := filepath.Base(src)
if _, err := os.Stat(src); err != nil {
return err
@ -260,6 +260,6 @@ func transferAndLoadImage(cr command.Runner, k8s config.KubernetesConfig, imgNam
return errors.Wrapf(err, "%s load %s", r.Name(), dst)
}
glog.Infof("Transferred and loaded %s from cache", src)
klog.Infof("Transferred and loaded %s from cache", src)
return nil
}

View File

@ -40,8 +40,8 @@ import (
"github.com/docker/machine/libmachine/state"
"github.com/docker/machine/libmachine/swarm"
"github.com/docker/machine/libmachine/version"
"github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/command"
"k8s.io/minikube/pkg/minikube/driver"
"k8s.io/minikube/pkg/minikube/exit"
@ -162,10 +162,10 @@ func CommandRunner(h *host.Host) (command.Runner, error) {
// Create creates the host
func (api *LocalClient) Create(h *host.Host) error {
glog.Infof("LocalClient.Create starting")
klog.Infof("LocalClient.Create starting")
start := time.Now()
defer func() {
glog.Infof("LocalClient.Create took %s", time.Since(start))
klog.Infof("LocalClient.Create took %s", time.Since(start))
}()
def := registry.Driver(h.DriverName)

View File

@ -25,8 +25,8 @@ import (
"github.com/docker/machine/libmachine/host"
"github.com/docker/machine/libmachine/mcnerror"
"github.com/docker/machine/libmachine/state"
"github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/drivers/kic/oci"
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/driver"
@ -43,7 +43,7 @@ func deleteOrphanedKIC(ociBin string, name string) {
_, err := oci.ContainerStatus(ociBin, name)
if err != nil {
glog.Infof("couldn't inspect container %q before deleting: %v", name, err)
klog.Infof("couldn't inspect container %q before deleting: %v", name, err)
return
}
// allow no more than 5 seconds for delting the container
@ -51,12 +51,12 @@ func deleteOrphanedKIC(ociBin string, name string) {
defer cancel()
if err := oci.ShutDown(ociBin, name); err != nil {
glog.Infof("couldn't shut down %s (might be okay): %v ", name, err)
klog.Infof("couldn't shut down %s (might be okay): %v ", name, err)
}
cmd := exec.CommandContext(ctx, ociBin, "rm", "-f", "-v", name)
err = cmd.Run()
if err == nil {
glog.Infof("Found stale kic container and successfully cleaned it up!")
klog.Infof("Found stale kic container and successfully cleaned it up!")
}
}
@ -79,7 +79,7 @@ func DeleteHost(api libmachine.API, machineName string, deleteAbandoned ...bool)
status, err := Status(api, machineName)
if err != nil {
// Assume that the host has already been deleted, log and return
glog.Infof("Unable to get host status for %s, assuming it has already been deleted: %v", machineName, err)
klog.Infof("Unable to get host status for %s, assuming it has already been deleted: %v", machineName, err)
return nil
}
@ -90,7 +90,7 @@ func DeleteHost(api libmachine.API, machineName string, deleteAbandoned ...bool)
// some drivers need manual shut down before delete to avoid getting stuck.
if driver.NeedsShutdown(host.Driver.DriverName()) {
if err := StopHost(api, machineName); err != nil {
glog.Warningf("stop host: %v", err)
klog.Warningf("stop host: %v", err)
}
// Hack: give the Hyper-V VM more time to stop before deletion
time.Sleep(1 * time.Second)
@ -103,7 +103,7 @@ func DeleteHost(api libmachine.API, machineName string, deleteAbandoned ...bool)
// delete removes a host and its local data files
func delete(api libmachine.API, h *host.Host, machineName string) error {
if err := h.Driver.Remove(); err != nil {
glog.Warningf("remove failed, will retry: %v", err)
klog.Warningf("remove failed, will retry: %v", err)
time.Sleep(1 * time.Second)
nerr := h.Driver.Remove()
@ -121,20 +121,20 @@ func delete(api libmachine.API, h *host.Host, machineName string) error {
// demolish destroys a host by any means necessary - use only if state is inconsistent
func demolish(api libmachine.API, cc config.ClusterConfig, n config.Node, h *host.Host) {
machineName := driver.MachineName(cc, n)
glog.Infof("DEMOLISHING %s ...", machineName)
klog.Infof("DEMOLISHING %s ...", machineName)
// This will probably fail
err := stop(h)
if err != nil {
glog.Infof("stophost failed (probably ok): %v", err)
klog.Infof("stophost failed (probably ok): %v", err)
}
// For 95% of cases, this should be enough
err = DeleteHost(api, machineName)
if err != nil {
glog.Warningf("deletehost failed: %v", err)
klog.Warningf("deletehost failed: %v", err)
}
err = delete(api, h, machineName)
glog.Warningf("delete failed (probably ok) %v", err)
klog.Warningf("delete failed (probably ok) %v", err)
}

View File

@ -23,8 +23,8 @@ import (
"path"
"path/filepath"
"github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/assets"
"k8s.io/minikube/pkg/minikube/command"
"k8s.io/minikube/pkg/minikube/localpath"
@ -115,7 +115,7 @@ func syncDest(localRoot string, localPath string, destRoot string, flatten bool)
// assetsFromDir generates assets from a local filepath, with/without a flattened hierarchy
func assetsFromDir(localRoot string, destRoot string, flatten bool) ([]assets.CopyableFile, error) {
glog.Infof("Scanning %s for local assets ...", localRoot)
klog.Infof("Scanning %s for local assets ...", localRoot)
fs := []assets.CopyableFile{}
err := filepath.Walk(localRoot, func(localPath string, fi os.FileInfo, err error) error {
if err != nil {
@ -138,7 +138,7 @@ func assetsFromDir(localRoot string, destRoot string, flatten bool) ([]assets.Co
targetDir := path.Dir(dest)
targetName := path.Base(dest)
glog.Infof("local asset: %s -> %s in %s", localPath, targetName, targetDir)
klog.Infof("local asset: %s -> %s in %s", localPath, targetName, targetDir)
f, err := assets.NewFileAsset(localPath, targetDir, targetName, ps)
if err != nil {
return errors.Wrapf(err, "creating file asset for %s", localPath)

View File

@ -28,8 +28,8 @@ import (
"github.com/docker/machine/libmachine"
"github.com/docker/machine/libmachine/host"
"github.com/docker/machine/libmachine/state"
"github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/driver"
@ -51,9 +51,9 @@ const (
// fixHost fixes up a previously configured VM so that it is ready to run Kubernetes
func fixHost(api libmachine.API, cc *config.ClusterConfig, n *config.Node) (*host.Host, error) {
start := time.Now()
glog.Infof("fixHost starting: %s", n.Name)
klog.Infof("fixHost starting: %s", n.Name)
defer func() {
glog.Infof("fixHost completed within %s", time.Since(start))
klog.Infof("fixHost completed within %s", time.Since(start))
}()
h, err := api.Load(driver.MachineName(*cc, *n))
@ -91,7 +91,7 @@ func fixHost(api libmachine.API, cc *config.ClusterConfig, n *config.Node) (*hos
}
if driver.BareMetal(h.Driver.DriverName()) {
glog.Infof("%s is local, skipping auth/time setup (requires ssh)", driverName)
klog.Infof("%s is local, skipping auth/time setup (requires ssh)", driverName)
return h, nil
}
@ -104,19 +104,19 @@ func recreateIfNeeded(api libmachine.API, cc *config.ClusterConfig, n *config.No
recreated := false
s, serr := h.Driver.GetState()
glog.Infof("recreateIfNeeded on %s: state=%s err=%v", machineName, s, serr)
klog.Infof("recreateIfNeeded on %s: state=%s err=%v", machineName, s, serr)
if serr != nil || s == state.Stopped || s == state.None {
// If virtual machine does not exist due to user interrupt cancel(i.e. Ctrl + C), recreate virtual machine
me, err := machineExists(h.Driver.DriverName(), s, serr)
if err != nil {
glog.Infof("machineExists: %t. err=%v", me, err)
klog.Infof("machineExists: %t. err=%v", me, err)
}
if !me || err == constants.ErrMachineMissing {
out.T(style.Shrug, `{{.driver_name}} "{{.cluster}}" {{.machine_type}} is missing, will recreate.`, out.V{"driver_name": cc.Driver, "cluster": machineName, "machine_type": machineType})
demolish(api, *cc, *n, h)
glog.Infof("Sleeping 1 second for extra luck!")
klog.Infof("Sleeping 1 second for extra luck!")
time.Sleep(1 * time.Second)
h, err = createHost(api, cc, n)
@ -130,7 +130,7 @@ func recreateIfNeeded(api libmachine.API, cc *config.ClusterConfig, n *config.No
}
if serr != constants.ErrMachineMissing {
glog.Warningf("unexpected machine state, will restart: %v", serr)
klog.Warningf("unexpected machine state, will restart: %v", serr)
}
if s == state.Running {
@ -187,11 +187,11 @@ func ensureSyncedGuestClock(h hostRunner, drv string) error {
}
d, err := guestClockDelta(h, time.Now())
if err != nil {
glog.Warningf("Unable to measure system clock delta: %v", err)
klog.Warningf("Unable to measure system clock delta: %v", err)
return nil
}
if math.Abs(d.Seconds()) < maxClockDesyncSeconds {
glog.Infof("guest clock delta is within tolerance: %s", d)
klog.Infof("guest clock delta is within tolerance: %s", d)
return nil
}
if err := adjustGuestClock(h, time.Now()); err != nil {
@ -207,7 +207,7 @@ func guestClockDelta(h hostRunner, local time.Time) (time.Duration, error) {
if err != nil {
return 0, errors.Wrap(err, "get clock")
}
glog.Infof("guest clock: %s", out)
klog.Infof("guest clock: %s", out)
ns := strings.Split(strings.TrimSpace(out), ".")
secs, err := strconv.ParseInt(strings.TrimSpace(ns[0]), 10, 64)
if err != nil {
@ -220,14 +220,14 @@ func guestClockDelta(h hostRunner, local time.Time) (time.Duration, error) {
// NOTE: In a synced state, remote is a few hundred ms ahead of local
remote := time.Unix(secs, nsecs)
d := remote.Sub(local)
glog.Infof("Guest: %s Remote: %s (delta=%s)", remote, local, d)
klog.Infof("Guest: %s Remote: %s (delta=%s)", remote, local, d)
return d, nil
}
// adjustSystemClock adjusts the guest system clock to be nearer to the host system clock
func adjustGuestClock(h hostRunner, t time.Time) error {
out, err := h.RunSSHCommand(fmt.Sprintf("sudo date -s @%d", t.Unix()))
glog.Infof("clock set: %s (err=%v)", out, err)
klog.Infof("clock set: %s (err=%v)", out, err)
return err
}

View File

@ -20,8 +20,9 @@ import (
"github.com/docker/machine/libmachine"
"github.com/docker/machine/libmachine/host"
"github.com/docker/machine/libmachine/state"
"github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/klog/v2"
)
// Status returns the status of a libmachine host
@ -50,11 +51,11 @@ func Status(api libmachine.API, machineName string) (string, error) {
func IsRunning(api libmachine.API, name string) bool {
s, err := Status(api, name)
if err != nil {
glog.Warningf("host status for %q returned error: %v", name, err)
klog.Warningf("host status for %q returned error: %v", name, err)
return false
}
if s != state.Running.String() {
glog.Warningf("%q host status: %s", name, s)
klog.Warningf("%q host status: %s", name, s)
return false
}
return true
@ -62,7 +63,7 @@ func IsRunning(api libmachine.API, name string) bool {
// LoadHost returns a libmachine host by name
func LoadHost(api libmachine.API, machineName string) (*host.Host, error) {
glog.Infof("Checking if %q exists ...", machineName)
klog.Infof("Checking if %q exists ...", machineName)
exists, err := api.Exists(machineName)
if err != nil {
return nil, errors.Wrapf(err, "Error checking that machine exists: %s", machineName)

View File

@ -21,10 +21,10 @@ import (
"os/exec"
"github.com/docker/machine/libmachine/provision"
"github.com/golang/glog"
"github.com/shirou/gopsutil/cpu"
"github.com/shirou/gopsutil/disk"
"github.com/shirou/gopsutil/mem"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/command"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/out/register"
@ -44,16 +44,16 @@ func CachedHostInfo() (*HostInfo, error, error, error) {
var cpuErr, memErr, diskErr error
i, cpuErr := cachedCPUInfo()
if cpuErr != nil {
glog.Warningf("Unable to get CPU info: %v", cpuErr)
klog.Warningf("Unable to get CPU info: %v", cpuErr)
}
v, memErr := cachedSysMemLimit()
if memErr != nil {
glog.Warningf("Unable to get mem info: %v", memErr)
klog.Warningf("Unable to get mem info: %v", memErr)
}
d, diskErr := cachedDiskInfo()
if diskErr != nil {
glog.Warningf("Unable to get disk info: %v", diskErr)
klog.Warningf("Unable to get disk info: %v", diskErr)
}
var info HostInfo
@ -67,13 +67,13 @@ func CachedHostInfo() (*HostInfo, error, error, error) {
func showLocalOsRelease() {
osReleaseOut, err := ioutil.ReadFile("/etc/os-release")
if err != nil {
glog.Errorf("ReadFile: %v", err)
klog.Errorf("ReadFile: %v", err)
return
}
osReleaseInfo, err := provision.NewOsRelease(osReleaseOut)
if err != nil {
glog.Errorf("NewOsRelease: %v", err)
klog.Errorf("NewOsRelease: %v", err)
return
}
@ -85,16 +85,16 @@ func showLocalOsRelease() {
func logRemoteOsRelease(r command.Runner) {
rr, err := r.RunCmd(exec.Command("cat", "/etc/os-release"))
if err != nil {
glog.Infof("remote release failed: %v", err)
klog.Infof("remote release failed: %v", err)
}
osReleaseInfo, err := provision.NewOsRelease(rr.Stdout.Bytes())
if err != nil {
glog.Errorf("NewOsRelease: %v", err)
klog.Errorf("NewOsRelease: %v", err)
return
}
glog.Infof("Remote host: %s", osReleaseInfo.PrettyName)
klog.Infof("Remote host: %s", osReleaseInfo.PrettyName)
}
var (

View File

@ -22,8 +22,8 @@ import (
"github.com/docker/machine/libmachine"
"github.com/docker/machine/libmachine/host"
libprovision "github.com/docker/machine/libmachine/provision"
"github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/driver"
"k8s.io/minikube/pkg/provision"
@ -85,10 +85,10 @@ func LoadMachine(name string) (*Machine, error) {
// provisionDockerMachine provides fast provisioning of a docker machine
func provisionDockerMachine(h *host.Host) error {
glog.Infof("provisioning docker machine ...")
klog.Infof("provisioning docker machine ...")
start := time.Now()
defer func() {
glog.Infof("provisioned docker machine in %s", time.Since(start))
klog.Infof("provisioned docker machine in %s", time.Since(start))
}()
p, err := fastDetectProvisioner(h)

View File

@ -32,10 +32,10 @@ import (
"github.com/docker/machine/libmachine/drivers"
"github.com/docker/machine/libmachine/engine"
"github.com/docker/machine/libmachine/host"
"github.com/golang/glog"
"github.com/juju/mutex"
"github.com/pkg/errors"
"github.com/spf13/viper"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/drivers/kic/oci"
"k8s.io/minikube/pkg/minikube/command"
"k8s.io/minikube/pkg/minikube/config"
@ -78,7 +78,7 @@ func StartHost(api libmachine.API, cfg *config.ClusterConfig, n *config.Node) (*
}
start := time.Now()
defer func() {
glog.Infof("releasing machines lock for %q, held for %s", machineName, time.Since(start))
klog.Infof("releasing machines lock for %q, held for %s", machineName, time.Since(start))
releaser.Release()
}()
@ -87,11 +87,11 @@ func StartHost(api libmachine.API, cfg *config.ClusterConfig, n *config.Node) (*
return nil, false, errors.Wrapf(err, "exists: %s", machineName)
}
if !exists {
glog.Infof("Provisioning new machine with config: %+v %+v", cfg, n)
klog.Infof("Provisioning new machine with config: %+v %+v", cfg, n)
h, err := createHost(api, cfg, n)
return h, exists, err
}
glog.Infoln("Skipping create...Using existing machine configuration")
klog.Infoln("Skipping create...Using existing machine configuration")
h, err := fixHost(api, cfg, n)
return h, exists, err
}
@ -124,10 +124,10 @@ func engineOptions(cfg config.ClusterConfig) *engine.Options {
}
func createHost(api libmachine.API, cfg *config.ClusterConfig, n *config.Node) (*host.Host, error) {
glog.Infof("createHost starting for %q (driver=%q)", n.Name, cfg.Driver)
klog.Infof("createHost starting for %q (driver=%q)", n.Name, cfg.Driver)
start := time.Now()
defer func() {
glog.Infof("duration metric: createHost completed in %s", time.Since(start))
klog.Infof("duration metric: createHost completed in %s", time.Since(start))
}()
if cfg.Driver == driver.VMwareFusion && viper.GetBool(config.ShowDriverDeprecationNotification) {
@ -161,7 +161,7 @@ func createHost(api libmachine.API, cfg *config.ClusterConfig, n *config.Node) (
h.HostOptions.EngineOptions = engineOptions(*cfg)
cstart := time.Now()
glog.Infof("libmachine.API.Create for %q (driver=%q)", cfg.Name, cfg.Driver)
klog.Infof("libmachine.API.Create for %q (driver=%q)", cfg.Name, cfg.Driver)
if cfg.StartHostTimeout == 0 {
cfg.StartHostTimeout = 6 * time.Minute
@ -169,7 +169,7 @@ func createHost(api libmachine.API, cfg *config.ClusterConfig, n *config.Node) (
if err := timedCreateHost(h, api, cfg.StartHostTimeout); err != nil {
return nil, errors.Wrap(err, "creating host")
}
glog.Infof("duration metric: libmachine.API.Create for %q took %s", cfg.Name, time.Since(cstart))
klog.Infof("duration metric: libmachine.API.Create for %q took %s", cfg.Name, time.Since(cstart))
if err := postStartSetup(h, *cfg); err != nil {
return h, errors.Wrap(err, "post-start")
@ -216,7 +216,7 @@ func postStartValidations(h *host.Host, drvName string) {
}
r, err := CommandRunner(h)
if err != nil {
glog.Warningf("error getting command runner: %v", err)
klog.Warningf("error getting command runner: %v", err)
}
var kind reason.Kind
@ -230,14 +230,14 @@ func postStartValidations(h *host.Host, drvName string) {
name = "Podman"
}
if name == "" {
glog.Warningf("unknown KIC driver: %v", drvName)
klog.Warningf("unknown KIC driver: %v", drvName)
return
}
// make sure /var isn't full, as pod deployments will fail if it is
percentageFull, err := DiskUsed(r, "/var")
if err != nil {
glog.Warningf("error getting percentage of /var that is free: %v", err)
klog.Warningf("error getting percentage of /var that is free: %v", err)
}
if percentageFull >= 99 {
exit.Message(kind, `{{.n}} is out of disk space! (/var is at {{.p}}% of capacity)`, out.V{"n": name, "p": percentageFull})
@ -255,7 +255,7 @@ func DiskUsed(cr command.Runner, dir string) (int, error) {
}
output, err := cr.RunCmd(exec.Command("sh", "-c", fmt.Sprintf("df -h %s | awk 'NR==2{print $5}'", dir)))
if err != nil {
glog.Warningf("error running df -h /var: %v\n%v", err, output.Output())
klog.Warningf("error running df -h /var: %v\n%v", err, output.Output())
return 0, err
}
percentage := strings.TrimSpace(output.Stdout.String())
@ -265,17 +265,17 @@ func DiskUsed(cr command.Runner, dir string) (int, error) {
// postStart are functions shared between startHost and fixHost
func postStartSetup(h *host.Host, mc config.ClusterConfig) error {
glog.Infof("post-start starting for %q (driver=%q)", h.Name, h.DriverName)
klog.Infof("post-start starting for %q (driver=%q)", h.Name, h.DriverName)
start := time.Now()
defer func() {
glog.Infof("post-start completed in %s", time.Since(start))
klog.Infof("post-start completed in %s", time.Since(start))
}()
if driver.IsMock(h.DriverName) {
return nil
}
glog.Infof("creating required directories: %v", requiredDirectories)
klog.Infof("creating required directories: %v", requiredDirectories)
r, err := CommandRunner(h)
if err != nil {
@ -311,11 +311,11 @@ func acquireMachinesLock(name string, drv string) (mutex.Releaser, error) {
spec.Timeout = 10 * time.Minute
}
glog.Infof("acquiring machines lock for %s: %+v", name, spec)
klog.Infof("acquiring machines lock for %s: %+v", name, spec)
start := time.Now()
r, err := mutex.Acquire(spec)
if err == nil {
glog.Infof("acquired machines lock for %q in %s", name, time.Since(start))
klog.Infof("acquired machines lock for %q in %s", name, time.Since(start))
}
return r, err
}

View File

@ -23,8 +23,8 @@ import (
"github.com/docker/machine/libmachine/host"
"github.com/docker/machine/libmachine/mcnerror"
"github.com/docker/machine/libmachine/state"
"github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/drivers/kic/oci"
"k8s.io/minikube/pkg/minikube/driver"
"k8s.io/minikube/pkg/minikube/out"
@ -36,7 +36,7 @@ import (
// StopHost stops the host VM, saving state to disk.
func StopHost(api libmachine.API, machineName string) error {
register.Reg.SetStep(register.Stopping)
glog.Infof("StopHost: %v", machineName)
klog.Infof("StopHost: %v", machineName)
h, err := api.Load(machineName)
if err != nil {
return errors.Wrapf(err, "load")
@ -56,15 +56,15 @@ func stop(h *host.Host) error {
}
if err := h.Stop(); err != nil {
glog.Infof("stop err: %v", err)
klog.Infof("stop err: %v", err)
st, ok := err.(mcnerror.ErrHostAlreadyInState)
if ok && st.State == state.Stopped {
glog.Infof("host is already stopped")
klog.Infof("host is already stopped")
return nil
}
return &retry.RetriableError{Err: errors.Wrap(err, "stop")}
}
glog.Infof("duration metric: stop complete within %s", time.Since(start))
klog.Infof("duration metric: stop complete within %s", time.Since(start))
return nil
}
@ -72,11 +72,11 @@ func stop(h *host.Host) error {
func trySSHPowerOff(h *host.Host) error {
s, err := h.Driver.GetState()
if err != nil {
glog.Warningf("unable to get state: %v", err)
klog.Warningf("unable to get state: %v", err)
return err
}
if s != state.Running {
glog.Infof("host is in state %s", s)
klog.Infof("host is in state %s", s)
return nil
}
@ -84,11 +84,11 @@ func trySSHPowerOff(h *host.Host) error {
// differnet for kic because RunSSHCommand is not implemented by kic
if driver.IsKIC(h.DriverName) {
err := oci.ShutDown(h.DriverName, h.Name)
glog.Infof("shutdown container: err=%v", err)
klog.Infof("shutdown container: err=%v", err)
} else {
out, err := h.RunSSHCommand("sudo poweroff")
// poweroff always results in an error, since the host disconnects.
glog.Infof("poweroff result: out=%s, err=%v", out, err)
klog.Infof("poweroff result: out=%s, err=%v", out, err)
}
return nil
}

View File

@ -25,7 +25,7 @@ import (
"github.com/docker/machine/libmachine"
"github.com/docker/machine/libmachine/host"
"github.com/docker/machine/libmachine/state"
"github.com/golang/glog"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/bootstrapper/bsutil/kverify"
"k8s.io/minikube/pkg/minikube/command"
"k8s.io/minikube/pkg/minikube/config"
@ -63,7 +63,7 @@ type ControlPlane struct {
// Partial is a cmd-friendly way to load a cluster which may or may not be running
func Partial(name string, miniHome ...string) (libmachine.API, *config.ClusterConfig) {
glog.Infof("Loading cluster: %s", name)
klog.Infof("Loading cluster: %s", name)
api, err := machine.NewAPIClient(miniHome...)
if err != nil {
exit.Error(reason.NewAPIClient, "libmachine failed", err)

View File

@ -22,10 +22,10 @@ import (
"runtime"
"strings"
"github.com/golang/glog"
"github.com/pkg/errors"
"github.com/spf13/viper"
"golang.org/x/sync/errgroup"
"k8s.io/klog/v2"
cmdcfg "k8s.io/minikube/cmd/minikube/cmd/config"
"k8s.io/minikube/pkg/drivers/kic"
"k8s.io/minikube/pkg/minikube/config"
@ -50,13 +50,13 @@ const (
func beginCacheKubernetesImages(g *errgroup.Group, imageRepository string, k8sVersion string, cRuntime string) {
// TODO: remove imageRepository check once #7695 is fixed
if imageRepository == "" && download.PreloadExists(k8sVersion, cRuntime) {
glog.Info("Caching tarball of preloaded images")
klog.Info("Caching tarball of preloaded images")
err := download.Preload(k8sVersion, cRuntime)
if err == nil {
glog.Infof("Finished verifying existence of preloaded tar for %s on %s", k8sVersion, cRuntime)
klog.Infof("Finished verifying existence of preloaded tar for %s on %s", k8sVersion, cRuntime)
return // don't cache individual images if preload is successful.
}
glog.Warningf("Error downloading preloaded artifacts will continue without preload: %v", err)
klog.Warningf("Error downloading preloaded artifacts will continue without preload: %v", err)
}
if !viper.GetBool(cacheImages) {
@ -108,15 +108,15 @@ func doCacheBinaries(k8sVersion string) error {
func beginDownloadKicBaseImage(g *errgroup.Group, cc *config.ClusterConfig, downloadOnly bool) {
if cc.Driver != "docker" {
// TODO: driver == "podman"
glog.Info("Driver isn't docker, skipping base image download")
klog.Info("Driver isn't docker, skipping base image download")
return
}
if image.ExistsImageInDaemon(cc.KicBaseImage) {
glog.Infof("%s exists in daemon, skipping pull", cc.KicBaseImage)
klog.Infof("%s exists in daemon, skipping pull", cc.KicBaseImage)
return
}
glog.Infof("Beginning downloading kic base image for %s with %s", cc.Driver, cc.KubernetesConfig.ContainerRuntime)
klog.Infof("Beginning downloading kic base image for %s with %s", cc.Driver, cc.KubernetesConfig.ContainerRuntime)
out.T(style.Pulling, "Pulling base image ...")
g.Go(func() error {
baseImg := cc.KicBaseImage
@ -133,27 +133,27 @@ func beginDownloadKicBaseImage(g *errgroup.Group, cc *config.ClusterConfig, down
}()
for _, img := range append([]string{baseImg}, kic.FallbackImages...) {
if err := image.LoadFromTarball(driver.Docker, img); err == nil {
glog.Infof("successfully loaded %s from cached tarball", img)
klog.Infof("successfully loaded %s from cached tarball", img)
// strip the digest from the img before saving it in the config
// because loading an image from tarball to daemon doesn't load the digest
finalImg = image.Tag(img)
return nil
}
glog.Infof("Downloading %s to local daemon", img)
klog.Infof("Downloading %s to local daemon", img)
err := image.WriteImageToDaemon(img)
if err == nil {
glog.Infof("successfully downloaded %s", img)
klog.Infof("successfully downloaded %s", img)
finalImg = img
return nil
}
if downloadOnly {
if err := image.SaveToDir([]string{img}, constants.ImageCacheDir); err == nil {
glog.Infof("successfully saved %s as a tarball", img)
klog.Infof("successfully saved %s as a tarball", img)
finalImg = img
return nil
}
}
glog.Infof("failed to download %s, will try fallback image if available: %v", img, err)
klog.Infof("failed to download %s, will try fallback image if available: %v", img, err)
}
return fmt.Errorf("failed to download kic base image or any fallback image")
})
@ -164,7 +164,7 @@ func waitDownloadKicBaseImage(g *errgroup.Group) {
if err := g.Wait(); err != nil {
if err != nil {
if errors.Is(err, image.ErrGithubNeedsLogin) {
glog.Warningf("Error downloading kic artifacts: %v", err)
klog.Warningf("Error downloading kic artifacts: %v", err)
out.ErrT(style.Connectivity, "Unfortunately, could not download the base image {{.image_name}} ", out.V{"image_name": strings.Split(kic.BaseImage, "@")[0]})
out.WarningT("In order to use the fall back image, you need to log in to the github packages registry")
out.T(style.Documentation, `Please visit the following link for documentation around this:
@ -174,12 +174,12 @@ func waitDownloadKicBaseImage(g *errgroup.Group) {
if errors.Is(err, image.ErrGithubNeedsLogin) || errors.Is(err, image.ErrNeedsLogin) {
exit.Message(reason.Usage, `Please either authenticate to the registry or use --base-image flag to use a different registry.`)
} else {
glog.Errorln("Error downloading kic artifacts: ", err)
klog.Errorln("Error downloading kic artifacts: ", err)
}
}
}
glog.Info("Successfully downloaded all kic artifacts")
klog.Info("Successfully downloaded all kic artifacts")
}
// WaitCacheRequiredImages blocks until the required images are all cached.
@ -188,7 +188,7 @@ func waitCacheRequiredImages(g *errgroup.Group) {
return
}
if err := g.Wait(); err != nil {
glog.Errorln("Error caching images: ", err)
klog.Errorln("Error caching images: ", err)
}
}

View File

@ -24,8 +24,8 @@ import (
"strconv"
"sync"
"github.com/golang/glog"
"github.com/spf13/viper"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/cruntime"
@ -62,12 +62,12 @@ func configureMounts(wg *sync.WaitGroup) {
out.T(style.Mounting, "Creating mount {{.name}} ...", out.V{"name": viper.GetString(mountString)})
path := os.Args[0]
mountDebugVal := 0
if glog.V(8) {
if klog.V(8).Enabled() {
mountDebugVal = 1
}
mountCmd := exec.Command(path, "mount", fmt.Sprintf("--v=%d", mountDebugVal), viper.GetString(mountString))
mountCmd.Env = append(os.Environ(), constants.IsMinikubeChildProcess+"=true")
if glog.V(8) {
if klog.V(8).Enabled() {
mountCmd.Stdout = os.Stdout
mountCmd.Stderr = os.Stderr
}

View File

@ -20,10 +20,10 @@ import (
"fmt"
"os/exec"
"github.com/golang/glog"
"github.com/pkg/errors"
"github.com/spf13/viper"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/kapi"
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/driver"
@ -88,9 +88,9 @@ func Delete(cc config.ClusterConfig, name string) (*config.Node, error) {
kubectl := kapi.KubectlBinaryPath(cc.KubernetesConfig.KubernetesVersion)
cmd := exec.Command("sudo", "KUBECONFIG=/var/lib/minikube/kubeconfig", kubectl, "drain", m)
if _, err := runner.RunCmd(cmd); err != nil {
glog.Warningf("unable to scale coredns replicas to 1: %v", err)
klog.Warningf("unable to scale coredns replicas to 1: %v", err)
} else {
glog.Infof("successfully scaled coredns replicas to 1")
klog.Infof("successfully scaled coredns replicas to 1")
}
// kubectl delete
@ -122,7 +122,7 @@ func Retrieve(cc config.ClusterConfig, name string) (*config.Node, int, error) {
// Accept full machine name as well as just node name
if driver.MachineName(cc, n) == name {
glog.Infof("Couldn't find node name %s, but found it as a machine name, returning it anyway.", name)
klog.Infof("Couldn't find node name %s, but found it as a machine name, returning it anyway.", name)
return &n, i, nil
}
}

View File

@ -29,10 +29,10 @@ import (
"github.com/blang/semver"
"github.com/docker/machine/libmachine"
"github.com/docker/machine/libmachine/host"
"github.com/golang/glog"
"github.com/pkg/errors"
"github.com/spf13/viper"
"golang.org/x/sync/errgroup"
"k8s.io/klog/v2"
cmdcfg "k8s.io/minikube/cmd/minikube/cmd/config"
"k8s.io/minikube/pkg/addons"
"k8s.io/minikube/pkg/drivers/kic/oci"
@ -96,9 +96,9 @@ func Start(starter Starter, apiServer bool) (*kubeconfig.Settings, error) {
// Add "host.minikube.internal" DNS alias (intentionally non-fatal)
hostIP, err := cluster.HostIP(starter.Host)
if err != nil {
glog.Errorf("Unable to get host IP: %v", err)
klog.Errorf("Unable to get host IP: %v", err)
} else if err := machine.AddHostAlias(starter.Runner, constants.HostAlias, hostIP); err != nil {
glog.Errorf("Unable to add host alias: %v", err)
klog.Errorf("Unable to add host alias: %v", err)
}
var bs bootstrapper.Bootstrapper
@ -196,12 +196,12 @@ func Start(starter Starter, apiServer bool) (*kubeconfig.Settings, error) {
}
}
glog.Infof("Will wait %s for node ...", waitTimeout)
klog.Infof("Will wait %s for node ...", waitTimeout)
if err := bs.WaitForNode(*starter.Cfg, *starter.Node, viper.GetDuration(waitTimeout)); err != nil {
return nil, errors.Wrapf(err, "wait %s for node", viper.GetDuration(waitTimeout))
}
glog.Infof("waiting for startup goroutines ...")
klog.Infof("waiting for startup goroutines ...")
wg.Wait()
// Write enabled addons to the config before completion
@ -264,7 +264,7 @@ func configureRuntimes(runner cruntime.CommandRunner, cc config.ClusterConfig, k
case *cruntime.ErrISOFeature:
out.ErrT(style.Tip, "Existing disk is missing new features ({{.error}}). To upgrade, run 'minikube delete'", out.V{"error": err})
default:
glog.Warningf("%s preload failed: %v, falling back to caching images", cr.Name(), err)
klog.Warningf("%s preload failed: %v, falling back to caching images", cr.Name(), err)
}
if err := machine.CacheImagesForBootstrapper(cc.KubernetesConfig.ImageRepository, cc.KubernetesConfig.KubernetesVersion, viper.GetString(cmdcfg.Bootstrapper)); err != nil {
@ -374,31 +374,31 @@ func startHost(api libmachine.API, cc *config.ClusterConfig, n *config.Node, del
if err == nil {
return host, exists, nil
}
glog.Warningf("error starting host: %v", err)
klog.Warningf("error starting host: %v", err)
// NOTE: People get very cranky if you delete their prexisting VM. Only delete new ones.
if !exists {
err := machine.DeleteHost(api, driver.MachineName(*cc, *n))
if err != nil {
glog.Warningf("delete host: %v", err)
klog.Warningf("delete host: %v", err)
}
}
if _, ff := err.(*oci.FailFastError); ff {
glog.Infof("will skip retrying to create machine because error is not retriable: %v", err)
klog.Infof("will skip retrying to create machine because error is not retriable: %v", err)
return host, exists, err
}
out.ErrT(style.Embarrassed, "StartHost failed, but will try again: {{.error}}", out.V{"error": err})
glog.Info("Will try again in 5 seconds ...")
klog.Info("Will try again in 5 seconds ...")
// Try again, but just once to avoid making the logs overly confusing
time.Sleep(5 * time.Second)
if delOnFail {
glog.Info("Deleting existing host since delete-on-failure was set.")
klog.Info("Deleting existing host since delete-on-failure was set.")
// Delete the failed existing host
err := machine.DeleteHost(api, driver.MachineName(*cc, *n))
if err != nil {
glog.Warningf("delete host: %v", err)
klog.Warningf("delete host: %v", err)
}
}
@ -461,7 +461,7 @@ func trySSH(h *host.Host, ip string) error {
d := net.Dialer{Timeout: 3 * time.Second}
conn, err := d.Dial("tcp", sshAddr)
if err != nil {
glog.Warningf("dial failed (will retry): %v", err)
klog.Warningf("dial failed (will retry): %v", err)
return err
}
_ = conn.Close()
@ -506,7 +506,7 @@ func tryRegistry(r command.Runner, driverName string, imageRepository string) {
opts = append(opts, fmt.Sprintf("https://%s/", imageRepository))
if rr, err := r.RunCmd(exec.Command("curl", opts...)); err != nil {
glog.Warningf("%s failed: %v", rr.Args, err)
klog.Warningf("%s failed: %v", rr.Args, err)
out.WarningT("This {{.type}} is having trouble accessing https://{{.repository}}", out.V{"repository": imageRepository, "type": driver.MachineType(driverName)})
out.ErrT(style.Tip, "To pull new external images, you may need to configure a proxy: https://minikube.sigs.k8s.io/docs/reference/networking/proxy/")
}
@ -548,8 +548,8 @@ func rescaleCoreDNS(cc *config.ClusterConfig, runner command.Runner) {
kubectl := kapi.KubectlBinaryPath(cc.KubernetesConfig.KubernetesVersion)
cmd := exec.Command("sudo", "KUBECONFIG=/var/lib/minikube/kubeconfig", kubectl, "scale", "deployment", "--replicas=1", "coredns", "-n=kube-system")
if _, err := runner.RunCmd(cmd); err != nil {
glog.Warningf("unable to scale coredns replicas to 1: %v", err)
klog.Warningf("unable to scale coredns replicas to 1: %v", err)
} else {
glog.Infof("successfully scaled coredns replicas to 1")
klog.Infof("successfully scaled coredns replicas to 1")
}
}

View File

@ -26,9 +26,9 @@ import (
"time"
"github.com/blang/semver"
"github.com/golang/glog"
"github.com/pkg/errors"
"github.com/spf13/viper"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/localpath"
"k8s.io/minikube/pkg/minikube/out"
@ -54,17 +54,17 @@ func MaybePrintUpdateText(url string, lastUpdatePath string) bool {
}
latestVersion, err := getLatestVersionFromURL(url)
if err != nil {
glog.Warning(err)
klog.Warning(err)
return true
}
localVersion, err := version.GetSemverVersion()
if err != nil {
glog.Warning(err)
klog.Warning(err)
return true
}
if localVersion.Compare(latestVersion) < 0 {
if err := writeTimeToFile(lastUpdateCheckFilePath, time.Now().UTC()); err != nil {
glog.Errorf("write time failed: %v", err)
klog.Errorf("write time failed: %v", err)
}
url := "https://github.com/kubernetes/minikube/releases/tag/v" + latestVersion.String()
out.T(style.Celebrate, `minikube {{.version}} is available! Download it: {{.url}}`, out.V{"version": latestVersion, "url": url})
@ -123,7 +123,7 @@ func getLatestVersionFromURL(url string) (semver.Version, error) {
// GetAllVersionsFromURL get all versions from a JSON URL
func GetAllVersionsFromURL(url string) (Releases, error) {
var releases Releases
glog.Info("Checking for updates...")
klog.Info("Checking for updates...")
if err := getJSON(url, &releases); err != nil {
return releases, errors.Wrap(err, "Error getting json from minikube version url")
}

View File

@ -27,8 +27,9 @@ import (
"strconv"
"strings"
"github.com/golang/glog"
isatty "github.com/mattn/go-isatty"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/out/register"
"k8s.io/minikube/pkg/minikube/style"
"k8s.io/minikube/pkg/minikube/translate"
@ -99,25 +100,25 @@ func Infof(format string, a ...V) {
// String writes a basic formatted string to stdout
func String(format string, a ...interface{}) {
// Flush log buffer so that output order makes sense
glog.Flush()
klog.Flush()
if outFile == nil {
glog.Warningf("[unset outFile]: %s", fmt.Sprintf(format, a...))
klog.Warningf("[unset outFile]: %s", fmt.Sprintf(format, a...))
return
}
glog.Infof(format, a...)
klog.Infof(format, a...)
_, err := fmt.Fprintf(outFile, format, a...)
if err != nil {
glog.Errorf("Fprintf failed: %v", err)
klog.Errorf("Fprintf failed: %v", err)
}
}
// Ln writes a basic formatted string with a newline to stdout
func Ln(format string, a ...interface{}) {
if JSON {
glog.Warningf("please use out.T to log steps in JSON")
klog.Warningf("please use out.T to log steps in JSON")
return
}
String(format+"\n", a...)
@ -138,15 +139,15 @@ func Err(format string, a ...interface{}) {
register.RecordError(format)
if errFile == nil {
glog.Errorf("[unset errFile]: %s", fmt.Sprintf(format, a...))
klog.Errorf("[unset errFile]: %s", fmt.Sprintf(format, a...))
return
}
glog.Warningf(format, a...)
klog.Warningf(format, a...)
_, err := fmt.Fprintf(errFile, format, a...)
if err != nil {
glog.Errorf("Fprint failed: %v", err)
klog.Errorf("Fprint failed: %v", err)
}
}
@ -181,20 +182,20 @@ func FailureT(format string, a ...V) {
// SetOutFile configures which writer standard output goes to.
func SetOutFile(w fdWriter) {
glog.Infof("Setting OutFile to fd %d ...", w.Fd())
klog.Infof("Setting OutFile to fd %d ...", w.Fd())
outFile = w
useColor = wantsColor(w.Fd())
}
// SetJSON configures printing to STDOUT in JSON
func SetJSON(j bool) {
glog.Infof("Setting JSON to %v", j)
klog.Infof("Setting JSON to %v", j)
JSON = j
}
// SetErrFile configures which writer error output goes to.
func SetErrFile(w fdWriter) {
glog.Infof("Setting ErrFile to fd %d...", w.Fd())
klog.Infof("Setting ErrFile to fd %d...", w.Fd())
errFile = w
useColor = wantsColor(w.Fd())
}
@ -209,11 +210,11 @@ func wantsColor(fd uintptr) bool {
// If unset, we try to automatically determine suitability from the environment.
val := os.Getenv(OverrideEnv)
if val != "" {
glog.Infof("%s=%q\n", OverrideEnv, os.Getenv(OverrideEnv))
klog.Infof("%s=%q\n", OverrideEnv, os.Getenv(OverrideEnv))
override, err := strconv.ParseBool(val)
if err != nil {
// That's OK, we will just fall-back to automatic detection.
glog.Errorf("ParseBool(%s): %v", OverrideEnv, err)
klog.Errorf("ParseBool(%s): %v", OverrideEnv, err)
} else {
return override
}
@ -228,12 +229,12 @@ func wantsColor(fd uintptr) bool {
colorTerm := os.Getenv("COLORTERM")
// Example: term-256color
if !strings.Contains(term, "color") && !strings.Contains(colorTerm, "truecolor") && !strings.Contains(colorTerm, "24bit") && !strings.Contains(colorTerm, "yes") {
glog.Infof("TERM=%s,COLORTERM=%s, which probably does not support color", term, colorTerm)
klog.Infof("TERM=%s,COLORTERM=%s, which probably does not support color", term, colorTerm)
return false
}
isT := isatty.IsTerminal(fd)
glog.Infof("isatty.IsTerminal(%d) = %v\n", fd, isT)
klog.Infof("isatty.IsTerminal(%d) = %v\n", fd, isT)
return isT
}
@ -254,7 +255,7 @@ func LogEntries(msg string, err error, entries map[string][]string) {
// DisplayError prints the error and displays the standard minikube error messaging
func DisplayError(msg string, err error) {
glog.Warningf(fmt.Sprintf("%s: %v", msg, err))
klog.Warningf(fmt.Sprintf("%s: %v", msg, err))
if JSON {
FatalT("{{.msg}}: {{.err}}", V{"msg": translate.T(msg), "err": err})
return
@ -270,19 +271,19 @@ func DisplayError(msg string, err error) {
// applyTmpl applies formatting
func applyTmpl(format string, a ...V) string {
if len(a) == 0 {
glog.Warningf("no arguments passed for %q - returning raw string", format)
klog.Warningf("no arguments passed for %q - returning raw string", format)
return format
}
var buf bytes.Buffer
t, err := template.New(format).Parse(format)
if err != nil {
glog.Errorf("unable to parse %q: %v - returning raw string.", format, err)
klog.Errorf("unable to parse %q: %v - returning raw string.", format, err)
return format
}
err = t.Execute(&buf, a[0])
if err != nil {
glog.Errorf("unable to execute %s: %v - returning raw string.", format, err)
klog.Errorf("unable to execute %s: %v - returning raw string.", format, err)
return format
}
out := buf.String()

Some files were not shown because too many files have changed in this diff Show More