abundant-airplane-93796
06/04/2020, 1:20 AMpulumi preview
giving different behavior to pulumi up
when using GKE? I'm finding that preview
fails to properly use gcloud
to authenticate with the cluster, causing the preview to not see any existing kubernetes resources. up
on the other hand works as expectedcreamy-potato-29402
06/04/2020, 1:23 AMabundant-airplane-93796
06/04/2020, 2:05 AMpulumi preview
with a -r
flagwarning: configured Kubernetes cluster is unreachable: unable to load schema information from the API server: the server has asked for the client to provide credentials
messagespulumi up -r
has the same errorscreamy-potato-29402
06/04/2020, 2:31 AMpreview
doesn’t consult the cluster, preview -r
does. does normal pulumi up
work?abundant-airplane-93796
06/04/2020, 3:13 AMcreamy-potato-29402
06/04/2020, 3:30 AMabundant-airplane-93796
06/04/2020, 12:54 PMexport function GenerateK8sProvider(name: string, cluster: gcp.container.Cluster): k8s.Provider {
// prettier-ignore
const kubeconfig = pulumi.
all([ cluster.name, cluster.endpoint, cluster.masterAuth ]).
apply(([ name, endpoint, masterAuth ]) => {
const context = `${gcp.config.project}_${gcp.config.zone}_${name}`;
return `apiVersion: v1
clusters:
- cluster:
certificate-authority-data: ${masterAuth.clusterCaCertificate}
server: https://${endpoint}
name: ${context}
contexts:
- context:
cluster: ${context}
user: ${context}
name: ${context}
current-context: ${context}
kind: Config
preferences: {}
users:
- name: ${context}
user:
auth-provider:
config:
cmd-args: config config-helper --format=json
cmd-path: gcloud
expiry-key: '{.credential.token_expiry}'
token-key: '{.credential.access_token}'
name: gcp
`;
});
return new k8s.Provider(name, { kubeconfig: kubeconfig });
}