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/extend some K8s-related utilities. #26

Merged
merged 5 commits into from
Jul 30, 2024

Conversation

aznashwan
Copy link
Contributor

@aznashwan aznashwan commented Jul 29, 2024

This patch notably:

  • extends the various k8s_utils.wait_for_*() functions with configurable retry times/period arguments
  • adds an explicit wait_for_statefulset function
  • formating fixes to platform_util module
  • add decorator to kubectl describe relevant resources in case any wait_for_*() functions fail

Signed-off-by: Nashwan Azhari <nazhari@cloudbasesolutions.com>
Signed-off-by: Nashwan Azhari <nazhari@cloudbasesolutions.com>
Signed-off-by: Nashwan Azhari <nazhari@cloudbasesolutions.com>
Copy link
Collaborator

@bschimke95 bschimke95 left a comment

Choose a reason for hiding this comment

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

LGTM, minor comment but fine for now.

)


def wait_for_statefulset(
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should probably just make this a wait_for_resource in the future. Let's leave it like this for now (as we would need to update all Rocks).

@@ -142,7 +144,7 @@ def wait_for_resource(
resource_type,
name,
"--timeout",
"60s",
"1s",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually, this should be 1min I guess.

Copy link
Contributor Author

@aznashwan aznashwan Jul 29, 2024

Choose a reason for hiding this comment

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

I have “shifted” the wait from the ‘kubectl’ call to the retry function itself via the default values for the kwarga, with the total wait time still amounting to more or less 1minute.

The ‘--timeout’ kwarg to ‘kubectl’ is still required though, otherwise we risk it waiting indefinitely…

Copy link
Contributor Author

Choose a reason for hiding this comment

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

with the total wait time still amounting to more or less 1minute.

Actually it just hit me that the original was about 5 minutes, updated the default kwargs to be about 5minutes again.

Signed-off-by: Nashwan Azhari <nazhari@cloudbasesolutions.com>
Signed-off-by: Nashwan Azhari <nazhari@cloudbasesolutions.com>
@bschimke95 bschimke95 merged commit 6beaf30 into canonical:main Jul 30, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants