英文:
How do I programmatically check if a secondary ip service range is in use by a GKE cluster?
问题
我预先为我的GKE集群创建了辅助范围以供使用。
我如何以编程方式检查辅助范围当前是否被集群使用或空闲?
我使用Python API。
我甚至不知道如何列出VPC中的辅助范围。查看文档,我唯一看到与VPC有关的事情是VPC访问连接器。
英文:
I pre-create secondary ranges for my GKE clusters to use.
How do I programmatically check if a secondary range is currently in use by a cluster or is free?
I use the python API.
I can't even see how to list secondary ranges in a VPC. Looking at the docs the only thing I see remotely related to VPC is for VPC access connectors:
答案1
得分: 2
The VPC components are part of the google-cloud-compute, you should check the SubnetworksClient
The SubnetworkSecondaryRange is an attribute of the class Subnetwork
There is no flag "use" in the secondary ranges because the secondary ranges can be used in more than one cluster, because of that you need to implement some logic to loop through all the clusters and check for the secondary ranges in use.
英文:
The VPC components are part of the google-cloud-compute you should check the SubnetworksClient
The SubnetworkSecondaryRange is an attribute of the class Subnetwork
There is no flag "use" in the secondary ranges because the secondary ranges can be used in more than one cluster, because of that you need to implement some logic to loop through all the clusters and check for the secondary ranges in use.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论