early-intern-90238
08/29/2019, 6:34 PMbitter-dentist-28132
08/29/2019, 9:42 PMconst cluster = new digitalocean.KubernetesCluster("foo", {
name: 'foo',
// ...
});
try {
// first try to get the kubeconfig from a pre-existing cluster. this
// is done to workaround the 7-day expiry of kubeconfigs from DO
kubeConfig = pulumi.secret(digitalocean.getKubernetesCluster(
{name: 'foo'}).kubeConfigs[0].rawConfig);
} catch (e) {
// if we can't do that, simply grab the kubeconfig from the cluster we
// just created
kubeConfig = pulumi.secret(cluster.kubeConfigs[0].rawConfig);
}