kubernetes

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package kubernetes implements a convenience wrapper around Kubernetes clients.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateNamespace

func CreateNamespace(client client.Client, name string) error

CreateNamespace creates a namespace.

func DeleteNamespace

func DeleteNamespace(client client.Client, name string) error

DeleteNamespace deletes a namespace.

Types

type ClusterRole added in v0.2.4

type ClusterRole struct {
	rbacv1.ClusterRole
	// contains filtered or unexported fields
}

ClusterRole wraps a Kubernetes ClusterRole.

func GetClusterRole added in v0.2.4

func GetClusterRole(client client.Client, name string) (ClusterRole, error)

GetClusterRole gets a clusterrole.

func ListClusterRoles added in v0.2.4

func ListClusterRoles(client client.Client) ([]ClusterRole, error)

ListClusterRoles lists all clusterroles.

func NewClusterRole added in v0.2.4

func NewClusterRole(client client.Client, clusterrole rbacv1.ClusterRole) (ClusterRole, error)

NewClusterRole creates a ClusterRole from its Kubernetes ClusterRole.

func (ClusterRole) Delete added in v0.2.4

func (clusterrole ClusterRole) Delete() error

Delete deletes a ClusterRole from the Kubernetes cluster.

func (*ClusterRole) Save added in v0.5.0

func (clusterrole *ClusterRole) Save() error

Save saves the current ClusterRole.

func (*ClusterRole) Update added in v0.2.4

func (clusterrole *ClusterRole) Update() error

Update gets the current ClusterRole status.

type ClusterRoleBinding added in v0.2.4

type ClusterRoleBinding struct {
	rbacv1.ClusterRoleBinding
	// contains filtered or unexported fields
}

ClusterRoleBinding wraps a Kubernetes ClusterRoleBinding.

func GetClusterRoleBinding added in v0.2.4

func GetClusterRoleBinding(client client.Client, name string) (ClusterRoleBinding, error)

GetClusterRoleBinding gets a clusterrolebinding.

func ListClusterRoleBindings added in v0.2.4

func ListClusterRoleBindings(client client.Client) ([]ClusterRoleBinding, error)

ListClusterRoleBindings lists all clusterrolebindings.

func NewClusterRoleBinding added in v0.2.4

func NewClusterRoleBinding(client client.Client, clusterrolebinding rbacv1.ClusterRoleBinding) (ClusterRoleBinding, error)

NewClusterRoleBinding creates a ClusterRoleBinding from its Kubernetes ClusterRoleBinding.

func (ClusterRoleBinding) Delete added in v0.2.4

func (clusterrolebinding ClusterRoleBinding) Delete() error

Delete deletes a ClusterRoleBinding from the Kubernetes cluster.

func (*ClusterRoleBinding) Save added in v0.5.0

func (clusterrolebinding *ClusterRoleBinding) Save() error

Save saves the current ClusterRoleBinding.

func (*ClusterRoleBinding) Update added in v0.2.4

func (clusterrolebinding *ClusterRoleBinding) Update() error

Update gets the current ClusterRoleBinding status.

type Node added in v0.4.1

type Node struct {
	corev1.Node
	// contains filtered or unexported fields
}

Node wraps a Kubernetes Node.

func GetNode added in v0.4.1

func GetNode(client client.Client, name string) (Node, error)

GetNode gets a node.

func ListNodes added in v0.4.1

func ListNodes(client client.Client) ([]Node, error)

ListNodes lists all nodes.

func NewNode added in v0.4.1

func NewNode(client client.Client, node corev1.Node) (Node, error)

NewNode creates a Node from its Kubernetes Node.

func (Node) Delete added in v0.4.1

func (node Node) Delete() error

Delete deletes a Node from the Kubernetes cluster.

func (*Node) Save added in v0.5.0

func (node *Node) Save() error

Save saves the current Node.

func (*Node) Update added in v0.4.1

func (node *Node) Update() error

Update gets the current Node status.

type PersistentVolumeClaim added in v0.2.0

type PersistentVolumeClaim struct {
	corev1.PersistentVolumeClaim
	// contains filtered or unexported fields
}

PersistentVolumeClaim wraps a Kubernetes PersistentVolumeClaim.

func GetPersistentVolumeClaim added in v0.2.0

func GetPersistentVolumeClaim(client client.Client, name string, namespace string) (PersistentVolumeClaim, error)

GetPersistentVolumeClaim gets a persistentvolumeclaim in a namespace.

func ListPersistentVolumeClaims added in v0.2.0

func ListPersistentVolumeClaims(client client.Client, namespace string) ([]PersistentVolumeClaim, error)

ListPersistentVolumeClaims lists all persistentvolumeclaims in a namespace.

func NewPersistentVolumeClaim added in v0.2.0

func NewPersistentVolumeClaim(client client.Client, persistentvolumeclaim corev1.PersistentVolumeClaim) (PersistentVolumeClaim, error)

NewPersistentVolumeClaim creates a PersistentVolumeClaim from its Kubernetes PersistentVolumeClaim.

func (PersistentVolumeClaim) Delete added in v0.2.0

func (persistentvolumeclaim PersistentVolumeClaim) Delete() error

Delete deletes a PersistentVolumeClaim from the Kubernetes cluster.

func (*PersistentVolumeClaim) Save added in v0.5.0

func (persistentvolumeclaim *PersistentVolumeClaim) Save() error

Save saves the current PersistentVolumeClaim.

func (*PersistentVolumeClaim) Update added in v0.2.0

func (persistentvolumeclaim *PersistentVolumeClaim) Update() error

Update gets the current PersistentVolumeClaim status.

type Pod

type Pod struct {
	corev1.Pod
	// contains filtered or unexported fields
}

Pod wraps a Kubernetes Pod.

func GetPod

func GetPod(client client.Client, name string, namespace string) (Pod, error)

GetPod gets a pod in a namespace.

func ListPods

func ListPods(client client.Client, namespace string) ([]Pod, error)

ListPods lists all pods in a namespace.

func NewPod added in v0.2.0

func NewPod(client client.Client, pod corev1.Pod) (Pod, error)

NewPod creates a Pod from its Kubernetes Pod.

func (Pod) ContainerExec

func (pod Pod) ContainerExec(container string, command cmd.Builder) error

ContainerExec runs a command in a pod's container.

func (Pod) ContainerLogs

func (pod Pod) ContainerLogs(container string) ([]byte, error)

ContainerLogs returns the (current) logs of a pod's container.

func (Pod) Delete added in v0.2.0

func (pod Pod) Delete() error

Delete deletes a Pod from the Kubernetes cluster.

func (*Pod) Save added in v0.5.0

func (pod *Pod) Save() error

Save saves the current Pod.

func (*Pod) Update

func (pod *Pod) Update() error

Update gets the current Pod status.

type Role added in v0.2.4

type Role struct {
	rbacv1.Role
	// contains filtered or unexported fields
}

Role wraps a Kubernetes Role.

func GetRole added in v0.2.4

func GetRole(client client.Client, name string, namespace string) (Role, error)

GetRole gets a role in a namespace.

func ListRoles added in v0.2.4

func ListRoles(client client.Client, namespace string) ([]Role, error)

ListRoles lists all roles in a namespace.

func NewRole added in v0.2.4

func NewRole(client client.Client, role rbacv1.Role) (Role, error)

NewRole creates a Role from its Kubernetes Role.

func (Role) Delete added in v0.2.4

func (role Role) Delete() error

Delete deletes a Role from the Kubernetes cluster.

func (*Role) Save added in v0.5.0

func (role *Role) Save() error

Save saves the current Role.

func (*Role) Update added in v0.2.4

func (role *Role) Update() error

Update gets the current Role status.

type RoleBinding added in v0.2.4

type RoleBinding struct {
	rbacv1.RoleBinding
	// contains filtered or unexported fields
}

RoleBinding wraps a Kubernetes RoleBinding.

func GetRoleBinding added in v0.2.4

func GetRoleBinding(client client.Client, name string, namespace string) (RoleBinding, error)

GetRoleBinding gets a rolebinding in a namespace.

func ListRoleBindings added in v0.2.4

func ListRoleBindings(client client.Client, namespace string) ([]RoleBinding, error)

ListRoleBindings lists all rolebindings in a namespace.

func NewRoleBinding added in v0.2.4

func NewRoleBinding(client client.Client, rolebinding rbacv1.RoleBinding) (RoleBinding, error)

NewRoleBinding creates a RoleBinding from its Kubernetes RoleBinding.

func (RoleBinding) Delete added in v0.2.4

func (rolebinding RoleBinding) Delete() error

Delete deletes a RoleBinding from the Kubernetes cluster.

func (*RoleBinding) Save added in v0.5.0

func (rolebinding *RoleBinding) Save() error

Save saves the current RoleBinding.

func (*RoleBinding) Update added in v0.2.4

func (rolebinding *RoleBinding) Update() error

Update gets the current RoleBinding status.

type Secret added in v0.2.0

type Secret struct {
	corev1.Secret
	// contains filtered or unexported fields
}

Secret wraps a Kubernetes Secret.

func GetSecret added in v0.2.0

func GetSecret(client client.Client, name string, namespace string) (Secret, error)

GetSecret gets a secret in a namespace.

func ListSecrets added in v0.2.0

func ListSecrets(client client.Client, namespace string) ([]Secret, error)

ListSecrets lists all secrets in a namespace.

func NewSecret added in v0.2.0

func NewSecret(client client.Client, secret corev1.Secret) (Secret, error)

NewSecret creates a Secret from its Kubernetes Secret.

func (Secret) Delete added in v0.2.0

func (secret Secret) Delete() error

Delete deletes a Secret from the Kubernetes cluster.

func (*Secret) Save added in v0.5.0

func (secret *Secret) Save() error

Save saves the current Secret.

func (*Secret) Update added in v0.2.0

func (secret *Secret) Update() error

Update gets the current Secret status.

type SecretBuilder added in v0.2.0

type SecretBuilder struct {
	Name       string
	Namespace  string
	Data       map[string][]byte
	StringData map[string]string
}

SecretBuilder tracks the options set for a secret.

func CreateSecret added in v0.2.0

func CreateSecret(name string) SecretBuilder

CreateSecret creates a secret. Additional parameters can be added to this call. The creation is started by calling 'Do'.

func (SecretBuilder) Do added in v0.2.0

func (builder SecretBuilder) Do(client client.Client) (Secret, error)

Do creates the secret in the cluster.

func (SecretBuilder) WithData added in v0.2.0

func (builder SecretBuilder) WithData(data map[string][]byte) SecretBuilder

WithData sets the data the secret should hold.

func (SecretBuilder) WithNamespace added in v0.2.0

func (builder SecretBuilder) WithNamespace(namespace string) SecretBuilder

WithNamespace sets the namespace in which the secret will be created.

func (SecretBuilder) WithStringData added in v0.2.2

func (builder SecretBuilder) WithStringData(data map[string]string) SecretBuilder

WithStringData sets the data the secret should hold as string

type Service added in v0.2.0

type Service struct {
	corev1.Service
	// contains filtered or unexported fields
}

Service wraps a Kubernetes Service.

func GetService added in v0.2.0

func GetService(client client.Client, name string, namespace string) (Service, error)

GetService gets a service in a namespace.

func ListServices added in v0.2.0

func ListServices(client client.Client, namespace string) ([]Service, error)

ListServices lists all services in a namespace.

func NewService added in v0.2.0

func NewService(client client.Client, service corev1.Service) (Service, error)

NewService creates a Service from its Kubernetes Service.

func (Service) Delete added in v0.2.0

func (service Service) Delete() error

Delete deletes a Service from the Kubernetes cluster.

func (*Service) Save added in v0.5.0

func (service *Service) Save() error

Save saves the current Service.

func (*Service) Update added in v0.2.0

func (service *Service) Update() error

Update gets the current Service status.

type ServiceAccount added in v0.2.4

type ServiceAccount struct {
	corev1.ServiceAccount
	// contains filtered or unexported fields
}

ServiceAccount wraps a Kubernetes ServiceAccount.

func GetServiceAccount added in v0.2.4

func GetServiceAccount(client client.Client, name string, namespace string) (ServiceAccount, error)

GetServiceAccount gets a serviceaccount in a namespace.

func ListServiceAccounts added in v0.2.4

func ListServiceAccounts(client client.Client, namespace string) ([]ServiceAccount, error)

ListServiceAccounts lists all serviceaccounts in a namespace.

func NewServiceAccount added in v0.2.4

func NewServiceAccount(client client.Client, serviceaccount corev1.ServiceAccount) (ServiceAccount, error)

NewServiceAccount creates a ServiceAccount from its Kubernetes ServiceAccount.

func (ServiceAccount) Delete added in v0.2.4

func (serviceaccount ServiceAccount) Delete() error

Delete deletes a ServiceAccount from the Kubernetes cluster.

func (*ServiceAccount) Save added in v0.5.0

func (serviceaccount *ServiceAccount) Save() error

Save saves the current ServiceAccount.

func (*ServiceAccount) Update added in v0.2.4

func (serviceaccount *ServiceAccount) Update() error

Update gets the current ServiceAccount status.

type StatefulSet added in v0.2.0

type StatefulSet struct {
	appsv1.StatefulSet
	// contains filtered or unexported fields
}

StatefulSet wraps a Kubernetes StatefulSet.

func GetStatefulSet added in v0.2.0

func GetStatefulSet(client client.Client, name string, namespace string) (StatefulSet, error)

GetStatefulSet gets a statefulset in a namespace.

func ListStatefulSets added in v0.2.0

func ListStatefulSets(client client.Client, namespace string) ([]StatefulSet, error)

ListStatefulSets lists all statefulsets in a namespace.

func NewStatefulSet added in v0.2.0

func NewStatefulSet(client client.Client, statefulset appsv1.StatefulSet) (StatefulSet, error)

NewStatefulSet creates a StatefulSet from its Kubernetes StatefulSet.

func (StatefulSet) Delete added in v0.2.0

func (statefulset StatefulSet) Delete() error

Delete deletes a StatefulSet from the Kubernetes cluster.

func (*StatefulSet) Save added in v0.5.0

func (statefulset *StatefulSet) Save() error

Save saves the current StatefulSet.

func (*StatefulSet) Update added in v0.2.0

func (statefulset *StatefulSet) Update() error

Update gets the current StatefulSet status.

Jump to

Keyboard shortcuts

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