billowy-garage-68819
03/28/2019, 3:16 PMcreamy-potato-29402
03/28/2019, 6:41 PMbillowy-garage-68819
03/28/2019, 6:42 PMcreamy-potato-29402
03/28/2019, 6:42 PMbillowy-garage-68819
03/28/2019, 6:42 PMcreamy-potato-29402
03/28/2019, 6:43 PMbillowy-garage-68819
03/28/2019, 6:44 PMcreamy-potato-29402
03/28/2019, 6:44 PMbillowy-garage-68819
03/28/2019, 6:44 PMcreamy-potato-29402
03/28/2019, 6:45 PMbillowy-garage-68819
03/28/2019, 6:46 PMcreamy-potato-29402
03/28/2019, 6:46 PMbillowy-garage-68819
03/28/2019, 6:49 PMcreamy-potato-29402
03/28/2019, 6:50 PMbillowy-garage-68819
03/28/2019, 6:50 PMcreamy-potato-29402
03/28/2019, 6:50 PMConfigFile
requires {providers: {kubernetes: k8sProvider}}
billowy-garage-68819
03/28/2019, 7:04 PMcreamy-potato-29402
03/28/2019, 7:41 PMbillowy-garage-68819
03/28/2019, 7:41 PMcreamy-potato-29402
03/28/2019, 7:44 PMk8sProvider
and k8sCluster
in addon_externaldns.ts
are undefined
.pulumi up
, they don’t appear as children in the resource summary.billowy-garage-68819
03/28/2019, 7:45 PMcreamy-potato-29402
03/28/2019, 7:46 PMaddon_externaldns.ts
.
2. nodejs goes and starts executing that file.
3. From that file you import index.ts
.
4. You reference k8sProvider
and k8sCluster
, but because we have interrupted executing index.ts
to import addon_externaldns.ts
, those values are undefined
5. Therefore no providers or parent values are set. 🙂billowy-garage-68819
03/28/2019, 7:47 PMcreamy-potato-29402
03/28/2019, 7:47 PMbillowy-garage-68819
03/28/2019, 7:48 PMcreamy-potato-29402
03/28/2019, 7:48 PMbillowy-garage-68819
03/28/2019, 7:48 PMcreamy-potato-29402
03/28/2019, 7:48 PMbillowy-garage-68819
03/28/2019, 7:49 PMcreamy-potato-29402
03/28/2019, 7:49 PMbillowy-garage-68819
03/28/2019, 7:50 PMcreamy-potato-29402
03/28/2019, 7:51 PMimport * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
import * as k8s from "@pulumi/kubernetes";
// Addons
import { project } from "@pulumi/gcp/config";
import { externalDnsVersion } from "./config";
import { addKSNamespace } from "./helper";
import { name } from "./config";
export const k8sCluster = new gcp.container.Cluster(
"gke-cluster",
{
name: name,
loggingService: "<http://logging.googleapis.com/kubernetes|logging.googleapis.com/kubernetes>",
monitoringService: "<http://monitoring.googleapis.com/kubernetes|monitoring.googleapis.com/kubernetes>",
addonsConfig: {
httpLoadBalancing: {
disabled: false,
},
},
nodePools: [{ name: "default-pool" }],
},
{
deleteBeforeReplace: true,
},
);
// Manufacture a GKE-style kubeconfig. Note that this is slightly "different"
// because of the way GKE requires gcloud to be in the picture for cluster
// authentication (rather than using the client cert/key directly).
export const kubeconfig = pulumi
.all([k8sCluster.name, k8sCluster.endpoint, k8sCluster.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
`;
});
export const k8sProvider = new k8s.Provider(
"gkeK8s",
{
kubeconfig: kubeconfig,
},
{
dependsOn: k8sCluster,
parent: k8sCluster,
},
);
// Export the Cluster name
export const clusterName = k8sCluster.name;
const externaldns = new k8s.helm.v2.Chart(
"externaldns1",
{
repo: "stable",
version: externalDnsVersion,
chart: "external-dns",
namespace: "kube-system",
transformations: [addKSNamespace],
values: {
google: {
project: project,
},
policy: "sync",
provider: "google",
rbac: {
create: true,
},
tolerations: [],
},
},
{
providers: { kubernetes: k8sProvider },
parent: k8sCluster,
dependsOn: k8sCluster,
},
);
billowy-garage-68819
03/28/2019, 7:54 PMcreamy-potato-29402
03/28/2019, 7:55 PMbillowy-garage-68819
03/28/2019, 7:55 PMcreamy-potato-29402
03/28/2019, 7:55 PMbillowy-garage-68819
03/28/2019, 7:56 PMcreamy-potato-29402
03/28/2019, 7:57 PMbillowy-garage-68819
03/28/2019, 7:58 PMcreamy-potato-29402
03/28/2019, 8:00 PMbillowy-garage-68819
03/28/2019, 8:00 PM