diff --git a/set-annotations/0.1.0/README.md b/set-annotations/0.1.0/README.md new file mode 100644 index 00000000..e23b070a --- /dev/null +++ b/set-annotations/0.1.0/README.md @@ -0,0 +1,30 @@ +## Introduction + +`set-annotations` is a kcl mutation package, which can be used to add `metadata.annotations` attributes for the Kubernetes resources. + +The KCL code is as follows: + +```python +params = option("params") or {} +# Use `k = v` to override existing annotations +annotations: {str:str} = {k = v for k, v in params.annotations or {}} +items = [item | { + metadata.annotations: annotations +} for item in option("items")] +``` + +## How to Use + +Add the source into your `KCLRun` resource and use the [kubectl kcl plugin](https://kcl-lang.io/docs/user_docs/guides/working-with-k8s/mutate-manifests/kubectl-kcl-plugin) or the [kcl operator](https://kcl-lang.io/docs/user_docs/guides/working-with-k8s/mutate-manifests/kcl-operator) to integrate this model. + +```yaml +apiVersion: krm.kcl.dev/v1alpha1 +kind: KCLRun +metadata: + name: set-annotations +spec: + params: + annotations: + config.kubernetes.io/local-config: "true" + source: oci://ghcr.io/kcl-lang/set-annotations +``` diff --git a/set-annotations/0.1.0/artifacthub-pkg.yaml b/set-annotations/0.1.0/artifacthub-pkg.yaml new file mode 100644 index 00000000..86c47ccc --- /dev/null +++ b/set-annotations/0.1.0/artifacthub-pkg.yaml @@ -0,0 +1,26 @@ +version: 0.1.0 +name: set-annotations +displayName: set-annotations +createdAt: "2023-10-25T06:46:13Z" +description: '`set-annotations` is a kcl mutation package, which can be used to add + `metadata.annotations` attributes for the Kubernetes resources.' +links: +- name: KCL homepage + url: https://kcl-lang.io/ +- name: KCL repo + url: https://github.com/kcl-lang/kcl +install: | + #### Add `set-annotations` with tag `0.1.0` as dependency + ``` + kpm add set-annotations:0.1.0 + ``` + + #### Pull `set-annotations` with tag `0.1.0` to local + ``` + kpm pull set-annotations:0.1.0 + ``` +maintainers: +- name: kcl-lang.io + email: kcl-lang.io@domainsbyproxy.com +provider: + name: kcl-lang.io