Merge pull request #64605 from vikaschoudhary16/feature-gate-for-watcher

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Add feature gate for kubelet plugin watcher

**What this PR does / why we need it**:
Adds a feature gate for kubelet plugin watcher and starts kubelet plugin watcher from behind feature gate

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #64576 #64303

**Special notes for your reviewer**:

**Release note**:

```release-note
Adds feature gate for plugin watcher
```
/sig node
/cc @saad-ali @vishh @derekwaynecarr @dchen1107 @jiayingz
pull/8/head
Kubernetes Submit Queue 2018-06-01 06:55:57 -07:00 committed by GitHub
commit d75e8cfcdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 4 deletions

View File

@ -304,6 +304,13 @@ const (
// Allow subpath environment variable substitution
// Only applicable if the VolumeSubpath feature is also enabled
VolumeSubpathEnvExpansion utilfeature.Feature = "VolumeSubpathEnvExpansion"
// owner: @vikaschoudhary16
// alpha: v1.11
//
//
// Enable probe based plugin watcher utility for discovering Kubelet plugins
KubeletPluginsWatcher utilfeature.Feature = "KubeletPluginsWatcher"
)
func init() {
@ -356,6 +363,7 @@ var defaultKubernetesFeatureGates = map[utilfeature.Feature]utilfeature.FeatureS
BalanceAttachedNodeVolumes: {Default: false, PreRelease: utilfeature.Alpha},
DynamicProvisioningScheduling: {Default: false, PreRelease: utilfeature.Alpha},
VolumeSubpathEnvExpansion: {Default: false, PreRelease: utilfeature.Alpha},
KubeletPluginsWatcher: {Default: false, PreRelease: utilfeature.Alpha},
// inherited features from generic apiserver, relisted here to get a conflict if it is changed
// unintentionally on either side:

View File

@ -540,6 +540,7 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
experimentalHostUserNamespaceDefaulting: utilfeature.DefaultFeatureGate.Enabled(features.ExperimentalHostUserNamespaceDefaultingGate),
keepTerminatedPodVolumes: keepTerminatedPodVolumes,
nodeStatusMaxImages: nodeStatusMaxImages,
enablePluginsWatcher: utilfeature.DefaultFeatureGate.Enabled(features.KubeletPluginsWatcher),
}
if klet.cloud != nil {
@ -1172,6 +1173,9 @@ type Kubelet struct {
// This flag sets a maximum number of images to report in the node status.
nodeStatusMaxImages int32
// This flag indicates that kubelet should start plugin watcher utility server for discovering Kubelet plugins
enablePluginsWatcher bool
}
func allGlobalUnicastIPs() ([]net.IP, error) {
@ -1285,10 +1289,11 @@ func (kl *Kubelet) initializeModules() error {
glog.Errorf("Failed to create directory %q: %v", ContainerLogsDir, err)
}
}
// Start the plugin watcher
if err := kl.pluginWatcher.Start(); err != nil {
return fmt.Errorf("failed to start Plugin Watcher. err: %v", err)
if kl.enablePluginsWatcher {
// Start the plugin watcher
if err := kl.pluginWatcher.Start(); err != nil {
return fmt.Errorf("failed to start Plugin Watcher. err: %v", err)
}
}
// Start the image manager.