diff --git a/podstatus/app.py b/podstatus/app.py index 0212b16..690f424 100644 --- a/podstatus/app.py +++ b/podstatus/app.py @@ -42,7 +42,14 @@ bstick = blinkstick.find_first() if not bstick: logging.info("No BlinkStick found") - led_per_pod = 3 + logging.info( + f"BlinkStick found: {bstick.get_description()} - {bstick.get_serial()}" + ) + logging.info( + f"Setting total LED to {config.BLINKSTICK_TOTAL_LED} and grouping to {config.BLINKSTICK_GROUP_LED}" + ) + bstick.set_led_count(config.BLINKSTICK_TOTAL_LED) + led_per_pod = config.BLINKSTICK_GROUP_LED except NoBackendError as e: logging.fatal(f"BlinkStick setup failed: {e}") bstick = None diff --git a/podstatus/config.py b/podstatus/config.py index 1205d3a..6faad3c 100644 --- a/podstatus/config.py +++ b/podstatus/config.py @@ -14,6 +14,8 @@ def __init__(self): self.LOG_LEVEL = self.get_env_var("LOG_LEVEL", "INFO").upper() self.KUBECONFIG = os.getenv("KUBECONFIG", None) self.K8S_NAMESPACE = self.get_env_var("K8S_NAMESPACE") + self.BLINKSTICK_TOTAL_LED = self.get_env_int_var("BLINKSTICK_TOTAL_LED", 15) + self.BLINKSTICK_GROUP_LED = self.get_env_int_var("BLINKSTICK_GROUP_LED", 3) def get_env_var(self, name, default=None): value = os.getenv(name, default) @@ -22,7 +24,7 @@ def get_env_var(self, name, default=None): return value.replace('"', "") def get_env_int_var(self, name, default=None): - value = self.get_env_var(name, default) + value = os.getenv(name, default) try: return int(value) except ValueError: