Skip to content

Commit

Permalink
targetconfigcontroller: inject authorization-mode just in case observ…
Browse files Browse the repository at this point in the history
…er doesn't run

Signed-off-by: Peter Hunt <[email protected]>
  • Loading branch information
haircommander committed Dec 19, 2024
1 parent 5e27987 commit c0745cb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/operator/targetconfigcontroller/targetconfigcontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
kubecontrolplanev1 "github.com/openshift/api/kubecontrolplane/v1"
operatorv1 "github.com/openshift/api/operator/v1"
"github.com/openshift/cluster-kube-apiserver-operator/bindata"
"github.com/openshift/cluster-kube-apiserver-operator/pkg/operator/configobservation/node"
"github.com/openshift/cluster-kube-apiserver-operator/pkg/operator/operatorclient"
"github.com/openshift/cluster-kube-apiserver-operator/pkg/version"
"github.com/openshift/library-go/pkg/controller/factory"
Expand Down Expand Up @@ -228,12 +229,21 @@ func manageKubeAPIServerConfig(ctx context.Context, client coreclientv1.ConfigMa
configOverrides := bindata.MustAsset("assets/config/config-overrides.yaml")
specialMergeRules := map[string]resourcemerge.MergeFunc{}

// Guarantee the authorization-mode will be present in the base config, regardless of whether the observer is running
authModeOverride := map[string]interface{}{}
node.AddAuthorizationModes(authModeOverride, false)
authModeOverrideJSON, err := json.Marshal(authModeOverride)
if err != nil {
return nil, false, err
}

requiredConfigMap, _, err := resourcemerge.MergePrunedConfigMap(
&kubecontrolplanev1.KubeAPIServerConfig{},
configMap,
"config.yaml",
specialMergeRules,
defaultConfig,
authModeOverrideJSON,
configOverrides,
operatorSpec.ObservedConfig.Raw,
operatorSpec.UnsupportedConfigOverrides.Raw,
Expand Down

0 comments on commit c0745cb

Please sign in to comment.