Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg/kepval: enable PRR check for implemented KEPs #3007

Merged
merged 12 commits into from
Oct 20, 2021
3 changes: 3 additions & 0 deletions api/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@ func (k *KEPHandler) Validate(p *Proposal) []error {
if err := p.Stage.IsValid(); err != nil {
allErrs = append(allErrs, err)
}
if p.Status == ImplementedStatus && p.Stage != StableStage {
allErrs = append(allErrs, fmt.Errorf("status:implemented implies stage:stable but found: %v", p.Stage))
}
return allErrs
}

Expand Down
103 changes: 103 additions & 0 deletions hack/edit-keps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#!/usr/bin/env python3

# Copyright 2021 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Edit KEPs en-masse by round-tripping them through ruamel.yaml

This is not intended for general usage, because:
- many keps have different formatting, and we're not at a point where
we can enforce formatting standards, so this is almost guaranteed
to introduce formatting change noise
- the idea is to manually edit this file with the specific edit to be
done, rather that developing a general purpose language to do this
"""

import argparse
import glob

from os import path

import ruamel.yaml

# Files that will be ignored
EXCLUDED_FILES = []
# A hilariously large line length to ensure we never line-wrap
MAX_WIDTH = 2000000000

def setup_yaml():
# Setup the ruamel.yaml parser
yaml = ruamel.yaml.YAML(typ='rt')
yaml.preserve_quotes = True
# This is what's used in the template, currently ~36 KEPs have drifted
yaml.indent(mapping=2, sequence=4, offset=2)
yaml.width = MAX_WIDTH
return yaml

def edit_kep(yaml, file_name, force_rewrite=False):
with open(file_name, "r") as fp:
kep = yaml.load(fp)

rewrite = force_rewrite

stage = kep.get("stage", "unknown")
status = kep.get("status", "unknown")
latest_milestone = kep.get("latest-milestone", "unknown")
last_updated = kep.get("last-updated", "unknown")
milestone = kep.get("milestone", {})

if status == "implemented":
if latest_milestone == "unknown":
print(f'status: {status} stage: {stage} last-updated: {last_updated} file: {file_name}')
kep["latest-milestone"] = "0.0"
rewrite = True
if stage == "unknown":
if latest_milestone == "unknown":
kep["stage"] = "stable"
else:
kep["stage"] = [s for s,v in milestone.items() if v == latest_milestone][0]
rewrite = True

# Dump KEP to file_name
if rewrite:
print(f' writing {file_name}')
with open(file_name, "w") as fp:
yaml.dump(kep, fp)
fp.truncate()

def main(keps_dir, force_rewrite):
yaml = setup_yaml()
for f in glob.glob(f'{keps_dir}/**/kep.yaml', recursive=True):
if path.basename(f) not in EXCLUDED_FILES:
try:
print(f'processing file: {f}')
edit_kep(yaml, f, force_rewrite)
except Exception as e: # pylint: disable=broad-except
print(f'ERROR: could not edit {f}: {e}')

if __name__ == '__main__':
PARSER = argparse.ArgumentParser(
description='Does things to KEPs')
PARSER.add_argument(
'--keps-dir',
default='../keps',
help='Path to KEPs directoryProw Job Directory')
PARSER.add_argument(
'--force',
default=False,
help='Force rewrite of all KEPs')
ARGS = PARSER.parse_args()

main(ARGS.keps_dir, ARGS.force)

3 changes: 3 additions & 0 deletions keps/prod-readiness/sig-architecture/1143.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kep-number: 1143
stable:
approver: "@wojtek-t"
3 changes: 3 additions & 0 deletions keps/prod-readiness/sig-auth/2907.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kep-number: 2907
stable:
approver: "@johnbelamaric"
Comment on lines +1 to +3
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#3007 moved this to implemented but missed PRR files

I think this is out of tree so maybe not explicitly covered by PRR

3 changes: 3 additions & 0 deletions keps/prod-readiness/sig-cli/2206.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kep-number: 2206
beta:
approver: "@johnbelamaric"
Comment on lines +1 to +3
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#2758 is the PR that moved this KEP to beta

3 changes: 3 additions & 0 deletions keps/prod-readiness/sig-testing/2539.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kep-number: 2539
beta:
approver: "@johnbelamaric"
Comment on lines +1 to +3
Copy link
Member Author

@spiffxp spiffxp Oct 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can speak a bit more to this one since I'm on the KEP.

#2867 retroactively declared this beta since that's where this ultimately ended up during 1.21. This KEP was initially declared implementable at alpha, before PRR was required. The retroactive PR incorrectly called this "implemented" at beta, so it skipped PRR this cycle.

Given that this KEP is related to prow, and not to anything that is contained in a kubernetes release, I think this is pretty uncontroversial

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree but cc: @johnbelamaric just for viz

Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ replaces:
- n/a
superseded-by:
- n/a
latest-milestone: '0.0'
stage: stable
2 changes: 2 additions & 0 deletions keps/sig-api-machinery/1623-standardize-conditions/kep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ approvers:
- "@liggitt"
see-also:
replaces:
latest-milestone: '0.0'
stage: stable
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ status: implemented
see-also:
- "https://github.com/kubernetes/enhancements/pull/1002"
- "/keps/sig-api-machinery/20180415-crds-to-ga.md"
latest-milestone: '0.0'
stage: stable
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ see-also:
- "/keps/sig-api-machinery/20180415-crds-to-ga.md"
- "https://github.com/kubernetes/enhancements/pull/926"
- "https://github.com/kubernetes/enhancements/pull/709"
latest-milestone: '0.0'
stage: stable
2 changes: 2 additions & 0 deletions keps/sig-api-machinery/2337-k8s.io-group-protection/kep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ editor: "@deads2k"
creation-date: 2019-06-12
last-updated: 2019-07-03
status: implemented
latest-milestone: '0.0'
stage: stable
2 changes: 2 additions & 0 deletions keps/sig-api-machinery/492-admission-webhooks/kep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ last-updated: 2019-02-04
status: implemented
see-also:
- "[Admission Control Webhook Beta Design Doc](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/admission-control-webhooks.md)"
latest-milestone: '0.0'
stage: stable
2 changes: 2 additions & 0 deletions keps/sig-api-machinery/575-crd-defaulting/kep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ status: implemented
see-also:
- "/keps/sig-api-machinery/20180731-crd-pruning.md"
- "/keps/sig-api-machinery/20190425-structural-openapi.md"
latest-milestone: '0.0'
stage: stable
2 changes: 2 additions & 0 deletions keps/sig-api-machinery/576-dry-run/kep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ editor: apelisse
creation-date: 2018-06-21
last-updated: 2020-03-23
status: implemented
latest-milestone: '0.0'
stage: stable
2 changes: 2 additions & 0 deletions keps/sig-api-machinery/598-crd-conversion-webhook/kep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ last-updated: 2019-04-25
status: implemented
replaces:
- "(https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/customresource-conversion-webhook.md)"
latest-milestone: '0.0'
stage: stable
2 changes: 2 additions & 0 deletions keps/sig-api-machinery/956-watch-bookmark/kep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ replaces:
- n/a
superseded-by:
- n/a
latest-milestone: '0.0'
stage: stable
2 changes: 2 additions & 0 deletions keps/sig-architecture/0000-kep-process/kep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ editor: "@jbeda"
creation-date: 2017-08-22
last-updated: 2020-02-18
status: implemented
latest-milestone: '0.0'
stage: stable
2 changes: 2 additions & 0 deletions keps/sig-architecture/1194-prod-readiness/kep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ approvers:
creation-date: 2019-07-31
last-updated: 2020-12-15
status: implemented
latest-milestone: '0.0'
stage: stable
1 change: 1 addition & 0 deletions keps/sig-architecture/1635-prevent-permabeta/kep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ approvers:
- "@johnbelamaric"
see-also:
replaces:
stage: stable
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ stage: stable
feature-gates: []
disable-supported: false
metrics: []
latest-milestone: '0.0'
2 changes: 2 additions & 0 deletions keps/sig-auth/1513-certificate-signing-request/kep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ approvers:
creation-date: 2019-06-07
last-updated: 2020-09-14
status: implemented
latest-milestone: '0.0'
stage: stable
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ approvers:
creation-date: 2020-04-14
last-updated: 2021-01-06
status: implemented
latest-milestone: '0.0'
stage: stable
Comment on lines +19 to +20
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So like here's a concern of mine re: assuming everything is stable, for example: https://github.com/kubernetes/enhancements/tree/9b8db018f22e42db88148cdfe2768dfe4f87a477/keps/sig-auth/1687-hierarchical-namespaces-subproject

  • has no graduation criteria listed for stable
  • comments in the kep say it was marked as implementable so should this not be implemented?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I believe this one is implemented as it was a KEP to create a subproject that was created: #1687

It was out of tree and untracked, the subproject was created, so I think this is done and implemented.

Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ disable-supported: true
metrics:
- kubelet_certificate_manager_client_expiration_seconds
- kubelet_certificate_manager_client_expiration_renew_errors
stage: stable
2 changes: 2 additions & 0 deletions keps/sig-auth/279-limit-node-access/kep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ approvers:
creation-date: 2017-08-14
last-updated: 2020-05-01
status: implemented
latest-milestone: '0.0'
stage: stable
1 change: 1 addition & 0 deletions keps/sig-auth/2907-secrets-store-csi-driver/kep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ approvers:
- "@ritazh"
- "@mikedanese"
status: implemented
stage: stable
2 changes: 2 additions & 0 deletions keps/sig-auth/789-harden-default-discover-bindings/kep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ editor: TBD
creation-date: 2019-01-28
last-updated: 2019-01-31
status: implemented
latest-milestone: '0.0'
stage: stable
2 changes: 2 additions & 0 deletions keps/sig-autoscaling/117-hpa-metrics-specificity/kep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ editor: "@directxman12"
creation-date: 2018-04-19
last-updated: 2018-04-19
status: implemented
latest-milestone: '0.0'
stage: stable
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ creation-date: 2019-03-07
last-updated: 2020-01-29
status: implemented
superseded-by:
latest-milestone: '0.0'
stage: stable
2 changes: 1 addition & 1 deletion keps/sig-cli/2206-openapi-features-in-kustomize/kep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ approvers:
- "@pwittrock"
creation-date: 2020-12-21
last-updated: 2020-01-15
status: implemented
status: implementable
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is in response to #2758 (comment)

We have a KEP about leaving things at perma-beta, though maybe it only applies to kubernetes resources

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jrrickard wdyt? I tend to think implemented is the right choice given the past pr.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like there was an unanswered question in that PR, and the chair at the time was open to corrections down the line. I see how many other KEP's violate status: implemented => stage: stable, maybe this is a "rule" that doesn't actually exist.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The permabeta KEP is about served APIs - it implemented automatic disabling of apis that are beta for too many releases.

But the general principle applies beyond APIs - we really shouldn't be leaving stuff in a perma-beta state. If we mark this as implemented then it implies there is no more work to do, which isn't true. So I agree that this should be implementable.


latest-milestone: "1.22"
stage: "beta"
2 changes: 2 additions & 0 deletions keps/sig-cli/2377-Kustomize/kep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ replaces:
- kinflate # Old name for kustomize
superseded-by:
- "/keps/sig-cli/2386-kustomize-subcommand-integration/"
latest-milestone: '0.0'
stage: stable
2 changes: 2 additions & 0 deletions keps/sig-cli/2379-kubectl-plugins/kep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ replaces:
- "https://github.com/kubernetes/community/pull/481"
superseded-by:
- n/a
latest-milestone: '0.0'
stage: stable
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ see-also:
replaces:
superseded-by:
- n/a
latest-milestone: '0.0'
stage: stable
2 changes: 2 additions & 0 deletions keps/sig-cli/2386-kustomize-subcommand-integration/kep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ replaces:
- "0008-kustomize.md"
superseded-by:
- n/a
latest-milestone: '0.0'
stage: stable
2 changes: 2 additions & 0 deletions keps/sig-cli/491-kubectl-diff/kep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ status: implemented
see-also:
- "/keps/sig-api-machinery/0015-dry-run.md"
- "/keps/sig-api-machinery/0006-apply.md"
latest-milestone: '0.0'
stage: stable
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ status: implemented
see-also:
- "/keps/sig-cloud-provider/20190125-removing-in-tree-providers.md"
- "/keps/sig-cloud-provider/20180530-cloud-controller-manager.md"
latest-milestone: '0.0'
stage: stable
2 changes: 2 additions & 0 deletions keps/sig-cloud-provider/669-out-of-tree-openstack/kep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ editor: TBD
creation-date: 2019-01-25
last-updated: 2019-01-25
status: implemented
latest-milestone: '0.0'
stage: stable
2 changes: 2 additions & 0 deletions keps/sig-cloud-provider/670-out-of-tree-vsphere/kep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ editor: TBD
creation-date: 2019-01-25
last-updated: 2020-04-09
status: implemented
latest-milestone: '0.0'
stage: stable
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ creation-date: 2019-07-22
last-updated: 2021-01-26
status: implemented

latest-milestone: '0.0'
stage: stable
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ editor: "@timothysc"
creation-date: 2017-10-20
last-updated: 2018-01-23
status: implemented
latest-milestone: '0.0'
stage: stable
2 changes: 2 additions & 0 deletions keps/sig-contributor-experience/0000-community-forum/kep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ editor: TBD
creation-date: 2018-04-03
last-updated: 2018-04-17
status: implemented
latest-milestone: '0.0'
stage: stable
2 changes: 2 additions & 0 deletions keps/sig-contributor-experience/1553-issue-triage/kep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ approvers:
creation-date: 2020-02-15
see-also:
replaces:
latest-milestone: '0.0'
stage: stable
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ editor: TBD
creation-date: "2018-02-19"
last-updated: "2021-01-04"
status: implemented
latest-milestone: '0.0'
stage: stable
2 changes: 2 additions & 0 deletions keps/sig-instrumentation/1206-metrics-overhaul/kep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ editor: "@DirectXMan12"
creation-date: 2018-11-06
last-updated: 2019-03-21
status: implemented
latest-milestone: '0.0'
stage: stable
2 changes: 2 additions & 0 deletions keps/sig-network/1024-nodelocal-cache-dns/kep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ last-updated: 2020-09-23
status: implemented
see-also:
- "/keps/sig-network/0030-nodelocal-dns-cache.md"
latest-milestone: '0.0'
stage: stable
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ status: implemented
see-also:
replaces:
superseded-by:
latest-milestone: '0.0'
stage: stable
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ status: implemented
see-also:
replaces:
superseded-by:
latest-milestone: '0.0'
stage: stable
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ approvers:
- thockin
owning-sig: sig-network
status: implemented
latest-milestone: '0.0'
stage: stable
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ status: implemented
see-also:
replaces:
superseded-by:
latest-milestone: '0.0'
stage: stable
2 changes: 2 additions & 0 deletions keps/sig-network/265-ipvs-based-load-balancing/kep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ editor: "@thockin"
creation-date: 2018-03-21
last-updated: 2019-06-27
status: implemented
latest-milestone: '0.0'
stage: stable
2 changes: 2 additions & 0 deletions keps/sig-network/980-load-balancer-finalizers/kep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ status: implemented
see-also:
replaces:
superseded-by:
latest-milestone: '0.0'
stage: stable
2 changes: 2 additions & 0 deletions keps/sig-node/135-seccomp/kep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ approvers:
editor: "@saschagrunert"
creation-date: 2019-07-17
status: implemented
latest-milestone: '0.0'
stage: stable
Loading