client

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const MaxJobsPerRequest = 200

Variables

This section is empty.

Functions

func AddArmadaApiConnectionCommandlineArgs

func AddArmadaApiConnectionCommandlineArgs(rootCmd *cobra.Command)

AddArmadaApiConnectionCommandlineArgs adds command-line flags to a cobra command. Arguments given via these flags are later used by LoadCommandlineArgsFromConfigFile. Hence, apps that use the client package to load config should call this function as part of their initialization.

func AddClientIds

func AddClientIds(jobs []*api.JobSubmitRequestItem)

func CreateApiConnection

func CreateApiConnection(config *ApiConnectionDetails, additionalDialOptions ...grpc.DialOption) (*grpc.ClientConn, error)

func CreateApiConnectionWithCallOptions

func CreateApiConnectionWithCallOptions(
	config *ApiConnectionDetails,
	additionalDefaultCallOptions []grpc.CallOption,
	additionalDialOptions ...grpc.DialOption,
) (*grpc.ClientConn, error)

func CreateChunkedSubmitRequests

func CreateChunkedSubmitRequests(queue string, jobSetId string, jobs []*api.JobSubmitRequestItem) []*api.JobSubmitRequest

func CreateQueue

func CreateQueue(submitClient api.SubmitClient, queue *api.Queue) error

func CustomClientSubmitJobs added in v0.4.8

func CustomClientSubmitJobs(submitClient api.CustomSubmitClient, request *api.JobSubmitRequest) (*api.JobSubmitResponse, error)

func DeleteQueue

func DeleteQueue(submitClient api.SubmitClient, name string) error

func ExtractConfigurationContexts added in v0.4.40

func ExtractConfigurationContexts() []string

ExtractConfigurationContexts extracts all contexts from loaded viper state

func GetJobSetState

func GetJobSetState(client api.EventClient, queue, jobSetId string, context context.Context, errorOnNotExists bool, forceNew bool, forceLegacy bool) *domain.WatchContext

func GetKubectlCommand

func GetKubectlCommand(cluster string, namespace string, jobId string, podNumber int, cmd string) string

func LoadCommandlineArgs

func LoadCommandlineArgs() error

LoadCommandlineArgs loads armadactl config armadactl-defaults.yaml - From exePath, where exePath is the path to the armadactl executable armada config file - From cfgFile, set by the --config CLI flag, or defaulting to $HOME/.armadactl if not set These configs are then merged

func LoadCommandlineArgsFromConfigFile

func LoadCommandlineArgsFromConfigFile(cfgFile string) error

LoadCommandlineArgsFromConfigFile loads armadactl config armadactl-defaults.yaml - From exePath, where exePath is the path to the armadactl executable armada config file - From cfgFile or defaulting to $HOME/.armadactl These configs are then merged

func ModifyCurrentContextInConfig added in v0.4.40

func ModifyCurrentContextInConfig(cfgFilePath string, newContext string) error

ModifyCurrentContextInConfig reads the config file at the provided path, sets the currentContext to the provided value, and writes the config back into the file.

func NewThreadSafeStringSlice

func NewThreadSafeStringSlice() *threadSafeStringSlice

func SetDefaultContext added in v0.4.40

func SetDefaultContext(newContext string) error

SetDefaultContext sets the currentContext within the viper config. We return an error if the context doesn't exist in the set of existing contexts

func SubmitJobs

func SubmitJobs(submitClient api.SubmitClient, request *api.JobSubmitRequest) (*api.JobSubmitResponse, error)

func UpdateQueue

func UpdateQueue(submitClient api.SubmitClient, queue *api.Queue) error

func WatchJobSet

func WatchJobSet(
	client api.EventClient,
	queue, jobSetId string,
	waitForNew bool,
	errorOnNotExists bool,
	forceNew bool,
	forceLegacy bool,
	context context.Context,
	onUpdate func(*domain.WatchContext, api.Event) bool,
) *domain.WatchContext

func WatchJobSetWithJobIdsFilter

func WatchJobSetWithJobIdsFilter(
	client api.EventClient,
	queue, jobSetId string,
	waitForNew bool,
	errorOnNotExists bool,
	forceNew bool,
	forceLegacy bool,
	jobIds []string,
	context context.Context,
	onUpdate func(*domain.WatchContext, api.Event) bool,
) *domain.WatchContext

func WithConnection

func WithConnection(apiConnectionDetails *ApiConnectionDetails, action func(*grpc.ClientConn) error) error

func WithEventClient

func WithEventClient(apiConnectionDetails *ApiConnectionDetails, action func(api.EventClient) error) error

func WithSchedulerReportingClient

func WithSchedulerReportingClient(apiConnectionDetails *ApiConnectionDetails, action func(schedulerobjects.SchedulerReportingClient) error) error

func WithSubmitClient

func WithSubmitClient(apiConnectionDetails *ApiConnectionDetails, action func(api.SubmitClient) error) error

Types

type APIVersion

type APIVersion string
const (
	APIVersionV1 APIVersion = "armadaproject.io/v1beta1"
)

func NewAPIVersion

func NewAPIVersion(in string) (APIVersion, error)

func (*APIVersion) UnmarshalJSON

func (version *APIVersion) UnmarshalJSON(data []byte) error

type ApiConnectionDetails

type ApiConnectionDetails struct {
	ArmadaUrl     string
	ArmadaRestUrl string
	// Names of executor clusters as they appear in the local kubeconfig file.
	// Used by the test suite to download logs from pods running tests.
	ExecutorClusters []string
	// After a duration of this time, if the client doesn't see any activity it
	// pings the server to see if the transport is still alive.
	// If set below 10s, a minimum value of 10s is used instead.
	// The default value is infinity.
	GrpcKeepAliveTime time.Duration
	// After having pinged for keepalive check, the client waits for a duration
	// of Timeout and if no activity is seen even after that the connection is
	// closed.
	GrpcKeepAliveTimeout time.Duration
	// Authentication options.
	BasicAuth                   common.LoginCredentials
	KubernetesNativeAuth        kubernetes.NativeAuthDetails
	OpenIdAuth                  oidc.PKCEDetails
	OpenIdDeviceAuth            oidc.DeviceDetails
	OpenIdPasswordAuth          oidc.ClientPasswordDetails
	OpenIdClientCredentialsAuth oidc.ClientCredentialsDetails
	OpenIdKubernetesAuth        oidc.KubernetesDetails
	ForceNoTls                  bool
	ExecAuth                    exec.CommandDetails
}

func ExtractCommandlineArmadaApiConnectionDetails

func ExtractCommandlineArmadaApiConnectionDetails() (*ApiConnectionDetails, error)

ExtractCommandlineArmadaApiConnectionDetails extracts Armada server connection details from the config loaded into viper. Hence, this function must be called after loading config into viper, e.g., by calling LoadCommandlineArgsFromConfigFile.

func (*ApiConnectionDetails) ArmadaHealthCheck

func (a *ApiConnectionDetails) ArmadaHealthCheck() (ok bool, err error)

ArmadaHealthCheck calls Armada Server /health endpoint.

Returns true if response status code is in range [200-399], otherwise returns false.

TODO: Shouldn't be a method on ApiConnectionDetails. TODO: Break this up into one function to get the status code and another to check if that's a healthy one.

type ArmadaLoadTester

type ArmadaLoadTester struct {
	// contains filtered or unexported fields
}

func NewArmadaLoadTester

func NewArmadaLoadTester(connectionDetails *ApiConnectionDetails) *ArmadaLoadTester

func (ArmadaLoadTester) RunSubmissionTest

func (apiLoadTester ArmadaLoadTester) RunSubmissionTest(ctx context.Context, spec domain.LoadTestSpecification, watchEvents bool) domain.LoadTestSummary

type ConnectionDetails

type ConnectionDetails func() (*ApiConnectionDetails, error)

type CtlConfig added in v0.4.40

type CtlConfig struct {
	CurrentContext string                 `yaml:"currentContext"`
	Contexts       map[string]interface{} `yaml:"contexts"`
}

func ReadConfigFromPath added in v0.4.40

func ReadConfigFromPath(cfgFilePath string) (CtlConfig, error)

type LoadTester

type LoadTester interface {
	RunSubmissionTest(ctx context.Context, spec domain.LoadTestSpecification, watchEvents bool) *domain.WatchContext
}

type Resource

type Resource struct {
	Version APIVersion   `json:"apiVersion" yaml:"apiVersion"`
	Kind    ResourceKind `json:"kind" yaml:"kind"`
}

type ResourceKind

type ResourceKind string
const (
	ResourceKindQueue ResourceKind = "Queue"
)

func NewResourceKind

func NewResourceKind(in string) (ResourceKind, error)

func (*ResourceKind) UnmarshalJSON

func (kind *ResourceKind) UnmarshalJSON(data []byte) error

Directories

Path Synopsis
auth

Jump to

Keyboard shortcuts

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