k8s

package
v0.0.0-...-9f63048 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EscapeJSONPointer

func EscapeJSONPointer(s string) string

EscapeJSONPointer escapes JSON Pointer according to https://tools.ietf.org/html/rfc6901#section-3.

func ToPVReclaimPolicyPtr

func ToPVReclaimPolicyPtr(s string) *v1.PersistentVolumeReclaimPolicy

ToPVReclaimPolicyPtr converts given string to v1.PersistentVolumeReclaimPolicy pointer.

func ToStringPtr

func ToStringPtr(s string) *string

ToStringPtr converts given string to string pointer.

Types

type Client

type Client struct {
	kubernetes.Interface
}

Client contains wrapper methods to Kubernetes API.

func NewClient

func NewClient(cs kubernetes.Interface) (*Client, error)

NewClient creates new Kubernetes client wrapper using provided Kubernetes client.

func NewClientForConfig

func NewClientForConfig(c *rest.Config) (*Client, error)

NewClientForConfig creates new Kubernetes client wrapper using provided configuration.

func (*Client) PersistentVolumesWithClaimsAndPods

func (c *Client) PersistentVolumesWithClaimsAndPods(ctx context.Context) ([]VolumeClaimPods, error)

PersistentVolumesWithClaimsAndPods returns all persistent volumes in the cluster together with their belonging persistent volume claims and pods.

func (*Client) SetDefaultStorageClass

func (c *Client) SetDefaultStorageClass(ctx context.Context, storageClassName string) error

SetDefaultStorageClass sets default storage class and unsets default flat to all other storage classes.

func (*Client) SetPersistentVolumeReclaimPolicy

func (c *Client) SetPersistentVolumeReclaimPolicy(ctx context.Context, persistentVolumeName, policy string) error

SetPersistentVolumeReclaimPolicy sets reclaim policy to the given persistent volume.

func (*Client) StorageClasses

func (c *Client) StorageClasses(ctx context.Context) ([]storagev1.StorageClass, error)

StorageClasses returns all storage classes in the cluster.

type Interface

type Interface interface {
	StorageClasses(ctx context.Context) ([]v1.StorageClass, error)
	PersistentVolumesWithClaimsAndPods(ctx context.Context) ([]VolumeClaimPods, error)
	SetPersistentVolumeReclaimPolicy(ctx context.Context, persistentVolumeName, policy string) error
	SetDefaultStorageClass(ctx context.Context, storageClassName string) error
}

Interface contains all public methods of k8s.Client implementation.

type VolumeClaimPods

type VolumeClaimPods struct {
	PersistentVolume      v1.PersistentVolume      `json:"volume"`
	PersistentVolumeClaim v1.PersistentVolumeClaim `json:"claim"`
	Pods                  []v1.Pod                 `json:"pods"`
}

VolumeClaimPods represents a persistent volume together with belonging claim and pods.

Jump to

Keyboard shortcuts

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