Skip to content

Commit 13ddec1

Browse files
authored
Merge pull request kubernetes#2180 from wojtek-t/prod_readiness_approvals
Tracker for production-readiness approvals
2 parents 08c82f9 + 141539d commit 13ddec1

File tree

16 files changed

+413
-70
lines changed

16 files changed

+413
-70
lines changed

cmd/kepval/main.go

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

cmd/kepval/main_test.go

Lines changed: 59 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,18 @@ limitations under the License.
1717
package main
1818

1919
import (
20-
"bytes"
2120
"os"
2221
"path/filepath"
2322
"strings"
2423
"testing"
24+
25+
"k8s.io/enhancements/pkg/kepval/keps"
26+
"k8s.io/enhancements/pkg/kepval/prrs"
2527
)
2628

2729
const (
2830
kepsDir = "keps"
31+
prrsDir = "keps/prod-readiness"
2932
kepMetadata = "kep.yaml"
3033
)
3134

@@ -70,14 +73,61 @@ func TestValidation(t *testing.T) {
7073
t.Fatal("must find more than 0 keps")
7174
}
7275

73-
// Overwrite the command line argument for the run() function
74-
os.Args = []string{"", ""}
75-
for _, file := range files {
76-
t.Run(file, func(t *testing.T) {
77-
os.Args[1] = file
78-
var b bytes.Buffer
79-
if exit := run(&b); exit != 0 {
80-
t.Fatalf("exit code was %d and not 0. Output:\n%s", exit, b.String())
76+
kepParser := &keps.Parser{}
77+
prrParser := &prrs.Parser{}
78+
prrsDir := filepath.Join("..", "..", prrsDir)
79+
80+
for _, filename := range files {
81+
t.Run(filename, func(t *testing.T) {
82+
kepFile, err := os.Open(filename)
83+
if err != nil {
84+
t.Fatalf("could not open file %s: %v\n", filename, err)
85+
}
86+
defer kepFile.Close()
87+
88+
kep := kepParser.Parse(kepFile)
89+
if kep.Error != nil {
90+
t.Errorf("%v has an error: %v", filename, kep.Error)
91+
}
92+
93+
requiredPRRApproval := len(kep.Number) > 0 && kep.LatestMilestone >= "v1.21"
94+
if !requiredPRRApproval {
95+
return
96+
}
97+
98+
prrFilename := filepath.Join(prrsDir, kep.OwningSIG, kep.Number)
99+
prrFile, err := os.Open(prrFilename)
100+
if os.IsNotExist(err) {
101+
t.Errorf("missing PRR Approval file under: %s", prrFilename)
102+
return
103+
}
104+
if err != nil {
105+
t.Fatalf("could not open file %s: %v\n", prrFilename, err)
106+
}
107+
prr := prrParser.Parse(prrFile)
108+
if prr.Error != nil {
109+
t.Errorf("PRR approval file %v has an error: %v", prrFilename, prr.Error)
110+
return
111+
}
112+
113+
var stageMilestone string
114+
var stagePRRApprover string
115+
switch kep.Stage {
116+
case "alpha":
117+
stageMilestone = kep.Milestone.Alpha
118+
stagePRRApprover = prr.Alpha.Approver
119+
case "beta":
120+
stageMilestone = kep.Milestone.Beta
121+
stagePRRApprover = prr.Beta.Approver
122+
case "stable":
123+
stageMilestone = kep.Milestone.Stable
124+
stagePRRApprover = prr.Stable.Approver
125+
}
126+
if len(stageMilestone) > 0 && stageMilestone >= "v1.21" {
127+
// PRR approval is needed.
128+
if len(stagePRRApprover) == 0 {
129+
t.Errorf("PRR not approved for: %s", kep.Stage)
130+
}
81131
}
82132
})
83133
}

keps/prod-readiness/OWNERS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Disable inheritance as this is production-readiness directory.
2+
options:
3+
no_parent_owners: true
4+
5+
approvers:
6+
- prod-readiness-approvers
7+
8+
# TODO: Tag PRs with PRR-related label.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
kep-number: 1040
2+
beta:
3+
approver: "@wojtek-t"

keps/sig-cloud-provider/1959-service-lb-class-field/kep.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ stage: alpha
2424
# The most recent milestone for which work toward delivery of this KEP has been
2525
# done. This can be the current (upcoming) milestone, if it is being actively
2626
# worked on.
27-
latest-milestone: "v1.21"
27+
# latest-milestone: "v1.21"
2828

2929
# The milestone at which this feature was, or is targeted to be, at each stage.
3030
milestone:

keps/sig-network/1860-kube-proxy-IP-node-binding/kep.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@ approvers:
1616

1717
stage: "alpha"
1818

19-
latest-milestone: "v1.21"
19+
# latest-milestone: "v1.21"
2020

2121
milestone:
2222
alpha: "v1.21"
2323
beta: "v1.22"
24-
stable: "v1.22"
2524

2625
feature-gates:
2726
- name: LoadBalancerIPMode

keps/sig-network/2004-topology-aware-subsetting/kep.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ stage: alpha
2626
# The most recent milestone for which work toward delivery of this KEP has been
2727
# done. This can be the current (upcoming) milestone, if it is being actively
2828
# worked on.
29-
latest-milestone: "v1.21"
29+
# latest-milestone: "v1.21"
3030

3131
# The milestone at which this feature was, or is targeted to be, at each stage.
3232
milestone:

keps/sig-network/2030-endpointslice-subsetting/kep.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ stage: alpha
2424
# The most recent milestone for which work toward delivery of this KEP has been
2525
# done. This can be the current (upcoming) milestone, if it is being actively
2626
# worked on.
27-
latest-milestone: "v1.21"
27+
# latest-milestone: "v1.21"
2828

2929
# The milestone at which this feature was, or is targeted to be, at each stage.
3030
milestone:

keps/sig-network/2079-network-policy-port-range/kep.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ stage: alpha
1818
# The most recent milestone for which work toward delivery of this KEP has been
1919
# done. This can be the current (upcoming) milestone, if it is being actively
2020
# worked on.
21-
latest-milestone: "v1.21"
21+
# latest-milestone: "v1.21"
2222

2323
# The milestone at which this feature was, or is targeted to be, at each stage.
2424
milestone:

keps/sig-network/2086-service-internal-traffic-policy/kep.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ stage: alpha
2323
# The most recent milestone for which work toward delivery of this KEP has been
2424
# done. This can be the current (upcoming) milestone, if it is being actively
2525
# worked on.
26-
latest-milestone: "v1.21"
26+
# latest-milestone: "v1.21"
2727

2828
# The milestone at which this feature was, or is targeted to be, at each stage.
2929
milestone:

0 commit comments

Comments
 (0)