kubelib

package
v0.0.0-...-e06b190 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2022 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddConfigEnvVar

func AddConfigEnvVar(c *k8v1.Container, envName string, selector string, key string)

Adds env variable from configMap

func AddContainer

func AddContainer(p *k8v1.PodSpec, c *k8v1.Container)

AddContainer adds container to a pod

func AddContainerVolume

func AddContainerVolume(c *k8v1.Container, name string, mountpath string)

Adds a container volume mount to a container

func AddEnvVar

func AddEnvVar(c *k8v1.Container, key string, value string)

Add env var to container

func AddPodConfigVolume

func AddPodConfigVolume(p *k8v1.PodSpec, volName string, configMap string)

Adds a configMap volume to a pod

func AddPodEmptyVolume

func AddPodEmptyVolume(p *k8v1.PodSpec, name string)

func AddPodHostVolume

func AddPodHostVolume(p *k8v1.PodSpec, name string, hostpath string)

func AddPullSecret

func AddPullSecret(pod *k8v1.PodSpec, secret string)

AddPullSecret adds a new pullsecret to the Pod

func CreateConfigMap

func CreateConfigMap(name string, dataKey string, data string) *k8v1.ConfigMap

CreateConfigMap creates a configmap that can be submitted to kubernetes

func CreateContainer

func CreateContainer(name string, image string) *k8v1.Container

CreateContainer creates a default container.

func CreateDeployment

func CreateDeployment(name string) *apps.Deployment

func CreateDeploymentConfig

func CreateDeploymentConfig(name string) *appsv1beta2.Deployment

CreateDeployment

func CreateJob

func CreateJob(name string) *batchv1.Job

Create a basic job

func GetKubeAPI

func GetKubeAPI() *kubernetes.Clientset

GetKubeAPI returns the clientset for the container running inside kubernetes. The container must have the RBAC roles in place to use kubernetes api

Types

type Command

type Command interface{}

type ConfigMapCommand

type ConfigMapCommand struct {
	Configmap *k8v1.ConfigMap
}

func (*ConfigMapCommand) Add

func (k *ConfigMapCommand) Add(clientset kubernetes.Interface) error

func (*ConfigMapCommand) Undo

func (k *ConfigMapCommand) Undo(clientset kubernetes.Interface) error

Undo deletes the ConfigMap from k8s

func (*ConfigMapCommand) Update

func (k *ConfigMapCommand) Update(clientset kubernetes.Interface) error

type DeploymentCommand

type DeploymentCommand struct {
	Deployment *apps.Deployment
}

func (*DeploymentCommand) Add

func (d *DeploymentCommand) Add(clientset kubernetes.Interface) error

func (*DeploymentCommand) Undo

func (d *DeploymentCommand) Undo(clientset kubernetes.Interface) error

func (*DeploymentCommand) Update

func (d *DeploymentCommand) Update(clientset kubernetes.Interface) error

type JobCommand

type JobCommand struct {
	Job *batch.Job
}

func (*JobCommand) Add

func (j *JobCommand) Add(clientset kubernetes.Interface) error

func (*JobCommand) Undo

func (j *JobCommand) Undo(clientset kubernetes.Interface) error

func (*JobCommand) Update

func (j *JobCommand) Update(clientset kubernetes.Interface) error

type KubeCommand

type KubeCommand interface {
	Add(clientset kubernetes.Interface) error
	Undo(clientset kubernetes.Interface) error
	Update(clientset kubernetes.Interface) error
}

type KubernetesCommand

type KubernetesCommand struct {
	Obj *runtime.Object
}

type ServiceCommand

type ServiceCommand struct {
	Service *k8v1.Service
}

func CreateService

func CreateService(name string, selector string, ports []k8v1.ServicePort) *ServiceCommand

func (*ServiceCommand) Add

func (s *ServiceCommand) Add(clientset kubernetes.Interface) error

func (*ServiceCommand) Undo

func (s *ServiceCommand) Undo(clientset kubernetes.Interface) error

func (*ServiceCommand) Update

func (s *ServiceCommand) Update(clientset kubernetes.Interface) error

Jump to

Keyboard shortcuts

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