From 9d7102132f33e265dc9a3a9475f0a79b6c8fb38e Mon Sep 17 00:00:00 2001 From: Joni Collinge Date: Thu, 2 Jun 2022 08:32:35 +0100 Subject: [PATCH] add README.md seciton Signed-off-by: Joni Collinge --- README.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/README.md b/README.md index d55b45767..bf6afde31 100644 --- a/README.md +++ b/README.md @@ -630,6 +630,40 @@ The default is `false`. For more details, please run the command and check the examples to apply to your shell. +### Annotate a Kubernetes manifest + +To add or modify dapr annotations on an existing Kubernetes manifest, use the `dapr annotate` command: + +```bash +dapr annotate [flags] mydeployment.yaml +``` + +This will add the `dapr.io/enabled` and the `dapr.io/app-id` annotations. The dapr app id will be genereated using the format `--` where the values are taken from the existing Kubernetes object metadata. + +To provide your own dapr app id, provide the flag `--app-id`. + +All dapr annotations are available to set if a value is provided for the appropriate flag on the `dapr annotate` command. + +You can also provide the Kubernetes manifest via stdin: + +```bash +kubectl get deploy mydeploy -o yaml | dapr annotate - | kubectl apply -f - +``` + +Or you can provide the Kubernetes manifest via a URL: + +```bash +dapr annotate --log-level debug https://raw.githubusercontent.com/dapr/quickstarts/master/tutorials/hello-kubernetes/deploy/node.yaml | kubectl apply -f - +``` + +If the input contains multiple manifests then the command will search for the first appropriate one to apply the annotations. If you'd rather it applied to a specific manifest then you can provide the `--resource` flag with the value set to the name of the object you'd like to apply the annotations to. If you have a conflict between namespaces you can also provide the namespace via the `--namespace` flag to isolate the manifest you wish to target. + +If you want to annotate multiple manifests, you can chain together the `dapr annotate` commands with each applying the annotation to a specific manifest. + +```bash +kubectl get deploy -o yaml | dapr annotate -r nodeapp --log-level debug - | dapr annotate --log-level debug -r pythonapp - | kubectl apply -f - +``` + ## Reference for the Dapr CLI See the [Reference Guide](https://docs.dapr.io/reference/cli/) for more information about individual Dapr commands.