setting

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 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"
	ENVMysqlUser               = "MYSQL_USER"
	ENVMysqlPassword           = "MYSQL_PASSWORD"
	ENVMysqlHost               = "MYSQL_HOST"

	// 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"

	// user
	ENVIssuerURL      = "ISSUER_URL"
	ENVClientID       = "CLIENT_ID"
	ENVClientSecret   = "CLIENT_SECRET"
	ENVRedirectURI    = "REDIRECT_URI"
	ENVSecretKey      = "SECRET_KEY"
	ENVMysqlUserDB    = "MYSQL_USER_DB"
	ENVScopes         = "SCOPES"
	ENVTokenExpiresAt = "TOKEN_EXPIRES_AT"
	ENVUserPort       = "USER_PORT"

	// initconfig
	ENVAdminEmail    = "ADMIN_EMAIL"
	ENVAdminPassword = "ADMIN_PASSWORD"
	PresetAccount    = "admin"
)

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"

	// annotations
	HelmReleaseNameAnnotation = "meta.helm.sh/release-name"

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

	APIVersionAppsV1 = "apps/v1"

	DefaultImagePullSecret = "default-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"
	// SourceFromChartTemplate 配置来源为helmTemplate
	SourceFromChartTemplate = "chartTemplate"
	// SourceFromPublicRepo 配置来源为publicRepo
	SourceFromPublicRepo = "publicRepo"

	// SourceFromGUI 配置来源为gui
	SourceFromGUI = "gui"
	//SourceFromHelm
	SourceFromHelm = "helm"
	//SourceFromExternal
	SourceFromExternal = "external"
	// service from yaml template
	ServiceSourceTemplate = "template"

	ProdENV = "prod"
	TestENV = "test"
	AllENV  = "all"

	// 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 (
	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 (
	ValuesYamlSourceFreeEdit = "freeEdit"
	ValuesYamlSourceGitRepo  = "gitRepo"

	// components used to search image paths from yaml
	PathSearchComponentRepo  = "repo"
	PathSearchComponentImage = "image"
	PathSearchComponentTag   = "tag"
)

helm related

View Source
const (
	DockerfileSourceLocal    = "local"
	DockerfileSourceTemplate = "template"

	ZadigDockerfilePath = "zadig-dockerfile"
)

Dockerfile template constant

View Source
const (
	TemplateVariableProduct            = "$T-Project$"
	TemplateVariableProductDescription = "项目名称"
	TemplateVariableService            = "$T-Service$"
	TemplateVariableServiceDescription = "服务名称"
)

template common constant

View Source
const (
	ResponseError = "error"
	ResponseData  = "response"
)
View Source
const (
	Contributor        RoleType = "contributor"
	ReadOnly           RoleType = "read-only"
	Admin              RoleType = "project-admin"
	RoleBindingNameFmt string   = "user:%s,role:%s,project:%s"
)
View Source
const (
	Subresource        = "subresource"
	StatusSubresource  = "status"
	IngressSubresource = "ingress"
	ResourcesHeader    = "Resources"
)
View Source
const (
	LocalClusterID   = "local" // special(fake) id of the local cluster
	LocalClusterName = "local" // special(fake) name of the local cluster
)
View Source
const (
	CpuUintM     string = "m"
	MemoryUintMi string = "Mi"
	MemoryUintGi string = "Gi"
)
View Source
const (
	Aslan     = iota + 1 // 1
	Aslanx               // 2
	Clair                // 3
	Collie               // 4
	Cron                 // 5
	HubServer            // 6
	PodExec              // 7
	SonarQube            // 9
	WarpDrive            // 10
	Minio                // 11
	OPA                  // 12
	Policy               // 13
	Config               // 14
	User                 // 15
)
View Source
const (
	AliyunHost = ".aliyuncs.com"
)

Aliyun specific stuff

View Source
const (
	AuthorizationHeader = "Authorization"
)
View Source
const ChartTemplatesPath = "charts"
View Source
const (
	DockerfileCmdArg = "ARG"
)

Dockerfile parsing consts

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 ModernWorkflowType = "ModernWorkflow"

ModernWorkflowType 自由编排工作流

View Source
const (
	NormalModeProduct = "normal"
)
View Source
const (
	RegExpParameter = `{{.(\w)+}}`
)

Yaml template constant

View Source
const (
	S3DefaultRegion = "ap-shanghai"
)

S3 related constants

Variables

View Source
var (
	// HighRequestSpec 16 CPU 32 G
	HighRequestSpec = RequestSpec{
		CpuLimit:    16000,
		MemoryLimit: 32768,
		CpuReq:      4000,
		MemoryReq:   4096,
	}
	// MediumRequestSpec 8 CPU 16 G
	MediumRequestSpec = RequestSpec{
		CpuLimit:    8000,
		MemoryLimit: 16384,
		CpuReq:      2000,
		MemoryReq:   2048,
	}
	// LowRequestSpec 4 CPU 8 G
	LowRequestSpec = RequestSpec{
		CpuLimit:    4000,
		MemoryLimit: 8192,
		CpuReq:      1000,
		MemoryReq:   1024,
	}
	// MinRequestSpec 2 CPU 2 G
	MinRequestSpec = RequestSpec{
		CpuLimit:    2000,
		MemoryLimit: 2048,
		CpuReq:      500,
		MemoryReq:   512,
	}
	// DefineRequest X CPU X G
	DefineRequestSpec  = RequestSpec{}
	DefaultRequestSpec = RequestSpec{
		CpuLimit:    4000,
		MemoryLimit: 8192,
		CpuReq:      1000,
		MemoryReq:   1024,
	}
)
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,
	},
	SonarQube: {
		Name: "sonarqube",
		Port: 80,
	},
	WarpDrive: {
		Name: "warpdrive",
		Port: 80,
	},
	Minio: {
		Name: "zadig-minio",
		Port: 9000,
	},
	OPA: {
		Name: "opa",
		Port: 8181,
	},
	Policy: {
		Name: "policy",
		Port: 80,
	},
	Config: {
		Name: "config",
		Port: 80,
	},
	User: {
		Name: "user",
		Port: 80,
	},
}
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 K8SClusterStatus added in v1.7.1

type K8SClusterStatus string
const (
	Disconnected K8SClusterStatus = "disconnected"
	Pending      K8SClusterStatus = "pending"
	Normal       K8SClusterStatus = "normal"
	Abnormal     K8SClusterStatus = "abnormal"
)

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"
	// DefaultRequest 4 CPU 8 G
	DefaultRequest Request = "default"
	// DefineRequest x CPU x G
	DefineRequest Request = "define"
)

type RequestSpec added in v1.7.1

type RequestSpec struct {
	CpuLimit    int `bson:"cpu_limit"                     json:"cpu_limit"`
	MemoryLimit int `bson:"memory_limit"                  json:"memory_limit"`
	CpuReq      int `bson:"cpu_req,omitempty"             json:"cpu_req,omitempty"`
	MemoryReq   int `bson:"memory_req,omitempty"          json:"memory_req,omitempty"`
}

type RoleType added in v1.7.0

type RoleType string

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