This repository has been archived by the owner on Mar 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 238
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use IndexerInformer rather than controller and queue (#51)
This helps to simplify the implementation of the pod and namespace caches, as well as better handling errors from `cache.DeletedFinalStateUnknown` identified in #46 and more.
- Loading branch information
Showing
8 changed files
with
247 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package k8s | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/fields" | ||
"k8s.io/client-go/kubernetes" | ||
"k8s.io/client-go/tools/cache" | ||
) | ||
|
||
const ( | ||
// ResourcePods are Pod resources | ||
ResourcePods = "pods" | ||
// ResourceNamespaces are Namespace resources | ||
ResourceNamespaces = "namespaces" | ||
) | ||
|
||
// NewListWatch creates a ListWatch for the specified Resource | ||
func NewListWatch(client *kubernetes.Clientset, resource string) *cache.ListWatch { | ||
return cache.NewListWatchFromClient(client.Core().RESTClient(), resource, "", fields.Everything()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.