-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f9cc60d
Showing
8 changed files
with
656 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# k3s-status-lcd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__version__ = '0.1.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/usr/bin/python3 | ||
""" | ||
Render k3s cluster stats on a LCD display | ||
""" | ||
|
||
import os | ||
import time | ||
import struct | ||
import socket | ||
import fcntl | ||
import i2c_lcd | ||
|
||
from kubernetes import client, config | ||
|
||
DISPLAY_DELAY = 10 | ||
|
||
try: | ||
config.load_kube_config(os.path.join(os.environ["HOME"], '.kube/config')) | ||
except Exception as err: | ||
print(err) | ||
|
||
kube_cli = client.CoreV1Api() | ||
lcd = i2c_lcd.lcd() | ||
|
||
def print_welcome(): | ||
lcd.lcd_clear() | ||
lcd.lcd_display_string('k3s lcd status svc', 1) | ||
lcd.lcd_display_string('running ^_^', 2) | ||
|
||
def print_k3s_overview(): | ||
lcd.lcd_clear() | ||
lcd.lcd_display_string('k3s status', 1) | ||
lcd.lcd_display_string('nodes: 3', 2) | ||
lcd.lcd_display_string('pods: 8', 3) | ||
|
||
if __name__ == "__main__": | ||
print("starting service") | ||
try: | ||
print("printing welcome message") | ||
print_welcome() | ||
time.sleep(DISPLAY_DELAY) | ||
|
||
while True: | ||
print("printing k3s overview") | ||
print_k3s_overview() | ||
time.sleep(DISPLAY_DELAY) | ||
|
||
print("printing welcome message") | ||
print_welcome() | ||
time.sleep(DISPLAY_DELAY) | ||
except KeyboardInterrupt: | ||
pass |
Oops, something went wrong.