Skip to content

Commit f9e1a0e

Browse files
committed
api: Initial commit
Signed-off-by: Stephen Augustus <[email protected]>
1 parent c18e33a commit f9e1a0e

File tree

2 files changed

+72
-53
lines changed

2 files changed

+72
-53
lines changed

api/proposal.go

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*
2+
Copyright 2021 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package api
18+
19+
type Proposals []*Proposal
20+
21+
func (p *Proposals) AddProposal(proposal *Proposal) {
22+
*p = append(*p, proposal)
23+
}
24+
25+
type Proposal struct {
26+
ID string `json:"id"`
27+
PRNumber string `json:"prNumber,omitempty"`
28+
Name string `json:"name,omitempty"`
29+
30+
Title string `json:"title" yaml:"title"`
31+
Number string `json:"kep-number" yaml:"kep-number"`
32+
Authors []string `json:"authors" yaml:",flow"`
33+
OwningSIG string `json:"owningSig" yaml:"owning-sig"`
34+
ParticipatingSIGs []string `json:"participatingSigs" yaml:"participating-sigs,flow,omitempty"`
35+
Reviewers []string `json:"reviewers" yaml:",flow"`
36+
Approvers []string `json:"approvers" yaml:",flow"`
37+
PRRApprovers []string `json:"prrApprovers" yaml:"prr-approvers,flow"`
38+
Editor string `json:"editor" yaml:"editor,omitempty"`
39+
CreationDate string `json:"creationDate" yaml:"creation-date"`
40+
LastUpdated string `json:"lastUpdated" yaml:"last-updated"`
41+
Status string `json:"status" yaml:"status"`
42+
SeeAlso []string `json:"seeAlso" yaml:"see-also,omitempty"`
43+
Replaces []string `json:"replaces" yaml:"replaces,omitempty"`
44+
SupersededBy []string `json:"supersededBy" yaml:"superseded-by,omitempty"`
45+
46+
Stage string `json:"stage" yaml:"stage"`
47+
LatestMilestone string `json:"latestMilestone" yaml:"latest-milestone"`
48+
Milestone Milestone `json:"milestone" yaml:"milestone"`
49+
50+
FeatureGates []FeatureGate `json:"featureGates" yaml:"feature-gates"`
51+
DisableSupported bool `json:"disableSupported" yaml:"disable-supported"`
52+
Metrics []string `json:"metrics" yaml:"metrics"`
53+
54+
Filename string `json:"-" yaml:"-"`
55+
Error error `json:"-" yaml:"-"`
56+
Contents string `json:"markdown" yaml:"-"`
57+
}
58+
59+
type Milestone struct {
60+
Alpha string `json:"alpha" yaml:"alpha"`
61+
Beta string `json:"beta" yaml:"beta"`
62+
Stable string `json:"stable" yaml:"stable"`
63+
}
64+
65+
type FeatureGate struct {
66+
Name string `json:"name" yaml:"name"`
67+
Components []string `json:"components" yaml:"components"`
68+
}

pkg/kepval/keps/proposals.go

Lines changed: 4 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -26,63 +26,14 @@ import (
2626

2727
"github.com/pkg/errors"
2828
"gopkg.in/yaml.v2"
29+
30+
"k8s.io/enhancements/api"
2931
"k8s.io/enhancements/pkg/kepval/keps/validations"
3032
)
3133

32-
type Proposals []*Proposal
33-
34-
func (p *Proposals) AddProposal(proposal *Proposal) {
35-
*p = append(*p, proposal)
36-
}
37-
38-
type Milestone struct {
39-
Alpha string `json:"alpha" yaml:"alpha"`
40-
Beta string `json:"beta" yaml:"beta"`
41-
Stable string `json:"stable" yaml:"stable"`
42-
}
43-
44-
type FeatureGate struct {
45-
Name string `json:"name" yaml:"name"`
46-
Components []string `json:"components" yaml:"components"`
47-
}
48-
49-
type Proposal struct {
50-
ID string `json:"id"`
51-
PRNumber string `json:"prNumber,omitempty"`
52-
Name string `json:"name,omitempty"`
53-
54-
Title string `json:"title" yaml:"title"`
55-
Number string `json:"kep-number" yaml:"kep-number"`
56-
Authors []string `json:"authors" yaml:",flow"`
57-
OwningSIG string `json:"owningSig" yaml:"owning-sig"`
58-
ParticipatingSIGs []string `json:"participatingSigs" yaml:"participating-sigs,flow,omitempty"`
59-
Reviewers []string `json:"reviewers" yaml:",flow"`
60-
Approvers []string `json:"approvers" yaml:",flow"`
61-
PRRApprovers []string `json:"prrApprovers" yaml:"prr-approvers,flow"`
62-
Editor string `json:"editor" yaml:"editor,omitempty"`
63-
CreationDate string `json:"creationDate" yaml:"creation-date"`
64-
LastUpdated string `json:"lastUpdated" yaml:"last-updated"`
65-
Status string `json:"status" yaml:"status"`
66-
SeeAlso []string `json:"seeAlso" yaml:"see-also,omitempty"`
67-
Replaces []string `json:"replaces" yaml:"replaces,omitempty"`
68-
SupersededBy []string `json:"supersededBy" yaml:"superseded-by,omitempty"`
69-
70-
Stage string `json:"stage" yaml:"stage"`
71-
LatestMilestone string `json:"latestMilestone" yaml:"latest-milestone"`
72-
Milestone Milestone `json:"milestone" yaml:"milestone"`
73-
74-
FeatureGates []FeatureGate `json:"featureGates" yaml:"feature-gates"`
75-
DisableSupported bool `json:"disableSupported" yaml:"disable-supported"`
76-
Metrics []string `json:"metrics" yaml:"metrics"`
77-
78-
Filename string `json:"-" yaml:"-"`
79-
Error error `json:"-" yaml:"-"`
80-
Contents string `json:"markdown" yaml:"-"`
81-
}
82-
8334
type Parser struct{}
8435

85-
func (p *Parser) Parse(in io.Reader) *Proposal {
36+
func (p *Parser) Parse(in io.Reader) *api.Proposal {
8637
scanner := bufio.NewScanner(in)
8738
count := 0
8839
metadata := []byte{}
@@ -99,7 +50,7 @@ func (p *Parser) Parse(in io.Reader) *Proposal {
9950
body.WriteString(line)
10051
}
10152
}
102-
proposal := &Proposal{
53+
proposal := &api.Proposal{
10354
Contents: body.String(),
10455
}
10556
if err := scanner.Err(); err != nil {

0 commit comments

Comments
 (0)