Documentation
¶
Index ¶
- Constants
- Variables
- func CreateOrUpdateAnnotated(ctx context.Context, c client.Client, obj client.Object, f MutateFn) (upserted bool, err error)
- func ExecInPod(scheme *runtime.Scheme, config *rest.Config, namespace string, name string, ...) (string, string, error)
- func FindContainer(container string, spec *corev1.PodSpec) (*corev1.Container, error)
- func GeContainerStatusFromList(containerStatuses []corev1.ContainerStatus, image string) (int, *corev1.ContainerStatus)
- func Get(ctx context.Context, cl client.Client, obj client.Object) error
- func GetClusterCA(ctx context.Context, config *rest.Config) ([]byte, error)
- func GetContainerStatus(status *corev1.PodStatus, image string) (int, *corev1.ContainerStatus)
- func GetPodCondition(status *corev1.PodStatus, conditionType corev1.PodConditionType) (int, *corev1.PodCondition)
- func GetPodConditionFromList(conditions []corev1.PodCondition, conditionType corev1.PodConditionType) (int, *corev1.PodCondition)
- func GetPodReadyCondition(status corev1.PodStatus) *corev1.PodCondition
- func HandleStsError(err error, l logr.Logger, stsName string, ns string) error
- func IsImagePullBackOff(pod *corev1.Pod, image string) bool
- func IsPodReady(pod *corev1.Pod) bool
- func IsPodReadyConditionTrue(status corev1.PodStatus) bool
- func WaitUntilAllStsPodsAreReady(ctx context.Context, clientset *kubernetes.Clientset, l logr.Logger, ...) error
- type KubernetesDistribution
- type MutateFn
- type PersistFn
- type PodDialer
Constants ¶
const LastAppliedAnnotation = "crdb.io/last-applied"
Variables ¶
var IgnoreNotFound = client.IgnoreNotFound
var IsNotFound = apierrors.IsNotFound
Functions ¶
func CreateOrUpdateAnnotated ¶
func FindContainer ¶
func GeContainerStatusFromList ¶
func GeContainerStatusFromList(containerStatuses []corev1.ContainerStatus, image string) (int, *corev1.ContainerStatus)
GeContainerStatusFromList extracts the provided container status from the given list of condition and returns the index of the condition and the condition. Returns -1 and nil if the containeer status is not present.
func GetContainerStatus ¶
GetContainerStatus extracts the provided container status from the given status and returns that. Returns nil and -1 if the condition is not present, and the index of the located container status.
func GetPodCondition ¶
func GetPodCondition(status *corev1.PodStatus, conditionType corev1.PodConditionType) (int, *corev1.PodCondition)
GetPodCondition extracts the provided condition from the given status and returns that. Returns nil and -1 if the condition is not present, and the index of the located condition.
func GetPodConditionFromList ¶
func GetPodConditionFromList(conditions []corev1.PodCondition, conditionType corev1.PodConditionType) (int, *corev1.PodCondition)
GetPodConditionFromList extracts the provided condition from the given list of condition and returns the index of the condition and the condition. Returns -1 and nil if the condition is not present.
func GetPodReadyCondition ¶
func GetPodReadyCondition(status corev1.PodStatus) *corev1.PodCondition
GetPodReadyCondition extracts the pod ready condition from the given status and returns that. Returns nil if the condition is not present.
func HandleStsError ¶ added in v1.7.7
func IsImagePullBackOff ¶
IsImagePullBackOff returns true if a container status has the waiting state with reason ImagePullBackOff
func IsPodReady ¶
IsPodReady returns true if a pod is ready; false otherwise.
func IsPodReadyConditionTrue ¶
IsPodReadyConditionTrue returns true if a pod is ready; false otherwise.
func WaitUntilAllStsPodsAreReady ¶ added in v1.7.7
func WaitUntilAllStsPodsAreReady(ctx context.Context, clientset *kubernetes.Clientset, l logr.Logger, stsname, stsnamespace string, podUpdateTimeout, podMaxPollingInterval time.Duration) error
WaitUntilAllStsPodsAreReady waits until all pods in the statefulset are in the ready state. The ready state implies all nodes are passing node liveness.
Types ¶
type KubernetesDistribution ¶ added in v1.7.6
type KubernetesDistribution interface {
Get(ctx context.Context, config *rest.Config, log logr.Logger) (string, error)
}
func MockKubernetesDistribution ¶ added in v1.7.6
func MockKubernetesDistribution() KubernetesDistribution
func NewKubernetesDistribution ¶ added in v1.7.6
func NewKubernetesDistribution() KubernetesDistribution
type MutateFn ¶
type MutateFn func() error
MutateFn is a function which mutates the existing object into it's desired state.
type PersistFn ¶
type PersistFn func(context.Context, client.Client, client.Object, MutateFn) (upserted bool, err error)
var DefaultPersister PersistFn = func(ctx context.Context, cl client.Client, obj client.Object, f MutateFn) (upserted bool, err error) { result, err := ctrl.CreateOrUpdate(ctx, cl, obj, func() error { return f() }) return result == ctrlutil.OperationResultCreated || result == ctrlutil.OperationResultUpdated, err }
type PodDialer ¶
type PodDialer struct { Namespace string Config *rest.Config ClientSet kubernetes.Interface Transport http.RoundTripper Upgrader spdy.Upgrader // contains filtered or unexported fields }
PodDialer uses kubernetes' portforwarding protocol to create a net.Conn to a pod in the given kubernetes clusters
func NewPodDialer ¶
NewPodDialer creates a PodDailer that allows for a database connection to flow through a connection created by a kube-proxy like connection.
func (*PodDialer) Dial ¶
Dial connects to a port in a kubernetes pod specified by addr. network must be TCP Implmentation adapted from:
https://github.com/kubernetes/kubernetes/blob/27c70773add99e43464a4e525e3bddfc8b602a3d/staging/src/k8s.io/client-go/tools/portforward/portforward.go https://github.com/kubernetes/kubernetes/blob/27c70773add99e43464a4e525e3bddfc8b602a3d/staging/src/k8s.io/kubectl/pkg/cmd/portforward/portforward.go