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

install-agent-k8s.sh gives a very cryptic error when sysdig_instance_name has spaces in it #100

Open
ashishth09 opened this issue Mar 18, 2020 · 0 comments

Comments

@ashishth09
Copy link

ashishth09 commented Mar 18, 2020

By sheer coincidence my script declared SYSDIG_INSTANCE_NAME and it has spaces in it. For example - My Sysdig Instance. I never passed any value to sysdig_instance_name

But the script used it anyway :) https://github.com/draios/sysdig-cloud-scripts/blob/master/agent_deploy/IBMCloud-Kubernetes-Service/install-agent-k8s.sh#L422

https://github.com/draios/sysdig-cloud-scripts/blob/master/agent_deploy/IBMCloud-Kubernetes-Service/install-agent-k8s.sh#L284 choked with error as

sed: -e expression #1, char 45: unterminated s' command`

Since sysdig_instance_name is expected to be used as K8s labels, it can't have any spaces..

A valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue',  or 'my_value',  or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?') 

We should use the regex to validate the value to avoid throwing error at later stages and make it clear in documentation

If we don't want to keep up with K8s changes, we should simply let user pass whatever he wishes to and get that correctly sed'ed, actual error about spaces etc will eventually be thrown by K8s API

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

No branches or pull requests

1 participant