k8s

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTimeout = 1 * time.Minute

DefaultTimeout is a reasonable timeout to use with the Client.

View Source
const (
	// HarborClusterNameLabel contains the harbor cluster name of the cr.
	HarborClusterNameLabel = "goharbor.io/harbor-cluster"
)

Variables

This section is empty.

Functions

func ExternalConfig

func ExternalConfig() (*rest.Config, error)

ExternalConfig returns a config object which uses the service account kubernetes gives to pods.

func HomeDir

func HomeDir() string

HomeDir returns home dir

func NewDynamicClient

func NewDynamicClient() (dynamic.Interface, error)

NewDynamicClient returns the dynamic interface.

Types

type Client

type Client interface {
	// WithContext returns a client configured to use the provided context on
	// subsequent requests, instead of one created from the preconfigured timeout.
	WithContext(ctx context.Context) Client

	// Get wraps a controller-runtime client.Get call with a context.
	Get(key client.ObjectKey, obj runtime.Object) error
	// List wraps a controller-runtime client.List call with a context.
	List(opts *client.ListOptions, list runtime.Object) error
	// Create wraps a controller-runtime client.Create call with a context.
	Create(obj runtime.Object) error
	// Delete wraps a controller-runtime client.Delete call with a context.
	Delete(obj runtime.Object, opts ...client.DeleteOption) error
	// Update wraps a controller-runtime client.Update call with a context.
	Update(obj runtime.Object) error
}

Client wraps a controller-runtime client to use a default context with a timeout if no context is passed.

func WrapClient

func WrapClient(ctx context.Context, client client.Client) Client

WrapClient returns a Client that performs requests within DefaultTimeout.

type ClusterClient

type ClusterClient struct {
	// contains filtered or unexported fields
}

func (*ClusterClient) Create

func (w *ClusterClient) Create(obj runtime.Object) error

Create wraps a controller-runtime client.Create call with a context.

func (*ClusterClient) Delete

func (w *ClusterClient) Delete(obj runtime.Object, opts ...client.DeleteOption) error

Delete wraps a controller-runtime client.Delete call with a context.

func (*ClusterClient) Get

func (w *ClusterClient) Get(key client.ObjectKey, obj runtime.Object) error

Get wraps a controller-runtime client.Get call with a context.

func (*ClusterClient) List

func (w *ClusterClient) List(opts *client.ListOptions, list runtime.Object) error

List wraps a controller-runtime client.List call with a context.

func (*ClusterClient) Update

func (w *ClusterClient) Update(obj runtime.Object) error

Update wraps a controller-runtime client.Update call with a context.

func (*ClusterClient) WithContext

func (w *ClusterClient) WithContext(ctx context.Context) Client

WithContext returns a client configured to use the provided context on subsequent requests, instead of one created from the preconfigured timeout.

type ClusterDynamicClient

type ClusterDynamicClient struct {
	// contains filtered or unexported fields
}

func (*ClusterDynamicClient) Create

Create wraps a client-go dynamic.Create call with a context.

func (*ClusterDynamicClient) Delete

func (w *ClusterDynamicClient) Delete(name string, options metav1.DeleteOptions, subresources ...string) error

Delete wraps a client-go dynamic.Delete call with a context.

func (*ClusterDynamicClient) DeleteCollection

func (w *ClusterDynamicClient) DeleteCollection(options metav1.DeleteOptions, listOptions metav1.ListOptions) error

DeleteCollection wraps a client-go dynamic.DeleteCollection call with a context.

func (*ClusterDynamicClient) Get

func (w *ClusterDynamicClient) Get(name string, options metav1.GetOptions, subresources ...string) (*unstructured.Unstructured, error)

Get wraps a client-go dynamic.Get call with a context.

func (*ClusterDynamicClient) List

Get wraps a client-go dynamic.Get call with a context.

func (*ClusterDynamicClient) Patch

func (w *ClusterDynamicClient) Patch(name string, pt types.PatchType, data []byte, options metav1.PatchOptions, subresources ...string) (*unstructured.Unstructured, error)

Patch wraps a client-go dynamic.Patch call with a context.

func (*ClusterDynamicClient) Update

Update wraps a client-go dynamic.Update call with a context.

func (*ClusterDynamicClient) UpdateStatus

UpdateStatus wraps a client-go dynamic.UpdateStatus call with a context.

func (*ClusterDynamicClient) Watch

Watch wraps a client-go dynamic.Watch call with a context.

func (*ClusterDynamicClient) WithContext

func (w *ClusterDynamicClient) WithContext(ctx context.Context) DClient

WithContext returns a client with context.

func (*ClusterDynamicClient) WithNamespace

func (w *ClusterDynamicClient) WithNamespace(namespace string) DClient

WithNamespace returns a client with namespace.

func (*ClusterDynamicClient) WithResource

func (w *ClusterDynamicClient) WithResource(resource schema.GroupVersionResource) DClient

WithResource returns a client with resource.

type DClient

type DClient interface {
	WithResource(resource schema.GroupVersionResource) DClient
	WithNamespace(namespace string) DClient
	WithContext(ctx context.Context) DClient
	Create(obj *unstructured.Unstructured, options metav1.CreateOptions, subresources ...string) (*unstructured.Unstructured, error)
	Update(obj *unstructured.Unstructured, options metav1.UpdateOptions, subresources ...string) (*unstructured.Unstructured, error)
	Delete(name string, options metav1.DeleteOptions, subresources ...string) error
	Get(name string, options metav1.GetOptions, subresources ...string) (*unstructured.Unstructured, error)
	List(opts metav1.ListOptions) (*unstructured.UnstructuredList, error)
}

DClient wraps a client-go dynamic.

func WrapDClient

func WrapDClient(client dynamic.Interface) DClient

WrapDClient returns a Dynamic Client.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL