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 k8s kubeconfig, defaultNamespace #3803

Merged
merged 3 commits into from
Oct 10, 2023
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 @@ -36,6 +36,7 @@ spec:
| `namespace` | Y | Input | The Kubernetes namespace to read events from | `"default"` |
| `resyncPeriodInSec` | N | Input | The period of time to refresh event list from Kubernetes API server. Defaults to `"10"` | `"15"`
| `direction` | N | Input | The direction of the binding | `"input"`
| `kubeconfigPath` | N | Input | The path to the kubeconfig file. If not specified, the binding will use the default in-cluster config value | `"/path/to/kubeconfig"`
mukundansundar marked this conversation as resolved.
Show resolved Hide resolved

## Binding support

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ The above example uses secrets as plain strings. It is recommended to use a secr

## Spec metadata fields

For the Kubernetes secret store component, there are no metadata attributes.
| Field | Required | Details | Example |
|--------------------|:--------:|------------|-----|---------|
| `defaultNamespace` | N | Default namespace to retrieve secrets from. If unset, the namespace must be specified for each key, as `namespace/secretName/key` | `"default-ns"` |
| `kubeconfigPath` | N | The path to the kubeconfig file. If not specified, the binding will use the default in-cluster config value | `"/path/to/kubeconfig"`
mukundansundar marked this conversation as resolved.
Show resolved Hide resolved


## Related links
[Cryptography building block]({{< ref cryptography >}})
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ spec:
```

## Spec metadata fields
For the Kubernetes secret store component, there are no metadata attributes.

| Field | Required | Details | Example |
|--------------------|:--------:|------------|-----|---------|
| `defaultNamespace` | N | Default namespace to retrieve secrets from | `"default-ns"` |
Copy link
Member

Choose a reason for hiding this comment

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

Any consequences if this value is not set?

Copy link
Contributor Author

@mukundansundar mukundansundar Oct 10, 2023

Choose a reason for hiding this comment

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

No, defaultNamespace is not a required parameter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

namespace is a required parameter to get secrets ....
either through request metadata, or though NAMESPACE env var.
https://github.com/dapr/components-contrib/blob/master/secretstores/kubernetes/kubernetes.go#L112-L126

func (k *kubernetesSecretStore) getNamespaceFromMetadata(metadata map[string]string) (string, error) {
	if val, ok := metadata["namespace"]; ok && val != "" {
		return val, nil
	}

	if val := os.Getenv("NAMESPACE"); val != "" {
		return val, nil
	}

	if k.md.DefaultNamespace != "" {
		return k.md.DefaultNamespace, nil
	}

	return "", errors.New("namespace is missing on metadata and NAMESPACE env variable, and no default namespace is set")
}

| `kubeconfigPath` | N | The path to the kubeconfig file. If not specified, the binding will use the default in-cluster config value | `"/path/to/kubeconfig"`
mukundansundar marked this conversation as resolved.
Show resolved Hide resolved


## Optional per-request metadata properties

Expand Down
Loading