GithubHelp home page GithubHelp logo

Comments (7)

tseaver avatar tseaver commented on June 15, 2024 1

@mholleville Thanks for the report. This is due to a strangeness in the proto file for the Cluster service, which deprecates the three original atttributes of the ListNodePoolsRequest message (project_id, zone, cluster_id) and makes the fourth one (parent) required.

As a workaround, you can pass None for the three deprecated arguments, e.g.:

parent = '/projects/{}/locations/{}/clusters/{}'.format(project_id, zone, cluster_id)
pool_iter = client.list_node_pools(parent=parent, project_id=None, zone=None, cluster_id=None)
for pool in pool_iter:
   do_something_with(pool)

@lukesneeringer I don't understand how that is supposed to work, but it definitely trips up our code generator: we generated the deprecated fields as required positional arguments! This issue actually infects pretty much every method of the Python container client.

from python-container.

mholleville avatar mholleville commented on June 15, 2024

Trying but google.api_core.exceptions.InvalidArgument: 400 Location "locations" does not exist. :(

from python-container.

lukesneeringer avatar lukesneeringer commented on June 15, 2024

The location should probably be either global or a specific location (e.g. us-central-1).

from python-container.

tseaver avatar tseaver commented on June 15, 2024

@noahdietz, can you recommend a way forward? It looks like the GAPIC YAML file is b0rked.

from python-container.

tseaver avatar tseaver commented on June 15, 2024

A little bird says maybe I should ask @dazuma instead for help here.

from python-container.

dijitali avatar dijitali commented on June 15, 2024

@mholleville - I think there might have been a typo in the comment above (slash before projects), this works for me with both a regional and zonal cluster:

parent = 'projects/{}/locations/{}/clusters/{}'.format(project_id, location, cluster_id)
print (client.list_node_pools(parent=parent, project_id=None, zone=None, cluster_id=None))

from python-container.

askmeegs avatar askmeegs commented on June 15, 2024

@mholleville - I think there might have been a typo in the comment above (slash before projects), this works for me with both a regional and zonal cluster:

parent = 'projects/{}/locations/{}/clusters/{}'.format(project_id, location, cluster_id)
print (client.list_node_pools(parent=parent, project_id=None, zone=None, cluster_id=None))

Following up on this issue - dijitali@'s example is working for me, google_cloud_container 2.4.0, with us-central1 set as the location --

from google.cloud.container_v1.services.cluster_manager import ClusterManagerClient
from google.cloud.container_v1.types import cluster_service
import google.auth

credentials, project_id = google.auth.default()
location = "us-central1"
cluster_id="regional-cluster"

client = ClusterManagerClient(credentials=credentials)

parent = 'projects/{}/locations/{}/clusters/{}'.format(project_id, location, cluster_id)
print (client.list_node_pools(parent=parent, project_id=None, zone=None, cluster_id=None))

Output:

node_pools {
  name: "default-pool"
  config {
    machine_type: "e2-medium"
...

Closing this issue given that there's a suitable workaround for the deprecated fields.

from python-container.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.