kubernetes

package
v1.5.14-0...-e6cd0ce Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2022 License: Apache-2.0 Imports: 52 Imported by: 0

Documentation

Index

Constants

View Source
const TaintKeyPrefix = "node.orbos.ch/"

Variables

This section is empty.

Functions

func ApplyCRDs

func ApplyCRDs(boilerplatePath, path string, k8sClient ClientInt) error

func EnsureBoomArtifacts

func EnsureBoomArtifacts(
	monitor mntr.Monitor,
	apiLabels *labels.API,
	client ClientInt,
	version string,
	tolerations k8s.Tolerations,
	nodeselector map[string]string,
	resources *k8s.Resources,
	imageRegistry string,
	gitops bool,
) error

func EnsureCaosSystemNamespace

func EnsureCaosSystemNamespace(monitor mntr.Monitor, client ClientInt) error

func EnsureNetworkingArtifacts

func EnsureNetworkingArtifacts(
	monitor mntr.Monitor,
	apiLabels *labels.API,
	client ClientInt,
	version string,
	nodeselector map[string]string,
	tolerations []core.Toleration,
	imageRegistry string,
	gitops bool,
) error

func EnsureOrbconfigSecret

func EnsureOrbconfigSecret(monitor mntr.Monitor, client ClientInt, orbconfig []byte) error

func EnsureOrbiterArtifacts

func EnsureOrbiterArtifacts(
	monitor mntr.Monitor,
	apiLabels *labels.API,
	client *Client,
	pprof bool,
	orbiterversion string,
	imageRegistry string,
) error

func GetCRDs

func GetCRDs(boilerplatePath, path string) ([]string, error)

func WriteCRDs

func WriteCRDs(boilerplatePath, path, destinationFolder string) error

Types

type Client

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

func NewK8sClient

func NewK8sClient(monitor mntr.Monitor, kubeconfig *string, kubeconfigPath string) (*Client, error)

func NewK8sClientPathBeforeInCluster

func NewK8sClientPathBeforeInCluster(monitor mntr.Monitor, kubeconfigPath string) (*Client, error)

func NewK8sClientWithConfig

func NewK8sClientWithConfig(monitor mntr.Monitor, conf *rest.Config) (*Client, error)

func (*Client) ApplyCRDResource

func (c *Client) ApplyCRDResource(crd *unstructured.Unstructured) error

func (*Client) ApplyClusterRole

func (c *Client) ApplyClusterRole(rsc *rbac.ClusterRole) error

func (*Client) ApplyClusterRoleBinding

func (c *Client) ApplyClusterRoleBinding(rsc *rbac.ClusterRoleBinding) error

func (*Client) ApplyConfigmap

func (c *Client) ApplyConfigmap(rsc *core.ConfigMap) error

func (*Client) ApplyCronJob

func (c *Client) ApplyCronJob(rsc *v1beta1.CronJob) error

func (*Client) ApplyDeployment

func (c *Client) ApplyDeployment(rsc *apps.Deployment, force bool) error

func (*Client) ApplyIngress

func (c *Client) ApplyIngress(rsc *extensions.Ingress) error

func (*Client) ApplyJob

func (c *Client) ApplyJob(rsc *batch.Job) error

func (*Client) ApplyJobDryRun

func (c *Client) ApplyJobDryRun(rsc *batch.Job) error

func (*Client) ApplyNamespace

func (c *Client) ApplyNamespace(rsc *core.Namespace) error

func (*Client) ApplyNamespacedCRDResource

func (c *Client) ApplyNamespacedCRDResource(group, version, kind, namespace, name string, crd *unstructured.Unstructured) error

func (*Client) ApplyPlainYAML

func (c *Client) ApplyPlainYAML(monitor mntr.Monitor, data []byte) error

func (*Client) ApplyPodDisruptionBudget

func (c *Client) ApplyPodDisruptionBudget(rsc *policy.PodDisruptionBudget) error

func (*Client) ApplyRole

func (c *Client) ApplyRole(rsc *rbac.Role) error

func (*Client) ApplyRoleBinding

func (c *Client) ApplyRoleBinding(rsc *rbac.RoleBinding) error

func (*Client) ApplySecret

func (c *Client) ApplySecret(rsc *core.Secret) error

func (*Client) ApplyService

func (c *Client) ApplyService(rsc *core.Service) error

func (*Client) ApplyServiceAccount

func (c *Client) ApplyServiceAccount(rsc *core.ServiceAccount) error

func (*Client) ApplyStatefulSet

func (c *Client) ApplyStatefulSet(rsc *apps.StatefulSet, force bool) error

func (*Client) CheckCRD

func (*Client) DeleteCRDResource

func (c *Client) DeleteCRDResource(group, version, kind, name string) error

func (*Client) DeleteClusterRole

func (c *Client) DeleteClusterRole(name string) error

func (*Client) DeleteClusterRoleBinding

func (c *Client) DeleteClusterRoleBinding(name string) error

func (*Client) DeleteConfigmap

func (c *Client) DeleteConfigmap(namespace, name string) error

func (*Client) DeleteCronJob

func (c *Client) DeleteCronJob(namespace string, name string) error

func (*Client) DeleteDeployment

func (c *Client) DeleteDeployment(namespace, name string) error

func (*Client) DeleteIngress

func (c *Client) DeleteIngress(namespace, name string) error

func (*Client) DeleteJob

func (c *Client) DeleteJob(namespace string, name string) error

func (*Client) DeleteNamespace

func (c *Client) DeleteNamespace(name string) error

func (*Client) DeleteNamespacedCRDResource

func (c *Client) DeleteNamespacedCRDResource(group, version, kind, namespace, name string) error

func (*Client) DeleteNode

func (c *Client) DeleteNode(name string) error

func (*Client) DeletePersistentVolumeClaim

func (c *Client) DeletePersistentVolumeClaim(namespace, name string, timeout time.Duration) error

func (*Client) DeletePod

func (c *Client) DeletePod(namespace, name string) error

func (*Client) DeletePodDisruptionBudget

func (c *Client) DeletePodDisruptionBudget(namespace string, name string) error

func (*Client) DeletePodsByLabels

func (c *Client) DeletePodsByLabels(namespace string, labels map[string]string) error

func (*Client) DeleteRole

func (c *Client) DeleteRole(namespace, name string) error

func (*Client) DeleteRoleBinding

func (c *Client) DeleteRoleBinding(namespace, name string) error

func (*Client) DeleteSecret

func (c *Client) DeleteSecret(namespace, name string) error

func (*Client) DeleteService

func (c *Client) DeleteService(namespace, name string) error

func (*Client) DeleteServiceAccount

func (c *Client) DeleteServiceAccount(namespace, name string) error

func (*Client) DeleteStatefulset

func (c *Client) DeleteStatefulset(namespace, name string) error

func (*Client) Drain

func (c *Client) Drain(machine Machine, node *core.Node, reason DrainReason, self bool) (err error)

func (*Client) ExecInPod

func (c *Client) ExecInPod(namespace, name, container, command string) error

func (*Client) ExecInPodOfDeployment

func (c *Client) ExecInPodOfDeployment(namespace, name, container, command string) error

func (*Client) ExecInPodWithOutput

func (c *Client) ExecInPodWithOutput(namespace, name, container, command string) (string, error)

func (*Client) GetConfigMap

func (c *Client) GetConfigMap(namespace, name string) (*core.ConfigMap, error)

func (*Client) GetDeployment

func (c *Client) GetDeployment(namespace, name string) (*apps.Deployment, error)

func (*Client) GetJob

func (c *Client) GetJob(namespace, name string) (*batch.Job, error)

func (*Client) GetNamespacedCRDResource

func (c *Client) GetNamespacedCRDResource(group, version, kind, namespace, name string) (*unstructured.Unstructured, error)

func (*Client) GetNode

func (c *Client) GetNode(id string) (node *core.Node, err error)

func (*Client) GetSecret

func (c *Client) GetSecret(namespace string, name string) (*core.Secret, error)

func (*Client) ListCronJobs

func (c *Client) ListCronJobs(namespace string, labels map[string]string) (*batchv1beta1.CronJobList, error)

func (*Client) ListNamespaces

func (c *Client) ListNamespaces() (*core.NamespaceList, error)

func (*Client) ListNodes

func (c *Client) ListNodes(filterID ...string) (nodes []core.Node, err error)

func (*Client) ListPersistentVolumeClaims

func (c *Client) ListPersistentVolumeClaims(namespace string) (*core.PersistentVolumeClaimList, error)

func (*Client) ListPersistentVolumes

func (c *Client) ListPersistentVolumes() (*core.PersistentVolumeList, error)

func (*Client) ListPods

func (c *Client) ListPods(namespace string, labels map[string]string) (*core.PodList, error)

func (*Client) ListSecrets

func (c *Client) ListSecrets(namespace string, labels map[string]string) (*core.SecretList, error)

func (*Client) PatchDeployment

func (c *Client) PatchDeployment(namespace, name string, data string) error

func (*Client) RemoveFromTaints

func (c *Client) RemoveFromTaints(taints []core.Taint, reason DrainReason) (result []core.Taint)

func (*Client) ScaleDeployment

func (c *Client) ScaleDeployment(namespace, name string, replicaCount int) error

func (*Client) ScaleStatefulset

func (c *Client) ScaleStatefulset(namespace, name string, replicaCount int) error

func (*Client) Tainted

func (c *Client) Tainted(node *core.Node, reason DrainReason) bool

func (*Client) UpdateNode

func (c *Client) UpdateNode(node *core.Node) (err error)

func (*Client) WaitForConfigMap

func (c *Client) WaitForConfigMap(namespace string, name string, timeout time.Duration) error

func (*Client) WaitForSecret

func (c *Client) WaitForSecret(namespace string, name string, timeout time.Duration) error

func (*Client) WaitUntilDeploymentReady

func (c *Client) WaitUntilDeploymentReady(namespace string, name string, containerCheck, readyCheck bool, timeout time.Duration) error

func (*Client) WaitUntilJobCompleted

func (c *Client) WaitUntilJobCompleted(namespace string, name string, timeout time.Duration) error

func (*Client) WaitUntilStatefulsetIsReady

func (c *Client) WaitUntilStatefulsetIsReady(namespace string, name string, containerCheck, readyCheck bool, timeout time.Duration) error

type ClientInt

type ClientInt interface {
	ApplyService(rsc *core.Service) error
	DeleteService(namespace, name string) error

	GetJob(namespace, name string) (*batch.Job, error)
	ApplyJob(rsc *batch.Job) error
	ApplyJobDryRun(rsc *batch.Job) error
	DeleteJob(namespace string, name string) error
	WaitUntilJobCompleted(namespace string, name string, timeout time.Duration) error

	ApplyServiceAccount(rsc *core.ServiceAccount) error
	DeleteServiceAccount(namespace, name string) error

	ApplyStatefulSet(rsc *apps.StatefulSet, force bool) error
	DeleteStatefulset(namespace, name string) error
	ScaleStatefulset(namespace, name string, replicaCount int) error
	WaitUntilStatefulsetIsReady(namespace string, name string, containerCheck, readyCheck bool, timeout time.Duration) error

	ExecInPodWithOutput(namespace, name, container, command string) (string, error)
	ExecInPod(namespace, name, container, command string) error

	GetDeployment(namespace, name string) (*apps.Deployment, error)
	ApplyDeployment(rsc *apps.Deployment, force bool) error
	DeleteDeployment(namespace, name string) error
	PatchDeployment(namespace, name string, data string) error
	WaitUntilDeploymentReady(namespace string, name string, containerCheck, readyCheck bool, timeout time.Duration) error
	ScaleDeployment(namespace, name string, replicaCount int) error
	ExecInPodOfDeployment(namespace, name, container, command string) error

	CheckCRD(name string) (*apixv1beta1.CustomResourceDefinition, bool, error)
	GetNamespacedCRDResource(group, version, kind, namespace, name string) (*unstructured.Unstructured, error)
	ApplyNamespacedCRDResource(group, version, kind, namespace, name string, crd *unstructured.Unstructured) error
	DeleteNamespacedCRDResource(group, version, kind, namespace, name string) error
	ApplyCRDResource(crd *unstructured.Unstructured) error
	DeleteCRDResource(group, version, kind, name string) error

	ApplyCronJob(rsc *v1beta1.CronJob) error
	DeleteCronJob(namespace string, name string) error
	ListCronJobs(namespace string, labels map[string]string) (*batchv1beta1.CronJobList, error)

	ListSecrets(namespace string, labels map[string]string) (*core.SecretList, error)
	GetSecret(namespace string, name string) (*core.Secret, error)
	ApplySecret(rsc *core.Secret) error
	DeleteSecret(namespace, name string) error
	WaitForSecret(namespace string, name string, timeout time.Duration) error

	GetConfigMap(namespace, name string) (*core.ConfigMap, error)
	ApplyConfigmap(rsc *core.ConfigMap) error
	DeleteConfigmap(namespace, name string) error
	WaitForConfigMap(namespace string, name string, timeout time.Duration) error

	ApplyRole(rsc *rbac.Role) error
	DeleteRole(namespace, name string) error

	ApplyClusterRole(rsc *rbac.ClusterRole) error
	DeleteClusterRole(name string) error

	ApplyIngress(rsc *extensions.Ingress) error
	DeleteIngress(namespace, name string) error

	ApplyRoleBinding(rsc *rbac.RoleBinding) error
	DeleteRoleBinding(namespace, name string) error

	ApplyClusterRoleBinding(rsc *rbac.ClusterRoleBinding) error
	DeleteClusterRoleBinding(name string) error

	ApplyPodDisruptionBudget(rsc *policy.PodDisruptionBudget) error
	DeletePodDisruptionBudget(namespace string, name string) error

	ApplyNamespace(rsc *core.Namespace) error
	DeleteNamespace(name string) error

	ListPersistentVolumes() (*core.PersistentVolumeList, error)

	ApplyPlainYAML(mntr.Monitor, []byte) error

	ListPersistentVolumeClaims(namespace string) (*core.PersistentVolumeClaimList, error)
	DeletePersistentVolumeClaim(namespace, name string, timeout time.Duration) error
}

type DrainReason

type DrainReason int
const (
	Updating DrainReason = iota
	Rebooting
	Deleting
)

func (DrainReason) String

func (i DrainReason) String() string

type File

type File struct {
	Name    string
	Content []byte
}

type IDFunc

type IDFunc func() string

func (IDFunc) ID

func (i IDFunc) ID() string

type Machine

type Machine interface {
	GetUpdating() bool
	SetUpdating(bool)
	GetJoined() bool
	SetJoined(bool)
}

type NodeWithKubeadm

type NodeWithKubeadm interface {
	Execute(stdin io.Reader, cmd string) ([]byte, error)
}

Directories

Path Synopsis
Package kubernetesmock is a generated GoMock package.
Package kubernetesmock is a generated GoMock package.
job
pdb

Jump to

Keyboard shortcuts

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