@@ -16,6 +16,7 @@ import (
1616 "net"
1717 "os"
1818 "strings"
19+ "context"
1920
2021 v1 "k8s.io/api/core/v1"
2122 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -175,7 +176,7 @@ func (me *Me) init() error {
175176// loadPod loads a pod using the downward API.
176177func (me * Me ) loadPod () (* v1.Pod , string , error ) {
177178 ns := NamespaceFromEnv ()
178- p , err := me .c .CoreV1 ().Pods (ns ).Get (me .Name , metav1.GetOptions {})
179+ p , err := me .c .CoreV1 ().Pods (ns ).Get (context . TODO (), me .Name , metav1.GetOptions {})
179180 return p , ns , err
180181}
181182
@@ -189,12 +190,12 @@ func (me *Me) findPodInNamespaces(selector string) (*v1.Pod, string, error) {
189190 // Get the drycc namespace. If it does not exist, get the default namespce.
190191 s , err := labels .Parse (selector )
191192 if err == nil {
192- ns , err := me .c .CoreV1 ().Namespaces ().List (metav1.ListOptions {LabelSelector : s .String ()})
193+ ns , err := me .c .CoreV1 ().Namespaces ().List (context . TODO (), metav1.ListOptions {LabelSelector : s .String ()})
193194 if err != nil {
194195 return nil , "default" , err
195196 }
196197 for _ , n := range ns .Items {
197- p , err := me .c .CoreV1 ().Pods (n .Name ).Get (me .Name , metav1.GetOptions {})
198+ p , err := me .c .CoreV1 ().Pods (n .Name ).Get (context . TODO (), me .Name , metav1.GetOptions {})
198199
199200 // If there is no error, we got a matching pod.
200201 if err == nil {
@@ -204,7 +205,7 @@ func (me *Me) findPodInNamespaces(selector string) (*v1.Pod, string, error) {
204205 }
205206
206207 // If we get here, it's really the last ditch.
207- p , err := me .c .CoreV1 ().Pods ("default" ).Get (me .Name , metav1.GetOptions {})
208+ p , err := me .c .CoreV1 ().Pods ("default" ).Get (context . TODO (), me .Name , metav1.GetOptions {})
208209 return p , "default" , err
209210}
210211
0 commit comments