Open matusnovak opened 8 months ago
The get
functions are mainly designed to retrieve a single resource. For example, it is possible to get a specific node by name (in this case, the node named docker-desktop
):
node = k8s.core.v1.Node.get("docker-desktop", "docker-desktop")
pulumi.export("resourceVersion", node.metadata.resource_version)
While the NodeList
class does have a get
function, it isn't an actual resource and doesn't work as expected. That's my understanding, at least.
I'm seeing the same behavior.
From the docs:
NodeList is the whole list of all Nodes which have been registered with master.
I don't get why it should need an id
indeed. And it doesn't work for me either. Seems like a bug.
What happened?
I am trying to retrieve a list of existing kubernetes cluster nodes, the same thing that
kubectl get node
provides.Based on the documentation, the
.get()
method of each resource should provide a way to retrieve an existing resource.Moreover, based on this answer: https://www.pulumi.com/ai/answers/1030542e-799d-49e2-b67d-75846a09c1c0 it should be simple as calling
get("nodes")
onpulumi_kubernetes.core.v1.NodeList
.However, that does not work as expected. It fails with
NodeList.get() missing 1 required positional argument: 'id'
. That does not make sense. TheNodeList.get("nodes")
should not need anid
.I have tried providing the following values for the
id
parameter of theNodeList.get
method:id
property of the kubernetesProvider
class.None
kubectl describe node
System Info -> Machine IDkubectl describe node
System Info -> System UUIDkubectl describe node
ProviderIDNone of them work.
See the example below.
Example
Minimal Python example:
Output of the above example on
pulumi up
:Output of
pulumi about
Additional context
No response
Contributing
Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).