Skip to content

Commit

Permalink
Adopt breaking change in Helm chart API (#194)
Browse files Browse the repository at this point in the history
Adapt to changes in v0.18.0 from pulumi/pulumi-kubernetes#241.
  • Loading branch information
lukehoban committed Dec 15, 2018
1 parent ca12691 commit dffb7cf
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions azure-ts-aks-helm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ const apache = new helm.v2.Chart(
export let cluster = k8sCluster.name;
export let kubeConfig = k8sCluster.kubeConfigRaw;
export let serviceIP = apache
.getResource("v1/Service", "apache-apache")
.status.apply(status => status.loadBalancer.ingress[0].ip);
.getResourceProperty("v1/Service", "apache-apache", "status")
.apply(status => status.loadBalancer.ingress[0].ip);

4 changes: 2 additions & 2 deletions azure-ts-aks-mean/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ const node = new k8s.helm.v2.Chart(
export const kubeconfig = k8sCluster.kubeConfig;
export const cluster = k8sCluster.name;
export const frontendAddress = node
.getResource("v1/Service", "node-node")
.status.apply(status => status.loadBalancer.ingress[0].ip);
.getResourceProperty("v1/Service", "node-node", "status")
.apply(status => status.loadBalancer.ingress[0].ip);
4 changes: 2 additions & 2 deletions kubernetes-ts-helm-wordpress/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ const wordpress = new k8s.helm.v2.Chart("wpdev", {
});

// Export the public IP for Wordpress.
const frontend = wordpress.getResource("v1/Service", "wpdev-wordpress");
export const frontendIp = frontend.status.apply(status => status.loadBalancer.ingress[0].ip);
const frontend = wordpress.getResourceProperty("v1/Service", "wpdev-wordpress", "status");
export const frontendIp = frontend.apply(status => status.loadBalancer.ingress[0].ip);
4 changes: 2 additions & 2 deletions kubernetes-ts-helm-wordpress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"@types/node": "latest"
},
"dependencies": {
"@pulumi/pulumi": "^0.15.0",
"@pulumi/kubernetes": "^0.16.0"
"@pulumi/pulumi": "^0.16.7",
"@pulumi/kubernetes": "^0.18.0"
}
}
9 changes: 5 additions & 4 deletions kubernetes-ts-staged-rollout-with-prometheus/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as pulumi from "@pulumi/pulumi";
import * as k8s from "@pulumi/kubernetes";
import * as http from "http";
import { spawn } from "child_process";
import { meta } from "@pulumi/kubernetes/types/input";

export interface PromPortForwardOpts {
localPort: number;
Expand All @@ -19,15 +20,15 @@ export interface PromPortForwardOpts {
// This is useful for when we can't run Pulumi in-cluster, in which case simply calling to the
// appropriate KubeDNS URL is not sufficient.
export function forwardPrometheusService(
service: k8s.core.v1.Service,
deployment: k8s.extensions.v1beta1.Deployment,
service: pulumi.Input<k8s.core.v1.Service>,
deployment: pulumi.Input<k8s.extensions.v1beta1.Deployment>,
opts: PromPortForwardOpts
): pulumi.Output<() => void> {
if (pulumi.runtime.isDryRun()) {
return pulumi.output(() => {});
}

return pulumi.all([service.metadata, deployment.urn]).apply(([meta]) => {
return pulumi.all([service, deployment]).apply(([s, d]) => pulumi.all([s.metadata, d.urn])).apply(([meta]) => {
return new Promise<() => void>((resolve, reject) => {
const forwarderHandle = spawn("kubectl", [
"port-forward",
Expand Down Expand Up @@ -182,7 +183,7 @@ function getHttpLatency(url: string): Promise<string> {

// Append to the body until the end.
const body: string[] = [];
response.on("data", chunk => body.push(chunk));
response.on("data", chunk => body.push(chunk.toString()));
response.on("end", () => resolve(body.join("")));
});

Expand Down

0 comments on commit dffb7cf

Please sign in to comment.