Documentation ¶
Index ¶
- Constants
- Variables
- func ExtractRegistry(image string) (string, string, string, string)
- func IsDatasetSpecErr(err error) bool
- func IsRaceConditionErr(err error) bool
- func IsValidationErr(err error) bool
- func ValidateAbsPath(fl validator.FieldLevel) bool
- type AddNerdDependenciesInput
- type CreateDatasetInput
- type CreateDatasetOutput
- type CreateSecretInput
- type CreateSecretOutput
- type DI
- type DatasetDetails
- type DeleteDatasetInput
- type DeleteDatasetOutput
- type DeleteJobInput
- type DeleteJobOutput
- type DeleteSecretInput
- type DeleteSecretOutput
- type FetchJobLogsInput
- type FetchJobLogsOutput
- type GetDatasetInput
- type GetDatasetOutput
- type GetSecretInput
- type GetSecretOutput
- type JobDetails
- type JobDetailsPhase
- type JobEvent
- type JobVolume
- type JobVolumeType
- type Kube
- func (k *Kube) AddNerdDependencies(ctx context.Context, in *AddNerdDependenciesInput) (err error)
- func (k *Kube) CreateDataset(ctx context.Context, in *CreateDatasetInput) (out *CreateDatasetOutput, err error)
- func (k *Kube) CreateSecret(ctx context.Context, in *CreateSecretInput) (out *CreateSecretOutput, err error)
- func (k *Kube) DeleteDataset(ctx context.Context, in *DeleteDatasetInput) (out *DeleteDatasetOutput, err error)
- func (k *Kube) DeleteJob(ctx context.Context, in *DeleteJobInput) (out *DeleteJobOutput, err error)
- func (k *Kube) DeleteSecret(ctx context.Context, in *DeleteSecretInput) (out *DeleteSecretOutput, err error)
- func (k *Kube) FetchJobLogs(ctx context.Context, in *FetchJobLogsInput) (out *FetchJobLogsOutput, err error)
- func (k *Kube) GetDataset(ctx context.Context, in *GetDatasetInput) (out *GetDatasetOutput, err error)
- func (k *Kube) GetSecret(ctx context.Context, in *GetSecretInput) (out *GetSecretOutput, err error)
- func (k *Kube) IsNerdCompliant(ctx context.Context) (ok bool, dependencies []string, err error)
- func (k *Kube) ListDatasets(ctx context.Context, in *ListDatasetsInput) (out *ListDatasetsOutput, err error)
- func (k *Kube) ListJobs(ctx context.Context, in *ListJobsInput) (out *ListJobsOutput, err error)
- func (k *Kube) ListQuotas(ctx context.Context, in *ListQuotasInput) (out *ListQuotasOutput, err error)
- func (k *Kube) ListSecrets(ctx context.Context, in *ListSecretsInput) (out *ListSecretsOutput, err error)
- func (k *Kube) RunJob(ctx context.Context, in *RunJobInput) (out *RunJobOutput, err error)
- func (k *Kube) UpdateDataset(ctx context.Context, in *UpdateDatasetInput) (out *UpdateDatasetOutput, err error)
- func (k *Kube) UpdateSecret(ctx context.Context, in *UpdateSecretInput) (out *UpdateSecretOutput, err error)
- type ListDatasetItem
- type ListDatasetsInput
- type ListDatasetsOutput
- type ListJobItem
- type ListJobsInput
- type ListJobsOutput
- type ListQuotaItem
- type ListQuotasInput
- type ListQuotasOutput
- type ListSecretItem
- type ListSecretsInput
- type ListSecretsOutput
- type Logger
- type RunJobInput
- type RunJobOutput
- type SecretDetails
- type UpdateDatasetInput
- type UpdateDatasetOutput
- type UpdateSecretInput
- type UpdateSecretOutput
- type Validator
Constants ¶
const ( //JobVolumeTypeInput determines the volume to be input JobVolumeTypeInput = JobVolumeType("input") //JobVolumeTypeOutput determines the volume to output JobVolumeTypeOutput = JobVolumeType("output") )
Variables ¶
var ErrMinikubeOnly = errors.New("temp DI can only be created on Minikube")
ErrMinikubeOnly is returned when a temp di is created on something thats not minikube
var ( //JobDefaultBackoffLimit determines how often we will retry a pod's job on when its failing JobDefaultBackoffLimit = int32(3) )
var NodeLimitedQuota = ListQuotaItem{}
NodeLimitedQuota is used when no quota is configured
Functions ¶
func ExtractRegistry ¶
ExtractRegistry takes a string as input and divides it in image, project, registry, tag
func IsDatasetSpecErr ¶
IsDatasetSpecErr is returned when a invalid input/output spec was given
func IsRaceConditionErr ¶
IsRaceConditionErr is returned when we couldn't retrieve any logs for the job
func IsValidationErr ¶
IsValidationErr asserts for a validation error
func ValidateAbsPath ¶
func ValidateAbsPath(fl validator.FieldLevel) bool
ValidateAbsPath is derived from https://github.com/golang/go/blob/1106512db54fc2736c7a9a67dd553fc9e1fca742/src/path/filepath/path_unix.go#L12
Types ¶
type AddNerdDependenciesInput ¶
type AddNerdDependenciesInput struct {
Dependencies []string
}
AddNerdDependenciesInput is used to configure the resource creation
type CreateDatasetInput ¶
type CreateDatasetInput struct { Name string `validate:"printascii"` Size uint64 StoreOptions transferstore.StoreOptions `validate:"required"` ArchiverOptions transferarchiver.ArchiverOptions `validate:"required"` }
CreateDatasetInput is the input to CreateDataset
type CreateDatasetOutput ¶
type CreateDatasetOutput struct {
Name string
}
CreateDatasetOutput is the output to CreateDataset
type CreateSecretInput ¶
type CreateSecretInput struct { Image string `validate:"printascii"` Registry string `validate:"required"` Project string Tag string Username string `validate:"required"` Password string `validate:"required"` }
CreateSecretInput is the input to CreateSecret
type CreateSecretOutput ¶
type CreateSecretOutput struct {
Name string
}
CreateSecretOutput is the output to CreateSecret
type DI ¶
type DI interface { Kube() kubernetes.Interface Crd() crd.Interface APIExt() apiext.Interface Validator() Validator Logger() Logger Namespace() string }
DI provides dependencies for our services
type DatasetDetails ¶
type DatasetDetails struct { CreatedAt time.Time Size uint64 InputFor []string OutputFrom []string }
DatasetDetails tells us more about the dataset by looking at underlying resources
type DeleteDatasetInput ¶
type DeleteDatasetInput struct {
Name string `validate:"min=1,printascii"`
}
DeleteDatasetInput is the input to DeleteDataset
type DeleteDatasetOutput ¶
type DeleteDatasetOutput struct{}
DeleteDatasetOutput is the output to DeleteDataset
type DeleteJobInput ¶
type DeleteJobInput struct {
Name string `validate:"min=1,printascii"`
}
DeleteJobInput is the input to DeleteJob
type DeleteSecretInput ¶
type DeleteSecretInput struct {
Name string `validate:"min=1,printascii"`
}
DeleteSecretInput is the input to DeleteSecret
type DeleteSecretOutput ¶
type DeleteSecretOutput struct{}
DeleteSecretOutput is the output to DeleteSecret
type FetchJobLogsInput ¶
type FetchJobLogsInput struct { Tail int64 `validate:"min=0"` Name string `validate:"min=1,printascii"` }
FetchJobLogsInput is the input to FetchJobLogs
type FetchJobLogsOutput ¶
type FetchJobLogsOutput struct {
Data []byte
}
FetchJobLogsOutput is the output to FetchJobLogs
type GetDatasetInput ¶
type GetDatasetInput struct {
Name string `validate:"printascii"`
}
GetDatasetInput is the input to GetDataset
type GetDatasetOutput ¶
type GetDatasetOutput struct { Name string Size uint64 InputFor []string OutputFrom []string StoreOptions transferstore.StoreOptions ArchiverOptions transferarchiver.ArchiverOptions }
GetDatasetOutput is the output to GetDataset
func GetDatasetOutputFromSpec ¶
func GetDatasetOutputFromSpec(dataset *datasetsv1.Dataset) *GetDatasetOutput
GetDatasetOutputFromSpec allows easy output creation from dataset
type GetSecretInput ¶
type GetSecretInput struct {
Name string `validate:"printascii"`
}
GetSecretInput is the input to GetSecret
type GetSecretOutput ¶
GetSecretOutput is the output to GetSecret
type JobDetails ¶
type JobDetails struct { SeenAt time.Time Phase JobDetailsPhase Scheduled bool //indicate if the pod was scheduled Parallelism int32 //job width, if 0 this means it was stopped WaitingReason string //why the job -> pod -> container is waiting WaitingMessage string //explains why we're waiting TerminatedReason string //termination of main container TerminatedMessage string //explains why its terminated TerminatedExitCode int32 //exit code it was terminated with UnschedulableReason string //when scheduling condition is false UnschedulableMessage string FailedCreateEvents []JobEvent }
JobDetails tells us more about the job by looking at underlying resources
type JobDetailsPhase ¶
type JobDetailsPhase string
JobDetailsPhase is a high level description of the underlying pod
var ( // JobDetailsPhasePending means the pod has been accepted by the system, but one or more of the containers // has not been started. This includes time before being bound to a node, as well as time spent // pulling images onto the host. JobDetailsPhasePending JobDetailsPhase = "Pending" // JobDetailsPhaseRunning means the pod has been bound to a node and all of the containers have been started. // At least one container is still running or is in the process of being restarted. JobDetailsPhaseRunning JobDetailsPhase = "Running" // JobDetailsPhaseSucceeded means that all containers in the pod have voluntarily terminated // with a container exit code of 0, and the system is not going to restart any of these containers. JobDetailsPhaseSucceeded JobDetailsPhase = "Succeeded" // JobDetailsPhaseFailed means that all containers in the pod have terminated, and at least one container has // terminated in a failure (exited with a non-zero exit code or was stopped by the system). JobDetailsPhaseFailed JobDetailsPhase = "Failed" // JobDetailsPhaseUnknown means that for some reason the state of the pod could not be obtained, typically due // to an error in communicating with the host of the pod. JobDetailsPhaseUnknown JobDetailsPhase = "Unknown" )
type JobEvent ¶
type JobEvent struct {
Message string
}
JobEvent contains infromation from the events
type JobVolume ¶
type JobVolume struct { MountPath string `validate:"is-abs-path"` InputDataset string OutputDataset string }
JobVolume can be used in a job
type JobVolumeType ¶
type JobVolumeType string
JobVolumeType determines if its content will be uploaded or downloaded
type Kube ¶
type Kube struct {
// contains filtered or unexported fields
}
Kube interacts with the kubernetes backend
func (*Kube) AddNerdDependencies ¶
func (k *Kube) AddNerdDependencies(ctx context.Context, in *AddNerdDependenciesInput) (err error)
AddNerdDependencies will deploy necessary daemonsets, controllers and roles so that a private cluster can be used by the cli
func (*Kube) CreateDataset ¶
func (k *Kube) CreateDataset(ctx context.Context, in *CreateDatasetInput) (out *CreateDatasetOutput, err error)
CreateDataset will create a dataset on kubernetes
func (*Kube) CreateSecret ¶
func (k *Kube) CreateSecret(ctx context.Context, in *CreateSecretInput) (out *CreateSecretOutput, err error)
CreateSecret will create a secret on kubernetes
func (*Kube) DeleteDataset ¶
func (k *Kube) DeleteDataset(ctx context.Context, in *DeleteDatasetInput) (out *DeleteDatasetOutput, err error)
DeleteDataset will create a dataset on kubernetes
func (*Kube) DeleteJob ¶
func (k *Kube) DeleteJob(ctx context.Context, in *DeleteJobInput) (out *DeleteJobOutput, err error)
DeleteJob will create a job on kubernetes
func (*Kube) DeleteSecret ¶
func (k *Kube) DeleteSecret(ctx context.Context, in *DeleteSecretInput) (out *DeleteSecretOutput, err error)
DeleteSecret will create a dataset on kubernetes
func (*Kube) FetchJobLogs ¶
func (k *Kube) FetchJobLogs(ctx context.Context, in *FetchJobLogsInput) (out *FetchJobLogsOutput, err error)
FetchJobLogs will create a job on kubernetes
func (*Kube) GetDataset ¶
func (k *Kube) GetDataset(ctx context.Context, in *GetDatasetInput) (out *GetDatasetOutput, err error)
GetDataset will retrieve a dataset from kubernetes
func (*Kube) GetSecret ¶
func (k *Kube) GetSecret(ctx context.Context, in *GetSecretInput) (out *GetSecretOutput, err error)
GetSecret will retrieve the secret matching the provided name from kubernetes
func (*Kube) IsNerdCompliant ¶
IsNerdCompliant checks if the nlz-utils are running on the current cluster
func (*Kube) ListDatasets ¶
func (k *Kube) ListDatasets(ctx context.Context, in *ListDatasetsInput) (out *ListDatasetsOutput, err error)
ListDatasets will create a dataset on kubernetes
func (*Kube) ListJobs ¶
func (k *Kube) ListJobs(ctx context.Context, in *ListJobsInput) (out *ListJobsOutput, err error)
ListJobs will list jobs on kubernetes
func (*Kube) ListQuotas ¶
func (k *Kube) ListQuotas(ctx context.Context, in *ListQuotasInput) (out *ListQuotasOutput, err error)
ListQuotas will list quotas on kubernetes
func (*Kube) ListSecrets ¶
func (k *Kube) ListSecrets(ctx context.Context, in *ListSecretsInput) (out *ListSecretsOutput, err error)
ListSecrets will create a secret on kubernetes
func (*Kube) RunJob ¶
func (k *Kube) RunJob(ctx context.Context, in *RunJobInput) (out *RunJobOutput, err error)
RunJob will create a job on kubernetes
func (*Kube) UpdateDataset ¶
func (k *Kube) UpdateDataset(ctx context.Context, in *UpdateDatasetInput) (out *UpdateDatasetOutput, err error)
UpdateDataset will update a dataset resource. Fields that can be updated: name, input, output and size. Input and output are the jobs the dataset is used for or coming from.
func (*Kube) UpdateSecret ¶
func (k *Kube) UpdateSecret(ctx context.Context, in *UpdateSecretInput) (out *UpdateSecretOutput, err error)
UpdateSecret will update a secret resource. Fields that can be updated: name, input, output and size. Input and output are the jobs the secret is used for or coming from.
type ListDatasetItem ¶
type ListDatasetItem struct { Name string Details DatasetDetails }
ListDatasetItem is a dataset listing item
type ListDatasetsInput ¶
type ListDatasetsInput struct{}
ListDatasetsInput is the input to ListDatasets
type ListDatasetsOutput ¶
type ListDatasetsOutput struct {
Items []*ListDatasetItem
}
ListDatasetsOutput is the output to ListDatasets
type ListJobItem ¶
type ListJobItem struct { Name string Image string Input []string Output []string Memory int64 VCPU int64 CreatedAt time.Time DeletedAt time.Time ActiveAt time.Time CompletedAt time.Time FailedAt time.Time Details JobDetails }
ListJobItem is a job listing item
type ListJobsOutput ¶
type ListJobsOutput struct {
Items []*ListJobItem
}
ListJobsOutput is the output to ListJobs
type ListQuotaItem ¶
type ListQuotaItem struct { RequestCPU int64 LimitCPU int64 LimitMemory int64 RequestMemory int64 UseRequestCPU int64 UseLimitCPU int64 UseLimitMemory int64 UseRequestMemory int64 Labels map[string]string }
ListQuotaItem describes a namespace quota
type ListQuotasOutput ¶
type ListQuotasOutput struct {
Items []*ListQuotaItem
}
ListQuotasOutput is the output to ListQuotas
type ListSecretItem ¶
type ListSecretItem struct { Name string Details SecretDetails }
ListSecretItem is a secret listing item
type ListSecretsInput ¶
type ListSecretsInput struct {
Labels []string
}
ListSecretsInput is the input to ListSecrets
type ListSecretsOutput ¶
type ListSecretsOutput struct {
Items []*ListSecretItem
}
ListSecretsOutput is the output to ListSecrets
type Logger ¶
type Logger interface {
Debugf(format string, args ...interface{})
}
Logger describes the logging dependency the services require
type RunJobInput ¶
type RunJobInput struct { Image string `validate:"min=1"` Name string `validate:"printascii"` Env map[string]string BackoffLimit *int32 Args []string Volumes []JobVolume Memory string VCPU string Secret string }
RunJobInput is the input to RunJob
type SecretDetails ¶
SecretDetails tells us more about the secret by looking at underlying resources
type UpdateDatasetInput ¶
type UpdateDatasetInput struct { Name string `validate:"printascii"` NewName string `validate:"printascii"` Size *uint64 InputFor string OutputFrom string }
UpdateDatasetInput is the input for UpdateDataset
type UpdateDatasetOutput ¶
type UpdateDatasetOutput struct {
Name string
}
UpdateDatasetOutput is the output for UpdateDataset
type UpdateSecretInput ¶
type UpdateSecretInput struct { Name string `validate:"printascii"` Username string Password string }
UpdateSecretInput is the input for UpdateSecret
type UpdateSecretOutput ¶
type UpdateSecretOutput struct {
Name string
}
UpdateSecretOutput is the output for UpdateSecret
Source Files ¶
- errors.go
- kube.go
- kube_create_dataset.go
- kube_create_secret.go
- kube_delete_dataset.go
- kube_delete_job.go
- kube_delete_secret.go
- kube_fetch_job_logs.go
- kube_get_dataset.go
- kube_get_secret.go
- kube_list_datasets.go
- kube_list_jobs.go
- kube_list_quotas.go
- kube_list_secret.go
- kube_nerd_compliant.go
- kube_run_job.go
- kube_update_dataset.go
- kube_update_secret.go
- svc.go