Skip to content
This repository was archived by the owner on Nov 29, 2023. It is now read-only.
This repository was archived by the owner on Nov 29, 2023. It is now read-only.

creating cluster with workloadIdentity enabled is not supported as the workloadIdentity field is not part of the proto #42

@nimrodf1

Description

@nimrodf1

If you are still having issues, please be sure to include as much information as possible:

Environment details

  • OS type and version:
  • Python version: 3.8.3
  • pip version: pip --version
  • google-cloud-container version: pip show google-cloud-container

Steps to reproduce

Here is the description of the cluster resource.
Here is the proto for the cluster. As you can see it doesn't include the workloadIdentityConfig.

Code example

This is a simplified version of the code I ran to find the issue -

from google.oauth2 import service_account
from google.cloud import container_v1beta1

class GoogleCloudKubernetesClient(object):

  def __init__(self, file, project_id, zone):
    credentials = service_account.Credentials.from_service_account_file(
        filename=file)
    self.client = container_v1beta1.ClusterManagerClient(credentials=credentials)
    self.project_id = project_id
    self.zone = zone

  def create_cluster(self, cluster):
    response = self.client.create_cluster(self.project_id, self.zone, cluster=cluster)


def main():
  cluster_data = {
      "name": "test-cluster",
      "master_auth": {
          "username": "admin",
      },
      "node_pools": [
          {"name": "asdf"}
          ],
      "initial_cluster_version": "1.16",
      "location": "europe-west1-b",
      "workload_identity_config": {"workload_pool": "velos-auto-1.svc.id.goog"}
  }

  kube = GoogleCloudKubernetesClient(file='~/service-account.json', project_id='proj-name', zone='europe-west1-b')

  kube.create_cluster(cluster_data)


if __name__ == '__main__':
  main()

Stack trace

Traceback (most recent call last):
  File "/usr/local/google/home/user/IdeaProjects/Go_tmp_tests/mian.py", line 45, in <module>
    main()
  File "/usr/local/google/home/user/IdeaProjects/Go_tmp_tests/mian.py", line 41, in main
    kube.create_cluster(cluster_data)
  File "/usr/local/google/home/user/IdeaProjects/Go_tmp_tests/mian.py", line 17, in create_cluster
    response = self.client.create_cluster(self.project_id, self.zone, cluster=cluster)
  File "/usr/local/google/home/niuser/.local/lib/python3.7/site-packages/google/cloud/container_v1beta1/gapic/cluster_manager_client.py", line 455, in create_cluster
    project_id=project_id, zone=zone, cluster=cluster, parent=parent
ValueError: Protocol message Cluster has no "workload_identity_config" field.

Making sure to follow these steps will guarantee the quickest resolution possible.

Thanks!

Metadata

Metadata

Assignees

Labels

api: containerIssues related to the googleapis/python-container API.externalThis issue is blocked on a bug with the actual product.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions