Update telemetry entry sh to support k8s start and keep compatible with systemd start flow#24061
Conversation
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
systemd start flow
ed6dc1f to
2709f1e
Compare
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
| #!/usr/bin/env bash | ||
|
|
||
| # Control with env var launch_by, only used if container is launched via k8s | ||
| if [[ "${launch_by:-}" == "k8s" ]]; then |
There was a problem hiding this comment.
how do you pass in the environment variable? this is started by supervisord but I assume the environment variable set by k8s will also be available? #Closed
There was a problem hiding this comment.
This env will not be set by default so that existing mgmt test will keep working as originally, when k8s rollout telemetry image this env will be set via daemonset config
|
|
||
| DST="/usr/share/sonic/hwsku" | ||
| rm -rf -- "$DST" | ||
| ln -s -- "$SRC_HWSKU" "$DST" |
There was a problem hiding this comment.
why you need to create symlinks? Is it relating to k8s features? #Closed
There was a problem hiding this comment.
not for k8s feature, this was used in currently telemetry.sh
, we only try to launch telemetry with the same parameter/mount/env but from k8s instead of systemd path.There was a problem hiding this comment.
k8s can only have the volume name as static instead of generating volume based on label of the node - so we create the symlink at run time based on the node's sku/platform.
There was a problem hiding this comment.
The 2 DST folders above are RO mounted folder. I do not understand why you need to rm them and create symlink.
There was a problem hiding this comment.
added this logic to first remove the symlink/file/directory at DST in case they're not expected and then run "ln -s" just once.
There was a problem hiding this comment.
@qiluo-msft - the DST folders are not mounted. the mounted folder is /usr/share/sonic/device/
| [[ -n "${PLATFORM:-}" && -n "${HWSKU:-}" ]] || { echo "ERROR: PLATFORM/HWSKU not set in $ENV_FILE."; exit 1; } | ||
|
|
||
| resolve() { for p in "$@"; do [[ -e "$p" ]] && { printf '%s\n' "$p"; return 0; }; done; return 1; } | ||
| SRC_PLATFORM="$(resolve "/usr/share/sonic/device/${PLATFORM}" "/usr/share/sonic/device/device/${PLATFORM}")" \ |
There was a problem hiding this comment.
seems indeed redundant check, removed.
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Cherry-pick PR to msft-202412: Azure/sonic-buildimage-msft#1700 |
…th systemd start flow (sonic-net#24061) Why I did it Update telemetry entry sh to support k8s start and keep compatible with systemd start flow How I did it With k8s start, it will contains below env sudo docker run -d --rm -it --privileged --net=host --pid=host --ipc=host --tmpfs /usr/share/sonic:rw -v /usr/share/sonic/device:/usr/share/sonic/device:ro -v /etc/sonic:/etc/sonic:ro -v /etc/localtime:/etc/localtime:ro -v /host/reboot-cause:/host/reboot-cause -v /var/run/redis:/var/run/redis -v /var/run/redis-chassis:/var/run/redis-chassis:ro -v /usr/share/sonic/templates/rsyslog-container.conf.j2:/usr/share/sonic/templates/rsyslog-container.conf.j2:ro -e RUNTIME_OWNER=kube -e SYSLOG_TARGET_IP=127.0.0.1 -e NAMESPACE_PREFIX=asic -e launch_by=k8s docker-sonic-telemetry:latest by default it will not be used so that existing rollout mgmt test will not be break. Signed-off-by: Feng Pan <[email protected]>
Why I did it
Update telemetry entry sh to support k8s start and keep compatible with systemd start flow
How I did it
With k8s start, it will contains below env
sudo docker run -d --rm -it --privileged
--net=host --pid=host --ipc=host
--tmpfs /usr/share/sonic:rw
-v /usr/share/sonic/device:/usr/share/sonic/device:ro
-v /etc/sonic:/etc/sonic:ro
-v /etc/localtime:/etc/localtime:ro
-v /host/reboot-cause:/host/reboot-cause
-v /var/run/redis:/var/run/redis
-v /var/run/redis-chassis:/var/run/redis-chassis:ro
-v /usr/share/sonic/templates/rsyslog-container.conf.j2:/usr/share/sonic/templates/rsyslog-container.conf.j2:ro
-e RUNTIME_OWNER=kube
-e SYSLOG_TARGET_IP=127.0.0.1
-e NAMESPACE_PREFIX=asic
-e launch_by=k8s
docker-sonic-telemetry:latest
by default it will not be used so that existing rollout mgmt test will not be break.
How to verify it
Which release branch to backport (provide reason below if selected)
Tested branch (Please provide the tested image version)
Description for the changelog
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)