-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Automated feature gates docs using genfeaturegates utility
#53516
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: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Saurabh Kumar Singh <[email protected]>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
genfeaturegates utility in K/Kgenfeaturegates utility for automated feature gates docs
✅ Pull request preview available for checkingBuilt without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
Signed-off-by: Saurabh Kumar Singh <[email protected]>
genfeaturegates utility for automated feature gates docsgenfeaturegates utility
| 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" |
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.
nit: would be good to warn people running the script that there will be a feature gate with details missing.
lmktfy
left a comment
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.
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) == "---" { |
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.
nit: we should not allow leading whitespace
| scanner := bufio.NewScanner(strings.NewReader(content)) | ||
|
|
||
| // Find first --- | ||
| if !scanner.Scan() || strings.TrimSpace(scanner.Text()) != "---" { |
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.
nit: we should not allow leading whitespace
| 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 |
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.
nit: ideally, write these lines to stderr:
| 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}" |
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.
(nit)
| echo "Error: JSON file not found: ${JSON_FILE}" | |
| echo "Error: JSON file not found: ${JSON_FILE}" >&2 |
| // 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. |
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.
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.
Description
Automate Feature Gates Documentation
Integrates
genfeaturegatesutility 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