public class KubeConfig extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
KubeConfig.Builder
Builder for
KubeConfig. |
| Modifier and Type | Method and Description |
|---|---|
static KubeConfig |
fromCluster(String projectId,
com.google.api.services.container.model.Cluster cluster,
String accessToken)
Creates a
KubeConfig from the specified Cluster. |
com.google.common.collect.ImmutableList<Object> |
getClusters() |
com.google.common.collect.ImmutableList<Object> |
getContexts() |
String |
getCurrentContext() |
com.google.common.collect.ImmutableList<Object> |
getUsers() |
String |
toYaml()
Write a Yaml dump of this
KubeConfig's data to the specified Writer. |
public com.google.common.collect.ImmutableList<Object> getContexts()
public com.google.common.collect.ImmutableList<Object> getClusters()
public com.google.common.collect.ImmutableList<Object> getUsers()
public String getCurrentContext()
public String toYaml() throws IOException
KubeConfig's data to the specified Writer.
NOTE(craigatgoogle): The logic here is taken directly from the `gcloud containers clutsers
get-credentials` command's implementation: link.KubeConfig.IOException - If an error was encountered while exporting to Yaml.public static KubeConfig fromCluster(String projectId, com.google.api.services.container.model.Cluster cluster, String accessToken)
KubeConfig from the specified Cluster.projectId - The ID of the project the cluster resides in.cluster - The cluster data will be drawn from.accessToken - Access token for GKE API access.KubeConfig from the specified Cluster.Copyright © 2016–2020 Google. All rights reserved.