config

package
v0.14.6 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GlobalServerConfig *ServerConfig                // the global ServerConfig
	DefaultPV          *apiv1.PersistentVolume      // the global default pv instance
	DefaultPVC         *apiv1.PersistentVolumeClaim // the global default pvc instance
	DefaultJobTemplate map[string][]byte            // the global default job template

	DefaultRunYamlPath = "./run.yaml"

	// DefaultClusterName for default cluster in single cluster
	DefaultClusterName = "default-cluster"
	// DefaultQueueName for default queue in single cluster
	DefaultQueueName = "default-queue"
	// DefaultNamespace for default namespace of default queue in single cluster
	DefaultNamespace = "default"
)

Functions

func AddKubeConfigFlagSet

func AddKubeConfigFlagSet(fs *pflag.FlagSet, kubeConf *KubeConfig)

func FileNumsInDir

func FileNumsInDir(path string) (int, error)

FileNumsInDir caculate files number in path, include dir type

func GetServiceAddress added in v0.14.3

func GetServiceAddress() string

GetServiceAddress get address of paddleflow's api-server

func InitConfigFromYaml

func InitConfigFromYaml(conf interface{}, configPath string) error

func InitDefaultPV

func InitDefaultPV(path string) error

InitDefaultPV initialize the default pv instance

func InitDefaultPVC

func InitDefaultPVC(path string) error

InitDefaultPVC initialize the default pvc instance

func InitJobTemplate added in v0.14.5

func InitJobTemplate(path string) error

func InitKubeConfig

func InitKubeConfig(kubeConf KubeConfig) *rest.Config

func InitKubeConfigFromBytes

func InitKubeConfigFromBytes(configBytes []byte) (*rest.Config, error)

func PathExists

func PathExists(path string) (bool, error)

PathExists indicate path exist or not 1. path exist: return true, nil 2. path not exist: return false, nil 3. unknown error: return false, err

func PrettyFormat

func PrettyFormat(data interface{}) []byte

Types

type ApiServerConfig

type ApiServerConfig struct {
	// Host Port used for FS to create pv/pvc with volumeAttributes point pfs-server pod
	Host                string `yaml:"host"`
	Port                int    `yaml:"port"`
	TokenExpirationHour int    `yaml:"tokenExpirationHour"`
}

type FsServerConf

type FsServerConf struct {
	DefaultPVPath        string        `yaml:"defaultPVPath"`
	DefaultPVCPath       string        `yaml:"defaultPVCPath"`
	LinkMetaDirPrefix    string        `yaml:"linkMetaDirPrefix"`
	MountPodExpire       time.Duration `yaml:"mountPodExpire"`
	MountPodIntervalTime time.Duration `yaml:"mountPodIntervalTime"`
	// ServicePort is used to call paddleflow api-server in k8s, the default is the same as ApiServerConfig.Port
	ServicePort int `yaml:"servicePort"`
}

type ImageConfig

type ImageConfig struct {
	Server           string `yaml:"server"`
	Namespace        string `yaml:"namespace"`
	Username         string `yaml:"username"`
	Password         string `yaml:"password"`
	Concurrency      int    `yaml:"concurrency"`
	RemoveLocalImage bool   `yaml:"removeLocalImage"`
}

type JobConfig

type JobConfig struct {
	Reclaim       ReclaimConfig `yaml:"reclaim"`
	SchedulerName string        `yaml:"schedulerName"`
	// period second for job manager
	ClusterSyncPeriod int `yaml:"clusterSyncPeriod"`
	QueueExpireTime   int `yaml:"queueExpireTime"`
	QueueCacheSize    int `yaml:"queueCacheSize"`
	JobLoopPeriod     int `yaml:"jobLoopPeriod"`
	// SyncClusterQueue defines whether aware cluster resource or not, such as queue
	SyncClusterQueue bool `yaml:"syncClusterQueue"`
	// DefaultJobYamlPath defines file path that stores all default templates in one yaml
	DefaultJobYamlPath string       `yaml:"defaultJobYamlPath"`
	IsSingleCluster    bool         `yaml:"isSingleCluster"`
	RuntimeType        string       `yaml:"runtimeType"`
	Log                JobLogConfig `yaml:"log"`
}

type JobLogConfig added in v0.14.6

type JobLogConfig struct {
	ServiceHost string `yaml:"serviceHost"`
	ServicePort string `yaml:"servicePort"`
	SaltStr     string `yaml:"saltStr"`
	TimeFormat  string `yaml:"timeFormat"`
}

type KubeConfig

type KubeConfig struct {
	ConfigPath    string `yaml:"configPath"`
	ClientQPS     int    `yaml:"clientQps"`
	ClientBurst   int    `yaml:"clientBurst"`
	ClientTimeout int    `yaml:"clientTimeout"`
}

type MetricsConfig added in v0.14.4

type MetricsConfig struct {
	Port   int  `yaml:"port"`
	Enable bool `yaml:"enable"`
}

type PrometheusConfig added in v0.14.3

type PrometheusConfig struct {
	Server              string `yaml:"server"`
	ExporterServicePort int    `yaml:"exporterServicePort"`
}

type ReclaimConfig

type ReclaimConfig struct {
	CleanJob               bool `yaml:"isCleanJob"`
	SkipCleanFailedJob     bool `yaml:"isSkipCleanFailedJob"`
	FailedJobTTLSeconds    int  `yaml:"failedJobTTLSeconds,omitempty"`
	SucceededJobTTLSeconds int  `yaml:"succeededJobTTLSeconds,omitempty"`
	PendingJobTTLSeconds   int  `yaml:"pendingJobTTLSeconds,omitempty"`
}

type ServerConfig

type ServerConfig struct {
	Storage   StorageConfig                  `yaml:"database"`
	Log       logger.LogConfig               `yaml:"log"`
	TraceLog  trace_logger.TraceLoggerConfig `yaml:"traceLog"`
	ApiServer ApiServerConfig                `yaml:"apiServer"`
	Job       JobConfig                      `yaml:"job"`
	Fs        FsServerConf                   `yaml:"fs"`
	ImageConf ImageConfig                    `yaml:"imageRepository"`
	Monitor   PrometheusConfig               `yaml:"monitor"`
	Metrics   MetricsConfig                  `yaml:"metrics"`
}

type StorageConfig added in v0.14.3

type StorageConfig struct {
	Driver                               string `yaml:"driver"`
	Host                                 string `yaml:"host"`
	Port                                 string `yaml:"port"`
	User                                 string `yaml:"user"`
	Password                             string `yaml:"password"`
	Database                             string `yaml:"database"`
	ConnectTimeoutInSeconds              int    `yaml:"connectTimeoutInSeconds,omitempty"`
	LockTimeoutInMilliseconds            int    `yaml:"lockTimeoutInMilliseconds,omitempty"`
	IdleTransactionTimeoutInMilliseconds int    `yaml:"idleTransactionTimeoutInMilliseconds,omitempty"`
	MaxIdleConns                         *int   `yaml:"maxIdleConns,omitempty"`
	MaxOpenConns                         *int   `yaml:"maxOpenConns,omitempty"`
	ConnMaxLifetimeInHours               *int   `yaml:"connMaxLifetimeInHours,omitempty"`
}

Jump to

Keyboard shortcuts

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