k8s

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2021 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

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.

Types

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.

type CtrlOptions

type CtrlOptions struct {
	CTX         context.Context
	Client      client.Client
	Log         logr.Logger
	DClient     *DynamicClientWrapper
	Scheme      *runtime.Scheme
	ConfigStore *configstore.Store
}

type DClient

type DClient interface {
	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.

type DynamicClientOption

type DynamicClientOption func(opt *DynamicClientOptions)

DynamicClientOption is option template.

func WithNamespace

func WithNamespace(namespace string) DynamicClientOption

WithNamespace option.

func WithResource

func WithResource(resource schema.GroupVersionResource) DynamicClientOption

WithResource option.

type DynamicClientOptions

type DynamicClientOptions struct {
	// Resource namespace
	Namespace string
	// Resource schema
	Resource schema.GroupVersionResource
}

DynamicClientOptions provide options for initializing ClusterDynamicClient.

type DynamicClientWrapper

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

DynamicClientWrapper wraps the dynamic client to DClient.

func DynamicClient

func DynamicClient() (*DynamicClientWrapper, error)

DynamicClient returns a dynamic client wrapper.

func (*DynamicClientWrapper) DynamicClient

func (d *DynamicClientWrapper) DynamicClient(ctx context.Context, options ...DynamicClientOption) DClient

DynamicClient returns a DClient copy. Required options: WithResource and WithNamespace.

func (*DynamicClientWrapper) RawClient

func (d *DynamicClientWrapper) RawClient() dynamic.Interface

RawClient returns the used dynamic.Interface.

type Option

type Option func(ops *CtrlOptions)

func WithClient

func WithClient(client client.Client) Option

func WithConfigStore

func WithConfigStore(store *configstore.Store) Option

func WithDClient

func WithDClient(dClient *DynamicClientWrapper) Option

func WithLog

func WithLog(log logr.Logger) Option

func WithScheme

func WithScheme(scheme *runtime.Scheme) Option

Jump to

Keyboard shortcuts

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