Skip to content

Commit c7154a3

Browse files
committed
Set default value for corev1.Protocol type
1 parent 9a9db70 commit c7154a3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pkg/crd/known_types.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ import (
2424
// KnownPackages overrides types in some comment packages that have custom validation
2525
// but don't have validation markers on them (since they're from core Kubernetes).
2626
var KnownPackages = map[string]PackageOverride{
27+
"k8s.io/api/core/v1": func(p *Parser, pkg *loader.Package) {
28+
// Explicit defaulting for the corev1.Protocol type in lieu of https://github.com/kubernetes/enhancements/pull/1928
29+
p.Schemata[TypeIdent{Name: "Protocol", Package: pkg}] = apiext.JSONSchemaProps{
30+
Type: "string",
31+
Default: &apiext.JSON{Raw: []byte(`"TCP"`)},
32+
}
33+
p.AddPackage(pkg)
34+
},
2735

2836
"k8s.io/apimachinery/pkg/apis/meta/v1": func(p *Parser, pkg *loader.Package) {
2937
// ObjectMeta is managed by the Kubernetes API server, so no need to

0 commit comments

Comments
 (0)