Skip to content

Commit

Permalink
Merge pull request #99 from erikgb/disable-propagate-generated-by-def…
Browse files Browse the repository at this point in the history
…ault

chore: enable DisablePropagateGenerated feature gate by default
  • Loading branch information
ymmt2005 authored Oct 23, 2023
2 parents 9bbac9f + 6f225f3 commit 7fcb2aa
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 2 deletions.
5 changes: 5 additions & 0 deletions controllers/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ import (
"sigs.k8s.io/controller-runtime/pkg/log/zap"

accuratev1 "github.com/cybozu-go/accurate/api/v1"
"github.com/cybozu-go/accurate/pkg/config"
"github.com/cybozu-go/accurate/pkg/constants"
"github.com/cybozu-go/accurate/pkg/feature"
//+kubebuilder:scaffold:imports
)

Expand Down Expand Up @@ -49,6 +51,9 @@ var _ = BeforeSuite(func() {
zap.Level(zapcore.Level(-5)),
))

// Some tests are still testing the propagate-generated feature
Expect(config.DefaultMutableFeatureGate.SetFromMap(map[string]bool{string(feature.DisablePropagateGenerated): false})).To(Succeed())

By("bootstrapping test environment")
testEnv = &envtest.Environment{
CRDDirectoryPaths: []string{filepath.Join("..", "config", "crd", "bases")},
Expand Down
31 changes: 31 additions & 0 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,35 @@ controller:
<snip>
```

## Feature Gates

Feature gates are a set of key=value pairs that describe operator features.
You can turn these features on or off using the `--feature-gates` command line flag.
Use `-h` flag to see a full set of feature gates.

To set feature gates, use the `--feature-gates` flag assigned to a list of feature pairs:

```shell
--feature-gates=...,DisablePropagateGenerated=false
```

The following table is a summary of the feature gates that you can set.

- The "Since" column contains the Accurate release when a feature is introduced
or its release stage is changed.
- The "Until" column, if not empty, contains the last Accurate release in which
you can still use a feature gate.

{{< table caption="Feature gates for features in Alpha or Beta states" sortable="true" >}}

| Feature | Default | Stage | Since | Until |
|---------|---------|-------|-------|-------|
| `DisablePropagateGenerated` | `false` | Alpha | 1.2.0 | 1.3.0 |
| `DisablePropagateGenerated` | `true` | Beta | 1.3.0 | |

Each feature gate is designed for enabling/disabling a specific feature:

- `DisablePropagateGenerated`: Disable [propagating generated resources](concepts.md#propagating-generated-resources),
which is a feature subject for removal soon.

[ResourceQuota]: https://kubernetes.io/docs/concepts/policy/resource-quotas/
3 changes: 2 additions & 1 deletion e2e/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ image:
controller:
extraArgs:
- --zap-log-level=5

# Some tests are still testing the propagate-generated feature
- --feature-gates=DisablePropagateGenerated=false
config:
labelKeys:
- team
Expand Down
2 changes: 1 addition & 1 deletion pkg/feature/feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ func init() {
}

var defaultFeatureGates = map[featuregate.Feature]featuregate.FeatureSpec{
DisablePropagateGenerated: {Default: false, PreRelease: featuregate.Alpha},
DisablePropagateGenerated: {Default: true, PreRelease: featuregate.Beta},
}

0 comments on commit 7fcb2aa

Please sign in to comment.