Skip to content

Commit a56fcf2

Browse files
committed
ensure all KEPs have title and owning-sig at least
1 parent cb0d284 commit a56fcf2

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

cmd/kepval/main_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ func ignore(name string) bool {
7474
return true
7575
}
7676
if name == "0023-documentation-for-images.md" ||
77-
name == "0004-cloud-provider-template.md" {
77+
name == "0004-cloud-provider-template.md" ||
78+
name == "README.md" ||
79+
name == "kep-faq.md" {
7880
return true
7981
}
8082
return false

keps/sig-network/20190920-external-dns.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
---
2+
title: Move ExternalDNS out of Kubernetes incubator
3+
authors:
4+
- "@njuettner"
5+
owning-sig: sig-network
6+
---
7+
18
# Move ExternalDNS out of Kubernetes incubator
29

310
## Table of Contents

pkg/kepval/keps/validations/yaml.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ import (
2121
"strings"
2222
)
2323

24+
type KeyMustBeSpecified struct {
25+
key interface{}
26+
}
27+
28+
func (k *KeyMustBeSpecified) Error() string {
29+
return fmt.Sprintf("missing key %[1]v", k.key)
30+
}
31+
2432
type KeyMustBeString struct {
2533
key interface{}
2634
}
@@ -62,7 +70,16 @@ type MustHaveAtLeastOneValue struct {
6270
func (m *MustHaveAtLeastOneValue) Error() string {
6371
return fmt.Sprintf("%q must have at least one value", m.key)
6472
}
73+
74+
var mandatoryKeys = []string{"title", "owning-sig"}
75+
6576
func ValidateStructure(parsed map[interface{}]interface{}) error {
77+
for _, key := range mandatoryKeys {
78+
if _, found := parsed[key]; !found {
79+
return &KeyMustBeSpecified{key}
80+
}
81+
}
82+
6683
for key, value := range parsed {
6784
// First off the key has to be a string. fact.
6885
k, ok := key.(string)

0 commit comments

Comments
 (0)