From e5297fc75da9763b7fac240a38c59106ca512e6e Mon Sep 17 00:00:00 2001 From: Peefy Date: Mon, 28 Oct 2024 20:19:32 +0800 Subject: [PATCH] chore: bump resource_list to items Signed-off-by: Peefy --- README.md | 6 +++--- examples/workload-charts-with-kcl/kcl-run.yaml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 24c2387..9584735 100644 --- a/README.md +++ b/README.md @@ -78,9 +78,9 @@ metadata: name: set-annotation spec: # EDIT THE SOURCE! - # This should be your KCL code which preloads the `ResourceList` to `option("resource_list") + # This should be your KCL code which preloads the `ResourceList` to `option("items") source: | - [resource | {if resource.kind == "Deployment": metadata.annotations: {"managed-by" = "helm-kcl-plugin"}} for resource in option("resource_list").items] + [resource | {if resource.kind == "Deployment": metadata.annotations: {"managed-by" = "helm-kcl-plugin"}} for resource in option("items")] repositories: - name: workload @@ -198,7 +198,7 @@ make docker-run-release Here's what you can do in the KCL script: -+ Read resources from `option("resource_list")`. The `option("resource_list")` complies with the [KRM Functions Specification](https://kpt.dev/book/05-developing-functions/01-functions-specification). You can read the input resources from `option("resource_list")["items"]` and the `functionConfig` from `option("resource_list")["functionConfig"]`. ++ Read resources from `option("items")`. The `option("items")` complies with the [KRM Functions Specification](https://kpt.dev/book/05-developing-functions/01-functions-specification). + Return a KPM list for output resources. + Return an error using `assert {condition}, {error_message}`. + Read the environment variables. e.g. `option("PATH")` (Not yet implemented). diff --git a/examples/workload-charts-with-kcl/kcl-run.yaml b/examples/workload-charts-with-kcl/kcl-run.yaml index 365c78f..49df40d 100644 --- a/examples/workload-charts-with-kcl/kcl-run.yaml +++ b/examples/workload-charts-with-kcl/kcl-run.yaml @@ -5,9 +5,9 @@ metadata: name: set-annotation spec: # EDIT THE SOURCE! - # This should be your KCL code which preloads the `ResourceList` to `option("resource_list") + # This should be your KCL code which preloads the `ResourceList` to `option("items") source: | - [resource | {if resource.kind == "Deployment": metadata.annotations: {"managed-by" = "helm-kcl-plugin"}} for resource in option("resource_list").items] + [resource | {if resource.kind == "Deployment": metadata.annotations: {"managed-by" = "helm-kcl-plugin"}} for resource in option("items")] repositories: - name: workload