Skip to content

Commit 3e2c87b

Browse files
authored
Merge pull request kubernetes#2425 from justaugustus/refactor-revert
Revert "Merge pull request kubernetes#2387 from justaugustus/cleanup"
2 parents 0a495c8 + 0d6484e commit 3e2c87b

34 files changed

+375
-869
lines changed

api/approval.go

Lines changed: 0 additions & 99 deletions
This file was deleted.

api/proposal.go

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,6 @@ limitations under the License.
1616

1717
package api
1818

19-
import (
20-
"bufio"
21-
"bytes"
22-
"crypto/md5"
23-
"fmt"
24-
"io"
25-
"strings"
26-
27-
"github.com/go-playground/validator/v10"
28-
"github.com/pkg/errors"
29-
"gopkg.in/yaml.v3"
30-
)
31-
3219
type Proposals []*Proposal
3320

3421
func (p *Proposals) AddProposal(proposal *Proposal) {
@@ -69,65 +56,6 @@ type Proposal struct {
6956
Contents string `json:"markdown" yaml:"-"`
7057
}
7158

72-
func (p *Proposal) Validate() error {
73-
v := validator.New()
74-
if err := v.Struct(p); err != nil {
75-
return errors.Wrap(err, "running validation")
76-
}
77-
78-
return nil
79-
}
80-
81-
type KEPHandler Parser
82-
83-
// TODO(api): Make this a generic parser for all `Document` types
84-
func (k *KEPHandler) Parse(in io.Reader) (*Proposal, error) {
85-
scanner := bufio.NewScanner(in)
86-
count := 0
87-
metadata := []byte{}
88-
var body bytes.Buffer
89-
for scanner.Scan() {
90-
line := scanner.Text() + "\n"
91-
if strings.Contains(line, "---") {
92-
count++
93-
continue
94-
}
95-
if count == 1 {
96-
metadata = append(metadata, []byte(line)...)
97-
} else {
98-
body.WriteString(line)
99-
}
100-
}
101-
102-
kep := &Proposal{
103-
Contents: body.String(),
104-
}
105-
106-
if err := scanner.Err(); err != nil {
107-
return kep, errors.Wrap(err, "reading file")
108-
}
109-
110-
// this file is just the KEP metadata
111-
if count == 0 {
112-
metadata = body.Bytes()
113-
kep.Contents = ""
114-
}
115-
116-
if err := yaml.Unmarshal(metadata, &kep); err != nil {
117-
k.Errors = append(k.Errors, errors.Wrap(err, "error unmarshalling YAML"))
118-
return kep, errors.Wrap(err, "unmarshalling YAML")
119-
}
120-
121-
if valErr := kep.Validate(); valErr != nil {
122-
k.Errors = append(k.Errors, errors.Wrap(valErr, "validating KEP"))
123-
return kep, errors.Wrap(valErr, "validating KEP")
124-
}
125-
126-
kep.ID = hash(kep.OwningSIG + ":" + kep.Title)
127-
128-
return kep, nil
129-
}
130-
13159
type Milestone struct {
13260
Alpha string `json:"alpha" yaml:"alpha"`
13361
Beta string `json:"beta" yaml:"beta"`
@@ -138,7 +66,3 @@ type FeatureGate struct {
13866
Name string `json:"name" yaml:"name"`
13967
Components []string `json:"components" yaml:"components"`
14068
}
141-
142-
func hash(s string) string {
143-
return fmt.Sprintf("%x", md5.Sum([]byte(s)))
144-
}

cmd/kepctl/cmd/create.go

Lines changed: 0 additions & 106 deletions
This file was deleted.

cmd/kepctl/cmd/promote.go

Lines changed: 0 additions & 72 deletions
This file was deleted.

0 commit comments

Comments
 (0)