Documentation
¶
Overview ¶
Package runtime defines the interface of a cluster operation and providers a register method.
Index ¶
- Variables
- func ExpandVolumesHostPaths(volumes []internalversion.Volume) ([]internalversion.Volume, error)
- func GetComponentPatches(conf *internalversion.KwokctlConfiguration, componentName string) internalversion.ComponentPatches
- func GetLogVolumes(ctx context.Context) ([]internalversion.Volume, error)
- 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) Install(ctx context.Context) error
- func (c *Cluster) Kubectl(ctx context.Context, args ...string) error
- func (c *Cluster) KubectlInCluster(ctx context.Context, 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) SnapshotRestoreWithYAML(ctx context.Context, path string, filters []string) error
- func (c *Cluster) SnapshotSaveWithYAML(ctx context.Context, path string, filters []string) 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 ¶
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" )
The following functions are used to get the path of the cluster
var DefaultRegistry = NewRegistry()
DefaultRegistry is the default registry
var ( // ErrComponentNotFound is returned when a component is not found ErrComponentNotFound = fmt.Errorf("component not found") )
Functions ¶
func ExpandVolumesHostPaths ¶ added in v0.2.0
func ExpandVolumesHostPaths(volumes []internalversion.Volume) ([]internalversion.Volume, error)
ExpandVolumesHostPaths expands relative paths specified in volumes to absolute paths
func GetComponentPatches ¶ added in v0.2.0
func GetComponentPatches(conf *internalversion.KwokctlConfiguration, componentName string) internalversion.ComponentPatches
GetComponentPatches returns the patches for a component.
func GetLogVolumes ¶ added in v0.2.0
func GetLogVolumes(ctx context.Context) ([]internalversion.Volume, error)
GetLogVolumes returns volumes for Logs and ClusterLogs resource.
func ListClusters ¶
ListClusters returns the list of clusters in the directory
Types ¶
type BuildRuntime ¶
BuildRuntime is a function to build a runtime
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
Cluster is the cluster
func (*Cluster) AuditLogsFollow ¶
AuditLogsFollow follows the audit logs of the cluster.
func (*Cluster) Config ¶
func (c *Cluster) Config(ctx context.Context) (*internalversion.KwokctlConfiguration, error)
Config returns the cluster config
func (*Cluster) GetBinPath ¶ added in v0.1.0
GetBinPath returns the path to the given binary name.
func (*Cluster) GetComponent ¶ added in v0.1.0
GetComponent returns the component by name
func (*Cluster) GetLogPath ¶ added in v0.1.0
GetLogPath returns the path of the given log name.
func (*Cluster) GetWorkdirPath ¶ added in v0.1.0
GetWorkdirPath returns the path to the file in the workdir.
func (*Cluster) KubectlInCluster ¶
KubectlInCluster runs kubectl in the cluster.
func (*Cluster) Load ¶
func (c *Cluster) Load(ctx context.Context) (*internalversion.KwokctlConfiguration, error)
Load loads the cluster config
func (*Cluster) SetConfig ¶ added in v0.1.0
func (c *Cluster) SetConfig(ctx context.Context, conf *internalversion.KwokctlConfiguration) error
SetConfig sets the cluster config
func (*Cluster) SnapshotRestoreWithYAML ¶ added in v0.2.0
SnapshotRestoreWithYAML restore the snapshot of cluster
func (*Cluster) SnapshotSaveWithYAML ¶ added in v0.2.0
SnapshotSaveWithYAML save the snapshot of cluster
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is a registry of runtime
func (*Registry) Register ¶
func (r *Registry) Register(name string, buildRuntime BuildRuntime)
Register a runtime
type Runtime ¶
type Runtime interface { // Available checks whether the runtime is available. Available(ctx context.Context) error // 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 // AddContext add the context of cluster to kubeconfig AddContext(ctx context.Context, kubeconfigPath string) error // RemoveContext remove the context of cluster from kubeconfig RemoveContext(ctx context.Context, kubeconfigPath string) error // Kubectl command Kubectl(ctx context.Context, args ...string) error // KubectlInCluster command in cluster KubectlInCluster(ctx context.Context, args ...string) error // EtcdctlInCluster command in cluster EtcdctlInCluster(ctx context.Context, 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 // SnapshotSaveWithYAML save the snapshot of cluster SnapshotSaveWithYAML(ctx context.Context, path string, filters []string) error // SnapshotRestoreWithYAML restore the snapshot of cluster SnapshotRestoreWithYAML(ctx context.Context, path string, filters []string) error }
Runtime is the interface for a runtime.
Source Files
¶
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. |
Package kind implements the runtime.Runtime interface using the kind.
|
Package kind implements the runtime.Runtime interface using the kind. |