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

Conversation

mukundansundar
Copy link
Contributor

Thank you for helping make the Dapr documentation better!

Please follow this checklist before submitting:

  • Commits are signed with Developer Certificate of Origin (DCO - learn more)
  • Read the contribution guide
  • Commands include options for Linux, MacOS, and Windows within codetabs
  • New file and folder names are globally unique
  • Page references use shortcodes instead of markdown or URL links
  • Images use HTML style and have alternative text
  • Places where multiple code/command options are given have codetabs

In addition, please fill out the following to help reviewers understand this pull request:

Description

Based on PR dapr/components-contrib#3060

Issue reference

Closes #3669

@mukundansundar mukundansundar requested review from a team as code owners October 9, 2023 22:44
@mukundansundar
Copy link
Contributor Author

@ItalyPaleAle Please review PR

@mukundansundar mukundansundar linked an issue Oct 9, 2023 that may be closed by this pull request

| 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")
}

Signed-off-by: Mukundan Sundararajan <[email protected]>
Copy link
Member

@msfussell msfussell left a comment

Choose a reason for hiding this comment

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

LGTM

@msfussell msfussell merged commit ea00e24 into dapr:v1.12 Oct 10, 2023
4 checks passed
@mukundansundar mukundansundar deleted the k8s-kubeconfig branch October 11, 2023 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[1.12] Update docs for Kubernetes components
3 participants