forked from openshift/kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UPSTREAM: <carry>: openshift KCM volume plugin manager uses a disjoin…
…t set of featuregates The volume plugin manager for openshfit's Attach Detach controller in kube-controller-manager uses a set of featuregates that are NOT the same as the the other controllers in KCM and the kubelet. This means these featuregates (if we kept the old names) would be inconsistent inside of a single binary. There are now separate featuregates for the volumepluginmanger when running in the Attach Detach controller to reflect this distintion. See openshift/enhancements#549 for details. Stop <carrying> the patch when CSI migration becomes GA (i.e. features.CSIMigrationAWS / features.CSIMigrationOpenStack are GA).
- Loading branch information
Showing
4 changed files
with
78 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package features | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/util/runtime" | ||
utilfeature "k8s.io/apiserver/pkg/util/feature" | ||
"k8s.io/component-base/featuregate" | ||
) | ||
|
||
var ( | ||
// owner: @jsafrane | ||
// alpha: v1.21 | ||
// | ||
// Enables the AWS EBS CSI migration for the Attach/Detach controller (ADC) only. | ||
ADCCSIMigrationAWS featuregate.Feature = "ADC_CSIMigrationAWS" | ||
|
||
// owner: @jsafrane | ||
// alpha: v1.21 | ||
// | ||
// Enables the Cinder CSI migration for the Attach/Detach controller (ADC) only. | ||
ADCCSIMigrationCinder featuregate.Feature = "ADC_CSIMigrationCinder" | ||
) | ||
|
||
var ocpDefaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureSpec{ | ||
ADCCSIMigrationAWS: {Default: true, PreRelease: featuregate.Beta}, | ||
ADCCSIMigrationCinder: {Default: true, PreRelease: featuregate.Beta}, | ||
} | ||
|
||
func init() { | ||
runtime.Must(utilfeature.DefaultMutableFeatureGate.Add(ocpDefaultKubernetesFeatureGates)) | ||
} |
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,44 @@ | ||
package csimigration | ||
|
||
import ( | ||
"k8s.io/component-base/featuregate" | ||
csilibplugins "k8s.io/csi-translation-lib/plugins" | ||
"k8s.io/kubernetes/pkg/features" | ||
) | ||
|
||
// NewADCPluginManager returns a new PluginManager instance for the Attach Detach controller which uses different | ||
// featuregates in openshift to control enablement/disablement which *DO NOT MATCH* the featuregates for the rest of the | ||
// cluster. | ||
func NewADCPluginManager(m PluginNameMapper, featureGate featuregate.FeatureGate) PluginManager { | ||
ret := NewPluginManager(m, featureGate) | ||
ret.useADCPluginManagerFeatureGates = true | ||
return ret | ||
} | ||
|
||
// adcIsMigrationEnabledForPlugin indicates whether CSI migration has been enabled | ||
// for a particular storage plugin in Attach/Detach controller. | ||
func (pm PluginManager) adcIsMigrationEnabledForPlugin(pluginName string) bool { | ||
// CSIMigration feature should be enabled along with the plugin-specific one | ||
if !pm.featureGate.Enabled(features.CSIMigration) { | ||
return false | ||
} | ||
|
||
switch pluginName { | ||
case csilibplugins.AWSEBSInTreePluginName: | ||
return pm.featureGate.Enabled(features.ADCCSIMigrationAWS) | ||
case csilibplugins.CinderInTreePluginName: | ||
return pm.featureGate.Enabled(features.ADCCSIMigrationCinder) | ||
default: | ||
return pm.isMigrationEnabledForPlugin(pluginName) | ||
} | ||
} | ||
|
||
// IsMigrationEnabledForPlugin indicates whether CSI migration has been enabled | ||
// for a particular storage plugin | ||
func (pm PluginManager) IsMigrationEnabledForPlugin(pluginName string) bool { | ||
if pm.useADCPluginManagerFeatureGates { | ||
return pm.adcIsMigrationEnabledForPlugin(pluginName) | ||
} | ||
|
||
return pm.isMigrationEnabledForPlugin(pluginName) | ||
} |
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