k8s

package
v0.2.11 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToConsulCheck

func ConvertToConsulCheck(probe *corev1.Probe, host string) *consul.Check

ConvertToConsulCheck converts Kubernetes probe definition to Consul check definition.

func Find added in v0.1.30

func Find(slice []string, val string) bool

Find takes a slice and looks for an element in it. If found it will return it's key, otherwise it will return -1 and a bool of false.

Types

type Client

type Client interface {
	// GetPod returns current pod data.
	GetPod(ctx context.Context, podNamespace string, podName string) (*corev1.Pod, error)
	// GetFailureDomainTags returns current failure domain for pod
	GetFailureDomainTags(ctx context.Context, pod *corev1.Pod) ([]string, error)
	// DoProbeCheck check if service is alive
	DoProbeCheck(pod *corev1.Probe, ip string) error
}

Client is an interface for client to Kubernetes API.

type ServiceProvider

type ServiceProvider struct {
	Client             Client
	Timeout            time.Duration
	HealthCheckTimeout time.Duration
}

ServiceProvider is responsible for providing services that should be registered in Consul discovery service.

func (*ServiceProvider) CheckProbe added in v0.2.3

func (p *ServiceProvider) CheckProbe(ctx context.Context) error

func (*ServiceProvider) GenerateSecured added in v0.1.30

func (p *ServiceProvider) GenerateSecured(ctx context.Context, services []consul.ServiceInstance) []consul.ServiceInstance

GenerateSecured generates list of postfixed Consul services for deregistration

func (*ServiceProvider) Get

Get returns slice of services that are configured to be registered in Consul discovery service.

func (*ServiceProvider) IsPodTerminating added in v0.2.9

func (p *ServiceProvider) IsPodTerminating(ctx context.Context) (bool, error)

Jump to

Keyboard shortcuts

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