Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove defaults from crd v1beta1 YAML (#8)
Signed-off-by: Tamal Saha <tamal@appscode.com>
  • Loading branch information
tamalsaha committed May 25, 2020
1 parent 1a09ffd commit d2f3f5d
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions api/crds/bindata.go

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion api/crds/stash.appscode.com_functions.yaml
Expand Up @@ -104,7 +104,6 @@ spec:
name. Name for the port that can be referred to by services.
type: string
protocol:
default: TCP
description: Protocol for port. Must be UDP, TCP, or SCTP. Defaults
to "TCP".
type: string
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -21,7 +21,7 @@ require (
k8s.io/client-go v12.0.0+incompatible
k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6
k8s.io/kubernetes v1.18.3
kmodules.xyz/client-go v0.0.0-20200525110342-ae5b70d3b49b
kmodules.xyz/client-go v0.0.0-20200525195850-2fd180961371
kmodules.xyz/crd-schema-fuzz v0.0.0-20200521005638-2433a187de95
kmodules.xyz/custom-resources v0.0.0-20200525025248-c2afe49bbec6
kmodules.xyz/objectstore-api v0.0.0-20200521103120-92080446e04d
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Expand Up @@ -885,8 +885,8 @@ k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89/go.mod h1:sZAwmy6armz5eXlNoLmJcl
kmodules.xyz/client-go v0.0.0-20200521005126-35ce6bd4ed46/go.mod h1:sY/eoe4ktxZEoHpr5NpAQ5s22VSwTE8psJtKVeVgLRY=
kmodules.xyz/client-go v0.0.0-20200521065424-173e32c78a20/go.mod h1:sY/eoe4ktxZEoHpr5NpAQ5s22VSwTE8psJtKVeVgLRY=
kmodules.xyz/client-go v0.0.0-20200525012433-99c6914a1eca/go.mod h1:sY/eoe4ktxZEoHpr5NpAQ5s22VSwTE8psJtKVeVgLRY=
kmodules.xyz/client-go v0.0.0-20200525110342-ae5b70d3b49b h1:Fv9E35891GahcrCO09WfCGSJlpaEpfIyxoBHwOINhiQ=
kmodules.xyz/client-go v0.0.0-20200525110342-ae5b70d3b49b/go.mod h1:sY/eoe4ktxZEoHpr5NpAQ5s22VSwTE8psJtKVeVgLRY=
kmodules.xyz/client-go v0.0.0-20200525195850-2fd180961371 h1:PPawDOMyDHGeDPN8j1epNozaIB/Z7MlJsXpwm/r4jgk=
kmodules.xyz/client-go v0.0.0-20200525195850-2fd180961371/go.mod h1:sY/eoe4ktxZEoHpr5NpAQ5s22VSwTE8psJtKVeVgLRY=
kmodules.xyz/constants v0.0.0-20200506032633-a21e58ceec72/go.mod h1:DbiFk1bJ1KEO94t1SlAn7tzc+Zz95rSXgyUKa2nzPmY=
kmodules.xyz/crd-schema-fuzz v0.0.0-20200521005638-2433a187de95 h1:v0S/+ftzL6Xrs9XevgchAOJyPKlRQXPiZf87xotj3X4=
kmodules.xyz/crd-schema-fuzz v0.0.0-20200521005638-2433a187de95/go.mod h1:jpu8xFsDKd6kAWUAKk8oTu/GQGBWqhrcaDeOJdaCJnk=
Expand Down
9 changes: 7 additions & 2 deletions vendor/kmodules.xyz/client-go/apiextensions/kubernetes.go
Expand Up @@ -75,7 +75,11 @@ func RegisterCRDs(client crd_cs.Interface, crds []*CustomResourceDefinition) err
// xref: https://github.com/stashed/stash/issues/1007#issuecomment-570888875
crd.V1beta1.Spec.Validation.OpenAPIV3Schema.Type = ""
}
removeDefaults(crd.V1beta1.Spec.Validation.OpenAPIV3Schema)

if crd.V1beta1.Spec.Validation != nil &&
crd.V1beta1.Spec.Validation.OpenAPIV3Schema != nil {
removeDefaults(crd.V1beta1.Spec.Validation.OpenAPIV3Schema)
}

_, _, err := v1beta1.CreateOrUpdateCustomResourceDefinition(
context.TODO(),
Expand Down Expand Up @@ -125,8 +129,9 @@ func removeDefaults(schema *crdv1beta1.JSONSchemaProps) {
if schema.Not != nil {
removeDefaults(schema.Not)
}
for _, prop := range schema.Properties {
for key, prop := range schema.Properties {
removeDefaults(&prop)
schema.Properties[key] = prop
}
if schema.AdditionalProperties != nil {
removeDefaults(schema.AdditionalProperties.Schema)
Expand Down
2 changes: 1 addition & 1 deletion vendor/modules.txt
Expand Up @@ -684,7 +684,7 @@ k8s.io/utils/net
k8s.io/utils/path
k8s.io/utils/pointer
k8s.io/utils/trace
# kmodules.xyz/client-go v0.0.0-20200525110342-ae5b70d3b49b
# kmodules.xyz/client-go v0.0.0-20200525195850-2fd180961371
kmodules.xyz/client-go
kmodules.xyz/client-go/api/v1
kmodules.xyz/client-go/apiextensions
Expand Down

0 comments on commit d2f3f5d

Please sign in to comment.