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

Add missing additionProperties to openAPI specs for CRDS #496

Merged
merged 1 commit into from
Apr 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions helm-charts/seldon-core-crd/templates/_hpa-spec-validation.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@
"type": "array"
},
"matchLabels": {
"additionalProperties": true,
"additionalProperties": {
"type": "string"
},
"description": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.",
"type": "object"
}
Expand Down Expand Up @@ -111,7 +113,9 @@
"type": "array"
},
"matchLabels": {
"additionalProperties": true,
"additionalProperties": {
"type": "string"
},
"description": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.",
"type": "object"
}
Expand Down Expand Up @@ -194,7 +198,9 @@
"type": "array"
},
"matchLabels": {
"additionalProperties": true,
"additionalProperties": {
"type": "string"
},
"description": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.",
"type": "object"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"description": "ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.",
"properties": {
"annotations": {
"additionalProperties": true,
"additionalProperties": {
"type": "string"
},
"description": "Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations",
"type": "object"
},
Expand Down Expand Up @@ -177,7 +179,9 @@
"type": "object"
},
"labels": {
"additionalProperties": true,
"additionalProperties": {
"type": "string"
},
"description": "Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels",
"type": "object"
},
Expand Down
28 changes: 21 additions & 7 deletions helm-charts/seldon-core-crd/templates/_pod-spec-validation.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,9 @@
"type": "array"
},
"matchLabels": {
"additionalProperties": true,
"additionalProperties": {
"type": "string"
},
"description": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.",
"type": "object"
}
Expand Down Expand Up @@ -300,7 +302,9 @@
"type": "array"
},
"matchLabels": {
"additionalProperties": true,
"additionalProperties": {
"type": "string"
},
"description": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.",
"type": "object"
}
Expand Down Expand Up @@ -375,7 +379,9 @@
"type": "array"
},
"matchLabels": {
"additionalProperties": true,
"additionalProperties": {
"type": "string"
},
"description": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.",
"type": "object"
}
Expand Down Expand Up @@ -453,7 +459,9 @@
"type": "array"
},
"matchLabels": {
"additionalProperties": true,
"additionalProperties": {
"type": "string"
},
"description": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.",
"type": "object"
}
Expand Down Expand Up @@ -2218,7 +2226,9 @@
"type": "string"
},
"nodeSelector": {
"additionalProperties": true,
"additionalProperties": {
"type": "string"
},
"description": "NodeSelector is a selector which must be true for the pod to fit on a node. Selector which must match a node's labels for the pod to be scheduled on that node. More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/",
"type": "object"
},
Expand Down Expand Up @@ -2621,7 +2631,9 @@
"type": "boolean"
},
"volumeAttributes": {
"additionalProperties": true,
"additionalProperties": {
"type": "string"
},
"description": "VolumeAttributes stores driver-specific properties that are passed to the CSI driver. Consult your driver's documentation for supported values.",
"type": "object"
}
Expand Down Expand Up @@ -2761,7 +2773,9 @@
"type": "string"
},
"options": {
"additionalProperties": true,
"additionalProperties": {
"type": "string"
},
"description": "Optional: Extra command options if any.",
"type": "object"
},
Expand Down
12 changes: 9 additions & 3 deletions seldon-core/seldon-core/json/hpa-validation.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
"type": "array"
},
"matchLabels": {
"additionalProperties": true,
"additionalProperties": {
"type": "string"
},
"description": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.",
"type": "object"
}
Expand Down Expand Up @@ -110,7 +112,9 @@
"type": "array"
},
"matchLabels": {
"additionalProperties": true,
"additionalProperties": {
"type": "string"
},
"description": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.",
"type": "object"
}
Expand Down Expand Up @@ -193,7 +197,9 @@
"type": "array"
},
"matchLabels": {
"additionalProperties": true,
"additionalProperties": {
"type": "string"
},
"description": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.",
"type": "object"
}
Expand Down
8 changes: 6 additions & 2 deletions seldon-core/seldon-core/json/object-meta-validation.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
"description": "ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.",
"properties": {
"annotations": {
"additionalProperties": true,
"additionalProperties": {
"type": "string"
},
"description": "Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations",
"type": "object"
},
Expand Down Expand Up @@ -176,7 +178,9 @@
"type": "object"
},
"labels": {
"additionalProperties": true,
"additionalProperties": {
"type": "string"
},
"description": "Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels",
"type": "object"
},
Expand Down
28 changes: 21 additions & 7 deletions seldon-core/seldon-core/json/pod-spec-validation.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,9 @@
"type": "array"
},
"matchLabels": {
"additionalProperties": true,
"additionalProperties": {
"type": "string"
},
"description": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.",
"type": "object"
}
Expand Down Expand Up @@ -299,7 +301,9 @@
"type": "array"
},
"matchLabels": {
"additionalProperties": true,
"additionalProperties": {
"type": "string"
},
"description": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.",
"type": "object"
}
Expand Down Expand Up @@ -374,7 +378,9 @@
"type": "array"
},
"matchLabels": {
"additionalProperties": true,
"additionalProperties": {
"type": "string"
},
"description": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.",
"type": "object"
}
Expand Down Expand Up @@ -452,7 +458,9 @@
"type": "array"
},
"matchLabels": {
"additionalProperties": true,
"additionalProperties": {
"type": "string"
},
"description": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.",
"type": "object"
}
Expand Down Expand Up @@ -2217,7 +2225,9 @@
"type": "string"
},
"nodeSelector": {
"additionalProperties": true,
"additionalProperties": {
"type": "string"
},
"description": "NodeSelector is a selector which must be true for the pod to fit on a node. Selector which must match a node's labels for the pod to be scheduled on that node. More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/",
"type": "object"
},
Expand Down Expand Up @@ -2620,7 +2630,9 @@
"type": "boolean"
},
"volumeAttributes": {
"additionalProperties": true,
"additionalProperties": {
"type": "string"
},
"description": "VolumeAttributes stores driver-specific properties that are passed to the CSI driver. Consult your driver's documentation for supported values.",
"type": "object"
}
Expand Down Expand Up @@ -2760,7 +2772,9 @@
"type": "string"
},
"options": {
"additionalProperties": true,
"additionalProperties": {
"type": "string"
},
"description": "Optional: Extra command options if any.",
"type": "object"
},
Expand Down
4 changes: 3 additions & 1 deletion util/custom-resource-definitions/expand-validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ def expand(defn,root):
def simplifyAdditionalProperties(defn):
if isinstance(defn, dict):
if "additionalProperties" in defn.keys():
defn["additionalProperties"] = True
if isinstance(defn["additionalProperties"], dict):
if "$ref" in defn["additionalProperties"].keys():
defn["additionalProperties"] = True
for k in defn.keys():
simplifyAdditionalProperties(defn[k])

Expand Down