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

Relax strict validation for service link names #4252

Closed
xaka opened this issue Mar 31, 2016 · 12 comments
Closed

Relax strict validation for service link names #4252

xaka opened this issue Mar 31, 2016 · 12 comments
Assignees
Milestone

Comments

@xaka
Copy link

xaka commented Mar 31, 2016

Rancher Version: 1.0

Docker Version: 1.10.3

Steps to Reproduce:

  • upgrade rancher from 0.63 to 1.0
  • upgrade any of existing services

Results:

screen shot 2016-03-31 at 10 03 32 am

##

I had no such issues with v0.63.

@deniseschannon
Copy link

We started doing a stricter validation in GA for service link names to ensure that the name of a link would work with internal DNS. There are some backwards compatibility as we never had this kind of validation.

New validation:
1-63 characters long
Consisting only of A-Z, 0-9, and hyphen
Can't start of end with a hyphen
Can't contain 2 consecutive hyphens

We are discussing removing the validation and allow users to create any alias name knowing that internal DNS might not work as expected.

@deniseschannon deniseschannon added this to the Release 1.0.1 milestone Apr 1, 2016
@deniseschannon deniseschannon changed the title Validation failed in API: name contains invalid characters Revert strict validation for service link names Apr 1, 2016
@xaka
Copy link
Author

xaka commented Apr 1, 2016

1-63 characters long

Is it for service name or for service + stack name together? It looks like for both because my service name is pretty short xxxx-xxxxxx-xxxxxx (and stack name is xxxx-xxxxxx-xxxxxx-xxxxxxxxxxx).

@xaka
Copy link
Author

xaka commented Apr 1, 2016

BTW, even though UI reports such error, service gets upgraded anyway.

@deniseschannon deniseschannon changed the title Revert strict validation for service link names Relax strict validation for service link names Apr 4, 2016
@deniseschannon
Copy link

@xaka The new validation is for the service alias name.

links:
  mysql:<validation on this name>

Nothing significant changed on the service/stack name validation.

@kaos
Copy link

kaos commented Apr 5, 2016

@deniseschannon from the schema, I don't see the extra restrictions regarding starting or ending with a hyphen, or conescutive hyphens.. also, it seems like a slash is accepted.. ?

"validChars": "a-zA-Z0-9-/"

Is there some additional checks done on this particular resource that's not in the schema?

@kaos
Copy link

kaos commented Apr 5, 2016

Btw, is the schema configurable on any level, or is it hardwired into compiled code?
Was hoping to be able to patch the validChars until 1.0.1 is out, as this is halting our progress.

EDIT: nvm, found this: rancher/cattle@a583888

@antmanler
Copy link

ditto,
"do not allow dots" causes lots of problems for our online services...

@kaos it's dangerous, but you can manually update the service name in service_consume_map in MySQL

@kaos
Copy link

kaos commented Apr 6, 2016

@antmanler Thanks, but that won't work for me, unless I misunderstood you. I need to change the schema so it works for new services right away, as we deploy new stacks dozens of times a day (and delete about as many, too). So I can't run around patch each individual service.. ;)

@sangeethah
Copy link
Contributor

Tested with rancher server version - V1.0.1-rc1.

Allowed to have the following formats in service links:
1."validChars": "a-zA-Z0-9-._"
2. Cannot start or end with a "-" or "."
3. Cannot contain "--" or ".."
4. Each dot-delimited label is limited to 63 chars, and the whole string to 253. If there are no dots then it is a single label and must still be <= 63 chars.

We allow service link name to start/end with _ and __ . The links are not resolvable using ping. But dig works fine. Should we restrict these as well ?

screen shot 2016-04-07 at 2 52 13 pm

@will-chan
Copy link
Contributor

we won't support begin and end _ for now.

@vincent99
Copy link
Contributor

_ isn't allowed by the spec at all, so there is no point in us making up arbitrary validation rules to restrict the behavior of it. And it works fine for me:

image

root@aff668fb0db6:/# dig +short _under1
10.42.208.162
root@aff668fb0db6:/# dig +short __under2
10.42.208.162
root@aff668fb0db6:/# dig +short under3_
10.42.208.162
root@aff668fb0db6:/# dig +short under4__
10.42.208.162
root@aff668fb0db6:/# dig +short _under5_
10.42.208.162
root@aff668fb0db6:/# dig +short __under6__
10.42.208.162

@sangeethah
Copy link
Contributor

@vincent99 , dig works , but ping failed with error "unknown host"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants