k8sutil

package
v0.0.0-...-9f310f1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2018 License: Apache-2.0 Imports: 21 Imported by: 33

Documentation

Index

Constants

View Source
const (
	VaultClientPort = 8200
)

Variables

View Source
var (
	// VaultConfigPath is the path that vault pod uses to read config from
	VaultConfigPath = "/run/vault/config/vault.hcl"
)

Functions

func AddOwnerRefToObject

func AddOwnerRefToObject(o metav1.Object, r metav1.OwnerReference)

AddOwnerRefToObject appends the desired OwnerReference to the object

func AsOwner

AsOwner returns an owner reference set as the vault cluster CR

func CascadeDeleteBackground

func CascadeDeleteBackground() *metav1.DeleteOptions

CascadeDeleteBackground returns a background delete policy option which causes the garbage collector to delete the dependents in the background.

func ConfigMapNameForVault

func ConfigMapNameForVault(v *api.VaultService) string

ConfigMapNameForVault is the configmap name for the given vault. If ConfigMapName is given is spec, it will make a new name based on that. Otherwise, we will create a default configmap using the Vault's name.

func DeleteEtcdCluster

func DeleteEtcdCluster(etcdCRCli etcdCRClient.Interface, v *api.VaultService) error

DeleteEtcdCluster deletes the etcd cluster for the given vault

func DeployEtcdCluster

func DeployEtcdCluster(etcdCRCli etcdCRClient.Interface, v *api.VaultService) error

DeployEtcdCluster creates an etcd cluster for the given vault's name via etcd operator and waits for all of its members to be ready.

func DeployVault

func DeployVault(kubecli kubernetes.Interface, v *api.VaultService) error

DeployVault deploys a vault service. DeployVault is a multi-steps process. It creates the deployment, the service and other related Kubernetes objects for Vault. Any intermediate step can fail.

DeployVault is idempotent. If an object already exists, this function will ignore creating it and return no error. It is safe to retry on this function.

func DestroyVault

func DestroyVault(kubecli kubernetes.Interface, v *api.VaultService) error

DestroyVault destroys a vault service. TODO: remove this function when CRD GC is enabled.

func EtcdClientTLSSecretName

func EtcdClientTLSSecretName(vaultName string) string

EtcdClientTLSSecretName returns the name of etcd client TLS secret for the given vault name

func EtcdNameForVault

func EtcdNameForVault(name string) string

EtcdNameForVault returns the etcd cluster's name for the given vault's name

func EtcdPeerTLSSecretName

func EtcdPeerTLSSecretName(vaultName string) string

EtcdPeerTLSSecretName returns the name of etcd peer TLS secret for the given vault name

func EtcdServerTLSSecretName

func EtcdServerTLSSecretName(vaultName string) string

EtcdServerTLSSecretName returns the name of etcd server TLS secret for the given vault name

func EtcdURLForVault

func EtcdURLForVault(name string) string

EtcdURLForVault returns the URL to talk to etcd cluster for the given vault's name

func InClusterConfig

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

func IsPodReady

func IsPodReady(p v1.Pod) bool

IsPodReady checks the status of the pod for the Ready condition

func IsVaultVersionMatch

func IsVaultVersionMatch(ps v1.PodSpec, vs api.VaultServiceSpec) bool

func LabelsForVault

func LabelsForVault(name string) map[string]string

LabelsForVault returns the labels for selecting the resources belonging to the given vault name.

func MustNewKubeClient

func MustNewKubeClient() kubernetes.Interface

func MustNewKubeExtClient

func MustNewKubeExtClient() apiextensionsclient.Interface

func PodDNSName

func PodDNSName(p v1.Pod) string

PodDNSName constructs the dns name on which a pod can be addressed

func UpgradeDeployment

func UpgradeDeployment(kubecli kubernetes.Interface, vr *api.VaultService, d *appsv1beta1.Deployment) error

UpgradeDeployment sets deployment spec to: - roll forward version - keep active Vault node available by setting `maxUnavailable=N-1` and `maxSurge=1`

func VaultServiceURL

func VaultServiceURL(name, namespace string, port int) string

VaultServiceURL returns the DNS record of the vault service in the given namespace.

func VaultTLSFromSecret

func VaultTLSFromSecret(kubecli kubernetes.Interface, vr *api.VaultService) (*vaultapi.TLSConfig, error)

VaultTLSFromSecret reads Vault CR's TLS secret and converts it into a vault client's TLS config struct.

Types

This section is empty.

Jump to

Keyboard shortcuts

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