kubernetes

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: Apache-2.0 Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateNamespace

func CreateNamespace(clientset kubernetes.Interface, namespace string)

TODO: return error

func CreatePersistentVolume

func CreatePersistentVolume(clientset kubernetes.Interface, pvName string, capacity string, hostPath string, storageClassName string) (*v1.PersistentVolume, error)

func CreatePersistentVolumeClaim

func CreatePersistentVolumeClaim(clientset kubernetes.Interface, capacity string, storageClassName string, namespace string) (*v1.PersistentVolumeClaim, error)

func CreateSecret

func CreateSecret(clientset kubernetes.Interface, namespace string, secret *corev1.Secret) (*corev1.Secret, error)

func GetSecret

func GetSecret(clientset kubernetes.Interface, namespace string, secretName string) (*corev1.Secret, error)

func GetSecretKey

func GetSecretKey(clientset kubernetes.Interface, namespace, secretName, key string) (string, error)

func NewInClusterClientset

func NewInClusterClientset() (*kubernetes.Clientset, error)

Types

type Client

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

Client represents a Kubernetes client, wrapping k8s.io/client-go/kubernetes.Clientset

func NewClient

func NewClient(clientConfig *ClientConfig) (*Client, error)

NewClient initializes a Kubernetes client.

func NewInClusterClient

func NewInClusterClient(clientConfig *ClientConfig) (*Client, error)

NewInClusterClient initializes a Kubernetes client from within a cluster.

func (*Client) CreatePersistentVolumeClaim

func (c *Client) CreatePersistentVolumeClaim(ctxt context.Context, pvc *corev1.PersistentVolumeClaim, options metav1.CreateOptions) (*corev1.PersistentVolumeClaim, error)

func (*Client) GetConfigMap

func (c *Client) GetConfigMap(ctxt context.Context, cmName string, options metav1.GetOptions) (*v1.ConfigMap, error)

func (*Client) GetConfigMapKey

func (c *Client) GetConfigMapKey(ctxt context.Context, cmName, key string, options metav1.GetOptions) (string, error)

func (*Client) GetPersistentVolumeClaim

func (c *Client) GetPersistentVolumeClaim(ctxt context.Context, name string, options metav1.GetOptions) (*corev1.PersistentVolumeClaim, error)

type ClientConfig

type ClientConfig struct {
	// Kubernetes namespace.
	Namespace string
	// Logger is the logger to send logging messages to.
	Logger logging.LeveledLoggerInterface
	// KubernetesClient is the wrapped Kubernetes client.
	KubernetesClient *kubernetes.Clientset
}

ClientConfig configures a Tekton client.

type ClientConfigMapInterface

type ClientConfigMapInterface interface {
	GetConfigMap(ctxt context.Context, cmName string, options metav1.GetOptions) (*v1.ConfigMap, error)
	GetConfigMapKey(ctxt context.Context, cmName, key string, options metav1.GetOptions) (string, error)
}

type ClientPersistentVolumeClaimInterface

type ClientPersistentVolumeClaimInterface interface {
	GetPersistentVolumeClaim(ctxt context.Context, name string, options metav1.GetOptions) (*corev1.PersistentVolumeClaim, error)
	CreatePersistentVolumeClaim(ctxt context.Context, pipeline *corev1.PersistentVolumeClaim, options metav1.CreateOptions) (*corev1.PersistentVolumeClaim, error)
}

type Clients

type Clients struct {
	KubernetesClientSet *kubernetes.Clientset
	TektonClientSet     *tekton.Clientset
}

func NewClients

func NewClients() *Clients

type TestClient

type TestClient struct {
	// PersistentVolumeClaims is the pool of pipelines which can be retrieved.
	PVCs []*corev1.PersistentVolumeClaim
	// FailCreatePVC lets PVC creation fail.
	FailCreatePVC bool
	// CreatedPVCs is a slice of created PVC names.
	CreatedPVCs []string
	// ConfigMaps which can be retrieved
	CMs []*corev1.ConfigMap
}

TestClient returns mocked resources.

func (*TestClient) CreatePersistentVolumeClaim

func (c *TestClient) CreatePersistentVolumeClaim(ctxt context.Context, pipeline *corev1.PersistentVolumeClaim, options metav1.CreateOptions) (*corev1.PersistentVolumeClaim, error)

func (*TestClient) GetConfigMap

func (c *TestClient) GetConfigMap(ctxt context.Context, cmName string, options metav1.GetOptions) (*corev1.ConfigMap, error)

func (*TestClient) GetConfigMapKey

func (c *TestClient) GetConfigMapKey(ctxt context.Context, cmName, key string, options metav1.GetOptions) (string, error)

func (*TestClient) GetPersistentVolumeClaim

func (c *TestClient) GetPersistentVolumeClaim(ctxt context.Context, name string, options metav1.GetOptions) (*corev1.PersistentVolumeClaim, error)

Jump to

Keyboard shortcuts

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