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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ require (
github.com/hashicorp/golang-lru v0.5.3 // indirect
github.com/imdario/mergo v0.3.8 // indirect
github.com/onsi/gomega v1.7.1 // indirect
github.com/openshift/api v0.0.0-20200824151745-288e45a0adde
github.com/openshift/api v0.0.0-20200829102639-8a3a835f1acf
github.com/openshift/build-machinery-go v0.0.0-20200819073603-48aa266c95f7
github.com/openshift/client-go v0.0.0-20200729195840-c2b1adc6bed6
github.com/openshift/crd-schema-gen v1.0.0
Expand Down
5 changes: 3 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,8 @@ github.com/openshift/api v0.0.0-20200722170803-0ba2c3658da6/go.mod h1:IXsT3F4NjL
github.com/openshift/api v0.0.0-20200723134351-89de68875e7c h1:qsj/GaQ1sdT584yIcGmqqRpR5xtX5jTw5Gis3/09YI4=
github.com/openshift/api v0.0.0-20200723134351-89de68875e7c/go.mod h1:IXsT3F4NjLtRzfnQvwU+g/oPWpoNsVV5vd5aaOMO8eU=
github.com/openshift/api v0.0.0-20200728200559-811027b63048/go.mod h1:IXsT3F4NjLtRzfnQvwU+g/oPWpoNsVV5vd5aaOMO8eU=
github.com/openshift/api v0.0.0-20200824151745-288e45a0adde h1:8QdKXIB/cYQ5BlNSieOScfFL0Xq4pvIgtRV65w3eqYM=
github.com/openshift/api v0.0.0-20200824151745-288e45a0adde/go.mod h1:VxlbNnMs63PHurw9hgy1DKQKWmTmhRf3PULl7KwA5Kg=
github.com/openshift/api v0.0.0-20200829102639-8a3a835f1acf h1:KP/v5AGCaq1Sbe6QrlFGZM1fHBswiHuniMTC4/hgbVw=
github.com/openshift/api v0.0.0-20200829102639-8a3a835f1acf/go.mod h1:M3xexPhgM8DISzzRpuFUy+jfPjQPIcs9yqEYj17mXV8=
github.com/openshift/build-machinery-go v0.0.0-20200713135615-1f43d26dccc7 h1:iP7TOaN+tEVNUQ0ODEbN1ukjLz918lsIt7Czf8giWlM=
github.com/openshift/build-machinery-go v0.0.0-20200713135615-1f43d26dccc7/go.mod h1:b1BuldmJlbA/xYtdZvKi+7j5YGB44qJUJDZ9zwiNCfE=
github.com/openshift/build-machinery-go v0.0.0-20200819073603-48aa266c95f7 h1:mOq7Mg1Q9d7nIDxe1SJ6pluMBQsbVxa6olyAGmfYWTg=
Expand Down Expand Up @@ -490,6 +490,7 @@ github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDa
github.com/prometheus/procfs v0.1.3 h1:F0+tqvhOksq22sc6iCHF5WGlWjdwj92p0udFh1VFBS8=
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ=
github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
Expand Down
3 changes: 1 addition & 2 deletions pkg/client/operatorclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ func (c *ConfigOperatorClient) GetOperatorState() (spec *operatorv1.OperatorSpec
return nil, nil, "", err
}

// TODO(dmage): this should be updated when we add OperatorSpec to the config object
return &operatorv1.OperatorSpec{}, &config.Status.OperatorStatus, config.ResourceVersion, nil
return &config.Spec.OperatorSpec, &config.Status.OperatorStatus, config.ResourceVersion, nil
}

func (c *ConfigOperatorClient) UpdateOperatorSpec(oldResourceVersion string, in *operatorv1.OperatorSpec) (out *operatorv1.OperatorSpec, newResourceVersion string, err error) {
Expand Down
5 changes: 4 additions & 1 deletion pkg/operator/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,11 @@ func (c *Controller) Bootstrap() error {
Finalizers: []string{defaults.ImageRegistryOperatorResourceFinalizer},
},
Spec: imageregistryv1.ImageRegistrySpec{
OperatorSpec: operatorapi.OperatorSpec{
LogLevel: operatorapi.Normal,
OperatorLogLevel: operatorapi.Normal,
},
ManagementState: mgmtState,
LogLevel: 2,
Storage: platformStorage,
Replicas: replicas,
HTTPSecret: fmt.Sprintf("%x", string(secretBytes[:])),
Expand Down
6 changes: 5 additions & 1 deletion pkg/operator/bootstrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

configv1 "github.com/openshift/api/config/v1"
imageregistryv1 "github.com/openshift/api/imageregistry/v1"
operatorv1 "github.com/openshift/api/operator/v1"
configfakeclient "github.com/openshift/client-go/config/clientset/versioned/fake"
configinformers "github.com/openshift/client-go/config/informers/externalversions"
imageregistryfakeclient "github.com/openshift/client-go/imageregistry/clientset/versioned/fake"
Expand Down Expand Up @@ -77,8 +78,11 @@ func TestBootstrapAWS(t *testing.T) {
Storage: imageregistryv1.ImageRegistryConfigStorage{
S3: &imageregistryv1.ImageRegistryConfigStorageS3{},
},
OperatorSpec: operatorv1.OperatorSpec{
LogLevel: operatorv1.Normal,
OperatorLogLevel: operatorv1.Normal,
},
Replicas: 2,
LogLevel: 2,
RolloutStrategy: "RollingUpdate",
}
if !reflect.DeepEqual(config.Spec, expected) {
Expand Down
8 changes: 8 additions & 0 deletions pkg/operator/starter.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (
imageregistryinformers "github.com/openshift/client-go/imageregistry/informers/externalversions"
routeclient "github.com/openshift/client-go/route/clientset/versioned"
routeinformers "github.com/openshift/client-go/route/informers/externalversions"
"github.com/openshift/library-go/pkg/operator/events"
"github.com/openshift/library-go/pkg/operator/loglevel"

"github.com/openshift/cluster-image-registry-operator/pkg/client"
"github.com/openshift/cluster-image-registry-operator/pkg/defaults"
Expand Down Expand Up @@ -109,6 +111,11 @@ func RunOperator(ctx context.Context, kubeconfig *restclient.Config) error {
imageregistryInformers,
)

loggingController := loglevel.NewClusterOperatorLoggingController(
configOperatorClient,
events.NewLoggingEventRecorder("image-registry"),
)

kubeInformers.Start(ctx.Done())
kubeInformersForOpenShiftConfig.Start(ctx.Done())
kubeInformersForKubeSystem.Start(ctx.Done())
Expand All @@ -122,6 +129,7 @@ func RunOperator(ctx context.Context, kubeconfig *restclient.Config) error {
go imageRegistryCertificatesController.Run(ctx.Done())
go imageConfigStatusController.Run(ctx.Done())
go imagePrunerController.Run(ctx.Done())
go loggingController.Run(ctx, 1)

<-ctx.Done()
return nil
Expand Down
12 changes: 9 additions & 3 deletions pkg/resource/podtemplatespec.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,25 @@ import (

configapiv1 "github.com/openshift/api/config/v1"
v1 "github.com/openshift/api/imageregistry/v1"
operatorapiv1 "github.com/openshift/api/operator/v1"
configlisters "github.com/openshift/client-go/config/listers/config/v1"

"github.com/openshift/cluster-image-registry-operator/pkg/defaults"
"github.com/openshift/cluster-image-registry-operator/pkg/storage"
)

// generateLogLevel returns the appropriate operand log level according to user
// provided configuration.
func generateLogLevel(cr *v1.Config) string {
switch cr.Spec.LogLevel {
case 0:
return "error"
case operatorapiv1.Debug, operatorapiv1.Trace, operatorapiv1.TraceAll:
return "debug"
}

switch cr.Spec.Logging {
case 1:
return "warn"
case 2, 3:
case 0, 2, 3:
return "info"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the telemetry, all customers (who send config.imageregistry) have logging=2. So I'd rather select the maximum of both, not minimum.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed this, PTAL. Basically, if Loglevel is set to operatorapiv1.Debug, operatorapiv1.Trace or operatorapiv1.TraceAll we set it to debug, otherwise (operatorapiv1.Normal) we fall back to Logging (but this time if it is zero we return "info" instead of "error" as before)

}
return "debug"
Expand Down
10 changes: 5 additions & 5 deletions vendor/github.com/openshift/api/go.mod

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

42 changes: 25 additions & 17 deletions vendor/github.com/openshift/api/go.sum

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