Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
haircommander committed Dec 5, 2024
1 parent ed2d94b commit 0fa3b6d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/cmd/render/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,12 @@ func bootstrapDefaultConfig(featureGates featuregates.FeatureGate) ([]byte, erro
}

if featureGates.Enabled(features.FeatureGateMinimumKubeletVersion) {
klog.Infof("XXXXX enabled1")
if err := node.SetAPIServerArgumentsToEnforceMinimumKubeletVersion(node.AuthModesFromUnstructured(defaultConfig), defaultConfig, true); err != nil {
return nil, err
}
} else {
klog.Infof("XXXXX disabled1")
}

defaultConfigRaw, err := json.Marshal(defaultConfig)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func (o *minimumKubeletVersionObserver) ObserveMinimumKubeletVersion(genericList
}

if !featureGates.Enabled(features.FeatureGateMinimumKubeletVersion) {
klog.Infof("XXXXX disabled 2")
return existingConfig, nil
}

Expand All @@ -71,12 +72,14 @@ func (o *minimumKubeletVersionObserver) ObserveMinimumKubeletVersion(genericList
// return empty set of configs, this helps to unset the config
// values related to the minimumKubeletVersion.
// Also, ensures that this observer doesn't break cluster upgrades/downgrades
klog.Infof("XXXXX off 2")
return ret, errs
}

if err := unstructured.SetNestedField(ret, configNode.Spec.MinimumKubeletVersion, minimumKubeletVersionConfigPath); err != nil {
return ret, append(errs, err)
}
klog.Infof("XXXXX set %s", configNode.Spec.MinimumKubeletVersion)

return ret, errs
}
Expand Down Expand Up @@ -110,13 +113,16 @@ func AuthModesFromUnstructured(config map[string]any) []string {
// ObserveAuthorizationMode watches the featuregate configuration and generates the apiServerArguments.authorization-mode
// It currently hardcodes the default set and adds MinimumKubeletVersion if the feature is set to on.
func (o *authorizationModeObserver) ObserveAuthorizationMode(genericListers configobserver.Listers, _ events.Recorder, existingConfig map[string]interface{}) (ret map[string]interface{}, errs []error) {
klog.Infof("XXXXX auth mode called")
ret = map[string]interface{}{}
if !o.featureGateAccessor.AreInitialFeatureGatesObserved() {
klog.Infof("XXXXX not initialized")
return existingConfig, nil
}

featureGates, err := o.featureGateAccessor.CurrentFeatureGates()
if err != nil {
klog.Infof("XXXXX gates nil")
return existingConfig, append(errs, err)
}

Expand All @@ -126,8 +132,10 @@ func (o *authorizationModeObserver) ObserveAuthorizationMode(genericListers conf
}()

if err := SetAPIServerArgumentsToEnforceMinimumKubeletVersion(o.authModes, ret, featureGates.Enabled(features.FeatureGateMinimumKubeletVersion)); err != nil {
klog.Infof("XXXXX failed")
return existingConfig, append(errs, err)
}
klog.Infof("XXXXX success")
return ret, nil
}

Expand Down

0 comments on commit 0fa3b6d

Please sign in to comment.