-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
featuregate: adds EtcdServer.FeatureEnabled interface.
The interface can be used throughout the etcd server binary to check if the feature is enabled or not. Note that this commit also copies necessary FeatureGate interface from k8s component-base.
- Loading branch information
Showing
6 changed files
with
66 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright 2024 The etcd Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// featuregate package is copied from k8s.io/[email protected] to avoid any potential circular dependency between k8s and etcd. | ||
// Note that only necessary portions are copied to support etcd feature gate functionalities.s | ||
package featuregate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright 2024 The etcd Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package featuregate | ||
|
||
type Feature string | ||
|
||
// FeatureGate indicates whether a given feature is enabled or not | ||
type FeatureGate interface { | ||
// Enabled returns true if the key is enabled. | ||
Enabled(key Feature) bool | ||
// KnownFeatures returns a slice of strings describing the FeatureGate's known features. | ||
KnownFeatures() []string | ||
// DeepCopy returns a deep copy of the FeatureGate object, such that gates can be | ||
// set on the copy without mutating the original. This is useful for validating | ||
// config against potential feature gate changes before committing those changes. | ||
DeepCopy() MutableFeatureGate | ||
} | ||
|
||
// MutableFeatureGate parses and stores flag gates for known features from | ||
// a string like feature1=true,feature2=false,... | ||
type MutableFeatureGate interface { | ||
FeatureGate | ||
} |