metac icon indicating copy to clipboard operation
metac copied to clipboard

bug: MatchFields error out if value has forward slash

Open AmitKumarDas opened this issue 5 years ago • 1 comments

Following MatchFields results in error

ResourceSelector: v1alpha1.ResourceSelector{
	SelectorTerms: []*v1alpha1.SelectorTerm{
		&v1alpha1.SelectorTerm{
			MatchFields: map[string]string{
				"kind":       "StatefulSet",
				"apiVersion": "apps/v1",
			},
		},
	},
},
got [invalid label value: "apps/v1": at key: "apiVersion": 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])?')
            Invalid field expressions: &LabelSelector{MatchLabels:map[string]string{apiVersion: 
apps/v1,kind: StatefulSet,},MatchExpressions:[]LabelSelectorRequirement{},}
            openebs.io/metac/controller/common/selector.(*Evaluation).isFieldMatch

AmitKumarDas avatar Mar 18 '20 09:03 AmitKumarDas

This error may not happen if client-go & related k8s dependencies are pointed to v0.17.3 Need to write UT as well as update go.mod files to verify.

AmitKumarDas avatar Mar 26 '20 10:03 AmitKumarDas