File tree 1 file changed +14
-2
lines changed
1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -14,14 +14,26 @@ const domainName = config.get("domainName");
14
14
// kubeconfig to make it easy to access from the kubectl command line.
15
15
const cluster = new digitalocean . KubernetesCluster ( "do-cluster" , {
16
16
region : digitalocean . Regions . SFO2 ,
17
- version : "latest" ,
17
+ version : digitalocean . getKubernetesVersions ( { versionPrefix : "1.16" } ) . then ( p => p . latestVersion ) ,
18
18
nodePool : {
19
19
name : "default" ,
20
20
size : digitalocean . DropletSlugs . DropletS2VCPU2GB ,
21
21
nodeCount : nodeCount ,
22
22
} ,
23
23
} ) ;
24
- export const kubeconfig = cluster . kubeConfigs [ 0 ] . rawConfig ;
24
+
25
+ // The DigitalOcean Kubernetes cluster periodically gets a new certificate,
26
+ // so we look up the cluster by name and get the current kubeconfig after
27
+ // initial provisioning. You'll notice that the `certificate-authority-data`
28
+ // field changes on every `pulumi update`.
29
+ const kubeconfig = cluster . status . apply ( status => {
30
+ if ( status === "running" ) {
31
+ const clusterDataSource = cluster . name . apply ( name => digitalocean . getKubernetesCluster ( { name} ) ) ;
32
+ return clusterDataSource . kubeConfigs [ 0 ] . rawConfig ;
33
+ } else {
34
+ return cluster . kubeConfigs [ 0 ] . rawConfig ;
35
+ }
36
+ } ) ;
25
37
26
38
// Now lets actually deploy an application to our new cluster. We begin
27
39
// by creating a new "Provider" object that uses our kubeconfig above,
You can’t perform that action at this time.
0 commit comments