File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,10 @@ func main() {
4646 }
4747}
4848
49+ type ctxKey string
50+
51+ var kubeClientKey = ctxKey ("klient" )
52+
4953func rootCmd () * cobra.Command {
5054 kflags := genericclioptions .NewConfigFlags (true )
5155
@@ -71,7 +75,7 @@ You can also list nodes for a given node pool/group by name.`,
7175 return err
7276 }
7377
74- ctx = context .WithValue (ctx , "klient" , klient )
78+ ctx = context .WithValue (ctx , kubeClientKey , klient )
7579
7680 cmd .SetContext (ctx )
7781
@@ -148,7 +152,7 @@ func listCmd() *cobra.Command {
148152 RunE : func (cmd * cobra.Command , args []string ) error {
149153 ctx := cmd .Context ()
150154
151- klient := ctx .Value ("klient" ).(kubernetes.Interface )
155+ klient := ctx .Value (kubeClientKey ).(kubernetes.Interface )
152156
153157 res , err := klient .CoreV1 ().Nodes ().List (ctx , metav1.ListOptions {})
154158 if err != nil {
@@ -222,7 +226,7 @@ func nodesCmd() *cobra.Command {
222226
223227 ctx := cmd .Context ()
224228
225- klient := ctx .Value ("klient" ).(kubernetes.Interface )
229+ klient := ctx .Value (kubeClientKey ).(kubernetes.Interface )
226230
227231 res , err := klient .CoreV1 ().Nodes ().List (ctx , metav1.ListOptions {})
228232 if err != nil {
You can’t perform that action at this time.
0 commit comments