config

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2022 License: Apache-2.0 Imports: 14 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

	DefaultRunYamlPath = "./run.yaml"
)

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 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 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                string `yaml:"host"`
	Port                int    `yaml:"port"`
	TokenExpirationHour int    `yaml:"tokenExpirationHour"`
}

type DatabaseConfig

type DatabaseConfig 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"`
}

type FsServerConf

type FsServerConf struct {
	DefaultPVPath     string `yaml:"defaultPVPath"`
	DefaultPVCPath    string `yaml:"defaultPVCPath"`
	LinkMetaDirPrefix string `yaml:"linkMetaDirPrefix"`
	// K8sServiceName K8sServicePort used to create pv/pvc with volumeAttributes point pfs-server pod
	K8sServiceName string `yaml:"k8sServiceName"`
	K8sServicePort int    `yaml:"k8sServicePort"`
}

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"`
	ScalarResourceArray []string      `yaml:"scalarResourceArray"`
	// period second for job manager
	ClusterSyncPeriod int `yaml:"clusterSyncPeriod"`
	QueueExpireTime   int `yaml:"queueExpireTime"`
	QueueCacheSize    int `yaml:"queueCacheSize"`
	JobLoopPeriod     int `yaml:"jobLoopPeriod"`
	// DefaultJobYamlDir is directory that stores default template yaml files for job
	DefaultJobYamlDir string `yaml:"defaultJobYamlDir"`
}

type KubeConfig

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

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 {
	Database      DatabaseConfig            `yaml:"database"`
	Log           logger.LogConfig          `yaml:"log"`
	ApiServer     ApiServerConfig           `yaml:"apiServer"`
	Job           JobConfig                 `yaml:"job"`
	Fs            FsServerConf              `yaml:"fs"`
	NamespaceList []string                  `yaml:"namespaceList"`
	Flavour       []schema.Flavour          `yaml:"flavour"`
	FlavourMap    map[string]schema.Flavour `yaml:"-"`
	ImageConf     ImageConfig               `yaml:"imageRepository"`
}

Jump to

Keyboard shortcuts

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