Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

The Secret "slack_hook" is invalid: metadata.name #747

Closed
joshuacox opened this issue Jul 25, 2020 · 3 comments · Fixed by #811
Closed

The Secret "slack_hook" is invalid: metadata.name #747

joshuacox opened this issue Jul 25, 2020 · 3 comments · Fixed by #811
Labels
bug Something isn't working elasticsearch

Comments

@joshuacox
Copy link

joshuacox commented Jul 25, 2020

Chart version:

Kubernetes version:
v1.18.6

Kubernetes provider: E.g. GKE (Google Kubernetes Engine)

bare-metal

Describe the bug:

Followning the official example results in error about DNS-1123

kubectl create secret generic slack_hook --from-literal=xpack.notification.slack.account.monitoring.secure_url='https://hooks.slack.com/services/asdasdasd/asdasdas/asdasd'
The Secret "slack_hook" is invalid: metadata.name: Invalid value: "slack_hook": a DNS-1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')

Steps to reproduce:

  1. create a secret with an underscore in it's name
  2. view the error

Expected behavior:

To be able to create secrets for the snapshotting plugins (many of which have an underscore in their name) as in here:

https://discuss.elastic.co/t/adding-credentials-to-helm-chart/242420/2

Provide logs and/or server output (if relevant):
This can also be duplicated in under three minutes here:
https://labs.play-with-k8s.com/
and here:
https://www.katacoda.com/thoth/scenarios/duplicatednserror

@joshuacox
Copy link
Author

Is there anyone out there who can help on this issue? Surely I'm not the only one trying to do backups/snapshots.

@joshuacox
Copy link
Author

bump

@jmlrt
Copy link
Member

jmlrt commented Sep 16, 2020

Hi @joshuacox,
Thanks for reporting this issue.
It seems that k8s don't accept _ in secrets name.

I guess this was working in previous k8s versions when we added this example to the doc, but k8s behavior changed since.

You can fix it by naming your secret slack-hook instead of slack_hook:

$ kubectl create secret generic slack_hook --from-literal=xpack.notification.slack.account.monitoring.secure_url='https://hooks.slack.com/services/asdasdasd/asdasdas/asdasd'
The Secret "slack_hook" is invalid: metadata.name: Invalid value: "slack_hook": a DNS-1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')
$ kubectl create secret generic slack-hook --from-literal=xpack.notification.slack.account.monitoring.secure_url='https://hooks.slack.com/services/asdasdasd/asdasdas/asdasd'
secret/slack-hook created

#811 should fix the examples.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working elasticsearch
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants