Documentation ¶
Index ¶
- func ConfigK8s(ctx context.Context, namespace string, name string) (values map[string]string, err kv.Error)
- func InitiateK8s(ctx context.Context, namespace string, cfgMap string, readyC chan struct{}, ...)
- func IsAliveK8s() (err kv.Error)
- func K8sUpdateSecret(config string, secret string, content []byte) (err kv.Error)
- func ListenK8s(ctx context.Context, namespace string, globalMap string, podMap string, ...) (err kv.Error)
- func ListenK8sConfigMaps(ctx context.Context, namespace string, updateC chan<- K8sConfigUpdate, ...) (err kv.Error)
- func MonitorK8s(ctx context.Context, errC chan<- kv.Error)
- func StartTelemetry(ctx context.Context, logger *log.Logger, nodeName string, serviceName string, ...) (newCtx context.Context, err kv.Error)
- type ConfigListeners
- type K8sConfigUpdate
- type K8sStateUpdate
- type Resource
- type Resources
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigK8s ¶
func ConfigK8s(ctx context.Context, namespace string, name string) (values map[string]string, err kv.Error)
ConfigK8s is used to pull the values from a named config map in k8s
This function will return an empty map and and error value on failure.
func InitiateK8s ¶
func InitiateK8s(ctx context.Context, namespace string, cfgMap string, readyC chan struct{}, staleMsg time.Duration, logger *log.Logger, errorC chan kv.Error)
initiateK8s runs until either ctx is Done or the listener is running successfully
func IsAliveK8s ¶
IsAliveK8s is used to extract any kv.in the state of the k8s client api connection.
A nil returned indicates k8s is working and in use, otherwise a descriptive error is returned.
func K8sUpdateSecret ¶
func ListenK8s ¶
func ListenK8s(ctx context.Context, namespace string, globalMap string, podMap string, updateC chan<- K8sStateUpdate, errC chan<- kv.Error, logger *log.Logger) (err kv.Error)
ListenK8s will register a listener to watch for pod specific configMaps in k8s and will relay state changes to a channel, the global state map should exist at the bare minimum. A state change in either map superseded any previous state.
This is a blocking function that will return either upon an error in API calls to the cluster API or when the ctx is Done().
func ListenK8sConfigMaps ¶ added in v0.0.3
func ListenK8sConfigMaps(ctx context.Context, namespace string, updateC chan<- K8sConfigUpdate, errC chan<- kv.Error, logger *log.Logger) (err kv.Error)
ListenK8sConfigMaps will register a listener to watch for k8s config maps updates in a specified namespace and will relay these changes to a channel.
This is a blocking function that will return either upon an error in API calls to the cluster API or when the ctx is Done().
func MonitorK8s ¶
MonitorK8s is used to send appropriate errors into an error reporting channel on a regular basis if the k8s connectivity state changes
Types ¶
type ConfigListeners ¶ added in v0.0.3
type ConfigListeners struct { Master chan K8sConfigUpdate sync.Mutex // contains filtered or unexported fields }
ConfigListeners are used to handle the broadcasting of cluster events when Kubernetes is being used
func K8sConfigUpdates ¶ added in v0.0.3
func K8sConfigUpdates() (l *ConfigListeners)
func NewConfigBroadcast ¶ added in v0.0.3
func NewConfigBroadcast(ctx context.Context, errorC chan<- kv.Error) (l *ConfigListeners)
NewConfigBroadcast is used to instantiate a Kubernetes config maps update broadcaster
func (*ConfigListeners) Add ¶ added in v0.0.3
func (l *ConfigListeners) Add(listen chan<- K8sConfigUpdate) (id xid.ID, err kv.Error)
Add is used when a running thread wishes to add a channel to the broadcaster on which Kubernetes config maps updates will be received
func (*ConfigListeners) Delete ¶ added in v0.0.3
func (l *ConfigListeners) Delete(id xid.ID)
Delete is used when a running thread wishes to drop a channel from the broadcaster on which Kubernetes events will be received
type K8sConfigUpdate ¶ added in v0.0.3
K8sConfigUpdate encapsulates an update for some config map in the scope of server run-time environment.
type K8sStateUpdate ¶
K8sStateUpdate encapsulates the known kubernetes state within which the server finds itself.
type Resource ¶
type Resource struct { Cpus uint `json:"cpus"` Gpus uint `json:"gpus"` Hdd string `json:"hdd"` Ram string `json:"ram"` GpuMem string `json:"gpuMem"` GpuCount uint `json:"gpuCount"` }
Resource describes the needed resources for a runner task in a data structure that can be marshalled as json
type Resources ¶
type Resources struct{}
Resources is a receiver for resource related methods used to describe machine level capabilities
func (*Resources) FetchMachineResources ¶
FetchMachineResources extracts the current system state in terms of memory etc and coverts this into the resource specification used to pass machine characteristics around.