Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add docs for dapr annotate command #2576

Merged
merged 5 commits into from
Jul 6, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ For CLI there is no explicit opt-in, just the version that this was first made a
## Current preview features
| Feature | Description | Setting | Documentation | Version introduced |
| ---------- |-------------|---------|---------------|-----------------|
| **--image-registry** flag with Dapr CLI| In self hosted mode you can set this flag to specify any private registry to pull the container images required to install Dapr| N/A | [init CLI command reference]({{<ref "dapr-init.md#self-hosted-environment" >}}) | v1.7 |
| **dapr annotate** command in Dapr CLI | Add Dapr annotations to Kubernetes configuration files. | N/A | [CLI annotate command reference]({{<ref "dapr-annotate.md">}}) | v1.8 |
| **--image-registry** flag in Dapr CLI| In self hosted mode you can set this flag to specify any private registry to pull the container images required to install Dapr| N/A | [CLI init command reference]({{<ref "dapr-init.md#self-hosted-environment" >}}) | v1.7 |
Copy link
Contributor Author

@mukundansundar mukundansundar Jul 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leaving this as such for now only with a slight change in phrasing ... will have a discussion with Yaron after 1.8 release on whether to have Preview features or Preview commands in CLI or not ...
cc @msfussell @yaron2

| **Resiliency** | Allows configuring of fine-grained policies for retries, timeouts and circuitbreaking. | `Resiliency` | [Configure Resiliency Policies]({{<ref "resiliency-overview">}}) | v1.7|
| **Service invocation without default `content-type`** | When enabled removes the default service invocation content-type header value `application/json` when no content-type is provided. This will become the default behavior in release v1.9.0. This requires you to explictly set content-type headers where required for your apps. | `ServiceInvocation.NoDefaultContentType` | [Service Invocation]({{<ref "service_invocation_api.md#request-contents" >}}) | v1.7 |

2 changes: 2 additions & 0 deletions daprdocs/content/en/reference/cli/cli-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Usage:
dapr [command]

Available Commands:
annotate Add dapr annotations to a Kubernetes configuration. Supported platforms: Kubernetes
build-info Print build info of Dapr CLI and runtime
completion Generates shell completion scripts
components List all Dapr components. Supported platforms: Kubernetes
Expand Down Expand Up @@ -54,6 +55,7 @@ Use "dapr [command] --help" for more information about a command.

You can learn more about each Dapr command from the links below.

- [`dapr annotate`]({{< ref dapr-annotate.md >}})
- [`dapr build-info`]({{< ref dapr-build-info.md >}})
- [`dapr completion`]({{< ref dapr-completion.md >}})
- [`dapr components`]({{< ref dapr-components.md >}})
Expand Down
84 changes: 84 additions & 0 deletions daprdocs/content/en/reference/cli/dapr-annotate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
type: docs
title: "annotate CLI command reference"
linkTitle: "annotate"
description: "Add dapr annotatations to a Kubernetes configuration"
---

{{% alert title="Warning" color="warning" %}}
This command is in preview. The functionality might change in the future till the command is made stable.
{{% /alert %}}

### Description

Add dapr annotations to a Kubernetes configuration.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I presume arguments here reflects this list https://v1-8.docs.dapr.io/reference/arguments-annotations-overview/
If so has this list been checked since I could not find dapr.io/sidecar-image as a value.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the above is true (the list) then I suggest the following update.

Suggested change
Add dapr annotations to a Kubernetes configuration.
Add Dapr annotations to a Kubernetes configuration. This enables you to change the Dapr annotations on a deployment other than those specified in the deployment file. See [Kubernetes annotations]({{< ref arguments-annotations-overview >}}) for a full description of each annotation.

Copy link
Contributor Author

@mukundansundar mukundansundar Jul 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@msfussell I believe that this command as it exists is not for all the annotations as it exists. I am also thinking that all annotations should not be supported via this command. I am planning on creating a proposal to change this command to follow a helm based --set based format for 1.9. I will make note of the annotations needed to allowed to changed there.


### Supported platforms

- [Kubernetes]({{< ref kubernetes >}})

### Usage

```bash
dapr annotate [flags] CONFIG-FILE
```

### Flags

| Name | Environment Variable | Default | Description
| --- | --- | --- | --- |
| `--api-token-secret` | | | The secret to use for the API token |
| `--app-id, -a` | | | The app id to annotate |
| `--app-max-concurrency` | | `-1` | The maximum number of concurrent requests to allow |
| `--app-port, -p` | | `-1` | The port to expose the app on |
| `--app-protocol` | | | The protocol to use for the app |
| `--app-ssl` | | `false` | Enable SSL for the app |
| `--app-token-secret` | | | The secret to use for the app token |
| `--config, -c` | | | The config file to annotate |
| `--cpu-limit` | | | The CPU limit to set for the sidecar. See valid values [here](https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/). |
| `--cpu-request` | | | The CPU request to set for the sidecar. See valid values [here](https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/). |
| `--dapr-image` | | | The image to use for the dapr sidecar container |
| `--enable-debug` | | `false` | Enable debug |
| `--enable-metrics` | | `false` | Enable metrics |
| `--enable-profile` | | `false` | Enable profiling |
| `--env` | | | Environment variables to set (key value pairs, comma separated) |
| `--graceful-shutdown-seconds` | | `-1` | The number of seconds to wait for the app to shutdown |
| `--help, -h` | | | help for annotate |
| `--http-stream-request-body` | | `false` | Enable streaming request body for HTTP |
| `--listen-addresses` | | | The addresses for sidecar to listen on. To listen to all IPv4 addresses, use `0.0.0.0`. To listen to all IPv6 addresses, use `[::]`. |
| `--liveness-probe-delay` | | `-1` | The delay for sidecar to use for the liveness probe. Read more [here](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#configure-probes). |
| `--liveness-probe-period` | | `-1` | The period used by the sidecar for the liveness probe. Read more [here](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#configure-probes). |
| `--liveness-probe-threshold` | | `-1` | The threshold used by the sidecar for the liveness probe. Read more [here](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#configure-probes). |
| `--liveness-probe-timeout` | | `-1` | The timeout used by the sidecar for the liveness probe. Read more [here](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#configure-probes). |
| `--log-level` | | | The log level to use |
| `--max-request-body-size` | | `-1` | The maximum request body size to use |
| `--memory-limit` | | | The memory limit to set for the sidecar. See valid values [here](https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/) |
| `--memory-request`| | | The memory request to set for the sidecar |
| `--metrics-port` | | `-1` | The port to expose the metrics on |
| `--namespace, -n` | | | The namespace the resource target is in (can only be set if `--resource` is also set) |
| `--readiness-probe-delay` | | `-1` | The delay to use for the readiness probe in the sidecar. Read more [here](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#configure-probes).|
| `--readiness-probe-period` | | `-1` | The period to use for the readiness probe in the sidecar. Read more [here](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#configure-probes). |
| `--readiness-probe-threshold` | | `-1` | The threshold to use for the readiness probe in the sidecar. Read more [here](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#configure-probes). |
| `--readiness-probe-timeout` | | `-1` | The timeout to use for the readiness probe in the sidecar. Read more [here](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#configure-probes). |
| `--resource, -r` | | | The resource to target to annotate |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is --resource? When is this used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See examples with the -r flag ... It is the Kubernetes deployment resource that is the target for the annotate command ...

# Annotate multiple deployments by name in a chain
kubectl get deploy -o yaml | dapr annotate -k -r nodeapp - | dapr annotate -k -r pythonapp - | kubectl apply -f -

More examples in the file ...


{{% alert title="Warning" color="warning" %}}
If an application ID is not provided using `--app-id, -a`, we will generate one using the format `<namespace>-<kind>-<name>`.
{{% /alert %}}

### Examples

```bash
# Annotate the first deployment found in the input
kubectl get deploy -l app=node -o yaml | dapr annotate - | kubectl apply -f -

# Annotate multiple deployments by name in a chain
kubectl get deploy -o yaml | dapr annotate -r nodeapp - | dapr annotate -r pythonapp - | kubectl apply -f -

# Annotate deployment in a specific namespace from file or directory by name
dapr annotate -r nodeapp -n namespace mydeploy.yaml | kubectl apply -f -

# Annotate deployment from url by name
dapr annotate -r nodeapp --log-level debug https://raw.githubusercontent.com/dapr/quickstarts/master/tutorials/hello-kubernetes/deploy/node.yaml | kubectl apply -f -
```