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

get_kube_node_pool_nodes crashes when the pool hasn't been created yet #237

Open
Ngoguey42 opened this issue Sep 29, 2024 · 0 comments
Open

Comments

@Ngoguey42
Copy link

👋👋

I'm experiencing a crash when trying to retrieve the list of name of the nodes that are created by ovh.cloudproject.KubeNodePool.

pulumi up
Previewing update (dev):
     Type                              Name               Plan       Info
 +   pulumi:pulumi:Stack               079-dev            create     1 error
 +   ├─ ovh:CloudProject:Kube          ovh-kube-provider  create
 +   └─ ovh:CloudProject:KubeNodePool  ovh-node-pool      create

Diagnostics:
  pulumi:pulumi:Stack (079-dev):
    error: Program failed with an unhandled exception:
    Traceback (most recent call last):
      File "/Users/nico/test/079/__main__.py", line 25, in <module>
        nodes = ovh.cloudproject.get_kube_node_pool_nodes(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/nico/test/079/venv/lib/python3.12/site-packages/pulumi_ovh/cloudproject/get_kube_node_pool_nodes.py", line 126, in get_kube_node_pool_nodes
        __ret__ = pulumi.runtime.invoke('ovh:CloudProject/getKubeNodePoolNodes:getKubeNodePoolNodes', __args__, opts=opts, typ=GetKubeNodePoolNodesResult).value
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/nico/test/079/venv/lib/python3.12/site-packages/pulumi/runtime/invoke.py", line 121, in invoke
        return _sync_await(awaitableInvokeResult)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/nico/test/079/venv/lib/python3.12/site-packages/pulumi/runtime/sync_await.py", line 66, in _sync_await
        return fut.result()
               ^^^^^^^^^^^^
      File "/Users/nico/test/079/venv/lib/python3.12/site-packages/pulumi/runtime/invoke.py", line 306, in wait_for_fut
        return await asyncio.ensure_future(do_rpc())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/nico/test/079/venv/lib/python3.12/site-packages/pulumi/runtime/invoke.py", line 302, in do_rpc
        raise error
    Exception: invoke of ovh:CloudProject/getKubeNodePoolNodes:getKubeNodePoolNodes failed: [kube_id] Missing required argument: The argument "kube_id" is required, but no definition was found. ()
cat __main__.py Pulumi.dev.yaml Pulumi.yaml requirements.txt
import pulumi
import pulumi_ovh as ovh

SERVICE_NAME = "REDACTED"

ovh_kube_cluster = ovh.cloudproject.Kube(
    "ovh-kube-provider",
    service_name=SERVICE_NAME,
    name="my-test-cluster",
    region='GRA11',
)

node_pool = ovh.cloudproject.KubeNodePool(
    "ovh-node-pool",
    name='my-node-pool',
    flavor_name="d2-4",
    kube_id=ovh_kube_cluster.id,
    desired_nodes=2,
    max_nodes=2,
    min_nodes=2,
    service_name=SERVICE_NAME,
)

nodes = ovh.cloudproject.get_kube_node_pool_nodes(
    kube_id=ovh_kube_cluster.id,
    name=node_pool.name,
    service_name=SERVICE_NAME,
)




encryptionsalt: REDACTED
config:
  ovh:applicationKey:
    secure: REDACTED
  ovh:applicationSecret:
    secure: REDACTED
  ovh:consumerKey:
    secure: REDACTED
  ovh:endpoint: ovh-eu





name: "079"
runtime:
  name: python
  options:
    toolchain: pip
    virtualenv: venv
description: A minimal Python Pulumi program
config:
  pulumi:tags:
    value:
      pulumi:template: python






pulumi>=3.0.0,<4.0.0
pulumi-ovh>=0.49,!=0.50

pulumi about
CLI          
Version      3.132.0
Go Version   go1.23.1
Go Compiler  gc

Plugins
KIND      NAME    VERSION
resource  ovh     0.49.0
language  python  unknown

Host     
OS       darwin
Version  14.6.1
Arch     x86_64

This project is written in python: executable='/Users/nico/test/079/venv/bin/python' version='3.12.5'

Current Stack: organization/079/dev

Found no resources associated with dev

Found no pending operations associated with dev

Backend        
Name           ngoguey-mbp
URL            file://~
User           nico
Organizations  
Token type     personal

Dependencies:
NAME          VERSION
fqdn          1.5.1
isoduration   20.11.0
jsonpointer   3.0.0
jupyter       1.1.1
pip           24.2
pulumi_ovh    0.49.0
uri-template  1.3.0
webcolors     24.8.0
wheel         0.44.0

Pulumi locates its logs in /var/folders/50/ccj8r__12yz02g03vhq93r7c0000gn/T/ by default

Additional details

get_kube_node_pool_nodes only crashes during the preview phase of the first pulumi up (i.e. the one that creates the kube cluster).

I hacked the asyncio loop to inspect the status of kube_id passed to get_kube_node_pool_nodes. I believe that get_kube_node_pool_nodes crashes only when kube_id is not known.

import asyncio, nest_asyncio
nest_asyncio.apply()
is_kube_id_known = asyncio.get_running_loop().run_until_complete(ovh_kube_cluster.id.is_known())
print(f'{is_kube_id_known=:}')

Stdout before a crash:

    is_kube_id_known=False

Stdout before a success:

    is_kube_id_known=True

Mitigation

I have been able to prevent the crash by gating the call to get_kube_node_pool_nodes so that it isn't called during the preview run of the code. But I don't think I can work with this on the long run.

if not pulumi.runtime.is_dry_run():
    nodes = ovh.cloudproject.get_kube_node_pool_nodes(
        kube_id=ovh_kube_cluster.id,
        name=node_pool.name,
        service_name=SERVICE_NAME,
    )
@Ngoguey42 Ngoguey42 changed the title ovh.cloudproject.get_kube_node_pool_nodes crashes when the pool hasn't been created yet get_kube_node_pool_nodes crashes when the pool hasn't been created yet Sep 29, 2024
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

No branches or pull requests

1 participant