Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround for too large RV error #1004

Open
wants to merge 1 commit into
base: kmr2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions pkg/controller/rdconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"context"
"os"
"reflect"
"strings"

rdConfigv1 "github.com/noironetworks/aci-containers/pkg/rdconfig/apis/aci.snat/v1"
rdconfigclset "github.com/noironetworks/aci-containers/pkg/rdconfig/clientset/versioned"
Expand All @@ -41,15 +42,33 @@ func (cont *AciController) initRdConfigInformerFromClient(
&cache.ListWatch{
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
options.FieldSelector = fields.Set{"metadata.name": name}.String()
obj, err := rdConfigClient.AciV1().RdConfigs(ns).List(context.TODO(), options)
var obj runtime.Object
var err error
for {
obj, err = rdConfigClient.AciV1().RdConfigs(ns).List(context.TODO(), options)
if err != nil && strings.Contains(err.Error(), "Too large resource version") {
cont.log.Error("Failed to list RdConfigs during initialization of RdConfigInformer with err: ", err.Error(), " Retrying")
continue
}
break
}
if err != nil {
cont.log.Fatalf("Failed to list RdConfigs during initialization of RdConfigInformer with err: %v", err)
}
return obj, err
},
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
options.FieldSelector = fields.Set{"metadata.name": name}.String()
obj, err := rdConfigClient.AciV1().RdConfigs(ns).Watch(context.TODO(), options)
var obj watch.Interface
var err error
for {
obj, err = rdConfigClient.AciV1().RdConfigs(ns).Watch(context.TODO(), options)
if err != nil && strings.Contains(err.Error(), "Too large resource version") {
cont.log.Error("Failed to watch RdConfigs during initialization RdConfigsInformer with err: ", err.Error(), " Retrying")
continue
}
break
}
if err != nil {
cont.log.Fatalf("Failed to watch RdConfigs during initialization RdConfigsInformer with err: %v", err)
}
Expand Down
45 changes: 41 additions & 4 deletions pkg/controller/snatglobalinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"net"
"reflect"
"strconv"
"strings"

uuid "github.com/google/uuid"
nodeinfo "github.com/noironetworks/aci-containers/pkg/nodeinfo/apis/aci.snat/v1"
Expand All @@ -43,14 +44,32 @@ func (cont *AciController) initSnatNodeInformerFromClient(
cont.initSnatNodeInformerBase(
&cache.ListWatch{
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
obj, err := snatClient.AciV1().NodeInfos(metav1.NamespaceAll).List(context.TODO(), options)
var obj runtime.Object
var err error
for {
obj, err = snatClient.AciV1().NodeInfos(metav1.NamespaceAll).List(context.TODO(), options)
if err != nil && strings.Contains(err.Error(), "Too large resource version") {
cont.log.Error("Failed to list NodeInfos during initialization of SnatNodeInformer :", err.Error(), " Retrying")
continue
}
break
}
if err != nil {
cont.log.Fatal("Failed to list NodeInfos during initialization of SnatNodeInformer")
}
return obj, err
},
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
obj, err := snatClient.AciV1().NodeInfos(metav1.NamespaceAll).Watch(context.TODO(), options)
var obj watch.Interface
var err error
for {
obj, err = snatClient.AciV1().NodeInfos(metav1.NamespaceAll).Watch(context.TODO(), options)
if err != nil && strings.Contains(err.Error(), "Too large resource version") {
cont.log.Error("Failed to watch NodeInfos during initialization SnatNodeInformer: ", err.Error(), " Retrying")
continue
}
break
}
if err != nil {
cont.log.Fatal("Failed to watch NodeInfos during initialization SnatNodeInformer")
}
Expand Down Expand Up @@ -86,7 +105,16 @@ func (cont *AciController) initSnatCfgFromClient(
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
options.FieldSelector =
fields.Set{"metadata.name": "snat-operator-config"}.String()
obj, err := kubeClient.CoreV1().ConfigMaps("aci-containers-system").List(context.TODO(), options)
var obj runtime.Object
var err error
for {
obj, err = kubeClient.CoreV1().ConfigMaps("aci-containers-system").List(context.TODO(), options)
if err != nil && strings.Contains(err.Error(), "Too large resource version") {
cont.log.Error("Failed to list ConfigMap during initialization of SnatCfg :", err.Error(), " Retrying")
continue
}
break
}
if err != nil {
cont.log.Fatal("Failed to list ConfigMap during initialization of SnatCfg")
}
Expand All @@ -95,7 +123,16 @@ func (cont *AciController) initSnatCfgFromClient(
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
options.FieldSelector =
fields.Set{"metadata.name": "snat-operator-config"}.String()
obj, err := kubeClient.CoreV1().ConfigMaps("aci-containers-system").Watch(context.TODO(), options)
var obj watch.Interface
var err error
for {
obj, err = kubeClient.CoreV1().ConfigMaps("aci-containers-system").Watch(context.TODO(), options)
if err != nil && strings.Contains(err.Error(), "Too large resource version") {
cont.log.Error("Failed to watch NodeInfos during initialization SnatNodeInformer: ", err.Error(), " Retrying")
continue
}
break
}
if err != nil {
cont.log.Fatal("Failed to watch NodeInfos during initialization SnatNodeInformer")
}
Expand Down
22 changes: 20 additions & 2 deletions pkg/hostagent/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,16 @@ func (agent *HostAgent) initNodeInformerFromClient(
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
options.FieldSelector =
fields.Set{"metadata.name": agent.config.NodeName}.String()
obj, err := kubeClient.CoreV1().Nodes().List(context.TODO(), options)
var obj runtime.Object
var err error
for {
obj, err = kubeClient.CoreV1().Nodes().List(context.TODO(), options)
if err != nil && strings.Contains(err.Error(), "Too large resource version") {
agent.log.Error("Failed to list Nodes during initialization of NodeInformer: ", err.Error(), " Retrying")
continue
}
break
}
if err != nil {
agent.log.Fatalf("Failed to list Nodes during initialization of NodeInformer: %s", err)
}
Expand All @@ -62,7 +71,16 @@ func (agent *HostAgent) initNodeInformerFromClient(
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
options.FieldSelector =
fields.Set{"metadata.name": agent.config.NodeName}.String()
obj, err := kubeClient.CoreV1().Nodes().Watch(context.TODO(), options)
var obj watch.Interface
var err error
for {
obj, err = kubeClient.CoreV1().Nodes().Watch(context.TODO(), options)
if err != nil && strings.Contains(err.Error(), "Too large resource version") {
agent.log.Error("Failed to watch Nodes during initialization of NodeInformer: ", err.Error(), " Retrying")
continue
}
break
}
if err != nil {
agent.log.Fatalf("Failed to watch Nodes during initialization of NodeInformer: %s", err)
}
Expand Down
44 changes: 40 additions & 4 deletions pkg/hostagent/pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,16 @@ func (agent *HostAgent) initPodInformerFromClient(
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
options.FieldSelector =
fields.Set{"spec.nodeName": agent.config.NodeName}.String()
obj, err := kubeClient.CoreV1().Pods(metav1.NamespaceAll).List(context.TODO(), options)
var obj runtime.Object
var err error
for {
obj, err = kubeClient.CoreV1().Pods(metav1.NamespaceAll).List(context.TODO(), options)
if err != nil && strings.Contains(err.Error(), "Too large resource version") {
agent.log.Error("Failed to list Pods during initialization of PodInformer: ", err.Error(), " Retrying")
continue
}
break
}
if err != nil {
agent.log.Fatal("Failed to list Pods during initialization of PodInformer")
}
Expand All @@ -217,7 +226,16 @@ func (agent *HostAgent) initPodInformerFromClient(
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
options.FieldSelector =
fields.Set{"spec.nodeName": agent.config.NodeName}.String()
obj, err := kubeClient.CoreV1().Pods(metav1.NamespaceAll).Watch(context.TODO(), options)
var obj watch.Interface
var err error
for {
obj, err = kubeClient.CoreV1().Pods(metav1.NamespaceAll).Watch(context.TODO(), options)
if err != nil && strings.Contains(err.Error(), "Too large resource version") {
agent.log.Error("Failed to watch Pods during initialization of PodInformer: ", err.Error(), " Retrying")
continue
}
break
}
if err != nil {
agent.log.Fatal("Failed to watch Pods during initialization of PodInformer")
}
Expand All @@ -230,7 +248,16 @@ func (agent *HostAgent) initPodInformerFromClient(
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
options.LabelSelector = labels.Set{"name": "aci-containers-controller"}.String()
//options.LabelSelector = "name=aci-containers-controller"
obj, err := kubeClient.CoreV1().Pods(metav1.NamespaceAll).List(context.TODO(), options)
var obj runtime.Object
var err error
for {
obj, err = kubeClient.CoreV1().Pods(metav1.NamespaceAll).List(context.TODO(), options)
if err != nil && strings.Contains(err.Error(), "Too large resource version") {
agent.log.Error("Failed to list Pods during initialization of ControllerInformer: ", err.Error(), " Retrying")
continue
}
break
}
if err != nil {
agent.log.Fatal("Failed to list Pods during initialization of ControllerInformer")
}
Expand All @@ -239,7 +266,16 @@ func (agent *HostAgent) initPodInformerFromClient(
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
options.LabelSelector = labels.Set{"name": "aci-containers-controller"}.String()
//options.LabelSelector = "name=aci-containers-controller"
obj, err := kubeClient.CoreV1().Pods(metav1.NamespaceAll).Watch(context.TODO(), options)
var obj watch.Interface
var err error
for {
obj, err = kubeClient.CoreV1().Pods(metav1.NamespaceAll).Watch(context.TODO(), options)
if err != nil && strings.Contains(err.Error(), "Too large resource version") {
agent.log.Error("Failed to watch Pods during initialization of ControllerInformer: ", err.Error(), " Retrying")
continue
}
break
}
if err != nil {
agent.log.Fatal("Failed to watch Pods during initialization of ControllerInformer")
}
Expand Down
23 changes: 21 additions & 2 deletions pkg/hostagent/rdconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"os"
"path/filepath"
"reflect"
"strings"

rdConfig "github.com/noironetworks/aci-containers/pkg/rdconfig/apis/aci.snat/v1"
rdConClSet "github.com/noironetworks/aci-containers/pkg/rdconfig/clientset/versioned"
Expand All @@ -44,14 +45,32 @@ func (agent *HostAgent) initRdConfigInformerFromClient(
agent.initRdConfigInformerBase(
&cache.ListWatch{
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
obj, err := rdConClient.AciV1().RdConfigs(metav1.NamespaceAll).List(context.TODO(), options)
var obj runtime.Object
var err error
for {
obj, err = rdConClient.AciV1().RdConfigs(metav1.NamespaceAll).List(context.TODO(), options)
if err != nil && strings.Contains(err.Error(), "Too large resource version") {
agent.log.Error("Failed to list RdConfigs during initialization of RdConfigInformer :", err.Error(), " Retrying")
continue
}
break
}
if err != nil {
agent.log.Fatalf("Failed to list RdConfigs during initialization of RdConfigInformer")
}
return obj, err
},
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
obj, err := rdConClient.AciV1().RdConfigs(metav1.NamespaceAll).Watch(context.TODO(), options)
var obj watch.Interface
var err error
for {
obj, err = rdConClient.AciV1().RdConfigs(metav1.NamespaceAll).Watch(context.TODO(), options)
if err != nil && strings.Contains(err.Error(), "Too large resource version") {
agent.log.Error("Failed to watch RdConfigs during initialization of RdConfigInformer: ", err.Error(), " Retrying")
continue
}
break
}
if err != nil {
agent.log.Fatalf("Failed to watch RdConfigs during initialization of RdConfigInformer")
}
Expand Down
66 changes: 60 additions & 6 deletions pkg/hostagent/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,32 @@ func (agent *HostAgent) initEndpointsInformerFromClient(
agent.initEndpointsInformerBase(
&cache.ListWatch{
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
obj, err := kubeClient.CoreV1().Endpoints(metav1.NamespaceAll).List(context.TODO(), options)
var obj runtime.Object
var err error
for {
obj, err = kubeClient.CoreV1().Endpoints(metav1.NamespaceAll).List(context.TODO(), options)
if err != nil && strings.Contains(err.Error(), "Too large resource version") {
agent.log.Error("Failed to list Endpoints during initialization of EndpointsInformer :", err.Error(), " Retrying")
continue
}
break
}
if err != nil {
agent.log.Fatalf("Failed to list Endpoints during initialization of EndpointsInformer: %s", err)
}
return obj, err
},
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
obj, err := kubeClient.CoreV1().Endpoints(metav1.NamespaceAll).Watch(context.TODO(), options)
var obj watch.Interface
var err error
for {
obj, err = kubeClient.CoreV1().Endpoints(metav1.NamespaceAll).Watch(context.TODO(), options)
if err != nil && strings.Contains(err.Error(), "Too large resource version") {
agent.log.Error("Failed to watch Endpoints during initialization of EndpointsInformer: ", err.Error(), " Retrying")
continue
}
break
}
if err != nil {
agent.log.Fatalf("Failed to watch Endpoints during initialization of EndpointsInformer: %s", err)
}
Expand Down Expand Up @@ -164,14 +182,32 @@ func (agent *HostAgent) initEndpointSliceInformerFromClient(
agent.initEndpointSliceInformerBase(
&cache.ListWatch{
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
obj, err := kubeClient.DiscoveryV1beta1().EndpointSlices(metav1.NamespaceAll).List(context.TODO(), options)
var obj runtime.Object
var err error
for {
obj, err = kubeClient.DiscoveryV1beta1().EndpointSlices(metav1.NamespaceAll).List(context.TODO(), options)
if err != nil && strings.Contains(err.Error(), "Too large resource version") {
agent.log.Error("Failed to list EndpointSlices during initialization of EndpointSliceInformer :", err.Error(), " Retrying")
continue
}
break
}
if err != nil {
agent.log.Fatalf("Failed to list EndpointSlices during initialization of EndpointSliceInformer: %s", err)
}
return obj, err
},
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
obj, err := kubeClient.DiscoveryV1beta1().EndpointSlices(metav1.NamespaceAll).Watch(context.TODO(), options)
var obj watch.Interface
var err error
for {
obj, err = kubeClient.DiscoveryV1beta1().EndpointSlices(metav1.NamespaceAll).Watch(context.TODO(), options)
if err != nil && strings.Contains(err.Error(), "Too large resource version") {
agent.log.Error("Failed to watch EndpointSlices during initialization of EndpointSliceInformer: ", err.Error(), " Retrying")
continue
}
break
}
if err != nil {
agent.log.Fatalf("Failed to watch EndpointSlices during initialization of EndpointSliceInformer: %s", err)
}
Expand Down Expand Up @@ -205,14 +241,32 @@ func (agent *HostAgent) initServiceInformerFromClient(
agent.initServiceInformerBase(
&cache.ListWatch{
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
obj, err := kubeClient.CoreV1().Services(metav1.NamespaceAll).List(context.TODO(), options)
var obj runtime.Object
var err error
for {
obj, err = kubeClient.CoreV1().Services(metav1.NamespaceAll).List(context.TODO(), options)
if err != nil && strings.Contains(err.Error(), "Too large resource version") {
agent.log.Error("Failed to list Services during initialization of ServiceInformer :", err.Error(), " Retrying")
continue
}
break
}
if err != nil {
agent.log.Fatalf("Failed to list Services during initialization of ServiceInformer: %s", err)
}
return obj, err
},
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
obj, err := kubeClient.CoreV1().Services(metav1.NamespaceAll).Watch(context.TODO(), options)
var obj watch.Interface
var err error
for {
obj, err = kubeClient.CoreV1().Services(metav1.NamespaceAll).Watch(context.TODO(), options)
if err != nil && strings.Contains(err.Error(), "Too large resource version") {
agent.log.Error("Failed to watch Services during initialization of ServiceInformer: ", err.Error(), " Retrying")
continue
}
break
}
if err != nil {
agent.log.Fatalf("Failed to watch Services during initialization of ServiceInformer: %s", err)
}
Expand Down
Loading