Skip to content

Commit

Permalink
Merge pull request #1769 from lionelvillard/fix-defaults-v2
Browse files Browse the repository at this point in the history
Generate CRD defaults for known types
  • Loading branch information
openshift-merge-robot authored Aug 16, 2022
2 parents bf26f9c + f46a68d commit ae542d1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/crdpuller/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,10 @@ func (sc *SchemaConverter) VisitPrimitive(p *proto.Primitive) {
sc.setupDescription(p)
sc.schemaProps.Type = p.Type
sc.schemaProps.Format = p.Format

if defaults, ok := knownDefaults[p.Path.String()]; ok {
sc.schemaProps.Default = defaults
}
}

func (sc *SchemaConverter) VisitKind(k *proto.Kind) {
Expand Down Expand Up @@ -627,3 +631,7 @@ func init() {
}
}
}

var knownDefaults map[string]*apiextensionsv1.JSON = map[string]*apiextensionsv1.JSON{
"io.k8s.api.core.v1.ContainerPort.protocol": {Raw: []byte(`"TCP"`)},
}

0 comments on commit ae542d1

Please sign in to comment.