@@ -28,9 +28,11 @@ import (
28
28
"k8s.io/minikube/pkg/minikube/cruntime"
29
29
"k8s.io/minikube/pkg/minikube/driver"
30
30
"k8s.io/minikube/pkg/minikube/exit"
31
+ "k8s.io/minikube/pkg/minikube/localpath"
31
32
"k8s.io/minikube/pkg/minikube/machine"
32
33
"k8s.io/minikube/pkg/minikube/mustload"
33
34
"k8s.io/minikube/pkg/minikube/out"
35
+ "k8s.io/minikube/pkg/minikube/out/register"
34
36
)
35
37
36
38
var (
@@ -47,8 +49,27 @@ var pauseCmd = &cobra.Command{
47
49
48
50
func runPause (cmd * cobra.Command , args []string ) {
49
51
co := mustload .Running (ClusterFlagValue ())
52
+ register .SetEventLogPath (localpath .EventLog (ClusterFlagValue ()))
53
+ register .Reg .SetStep (register .Pausing )
54
+
55
+ glog .Infof ("namespaces: %v keys: %v" , namespaces , viper .AllSettings ())
56
+ if allNamespaces {
57
+ namespaces = nil //all
58
+ } else if len (namespaces ) == 0 {
59
+ exit .WithCodeT (exit .BadUsage , "Use -A to specify all namespaces" )
60
+ }
61
+
62
+ ids := []string {}
50
63
51
64
for _ , n := range co .Config .Nodes {
65
+ // Use node-name if available, falling back to cluster name
66
+ name := n .Name
67
+ if n .Name == "" {
68
+ name = co .Config .Name
69
+ }
70
+
71
+ out .T (out .Pause , "Pausing node {{.name}} ... " , out.V {"name" : name })
72
+
52
73
host , err := machine .LoadHost (co .API , driver .MachineName (* co .Config , n ))
53
74
if err != nil {
54
75
exit .WithError ("Error getting host" , err )
@@ -64,23 +85,18 @@ func runPause(cmd *cobra.Command, args []string) {
64
85
exit .WithError ("Failed runtime" , err )
65
86
}
66
87
67
- glog .Infof ("namespaces: %v keys: %v" , namespaces , viper .AllSettings ())
68
- if allNamespaces {
69
- namespaces = nil //all
70
- } else if len (namespaces ) == 0 {
71
- exit .WithCodeT (exit .BadUsage , "Use -A to specify all namespaces" )
72
- }
73
-
74
- ids , err := cluster .Pause (cr , r , namespaces )
88
+ uids , err := cluster .Pause (cr , r , namespaces )
75
89
if err != nil {
76
90
exit .WithError ("Pause" , err )
77
91
}
92
+ ids = append (ids , uids ... )
93
+ }
78
94
79
- if namespaces == nil {
80
- out . T ( out . Unpause , "Paused kubelet and {{.count}} containers" , out. V { "count" : len ( ids )})
81
- } else {
82
- out . T ( out . Unpause , "Paused kubelet and {{.count}} containers in: {{.namespaces}}" , out. V { "count" : len ( ids ), "namespaces" : strings . Join ( namespaces , ", " )})
83
- }
95
+ register . Reg . SetStep ( register . Done )
96
+ if namespaces == nil {
97
+ out . T ( out . Unpause , "Paused {{.count}} containers" , out. V { "count" : len ( ids )})
98
+ } else {
99
+ out . T ( out . Unpause , "Paused {{.count}} containers in: {{.namespaces}}" , out. V { "count" : len ( ids ), "namespaces" : strings . Join ( namespaces , ", " )})
84
100
}
85
101
}
86
102
0 commit comments