Documentation ¶
Overview ¶
Package conf 定义了 pipeline 所需要的配置选项,这些配置选项都是通过环境变量加载.
Index ¶
- func APITestNetportalAccessK8sNamespaceBlacklist() []string
- func ActionTypeMapping() map[string]string
- func AgentAccessibleCacheTTL() int64
- func AgentContainerPathWhenExecute() string
- func AgentPreFetcherDestDir() string
- func AnalyzedPipelineDefaultDatabaseGCTTLSec() uint64
- func BuildCacheCleanJobCron() string
- func BuildCacheExpireIn() time.Duration
- func ClusterManagerAddr() string
- func CmsBase64EncodedRsaPrivateKey() string
- func CmsBase64EncodedRsaPublicKey() string
- func CollectorAddr() string
- func CollectorPublicURL() string
- func CronCompensateConcurrentNumber() int64
- func CronCompensateTimeMinute() int64
- func CronFailureCreateIntervalCompensateTimeSecond() int64
- func Debug() bool
- func DiceCluster() string
- func DiceHubAddr() string
- func DisablePipelineVolume() bool
- func EventboxAddr() string
- func ExecutorRefreshIntervalMinute() uint64
- func FailedPipelineDefaultResourceGCTTLSec() uint64
- func FinishedPipelineDefaultDatabaseGCTTLSec() uint64
- func GittarAddr() string
- func GittarPublicURL() string
- func HepaAddr() string
- func InitializeSendRunningIntervalNum() uint64
- func InitializeSendRunningIntervalSec() uint64
- func InternalUserID() string
- func ListenAddr() string
- func Load()
- func OpenAPIAddr() string
- func OpenAPIPublicURL() string
- func OpenapiOAuth2TokenClientID() string
- func OpenapiOAuth2TokenClientSecret() string
- func QueueLoopHandleIntervalSec() uint64
- func SchedulerAddr() string
- func SpecifyImagePullPolicy() string
- func StorageURL() string
- func SuccessPipelineDefaultResourceGCTTLSec() uint64
- func TaskDefaultCPU() float64
- func TaskDefaultMEM() float64
- func TaskDefaultTimeout() time.Duration
- func TaskQueueAlertTime() time.Duration
- func TaskRunWaitInterval() time.Duration
- type Conf
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func APITestNetportalAccessK8sNamespaceBlacklist ¶
func APITestNetportalAccessK8sNamespaceBlacklist() []string
APITestNetportalAccessK8sNamespaceBlacklist 返回 api-test 调用 netportal 代理的 k8s namespace 黑名单.
func ActionTypeMapping ¶
ActionTypeMapping 返回新老 action type 映射关系.
func AgentAccessibleCacheTTL ¶
func AgentAccessibleCacheTTL() int64
AgentTTL 返回 agent 下载成功后 accessible 状态缓存的有效时间,默认为 12 小时。
func AgentContainerPathWhenExecute ¶
func AgentContainerPathWhenExecute() string
AgentContainerPathWhenExecute 返回 agent 在 action 运行时需要被挂载的路径, 例如: /opt/emptydir/agent .
func AgentPreFetcherDestDir ¶
func AgentPreFetcherDestDir() string
AgentPreFetcherDestDir 返回 agent 在 PreFetcher 中需要被 entrypoint 拷贝到的目录. 注意:不能是 /opt/action(agent 在镜像中的目录为 /opt/action/agent), 这样会导致 k8s initContainer emptyDir 与 mountDir 相同,entrypoint 执行失败。
func AnalyzedPipelineDefaultDatabaseGCTTLSec ¶ added in v1.1.0
func AnalyzedPipelineDefaultDatabaseGCTTLSec() uint64
AnalyzedPipelineDefaultDatabaseGCTTLSec return default database gc ttl for analyzed pipeline record
func BuildCacheCleanJobCron ¶
func BuildCacheCleanJobCron() string
BuildCacheCleanJobCron 返回清理 构建缓存镜像 任务的 定时配置.
func BuildCacheExpireIn ¶
BuildCacheExpireIn 返回 构建缓存镜像 的失效时间.
func ClusterManagerAddr ¶ added in v1.1.0
func ClusterManagerAddr() string
ClusterManagerAddr return cluster-manager address
func CmsBase64EncodedRsaPrivateKey ¶
func CmsBase64EncodedRsaPrivateKey() string
CmsBase64EncodedRsaPrivateKey 返回 配置管理 用于解密 value 的 rsa private key.
func CmsBase64EncodedRsaPublicKey ¶
func CmsBase64EncodedRsaPublicKey() string
CmsBase64EncodedRsaPublicKey 返回 配置管理 用于加密 value 的 rsa public key.
func CronCompensateConcurrentNumber ¶ added in v1.0.1
func CronCompensateConcurrentNumber() int64
func CronCompensateTimeMinute ¶ added in v1.0.1
func CronCompensateTimeMinute() int64
func CronFailureCreateIntervalCompensateTimeSecond ¶ added in v1.0.1
func CronFailureCreateIntervalCompensateTimeSecond() int64
func DiceCluster ¶
func DiceCluster() string
DiceCluster 返回 pipeline 服务所在集群,用于判断 task 运行在 中心 or SaaS 集群.
func DisablePipelineVolume ¶
func DisablePipelineVolume() bool
DisablePipelineVolume 返回 是否关闭 pipeline volume,只有值引用.
func ExecutorRefreshIntervalMinute ¶ added in v1.1.0
func ExecutorRefreshIntervalMinute() uint64
ExecutorRefreshIntervalMinute return default executor refresh interval
func FailedPipelineDefaultResourceGCTTLSec ¶ added in v1.1.0
func FailedPipelineDefaultResourceGCTTLSec() uint64
FailedPipelineDefaultResourceGCTTLSec return default resource gc for failed pipeline
func FinishedPipelineDefaultDatabaseGCTTLSec ¶ added in v1.1.0
func FinishedPipelineDefaultDatabaseGCTTLSec() uint64
FinishedPipelineDefaultDatabaseGCTTLSec return default database gc ttl for finished pipeline record
func InitializeSendRunningIntervalNum ¶ added in v1.1.0
func InitializeSendRunningIntervalNum() uint64
InitializeSendIntervalNum return initialize send running pipeline id interval num
func InitializeSendRunningIntervalSec ¶ added in v1.1.0
func InitializeSendRunningIntervalSec() uint64
InitializeSendIntervalTime return initialize send running pipeline id interval second
func OpenAPIPublicURL ¶
func OpenAPIPublicURL() string
OpenAPIPublicURL 返回 openapi 的公网地址,用于 SaaS 集群 task 回调中心集群 openapi.
func OpenapiOAuth2TokenClientID ¶
func OpenapiOAuth2TokenClientID() string
OpenapiOAuth2TokenClientID 返回 用于申请 openapi oauth2 token 的客户端 id.
func OpenapiOAuth2TokenClientSecret ¶
func OpenapiOAuth2TokenClientSecret() string
OpenapiOAuth2TokenClientID 返回 用于申请 openapi oauth2 token 的客户端 secret.
func QueueLoopHandleIntervalSec ¶
func QueueLoopHandleIntervalSec() uint64
QueueLoopHandleIntervalSec return reconciler queueManager loop handle interval second.
func SpecifyImagePullPolicy ¶ added in v1.2.0
func SpecifyImagePullPolicy() string
SpecifyImagePullPolicy return default image pull policy
func SuccessPipelineDefaultResourceGCTTLSec ¶ added in v1.1.0
func SuccessPipelineDefaultResourceGCTTLSec() uint64
SuccessPipelineDefaultResourceGCTTLSec return default resource gc for success pipeline
func TaskDefaultTimeout ¶
TaskDefaultTimeout 返回 task 默认超时时间.
func TaskQueueAlertTime ¶
TaskQueueAlertTime 返回 task 排队超过多少时间告警.
func TaskRunWaitInterval ¶
TaskRunWaitInterval 返回 task run 在 wait 过程中的时间间隔. 时间越短越精确,但对 scheduler 压力会变大,建议使用默认值 5s.
Types ¶
type Conf ¶
type Conf struct { ListenAddr string `env:"LISTEN_ADDR" default:":3081"` Debug bool `env:"DEBUG" default:"false"` DiceCluster string `env:"DICE_CLUSTER" default:"local"` // 服务所在集群 // task level TaskDefaultCPU float64 `env:"TASK_DEFAULT_CPU" default:"0.5"` TaskDefaultMEM float64 `env:"TASK_DEFAULT_MEM" default:"2048"` TaskDefaultTimeout time.Duration `env:"TASK_DEFAULT_TIMEOUT" default:"1h"` TaskRunWaitInterval time.Duration `env:"TASK_RUN_WAIT_INTERVAL" default:"5s"` TaskQueueAlertTime time.Duration `env:"TASK_QUEUE_ALERT_TIME" default:"10m"` // agent AgentAccessibleCacheTTL int64 `env:"AGENT_ACCESSIBLE_CACHE_TTL" default:"43200"` // 默认 12 小时 AgentPreFetcherDestDir string `env:"AGENT_PRE_FETCHER_DEST_DIR" default:"/opt/emptydir"` // build cache BuildCacheCleanJobCron string `env:"BUILD_CACHE_CLEAN_JOB_CRON" default:"0 0 0 * * ?"` BuildCacheExpireIn time.Duration `env:"BUILD_CACHE_EXPIRE_IN" default:"168h"` // bundle GittarAddr string `env:"GITTAR_ADDR" required:"false"` OpenAPIAddr string `env:"OPENAPI_ADDR" required:"false"` EventboxAddr string `env:"EVENTBOX_ADDR" required:"false"` DiceHubAddr string `env:"DICEHUB_ADDR" required:"false"` SchedulerAddr string `env:"SCHEDULER_ADDR" required:"false"` HepaAddr string `env:"HEPA_ADDR" required:"false"` CollectorAddr string `env:"COLLECTOR_ADDR" required:"false"` ClusterManagerAddr string `env:"CLUSTER_MANAGER_ADDR" required:"false"` // public url GittarPublicURL string `env:"GITTAR_PUBLIC_URL" required:"true"` OpenAPIPublicURL string `env:"OPENAPI_PUBLIC_URL" required:"true"` CollectorPublicURL string `env:"COLLECTOR_PUBLIC_URL" required:"false"` // oss/nfs storage PipelineStorageURL string `env:"PIPELINE_STORAGE_URL" required:"true"` // action type mapping ActionTypeMappingStr string `env:"ACTION_TYPE_MAPPING"` // git:git-checkout,dicehub:release ActionTypeMapping map[string]string // 默认用户 ID,用于鉴权 InternalUserID string `env:"INTERNAL_USER_ID" default:"1103"` // cms CmsBase64EncodedRsaPublicKey string `` /* 1118-byte string literal not displayed */ CmsBase64EncodedRsaPrivateKey string `` /* 4367-byte string literal not displayed */ // openapi oauth2 token client OpenapiOAuth2TokenClientID string `env:"OPENAPI_OAUTH2_TOKEN_CLIENT_ID" default:"pipeline"` OpenapiOAuth2TokenClientSecret string `env:"OPENAPI_OAUTH2_TOKEN_CLIENT_SECRET" default:"devops/pipeline"` // DisablePipelineVolume default is false, means enable context volumes DisablePipelineVolume bool `env:"DISABLE_PIPELINE_VOLUME" default:"false"` // queue handle loop interval QueueLoopHandleIntervalSec uint64 `env:"QUEUE_LOOP_HANDLE_INTERVAL_SEC" default:"10"` // API-Test APITestNetportalAccessK8sNamespaceBlacklist string `env:"APITEST_NETPORTAL_ACCESS_K8S_NAMESPACE_BLACKLIST" default:"default,kube-system"` // initialize send running pipeline interval InitializeSendRunningIntervalSec uint64 `env:"INITIALIZE_SEND_RUNNING_INTERVAL_SEC" default:"10"` InitializeSendRunningIntervalNum uint64 `env:"INITIALIZE_SEND_RUNNING_INTERVAL_NUM" default:"20"` // cron compensate time CronCompensateTimeMinute int64 `env:"CRON_COMPENSATE_TIME_MINUTE" default:"5"` CronCompensateConcurrentNumber int64 `env:"CRON_COMPENSATE_CONCURRENT_NUMBER" default:"10"` // cron interrupt compensate identification failure time second CronFailureCreateIntervalCompensateTimeSecond int64 `env:"CRON_FAILURE_CREATE_INTERVAL_COMPENSATE_TIME_SECOND" default:"300"` // database gc AnalyzedPipelineDefaultDatabaseGCTTLSec uint64 `env:"ANALYZED_PIPELINE_DEFAULT_DATABASE_GC_TTL_SEC" default:"86400"` // 60 * 60 * 24 analyzed pipeline db record default retains 1 day FinishedPipelineDefaultDatabaseGCTTLSec uint64 `env:"FINISHED_PIPELINE_DEFAULT_DATABASE_GC_TTL_SEC" default:"5184000"` // 60 * 60 * 24 * 30 * 2 finished pipeline db record default retains 2 month // resource gc SuccessPipelineDefaultResourceGCTTLSec uint64 `env:"SUCCESS_PIPELINE_DEFAULT_RESOURCE_GC_TTL_SEC" default:"1800"` // 60 * 30 success pipeline resources default retains 30 min FailedPipelineDefaultResourceGCTTLSec uint64 `env:"FAILED_PIPELINE_DEFAULT_RESOURCE_GC_TTL_SEC" default:"1800"` // 60 * 30 failed pipeline resources default retains 30 min // scheduler executor refresh interval ExecutorRefreshIntervalMinute uint64 `env:"EXECUTOR_REFRESH_INTERVAL_MINUTE" default:"20"` SpecifyImagePullPolicy string `env:"SPECIFY_IMAGE_PULL_POLICY" default:"IfNotPresent"` }
Conf 定义配置对象.