Skip to content

Commit

Permalink
sidecarset docs add sourceContainerNameFrom field (#123)
Browse files Browse the repository at this point in the history
Signed-off-by: liheng.zms <[email protected]>
  • Loading branch information
zmberg authored Aug 23, 2023
1 parent a569c72 commit 5968cbf
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/user-manuals/sidecarset.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,12 @@ spec:
transferEnv:
- sourceContainerName: main
envName: PROXY_IP
- sourceContainerNameFrom:
fieldRef:
apiVersion: "v1"
fieldPath: "metadata.labels['cName']"
# fieldPath: "metadata.annotations['cName']"
envName: TC
volumes:
- Name: nginx.conf
hostPath: /data/nginx/conf
Expand All @@ -209,6 +215,7 @@ spec:
- Share pod containers volumes: If ShareVolumePolicy.type is enabled, the sidecar container will share the other container's VolumeMounts in the pod(don't contains the injected sidecar container)
- Environment variable sharing
- Environment variables can be fetched from another container through spec.containers[x].transferenv, and the environment variable named envName from the container named sourceContainerName is copied to this container
- sourceContainerNameFrom support downwardAPI for container name, such as metadata.name, `metadata.labels['<KEY>']`, `metadata.annotations['<KEY>']`

#### injection pause
**FEATURE STATE:** Kruise v0.10.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@ spec:
transferEnv:
- sourceContainerName: main
envName: PROXY_IP
- sourceContainerNameFrom:
fieldRef:
apiVersion: "v1"
fieldPath: "metadata.labels['cName']"
# fieldPath: "metadata.annotations['cName']"
envName: TC
volumes:
- Name: nginx.conf
hostPath: /data/nginx/conf
Expand All @@ -199,6 +205,7 @@ spec:
- 共享所有卷:通过 spec.containers[i].shareVolumePolicy.type = enabled | disabled 来控制是否挂载pod应用容器的卷,常用于日志收集等 sidecar,配置为 enabled 后会把应用容器中所有挂载点注入 sidecar 同一路经下(sidecar中本身就有声明的数据卷和挂载点除外)
- 环境变量共享
- 可以通过 spec.containers[i].transferEnv 来从别的容器获取环境变量,会把名为 sourceContainerName 容器中名为 envName 的环境变量拷贝到本容器
- sourceContainerNameFrom 支持 downwardAPI 来获取容器name,比如:metadata.name, `metadata.labels['<KEY>']`, `metadata.annotations['<KEY>']`

#### 注入暂停
**FEATURE STATE:** Kruise v0.10.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@ spec:
transferEnv:
- sourceContainerName: main
envName: PROXY_IP
- sourceContainerNameFrom:
fieldRef:
apiVersion: "v1"
fieldPath: "metadata.labels['cName']"
# fieldPath: "metadata.annotations['cName']"
envName: TC
volumes:
- Name: nginx.conf
hostPath: /data/nginx/conf
Expand All @@ -199,6 +205,7 @@ spec:
- 共享所有卷:通过 spec.containers[i].shareVolumePolicy.type = enabled | disabled 来控制是否挂载pod应用容器的卷,常用于日志收集等 sidecar,配置为 enabled 后会把应用容器中所有挂载点注入 sidecar 同一路经下(sidecar中本身就有声明的数据卷和挂载点除外)
- 环境变量共享
- 可以通过 spec.containers[i].transferEnv 来从别的容器获取环境变量,会把名为 sourceContainerName 容器中名为 envName 的环境变量拷贝到本容器
- sourceContainerNameFrom 支持 downwardAPI 来获取容器name,比如:metadata.name, `metadata.labels['<KEY>']`, `metadata.annotations['<KEY>']`

#### 注入暂停
**FEATURE STATE:** Kruise v0.10.0
Expand Down
7 changes: 7 additions & 0 deletions versioned_docs/version-v1.4/user-manuals/sidecarset.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,12 @@ spec:
transferEnv:
- sourceContainerName: main
envName: PROXY_IP
- sourceContainerNameFrom:
fieldRef:
apiVersion: "v1"
fieldPath: "metadata.labels['cName']"
# fieldPath: "metadata.annotations['cName']"
envName: TC
volumes:
- Name: nginx.conf
hostPath: /data/nginx/conf
Expand All @@ -209,6 +215,7 @@ spec:
- Share pod containers volumes: If ShareVolumePolicy.type is enabled, the sidecar container will share the other container's VolumeMounts in the pod(don't contains the injected sidecar container)
- Environment variable sharing
- Environment variables can be fetched from another container through spec.containers[x].transferenv, and the environment variable named envName from the container named sourceContainerName is copied to this container
- sourceContainerNameFrom support downwardAPI for container name, such as metadata.name, `metadata.labels['<KEY>']`, `metadata.annotations['<KEY>']`

#### injection pause
**FEATURE STATE:** Kruise v0.10.0
Expand Down

0 comments on commit 5968cbf

Please sign in to comment.