Documentation ¶
Overview ¶
Package runtime defines the interface of a cluster operation and providers a register method.
Index ¶
- Variables
- func ListClusters(workdir string) ([]string, error)
- type BuildRuntime
- type Cluster
- func (c *Cluster) AuditLogs(ctx context.Context, out io.Writer) error
- func (c *Cluster) AuditLogsFollow(ctx context.Context, out io.Writer) error
- func (c *Cluster) Config(ctx context.Context) (*internalversion.KwokctlConfiguration, error)
- func (c *Cluster) GetBinPath(name string) string
- func (c *Cluster) GetComponent(ctx context.Context, name string) (internalversion.Component, error)
- func (c *Cluster) GetLogPath(name string) string
- func (c *Cluster) GetWorkdirPath(name string) string
- func (c *Cluster) InHostKubeconfig() (string, error)
- func (c *Cluster) Install(ctx context.Context) error
- func (c *Cluster) Kubectl(ctx context.Context, stm exec.IOStreams, args ...string) error
- func (c *Cluster) KubectlInCluster(ctx context.Context, stm exec.IOStreams, args ...string) error
- func (c *Cluster) Load(ctx context.Context) (*internalversion.KwokctlConfiguration, error)
- func (c *Cluster) Name() string
- func (c *Cluster) Ready(ctx context.Context) (bool, error)
- func (c *Cluster) Save(ctx context.Context) error
- func (c *Cluster) SetConfig(ctx context.Context, conf *internalversion.KwokctlConfiguration) error
- func (c *Cluster) Uninstall(ctx context.Context) error
- func (c *Cluster) WaitReady(ctx context.Context, timeout time.Duration) error
- func (c *Cluster) Workdir() string
- type Registry
- type Runtime
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ConfigName = consts.ConfigName InHostKubeconfigName = "kubeconfig.yaml" InClusterKubeconfigName = "kubeconfig" EtcdDataDirName = "etcd" PkiName = "pki" ComposeName = "docker-compose.yaml" Prometheus = "prometheus.yaml" KindName = "kind.yaml" KwokPod = "kwok-controller-pod.yaml" PrometheusDeploy = "prometheus-deployment.yaml" AuditPolicyName = "audit.yaml" AuditLogName = "audit.log" SchedulerConfigName = "scheduler.yaml" )
View Source
var DefaultRegistry = NewRegistry()
View Source
var (
ErrComponentNotFound = fmt.Errorf("component not found")
)
Functions ¶
func ListClusters ¶
ListClusters returns the list of clusters in the directory
Types ¶
type BuildRuntime ¶
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
func NewCluster ¶
func (*Cluster) AuditLogsFollow ¶
func (*Cluster) Config ¶
func (c *Cluster) Config(ctx context.Context) (*internalversion.KwokctlConfiguration, error)
func (*Cluster) GetBinPath ¶ added in v0.1.0
func (*Cluster) GetComponent ¶ added in v0.1.0
func (*Cluster) GetLogPath ¶ added in v0.1.0
func (*Cluster) GetWorkdirPath ¶ added in v0.1.0
func (*Cluster) InHostKubeconfig ¶
func (*Cluster) KubectlInCluster ¶
func (*Cluster) Load ¶
func (c *Cluster) Load(ctx context.Context) (*internalversion.KwokctlConfiguration, error)
func (*Cluster) SetConfig ¶ added in v0.1.0
func (c *Cluster) SetConfig(ctx context.Context, conf *internalversion.KwokctlConfiguration) error
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func NewRegistry() *Registry
func (*Registry) Register ¶
func (r *Registry) Register(name string, buildRuntime BuildRuntime)
Register a runtime
type Runtime ¶
type Runtime interface { // SetConfig sets the config of cluster SetConfig(ctx context.Context, conf *internalversion.KwokctlConfiguration) error // Save the config of cluster Save(ctx context.Context) error // Config return the config of cluster Config(ctx context.Context) (*internalversion.KwokctlConfiguration, error) // Install the cluster Install(ctx context.Context) error // Uninstall the cluster Uninstall(ctx context.Context) error // Up start the cluster Up(ctx context.Context) error // Down stop the cluster Down(ctx context.Context) error // Start a cluster Start(ctx context.Context) error // Stop a cluster Stop(ctx context.Context) error // StartComponent start cluster component StartComponent(ctx context.Context, name string) error // StopComponent stop cluster component StopComponent(ctx context.Context, name string) error // GetComponent return the component if it exists GetComponent(ctx context.Context, name string) (internalversion.Component, error) // Ready check the cluster is ready Ready(ctx context.Context) (bool, error) // WaitReady wait the cluster is ready WaitReady(ctx context.Context, timeout time.Duration) error // InHostKubeconfig return the kubeconfig in host InHostKubeconfig() (string, error) // Kubectl command Kubectl(ctx context.Context, stm exec.IOStreams, args ...string) error // KubectlInCluster command in cluster KubectlInCluster(ctx context.Context, stm exec.IOStreams, args ...string) error // EtcdctlInCluster command in cluster EtcdctlInCluster(ctx context.Context, stm exec.IOStreams, args ...string) error // Logs logs of a component Logs(ctx context.Context, name string, out io.Writer) error // LogsFollow follow logs of a component with follow LogsFollow(ctx context.Context, name string, out io.Writer) error // AuditLogs audit logs of apiserver AuditLogs(ctx context.Context, out io.Writer) error // AuditLogsFollow follow audit logs of apiserver AuditLogsFollow(ctx context.Context, out io.Writer) error // ListBinaries list binaries in the cluster ListBinaries(ctx context.Context) ([]string, error) // ListImages list images in the cluster ListImages(ctx context.Context) ([]string, error) // SnapshotSave save the snapshot of cluster SnapshotSave(ctx context.Context, path string) error // SnapshotRestore restore the snapshot of cluster SnapshotRestore(ctx context.Context, path string) error }
Directories ¶
Path | Synopsis |
---|---|
Package binary implements the runtime.Runtime interface using the binaries.
|
Package binary implements the runtime.Runtime interface using the binaries. |
Package compose implements the runtime.Runtime interface using the image with compose file.
|
Package compose implements the runtime.Runtime interface using the image with compose file. |
Click to show internal directories.
Click to hide internal directories.