client

package
v0.3.80-rc-351530a Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: Apache-2.0 Imports: 36 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 DeleteQueue

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

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 LoadClientConfig

func LoadClientConfig(configPath string) (*armadaClientConfig, error)

LoadClientConfig reads in config from the file at configPath, or, if configPath is the empty string, from $HOME/.armada/config, and from environment variables, using viper.

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 NewThreadSafeStringSlice

func NewThreadSafeStringSlice() *threadSafeStringSlice

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
	KerberosAuth                kerberos.ClientConfig
	ForceNoTls                  bool
	ExecAuth                    exec.CommandDetails
}

func ExtractCommandlineArmadaApiConnectionDetails

func ExtractCommandlineArmadaApiConnectionDetails() *ApiConnectionDetails

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

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"`
	Kind    ResourceKind `json:"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