Merge pull request #34020 from juanvallejo/jvallejo/allow-empty-annotation-values
Automatic merge from submit-queue Allow empty annotation values Related downstream issue: https://github.com/openshift/origin/issues/11175 **Release note**: ```release-note release-note-none ``` Annotations with empty values can be used, for example, in diagnostics logging. This patch removes the client-side check for empty values in an annotation key-value pair. **Before** ``` $ kubectl annotate pod zookeeper-1 node-selector="" --overwrite error: invalid annotation format: node-selector= ``` **After** ``` $ kubectl annotate pod zookeeper-1 node-selector="" --overwrite pod "zookeper-1" annotated ``` ``` $ kubectl get po/zookeeper-1 --template='{{.metadata.annotations}}' map[... node-selector: test-label:test] ``` @fabianofranz @liggitt
This commit is contained in:
@@ -122,7 +122,7 @@ func parseLabels(spec []string) (map[string]string, []string, error) {
|
||||
for _, labelSpec := range spec {
|
||||
if strings.Index(labelSpec, "=") != -1 {
|
||||
parts := strings.Split(labelSpec, "=")
|
||||
if len(parts) != 2 || len(parts[1]) == 0 {
|
||||
if len(parts) != 2 {
|
||||
return nil, nil, fmt.Errorf("invalid label spec: %v", labelSpec)
|
||||
}
|
||||
if errs := validation.IsValidLabelValue(parts[1]); len(errs) != 0 {
|
||||
|
Reference in New Issue
Block a user