setting

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2021 License: Apache-2.0 Imports: 1 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// common
	ENVSystemAddress           = "ADDRESS"
	ENVEnterprise              = "ENTERPRISE"
	ENVMode                    = "MODE"
	ENVNsqLookupAddrs          = "NSQLOOKUP_ADDRS"
	ENVMongoDBConnectionString = "MONGODB_CONNECTION_STRING"
	ENVAslanDBName             = "ASLAN_DB"
	ENVHubAgentImage           = "HUB_AGENT_IMAGE"
	ENVPoetryAPIRootKey        = "POETRY_API_ROOT_KEY"

	// Aslan
	ENVPodName              = "BE_POD_NAME"
	ENVNamespace            = "BE_POD_NAMESPACE"
	ENVLogLevel             = "LOG_LEVEL"
	ENVServiceStartTimeout  = "SERVICE_START_TIMEOUT"
	ENVDefaultEnvRecycleDay = "DEFAULT_ENV_RECYCLE_DAY"
	ENVDefaultIngressClass  = "DEFAULT_INGRESS_CLASS"
	ENVAslanRegAddress      = "DEFAULT_REGISTRY"
	ENVAslanRegAccessKey    = "DEFAULT_REGISTRY_AK"
	ENVAslanRegSecretKey    = "DEFAULT_REGISTRY_SK"
	ENVAslanRegNamespace    = "DEFAULT_REGISTRY_NAMESPACE"

	ENVGithubSSHKey    = "GITHUB_SSH_KEY"
	ENVGithubKnownHost = "GITHUB_KNOWN_HOST"

	ENVReaperImage      = "REAPER_IMAGE"
	ENVReaperBinaryFile = "REAPER_BINARY_FILE"
	ENVPredatorImage    = "PREDATOR_IMAGE"

	ENVDockerHosts = "DOCKER_HOSTS"

	ENVUseClassicBuild       = "USE_CLASSIC_BUILD"
	ENVCustomDNSNotSupported = "CUSTOM_DNS_NOT_SUPPORTED"

	ENVOldEnvSupported = "OLD_ENV_SUPPORTED"

	ENVS3StorageAK       = "S3STORAGE_AK"
	ENVS3StorageSK       = "S3STORAGE_SK"
	ENVS3StorageEndpoint = "S3STORAGE_ENDPOINT"
	ENVS3StorageBucket   = "S3STORAGE_BUCKET"
	ENVS3StorageProtocol = "S3STORAGE_PROTOCOL"
	ENVS3StoragePath     = "S3STORAGE_PATH"
	ENVKubeServerAddr    = "KUBE_SERVER_ADDR"

	// cron
	ENVRootToken = "ROOT_TOKEN"

	ENVKodespaceVersion = "KODESPACE_VERSION"

	// hubagent
	HubAgentToken         = "HUB_AGENT_TOKEN"
	HubServerBaseAddr     = "HUB_SERVER_BASE_ADDR"
	KubernetesServiceHost = "KUBERNETES_SERVICE_HOST"
	KubernetesServicePort = "KUBERNETES_SERVICE_PORT"
	Token                 = "X-API-Tunnel-Token"
	Params                = "X-API-Tunnel-Params"

	// warpdrive
	WarpDrivePodName    = "WD_POD_NAME"
	ReleaseImageTimeout = "RELEASE_IMAGE_TIMEOUT"
	DefaultRegistryAddr = "DEFAULT_REG_ADDRESS"
	DefaultRegistryAK   = "DEFAULT_REG_ACCESS_KEY"
	DefaultRegistrySK   = "DEFAULT_REG_SECRET_KEY"

	// reaper
	Home          = "HOME"
	PkgFile       = "PKG_FILE"
	JobConfigFile = "JOB_CONFIG_FILE"
	DockerAuthDir = "DOCKER_AUTH_DIR"
	Path          = "PATH"
	DockerHost    = "DOCKER_HOST"
	BuildURL      = "BUILD_URL"

	// jenkins
	JenkinsBuildImage = "JENKINS_BUILD_IMAGE"

	DebugMode   = "debug"
	ReleaseMode = "release"
	TestMode    = "test"
)

envs

View Source
const (
	Secret             = "Secret"
	ConfigMap          = "ConfigMap"
	Ingress            = "Ingress"
	Service            = "Service"
	Deployment         = "Deployment"
	StatefulSet        = "StatefulSet"
	Pod                = "Pod"
	ReplicaSet         = "ReplicaSet"
	Job                = "Job"
	CronJob            = "CronJob"
	ClusterRoleBinding = "ClusterRoleBinding"
	ServiceAccount     = "ServiceAccount"
	ClusterRole        = "ClusterRole"
	Role               = "Role"
	RoleBinding        = "RoleBinding"

	// labels
	TaskLabel                       = "s-task"
	TypeLabel                       = "s-type"
	PipelineTypeLable               = "p-type"
	ProductLabel                    = "s-product"
	GroupLabel                      = "s-group"
	ServiceLabel                    = "s-service"
	ConfigBackupLabel               = "config-backup"
	EnvNameLabel                    = "s-env"
	UpdateBy                        = "update-by"
	UpdateByID                      = "update-by-id"
	UpdateTime                      = "update-time"
	UpdatedByLabel                  = "updated-by-koderover"
	IngressClassLabel               = "kubernetes.io/ingress.class"
	IngressProxyConnectTimeoutLabel = "nginx.ingress.kubernetes.io/proxy-connect-timeout"
	IngressProxySendTimeoutLabel    = "nginx.ingress.kubernetes.io/proxy-send-timeout"
	IngressProxyReadTimeoutLabel    = "nginx.ingress.kubernetes.io/proxy-read-timeout"
	ComponentLabel                  = "app.kubernetes.io/component"

	DirtyLabel               = companyLabel + "/" + "modified-since-last-update"
	OwnerLabel               = companyLabel + "/" + "owner"
	InactiveConfigLabel      = companyLabel + "/" + "inactive"
	ModifiedByAnnotation     = companyLabel + "/" + "last-modified-by"
	EditorIDAnnotation       = companyLabel + "/" + "editor-id"
	LastUpdateTimeAnnotation = companyLabel + "/" + "last-update-time"

	LabelValueTrue = "true"

	// Pod status
	PodRunning    = "Running"
	PodError      = "Error"
	PodUnstable   = "Unstable"
	PodCreating   = "Creating"
	PodCreated    = "created"
	PodUpdating   = "Updating"
	PodDeleting   = "Deleting"
	PodSucceeded  = "Succeeded"
	PodFailed     = "Failed"
	PodPending    = "Pending"
	PodNonStarted = "Unstart"
	PodCompleted  = "Completed"

	// cluster status
	ClusterUnknown      = "Unknown"
	ClusterNotFound     = "NotFound"
	ClusterDisconnected = "Disconnected"

	EnvCreatedBy              = "createdBy"
	EnvCreator                = "koderover"
	PodReady                  = "ready"
	JobReady                  = "Completed"
	PodNotReady               = "not ready"
	HelmReleaseStatusPending  = "Pending"
	HelmReleaseStatusDeployed = "Deployed"

	APIVersionAppsV1 = "apps/v1"

	DefaultCandidateImagePullSecret = "default-candidate-registry-secret"
)

k8s concepts

View Source
const (
	ProductName = "zadig"
	RequestID   = "requestID"

	ProtocolHTTP  string = "http"
	ProtocolHTTPS string = "https"
	ProtocolTCP   string = "tcp"

	DefaultIngressClass = "koderover-nginx"

	// K8SDeployType 容器化部署方式
	K8SDeployType = "k8s"
	// helm 部署
	HelmDeployType = "helm"
	// PMDeployType physical machine deploy 脚本物理机部署方式
	PMDeployType = "pm"

	// 基础设施 k8s类型
	BasicFacilityK8S = "kubernetes"
	// 基础设施 云主机
	BasicFacilityCVM = "cloud_host"

	// SourceFromZadig 配置来源由平台管理
	SourceFromZadig = "spock"
	// SourceFromGitlab 配置来源为gitlab
	SourceFromGitlab = "gitlab"
	// SourceFromGithub 配置来源为github
	SourceFromGithub = "github"
	// SourceFromGitlab 配置来源为gerrit
	SourceFromGerrit = "gerrit"
	// SourceFromCodeHub 配置来源为codehub
	SourceFromCodeHub = "codehub"
	// SourceFromGUI 配置来源为gui
	SourceFromGUI = "gui"
	//SourceFromHelm
	SourceFromHelm = "helm"
	//SourceFromExternal
	SourceFromExternal = "external"

	ProdENV = "prod"
	TestENV = "test"

	// action type
	TypeEnableCronjob  = "enable"
	TypeDisableCronjob = "disable"

	PublicService = "public"

	// onboarding流程第二步
	OnboardingStatusSecond = 2

	Unset            = "UNSET"
	CleanSkippedList = "CLEAN_WHITE_LIST"
	PerPage          = 20

	BuildType   = "build"
	DeployType  = "deploy"
	TestType    = "test"
	PublishType = "publish"

	FunctionTestType = "function"
)
View Source
const (
	SessionUsername     = "Username"
	AuthPrefix          = "X-ROOT-API-KEY "
	SessionUser         = "User"
	USERAPIKEY          = "X-API-KEY"
	RootAPIKey          = "X-ROOT-API-KEY"
	TIMERAPIKEY         = "X-TIMER-API-KEY"
	AuthorizationHeader = "Authorization"
	CookieHeader        = "Cookie"
)
View Source
const (
	StandardScriptName   = "install.sh"
	AllInOneScriptName   = "install_with_k8s.sh"
	UninstallScriptName  = "uninstall.sh"
	StandardInstallType  = "standard"
	AllInOneInstallType  = "all-in-one"
	UninstallInstallType = "uninstall"
)

install script constants

View Source
const (
	StatusRunning   = "Running"
	StatusSucceeded = "Succeeded"
)

Pod Status

View Source
const (
	// BuildImageJob ...
	BuildImageJob = "docker-build"
	// ReleaseImageJob ...
	ReleaseImageJob = "docker-release"
)

build image consts

View Source
const (
	PipelineTaskFmt = "PipelineTask:%s"
	WorkflowTaskFmt = "WorkflowTask:%s"
	TestTaskFmt     = "TestTask:%s"
	ServiceTaskFmt  = "ServiceTask:%s"
)

counter prefix

View Source
const (
	ProductStatusSuccess  = "success"
	ProductStatusFailed   = "failed"
	ProductStatusCreating = "creating"
	ProductStatusUpdating = "updating"
	ProductStatusDeleting = "deleting"
	ProductStatusUnknown  = "unknown"
	ProductStatusUnstable = "Unstable"
)

Product Status

View Source
const (
	RoleOwnerID = 3
	RoleUserID  = 4

	RoleUser        = "user"        // 普通用户
	RoleOwner       = "owner"       // 项目管理员
	RoleAdmin       = "admin"       // 超级管理员
	RoleContributor = "contributor" //开源项目贡献者
	SystemUser      = "system"

	GuestAccount = "guest2019"
)

roles

View Source
const (
	CreateProductEvent        = "CreateProduct"
	UpdateProductEvent        = "UpdateProduct"
	DeleteProductEvent        = "DeleteProduct"
	UpdateContainerImageEvent = "UpdateContainerImage"
)

events

View Source
const (
	// PrivateVisibility ...
	PrivateVisibility = "private"
	// PublicAccess ...
	PublicAccess = "public"
	// ChartYaml
	ChartYaml = "Chart.yaml"
	// ValuesYaml
	ValuesYaml = "values.yaml"
	// TemplatesDir
	TemplatesDir = "templates"
	// ServiceTemplateCounterName 服务模板counter name
	ServiceTemplateCounterName = "service:%s&project:%s"
	// GerritDefaultOwner
	GerritDefaultOwner = "dafault"
	// YamlFileSeperator ...
	YamlFileSeperator = "\n---\n"
)

Service Related

View Source
const (
	ProxyAPIAddr    = "PROXY_API_ADDR"
	ProxyHTTPSAddr  = "PROXY_HTTPS_ADDR"
	ProxyHTTPAddr   = "PROXY_HTTP_ADDR"
	ProxySocks5Addr = "PROXY_SOCKS_ADDR"
)

proxy

View Source
const (
	// WebhookTaskCreator ...
	WebhookTaskCreator = "webhook"
	// CronTaskCreator ...
	CronTaskCreator = "timer"
	// DefaultTaskRevoker ...
	DefaultTaskRevoker = "system" // default task revoker
)
View Source
const (
	// DefaultMaxFailures ...
	DefaultMaxFailures = 10

	// FrequencySeconds ...
	FrequencySeconds = "seconds"
	// FrequencyMinutes ...
	FrequencyMinutes = "minutes"
	// FrequencyHour ...
	FrequencyHour = "hour"
	// FrequencyHours ...
	FrequencyHours = "hours"
	// FrequencyDay ...
	FrequencyDay = "day"
	// FrequencyDays ...
	FrequencyDays = "days"
	// FrequencyMondy ...
	FrequencyMondy = "monday"
	// FrequencyTuesday ...
	FrequencyTuesday = "tuesday"
	// FrequencyWednesday ...
	FrequencyWednesday = "wednesday"
	// FrequencyThursday ...
	FrequencyThursday = "thursday"
	// FrequencyFriday ...
	FrequencyFriday = "friday"
	// FrequencySaturday ...
	FrequencySaturday = "saturday"
	// FrequencySunday ...
	FrequencySunday = "sunday"
)
View Source
const (
	// FunctionTest 功能测试
	FunctionTest = "function"
	// PerformanceTest 性能测试
	PerformanceTest = "performance"
)
View Source
const (
	// UbuntuPrecis ...
	UbuntuPrecis = "precise"
	// UbuntuTrusty ...
	UbuntuTrusty = "trusty"
	// UbuntuXenial ...
	UbuntuXenial = "xenial"
	// UbuntuBionic ...
	UbuntuBionic = "bionic"
	// TestOnly ...
	TestOnly = "test"
)
View Source
const (
	Version = "stable"

	EnvRecyclePolicyAlways     = "always"
	EnvRecyclePolicyTaskStatus = "success"
	EnvRecyclePolicyNever      = "never"
)
View Source
const (
	ImageFromCustom     = "custom"
	FixedDayTimeCronjob = "timing"
	FixedGapCronjob     = "gap"
	CrontabCronjob      = "crontab"

	WorkflowCronjob = "workflow"
	TestingCronjob  = "test"

	TopicProcess      = "task.process"
	TopicCancel       = "task.cancel"
	TopicAck          = "task.ack"
	TopicItReport     = "task.it.report"
	TopicNotification = "task.notification"
	TopicCronjob      = "cronjob"
)
View Source
const (
	ProviderSourceETC = iota
	ProviderSourceAli
	ProviderSourceTencent
	ProviderSourceQiniu
	ProviderSourceHuawei
	ProviderSourceSystemDefault
)

ALL provider mapping

View Source
const (
	Aslan     = iota + 1 // 1
	Aslanx               // 2
	Clair                // 3
	Collie               // 4
	Cron                 // 5
	HubServer            // 6
	PodExec              // 7
	Poetry               // 8
	SonarQube            // 9
	WarpDrive            // 10
	Minio                // 11
)
View Source
const DogFood = "/var/run/koderover-dog-food"
View Source
const (
	JenkinsBuildJob = "jenkins-build"
)
View Source
const LocalConfig = "local.env"
View Source
const MaskValue = "********"
View Source
const MaxTries = 1
View Source
const (
	NormalModeProduct = "normal"
)
View Source
const (
	S3DefaultRegion = "ap-shanghai"
)

S3 related constants

Variables

View Source
var Services = map[int]*ServiceInfo{
	Aslan: {
		Name: "aslan",
		Port: 25000,
	},
	Aslanx: {
		Name: "aslanx",
		Port: 25002,
	},
	Clair: {
		Name: "clair",
		Port: 34002,
	},
	Collie: {
		Name: "collie-server",
		Port: 28080,
	},
	Cron: {
		Name: "cron",
		Port: 80,
	},
	HubServer: {
		Name: "hub-server",
		Port: 26000,
	},
	PodExec: {
		Name: "podexec",
		Port: 27000,
	},
	Poetry: {
		Name: "poetry",
		Port: 34001,
	},
	SonarQube: {
		Name: "sonarqube",
		Port: 80,
	},
	WarpDrive: {
		Name: "warpdrive",
		Port: 80,
	},
	Minio: {
		Name: "zadig-minio",
		Port: 9000,
	},
}
View Source
var ValidName = regexp.MustCompile(`^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$`)
View Source
var ValidNameHint = "a valid name must consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character"

Functions

This section is empty.

Types

type Request

type Request string
const (
	// HighRequest 16 CPU 32 G
	HighRequest Request = "high"
	// MediumRequest 8 CPU 16 G
	MediumRequest Request = "medium"
	// LowRequest 4 CPU 8 G
	LowRequest Request = "low"
	// MinRequest 2 CPU 2 G
	MinRequest Request = "min"
)

type ServiceInfo added in v1.3.0

type ServiceInfo struct {
	Name string
	Port int32
}

Jump to

Keyboard shortcuts

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