Created
June 25, 2021 19:27
-
-
Save dpkirchner/42f97f6d6df57fc552009743944fe779 to your computer and use it in GitHub Desktop.
execProviderConfig example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"execProviderConfig": { | |
"apiVersion": "client.authentication.k8s.io/v1beta1", | |
"args": [ | |
"-c", | |
"import urllib.request, json, datetime; obj = json.loads(urllib.request.urlopen(urllib.request.Request(\"http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token\", headers={\"Metadata-Flavor\":\"Google\"})).read()); delta = datetime.timedelta(seconds=int(obj[\"expires_in\"])); out = {\"apiVersion\":\"client.authentication.k8s.io/v1beta1\",\"kind\":\"ExecCredential\",\"status\":{\"token\":obj[\"access_token\"],\"expirationTimestamp\":(delta + datetime.datetime.utcnow()).strftime(\"%Y-%m-%dT%H:%M:%SZ\")}}; print(json.dumps(out))" | |
], | |
"command": "/usr/bin/python3" | |
}, | |
"tlsClientConfig": { | |
"caData": "xxx", | |
"insecure": false | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output looks like this: