Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stevencyb/genkube
A simple kube client wrapper.
https://github.com/stevencyb/genkube
Last synced: 28 days ago
JSON representation
A simple kube client wrapper.
- Host: GitHub
- URL: https://github.com/stevencyb/genkube
- Owner: StevenCyb
- Created: 2023-05-23T22:22:49.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-09T19:21:39.000Z (about 1 year ago)
- Last Synced: 2023-12-09T20:27:58.361Z (about 1 year ago)
- Language: Go
- Homepage:
- Size: 31.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# genkube
This is a simple wrapper client that inherit the `sigs.k8s.io/controller-runtime/pkg/client` client and adds some logic around it like watching any resource (including CRDs).## Functions
The following functions are provided by the client.
Most of them are part of the original client from *sigs.k8s.io* (including description).```go
// Get retrieves an obj for the given object key from the Kubernetes Cluster.
// obj must be a struct pointer so that obj can be updated with the response
// returned by the Server.
Get(ctx context.Context, key ObjectKey, obj Object, opts ...GetOption) error
``````go
// List retrieves list of objects for a given namespace and list options. On a
// successful call, Items field in the list will be populated with the
// result returned from the server.
List(ctx context.Context, list ObjectList, opts ...ListOption) error
``````go
// Create saves the object obj in the Kubernetes cluster. obj must be a
// struct pointer so that obj can be updated with the content returned by the Server.
Create(ctx context.Context, obj Object, opts ...CreateOption) error
``````go
// Delete deletes the given obj from Kubernetes cluster.
Delete(ctx context.Context, obj Object, opts ...DeleteOption) error
``````go
// Update updates the given obj in the Kubernetes cluster. obj must be a
// struct pointer so that obj can be updated with the content returned by the Server.
Update(ctx context.Context, obj Object, opts ...UpdateOption) error
``````go
// Patch patches the given obj in the Kubernetes cluster. obj must be a
// struct pointer so that obj can be updated with the content returned by the Server.
Patch(ctx context.Context, obj Object, patch Patch, opts ...PatchOption) error
``````go
// DeleteAllOf deletes all objects of the given type matching the given options.
DeleteAllOf(ctx context.Context, obj Object, opts ...DeleteAllOfOption) error
``````go
// WatchResource watches a resource based on given objects lists.
func (c *Client) WatchResource(
resource runtime.Object, resourceList runtimeClient.ObjectList,
eventHandler cache.ResourceEventHandlerFuncs, opts ...runtimeClient.ListOption,
)
```## Fake
To perform unit tests without an actual cluster, use the `NewFake` function to create a fake client.
This client can be used to interact with the client like on an real cluster.