-
Notifications
You must be signed in to change notification settings - Fork 595
wip: add ep for how we manage upstream feature gates in openshift #2084
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,217 @@ | ||
| --- | ||
| title: managing-upstream-feature-gates | ||
| authors: | ||
| - @everettraven | ||
| reviewers: # Include a comment about what domain expertise a reviewer is expected to bring and what area of the enhancement you expect them to focus on. For example: - "@networkguru, for networking aspects, please look at IP bootstrapping aspect" | ||
| - @JoelSpeed # API review background + architect | ||
| - @ScottDodson # architect | ||
| - @DevanGoodwin # architect | ||
| - @benluddy # control-plane group staff engineer for rebase concerns/considerations | ||
| - @albertolamela # HCP considerations + architect | ||
| approvers: # This should be a single approver. The role of the approver is to raise important questions, ensure the enhancement receives reviews from all applicable areas/SMEs, and determine when consensus is achieved such that the EP can move forward to implementation. Having multiple approvers makes it difficult to determine who is responsible for the actual approval. Team leads and staff engineers often make good approvers. | ||
| - @JoelSpeed | ||
| api-approvers: # In case of new or modified APIs or API extensions (CRDs, aggregated apiservers, webhooks, finalizers). If there is no API change, use "None". Once your EP is published, ask in #forum-api-review to be assigned an API approver. | ||
| - N/A | ||
| creation-date: 2026-08-19 | ||
| last-updated: 2026-08-19 | ||
| status: provisional|implementable|implemented|deferred|rejected|withdrawn|replaced|informational | ||
| tracking-link: # link to the tracking ticket (for example: Jira Feature or Epic ticket) that corresponds to this enhancement | ||
| - TBD | ||
| --- | ||
|
|
||
| # Managing Upstream Feature Gates | ||
|
|
||
| ## Summary | ||
|
|
||
| This enhancement is focused on reaching consensus on OpenShift's policy on | ||
| how we track and enable upstream feature gates on OpenShift. This includes, but is | ||
| not limited to: | ||
| - When upstream features should be enabled and what OpenShift featureset they should be enabled in. | ||
| - Testing to be implemented to enforce correct enablement/api-serving requirements. | ||
|
|
||
| ## Motivation | ||
|
|
||
| Historically in OpenShift, we have not closely tracked the state of upstream Kubernetes feature gates and | ||
| enforced when they should or should not be enabled within OpenShift. Instead, this has been on a case-by-case | ||
| basis in which teams wanting to enable alpha/beta upstream features early would undergo the process of creating an OpenShift equivalent | ||
| feature gate to enable in a given OpenShift feature set and plumbing everything through correctly. | ||
|
|
||
| More recently, we've identified that not having a policy around upstream feature gate enablement state on OpenShift | ||
| results in it being practically impossible for teams building products/integrations (or customers interested in early testing) | ||
| to enable a featureset on OpenShift, like TechPreviewNoUpgrade, to test the functionality. This also means that we are not | ||
| getting any meaningful signal as to the impact that a feature might have on OpenShift until the feature becomes enabled-by-default | ||
| upstream. | ||
|
|
||
| The primary motivation of this enhancement is to close this gap. | ||
|
|
||
| ### User Stories | ||
|
|
||
| 1. As a member of OpenShift concerned with product quality, I want to enable upstream features that are not enabled-by-default to ensure we are getting CI signals as to the impact a feature may have on the platform. | ||
|
|
||
| 2. As a member of OpenShift working on a feature/product/etc., I want upstream features that are not enabled-by-default and enabled-by-default but in beta to be enabled in the DevPreviewNoUpgrade and TechPreviewNoUpgrade feature sets so that I can test integrations with that feature before it goes GA in upstream. | ||
|
|
||
| 3. As a user of OpenShift interested in trying out new upstream Kubernetes features, I want to be able to enable upstream features that are not enabled-by-default and in beta so that I can test new Kubernetes functionality and plan how I may be able to use it in a production environment when it is stable. | ||
|
|
||
| ### Goals | ||
|
|
||
| - Define an explicit policy for when upstream features are enabled in which OpenShift feature sets. | ||
| - Define automated payload testing requirements that enforce the agreed upon policy for upstream gate enablement. | ||
| - Understand and identify mitigations to CI stability impacts of enabling upstream features that are not enabled by default. | ||
|
|
||
| ### Non-Goals | ||
|
|
||
| - TBD | ||
|
|
||
| ## Proposal | ||
|
|
||
| This EP proposes the following: | ||
| - A concrete policy and tooling for how OpenShift feature-gates are created and the featuresets they are included in (defined in openshift/api). | ||
| - End-to-end testing for determining which group-version-resources should be served by default and which features should be enabled by default. This testing would be performed on both OpenShift and HyperShift. | ||
|
|
||
| ### Upstream Feature Gate Enablement Policy | ||
|
|
||
| This section covers what OpenShift feature set upstream feature gates will be enabled in based on their level of maturity. | ||
|
|
||
| #### DevPreviewNoUpgrade Feature Set | ||
|
|
||
| All upstream feature gates are enabled in the DevPreviewNoUpgrade feature set. | ||
|
Comment on lines
+75
to
+77
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -eu
file="enhancements/release/managing-upstream-featuregates.md"
echo "== file outline =="
ast-grep outline "$file" 2>/dev/null || true
echo "== lines 1-180 =="
sed -n '1,180p' "$file"
echo "== relevant identifiers and policy terms =="
rg -n -i 'DevPreviewNoUpgrade|upstream|denylist|allowlist|security|NodeLogQuery|feature gate|featuregate' "$file" enhancements | head -200
echo "== referenced upstream source, if network access is available =="
url="https://raw.githubusercontent.com/kubernetes/kubernetes/2220c3853a2402ffc0502995c49b383f84ae8ceb/pkg/features/kube_features.go"
curl -L --fail --silent --show-error "$url" | rg -n -C 5 'NodeLogQuery|security|enable' | head -120 || trueRepository: openshift/enhancements Length of output: 50378 🏁 Script executed: #!/bin/bash
set -eu
url="https://raw.githubusercontent.com/kubernetes/kubernetes/2220c3853a2402ffc0502995c49b383f84ae8ceb/pkg/features/kube_features.go"
echo "== NodeLogQuery declaration and comments =="
curl -L --fail --silent --show-error "$url" |
rg -n -C 12 'NodeLogQuery' | head -80
echo "== security-related comments in the referenced source =="
curl -L --fail --silent --show-error "$url" |
rg -n -i -C 3 'security implication|security implications|security warning|need-based|only enable|enable.*security|security' |
head -160
echo "== exact referenced source lines 3012-3025 =="
curl -L --fail --silent --show-error "$url" |
nl -ba | sed -n '3012,3025p'Repository: openshift/enhancements Length of output: 4380 Define exclusions for upstream feature gates with security warnings.
🤖 Prompt for AI Agents |
||
|
|
||
| #### TechPreviewNoUpgrade Feature Set | ||
|
|
||
| All upstream feature gates that are enabled-by-default, regardless of maturity, will be enabled in the TechPreviewNoUpgrade feature set. | ||
|
|
||
| All upstream feature gates that are beta, but not enabled-by-default, will be enabled in the TechPreviewNoUpgrade feature set. | ||
|
|
||
| #### Default Feature Set | ||
|
|
||
| All upstream feature gates that are marked as GA will be enabled in the Default feature set. | ||
|
Comment on lines
+85
to
+87
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift Do not use upstream GA as the only OpenShift graduation signal. Existing 🤖 Prompt for AI Agents |
||
|
|
||
| ### Repository Changes | ||
|
|
||
| #### openshift/api | ||
|
|
||
| In order to facilitate automating this process as much as possible, openshift/api will have new tooling | ||
| introduced to help generate the set of upstream feature gate definitions. | ||
|
|
||
| It will utilize upstream libraries to identify feature gate maturity state based on the current k8s library version being imported. | ||
| More specifically, it will use `k8s.io/apiserver/pkg/util/feature.DefaultMutableFeatureGate` and a blank import of `k8s.io/pkg/features` to trigger [this `init` function](https://github.com/kubernetes/kubernetes/blob/2220c3853a2402ffc0502995c49b383f84ae8ceb/pkg/features/kube_features.go#L3012-L3025) | ||
|
Comment on lines
+96
to
+97
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n 'k8s\.io/(pkg/features|kubernetes/pkg/features)|DefaultMutableFeatureGate' \
enhancements/release/managing-upstream-featuregates.md
fd -H '^go\.mod$' -x rg -n \
'k8s\.io/(kubernetes|apiserver)' {}Repository: openshift/enhancements Length of output: 464 🏁 Script executed: #!/bin/bash
set -euo pipefail
python3 - <<'PY'
from urllib.request import urlopen
base = "https://raw.githubusercontent.com/kubernetes/kubernetes/2220c3853a2402ffc0502995c49b383f84ae8ceb/"
for path in ("go.mod", "pkg/features/kube_features.go", "staging/src/k8s.io/apiserver/pkg/util/feature gates.go"):
url = base + path
print(f"\n--- {path} ---")
try:
text = urlopen(url, timeout=20).read().decode()
except Exception as exc:
print(f"ERROR: {exc}")
continue
lines = text.splitlines()
if path == "go.mod":
for line in lines[:12]:
print(line)
elif path.endswith("kube_features.go"):
for i, line in enumerate(lines, 1):
if 1 <= i <= 8 or 3005 <= i <= 3030:
print(f"{i}: {line}")
else:
for i, line in enumerate(lines, 1):
if "DefaultMutableFeatureGate" in line or "type FeatureGate" in line:
print(f"{i}: {line}")
print("\n--- repository references and module files ---")
PY
git ls-files | rg '(^|/)(go\.mod|managing-upstream-featuregates\.md)$' || true
rg -n 'k8s\.io/(pkg/features|kubernetes/pkg/features|apiserver/pkg/util/feature)|DefaultMutableFeatureGate' \
enhancements/release/managing-upstream-featuregates.md . --glob '!enhancements/release/managing-upstream-featuregates.md' \
|| trueRepository: openshift/enhancements Length of output: 1225 🏁 Script executed: #!/bin/bash
set -euo pipefail
fetch() {
curl -fsSLk --retry 2 "$1"
}
echo '--- upstream go.mod ---'
fetch 'https://raw.githubusercontent.com/kubernetes/kubernetes/2220c3853a2402ffc0502995c49b383f84ae8ceb/go.mod' \
| sed -n '1,12p'
echo '--- upstream kube_features.go ---'
fetch 'https://raw.githubusercontent.com/kubernetes/kubernetes/2220c3853a2402ffc0502995c49b383f84ae8ceb/pkg/features/kube_features.go' \
| nl -ba | sed -n '1,12p;3005,3032p'
echo '--- upstream feature package references ---'
fetch 'https://raw.githubusercontent.com/kubernetes/kubernetes/2220c3853a2402ffc0502995c49b383f84ae8ceb/pkg/features/kube_features.go' \
| rg -n 'utilfeature|DefaultMutableFeatureGate|func init|AddVersioned|DefaultFeatureGate' || true
echo '--- repository tools/go.mod ---'
cat -n tools/go.mod | sed -n '1,180p'
echo '--- repository dependency references ---'
rg -n 'k8s\.io/(kubernetes|apiserver)|pkg/features|DefaultMutableFeatureGate' . \
--glob '!enhancements/release/managing-upstream-featuregates.md' || trueRepository: openshift/enhancements Length of output: 728 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '--- upstream kube_features.go excerpt ---'
curl -fsSLk --retry 2 \
'https://raw.githubusercontent.com/kubernetes/kubernetes/2220c3853a2402ffc0502995c49b383f84ae8ceb/pkg/features/kube_features.go' \
| awk 'NR <= 12 || (NR >= 3005 && NR <= 3032) { print NR ": " $0 }'
echo '--- upstream feature-gate registrations ---'
curl -fsSLk --retry 2 \
'https://raw.githubusercontent.com/kubernetes/kubernetes/2220c3853a2402ffc0502995c49b383f84ae8ceb/pkg/features/kube_features.go' \
| grep -nE 'utilfeature|DefaultMutableFeatureGate|func init|AddVersioned|DefaultFeatureGate' || true
echo '--- repository tools/go.mod ---'
sed -n '1,180p' tools/go.mod
echo '--- repository dependency references ---'
rg -n 'k8s\.io/(kubernetes|apiserver)|pkg/features|DefaultMutableFeatureGate' . \
--glob '!enhancements/release/managing-upstream-featuregates.md' || trueRepository: openshift/enhancements Length of output: 7403 Declare the Kubernetes dependencies for the generator. Use 🤖 Prompt for AI Agents
Comment on lines
+96
to
+97
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This means that the gates will change at rebase time. Does this possibly introduce some risk/toil for the group handling the kube rebase if there's a need to align the feature directly to when the o/k rebase lands? Having a way to opt-out of the automatic gate definition would be helpful to allow us to land back at the o/k base definition. We have already discussed this sync, but wanted to add some context to the EP too |
||
|
|
||
| Additionally, feature gate definitions will be updated to allow specifying the group-resource(s) associated with a feature-gate. | ||
| This will allow openshift/api to maintain a library implementation that, given a set of enabled feature gates, will return the appropriate | ||
| API group-version-resource pairings to be enabled on the kube-apiserver via the `--runtime-config` flag. | ||
|
|
||
| Proof-of-Concept PR: https://github.com/openshift/api/pull/2994 | ||
|
|
||
| #### openshift/cluster-kube-apiserver-operator | ||
|
|
||
| Instead of maintaining a [static list of feature-gate name -> group-version pairing](https://github.com/openshift/cluster-kube-apiserver-operator/blob/9c413cd4dc8c3876cc40ee85c207bf9b143f106f/pkg/operator/configobservation/apienablement/observe_runtime_config.go#L18-L32), this operator will be updated to utilize the new openshift/api owned library. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the intention for this to be configured at runtime by the FeatureGate manifest in cluster? |
||
|
|
||
| #### openshift/hypershift | ||
|
|
||
| Instead of [maintaining a hardcoded set of conditionals](https://github.com/openshift/hypershift/blob/458c251a004eaa43c12aa03b163cbd7dcea9646e/control-plane-operator/controllers/hostedcontrolplane/v2/kas/config.go#L240-L254), the hostedcontrolplane controller will be updated to utilize the new openshift/api owned library. | ||
|
Comment on lines
+93
to
+111
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -eu
file="$(fd -t f -g 'managing-upstream-featuregates.md' . | head -n 1)"
printf '%s\n' "FILE=$file"
wc -l "$file"
printf '%s\n' '--- outline-like headings ---'
rg -n '^#{1,6} ' "$file"
printf '%s\n' '--- cited section ---'
sed -n '80,120p' "$file"
printf '%s\n' '--- generation/merge/integration terms ---'
rg -n -i -C 3 'generat|merge|append|replace|override|preserv|drift|update|static|conditional|runtime-config|OpenShift-only|upstream' "$file"Repository: openshift/enhancements Length of output: 11455 🏁 Script executed: #!/bin/bash
set -eu
file="enhancements/release/managing-upstream-featuregates.md"
printf '%s\n' '--- remaining proposal ---'
sed -n '116,215p' "$file"
printf '%s\n' '--- related feature-gate files and generators ---'
git ls-files | rg -i 'feature.?gate|featureset|generator|generated'
printf '%s\n' '--- merge and drift language in enhancement documents ---'
rg -n -i -C 2 'generated.*(manual|hand|source)|manual.*generated|drift check|drift|make update|append|override|preserve.*(entry|mapping)' enhancements | head -n 240Repository: openshift/enhancements Length of output: 27822 Define the generated/manual merge boundary. The proposal does not define how generated upstream definitions combine with manually maintained OpenShift definitions. Specify append, replace, and override rules. Preserve OpenShift-only mappings and add a drift check for 🤖 Prompt for AI Agents |
||
|
|
||
| #### openshift/origin | ||
|
|
||
| In order to ensure that we don't accidentally serve the beta versions of APIs for enabled feature gates, a new test will be added to the openshift conformance suite that uses the openshift/api owned | ||
| library to validate that we are only serving the `v1` (or greater) version of the group-resource associated with a gate that has been included in the Default feature set. | ||
|
Comment on lines
+115
to
+116
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Worth linking the existing test in KASO that achieves similar as a unit test? |
||
|
|
||
| ### Workflow Description | ||
|
|
||
| #### Kube Rebase | ||
|
|
||
| 1. Update openshift/api tooling k8s package versions. | ||
| 2. Run `make update` to run generators, including new upstream feature-gate generator. | ||
| 3. For feature-gates that require APIs to be enabled, add the appropriate group-resource(s) to the gate definition. | ||
| 4. Create and merge PR with changes. | ||
| 5. Update openshift/origin dependency on openshift/api | ||
| 6. Update openshift/cluster-kube-apiserver-operator and openshift/hypershift dependency on openshift/api. | ||
|
|
||
| ### API Extensions | ||
|
|
||
| N/A | ||
|
|
||
| ### Topology Considerations | ||
|
|
||
| #### Hypershift / Hosted Control Planes | ||
|
|
||
| N/A | ||
|
|
||
| #### Standalone Clusters | ||
|
|
||
| N/A | ||
|
|
||
| #### Single-node Deployments or MicroShift | ||
|
|
||
| N/A | ||
|
|
||
| #### OpenShift Kubernetes Engine | ||
|
|
||
| N/A | ||
|
Comment on lines
+133
to
+149
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift Document the supported topology behavior. The proposal requires implementation and testing in HyperShift, but all topology subsections are 🤖 Prompt for AI Agents |
||
|
|
||
| ### Implementation Details/Notes/Constraints | ||
|
|
||
| What are some important details that didn't come across above in the | ||
| **Proposal**? Go in to as much detail as necessary here. This might be | ||
| a good place to talk about core concepts and how they relate. While it is useful | ||
| to go into the details of the code changes required, it is not necessary to show | ||
| how the code will be rewritten in the enhancement. | ||
|
|
||
| ### Risks and Mitigations | ||
|
|
||
| What are the risks of this proposal and how do we mitigate. Think broadly. For | ||
| example, consider both security and how this will impact the larger OKD | ||
| ecosystem. | ||
|
|
||
| How will security be reviewed and by whom? | ||
|
|
||
| How will UX be reviewed and by whom? | ||
|
|
||
| Consider including folks that also work outside your immediate sub-project. | ||
|
Comment on lines
+159
to
+169
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift Complete the risk and ownership analysis. This policy changes feature-gate and API exposure, but the Risks and Mitigations section contains only template text. Document CI stability risks, security review owners, UX review owners, rollback controls, and customer impact before implementation. 🤖 Prompt for AI Agents |
||
|
|
||
| ### Drawbacks | ||
|
|
||
| TBD | ||
|
|
||
| ## Alternatives (Not Implemented) | ||
|
|
||
| TBD | ||
|
|
||
| ## Open Questions [optional] | ||
|
|
||
| TBD | ||
|
|
||
| ## Test Plan | ||
|
|
||
| N/A | ||
|
|
||
| ## Graduation Criteria | ||
|
|
||
| N/A | ||
|
|
||
| ### Dev Preview -> Tech Preview | ||
|
|
||
| N/A | ||
|
|
||
| ### Tech Preview -> GA | ||
|
|
||
| N/A | ||
|
Comment on lines
+183
to
+197
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift Replace the test and graduation placeholders with an executable plan. The goals require automated payload enforcement, but 🤖 Prompt for AI Agents |
||
|
|
||
| ### Removing a deprecated feature | ||
|
|
||
| N/A | ||
|
|
||
| ## Upgrade / Downgrade Strategy | ||
|
|
||
| N/A | ||
|
|
||
| ## Version Skew Strategy | ||
|
|
||
| N/A | ||
|
|
||
| ## Operational Aspects of API Extensions | ||
|
|
||
| N/A | ||
|
|
||
| ## Support Procedures | ||
|
|
||
| N/A | ||
|
Comment on lines
+203
to
+217
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -eu
file=$(git ls-files | awk '$0=="enhancements/release/managing-upstream-featuregates.md"{print; exit}')
test -n "$file"
printf '%s\n' "=== file size ==="
wc -l "$file"
printf '%s\n' "=== document outline ==="
ast-grep outline "$file" || true
printf '%s\n' "=== lifecycle and rebase references ==="
rg -n -C 4 'Upgrade|Downgrade|Version Skew|Support Procedures|Operational Aspects|rebase|Rebase|removed|renamed|locked|lock|feature.?set|unknown|rollback|serving|gate' "$file"
printf '%s\n' "=== lines 1-216 ==="
cat -n "$file"
printf '%s\n' "=== referenced upstream commit availability ==="
if command -v curl >/dev/null 2>&1; then
curl -L --fail --silent --show-error \
'https://raw.githubusercontent.com/kubernetes/kubernetes/2220c3853a2402ffc0502995c49b383f84ae8ceb/pkg/features/kube_features.go' |
rg -n -C 3 'LockToDefault|lock|removed|Remove|Deprecated|FeatureGate|feature gate' | head -n 180
else
printf '%s\n' "curl unavailable"
fiRepository: openshift/enhancements Length of output: 29432 🏁 Script executed: #!/bin/bash
set -eu
tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' EXIT
curl -L --fail --silent --show-error \
'https://raw.githubusercontent.com/kubernetes/kubernetes/2220c3853a2402ffc0502995c49b383f84ae8ceb/pkg/features/kube_features.go' \
-o "$tmp/kube_features.go"
curl -L --fail --silent --show-error \
'https://raw.githubusercontent.com/kubernetes/kubernetes/2220c3853a2402ffc0502995c49b383f84ae8ceb/staging/src/component-base/featuregate/feature_gate.go' \
-o "$tmp/feature_gate.go"
python3 - "$tmp/kube_features.go" "$tmp/feature_gate.go" <<'PY'
import re
import sys
from pathlib import Path
kube = Path(sys.argv[1]).read_text()
gate = Path(sys.argv[2]).read_text()
print("=== upstream lifecycle metadata ===")
for needle in (
"features may only be removed 3 releases after graduation",
"LockToDefault",
"remove in 1.36",
"remove in 1.39",
):
print(f"{needle!r}: {needle in kube}")
print("=== representative versioned gate entries ===")
for name in ("CPUManagerPolicyOptions", "CSIServiceAccountTokenSecrets"):
match = re.search(
rf"(?ms)^\s*{name}: \{{.*?^\s*\}},",
kube,
)
print(match.group(0).strip() if match else f"{name}: NOT FOUND")
print("=== feature-gate validation paths ===")
for pattern in (
r"unknown feature gate",
r"UnknownFeature",
r"LockToDefault",
r"Validate",
r"KnownFeatures",
):
hits = [m.start() for m in re.finditer(pattern, gate, re.IGNORECASE)]
print(f"{pattern!r}: {len(hits)} hit(s)")
for pos in hits[:3]:
line = gate.count("\n", 0, pos) + 1
print(f" line {line}: {gate.splitlines()[line-1].strip()}")
print("=== source line ranges ===")
for path, patterns in (
(sys.argv[1], ("features may only be removed", "LockToDefault", "remove in")),
(sys.argv[2], ("unknown feature gate", "UnknownFeature", "LockToDefault")),
):
lines = Path(path).read_text().splitlines()
wanted = []
for i, line in enumerate(lines):
if any(p.lower() in line.lower() for p in patterns):
wanted.extend(range(max(1, i+1-2), min(len(lines), i+1+2)+1))
for i in sorted(set(wanted)):
print(f"{Path(path).name}:{i}:{lines[i-1]}")
PYRepository: openshift/enhancements Length of output: 211 🏁 Script executed: #!/bin/bash
set -eu
sha=2220c3853a2402ffc0502995c49b383f84ae8ceb
curl -L --fail --silent --show-error \
"https://api.github.com/repos/kubernetes/kubernetes/git/trees/${sha}?recursive=1" |
jq -r '.tree[] | select(.path | test("feature.?gate.*\\.go$|featuregate.*\\.go$"; "i")) | .path' |
head -n 80Repository: openshift/enhancements Length of output: 736 🏁 Script executed: #!/bin/bash
set -eu
tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' EXIT
base='https://raw.githubusercontent.com/kubernetes/kubernetes/2220c3853a2402ffc0502995c49b383f84ae8ceb'
for path in \
staging/src/k8s.io/component-base/featuregate/feature_gate.go \
test/compatibility_lifecycle/cmd/feature_gates.go \
pkg/features/kube_features.go
do
curl -L --fail --silent --show-error "$base/$path" -o "$tmp/$(basename "$path")"
done
python3 - "$tmp/feature_gate.go" "$tmp/feature_gates.go" "$tmp/kube_features.go" <<'PY'
import re
import sys
from pathlib import Path
feature_gate, lifecycle, kube_features = [Path(p).read_text() for p in sys.argv[1:]]
def show_matches(label, text, patterns, context=2):
print(f"=== {label} ===")
lines = text.splitlines()
selected = set()
for i, line in enumerate(lines):
if any(re.search(p, line, re.I) for p in patterns):
selected.update(range(max(0, i-context), min(len(lines), i+context+1)))
for i in sorted(selected):
print(f"{i+1}: {lines[i]}")
show_matches(
"feature-gate implementation",
feature_gate,
[r"unknown feature", r"UnknownFeature", r"LockToDefault", r"Validate", r"KnownFeatures"],
)
show_matches(
"compatibility lifecycle tooling",
lifecycle,
[r"removed", r"lock", r"unknown", r"version", r"feature.?gate", r"skew"],
)
show_matches(
"upstream feature metadata",
kube_features,
[r"features may only be removed", r"LockToDefault", r"remove in"],
)
print("=== deterministic source checks ===")
checks = {
"feature implementation validates known feature names": bool(
re.search(r"(?i)unknown feature|UnknownFeature|KnownFeatures", feature_gate)
),
"feature implementation contains lock semantics": "LockToDefault" in feature_gate,
"compatibility tooling tracks removals or locks": bool(
re.search(r"(?i)removed|remove|lock", lifecycle)
),
"upstream metadata contains removal schedule": bool(
re.search(r"(?i)remove in", kube_features)
),
}
for key, value in checks.items():
print(f"{key}: {value}")
PYRepository: openshift/enhancements Length of output: 38766 Define the feature-gate lifecycle contract. The proposal changes generated feature-gate definitions and 🤖 Prompt for AI Agents |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Replace the status placeholder.
status: provisional|...is a template value, not the status of this enhancement. Set the actual status before publication. Useprovisionalif this draft is the intended state.🤖 Prompt for AI Agents