Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ClassCastException when reading GCP configured auth provider config #267

@jroper

Description

@jroper

I get the following exception:

Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Date
	at skuber.api.Configuration$.authProviderRead$1(Configuration.scala:162)
	at skuber.api.Configuration$.toK8SAuthInfo$1(Configuration.scala:172)
	at skuber.api.Configuration$.$anonfun$parseKubeconfigStream$7(Configuration.scala:192)
	at skuber.api.Configuration$.$anonfun$parseKubeconfigStream$4(Configuration.scala:137)

When reading a GKE auth provider config that has been written by the gcloud command. Here's the config that command wrote:

- name: gke_my-project_us-central1-a_my-cluster
  user:
    auth-provider:
      config:
        access-token: ####
        cmd-args: config config-helper --format=json
        cmd-path: /usr/lib/google-cloud-sdk/bin/gcloud
        expiry: "2019-04-18T03:43:23Z"
        expiry-key: '{.credential.token_expiry}'
        token-key: '{.credential.access_token}'
      name: gcp

The problem appears to be that it's writing the expiry field as a String, but Skuber is expecting it to be a YAML date. I've got no idea if skuber is right or gcloud is right, but perhaps its safer to read as a string and parse manually?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions