Skip to content

Conversation

@singh1203
Copy link

@singh1203 singh1203 commented Dec 5, 2025

Description

Automate Feature Gates Documentation

Integrates genfeaturegates utility from kubernetes/kubernetes#135510 to replace manual gist.

Implements Idea 7 from #52376 for automated validation against upstream Kubernetes.

/kind documentation
/sig docs
/priority important-longterm

Issue

Closes: #50992

@k8s-ci-robot k8s-ci-robot added kind/documentation Categorizes issue or PR as related to documentation. sig/docs Categorizes an issue or PR as relevant to SIG Docs. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. area/release-eng Issues or PRs related to the Release Engineering subproject labels Dec 5, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign nate-double-u for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added sig/release Categorizes an issue or PR as relevant to SIG Release. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 5, 2025
@singh1203 singh1203 changed the title add: scripts to use genfeaturegates utility in K/K Use genfeaturegates utility for automated feature gates docs Dec 5, 2025
@netlify
Copy link

netlify bot commented Dec 5, 2025

Pull request preview available for checking

Built without sensitive environment variables

Name Link
🔨 Latest commit cacff86
🔍 Latest deploy log https://app.netlify.com/projects/kubernetes-io-main-staging/deploys/69347404a32cbc0008ec1025
😎 Deploy Preview https://deploy-preview-53516--kubernetes-io-main-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@singh1203
Copy link
Author

singh1203 commented Dec 7, 2025

@singh1203 singh1203 changed the title Use genfeaturegates utility for automated feature gates docs Automated feature gates docs using genfeaturegates utility Dec 8, 2025
existingContent, err := os.ReadFile(path)
if os.IsNotExist(err) {
// Create new file with TODO placeholder
content := newFrontMatter + "---\n<!-- TODO: Add description for " + fg.Name + " feature gate -->\n"
Copy link
Member

Choose a reason for hiding this comment

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

nit: would be good to warn people running the script that there will be a feature gate with details missing.

Copy link
Member

@lmktfy lmktfy left a comment

Choose a reason for hiding this comment

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

I have some feedback, but if we can show that this works, we should merge it.

I had a quick look but I didn't find the time to get it to run enough to show that it does work.

foundEnd := false
for scanner.Scan() {
line := scanner.Text()
if strings.TrimSpace(line) == "---" {
Copy link
Member

Choose a reason for hiding this comment

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

nit: we should not allow leading whitespace

scanner := bufio.NewScanner(strings.NewReader(content))

// Find first ---
if !scanner.Scan() || strings.TrimSpace(scanner.Text()) != "---" {
Copy link
Member

Choose a reason for hiding this comment

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

nit: we should not allow leading whitespace

Comment on lines +32 to +38
echo "Usage: $0 <feature-gates.json>"
echo ""
echo "Updates feature gate markdown files from JSON data."
echo ""
echo "To generate the JSON file, run from the kubernetes repo:"
echo " go run ./cmd/genfeaturegates -format=json -output=/tmp/feature-gates.json"
exit 1
Copy link
Member

Choose a reason for hiding this comment

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

nit: ideally, write these lines to stderr:

Suggested change
echo "Usage: $0 <feature-gates.json>"
echo ""
echo "Updates feature gate markdown files from JSON data."
echo ""
echo "To generate the JSON file, run from the kubernetes repo:"
echo " go run ./cmd/genfeaturegates -format=json -output=/tmp/feature-gates.json"
exit 1
echo "Usage: $0 <feature-gates.json>" >&2
echo "" >&2
echo "Updates feature gate markdown files from JSON data." >&2
echo "" >&2
echo "To generate the JSON file, run from the kubernetes repo:" >&2
echo " go run ./cmd/genfeaturegates -format=json -output=/tmp/feature-gates.json" >&2

JSON_FILE="$1"

if [[ ! -f "${JSON_FILE}" ]]; then
echo "Error: JSON file not found: ${JSON_FILE}"
Copy link
Member

Choose a reason for hiding this comment

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

(nit)

Suggested change
echo "Error: JSON file not found: ${JSON_FILE}"
echo "Error: JSON file not found: ${JSON_FILE}" >&2

Comment on lines +17 to +19
// update-feature-gates reads feature gate data from a JSON file (generated by
// genfeaturegates in kubernetes/kubernetes) and updates the corresponding
// markdown files in the website repository.
Copy link
Member

Choose a reason for hiding this comment

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

I wonder why it doesn't parse test/compatibility_lifecycle/reference/versioned_feature_list.yaml (which already exists in k/k, and is machine readable).

If not that specific file, loading and parsing another YAML file still feels like the way I'd go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/release-eng Issues or PRs related to the Release Engineering subproject cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/documentation Categorizes issue or PR as related to documentation. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. sig/docs Categorizes an issue or PR as relevant to SIG Docs. sig/release Categorizes an issue or PR as relevant to SIG Release. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Programatically sync feature gate status from k/k to documentation

3 participants