Skip to content

Commit f03050d

Browse files
committed
Enhance docs book integration with feature gates documentation
1 parent 6c2339c commit f03050d

File tree

1 file changed

+51
-1
lines changed

1 file changed

+51
-1
lines changed

docs/book/src/reference/markers/feature-gates.md

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,34 @@
22

33
Feature gates allow you to enable or disable experimental features in your Kubebuilder controllers. This is similar to how Kubernetes core uses feature gates to manage experimental functionality.
44

5+
## Quick Start
6+
7+
### Marking Fields
8+
9+
```go
10+
type MyResourceSpec struct {
11+
// Standard field
12+
Name string `json:"name"`
13+
14+
// Experimental field
15+
// +feature-gate experimental-bar
16+
Bar *string `json:"bar,omitempty"`
17+
}
18+
```
19+
20+
### Running with Feature Gates
21+
22+
```bash
23+
# Enable feature gates
24+
./manager --feature-gates=experimental-bar
25+
26+
# Multiple gates
27+
./manager --feature-gates=experimental-bar,advanced-features
28+
29+
# Mixed states
30+
./manager --feature-gates=experimental-bar=true,advanced-features=false
31+
```
32+
533
## Overview
634

735
Feature gates provide a mechanism to:
@@ -133,4 +161,26 @@ Enable debug logging to see feature gate discovery:
133161

134162
```bash
135163
./manager --feature-gates=experimental-bar --zap-log-level=debug
136-
```
164+
```
165+
166+
## Implementation Status
167+
168+
### ✅ Production Ready
169+
170+
- Feature gate discovery and validation
171+
- Controller integration with `--feature-gates` flag
172+
- Scaffolding integration for new projects
173+
174+
### 🔄 Future Enhancement
175+
176+
- CRD schema modification (requires [controller-tools support](https://github.com/kubernetes-sigs/controller-tools/issues/1238))
177+
178+
When [controller-tools supports feature gates](https://github.com/kubernetes-sigs/controller-tools/issues/1238), you'll be able to use:
179+
180+
```go
181+
// +kubebuilder:feature-gate=experimental-bar
182+
// +optional
183+
Bar *string `json:"bar,omitempty"`
184+
```
185+
186+
This will automatically exclude the field from CRD schemas when the feature gate is disabled.

0 commit comments

Comments
 (0)