Documentation
¶
Index ¶
- Constants
- type Config
- type Manager
- func (m *Manager) Deploy(ctx context.Context, req workload.DeployRequest) (*workload.DeployResult, error)
- func (m *Manager) HealthCheck(ctx context.Context) error
- func (m *Manager) List(ctx context.Context, filter workload.ListFilter) ([]workload.WorkloadInfo, error)
- func (m *Manager) Logs(ctx context.Context, id string, opts workload.LogOptions) ([]string, error)
- func (m *Manager) Remove(ctx context.Context, id string) error
- func (m *Manager) Restart(ctx context.Context, id string) error
- func (m *Manager) Status(ctx context.Context, id string) (*workload.WorkloadStatus, error)
- func (m *Manager) Stop(ctx context.Context, id string) error
- func (m *Manager) Wait(ctx context.Context, id string) (*workload.WaitResult, error)
Constants ¶
View Source
const ( WorkloadTypePod = "pod" WorkloadTypeJob = "job" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Kubeconfig is the path to the kubeconfig file. Empty uses in-cluster config.
Kubeconfig string `mapstructure:"kubeconfig" json:"kubeconfig"`
// Context is the kubeconfig context to use. Empty uses the current context.
Context string `mapstructure:"context" json:"context"`
// Namespace is the default namespace for workloads. Defaults to "default".
Namespace string `mapstructure:"namespace" json:"namespace"`
// ServiceAccount is the default service account for pods.
ServiceAccount string `mapstructure:"service_account" json:"service_account"`
// ImagePullPolicy controls when images are pulled: "Always", "IfNotPresent", "Never".
ImagePullPolicy string `mapstructure:"image_pull_policy" json:"image_pull_policy"`
// ImagePullSecrets are names of secrets used for private registry auth.
ImagePullSecrets []string `mapstructure:"image_pull_secrets" json:"image_pull_secrets"`
// WorkloadType controls what K8s resource is created: "pod", "job". Defaults to "job".
WorkloadType string `mapstructure:"workload_type" json:"workload_type"`
// TTLAfterFinished is the seconds after a Job finishes before it's cleaned up. -1 disables.
TTLAfterFinished *int32 `mapstructure:"ttl_after_finished" json:"ttl_after_finished"`
// ActiveDeadlineSeconds is the maximum time a Job can run before being terminated.
ActiveDeadlineSeconds *int64 `mapstructure:"active_deadline_seconds" json:"active_deadline_seconds"`
}
Config holds Kubernetes-specific workload configuration.
func (*Config) ApplyDefaults ¶
func (c *Config) ApplyDefaults()
ApplyDefaults fills in zero-valued fields.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager implements workload.Manager using the Kubernetes API.
func NewManager ¶
NewManager creates a new Kubernetes workload manager.
func (*Manager) Deploy ¶
func (m *Manager) Deploy(ctx context.Context, req workload.DeployRequest) (*workload.DeployResult, error)
Deploy creates and starts a Kubernetes workload (Pod or Job).
func (*Manager) HealthCheck ¶
HealthCheck verifies the Kubernetes cluster is reachable.
func (*Manager) List ¶
func (m *Manager) List(ctx context.Context, filter workload.ListFilter) ([]workload.WorkloadInfo, error)
List returns workloads matching the given filter.
func (*Manager) Restart ¶
Restart deletes and recreates the pod. For Jobs, this is not directly supported.
Click to show internal directories.
Click to hide internal directories.