Skip to content

Conversation

FengPan-Frank
Copy link
Contributor

@FengPan-Frank FengPan-Frank commented Sep 9, 2025

Why I did it

Create sidecar container which will stub systemd script, so that telemetry container rollout-ed via k8s could be managed by systemd script with naming change, as well as container checker logic.

Work item tracking
  • Microsoft ADO (number only):

How I did it

  1. Added systemd_stub service, which check sha256 for stub file regularly and overwrite
  2. Stub into /usr/local/bin/telemetry.sh, so that systemd cmd could keep compatible, but the implementation changes into kubectl
  3. Stub into monit container_checker, since container name will be changed when it's rollout-ed via k8s, but it will has label "raw_container_name=telemetry", thus update is in get_current_running_from_dockers
  4. Added env IS_V1_ENABLED to control telemetry.sh operation,
    IS_V1_ENABLED as true will recover system's original telemetry.sh which used as rollback case
    IS_V1_ENABLED as false will used to stub k8s supported telemetry.sh and move on upgrade.

How to verify it

image

tested on kubesonic env as well.
image

Which release branch to backport (provide reason below if selected)

  • 202205
  • 202211
  • 202305
  • 202311
  • 202405
  • 202411
  • 202505

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)

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

stderr_syslog=true
dependent_startup=true
dependent_startup_wait_for=rsyslogd:running
environment=IS_V1_ENABLED=%(ENV_IS_V1_ENABLED)s
Copy link

@make1980 make1980 Sep 23, 2025

Choose a reason for hiding this comment

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

do you have an extra 's' here?
#Closed

Choose a reason for hiding this comment

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

also is this really needed? I don't remember seeing this for the env var used by telemetry

Copy link
Contributor Author

Choose a reason for hiding this comment

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

without 's' Supervisor will not substitute the value, but treat it as a literal string, refer https://supervisord.org/configuration.html#environment-variables

Copy link
Contributor Author

Choose a reason for hiding this comment

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

do you mean IS_V1_ENABLED? it's used in systemd_stub.py

from sonic_py_common import logger as log
logger = log.Logger()

def env_bool(name: str, default: bool = False) -> bool:
Copy link

@make1980 make1980 Sep 23, 2025

Choose a reason for hiding this comment

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

env_bool -> get_bool_env_var #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed.

rules/scripts.mk Outdated
CONTAINER_CHECKER = container_checker
$(CONTAINER_CHECKER)_PATH = files/image_config/monit

TELEMETRY_SYSTEMD = telemetry_sydtemd
Copy link

@make1980 make1980 Sep 23, 2025

Choose a reason for hiding this comment

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

typo: telemetry_sydtemd #Closed

Choose a reason for hiding this comment

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

also what is telemetry_systemd?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed.

$(CONTAINER_CHECKER)_PATH = files/image_config/monit

TELEMETRY_SYSTEMD = telemetry_sydtemd
$(TELEMETRY_SYSTEMD)_PATH = files/scripts
Copy link

@make1980 make1980 Sep 23, 2025

Choose a reason for hiding this comment

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

where is this variable used? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

used in rules/docker-telemetry-sidecar.mk

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link

@make1980 make1980 left a comment

Choose a reason for hiding this comment

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

:shipit:

@mssonicbld
Copy link
Collaborator

Cherry-pick PR to msft-202412: Azure/sonic-buildimage-msft#1686

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants