Skip to content

Commit

Permalink
ObjectMeta should use additionalProperties (#1949)
Browse files Browse the repository at this point in the history
Rather than using `x-kubernetes-preserve-unknown-fields` which allows
both keys and values of any type, we should use `additionalProperties`
which only allows a specified type (in this case "string") for keys and
values.

Better validation!

Co-authored-by: Robert Bailey <robertbailey@google.com>
  • Loading branch information
markmandel and roberthbailey authored Jan 16, 2021
1 parent 8f439f0 commit 93d8c10
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 4 additions & 2 deletions install/helm/agones/templates/crds/_gameserverspecschema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ properties:
properties:
labels:
type: object
x-kubernetes-preserve-unknown-fields: true
additionalProperties:
type: string
annotations:
type: object
x-kubernetes-preserve-unknown-fields: true
additionalProperties:
type: string
{{- end}}
spec:
type: object
Expand Down
12 changes: 8 additions & 4 deletions install/yaml/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,12 @@ spec:
properties:
labels:
type: object
x-kubernetes-preserve-unknown-fields: true
additionalProperties:
type: string
annotations:
type: object
x-kubernetes-preserve-unknown-fields: true
additionalProperties:
type: string
spec:
type: object
required:
Expand Down Expand Up @@ -971,10 +973,12 @@ spec:
properties:
labels:
type: object
x-kubernetes-preserve-unknown-fields: true
additionalProperties:
type: string
annotations:
type: object
x-kubernetes-preserve-unknown-fields: true
additionalProperties:
type: string
spec:
type: object
required:
Expand Down

0 comments on commit 93d8c10

Please sign in to comment.