Skip to content

Commit 376271a

Browse files
committed
Merge branch 'master' into add_desc_node_to_minikube_logs
2 parents ba6dbc5 + ba4e993 commit 376271a

File tree

18 files changed

+446
-188
lines changed

18 files changed

+446
-188
lines changed

.github/workflows/main.yml

+25
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ jobs:
8888
docker info || true
8989
docker version || true
9090
docker ps || true
91+
- name: install lz4
92+
shell: bash
93+
run: |
94+
sudo apt-get update -qq
95+
sudo apt-get -qq -y install liblz4-tool
9196
- name: Install gopogh
9297
shell: bash
9398
run: |
@@ -150,6 +155,11 @@ jobs:
150155
SHELL: "/bin/bash" # To prevent https://github.com/kubernetes/minikube/issues/6643
151156
needs: [build_minikube]
152157
steps:
158+
- name: install lz4
159+
shell: bash
160+
run: |
161+
sudo apt-get update -qq
162+
sudo apt-get -qq -y install liblz4-tool
153163
- name: Docker Info
154164
shell: bash
155165
run: |
@@ -218,6 +228,11 @@ jobs:
218228
SHELL: "/bin/bash" # To prevent https://github.com/kubernetes/minikube/issues/6643
219229
runs-on: ubuntu-16.04
220230
steps:
231+
- name: install lz4
232+
shell: bash
233+
run: |
234+
sudo apt-get update -qq
235+
sudo apt-get -qq -y install liblz4-tool
221236
- name: Install gopogh
222237
shell: bash
223238
run: |
@@ -280,6 +295,11 @@ jobs:
280295
SHELL: "/bin/bash" # To prevent https://github.com/kubernetes/minikube/issues/6643
281296
runs-on: ubuntu-18.04
282297
steps:
298+
- name: install lz4
299+
shell: bash
300+
run: |
301+
sudo apt-get update -qq
302+
sudo apt-get -qq -y install liblz4-tool
283303
- name: Install gopogh
284304
shell: bash
285305
run: |
@@ -342,6 +362,11 @@ jobs:
342362
SHELL: "/bin/bash" # To prevent https://github.com/kubernetes/minikube/issues/6643
343363
runs-on: ubuntu-18.04
344364
steps:
365+
- name: install lz4
366+
shell: bash
367+
run: |
368+
sudo apt-get update -qq
369+
sudo apt-get -qq -y install liblz4-tool
345370
- name: install podman
346371
shell: bash
347372
run: |

cmd/minikube/cmd/service.go

+6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package cmd
1818

1919
import (
20+
"errors"
2021
"fmt"
2122
"net/url"
2223
"os"
@@ -104,6 +105,11 @@ var serviceCmd = &cobra.Command{
104105

105106
urls, err := service.WaitForService(api, namespace, svc, serviceURLTemplate, serviceURLMode, https, wait, interval)
106107
if err != nil {
108+
var s *service.SVCNotFoundError
109+
if errors.As(err, &s) {
110+
exit.WithCodeT(exit.Data, `Service '{{.service}}' was not found in '{{.namespace}}' namespace.
111+
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})
112+
}
107113
exit.WithError("Error opening service", err)
108114
}
109115

deploy/addons/gpu/nvidia-gpu-device-plugin.yaml.tmpl deploy/addons/gpu/nvidia-gpu-device-plugin.yaml

+3-6
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,18 @@ spec:
4646
hostPath:
4747
path: /dev
4848
containers:
49-
- image: "{{default "k8s.gcr.io" .ImageRepository}}/nvidia-gpu-device-plugin@sha256:0842734032018be107fa2490c98156992911e3e1f2a21e059ff0105b07dd8e9e"
50-
command: ["/usr/bin/nvidia-gpu-device-plugin", "-logtostderr"]
49+
- image: "nvidia/k8s-device-plugin:1.0.0-beta4"
50+
command: ["/usr/bin/nvidia-device-plugin", "-logtostderr"]
5151
name: nvidia-gpu-device-plugin
5252
resources:
5353
requests:
5454
cpu: 50m
5555
memory: 10Mi
56-
limits:
57-
cpu: 50m
58-
memory: 10Mi
5956
securityContext:
6057
privileged: true
6158
volumeMounts:
6259
- name: device-plugin
63-
mountPath: /device-plugin
60+
mountPath: /var/lib/kubelet/device-plugins
6461
- name: dev
6562
mountPath: /dev
6663
updateStrategy:

deploy/addons/helm-tiller/helm-tiller-dp.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ spec:
4646
value: kube-system
4747
- name: TILLER_HISTORY_MAX
4848
value: "0"
49-
image: gcr.io/kubernetes-helm/tiller:v2.16.1
49+
image: gcr.io/kubernetes-helm/tiller:v2.16.3
5050
imagePullPolicy: IfNotPresent
5151
livenessProbe:
5252
failureThreshold: 3

hack/kubernetes_version/update_kubernetes_version.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,18 @@ func main() {
5252
}
5353
mode := info.Mode()
5454

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

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

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

66-
testData := "../../pkg/minikube/bootstrapper/kubeadm/testdata"
66+
testData := "../../pkg/minikube/bootstrapper/bsutil/testdata"
6767

6868
err = filepath.Walk(testData, func(path string, info os.FileInfo, err error) error {
6969
if err != nil {

pkg/minikube/assets/addons.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -296,11 +296,11 @@ var Addons = map[string]*Addon{
296296
}, false, "nvidia-driver-installer"),
297297
"nvidia-gpu-device-plugin": NewAddon([]*BinAsset{
298298
MustBinAsset(
299-
"deploy/addons/gpu/nvidia-gpu-device-plugin.yaml.tmpl",
299+
"deploy/addons/gpu/nvidia-gpu-device-plugin.yaml",
300300
vmpath.GuestAddonsDir,
301301
"nvidia-gpu-device-plugin.yaml",
302302
"0640",
303-
true),
303+
false),
304304
}, false, "nvidia-gpu-device-plugin"),
305305
"logviewer": NewAddon([]*BinAsset{
306306
MustBinAsset(

pkg/minikube/bootstrapper/bsutil/binaries.go

+5
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ func TransferBinaries(cfg config.KubernetesConfig, c command.Runner) error {
5050
return err
5151
}
5252

53+
// stop kubelet to avoid "Text File Busy" error
54+
if _, err := c.RunCmd(exec.Command("/bin/bash", "-c", "pgrep kubelet && sudo systemctl stop kubelet")); err != nil {
55+
glog.Warningf("unable to stop kubelet: %s", err)
56+
}
57+
5358
var g errgroup.Group
5459
for _, name := range constants.KubernetesReleaseBinaries {
5560
name := name

pkg/minikube/bootstrapper/bsutil/files.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ const (
4040
// ConfigFileAssets returns configuration file assets
4141
func ConfigFileAssets(cfg config.KubernetesConfig, kubeadm []byte, kubelet []byte, kubeletSvc []byte, defaultCNIConfig []byte) []assets.CopyableFile {
4242
fs := []assets.CopyableFile{
43-
assets.NewMemoryAssetTarget(kubeadm, KubeadmYamlPath, "0640"),
44-
assets.NewMemoryAssetTarget(kubelet, KubeletSystemdConfFile, "0644"),
45-
assets.NewMemoryAssetTarget(kubeletSvc, KubeletServiceFile, "0644"),
43+
assets.NewMemoryAssetTarget(kubeadm, KubeadmYamlPath+".new", "0640"),
44+
assets.NewMemoryAssetTarget(kubelet, KubeletSystemdConfFile+".new", "0644"),
45+
assets.NewMemoryAssetTarget(kubeletSvc, KubeletServiceFile+".new", "0644"),
4646
}
4747
// Copy the default CNI config (k8s.conf), so that kubelet can successfully
4848
// start a Pod in the case a user hasn't manually installed any CNI plugin

pkg/minikube/bootstrapper/bsutil/kverify/kverify.go

+69-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030

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

83+
// ExpectedComponentsRunning returns whether or not all expected components are running
84+
func ExpectedComponentsRunning(cs *kubernetes.Clientset) error {
85+
expected := []string{
86+
"kube-dns", // coredns
87+
"etcd",
88+
"kube-apiserver",
89+
"kube-controller-manager",
90+
"kube-proxy",
91+
"kube-scheduler",
92+
}
93+
94+
found := map[string]bool{}
95+
96+
pods, err := cs.CoreV1().Pods("kube-system").List(meta.ListOptions{})
97+
if err != nil {
98+
return err
99+
}
100+
101+
for _, pod := range pods.Items {
102+
glog.Infof("found pod: %s", podStatusMsg(pod))
103+
if pod.Status.Phase != core.PodRunning {
104+
continue
105+
}
106+
for k, v := range pod.ObjectMeta.Labels {
107+
if k == "component" || k == "k8s-app" {
108+
found[v] = true
109+
}
110+
}
111+
}
112+
113+
missing := []string{}
114+
for _, e := range expected {
115+
if !found[e] {
116+
missing = append(missing, e)
117+
}
118+
}
119+
if len(missing) > 0 {
120+
return fmt.Errorf("missing components: %v", strings.Join(missing, ", "))
121+
}
122+
return nil
123+
}
124+
125+
// podStatusMsg returns a human-readable pod status, for generating debug status
126+
func podStatusMsg(pod core.Pod) string {
127+
var sb strings.Builder
128+
sb.WriteString(fmt.Sprintf("%q [%s] %s", pod.ObjectMeta.GetName(), pod.ObjectMeta.GetUID(), pod.Status.Phase))
129+
for i, c := range pod.Status.Conditions {
130+
if c.Reason != "" {
131+
if i == 0 {
132+
sb.WriteString(": ")
133+
} else {
134+
sb.WriteString(" / ")
135+
}
136+
sb.WriteString(fmt.Sprintf("%s:%s", c.Type, c.Reason))
137+
}
138+
if c.Message != "" {
139+
sb.WriteString(fmt.Sprintf(" (%s)", c.Message))
140+
}
141+
}
142+
return sb.String()
143+
}
144+
82145
// WaitForSystemPods verifies essential pods for running kurnetes is running
83146
func WaitForSystemPods(r cruntime.Manager, bs bootstrapper.Bootstrapper, cfg config.ClusterConfig, cr command.Runner, client *kubernetes.Clientset, start time.Time, timeout time.Duration) error {
84147
glog.Info("waiting for kube-system pods to appear ...")
@@ -100,6 +163,10 @@ func WaitForSystemPods(r cruntime.Manager, bs bootstrapper.Bootstrapper, cfg con
100163
return false, nil
101164
}
102165
glog.Infof("%d kube-system pods found", len(pods.Items))
166+
for _, pod := range pods.Items {
167+
glog.Infof(podStatusMsg(pod))
168+
}
169+
103170
if len(pods.Items) < 2 {
104171
return false, nil
105172
}
@@ -160,7 +227,7 @@ func APIServerStatus(cr command.Runner, ip net.IP, port int) (state.State, error
160227

161228
pid, err := apiServerPID(cr)
162229
if err != nil {
163-
glog.Warningf("unable to get apiserver pid: %v", err)
230+
glog.Warningf("stopped: unable to get apiserver pid: %v", err)
164231
return state.Stopped, nil
165232
}
166233

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

0 commit comments

Comments
 (0)