googlearchive / k8s-service-catalog

[DEPRECATED] Commandline tool to manage Service Catalog lifecycle and GCP Service Broker atop Kubernetes Cluster
Apache License 2.0
69 stars 31 forks source link

Create Binding - Unable to extrace resource containers #223

Open Evesy opened 5 years ago

Evesy commented 5 years ago

I've managed to get the GCP broker fully working in other projects, however in this instance while I can create ServiceInstance resources OK, attempting to create a ServiceBinding gives forbidden errors (This was a brand new project/cluster)

SC version: 0.1.1 darwin/amd64 (Built from master) Kubectl version:

Client Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.1", GitCommit:"b1b29978270dc22fecc592ac55d903350454310a", GitTreeState:"clean", BuildDate:"2018-07-17T18:53:20Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"11+", GitVersion:"v1.11.5-gke.5", GitCommit:"9aba9c1237d9d2347bef28652b93b1cba3aca6d8", GitTreeState:"clean", BuildDate:"2018-12-11T02:36:50Z", GoVersion:"go1.10.3b4", Compiler:"gc", Platform:"linux/amd64"}

(Gcloud config is set with the right project and zone corresponding to the Kubernetes master for good measure. gcloud auth login and gcloud auth application-default login have both been completed.)

Reproduction steps:

  Status:      Failed - Bind call failed: operation "projects/956662776668/operations/ad3a2b12-153a-11e9-862a-0a580a34001a/1547167738169839785" failed: generic::internal: operation projects/956662776668/operations/ad3a2b12-153a-11e9-862a-0a580a34001a/1547167738169839785 create binding deployment failed: generic::invalid_argument: Operation "operation-1547167739010-57f240f7ddbd1-ec2331d6-ee5d7fdb" failed with
               : [{"code":"RESOURCE_ERROR","location":"/deployments/bfac2d24a-7afc-4124-a52f-e46945778ee2/resources/service-account","message":"{\"ResourceType\":\"iam.v1.serviceAccount\",\"ResourceErrorCode\":\"403\",\"ResourceErrorMessage\":{\"code\":403,\"message\":\"Unable to extract resource containers.\",\"status\":\"PERMISSION_DENIED\",\"details\":[],\"statusMessage\":\"Forbidden\",\"requestPath\":\"https://iam.googleapis.com/v1/projects/service-catalog-228300/serviceAccounts/svct-demo-user@service-catalog-228300.iam.gserviceaccount.com\",\"httpMethod\":\"GET\"}}"}] @ 2019-01-11 00:49:16 +0000 UTC

I can see the corresponding error in the API metrics for google.iam.admin.v1.IAM.GetServiceAccount but it's not clear to me which permissions are actually incorrect

I can see similar errors in the google oauth pod as per #213, unsure if related

anouarchattouna commented 5 years ago

Hello, this is how I'm making the cloud storage provisioning working :

      volumes:
        # Make the 'gcp-credentials' secret available as volume
        # 'google-cloud-key'.
        - name: google-cloud-key
          secret:
            secretName: gcp-credentials
          volumeMounts:
            # Mount the 'google-cloud-key' volume into the container file
            # system.
            - name: google-cloud-key
              mountPath: /var/secrets/google
          env:
            # Pass the path to the private key JSON file from the mounted volume
            # to the environment variable.
            # the env var name must be GOOGLE_APPLICATION_CREDENTIALS
            - name: "GOOGLE_APPLICATION_CREDENTIALS"
              value: /var/secrets/google/privateKeyData
            # The two environment variables below come from the 'storage-credentials'
            # secret and, together, point at the Cloud Storage Bucket to use.
            # choose the env var name that have been used inside the app
            - name: "GOOGLE_CLOUD_STORAGE_PROJECT_ID"
              valueFrom:
                secretKeyRef:
                  # Use the projectId value from the 'storage-credentials' secret created
                  # as a result of binding to the Storage service instance.
                  name: storage-credentials
                  key: projectId
            # choose the env var name that have been used inside the app
            - name: "GOOGLE_CLOUD_STORAGE_BUCKET_ID"
              valueFrom:
                secretKeyRef:
                  # Use the topicId value from the 'storage-credentials' secret created
                  # as a result of binding to the Storage service instance.
                  name: storage-credentials
                  key: bucketId

Hope it helps.