kuberesolver

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2024 License: AGPL-3.0, Apache-2.0 Imports: 17 Imported by: 0

README

kuberesolver

Copied from github.com/sercand/kuberesolver/v5 Removed grpc specific bits

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	IP        string           `json:"ip"`
	TargetRef *ObjectReference `json:"targetRef,omitempty"`
}

type Endpoints

type Endpoints struct {
	Kind       string   `json:"kind"`
	ApiVersion string   `json:"apiVersion"`
	Metadata   Metadata `json:"metadata"`
	Subsets    []Subset `json:"subsets"`
}

type Event

type Event struct {
	Type   EventType `json:"type"`
	Object Endpoints `json:"object"`
}

Event represents a single event to a watched resource.

type EventType

type EventType string
const (
	Added    EventType = "ADDED"
	Modified EventType = "MODIFIED"
	Deleted  EventType = "DELETED"
	Error    EventType = "ERROR"
)

type K8sClient

type K8sClient interface {
	Do(req *http.Request) (*http.Response, error)
	GetRequest(url string) (*http.Request, error)
	Host() string
}

K8sClient is minimal kubernetes client interface

func NewInClusterK8sClient

func NewInClusterK8sClient() (K8sClient, error)

NewInClusterK8sClient creates K8sClient if it is inside Kubernetes

func NewInsecureK8sClient

func NewInsecureK8sClient(apiURL string) K8sClient

NewInsecureK8sClient creates an insecure k8s client which is suitable to connect kubernetes api behind proxy

type KResolver

type KResolver struct {
	// contains filtered or unexported fields
}

func Build

func Build(l log.Logger, k8sClient K8sClient, upd ResolveUpdates, target TargetInfo) (*KResolver, error)

func (*KResolver) Close

func (k *KResolver) Close()

Close closes the resolver.

type Metadata

type Metadata struct {
	Name            string            `json:"name"`
	Namespace       string            `json:"namespace"`
	ResourceVersion string            `json:"resourceVersion"`
	Labels          map[string]string `json:"labels"`
}

type ObjectReference

type ObjectReference struct {
	Kind      string `json:"kind"`
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
}

type Port

type Port struct {
	Name string `json:"name"`
	Port int    `json:"port"`
}

type ResolveUpdates

type ResolveUpdates interface {
	Resolved(e Endpoints)
}

type ResolveUpdatesFunc

type ResolveUpdatesFunc func(e Endpoints)

func (ResolveUpdatesFunc) Resolved

func (f ResolveUpdatesFunc) Resolved(e Endpoints)

type Subset

type Subset struct {
	Addresses []Address `json:"addresses"`
	Ports     []Port    `json:"ports"`
}

type TargetInfo

type TargetInfo struct {
	ServiceName      string
	ServiceNamespace string
}

Jump to

Keyboard shortcuts

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