From af8ff6a5c9578a8f4eaadbd3d301b06f3155939b Mon Sep 17 00:00:00 2001 From: Mengqi Yu Date: Tue, 22 Mar 2022 13:56:51 -0700 Subject: [PATCH] update the starlark configmap example to work with latest kpt --- .../starlark-configmap-as-functionconfig/set-replicas.star | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/starlark-configmap-as-functionconfig/set-replicas.star b/examples/starlark-configmap-as-functionconfig/set-replicas.star index c172efa04..9fb332374 100644 --- a/examples/starlark-configmap-as-functionconfig/set-replicas.star +++ b/examples/starlark-configmap-as-functionconfig/set-replicas.star @@ -3,5 +3,7 @@ def setReplicas(resources, replicas): if r["apiVersion"] == "apps/v1" and r["kind"] == "Deployment": r["spec"]["replicas"] = replicas -replicas = ctx.resource_list["functionConfig"]["data"]["replicas"] +# The functionConfig is a ConfigMap, so the replicas we got from field +# functionConfig.data.replicas is a string. We nned to convert it to a int. +replicas = int(ctx.resource_list["functionConfig"]["data"]["replicas"]) setReplicas(ctx.resource_list["items"], replicas)