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

Wait if the namespace we are monitoring doesn't exist (yet) #38

Open
guidoiaquinti opened this issue Nov 16, 2021 · 3 comments
Open

Wait if the namespace we are monitoring doesn't exist (yet) #38

guidoiaquinti opened this issue Nov 16, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@guidoiaquinti
Copy link

First of all, thank you for this GitHub action! 👏

Bug description

Maybe this is by design but the action doesn't seems to wait if the namespace we are monitoring doesn't exist

Expected behaviour

The action should wait till the namespace and its resources are ready.

Actual behaviour

The action doesn't wait if the namespace doesn't exist

Your personal set up

GitHub action config:

    - name: Wait until all the resources are fully deployed in k8s
      uses: jupyterhub/action-k8s-await-workloads@main
      with:
        namespace: "posthog"
        workloads: "" # all
        timeout: 600
        max-restarts: 15

GitHub action logs:

Run jupyterhub/action-k8s-await-workloads@main
  with:
    namespace: posthog
    timeout: 600
    max-restarts: 15

Awaiting workloads
================================================================================
Settings:
- workloads: 
- namespace: posthog
- timeout: 600
- max-restarts: 15

Workload overview
--------------------------------------------------------------------------------
/usr/local/bin/kubectl get ds,deploy,sts --namespace=posthog
No resources found in posthog namespace.

Workloads awaited
--------------------------------------------------------------------------------

All workloads awaited!
--------------------------------------------------------------------------------
@guidoiaquinti guidoiaquinti added the bug Something isn't working label Nov 16, 2021
@welcome
Copy link

welcome bot commented Nov 16, 2021

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively.
welcome
You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! 👋

Welcome to the Jupyter community! 🎉

@consideRatio
Copy link
Member

Ah hmmm, this makes sense in a way, but it would introduce some complexity that could be complicated to handle.

Consider that we assume no namespace yet exists, then perhaps the deployment resources hasn't been created either. When the namespace is created, perhaps this action completes directly by inspecting the super-fresh namespace and finding no resources. So, the logic to wait for a namespace - should it be "wait for a namespace, and if it doesn't exist during the first check, wait X seconds more after its creation to ensure the various deployments etc has got time to be registered with the k8s api-server"?

Can you describe the situation you are in when you end up with the possibility of needing to wait for a k8s namespace to be created? I've only used this action following running a helm upgrade --install command.

@guidoiaquinti
Copy link
Author

guidoiaquinti commented Nov 16, 2021

Consider that we assume no namespace yet exists, then perhaps the deployment resources hasn’t been created either. When the namespace is created, perhaps this action completes directly by inspecting the super-fresh namespace and finding no resources. So, the logic to wait for a namespace - should it be “wait for a namespace, and if it doesn’t exist during the first check, wait X seconds more after its creation to ensure the various deployments etc has got time to be registered with the k8s api-server”?

Thank you for the prompt response @consideRatio 🙌 I see your point and unfortunately I don’t think there is a silver bullet.

To fully solve this, we’ll probably need to extend the user input to provide a list of resources we should wait for. I don’t think we can archive the above by relying only on the ds, deploy, sts conditions we have now.

Can you describe the situation you are in when you end up with the possibility of needing to wait for a k8s namespace to be created? I’ve only used this action following running a helm upgrade --install command.

The use case is to support scenarios where the helm upgrade is an indirect action (e.g. executed during cluster provisioning). Here we control when we create the cluster but not when helm upgrade --install gets executed.

As workaround, adding something like as pre-step before action-k8s-await-workloads might work:

while ! kubectl wait CONDITION --timeout=60s --all
do
  sleep 10
done

might work, but that’s far from being ideal.

Looking forward to hear your feedback. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants