Skip to content

Commit e1af3e9

Browse files
committed
Fix issue with CircleCI build.
The issue was that the Clientset struct, which contains the CoreV1() method, was embedded directly in the Client struct. While this works in some Go versions, it seems the CircleCI environment's Go version requires explicit access to the embedded struct. I've updated the code to use k8s.Clientset.CoreV1() to explicitly access the CoreV1() method through the embedded Clientset. This should resolve the build and test failures in CircleCI.
1 parent 2d77aaa commit e1af3e9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

k8s/k8s.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func (k8s *Client) createPodLW() *cache.ListWatch {
3737
if k8s.nodeName != "" {
3838
fieldSelector = selector.OneTermEqualSelector("spec.nodeName", k8s.nodeName)
3939
}
40-
return cache.NewListWatchFromClient(k8s.CoreV1().RESTClient(), "pods", v1.NamespaceAll, fieldSelector)
40+
return cache.NewListWatchFromClient(k8s.Clientset.CoreV1().RESTClient(), "pods", v1.NamespaceAll, fieldSelector)
4141
}
4242

4343
// WatchForPods watches for pod changes.
@@ -55,7 +55,7 @@ func (k8s *Client) WatchForPods(podEventLogger cache.ResourceEventHandler, resyn
5555

5656
// returns a cache.ListWatch of namespaces.
5757
func (k8s *Client) createNamespaceLW() *cache.ListWatch {
58-
return cache.NewListWatchFromClient(k8s.CoreV1().RESTClient(), "namespaces", v1.NamespaceAll, selector.Everything())
58+
return cache.NewListWatchFromClient(k8s.Clientset.CoreV1().RESTClient(), "namespaces", v1.NamespaceAll, selector.Everything())
5959
}
6060

6161
// WatchForNamespaces watches for namespaces changes.
@@ -120,7 +120,7 @@ func (k8s *Client) PodByIP(IP string) (*v1.Pod, error) {
120120
// If the indexed pods all have HostNetwork = true the function return nil and the error message.
121121
// If we retrive a running pod that doesn't have HostNetwork = true and it is in Running state will return that.
122122
func resolveDuplicatedIP(k8s *Client, IP string) (*v1.Pod, error) {
123-
runningPodList, err := k8s.CoreV1().Pods("").List(metav1.ListOptions{
123+
runningPodList, err := k8s.Clientset.CoreV1().Pods("").List(metav1.ListOptions{
124124
FieldSelector: selector.OneTermEqualSelector("status.podIP", IP).String(),
125125
})
126126
metrics.K8sAPIDupReqCount.Inc()

0 commit comments

Comments
 (0)