Skip to content

Commit f2bbb23

Browse files
committed
Automatically synchronize FGs and documentation FGs list
1 parent cc40ec1 commit f2bbb23

File tree

9 files changed

+691
-95
lines changed

9 files changed

+691
-95
lines changed

CONTRIBUTING.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,21 @@ If your repo has certain guidelines for contribution, put them here ahead of the
2525

2626
- [Slack](https://kubernetes.slack.com/messages/sig-scheduling)
2727
- [Mailing List](https://groups.google.com/forum/#!forum/kubernetes-sig-scheduling)
28+
29+
## Feature gate documentation workflow
30+
31+
Kueue treats `pkg/features/kube_features.go` as the source of truth for every feature gate. After you change that file, run:
32+
33+
```shell
34+
make featuregates-update
35+
```
36+
37+
This command uses Kubernetes' `compatibility_lifecycle` tool to regenerate `test/compatibility_lifecycle/reference/versioned_feature_list.yaml` and copies the result to `site/data/featuregates/versioned_feature_list.yaml`. The docs under `site/content/*/docs/installation/_index.md` consume that YAML through the `feature-gates-table` shortcode, so no manual table edits are required.
38+
39+
CI enforces that the YAML and documentation stay in sync. You can run the same check locally with:
40+
41+
```shell
42+
make featuregates-verify
43+
```
44+
45+
or simply rely on `make verify`, which now calls the verification target automatically.

Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,16 @@ toc-update: mdtoc
183183
toc-verify: mdtoc
184184
./hack/verify-toc.sh
185185

186+
##@ Documentation
187+
188+
.PHONY: featuregates-update
189+
featuregates-update: ## Regenerate feature-gate YAML and site data.
190+
$(PROJECT_DIR)/hack/update-featuregates.sh
191+
192+
.PHONY: featuregates-verify
193+
featuregates-verify: ## Ensure feature-gate YAML and docs are in sync.
194+
$(PROJECT_DIR)/hack/verify-featuregates.sh
195+
186196
.PHONY: helm-lint
187197
helm-lint: helm ## Run Helm chart lint test.
188198
${HELM} lint charts/kueue
@@ -262,7 +272,7 @@ sync-hugo-version:
262272

263273
PATHS_TO_VERIFY := config/components apis charts/kueue client-go site/ netlify.toml
264274
.PHONY: verify
265-
verify: gomod-verify ci-lint lint-api fmt-verify shell-lint toc-verify manifests generate update-helm helm-verify helm-unit-test prepare-release-branch sync-hugo-version npm-depcheck
275+
verify: gomod-verify ci-lint lint-api fmt-verify shell-lint toc-verify featuregates-verify manifests generate update-helm helm-verify helm-unit-test prepare-release-branch sync-hugo-version npm-depcheck
266276
git --no-pager diff --exit-code $(PATHS_TO_VERIFY)
267277
if git ls-files --exclude-standard --others $(PATHS_TO_VERIFY) | grep -q . ; then exit 1; fi
268278

hack/update-featuregates.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright 2024 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -o errexit
18+
set -o nounset
19+
set -o pipefail
20+
21+
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
22+
MOD_FILE="${REPO_ROOT}/hack/tools/go.mod"
23+
K8S_TOOL_PKG="k8s.io/kubernetes/test/compatibility_lifecycle"
24+
REFERENCE_DIR="${REPO_ROOT}/test/compatibility_lifecycle/reference"
25+
REFERENCE_FILE="${REFERENCE_DIR}/versioned_feature_list.yaml"
26+
SITE_DATA_DIR="${REPO_ROOT}/site/data/featuregates"
27+
SITE_DATA_FILE="${SITE_DATA_DIR}/versioned_feature_list.yaml"
28+
29+
mkdir -p "${REFERENCE_DIR}"
30+
mkdir -p "${SITE_DATA_DIR}"
31+
32+
go run -mod=mod -modfile="${MOD_FILE}" "${K8S_TOOL_PKG}" feature-gates update
33+
34+
cp "${REFERENCE_FILE}" "${SITE_DATA_FILE}"
35+

hack/verify-featuregates.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright 2024 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -o errexit
18+
set -o nounset
19+
set -o pipefail
20+
21+
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
22+
MOD_FILE="${REPO_ROOT}/hack/tools/go.mod"
23+
K8S_TOOL_PKG="k8s.io/kubernetes/test/compatibility_lifecycle"
24+
REFERENCE_FILE="${REPO_ROOT}/test/compatibility_lifecycle/reference/versioned_feature_list.yaml"
25+
SITE_DATA_FILE="${REPO_ROOT}/site/data/featuregates/versioned_feature_list.yaml"
26+
27+
if [[ ! -f "${REFERENCE_FILE}" ]]; then
28+
echo "missing reference file: ${REFERENCE_FILE}" >&2
29+
exit 1
30+
fi
31+
32+
if ! go run -mod=mod -modfile="${MOD_FILE}" "${K8S_TOOL_PKG}" feature-gates verify; then
33+
echo "Please run 'hack/update-featuregates.sh' to regenerate feature gates." >&2
34+
exit 1
35+
fi
36+
37+
if ! cmp -s "${REFERENCE_FILE}" "${SITE_DATA_FILE}"; then
38+
echo "Feature-gate YAML under site/data/featuregates is out of sync. Re-run hack/update-featuregates.sh." >&2
39+
exit 1
40+
fi
41+

site/content/en/docs/installation/_index.md

Lines changed: 2 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -280,47 +280,7 @@ spec:
280280

281281
### Feature gates for alpha and beta features
282282

283-
| Feature | Default | Stage | Since | Until |
284-
| --------------------------------------------- | ------- | ----- | ----- | ----- |
285-
| `FlavorFungibility` | `true` | Beta | 0.5 | |
286-
| `MultiKueue` | `false` | Alpha | 0.6 | 0.8 |
287-
| `MultiKueue` | `true` | Beta | 0.9 | |
288-
| `MultiKueueBatchJobWithManagedBy` | `false` | Alpha | 0.8 | 0.15 |
289-
| `MultiKueueBatchJobWithManagedBy` | `true` | Beta | 0.15 | |
290-
| `PartialAdmission` | `false` | Alpha | 0.4 | 0.4 |
291-
| `PartialAdmission` | `true` | Beta | 0.5 | |
292-
| `VisibilityOnDemand` | `false` | Alpha | 0.6 | 0.8 |
293-
| `VisibilityOnDemand` | `true` | Beta | 0.9 | |
294-
| `PrioritySortingWithinCohort` | `true` | Beta | 0.6 | |
295-
| `LendingLimit` | `false` | Alpha | 0.6 | 0.8 |
296-
| `LendingLimit` | `true` | Beta | 0.9 | |
297-
| `TopologyAwareScheduling` | `false` | Alpha | 0.9 | 0.13 |
298-
| `TopologyAwareScheduling` | `true` | Beta | 0.14 | |
299-
| `LocalQueueDefaulting` | `false` | Alpha | 0.10 | 0.11 |
300-
| `LocalQueueDefaulting` | `true` | Beta | 0.12 | |
301-
| `LocalQueueMetrics` | `false` | Alpha | 0.10 | |
302-
| `HierarchicalCohort` | `true` | Beta | 0.11 | |
303-
| `ObjectRetentionPolicies` | `false` | Alpha | 0.12 | 0.12 |
304-
| `ObjectRetentionPolicies` | `true` | Beta | 0.13 | |
305-
| `TASFailedNodeReplacement` | `false` | Alpha | 0.12 | 0.13 |
306-
| `TASFailedNodeReplacement` | `true` | Beta | 0.14 | |
307-
| `AdmissionFairSharing` | `false` | Alpha | 0.12 | |
308-
| `AdmissionFairSharing` | `true` | Beta | 0.15 | |
309-
| `TASFailedNodeReplacementFailFast` | `false` | Alpha | 0.12 | 0.13 |
310-
| `TASFailedNodeReplacementFailFast` | `true` | Beta | 0.14 | |
311-
| `TASReplaceNodeOnPodTermination` | `false` | Alpha | 0.13 | 0.13 |
312-
| `TASReplaceNodeOnPodTermination` | `true` | Beta | 0.14 | |
313-
| `ElasticJobsViaWorkloadSlices` | `false` | Alpha | 0.13 | |
314-
| `ManagedJobsNamespaceSelectorAlwaysRespected` | `false` | Alpha | 0.13 | 0.15 |
315-
| `ManagedJobsNamespaceSelectorAlwaysRespected` | `true` | Beta | 0.15 | |
316-
| `FlavorFungibilityImplicitPreferenceDefault` | `false` | Alpha | 0.13 | 0.16 |
317-
| `WorkloadRequestUseMergePatch` | `false` | Alpha | 0.14 | |
318-
| `SanitizePodSets` | `true` | Beta | 0.13 | |
319-
| `MultiKueueAllowInsecureKubeconfigs` | `false` | Alpha | 0.13 | |
320-
| `ReclaimablePods` | `true` | Beta | 0.15 | |
321-
| `MultiKueueAdaptersForCustomJobs` | `false` | Alpha | 0.14 | 0.14 |
322-
| `MultiKueueAdaptersForCustomJobs` | `true` | Beta | 0.15 | |
323-
| `PropagateBatchJobLabelsToWorkload` | `true` | Beta | 0.15 | |
283+
{{< feature-gates-table stage="alpha-beta" >}}
324284

325285
{{% alert title="Note" color="primary" %}}
326286
The SanitizePodSets and MultiKueueAllowInsecureKubeconfigs features are available starting from versions 0.13.8 and 0.14.3.
@@ -329,14 +289,7 @@ The PropagateBatchJobLabelsToWorkload feature is available starting from version
329289

330290
### Feature gates for graduated or deprecated features
331291

332-
| Feature | Default | Stage | Since | Until |
333-
| ------------------------------------- | ------- | ---------- | ----- | ----- |
334-
| `ConfigurableResourceTransformations` | `false` | Alpha | 0.9 | 0.9 |
335-
| `ConfigurableResourceTransformations` | `true` | Beta | 0.10 | 0.13 |
336-
| `ConfigurableResourceTransformations` | `true` | GA | 0.14 | |
337-
| `TASProfileMostFreeCapacity` | `false` | Deprecated | 0.11 | 0.13 |
338-
| `TASProfileLeastFreeCapacity` | `false` | Deprecated | 0.11 | |
339-
| `TASProfileMixed` | `false` | Deprecated | 0.11 | |
292+
{{< feature-gates-table stage="ga-deprecated" >}}
340293

341294
## What's next
342295

site/content/zh-CN/docs/installation/_index.md

Lines changed: 2 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -262,54 +262,11 @@ spec:
262262

263263
### Alpha 和 Beta 级别特性的特性门控 {#feature-gates-for-alpha-and-beta-features}
264264

265-
| 功能 | 默认值 | 阶段 | 起始版本 | 截止版本 |
266-
|-----------------------------------------------|---------|-------|------|------|
267-
| `FlavorFungibility` | `true` | Beta | 0.5 | |
268-
| `MultiKueue` | `false` | Alpha | 0.6 | 0.8 |
269-
| `MultiKueue` | `true` | Beta | 0.9 | |
270-
| `MultiKueueBatchJobWithManagedBy` | `false` | Alpha | 0.8 | 0.15 |
271-
| `MultiKueueBatchJobWithManagedBy` | `true` | Beta | 0.15 | |
272-
| `PartialAdmission` | `false` | Alpha | 0.4 | 0.4 |
273-
| `PartialAdmission` | `true` | Beta | 0.5 | |
274-
| `VisibilityOnDemand` | `false` | Alpha | 0.6 | 0.8 |
275-
| `VisibilityOnDemand` | `true` | Beta | 0.9 | |
276-
| `PrioritySortingWithinCohort` | `true` | Beta | 0.6 | |
277-
| `LendingLimit` | `false` | Alpha | 0.6 | 0.8 |
278-
| `LendingLimit` | `true` | Beta | 0.9 | |
279-
| `TopologyAwareScheduling` | `false` | Alpha | 0.9 | 0.13 |
280-
| `TopologyAwareScheduling` | `true` | Beta | 0.14 | |
281-
| `LocalQueueDefaulting` | `false` | Alpha | 0.10 | 0.11 |
282-
| `LocalQueueDefaulting` | `true` | Beta | 0.12 | |
283-
| `LocalQueueMetrics` | `false` | Alpha | 0.10 | |
284-
| `HierarchicalCohort` | `true` | Beta | 0.11 | |
285-
| `ObjectRetentionPolicies` | `false` | Alpha | 0.12 | 0.12 |
286-
| `ObjectRetentionPolicies` | `true` | Beta | 0.13 | |
287-
| `TASFailedNodeReplacement` | `false` | Alpha | 0.12 | 0.13 |
288-
| `TASFailedNodeReplacement` | `true` | Beta | 0.14 | |
289-
| `AdmissionFairSharing` | `false` | Alpha | 0.12 | |
290-
| `TASFailedNodeReplacementFailFast` | `false` | Alpha | 0.12 | 0.13 |
291-
| `TASFailedNodeReplacementFailFast` | `true` | Beta | 0.14 | |
292-
| `TASReplaceNodeOnPodTermination` | `false` | Alpha | 0.13 | 0.13 |
293-
| `TASReplaceNodeOnPodTermination` | `true` | Beta | 0.14 | |
294-
| `ElasticJobsViaWorkloadSlices` | `false` | Alpha | 0.13 | |
295-
| `ManagedJobsNamespaceSelectorAlwaysRespected` | `false` | Alpha | 0.13 | |
296-
| `FlavorFungibilityImplicitPreferenceDefault` | `false` | Alpha | 0.13 | 0.16 |
297-
| `WorkloadRequestUseMergePatch` | `false` | Alpha | 0.14 | |
298-
| `SanitizePodSets` | `true` | Beta | 0.13 | |
299-
| `MultiKueueAllowInsecureKubeconfigs` | `false` | Alpha | 0.13 | |
265+
{{< feature-gates-table stage="alpha-beta" >}}
300266

301267
### 已毕业或已弃用特性的特性门控 {#feature-gates-for-graduated-or-deprecated-features}
302268

303-
| 功能 | 默认值 | 阶段 | 起始版本 | 截止版本 |
304-
|---------------------------------------|---------|------------|------|------|
305-
| `ManagedJobsNamespaceSelector` | `true` | Beta | 0.10 | 0.13 |
306-
| `ManagedJobsNamespaceSelector` | `true` | GA | 0.13 | |
307-
| `ConfigurableResourceTransformations` | `false` | Alpha | 0.9 | 0.9 |
308-
| `ConfigurableResourceTransformations` | `true` | Beta | 0.10 | 0.13 |
309-
| `ConfigurableResourceTransformations` | `true` | GA | 0.14 | |
310-
| `TASProfileMostFreeCapacity` | `false` | Deprecated | 0.11 | 0.13 |
311-
| `TASProfileLeastFreeCapacity` | `false` | Deprecated | 0.11 | |
312-
| `TASProfileMixed` | `false` | Deprecated | 0.11 | |
269+
{{< feature-gates-table stage="ga-deprecated" >}}
313270

314271
## 接下来是什么 {#whats-next}
315272

0 commit comments

Comments
 (0)