Skip to content

Commit 5ab1e99

Browse files
committed
add example of versioned feature gating
1 parent ff03634 commit 5ab1e99

File tree

1 file changed

+15
-0
lines changed
  • keps/sig-architecture/4330-compatibility-versions

1 file changed

+15
-0
lines changed

keps/sig-architecture/4330-compatibility-versions/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ tags, and then generate with `hack/update-toc.sh`.
8686
- [Component Flags](#component-flags)
8787
- [Changes to Feature Gates](#changes-to-feature-gates)
8888
- [Feature Gate Lifespans](#feature-gate-lifespans)
89+
- [Feature gating changes](#feature-gating-changes)
8990
- [CEL Environment Compatibility Versioning](#cel-environment-compatibility-versioning)
9091
- [StorageVersion Compatibility Versioning](#storageversion-compatibility-versioning)
9192
- [API Compatibility Versioning](#api-compatibility-versioning)
@@ -318,6 +319,20 @@ Note that this respects a 1yr deprecation policy.
318319
All feature gating and tracking must remain in code through 1.32 for N-3
319320
compatibility version support.
320321
322+
#### Feature gating changes
323+
324+
In order to preserve the behavior of in-development features across multiple releases,
325+
feature implementations may also be gated by version number.
326+
327+
For example, if `FeatureA` is partially implemented in 1.28 and additional functionality
328+
is added in 1.29, the feature developer is expected to gate the functionality by version.
329+
E.g.:
330+
331+
```go
332+
if feature_gate.Enabled(FeatureA) && feature_gate.StabilityVersion(FeatureA) == "1.28" {implementation 1}
333+
if feature_gate.Enabled(FeatureA) && feature_gate.StabilityVersion(FeatureA) == "1.29" {implementation 2}
334+
```
335+
321336
### CEL Environment Compatibility Versioning
322337
323338
CEL environments already [support a compatibility

0 commit comments

Comments
 (0)