@@ -202,6 +202,22 @@ def _format_timestamp(value: Optional[datetime.datetime]) -> str:
202202 return normalized .strftime ("%Y-%m-%d %H:%M:%S" )
203203
204204
205+ _TIMEZONE_LABEL = "UTC"
206+ _TIME_AWARE_HEADERS = {"LastSeen" , "CreatedAt" , "LastTerminatedTime" }
207+
208+
209+ def _label_time_header (header : str ) -> str :
210+ """시간 관련 컬럼에 타임존 정보를 부착한다."""
211+ if header in _TIME_AWARE_HEADERS :
212+ return f"{ header } ({ _TIMEZONE_LABEL } )"
213+ return header
214+
215+
216+ def _label_time_headers (headers : Sequence [str ]) -> List [str ]:
217+ """시간 컬럼이 포함된 헤더 목록에 타임존 레이블을 일괄 적용한다."""
218+ return [_label_time_header (name ) for name in headers ]
219+
220+
205221def _parse_tail_count (raw : str ) -> int :
206222 """tail -n 입력 문자열을 안전한 정수로 변환."""
207223 try :
@@ -1403,7 +1419,7 @@ def watch_event_monitoring() -> None:
14031419 show_header = True , header_style = "bold magenta" , box = box .ROUNDED
14041420 )
14051421 table .add_column ("Namespace" , style = "bold green" , overflow = "fold" )
1406- table .add_column ("LastSeen" )
1422+ table .add_column (_label_time_header ( "LastSeen" ) )
14071423 table .add_column ("Type" )
14081424 table .add_column ("Reason" )
14091425 table .add_column ("Object" )
@@ -1461,31 +1477,24 @@ def watch_event_monitoring() -> None:
14611477 )
14621478
14631479 frame_key = _make_frame_key ("data" , * frame_parts )
1464- snapshot = _format_table_snapshot (
1465- title = "Event Monitoring" ,
1466- headers = [
1480+ headers = _label_time_headers (
1481+ [
14671482 "Namespace" ,
14681483 "LastSeen" ,
14691484 "Type" ,
14701485 "Reason" ,
14711486 "Object" ,
14721487 "Message" ,
1473- ],
1488+ ]
1489+ )
1490+ snapshot = _format_table_snapshot (
1491+ title = "Event Monitoring" ,
1492+ headers = headers ,
14741493 rows = markdown_rows ,
14751494 command = command_descriptor ,
14761495 status = "success" ,
14771496 )
1478- structured_data = {
1479- "headers" : [
1480- "Namespace" ,
1481- "LastSeen" ,
1482- "Type" ,
1483- "Reason" ,
1484- "Object" ,
1485- "Message" ,
1486- ],
1487- "rows" : markdown_rows ,
1488- }
1497+ structured_data = {"headers" : headers , "rows" : markdown_rows }
14891498 tracker .update (
14901499 frame_key ,
14911500 _compose_group (command_descriptor , table ),
@@ -1541,7 +1550,7 @@ def view_restarted_container_logs() -> None:
15411550 table .add_column ("Namespace" , overflow = "fold" )
15421551 table .add_column ("Pod" , overflow = "fold" )
15431552 table .add_column ("Container" , overflow = "fold" )
1544- table .add_column ("LastTerminatedTime" )
1553+ table .add_column (_label_time_header ( "LastTerminatedTime" ) )
15451554 for i , (ns_pod , p_name , c_name , fat ) in enumerate (displayed_containers , start = 1 ):
15461555 table .add_row (str (i ), ns_pod , p_name , c_name , fat .strftime ("%Y-%m-%d %H:%M:%S" ))
15471556 console .print (
@@ -1751,7 +1760,7 @@ def watch_pod_monitoring_by_creation() -> None:
17511760 table .add_column ("Ready" )
17521761 table .add_column ("Status" )
17531762 table .add_column ("Restarts" , justify = "right" )
1754- table .add_column ("CreatedAt" )
1763+ table .add_column (_label_time_header ( "CreatedAt" ) )
17551764 if show_extra :
17561765 table .add_column ("PodIP" )
17571766 table .add_column ("Node" , overflow = "fold" )
@@ -1839,6 +1848,7 @@ def watch_pod_monitoring_by_creation() -> None:
18391848 )
18401849 if show_extra :
18411850 headers .extend (["PodIP" , "Node" ])
1851+ headers = _label_time_headers (headers )
18421852 snapshot = _format_table_snapshot (
18431853 title = "Pod Monitoring (생성 순)" ,
18441854 headers = headers ,
@@ -2038,7 +2048,7 @@ def _is_non_running(pod: V1Pod) -> bool:
20382048 table .add_column ("Phase" )
20392049 table .add_column ("Ready" )
20402050 table .add_column ("Restarts" , justify = "right" )
2041- table .add_column ("CreatedAt" )
2051+ table .add_column (_label_time_header ( "CreatedAt" ) )
20422052 if show_extra :
20432053 table .add_column ("PodIP" )
20442054 table .add_column ("Node" , overflow = "fold" )
@@ -2118,6 +2128,7 @@ def _is_non_running(pod: V1Pod) -> bool:
21182128 )
21192129 if show_extra :
21202130 headers .extend (["PodIP" , "Node" ])
2131+ headers = _label_time_headers (headers )
21212132 snapshot = _format_table_snapshot (
21222133 title = "Non-Running Pod" ,
21232134 headers = headers ,
@@ -2393,7 +2404,7 @@ def watch_node_monitoring_by_creation() -> None:
23932404 table .add_column ("NodeGroup" , overflow = "fold" )
23942405 table .add_column ("Zone" )
23952406 table .add_column ("Version" )
2396- table .add_column ("CreatedAt" )
2407+ table .add_column (_label_time_header ( "CreatedAt" ) )
23972408
23982409 markdown_rows : List [List [str ]] = []
23992410 frame_parts : List [str ] = []
@@ -2430,33 +2441,25 @@ def watch_node_monitoring_by_creation() -> None:
24302441 frame_parts .append ("|" .join (row ))
24312442
24322443 frame_key = _make_frame_key ("data" , * frame_parts )
2433- snapshot = _format_table_snapshot (
2434- title = "Node Monitoring (생성 순)" ,
2435- headers = [
2444+ headers = _label_time_headers (
2445+ [
24362446 "Name" ,
24372447 "Status" ,
24382448 "Roles" ,
24392449 "NodeGroup" ,
24402450 "Zone" ,
24412451 "Version" ,
24422452 "CreatedAt" ,
2443- ],
2453+ ]
2454+ )
2455+ snapshot = _format_table_snapshot (
2456+ title = "Node Monitoring (생성 순)" ,
2457+ headers = headers ,
24442458 rows = markdown_rows ,
24452459 command = command_descriptor ,
24462460 status = "success" ,
24472461 )
2448- structured_data = {
2449- "headers" : [
2450- "Name" ,
2451- "Status" ,
2452- "Roles" ,
2453- "NodeGroup" ,
2454- "Zone" ,
2455- "Version" ,
2456- "CreatedAt" ,
2457- ],
2458- "rows" : markdown_rows ,
2459- }
2462+ structured_data = {"headers" : headers , "rows" : markdown_rows }
24602463 tracker .update (
24612464 frame_key ,
24622465 _compose_group (command_descriptor , table ),
@@ -2646,7 +2649,7 @@ def watch_unhealthy_nodes() -> None:
26462649 table .add_column ("NodeGroup" , overflow = "fold" )
26472650 table .add_column ("Zone" )
26482651 table .add_column ("Version" )
2649- table .add_column ("CreatedAt" )
2652+ table .add_column (_label_time_header ( "CreatedAt" ) )
26502653
26512654 markdown_rows : List [List [str ]] = []
26522655 frame_parts : List [str ] = []
@@ -2688,33 +2691,25 @@ def watch_unhealthy_nodes() -> None:
26882691 frame_parts .append ("|" .join (row ))
26892692
26902693 frame_key = _make_frame_key ("data" , * frame_parts )
2691- snapshot = _format_table_snapshot (
2692- title = "Unhealthy Node" ,
2693- headers = [
2694+ headers = _label_time_headers (
2695+ [
26942696 "Name" ,
26952697 "Status" ,
26962698 "Reason" ,
26972699 "NodeGroup" ,
26982700 "Zone" ,
26992701 "Version" ,
27002702 "CreatedAt" ,
2701- ],
2703+ ]
2704+ )
2705+ snapshot = _format_table_snapshot (
2706+ title = "Unhealthy Node" ,
2707+ headers = headers ,
27022708 rows = markdown_rows ,
27032709 command = command_descriptor ,
27042710 status = "warning" ,
27052711 )
2706- structured_data = {
2707- "headers" : [
2708- "Name" ,
2709- "Status" ,
2710- "Reason" ,
2711- "NodeGroup" ,
2712- "Zone" ,
2713- "Version" ,
2714- "CreatedAt" ,
2715- ],
2716- "rows" : markdown_rows ,
2717- }
2712+ structured_data = {"headers" : headers , "rows" : markdown_rows }
27182713 tracker .update (
27192714 frame_key ,
27202715 _compose_group (command_descriptor , table ),
0 commit comments