improve custom_labels validation func

This commit is contained in:
Benjamin A. Petersen
2023-11-08 13:10:19 -08:00
committed by Ryan Richard
parent 1e9f9181a1
commit c3410c4b14
2 changed files with 26 additions and 2 deletions
+13 -1
View File
@@ -31,8 +31,20 @@ into_namespace: ""
#@ not assume that there was a static install-time yaml namespace."
#@schema/desc custom_labels_desc
#@schema/examples ("Example set of labels", {"myCustomLabelName": "myCustomLabelValue", "otherCustomLabelName": "otherCustomLabelValue"})
#@ def validate_labels(labels):
#@ """
#@ Returns True if labels is an associative data structure string→string,
#@ and False otherwise.
#@ """
#@ for label in labels:
#@ if type(label) != "string" or type(labels[label]) != "string":
#@ return False
#@ end
#@ end
#@ return True
#@ end
#@schema/type any=True
#@schema/validation ("a map of keys and values", lambda v: type(v) in ["yamlfragment"])
#@schema/validation ("a map of keys and values", validate_labels)
custom_labels: {}
#@schema/title "Replicas"
+13 -1
View File
@@ -31,8 +31,20 @@ into_namespace: ""
#@ not assume that there was a static install-time yaml namespace."
#@schema/desc custom_labels_desc
#@schema/examples ("Example set of labels", {"myCustomLabelName": "myCustomLabelValue", "otherCustomLabelName": "otherCustomLabelValue"})
#@ def validate_labels(labels):
#@ """
#@ Returns True if labels is an associative data structure string→string,
#@ and False otherwise.
#@ """
#@ for label in labels:
#@ if type(label) != "string" or type(labels[label]) != "string":
#@ return False
#@ end
#@ end
#@ return True
#@ end
#@schema/type any=True
#@schema/validation ("a map of keys and values", lambda v: type(v) in ["yamlfragment"])
#@schema/validation ("a map of keys and values", validate_labels)
custom_labels: {}
#@schema/title "Replicas"