Skip to content

Commit

Permalink
Merge branch 'master' into add_desc_node_to_minikube_logs
Browse files Browse the repository at this point in the history
  • Loading branch information
prasadkatti committed Mar 21, 2020
2 parents ba6dbc5 + ba4e993 commit 376271a
Show file tree
Hide file tree
Showing 18 changed files with 446 additions and 188 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ jobs:
docker info || true
docker version || true
docker ps || true
- name: install lz4
shell: bash
run: |
sudo apt-get update -qq
sudo apt-get -qq -y install liblz4-tool
- name: Install gopogh
shell: bash
run: |
Expand Down Expand Up @@ -150,6 +155,11 @@ jobs:
SHELL: "/bin/bash" # To prevent https://github.com/kubernetes/minikube/issues/6643
needs: [build_minikube]
steps:
- name: install lz4
shell: bash
run: |
sudo apt-get update -qq
sudo apt-get -qq -y install liblz4-tool
- name: Docker Info
shell: bash
run: |
Expand Down Expand Up @@ -218,6 +228,11 @@ jobs:
SHELL: "/bin/bash" # To prevent https://github.com/kubernetes/minikube/issues/6643
runs-on: ubuntu-16.04
steps:
- name: install lz4
shell: bash
run: |
sudo apt-get update -qq
sudo apt-get -qq -y install liblz4-tool
- name: Install gopogh
shell: bash
run: |
Expand Down Expand Up @@ -280,6 +295,11 @@ jobs:
SHELL: "/bin/bash" # To prevent https://github.com/kubernetes/minikube/issues/6643
runs-on: ubuntu-18.04
steps:
- name: install lz4
shell: bash
run: |
sudo apt-get update -qq
sudo apt-get -qq -y install liblz4-tool
- name: Install gopogh
shell: bash
run: |
Expand Down Expand Up @@ -342,6 +362,11 @@ jobs:
SHELL: "/bin/bash" # To prevent https://github.com/kubernetes/minikube/issues/6643
runs-on: ubuntu-18.04
steps:
- name: install lz4
shell: bash
run: |
sudo apt-get update -qq
sudo apt-get -qq -y install liblz4-tool
- name: install podman
shell: bash
run: |
Expand Down
6 changes: 6 additions & 0 deletions cmd/minikube/cmd/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package cmd

import (
"errors"
"fmt"
"net/url"
"os"
Expand Down Expand Up @@ -104,6 +105,11 @@ var serviceCmd = &cobra.Command{

urls, err := service.WaitForService(api, namespace, svc, serviceURLTemplate, serviceURLMode, https, wait, interval)
if err != nil {
var s *service.SVCNotFoundError
if errors.As(err, &s) {
exit.WithCodeT(exit.Data, `Service '{{.service}}' was not found in '{{.namespace}}' namespace.
You may select another namespace by using 'minikube service {{.service}} -n <namespace>'. Or list out all the services using 'minikube service list'`, out.V{"service": svc, "namespace": namespace})
}
exit.WithError("Error opening service", err)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,18 @@ spec:
hostPath:
path: /dev
containers:
- image: "{{default "k8s.gcr.io" .ImageRepository}}/nvidia-gpu-device-plugin@sha256:0842734032018be107fa2490c98156992911e3e1f2a21e059ff0105b07dd8e9e"
command: ["/usr/bin/nvidia-gpu-device-plugin", "-logtostderr"]
- image: "nvidia/k8s-device-plugin:1.0.0-beta4"
command: ["/usr/bin/nvidia-device-plugin", "-logtostderr"]
name: nvidia-gpu-device-plugin
resources:
requests:
cpu: 50m
memory: 10Mi
limits:
cpu: 50m
memory: 10Mi
securityContext:
privileged: true
volumeMounts:
- name: device-plugin
mountPath: /device-plugin
mountPath: /var/lib/kubelet/device-plugins
- name: dev
mountPath: /dev
updateStrategy:
Expand Down
2 changes: 1 addition & 1 deletion deploy/addons/helm-tiller/helm-tiller-dp.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ spec:
value: kube-system
- name: TILLER_HISTORY_MAX
value: "0"
image: gcr.io/kubernetes-helm/tiller:v2.16.1
image: gcr.io/kubernetes-helm/tiller:v2.16.3
imagePullPolicy: IfNotPresent
livenessProbe:
failureThreshold: 3
Expand Down
10 changes: 5 additions & 5 deletions hack/kubernetes_version/update_kubernetes_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,18 @@ func main() {
}
mode := info.Mode()

re := regexp.MustCompile(`var DefaultKubernetesVersion = .*`)
f := re.ReplaceAllString(string(cf), "var DefaultKubernetesVersion = \""+v+"\"")
re := regexp.MustCompile(`DefaultKubernetesVersion = \".*`)
f := re.ReplaceAllString(string(cf), "DefaultKubernetesVersion = \""+v+"\"")

re = regexp.MustCompile(`var NewestKubernetesVersion = .*`)
f = re.ReplaceAllString(f, "var NewestKubernetesVersion = \""+v+"\"")
re = regexp.MustCompile(`NewestKubernetesVersion = \".*`)
f = re.ReplaceAllString(f, "NewestKubernetesVersion = \""+v+"\"")

if err := ioutil.WriteFile(constantsFile, []byte(f), mode); err != nil {
fmt.Println(err)
os.Exit(1)
}

testData := "../../pkg/minikube/bootstrapper/kubeadm/testdata"
testData := "../../pkg/minikube/bootstrapper/bsutil/testdata"

err = filepath.Walk(testData, func(path string, info os.FileInfo, err error) error {
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/minikube/assets/addons.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,11 @@ var Addons = map[string]*Addon{
}, false, "nvidia-driver-installer"),
"nvidia-gpu-device-plugin": NewAddon([]*BinAsset{
MustBinAsset(
"deploy/addons/gpu/nvidia-gpu-device-plugin.yaml.tmpl",
"deploy/addons/gpu/nvidia-gpu-device-plugin.yaml",
vmpath.GuestAddonsDir,
"nvidia-gpu-device-plugin.yaml",
"0640",
true),
false),
}, false, "nvidia-gpu-device-plugin"),
"logviewer": NewAddon([]*BinAsset{
MustBinAsset(
Expand Down
5 changes: 5 additions & 0 deletions pkg/minikube/bootstrapper/bsutil/binaries.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ func TransferBinaries(cfg config.KubernetesConfig, c command.Runner) error {
return err
}

// stop kubelet to avoid "Text File Busy" error
if _, err := c.RunCmd(exec.Command("/bin/bash", "-c", "pgrep kubelet && sudo systemctl stop kubelet")); err != nil {
glog.Warningf("unable to stop kubelet: %s", err)
}

var g errgroup.Group
for _, name := range constants.KubernetesReleaseBinaries {
name := name
Expand Down
6 changes: 3 additions & 3 deletions pkg/minikube/bootstrapper/bsutil/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ const (
// ConfigFileAssets returns configuration file assets
func ConfigFileAssets(cfg config.KubernetesConfig, kubeadm []byte, kubelet []byte, kubeletSvc []byte, defaultCNIConfig []byte) []assets.CopyableFile {
fs := []assets.CopyableFile{
assets.NewMemoryAssetTarget(kubeadm, KubeadmYamlPath, "0640"),
assets.NewMemoryAssetTarget(kubelet, KubeletSystemdConfFile, "0644"),
assets.NewMemoryAssetTarget(kubeletSvc, KubeletServiceFile, "0644"),
assets.NewMemoryAssetTarget(kubeadm, KubeadmYamlPath+".new", "0640"),
assets.NewMemoryAssetTarget(kubelet, KubeletSystemdConfFile+".new", "0644"),
assets.NewMemoryAssetTarget(kubeletSvc, KubeletServiceFile+".new", "0644"),
}
// Copy the default CNI config (k8s.conf), so that kubelet can successfully
// start a Pod in the case a user hasn't manually installed any CNI plugin
Expand Down
70 changes: 69 additions & 1 deletion pkg/minikube/bootstrapper/bsutil/kverify/kverify.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (

"github.com/docker/machine/libmachine/state"
"github.com/golang/glog"
core "k8s.io/api/core/v1"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/kubernetes"
Expand Down Expand Up @@ -79,6 +80,68 @@ func apiServerPID(cr command.Runner) (int, error) {
return strconv.Atoi(s)
}

// ExpectedComponentsRunning returns whether or not all expected components are running
func ExpectedComponentsRunning(cs *kubernetes.Clientset) error {
expected := []string{
"kube-dns", // coredns
"etcd",
"kube-apiserver",
"kube-controller-manager",
"kube-proxy",
"kube-scheduler",
}

found := map[string]bool{}

pods, err := cs.CoreV1().Pods("kube-system").List(meta.ListOptions{})
if err != nil {
return err
}

for _, pod := range pods.Items {
glog.Infof("found pod: %s", podStatusMsg(pod))
if pod.Status.Phase != core.PodRunning {
continue
}
for k, v := range pod.ObjectMeta.Labels {
if k == "component" || k == "k8s-app" {
found[v] = true
}
}
}

missing := []string{}
for _, e := range expected {
if !found[e] {
missing = append(missing, e)
}
}
if len(missing) > 0 {
return fmt.Errorf("missing components: %v", strings.Join(missing, ", "))
}
return nil
}

// podStatusMsg returns a human-readable pod status, for generating debug status
func podStatusMsg(pod core.Pod) string {
var sb strings.Builder
sb.WriteString(fmt.Sprintf("%q [%s] %s", pod.ObjectMeta.GetName(), pod.ObjectMeta.GetUID(), pod.Status.Phase))
for i, c := range pod.Status.Conditions {
if c.Reason != "" {
if i == 0 {
sb.WriteString(": ")
} else {
sb.WriteString(" / ")
}
sb.WriteString(fmt.Sprintf("%s:%s", c.Type, c.Reason))
}
if c.Message != "" {
sb.WriteString(fmt.Sprintf(" (%s)", c.Message))
}
}
return sb.String()
}

// 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 ...")
Expand All @@ -100,6 +163,10 @@ func WaitForSystemPods(r cruntime.Manager, bs bootstrapper.Bootstrapper, cfg con
return false, nil
}
glog.Infof("%d kube-system pods found", len(pods.Items))
for _, pod := range pods.Items {
glog.Infof(podStatusMsg(pod))
}

if len(pods.Items) < 2 {
return false, nil
}
Expand Down Expand Up @@ -160,7 +227,7 @@ func APIServerStatus(cr command.Runner, ip net.IP, port int) (state.State, error

pid, err := apiServerPID(cr)
if err != nil {
glog.Warningf("unable to get apiserver pid: %v", err)
glog.Warningf("stopped: unable to get apiserver pid: %v", err)
return state.Stopped, nil
}

Expand Down Expand Up @@ -206,6 +273,7 @@ func apiServerHealthz(ip net.IP, port int) (state.State, error) {
resp, err := client.Get(url)
// Connection refused, usually.
if err != nil {
glog.Infof("stopped: %s: %v", url, err)
return state.Stopped, nil
}
if resp.StatusCode == http.StatusUnauthorized {
Expand Down
Loading

0 comments on commit 376271a

Please sign in to comment.