Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
haircommander committed Dec 19, 2024
1 parent c0745cb commit 2e3170e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/openshift/library-go/pkg/operator/configobserver/featuregates"
"github.com/openshift/library-go/pkg/operator/events"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/klog/v2"
)

// There are scopes authorizer tests that fail if this order is changed.
Expand Down Expand Up @@ -41,19 +42,24 @@ func (o *authorizationModeObserver) ObserveAuthorizationMode(genericListers conf
ret = configobserver.Pruned(ret, authModePath)
}()

klog.Infof("XXXXX auth mode called")
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)
}

ret = map[string]interface{}{}
if err := AddAuthorizationModes(ret, featureGates.Enabled(features.FeatureGateMinimumKubeletVersion)); err != nil {
klog.Infof("XXXXX auth mode failed")
return existingConfig, append(errs, err)
}
klog.Infof("XXXXX auth modesuccess")
return ret, nil
}

Expand All @@ -65,6 +71,7 @@ func (o *authorizationModeObserver) ObserveAuthorizationMode(genericListers conf
func AddAuthorizationModes(observedConfig map[string]interface{}, isMinimumKubeletVersionEnabled bool) error {
modes := defaultAuthenticationModes
if isMinimumKubeletVersionEnabled {
klog.Infof("XXXXX auth mode on")
modes = append(modes, ModeMinimumKubeletVersion)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func (o *minimumKubeletVersionObserver) ObserveMinimumKubeletVersion(genericList
}

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

Expand All @@ -66,12 +67,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 existingConfig, append(errs, err)
}
klog.Infof("XXXXX set %s", configNode.Spec.MinimumKubeletVersion)

return ret, errs
}

0 comments on commit 2e3170e

Please sign in to comment.