Skip to content

Commit

Permalink
Merge pull request #405 from robbrockbank/1.1.x-cp
Browse files Browse the repository at this point in the history
Cherry pick label fix into 1.1.x-series
  • Loading branch information
robbrockbank authored Apr 28, 2017
2 parents 7b7ca36 + 3609ebd commit 0d48eab
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion lib/selector/tokenizer/tokenizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ type Token struct {

const (
// LabelKeyMatcher is the base regex for a valid label key.
LabelKeyMatcher = `([a-zA-Z0-9_./-]{0,253}/)?[a-zA-Z0-9]([a-zA-Z0-9_.-]{0,61}[a-zA-Z0-9])?`
LabelKeyMatcher = `[a-zA-Z0-9_./-]{1,512}`
hasExpr = `has\(\s*(` + LabelKeyMatcher + `)\s*\)`
allExpr = `all\(\s*\)`
notInExpr = `not\s*in\b`
Expand Down
1 change: 0 additions & 1 deletion lib/validator/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ func init() {
Entry("should reject label key with !", api.HostEndpointMetadata{Labels: map[string]string{"rank!": "gold"}}, false),
Entry("should reject label key starting with ~", api.HostEndpointMetadata{Labels: map[string]string{"~rank_.0-9": "gold"}}, false),
Entry("should reject label key ending with ~", api.HostEndpointMetadata{Labels: map[string]string{"rank_.0-9~": "gold"}}, false),
Entry("should reject label key where prefix > 253 characters", api.HostEndpointMetadata{Labels: map[string]string{"Projectcalico.org.projectcalico.org.projectcalico.org.projectcalico.org.projectcalico.org.projectcalico.org.projectcalico.org.projectcalico.org.projectcalico.org.projectcalico.org.projectcalico.org.projectcalico.org.projectcalico.org.projectcalico.org123/k8s_ns": "gold"}}, false),
Entry("should reject label value starting with ~", api.HostEndpointMetadata{Labels: map[string]string{"rank_.0-9": "~gold"}}, false),
Entry("should reject label value ending with ~", api.HostEndpointMetadata{Labels: map[string]string{"rank_.0-9": "gold~"}}, false),

Expand Down

0 comments on commit 0d48eab

Please sign in to comment.