Adjust KEDA example to match the upcoming blog
MODIFY
azure-ts-aks-keda/cluster.ts
azure-ts-aks-keda/cluster.ts
@@ -10,7 +10,10 @@ import * as tls from "@pulumi/tls";
// Arguments for an AKS cluster. We use almost all defaults for this example, but the
// interface could be extended with e.g. agent pool settings.
export interface AksClusterArgs {
- resourceGroup: azure.core.ResourceGroup;
+ resourceGroupName: pulumi.Input<string>;
+ kubernetesVersion: pulumi.Input<string>;
+ vmSize: pulumi.Input<string>;
+ vmCount: pulumi.Input<number>;
}
export class AksCluster extends pulumi.ComponentResource {
@@ -42,24 +45,24 @@ export class AksCluster extends pulumi.ComponentResource {
// Create a Virtual Network for the cluster
const vnet = new azure.network.VirtualNetwork("keda", {
- resourceGroupName: args.resourceGroup.name,
+ resourceGroupName: args.resourceGroupName,
addressSpaces: ["10.2.0.0/16"],
}, { parent: this });
// Create a Subnet for the cluster
const subnet = new azure.network.Subnet("keda", {
- resourceGroupName: args.resourceGroup.name,
+ resourceGroupName: args.resourceGroupName,
virtualNetworkName: vnet.name,
addressPrefix: "10.2.1.0/24",
}, { parent: this });
// Now allocate an AKS cluster.
this.cluster = new azure.containerservice.KubernetesCluster("aksCluster", {
- resourceGroupName: args.resourceGroup.name,
+ resourceGroupName: args.resourceGroupName,
agentPoolProfiles: [{
name: "aksagentpool",
- count: 3,
- vmSize: "Standard_B2s",
+ count: args.vmCount,
+ vmSize: args.vmSize,
osType: "Linux",
osDiskSizeGb: 30,
vnetSubnetId: subnet.id,
@@ -75,7 +78,7 @@ export class AksCluster extends pulumi.ComponentResource {
clientId: adApp.applicationId,
clientSecret: adSpPassword.value,
},
- kubernetesVersion: "1.13.5",
+ kubernetesVersion: args.kubernetesVersion,
roleBasedAccessControl: { enabled: true },
networkProfile: {
networkPlugin: "azure",

MODIFY
azure-ts-aks-keda/index.ts
azure-ts-aks-keda/index.ts
import * as azure from "@pulumi/azure";
import { AksCluster } from "./cluster";
-import { KedaEdge, KedaStorageQueueHandler } from "./keda";
+import { KedaService, KedaStorageQueueHandler } from "./keda";
// Define the resource group to contain all resources
const resourceGroup = new azure.core.ResourceGroup("keda-pulumi");
// Create an AKS K8s cluster
-const aks = new AksCluster("keda-cluster", { resourceGroup });
+const aks = new AksCluster("keda-cluster", {
+ resourceGroupName: resourceGroup.name,
+ kubernetesVersion: "1.13.5",
+ vmSize: "Standard_B2s",
+ vmCount: 3,
+});
// Deploy shared components of KEDA (container registry, kedacore/keda-edge Helm chart)
-const edge = new KedaEdge("keda-edge", {
+const service = new KedaService("keda-edge", {
resourceGroup,
k8sProvider: aks.provider,
});
@@ -29,7 +34,7 @@ const queue = new azure.storage.Queue("kedaqueue", {
// Deploy a Function App which subscribes to the Storage Queue
const app = new KedaStorageQueueHandler("queue-handler", {
resourceGroup,
- edge,
+ service,
storageAccount,
queue,
path: "./functionapp",

MODIFY
azure-ts-aks-keda/keda.ts
azure-ts-aks-keda/keda.ts
@@ -6,19 +6,19 @@ import * as k8s from "@pulumi/kubernetes";
import * as pulumi from "@pulumi/pulumi";
// Arguments for a KEDA deployment.
-export interface KedaEdgeArgs {
+export interface KedaServiceArgs {
resourceGroup: azure.core.ResourceGroup;
k8sProvider: k8s.Provider;
}
// A component to deploy shared parts of KEDA (container registry, kedacore/keda-edge Helm chart)
-export class KedaEdge extends pulumi.ComponentResource {
+export class KedaService extends pulumi.ComponentResource {
public registry: azure.containerservice.Registry;
public k8sProvider: k8s.Provider;
public registrySecretName: pulumi.Output<string>;
constructor(name: string,
- args: KedaEdgeArgs,
+ args: KedaServiceArgs,
opts: pulumi.ComponentResourceOptions = {}) {
super("examples:keda:KedaEdge", name, args, opts);
@@ -69,7 +69,7 @@ export class KedaEdge extends pulumi.ComponentResource {
// Arguments for an Azure Function App that processes messages from a given storage queue.
export interface KedaStorageQueueHandlerArgs {
resourceGroup: azure.core.ResourceGroup;
- edge: KedaEdge;
+ service: KedaService;
storageAccount: azure.storage.Account;
queue: azure.storage.Queue;
path: pulumi.Input<string>;
@@ -82,7 +82,7 @@ export class KedaStorageQueueHandler extends pulumi.ComponentResource {
opts: pulumi.ComponentResourceOptions = {}) {
super("examples:keda:KedaStorageQueueHandler", name, args, opts);
- const registry = args.edge.registry;
+ const registry = args.service.registry;
// Deploy the docker image of the Function App
const dockerImage = new docker.Image("image", {
@@ -103,7 +103,7 @@ export class KedaStorageQueueHandler extends pulumi.ComponentResource {
queueConnectionString:
args.storageAccount.primaryConnectionString.apply(c => Buffer.from(c).toString("base64")),
},
- }, { provider: args.edge.k8sProvider, parent: this });
+ }, { provider: args.service.k8sProvider, parent: this });
// Deploy the Function App from the image
const appLabels = { app: name };
@@ -126,11 +126,11 @@ export class KedaStorageQueueHandler extends pulumi.ComponentResource {
env: [{ name: "queuename", value: args.queue.name }],
envFrom: [{ secretRef: {name: secretQueue.metadata.name } }],
}],
- imagePullSecrets: [{ name: args.edge.registrySecretName }],
+ imagePullSecrets: [{ name: args.service.registrySecretName }],
},
},
},
- }, { provider: args.edge.k8sProvider, parent: this });
+ }, { provider: args.service.k8sProvider, parent: this });
// Deploy a custom resource Scale Object and point it to the queue
const scaledObject = new k8s.apiextensions.CustomResource("scaleobject", {
@@ -151,7 +151,7 @@ export class KedaStorageQueueHandler extends pulumi.ComponentResource {
},
}],
},
- }, { provider: args.edge.k8sProvider, parent: this });
+ }, { provider: args.service.k8sProvider, parent: this });
this.registerOutputs();
}

Adjust KEDA example to match the upcoming blog (#411)