kubernetes

package
v0.0.0-...-0666c2b Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(host string, tokenSrc oauth2.TokenSource) (kubernetes.Interface, error)

NewClient initializes a Kubernetes client with the specified token source.

func NewDynamicClient

func NewDynamicClient(host string, tokenSrc oauth2.TokenSource) (dynamic.Interface, error)

NewDynamicClient initializes a dynamic Kubernetes client with the specified token source.

func ParseTaint

func ParseTaint(taintSpec string) (*v1.Taint, error)

Types

type ClientsCollection

type ClientsCollection struct {
	TypedClient   kubernetes.Interface
	DynamicClient dynamic.Interface
	Mapper        meta.RESTMapper
}

func NewClientsCollection

func NewClientsCollection(host string, tokenSrc oauth2.TokenSource) (*ClientsCollection, error)

func (*ClientsCollection) Create

func (c *ClientsCollection) Create(ctx context.Context, kind, namespace string, obj *unstructured.Unstructured, options metav1.CreateOptions, subresources ...string) (*unstructured.Unstructured, error)

func (*ClientsCollection) Delete

func (c *ClientsCollection) Delete(ctx context.Context, kind, namespace, name string, options metav1.DeleteOptions, subresources ...string) error

func (*ClientsCollection) DeleteCollection

func (c *ClientsCollection) DeleteCollection(ctx context.Context, kind, namespace string, options metav1.DeleteOptions, listOptions metav1.ListOptions) error

func (*ClientsCollection) DeleteResource

func (c *ClientsCollection) DeleteResource(ctx context.Context, logger *logrus.Entry, deletion *Resource) error

func (*ClientsCollection) Exists

func (c *ClientsCollection) Exists(ctx context.Context, kind, namespace, name string, options metav1.GetOptions, subresources ...string) (bool, error)

func (*ClientsCollection) Get

func (c *ClientsCollection) Get(ctx context.Context, kind, namespace, name string, options metav1.GetOptions, subresources ...string) (*unstructured.Unstructured, error)

func (*ClientsCollection) List

func (*ClientsCollection) ListResources

func (c *ClientsCollection) ListResources(ctx context.Context, rsrc *Resource) ([]unstructured.Unstructured, error)

func (*ClientsCollection) Patch

func (c *ClientsCollection) Patch(ctx context.Context, kind, namespace, name string, pt types.PatchType, data []byte, options metav1.PatchOptions, subresources ...string) (*unstructured.Unstructured, error)

func (*ClientsCollection) ResolveKind

func (c *ClientsCollection) ResolveKind(kind string) (schema.GroupVersionResource, error)

func (*ClientsCollection) Update

func (c *ClientsCollection) Update(ctx context.Context, kind, namespace string, obj *unstructured.Unstructured, options metav1.UpdateOptions, subresources ...string) (*unstructured.Unstructured, error)

func (*ClientsCollection) UpdateStatus

func (c *ClientsCollection) UpdateStatus(ctx context.Context, kind, namespace string, obj *unstructured.Unstructured, options metav1.UpdateOptions) (*unstructured.Unstructured, error)

func (*ClientsCollection) Watch

func (c *ClientsCollection) Watch(ctx context.Context, kind, namespace string, opts metav1.ListOptions) (watch.Interface, error)

type KubeCTLRunner

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

func NewKubeCTLRunner

func NewKubeCTLRunner(e *command.ExecManager, ts oauth2.TokenSource, l *logrus.Entry, k8sAPIURL string, maxRetries uint64) *KubeCTLRunner

func (*KubeCTLRunner) KubectlExecute

func (k *KubeCTLRunner) KubectlExecute(ctx context.Context, args []string, stdin string, dryRun bool) (string, error)

type Labels

type Labels map[string]string

func (Labels) String

func (l Labels) String() string

String returns a string representation of the labels map.

type Resource

type Resource struct {
	Name      string `yaml:"name"`
	Namespace string `yaml:"namespace"`
	Kind      string `yaml:"kind"`
	Selector  string `yaml:"selector"`
	Labels    Labels `yaml:"labels"`
	HasOwner  *bool  `yaml:"has_owner"`

	// See https://pkg.go.dev/k8s.io/apimachinery/pkg/apis/meta/v1#DeleteOptions
	GracePeriodSeconds *int64                      `yaml:"grace_period_seconds"`
	PropagationPolicy  *metav1.DeletionPropagation `yaml:"propagation_policy"`
}

Resource defines a minimal definition of a kubernetes Resource.

func (*Resource) LabelSelector

func (r *Resource) LabelSelector() string

func (*Resource) LogFields

func (r *Resource) LogFields() logrus.Fields

func (*Resource) Options

func (r *Resource) Options() metav1.DeleteOptions

Jump to

Keyboard shortcuts

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