Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add library to interact with kubernetes #123

Merged
merged 22 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
format
  • Loading branch information
fred-labs committed Jul 29, 2024
commit 244fd6e8eb931fa5b76a441647c7e40c612d62bb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ class KubernetesWaitForPodStatusState(Enum):
IDLE = 1
MONITORING = 2
FAILURE = 3



class KubernetesWaitForPodStatus(BaseAction):

def __init__(self, target: str, regex: bool, status: tuple, namespace: str, within_cluster: bool):
Expand Down Expand Up @@ -85,7 +86,8 @@ def update(self) -> py_trees.common.Status:
def watch_pods(self):
w = watch.Watch()
try:
for event in w.stream(self.client.list_namespaced_pod, namespace=self.namespace): # TODO: make use of send_initial_events=false in the future
# TODO: make use of send_initial_events=false in the future
for event in w.stream(self.client.list_namespaced_pod, namespace=self.namespace):
pod_name = event['object'].metadata.name
pod_status = event['object'].status.phase
if self.current_state == KubernetesWaitForPodStatusState.MONITORING:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ def setup(self, **kwargs):
def execute(self, node_name: str, state_sequence: list, allow_initial_skip: bool, fail_on_unexpected: bool, keep_running: bool):
print(f"AAAAAAAAAAAAAAAAAAA EXECUTE {node_name} {state_sequence} {allow_initial_skip} {fail_on_unexpected } {keep_running}")
if self.node_name != node_name or self.state_sequence != state_sequence:
raise ValueError(f"Updating node name or state_sequence not supported. {self.node_name} != {node_name}, {self.state_sequence} != {state_sequence}")
raise ValueError(
f"Updating node name or state_sequence not supported. {self.node_name} != {node_name}, {self.state_sequence} != {state_sequence}")
fmirus marked this conversation as resolved.
Show resolved Hide resolved

if all(isinstance(state, tuple) and len(state) == 2 for state in self.state_sequence):
self.state_sequence = [state[0] for state in self.state_sequence]
Expand Down
Loading