k8sutil

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2017 License: Apache-2.0 Imports: 32 Imported by: 348

Documentation

Index

Constants

View Source
const (
	BackupPodSelectorAppField = "etcd_backup_tool"

	PVBackupV1 = "v1" // TODO: refactor and combine this with pkg/backup.PVBackupV1
)

Variables

View Source
var BackupImage = "quay.io/coreos/etcd-operator:latest"

Functions

func AddRecoveryToPod

func AddRecoveryToPod(pod *v1.Pod, clusterName, token string, m *etcdutil.Member, cs spec.ClusterSpec)

func AtomicUpdateClusterTPRObject added in v0.2.6

func AtomicUpdateClusterTPRObject(restcli rest.Interface, name, namespace string, maxRetries int, updateFunc ClusterTPRUpdateFunc) (*spec.Cluster, error)

AtomicUpdateClusterTPRObject will get the latest result of a cluster, let user modify it, and update the cluster with modified result The entire process would be retried if there is a conflict of resource version

func AttachOperatorS3ToPodSpec added in v0.3.0

func AttachOperatorS3ToPodSpec(ps *v1.PodSpec, s3Ctx s3config.S3Context)

func AttachS3ToPodSpec added in v0.3.0

func AttachS3ToPodSpec(ps *v1.PodSpec, ss spec.S3Source)

func BackupServiceAddr added in v0.2.1

func BackupServiceAddr(clusterName string) string

func BackupSidecarLabels added in v0.2.6

func BackupSidecarLabels(clusterName string) map[string]string

func BackupSidecarName added in v0.2.6

func BackupSidecarName(clusterName string) string

func CascadeDeleteOptions added in v0.3.1

func CascadeDeleteOptions(gracePeriodSeconds int64) *metav1.DeleteOptions

func ClientServiceName added in v0.2.5

func ClientServiceName(clusterName string) string

func ClonePod added in v0.2.5

func ClonePod(p *v1.Pod) *v1.Pod

func ClusterListOpt added in v0.2.0

func ClusterListOpt(clusterName string) metav1.ListOptions

We are using internal api types for cluster related.

func CopyVolume added in v0.2.0

func CopyVolume(kubecli kubernetes.Interface, fromClusterName, toClusterName, ns string) error

func CreateAndWaitPVC added in v0.2.0

func CreateAndWaitPVC(kubecli kubernetes.Interface, clusterName, ns, pvProvisioner string, volumeSizeInMB int) error

func CreateAndWaitPod

func CreateAndWaitPod(kubecli kubernetes.Interface, ns string, pod *v1.Pod, timeout time.Duration) (*v1.Pod, error)

CreateAndWaitPod is a workaround for self hosted and util for testing. We should eventually get rid of this in critical code path and move it to test util.

func CreateClientService added in v0.2.5

func CreateClientService(kubecli kubernetes.Interface, clusterName, ns string, owner metav1.OwnerReference) error

func CreatePatch added in v0.2.5

func CreatePatch(o, n, datastruct interface{}) ([]byte, error)

func CreatePeerService added in v0.2.5

func CreatePeerService(kubecli kubernetes.Interface, clusterName, ns string, owner metav1.OwnerReference) error

func CreateStorageClass

func CreateStorageClass(kubecli kubernetes.Interface, pvProvisioner string) error

func DeletePVC added in v0.2.0

func DeletePVC(kubecli kubernetes.Interface, clusterName, ns string) error

func EtcdImageName added in v0.2.1

func EtcdImageName(version string) string

func GetClusterList added in v0.2.0

func GetClusterList(restcli rest.Interface, ns string) (*spec.ClusterList, error)

func GetClusterTPRObject added in v0.2.0

func GetClusterTPRObject(restcli rest.Interface, ns, name string) (*spec.Cluster, error)

func GetEtcdVersion

func GetEtcdVersion(pod *v1.Pod) string

func GetPodNames

func GetPodNames(pods []*v1.Pod) []string

func InClusterConfig added in v0.2.2

func InClusterConfig() (*rest.Config, error)

func IsKubernetesResourceAlreadyExistError

func IsKubernetesResourceAlreadyExistError(err error) bool

func IsKubernetesResourceNotFoundError

func IsKubernetesResourceNotFoundError(err error) bool

func LabelsForCluster added in v0.2.6

func LabelsForCluster(clusterName string) map[string]string

func MustNewKubeClient added in v0.2.1

func MustNewKubeClient() kubernetes.Interface

func NewBackupDeploymentManifest added in v0.2.6

func NewBackupDeploymentManifest(name string, dplSel map[string]string, pl v1.PodTemplateSpec, owner metav1.OwnerReference) *appsv1beta1.Deployment

func NewBackupPodTemplate added in v0.2.6

func NewBackupPodTemplate(clusterName, account string, sp spec.ClusterSpec) v1.PodTemplateSpec

func NewBackupServiceManifest added in v0.2.0

func NewBackupServiceManifest(clusterName string, owner metav1.OwnerReference) *v1.Service

func NewEtcdPod added in v0.2.1

func NewEtcdPod(m *etcdutil.Member, initialCluster []string, clusterName, state, token string, cs spec.ClusterSpec, owner metav1.OwnerReference) *v1.Pod

func NewSelfHostedEtcdPod added in v0.2.1

func NewSelfHostedEtcdPod(m *etcdutil.Member, initialCluster, endpoints []string, clusterName, state, token string, cs spec.ClusterSpec, owner metav1.OwnerReference) *v1.Pod

func NewTPRClient added in v0.2.1

func NewTPRClient() (*rest.RESTClient, error)

func PatchDeployment added in v0.3.0

func PatchDeployment(kubecli kubernetes.Interface, namespace, name string, updateFunc func(*appsv1beta1.Deployment)) error

func PodSpecWithPV added in v0.2.0

func PodSpecWithPV(ps *v1.PodSpec, clusterName string)

func PodWithAntiAffinity added in v0.2.0

func PodWithAntiAffinity(pod *v1.Pod, clusterName string) *v1.Pod

func PodWithNodeSelector

func PodWithNodeSelector(p *v1.Pod, ns map[string]string) *v1.Pod

func SetEtcdVersion

func SetEtcdVersion(pod *v1.Pod, version string)

func UpdateClusterTPRObject added in v0.2.0

func UpdateClusterTPRObject(restcli rest.Interface, ns string, c *spec.Cluster) (*spec.Cluster, error)

func WaitEtcdTPRReady

func WaitEtcdTPRReady(restcli rest.Interface, interval, timeout time.Duration, ns string) error

func WatchClusters added in v0.2.0

func WatchClusters(host, ns string, httpClient *http.Client, resourceVersion string) (*http.Response, error)

Types

type ClusterTPRUpdateFunc added in v0.2.6

type ClusterTPRUpdateFunc func(*spec.Cluster)

ClusterTPRUpdateFunc is a function to be used when atomically updating a Cluster TPR.

type TLSData added in v0.2.6

type TLSData struct {
	CertData []byte
	KeyData  []byte
	CAData   []byte
}

func GetTLSDataFromSecret added in v0.2.6

func GetTLSDataFromSecret(kubecli kubernetes.Interface, ns, se string) (*TLSData, error)

Directories

Path Synopsis
Package election implements leader election of a set of endpoints.
Package election implements leader election of a set of endpoints.

Jump to

Keyboard shortcuts

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