runtime

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2022 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package runtime implements connectors to various runtimes.

Index

Constants

View Source
const DefaultClient = "default"

DefaultClient defines default client id.

Variables

This section is empty.

Functions

func Install

func Install(name string, runtime Runtime)

Install a runtime singleton for a type.

Types

type Event

type Event struct {
	Spec interface{}
	Kind message.Kind
}

Event runtime event.

type EventUpdate

type EventUpdate struct {
	Old interface{} `json:"old"`
	New interface{} `json:"new"`
}

EventUpdate spec for update event.

type KubeconfigSource added in v0.2.1

type KubeconfigSource interface {
	GetKubeconfig(context.Context, *common.Context) (*rest.Config, error)
}

KubeconfigSource is implemented by runtimes that allow getting kubeconfigs.

type QueryOption

type QueryOption func(*QueryOptions)

QueryOption defines variable input option for List and Get methods in the Runtime implementations.

func WithCluster

func WithCluster(cluster *common.Cluster) QueryOption

WithCluster specifies the cluster to use to get the resource from.

func WithContext

func WithContext(name string) QueryOption

WithContext routes the request to a specific context.

func WithCurrentVersion

func WithCurrentVersion(version string) QueryOption

WithCurrentVersion pass current version to the update call to avoid conflicts (only for update, Theila only).

func WithFieldSelector

func WithFieldSelector(selector string) QueryOption

WithFieldSelector enables filtering by field.

func WithLabelSelector

func WithLabelSelector(selector string) QueryOption

WithLabelSelector enables filtering by label.

func WithName

func WithName(name string) QueryOption

WithName enables filtering by resource name.

func WithNamespace

func WithNamespace(namespace string) QueryOption

WithNamespace enables filtering by namespace.

func WithNodes

func WithNodes(nodes ...string) QueryOption

WithNodes explicitly defines nodes list to use for the request (Talos only).

func WithResource

func WithResource(resource string) QueryOption

WithResource explicitly specifies the resource type to get from the runtime.

type QueryOptions

type QueryOptions struct {
	Cluster        *common.Cluster
	Namespace      string
	Name           string
	Context        string
	Resource       string
	LabelSelector  string
	FieldSelector  string
	CurrentVersion string
	Nodes          []string
}

QueryOptions List and Get query options.

func NewQueryOptions

func NewQueryOptions(setters ...QueryOption) *QueryOptions

NewQueryOptions creates new QueryOptions.

type Resource

type Resource struct {
	Metadata map[string]interface{} `yaml:"metadata" json:"metadata"`
	Spec     map[string]interface{} `yaml:"spec" json:"spec"`
	Resource resource.Resource      `yaml:"-" json:"-"`
	ID       string                 `yaml:"-" json:"-"`
}

Resource wraps Talos and COSI resource response to be encoded as JSON.

func NewResource

func NewResource(m *common.Metadata, r resource.Resource) (*Resource, error)

NewResource creates new resource.

type Runtime

type Runtime interface {
	Watch(context.Context, *message.WatchSpec, chan Event) error
	Get(context.Context, ...QueryOption) (interface{}, error)
	List(context.Context, ...QueryOption) ([]interface{}, error)
	Create(context.Context, cosiresource.Resource, ...QueryOption) error
	Update(context.Context, cosiresource.Resource, ...QueryOption) error
	Delete(context.Context, ...QueryOption) error
	AddContext(string, []byte) error
	GetContext(context.Context, *common.Context, *common.Cluster) ([]byte, error)
}

Runtime is an abstraction for the data access.

func Get

func Get(name string) (Runtime, error)

Get returns runtime for a type.

Directories

Path Synopsis
Package kubernetes implements the connector that can pull data from the Kubernetes control plane.
Package kubernetes implements the connector that can pull data from the Kubernetes control plane.
capi
Package capi contains capi util helpers specific to Theila.
Package capi contains capi util helpers specific to Theila.
Package talos implements the connector that can pull data from the Talos controller runtime.
Package talos implements the connector that can pull data from the Talos controller runtime.
Package theila implements the internal service runtime.
Package theila implements the internal service runtime.
controllers
Package controllers contains all Theila internal COSI runtime controllers.
Package controllers contains all Theila internal COSI runtime controllers.
resources
Package resources defines various internal Theila resources.
Package resources defines various internal Theila resources.

Jump to

Keyboard shortcuts

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