Repost my topic, could someone point out which API...
# general
Repost my topic, could someone point out which API I should use in Pulumi to achieve following goals? We have a business requirement for following steps 1. List all EKS clusters existing on the AWS cloud, and get their name/id 2. Check the cluster status by passing the cluster name/id. 3. Get provider instance by passing the cluster name/id
Hello @fancy-xylophone-7581, I ’ll try to answer as close as possible to your questions with pointers to our documentation. Feel free to ask subsequent questions if it is not clear. 1. which gives you a list of names. Loop over the names, calling which gives you more detailed info about a cluster. 2. From the previous detailed cluster result, use the
output: 3. compute the
which you can pass to the
class similar to what we do in our EKS component:
Many thanks for the help, I will dig into them.
@limited-rainbow-51650 Thanks again, one more question, How could I get the instance of eks.Cluster from id / name / arn? If I can get the instance of that cluster, the step 3 would be much easier by get the field cluster.provider.
@fancy-xylophone-7581 doesn’t the detailed cluster info from step 2 contain all the information you need to calculate the kubeconfig?
@limited-rainbow-51650 It call a private overloaded functions generateKubeconfig to pass these parameters, and it is ugly design to duplicate these codes and if your source updated, my code would be outdated and lead to potential bug. Is there an exposed API that I can get the instance of Provider or Cluster Instance instead of code duplication?
@limited-rainbow-51650 I thought about the requirement last evening, I think that my question is actually: could I create a Pulumi Cluster Object from existing one on the AWS EKS? Or if this cluster is also provisioned by Pulumi, could I create an eks.Cluster instance of it in my local environment.
Just let me know if it is not possible, I can find an alternative way instead. Thanks a lot for your support.
No, retrieving info on existing resources is done via the
functions you see in the provider SDKs. If you use the classes and instantiate them, it indicates that you want Pulumi to create and manage one for you.
For more clarification. here is a case: I have 2 stacks, stack 1 provision the a EKS cluster A and stack 2 provision Helm chart and Kubernetes things. Is it possible stack 2 create a Cluster A instance locally which is identical with the cluster instance in stack 1?