Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ require (
github.com/ghodss/yaml v1.0.0
github.com/gonum/graph v0.0.0-20170401004347-50b27dea7ebb
github.com/google/go-cmp v0.5.9
github.com/openshift/api v0.0.0-20230320211411-560b2fb170af
github.com/openshift/api v0.0.0-20230330150608-05635858d40f
github.com/openshift/build-machinery-go v0.0.0-20220913142420-e25cf57ea46d
github.com/openshift/client-go v0.0.0-20230120202327-72f107311084
github.com/openshift/library-go v0.0.0-20230302173334-c5e706838384
github.com/openshift/library-go v0.0.0-20230405224819-c1e9763926fb
github.com/prometheus/client_golang v1.14.0
github.com/prometheus/common v0.37.0
github.com/spf13/cobra v1.6.0
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -424,14 +424,14 @@ github.com/onsi/ginkgo/v2 v2.4.0 h1:+Ig9nvqgS5OBSACXNk15PLdp0U9XPYROt9CFzVdFGIs=
github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.23.0 h1:/oxKu9c2HVap+F3PfKort2Hw5DEU+HGlW8n+tguWsys=
github.com/openshift/api v0.0.0-20230320211411-560b2fb170af h1:js8+NVUCTK7cz+IO6i9MnKfKU14QYSMgOiJYvqhAMM0=
github.com/openshift/api v0.0.0-20230320211411-560b2fb170af/go.mod h1:ctXNyWanKEjGj8sss1KjjHQ3ENKFm33FFnS5BKaIPh4=
github.com/openshift/api v0.0.0-20230330150608-05635858d40f h1:mGpCtfoehMcvmg/sSYLiv6nCbTl04cmtkUfYzP7H1AQ=
github.com/openshift/api v0.0.0-20230330150608-05635858d40f/go.mod h1:ctXNyWanKEjGj8sss1KjjHQ3ENKFm33FFnS5BKaIPh4=
github.com/openshift/build-machinery-go v0.0.0-20220913142420-e25cf57ea46d h1:RR4ah7FfaPR1WePizm0jlrsbmPu91xQZnAsVVreQV1k=
github.com/openshift/build-machinery-go v0.0.0-20220913142420-e25cf57ea46d/go.mod h1:b1BuldmJlbA/xYtdZvKi+7j5YGB44qJUJDZ9zwiNCfE=
github.com/openshift/client-go v0.0.0-20230120202327-72f107311084 h1:66uaqNwA+qYyQDwsMWUfjjau8ezmg1dzCqub13KZOcE=
github.com/openshift/client-go v0.0.0-20230120202327-72f107311084/go.mod h1:M3h9m001PWac3eAudGG3isUud6yBjr5XpzLYLLTlHKo=
github.com/openshift/library-go v0.0.0-20230302173334-c5e706838384 h1:lNyOAREdff+F246oiR7OUGMRQSYbS0OXYbNPMTJMO/4=
github.com/openshift/library-go v0.0.0-20230302173334-c5e706838384/go.mod h1:xO4nAf0qa56dgvEJWVD1WuwSJ8JWPU1TYLBQrlutWnE=
github.com/openshift/library-go v0.0.0-20230405224819-c1e9763926fb h1:yv/0B9Km8VD1ch9nYuzPVkWVtG2nVZa3IOrj89sTKR0=
github.com/openshift/library-go v0.0.0-20230405224819-c1e9763926fb/go.mod h1:tedJaJsajpyrlPVNoSfjOst6w2HHvvR4VPqKWeZzrbY=
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"k8s.io/client-go/tools/cache"

configinformers "github.com/openshift/client-go/config/informers/externalversions"
operatorinformers "github.com/openshift/client-go/operator/informers/externalversions"
libgocloudprovider "github.com/openshift/library-go/pkg/cloudprovider"
"github.com/openshift/library-go/pkg/controller/factory"
"github.com/openshift/library-go/pkg/operator/configobserver"
Expand All @@ -13,6 +14,7 @@ import (
"github.com/openshift/library-go/pkg/operator/configobserver/featuregates"
nodeobserver "github.com/openshift/library-go/pkg/operator/configobserver/node"
"github.com/openshift/library-go/pkg/operator/configobserver/proxy"
storageobserver "github.com/openshift/library-go/pkg/operator/configobserver/storage"
"github.com/openshift/library-go/pkg/operator/events"
"github.com/openshift/library-go/pkg/operator/resourcesynccontroller"
"github.com/openshift/library-go/pkg/operator/v1helpers"
Expand Down Expand Up @@ -41,6 +43,7 @@ type ConfigObserver struct {
func NewConfigObserver(
operatorClient v1helpers.OperatorClient,
configinformers configinformers.SharedInformerFactory,
operatorinformers operatorinformers.SharedInformerFactory,
kubeInformersForNamespaces v1helpers.KubeInformersForNamespaces,
resourceSyncer resourcesynccontroller.ResourceSyncer,
eventRecorder events.Recorder,
Expand All @@ -64,6 +67,7 @@ func NewConfigObserver(
configinformers.Config().V1().Networks().Informer(),
configinformers.Config().V1().Nodes().Informer(),
configinformers.Config().V1().Proxies().Informer(),
operatorinformers.Operator().V1().Storages().Informer(),
}
for _, ns := range interestingNamespaces {
informers = append(informers, kubeInformersForNamespaces.InformersFor(ns).Core().V1().ConfigMaps().Informer())
Expand Down Expand Up @@ -96,6 +100,7 @@ func NewConfigObserver(
NodeLister_: configinformers.Config().V1().Nodes().Lister(),
ProxyLister_: configinformers.Config().V1().Proxies().Lister(),
APIServerLister_: configinformers.Config().V1().APIServers().Lister(),
StorageLister_: operatorinformers.Operator().V1().Storages().Lister(),

ResourceSync: resourceSyncer,
ConfigMapLister_: kubeInformersForNamespaces.ConfigMapLister(),
Expand All @@ -110,6 +115,7 @@ func NewConfigObserver(
configinformers.Config().V1().Networks().Informer().HasSynced,
configinformers.Config().V1().Nodes().Informer().HasSynced,
configinformers.Config().V1().Proxies().Informer().HasSynced,
operatorinformers.Operator().V1().Storages().Informer().HasSynced,
),
},
informers,
Expand Down Expand Up @@ -150,6 +156,7 @@ func NewConfigObserver(
clustername.ObserveInfraID,
libgoapiserver.ObserveTLSSecurityProfile,
cloud.ObserveCloudVolumePlugin,
storageobserver.NewStorageObserveFunc([]string{"targetconfigcontroller", "storage"}),
),
}

Expand Down
6 changes: 6 additions & 0 deletions pkg/operator/configobservation/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"k8s.io/client-go/tools/cache"

configlistersv1 "github.com/openshift/client-go/config/listers/config/v1"
operatorlistersv1 "github.com/openshift/client-go/operator/listers/operator/v1"
"github.com/openshift/library-go/pkg/operator/configobserver/cloudprovider"
"github.com/openshift/library-go/pkg/operator/resourcesynccontroller"
)
Expand All @@ -19,6 +20,7 @@ type Listers struct {
ProxyLister_ configlistersv1.ProxyLister
ConfigMapLister_ corev1listers.ConfigMapLister
APIServerLister_ configlistersv1.APIServerLister
StorageLister_ operatorlistersv1.StorageLister

ResourceSync resourcesynccontroller.ResourceSyncer
PreRunCachesSynced []cache.InformerSynced
Expand Down Expand Up @@ -55,3 +57,7 @@ func (l Listers) ConfigMapLister() corev1listers.ConfigMapLister {
func (l Listers) APIServerLister() configlistersv1.APIServerLister {
return l.APIServerLister_
}

func (l Listers) StorageLister() operatorlistersv1.StorageLister {
return l.StorageLister_
}
9 changes: 9 additions & 0 deletions pkg/operator/starter.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (
configv1client "github.com/openshift/client-go/config/clientset/versioned"
configinformers "github.com/openshift/client-go/config/informers/externalversions"
configinformersv1 "github.com/openshift/client-go/config/informers/externalversions/config/v1"
operatorv1client "github.com/openshift/client-go/operator/clientset/versioned"
operatorinformers "github.com/openshift/client-go/operator/informers/externalversions"
"github.com/openshift/cluster-kube-controller-manager-operator/bindata"
"github.com/openshift/cluster-kube-controller-manager-operator/pkg/operator/certrotationcontroller"
"github.com/openshift/cluster-kube-controller-manager-operator/pkg/operator/configobservation/configobservercontroller"
Expand Down Expand Up @@ -48,8 +50,13 @@ func RunOperator(ctx context.Context, cc *controllercmd.ControllerContext) error
if err != nil {
return err
}
opClient, err := operatorv1client.NewForConfig(cc.KubeConfig)
if err != nil {
return err
}

configInformers := configinformers.NewSharedInformerFactory(configClient, 10*time.Minute)
opInformers := operatorinformers.NewSharedInformerFactory(opClient, 10*time.Minute)
kubeInformersForNamespaces := v1helpers.NewKubeInformersForNamespaces(kubeClient,
"",
operatorclient.GlobalUserSpecifiedConfigNamespace,
Expand Down Expand Up @@ -79,6 +86,7 @@ func RunOperator(ctx context.Context, cc *controllercmd.ControllerContext) error
configObserver, err := configobservercontroller.NewConfigObserver(
operatorClient,
configInformers,
opInformers,
kubeInformersForNamespaces,
resourceSyncController,
cc.EventRecorder,
Expand Down Expand Up @@ -255,6 +263,7 @@ func RunOperator(ctx context.Context, cc *controllercmd.ControllerContext) error
})

configInformers.Start(ctx.Done())
opInformers.Start(ctx.Done())
kubeInformersForNamespaces.Start(ctx.Done())
dynamicInformers.Start(ctx.Done())

Expand Down
17 changes: 13 additions & 4 deletions pkg/operator/targetconfigcontroller/targetconfigcontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -648,11 +648,20 @@ func managePod(ctx context.Context, configMapsGetter corev1client.ConfigMapsGett
return nil, false, fmt.Errorf("couldn't get the proxy config from observedConfig: %v", err)
}

proxyEnvVars := proxyMapToEnvVars(proxyConfig)
proxyEnvVars := stringMapToEnvVars(proxyConfig)
for i, container := range required.Spec.Containers {
required.Spec.Containers[i].Env = append(container.Env, proxyEnvVars...)
}

// Set OPENSHIFT_DO_VSPHERE_MIGRATION to 'true' if vSphere migration is enabled
storageConfig, _, err := unstructured.NestedStringMap(observedConfig, "targetconfigcontroller", "storage")
if err != nil {
return nil, false, fmt.Errorf("couldn't get the storage config from observedConfig: %v", err)
}
storageEnvVars := stringMapToEnvVars(storageConfig)
// this environment variable is only needed for kube-controller-manager
required.Spec.Containers[0].Env = append(required.Spec.Containers[0].Env, storageEnvVars...)

// set the env var to indicate that we want this vulnerable behavior.
if !useSecureServiceCA {
for i, container := range required.Spec.Containers {
Expand Down Expand Up @@ -904,13 +913,13 @@ func ensureKubeControllerManagerTrustedCA(ctx context.Context, client corev1clie
return err
}

func proxyMapToEnvVars(proxyConfig map[string]string) []corev1.EnvVar {
if proxyConfig == nil {
func stringMapToEnvVars(stringMap map[string]string) []corev1.EnvVar {
if stringMap == nil {
return nil
}

envVars := []corev1.EnvVar{}
for k, v := range proxyConfig {
for k, v := range stringMap {
envVars = append(envVars, corev1.EnvVar{Name: k, Value: v})
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading