Documentation ¶
Index ¶
- Constants
- Variables
- type API
- func (k *API) Cancel()
- func (k *API) CreatePod(ctx context.Context, desc *PodDescriptor) error
- func (k *API) Decode(template string) (*PodDescriptor, error)
- func (k *API) DeletePod(ctx context.Context, name string) error
- func (k *API) PodStatus(name string) (PodInfo, error)
- func (k *API) ServerVersion() (*version.Info, error)
- type EventHandler
- type EventType
- type Factory
- type ForwardPort
- type JWTSession
- type Manager
- type PodDescriptor
- type PodInfo
- type PodKindError
- type PodParameters
- type PodPhase
- type PodProxy
Constants ¶
View Source
const ( // PodPending means the pod has been accepted by the system, but one or more of the containers // has not been started. This includes time before being bound to a node, as well as time spent // pulling images onto the host. PodPending PodPhase = PodPhase(v1.PodPending) // PodRunning means the pod has been bound to a node and all of the containers have been started. // At least one container is still running or is in the process of being restarted. PodRunning PodPhase = PodPhase(v1.PodRunning) // PodSucceeded means that all containers in the pod have voluntarily terminated // with a container exit code of 0, and the system is not going to restart any of these containers. PodSucceeded PodPhase = PodPhase(v1.PodSucceeded) // PodFailed means that all containers in the pod have terminated, and at least one container has // terminated in a failure (exited with a non-zero exit code or was stopped by the system). PodFailed PodPhase = PodPhase(v1.PodFailed) // PodUnknown means that for some reason the state of the pod could not be obtained, typically due // to an error in communicating with the host of the pod. PodUnknown PodPhase = PodPhase(v1.PodUnknown) Added EventType = EventType(watch.Added) Modified EventType = EventType(watch.Modified) Deleted EventType = EventType(watch.Deleted) Bookmark EventType = EventType(watch.Bookmark) Error EventType = EventType(watch.Error) // Maximum number of retries por handler MaxRetries = 3 )
View Source
const (
BUFFER_POOL_SIZE = 32 * 1024 // Same as default pool size for httputil.ReverseProxy
)
Variables ¶
View Source
var CacheSyncError = errors.New("Failed to synchronize cache")
View Source
var ErrorFactoryCancelled = errors.New("PodFactory is being cancelled")
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct { Logger *log.Logger KubeconfigPath string Namespace string // contains filtered or unexported fields }
API encapsulates calls to Kubernetes API
func Loop ¶
func Loop(logger *log.Logger, namespace string, handler EventHandler, threads int, labels map[string]string) (*API, error)
Loop tries to build API by autodiscovering cluster and namespace
func (*API) CreatePod ¶
func (k *API) CreatePod(ctx context.Context, desc *PodDescriptor) error
CreatePod with given PodDescriptor
func (*API) Decode ¶
func (k *API) Decode(template string) (*PodDescriptor, error)
Decode reads the yaml descriptor for a pod
type EventHandler ¶
EventHandler manages events
type Factory ¶
type Factory struct { // Keeper must be at the top of the struct for atomic calls clock.Keeper Logger *log.Logger Template *template.Template Lifetime time.Duration ForwardPort PrefixPort map[string]ForwardPort // Additional ports for custom path prefixes ForwardedProto string BufferPool sync.Pool SessionCookie string Labels map[string]string // contains filtered or unexported fields }
func NewFactory ¶
func NewFactory(logger *log.Logger, tmpl *template.Template, lifetime time.Duration, defaultPort ForwardPort, prefixPort map[string]ForwardPort, forwardedProto string, sessionCookie string, labels map[string]string) *Factory
NewFactory creates a Factory for Managers
type ForwardPort ¶ added in v0.3.8
ForwardPort defines scheme and port for proxied pod
type JWTSession ¶
JWTSession returns a JWT token and expiration time
type Manager ¶
type Manager struct { // Timestamp of last update to be used by PodFactory. // Must be at the top of the struct for atomic ops to work. Timestamp clock.AtomicTimestamp Logger *log.Logger Descriptor *PodDescriptor // Scheme and port of the backend server to proxy to. // The IP address will be learnt from the kube cluster. ForwardPort PrefixPort map[string]ForwardPort // Additional ports for custom path prefixes ForwardedProto string Pool httputil.BufferPool // latest status detected and resulting reverse proxy SessionCookie string // contains filtered or unexported fields }
Manager handles the suscription to a pod's events
type PodDescriptor ¶
PodDescriptor is an alias to avoid having to import the v1 apis in other files.
type PodKindError ¶
type PodKindError string
PodKindError raised when received event for an object which is not a pod.
func (PodKindError) Error ¶
func (err PodKindError) Error() string
type PodParameters ¶
PodParameters are the parameters for the pod template
type PodProxy ¶
type PodProxy struct {
// contains filtered or unexported fields
}
func (*PodProxy) CurrentSession ¶
func (p *PodProxy) CurrentSession(session JWTSession)
CurrentSession resets the auth Session
Click to show internal directories.
Click to hide internal directories.