From 2109abb317b3b9a826e41fe65901abd7f4774bbc Mon Sep 17 00:00:00 2001 From: Lalatendu Das Date: Mon, 17 Jun 2024 18:13:08 +0000 Subject: [PATCH] vendor stork master to kdmp master Signed-off-by: Lalatendu Das --- go.mod | 2 +- go.sum | 4 +-- .../libopenstorage/stork/pkg/cache/cache.go | 27 +++++++++++++++++++ .../libopenstorage/stork/pkg/utils/utils.go | 2 -- vendor/modules.txt | 2 +- 5 files changed, 31 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 52dd00b2..06144ec8 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/hashicorp/go-version v1.6.0 github.com/kubernetes-csi/external-snapshotter/client/v4 v4.2.0 github.com/kubernetes-incubator/external-storage v0.20.4-openstorage-rc7 - github.com/libopenstorage/stork v1.4.1-0.20240616131748-2d789e95dcdb + github.com/libopenstorage/stork v1.4.1-0.20240617152950-2e3df62da9ae github.com/portworx/pxc v0.33.0 github.com/portworx/sched-ops v1.20.4-rc1.0.20240514213912-ff0ae32b859a github.com/sirupsen/logrus v1.9.3 diff --git a/go.sum b/go.sum index 93e21637..6f910917 100644 --- a/go.sum +++ b/go.sum @@ -3394,8 +3394,8 @@ github.com/libopenstorage/stork v1.4.1-0.20230502135851-9cacb19e1df5/go.mod h1:R github.com/libopenstorage/stork v1.4.1-0.20230519043154-cbc10dffaf19/go.mod h1:Xm4DHoViynFXMQKBXGj3IkA77LY2RBFkNtv6vbo3wNw= github.com/libopenstorage/stork v1.4.1-0.20230601053837-5dd68f026569/go.mod h1:+mKPMCPNhS/XOF2RPcNFijkr67CCCWp0o8OXVG6xxAk= github.com/libopenstorage/stork v1.4.1-0.20230610103146-72cf75320066/go.mod h1:Yst+fnOYjWk6SA5pXZBKm19wtiinjxQ/vgYTXI3k80Q= -github.com/libopenstorage/stork v1.4.1-0.20240616131748-2d789e95dcdb h1:E52CQ1QuyZBImL7ZJcaJs5rU4Ct1bxngkxEWd4Boktw= -github.com/libopenstorage/stork v1.4.1-0.20240616131748-2d789e95dcdb/go.mod h1:FF7ZKeSzmT8T92/xOhLEmrdMP6hiL+SbSOcNQoMg4tA= +github.com/libopenstorage/stork v1.4.1-0.20240617152950-2e3df62da9ae h1:6V1aphPC8/JDo7PKCS+Y0dShjMKx7Ky6OtKOAfj9Zww= +github.com/libopenstorage/stork v1.4.1-0.20240617152950-2e3df62da9ae/go.mod h1:4n6M9LolJA2u4uB8Cd3YvQFhe0jYEweHLW/EZvECCyE= github.com/libopenstorage/systemutils v0.0.0-20160208220149-44ac83be3ce1/go.mod h1:xwNGC7xiz/BQ/wbMkvHujL8Gjgseg+x41xMek7sKRRQ= github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de h1:9TO3cAIGXtEhnIaL+V+BEER86oLrvS+kWobKpbJuye0= github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de/go.mod h1:zAbeS9B/r2mtpb6U+EI2rYA5OAXxsYw6wTamcNW+zcE= diff --git a/vendor/github.com/libopenstorage/stork/pkg/cache/cache.go b/vendor/github.com/libopenstorage/stork/pkg/cache/cache.go index 41a0c679..7ac3747b 100644 --- a/vendor/github.com/libopenstorage/stork/pkg/cache/cache.go +++ b/vendor/github.com/libopenstorage/stork/pkg/cache/cache.go @@ -6,9 +6,11 @@ import ( "sync" storkv1alpha1 "github.com/libopenstorage/stork/pkg/apis/stork/v1alpha1" + "github.com/sirupsen/logrus" corev1 "k8s.io/api/core/v1" storagev1 "k8s.io/api/storage/v1" "k8s.io/client-go/rest" + clientCache "k8s.io/client-go/tools/cache" controllercache "sigs.k8s.io/controller-runtime/pkg/cache" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/manager" @@ -36,6 +38,9 @@ type SharedInformerCache interface { // ListTransformedPods lists the all the Pods from the cache after applying TransformFunc ListTransformedPods() (*corev1.PodList, error) + + // WatchPods registers the pod event handlers with the informer cache + WatchPods(fn func(object interface{})) error } type cache struct { @@ -84,6 +89,8 @@ func CreateSharedInformerCache(mgr manager.Manager) error { } } + currPod.ObjectMeta.DeletionTimestamp = podResource.ObjectMeta.DeletionTimestamp + currPod.Spec.Containers = podResource.Spec.Containers currPod.Spec.NodeName = podResource.Spec.NodeName @@ -204,3 +211,23 @@ func (c *cache) ListTransformedPods() (*corev1.PodList, error) { } return podList, nil } + +// WatchPods uses handlers for different pod events with shared informers. +func (c *cache) WatchPods(fn func(object interface{})) error { + informer, err := c.controllerCache.GetInformer(context.Background(), &corev1.Pod{}) + if err != nil { + logrus.WithError(err).Error("error getting the informer for pods") + return err + } + + informer.AddEventHandler(clientCache.ResourceEventHandlerFuncs{ + AddFunc: fn, + UpdateFunc: func(oldObj, newObj interface{}) { + // Only considering the new pod object + fn(newObj) + }, + DeleteFunc: fn, + }) + + return nil +} diff --git a/vendor/github.com/libopenstorage/stork/pkg/utils/utils.go b/vendor/github.com/libopenstorage/stork/pkg/utils/utils.go index 9cadfc89..a0b3f083 100644 --- a/vendor/github.com/libopenstorage/stork/pkg/utils/utils.go +++ b/vendor/github.com/libopenstorage/stork/pkg/utils/utils.go @@ -110,8 +110,6 @@ const ( // PXServiceName is the name of the portworx service in kubernetes PXServiceName = "portworx-service" VMRestoreIncludeResourceMapAnnotation = "stork.libopenstorage.org/vm-includeresource" - // podSecurityStandardEnforceMode - which PS standard to enforce while deploying the k8s workload Object - podSecurityStandardEnforceMode = "pod-security.kubernetes.io/enforce" //undefined UID or GID UndefinedId = int64(-1) PsaUIDKey = "portworx.io/psa-uid" diff --git a/vendor/modules.txt b/vendor/modules.txt index 8269d29b..94d5bce5 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -505,7 +505,7 @@ github.com/libopenstorage/openstorage-sdk-clients/sdk/golang github.com/libopenstorage/secrets github.com/libopenstorage/secrets/aws/credentials github.com/libopenstorage/secrets/k8s -# github.com/libopenstorage/stork v1.4.1-0.20240616131748-2d789e95dcdb +# github.com/libopenstorage/stork v1.4.1-0.20240617152950-2e3df62da9ae ## explicit; go 1.21 github.com/libopenstorage/stork/drivers github.com/libopenstorage/stork/drivers/volume