Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: platform environment variables #267

Merged
merged 6 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions docs/2.4/manual/dop/guides/reference/env.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# 平台级环境变量

## 公共环境变量

> 以下环境变量,流水线和应用运行时都会存在
CeerDecy marked this conversation as resolved.
Show resolved Hide resolved

| 变量名称 | 说明 | 示例 |
|---------------------|------------------|-------------------|
| `DICE_NAMESPACE` | 当前应用所在的Namespace | project-1904-test |
CeerDecy marked this conversation as resolved.
Show resolved Hide resolved
| `DICE_ROOT_DOMAIN` | erda中心域名 | daily.terminus.io |
| `DICE_CLUSTER_NAME` | 集群名称 | erda-jicheng |
| `DICE_PROTOCOL` | 协议 | https |

## 流水线环境变量

> 以下环境变量,存在于流水线Action中

| 变量名称 | 说明 | 示例 |
|---------------------------------|---------------|-----------------------------------------------------------------|
| `GITTAR_AUTHOR` | 作者 | Demo |
| `GITTAR_BRANCH` | 分支 | feature/1.0 |
| `GITTAR_COMMIT` | commit ID | 3ad7a17163ee8f1a431389bea75a2738e710a4f0 |
| `GITTAR_MESSAGE` | 提交信息 | feat: update pipeline |
| `GITTAR_REPO` | 仓库地址 | http://gittar.namespace.svc.cluster.local/demo-project/demo-app |
| `PIPELINE_TIME_BEGIN_TIMESTAMP` | 流水线开始时间戳 | 1707048002 |
| `PIPELINE_TASK_LOG_ID` | 流水线Task日志ID | pipeline-task-1486922756137087 |
| `PIPELINE_TASK_NAME` | 流水线Task名称 | uc-latest-release |
| `PIPELINE_LIMITED_DISK` | 流水线最大磁盘大小(MB) | 128 |
| `PIPELINE_LIMITED_MEM` | 流水线最大内存大小(MB) | 128 |
| `PIPELINE_DEBUG_MODE` | 流水线Debug模式 | false |
| `PIPELINE_TASK_ID` | 流水线TaskID | 1486922756137087 |
| `PIPELINE_LIMITED_CPU` | 流水线最大CPU数 | 0.4 |
| `DICE_OPENAPI_ADDR` | openapi集群内部地址 | erda-server.default.svc.cluster.local:9529 |
| `DICE_OPENAPI_PUBLIC_URL` | openapi外部域名地址 | https://openapi.erda.daily.terminus.io/ |
| `DICE_VERSION` | erda版本 | 2.4 |
| `DICE_HTTPS_PORT` | https端口 | 443 |
| `DICE_STORAGE_MOUNTPOINT` | 存储路径点 | /netdata |

## 应用运行时环境变量
CeerDecy marked this conversation as resolved.
Show resolved Hide resolved

> 以下环境变量,存在于应用运行时

| 变量名称 | 说明 | 示例 |
|-------------------------|------------------|---------------------------------------|
| `POD_IP` | Pod IP | 10.16.3.194 |
| `SELF_PORT` | Pod端口 | 25565 |
| `SELF_PORT(n)` | Pod开放的端口(n >= 0) | 25565 |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要确认下,现在除了 0 以外是否还存在其他的标号

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没有其他标号

image

| `SELF_HOST` | Pod集群内部地址 | demo.demo-namespace.svc.cluster.local |
| `TERMINUS_TA_ENABLE` | 开启前端Ta监控 | true |
| `TERMINUS_AGENT_ENABLE` | 是否开启agent代理 | true |
CeerDecy marked this conversation as resolved.
Show resolved Hide resolved
| `DICE_RUNTIME` | Runtime ID | 19635 |
| `DICE_MEM_REQUEST` | 申请的内存大小 | 256 |
| `DICE_MEM_LIMIT` | 最大内存大小 | 256 |
| `DICE_ORG_NAME` | 组织名称 | erda-development |
| `DICE_APPLICATION_ID` | 应用ID | 8766 |
| `DICE_CPU_ORIGIN` | CPU总大小 | 0.1 |
CeerDecy marked this conversation as resolved.
Show resolved Hide resolved
| `DICE_CPU_REQUEST` | 申请的CPU大小 | 0.05 |
| `DICE_IS_EDGE` | 是否为边缘集群? | true |
CeerDecy marked this conversation as resolved.
Show resolved Hide resolved
| `DICE_PROJECT_ID` | 项目ID | 1904 |
| `DICE_PROJECT_NAME` | 项目名称 | erda-development |
| `DICE_MEM_ORIGIN` | 内存总大小 | 128 |
CeerDecy marked this conversation as resolved.
Show resolved Hide resolved
| `DICE_APPLICATION_NAME` | 应用名称 | go-demo |
| `DICE_WORKSPACE` | 应用工作空间 | test |
| `DICE_CPU_LIMIT` | 最大CPU数 | 0.1 |
| `DICE_ORG_ID` | 组织ID | 633 |
| `DICE_CLUSTER_TYPE` | 集群类型 | kubernetes |
| `DICE_HTTP_PORT` | http端口 | 80 |
| `DICE_USER_ID` | 用户ID | 22304 |
| `DICE_SERVICE_NAME` | service名称 | golang-check |
69 changes: 69 additions & 0 deletions docs/en/next/manual/dop/guides/reference/env.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Platform Environment Variables

## Common Environment Variables

> The following environment variables are present during both pipeline execution and application runtime.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Runtime 是平台定义含义


| Variable Name | Description | Example |
|---------------------|--------------------------------------|-------------------|
| `DICE_NAMESPACE` | Namespace of the current application | project-1904-test |
| `DICE_ROOT_DOMAIN` | Erda central domain | daily.terminus.io |
| `DICE_CLUSTER_NAME` | Cluster name | erda-jicheng |
| `DICE_PROTOCOL` | Protocol | https |

## Pipeline Environment Variables

> The following environment variables are present in the pipeline Action.

| Variable Name | Description | Example |
|---------------------------------|-----------------------------------------|-----------------------------------------------------------------|
| `GITTAR_AUTHOR` | Author | Demo |
| `GITTAR_BRANCH` | Branch | feature/1.0 |
| `GITTAR_COMMIT` | Commit ID | 3ad7a17163ee8f1a431389bea75a2738e710a4f0 |
| `GITTAR_MESSAGE` | Commit message | feat: update pipeline |
| `GITTAR_REPO` | Repository address | http://gittar.namespace.svc.cluster.local/demo-project/demo-app |
| `PIPELINE_TIME_BEGIN_TIMESTAMP` | Pipeline start timestamp | 1707048002 |
| `PIPELINE_TASK_LOG_ID` | Pipeline task log ID | pipeline-task-1486922756137087 |
| `PIPELINE_TASK_NAME` | Pipeline task name | uc-latest-release |
| `PIPELINE_LIMITED_DISK` | Max disk size for the pipeline (MB) | 128 |
| `PIPELINE_LIMITED_MEM` | Max memory size for the pipeline (MB) | 128 |
| `PIPELINE_DEBUG_MODE` | Pipeline debug mode | false |
| `PIPELINE_TASK_ID` | Pipeline task ID | 1486922756137087 |
| `PIPELINE_LIMITED_CPU` | Max CPU count for the pipeline | 0.4 |
| `DICE_OPENAPI_ADDR` | Internal address of the OpenAPI cluster | erda-server.default.svc.cluster.local:9529 |
| `DICE_OPENAPI_PUBLIC_URL` | External domain address of OpenAPI | https://openapi.erda.daily.terminus.io/ |
| `DICE_VERSION` | Erda version | 2.4 |
| `DICE_HTTPS_PORT` | HTTPS port | 443 |
| `DICE_STORAGE_MOUNTPOINT` | Storage mount point | /netdata |

## Application Runtime Environment Variables

> The following environment variables are present during application runtime.

| Variable Name | Description | Example |
|-------------------------|-------------------------------------------|---------------------------------------|
| `POD_IP` | Pod IP | 10.16.3.194 |
| `SELF_PORT` | Pod port | 25565 |
| `SELF_PORT(n)` | Possible open ports of the Pod (n >= 0) | 25565 |
| `SELF_HOST` | Internal address of the Pod in Kubernetes | demo.demo-namespace.svc.cluster.local |
| `TERMINUS_TA_ENABLE` | Enable frontend TA monitoring | true |
| `TERMINUS_AGENT_ENABLE` | Enable agent proxy | true |
| `DICE_RUNTIME` | Runtime ID | 19635 |
| `DICE_MEM_REQUEST` | Requested memory size | 256 |
| `DICE_MEM_LIMIT` | Max memory size | 256 |
| `DICE_ORG_NAME` | Organization name | erda-development |
| `DICE_APPLICATION_ID` | Application ID | 8766 |
| `DICE_CPU_ORIGIN` | Total CPU size | 0.1 |
| `DICE_CPU_REQUEST` | Requested CPU size | 0.05 |
| `DICE_IS_EDGE` | Is it an edge cluster? | true |
| `DICE_PROJECT_ID` | Project ID | 1904 |
| `DICE_PROJECT_NAME` | Project name | erda-development |
| `DICE_MEM_ORIGIN` | Total memory size | 128 |
| `DICE_APPLICATION_NAME` | Application name | go-demo |
| `DICE_WORKSPACE` | Application workspace | test |
| `DICE_CPU_LIMIT` | Max CPU count | 0.1 |
| `DICE_ORG_ID` | Organization ID | 633 |
| `DICE_CLUSTER_TYPE` | Cluster type | kubernetes |
| `DICE_HTTP_PORT` | HTTP port | 80 |
| `DICE_USER_ID` | User ID | 22304 |
| `DICE_SERVICE_NAME` | Service name | golang-check |
69 changes: 69 additions & 0 deletions docs/next/manual/dop/guides/reference/env.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# 平台级环境变量

## 公共环境变量

> 以下环境变量,流水线和应用运行时都会存在

| 变量名称 | 说明 | 示例 |
|---------------------|------------------|-------------------|
| `DICE_NAMESPACE` | 当前应用所在的Namespace | project-1904-test |
| `DICE_ROOT_DOMAIN` | erda中心域名 | daily.terminus.io |
| `DICE_CLUSTER_NAME` | 集群名称 | erda-jicheng |
| `DICE_PROTOCOL` | 协议 | https |

## 流水线环境变量

> 以下环境变量,存在于流水线Action中

| 变量名称 | 说明 | 示例 |
|---------------------------------|---------------|-----------------------------------------------------------------|
| `GITTAR_AUTHOR` | 作者 | Demo |
| `GITTAR_BRANCH` | 分支 | feature/1.0 |
| `GITTAR_COMMIT` | commit ID | 3ad7a17163ee8f1a431389bea75a2738e710a4f0 |
| `GITTAR_MESSAGE` | 提交信息 | feat: update pipeline |
| `GITTAR_REPO` | 仓库地址 | http://gittar.namespace.svc.cluster.local/demo-project/demo-app |
| `PIPELINE_TIME_BEGIN_TIMESTAMP` | 流水线开始时间戳 | 1707048002 |
| `PIPELINE_TASK_LOG_ID` | 流水线Task日志ID | pipeline-task-1486922756137087 |
| `PIPELINE_TASK_NAME` | 流水线Task名称 | uc-latest-release |
| `PIPELINE_LIMITED_DISK` | 流水线最大磁盘大小(MB) | 128 |
| `PIPELINE_LIMITED_MEM` | 流水线最大内存大小(MB) | 128 |
| `PIPELINE_DEBUG_MODE` | 流水线Debug模式 | false |
| `PIPELINE_TASK_ID` | 流水线TaskID | 1486922756137087 |
| `PIPELINE_LIMITED_CPU` | 流水线最大CPU数 | 0.4 |
| `DICE_OPENAPI_ADDR` | openapi集群内部地址 | erda-server.default.svc.cluster.local:9529 |
| `DICE_OPENAPI_PUBLIC_URL` | openapi外部域名地址 | https://openapi.erda.daily.terminus.io/ |
| `DICE_VERSION` | erda版本 | 2.4 |
| `DICE_HTTPS_PORT` | https端口 | 443 |
| `DICE_STORAGE_MOUNTPOINT` | 存储路径点 | /netdata |

## 应用运行时环境变量

> 以下环境变量,存在于应用运行时

| 变量名称 | 说明 | 示例 |
|-------------------------|----------------|---------------------------------------|
| `POD_IP` | Pod IP | 10.16.3.194 |
| `SELF_PORT` | Pod端口 | 25565 |
| `SELF_PORT(0-n)` | Pod开放的端口可能有n多个 | 25565 |
| `SELF_HOST` | Pod集群内部地址 | demo.demo-namespace.svc.cluster.local |
| `TERMINUS_TA_ENABLE` | 开启前端Ta监控 | true |
| `TERMINUS_AGENT_ENABLE` | 是否开启agent代理 | true |
| `DICE_RUNTIME` | Runtime ID | 19635 |
| `DICE_MEM_REQUEST` | 申请的内存大小 | 256 |
| `DICE_MEM_LIMIT` | 最大内存大小 | 256 |
| `DICE_ORG_NAME` | 组织名称 | erda-development |
| `DICE_APPLICATION_ID` | 应用ID | 8766 |
| `DICE_CPU_ORIGIN` | CPU总大小 | 0.1 |
| `DICE_CPU_REQUEST` | 申请的CPU大小 | 0.05 |
| `DICE_IS_EDGE` | 是否为边缘集群? | true |
| `DICE_PROJECT_ID` | 项目ID | 1904 |
| `DICE_PROJECT_NAME` | 项目名称 | erda-development |
| `DICE_MEM_ORIGIN` | 内存总大小 | 128 |
| `DICE_APPLICATION_NAME` | 应用名称 | go-demo |
| `DICE_WORKSPACE` | 应用工作空间 | test |
| `DICE_CPU_LIMIT` | 最大CPU数 | 0.1 |
| `DICE_ORG_ID` | 组织ID | 633 |
| `DICE_CLUSTER_TYPE` | 集群类型 | kubernetes |
| `DICE_HTTP_PORT` | http端口 | 80 |
| `DICE_USER_ID` | 用户ID | 22304 |
| `DICE_SERVICE_NAME` | service名称 | golang-check |