probe

package
v0.0.0-...-c5b7aba Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: UPL-1.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CoherenceProbe

type CoherenceProbe struct {
	Client client.Client
	Config *rest.Config
	// contains filtered or unexported fields
}

func (*CoherenceProbe) ExecuteProbe

func (in *CoherenceProbe) ExecuteProbe(ctx context.Context, sts *appsv1.StatefulSet, probe *coh.Probe) bool

func (*CoherenceProbe) ExecuteProbeForSubSetOfPods

func (in *CoherenceProbe) ExecuteProbeForSubSetOfPods(ctx context.Context, sts *appsv1.StatefulSet, probe *coh.Probe, stsPods, pods corev1.PodList) bool

func (*CoherenceProbe) GetPodHostName

func (in *CoherenceProbe) GetPodHostName(pod corev1.Pod) string

func (*CoherenceProbe) GetPodsForStatefulSet

func (in *CoherenceProbe) GetPodsForStatefulSet(ctx context.Context, sts *appsv1.StatefulSet) (corev1.PodList, error)

func (*CoherenceProbe) IsPodReady

func (in *CoherenceProbe) IsPodReady(pod corev1.Pod) (bool, string)

IsPodReady determines whether the specified Pods are in the Ready state.

func (*CoherenceProbe) IsStatusHA

func (in *CoherenceProbe) IsStatusHA(ctx context.Context, deployment coh.CoherenceResource, sts *appsv1.StatefulSet) bool

IsStatusHA will return true if the deployment represented by the deployment is StatusHA. The number of Pods matching the StatefulSet selector must match the StatefulSet replica count ALl Pods must be in the ready state All Pods must pass the StatusHA check

func (*CoherenceProbe) ProbeUsingExec

func (in *CoherenceProbe) ProbeUsingExec(ctx context.Context, pod corev1.Pod, handler *coh.Probe) (bool, error)

func (*CoherenceProbe) ProbeUsingHTTP

func (in *CoherenceProbe) ProbeUsingHTTP(pod corev1.Pod, handler *coh.Probe) (bool, error)

func (*CoherenceProbe) ProbeUsingTCP

func (in *CoherenceProbe) ProbeUsingTCP(pod corev1.Pod, handler *coh.Probe) (bool, error)

func (*CoherenceProbe) RunProbe

func (in *CoherenceProbe) RunProbe(ctx context.Context, pod corev1.Pod, handler *coh.Probe) (bool, error)

func (*CoherenceProbe) SetGetPodHostName

func (in *CoherenceProbe) SetGetPodHostName(fn func(pod corev1.Pod) string)

func (*CoherenceProbe) SetTranslatePort

func (in *CoherenceProbe) SetTranslatePort(fn func(name string, port int) int)

func (*CoherenceProbe) SuspendServices

func (in *CoherenceProbe) SuspendServices(ctx context.Context, deployment coh.CoherenceResource, sts *appsv1.StatefulSet) ServiceSuspendStatus

SuspendServices will request services be suspended in the Coherence cluster. This is called prior to stopping a StatefulSet to then have a graceful shutdown. The number of Pods matching the StatefulSet selector must match the StatefulSet replica count ALl Pods must be in the ready state All Pods must pass the StatusHA check

func (*CoherenceProbe) TranslatePort

func (in *CoherenceProbe) TranslatePort(name string, port int) int

type GetHTTPInterface

type GetHTTPInterface interface {
	Do(req *http.Request) (*http.Response, error)
}

GetHTTPInterface is an interface for making HTTP requests, that returns a response and error.

type HTTPProbe

type HTTPProbe interface {
	Probe(url *url.URL, headers http.Header, timeout time.Duration) (Result, string, error)
}

HTTPProbe is an interface that defines the Probe function for doing HTTP readiness/liveness checks.

func NewHTTPProbe

func NewHTTPProbe() HTTPProbe

NewHTTPProbe creates Probe that will skip TLS verification while probing.

func NewHTTPProbeWithTLSConfig

func NewHTTPProbeWithTLSConfig(config *tls.Config) HTTPProbe

NewHTTPProbeWithTLSConfig takes tls config as parameter.

type Result

type Result string

Result is a string used to handle the results for probing container readiness/livenss

const (
	// Success Result
	Success Result = "success"
	// Failure Result
	Failure Result = "failure"
	// Unknown Result
	Unknown Result = "unknown"
)

func DoHTTPProbe

func DoHTTPProbe(url *url.URL, headers http.Header, client GetHTTPInterface) (Result, string, error)

DoHTTPProbe checks if a GET request to the url succeeds. If the HTTP response code is successful (i.e. 400 > code >= 200), it returns Success. If the HTTP response code is unsuccessful or HTTP communication fails, it returns Failure. This is exported because some other packages may want to do direct HTTP probes.

func DoTCPProbe

func DoTCPProbe(addr string, timeout time.Duration) (Result, string, error)

DoTCPProbe checks that a TCP socket to the address can be opened. If the socket can be opened, it returns Success If the socket fails to open, it returns Failure. This is exported because some other packages may want to do direct TCP probes.

type ServiceSuspendStatus

type ServiceSuspendStatus int
const (
	ServiceSuspendSkipped    ServiceSuspendStatus = iota // == 0
	ServiceSuspendSuccessful ServiceSuspendStatus = iota // == 1
	ServiceSuspendFailed     ServiceSuspendStatus = iota // == 2
)

type TCPProbe

type TCPProbe interface {
	Probe(host string, port int, timeout time.Duration) (Result, string, error)
}

TCPProbe is an interface that defines the Probe function for doing TCP readiness/liveness checks.

func NewTCPProbe

func NewTCPProbe() TCPProbe

NewTCPProbe creates TCPProbe.

Jump to

Keyboard shortcuts

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