Skip to content

Commit

Permalink
Merge pull request #222 from stlaz/observe_config
Browse files Browse the repository at this point in the history
Bug 1777137: add observation of idp config and validation of its cm/secrets
  • Loading branch information
openshift-merge-robot committed Jun 19, 2020
2 parents ee83ab9 + 94e4e71 commit 852cd73
Show file tree
Hide file tree
Showing 33 changed files with 1,851 additions and 1,050 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ import (
"github.com/openshift/library-go/pkg/operator/resourcesynccontroller"
"github.com/openshift/library-go/pkg/operator/v1helpers"

"github.com/openshift/cluster-authentication-operator/pkg/operator2/configobservation"
"github.com/openshift/cluster-authentication-operator/pkg/operator2/configobservation/console"
"github.com/openshift/cluster-authentication-operator/pkg/operator2/configobservation/infrastructure"
"github.com/openshift/cluster-authentication-operator/pkg/operator2/configobservation/routersecret"
"github.com/openshift/cluster-authentication-operator/pkg/controllers/configobservation"
"github.com/openshift/cluster-authentication-operator/pkg/controllers/configobservation/console"
"github.com/openshift/cluster-authentication-operator/pkg/controllers/configobservation/infrastructure"
"github.com/openshift/cluster-authentication-operator/pkg/controllers/configobservation/oauth"
"github.com/openshift/cluster-authentication-operator/pkg/controllers/configobservation/routersecret"
)

func NewConfigObserver(
Expand All @@ -26,20 +27,23 @@ func NewConfigObserver(
) factory.Controller {
interestingNamespaces := []string{
"openshift-authentication",
"openshift-config",
}

preRunCacheSynced := []cache.InformerSynced{
operatorClient.Informer().HasSynced,
configInformer.Config().V1().APIServers().Informer().HasSynced,
configInformer.Config().V1().Consoles().Informer().HasSynced,
configInformer.Config().V1().Infrastructures().Informer().HasSynced,
configInformer.Config().V1().OAuths().Informer().HasSynced,
}

informers := []factory.Informer{
operatorClient.Informer(),
configInformer.Config().V1().APIServers().Informer(),
configInformer.Config().V1().Consoles().Informer(),
configInformer.Config().V1().Infrastructures().Informer(),
configInformer.Config().V1().OAuths().Informer(),
}

for _, ns := range interestingNamespaces {
Expand All @@ -60,6 +64,9 @@ func NewConfigObserver(
apiserver.ObserveTLSSecurityProfile,
console.ObserveConsoleURL,
infrastructure.ObserveAPIServerURL,
oauth.ObserveIdentityProviders,
oauth.ObserveTemplates,
oauth.ObserveTokenConfig,
routersecret.ObserveRouterSecret,
} {
oauthServerObservers = append(oauthServerObservers,
Expand All @@ -70,11 +77,13 @@ func NewConfigObserver(
operatorClient,
eventRecorder,
configobservation.Listers{
SecretsLister: kubeInformersForNamespaces.SecretLister(),
ConfigMapLister: kubeInformersForNamespaces.ConfigMapLister(),
SecretsLister: kubeInformersForNamespaces.SecretLister(),

APIServerLister_: configInformer.Config().V1().APIServers().Lister(),
ConsoleLister: configInformer.Config().V1().Consoles().Lister(),
InfrastructureLister: configInformer.Config().V1().Infrastructures().Lister(),
OAuthLister: configInformer.Config().V1().OAuths().Lister(),
ResourceSync: resourceSyncer,
PreRunCachesSynced: preRunCacheSynced,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/openshift/library-go/pkg/operator/configobserver"
"github.com/openshift/library-go/pkg/operator/events"

"github.com/openshift/cluster-authentication-operator/pkg/operator2/configobservation"
"github.com/openshift/cluster-authentication-operator/pkg/controllers/configobservation"
)

func ObserveConsoleURL(genericlisters configobserver.Listers, recorder events.Recorder, existingConfig map[string]interface{}) (ret map[string]interface{}, _ []error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
configlistersv1 "github.com/openshift/client-go/config/listers/config/v1"
"github.com/openshift/library-go/pkg/operator/events"

"github.com/openshift/cluster-authentication-operator/pkg/operator2/configobservation"
"github.com/openshift/cluster-authentication-operator/pkg/controllers/configobservation"
)

func TestObserveConsoleURL(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/openshift/library-go/pkg/operator/configobserver"
"github.com/openshift/library-go/pkg/operator/events"

"github.com/openshift/cluster-authentication-operator/pkg/operator2/configobservation"
"github.com/openshift/cluster-authentication-operator/pkg/controllers/configobservation"
)

func ObserveAPIServerURL(genericlisters configobserver.Listers, recorder events.Recorder, existingConfig map[string]interface{}) (ret map[string]interface{}, _ []error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
configlistersv1 "github.com/openshift/client-go/config/listers/config/v1"
"github.com/openshift/library-go/pkg/operator/events"

"github.com/openshift/cluster-authentication-operator/pkg/operator2/configobservation"
"github.com/openshift/cluster-authentication-operator/pkg/controllers/configobservation"
)

func TestObserveAPIServerURL(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package configobservation

import (
corelistersv1 "k8s.io/client-go/listers/core/v1"
"k8s.io/client-go/tools/cache"

configlistersv1 "github.com/openshift/client-go/config/listers/config/v1"
"github.com/openshift/library-go/pkg/operator/configobserver"
"github.com/openshift/library-go/pkg/operator/resourcesynccontroller"
corelistersv1 "k8s.io/client-go/listers/core/v1"
)

var _ configobserver.Listers = Listers{}
Expand All @@ -17,11 +17,13 @@ const (
)

type Listers struct {
SecretsLister corelistersv1.SecretLister
SecretsLister corelistersv1.SecretLister
ConfigMapLister corelistersv1.ConfigMapLister

APIServerLister_ configlistersv1.APIServerLister
ConsoleLister configlistersv1.ConsoleLister
InfrastructureLister configlistersv1.InfrastructureLister
OAuthLister configlistersv1.OAuthLister

ResourceSync resourcesynccontroller.ResourceSyncer
PreRunCachesSynced []cache.InformerSynced
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// +build ocp

package operator2
package oauth

const (
defaultBrand = ocpBrand
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// +build !ocp

package operator2
package oauth

const (
defaultBrand = okdBrand
Expand Down

0 comments on commit 852cd73

Please sign in to comment.