Skip to content

Commit

Permalink
Turn events into warning for non state-changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sttts committed Sep 16, 2020
1 parent bc8bef9 commit efbfab5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions pkg/operator/aws_platform_service_location/controller.go
Expand Up @@ -13,6 +13,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/validation/field"
"k8s.io/client-go/tools/cache"
"k8s.io/klog"

configv1 "github.com/openshift/api/config/v1"
configv1client "github.com/openshift/client-go/config/clientset/versioned/typed/config/v1"
Expand Down Expand Up @@ -51,7 +52,7 @@ func NewController(operatorClient operatorv1helpers.OperatorClient,
func (c AWSPlatformServiceLocationController) sync(ctx context.Context, syncCtx factory.SyncContext) error {
obj, err := c.infraLister.Get("cluster")
if errors.IsNotFound(err) {
syncCtx.Recorder().Warningf("AWSPlatformServiceLocationController", "Required infrastructures.%s/cluster not found", configv1.GroupName)
klog.Warningf("AWSPlatformServiceLocationController", "Required infrastructures.%s/cluster not found", configv1.GroupName)
return nil
}
if err != nil {
Expand All @@ -64,7 +65,7 @@ func (c AWSPlatformServiceLocationController) sync(ctx context.Context, syncCtx
platformName = pstatus.Type
}
if len(platformName) == 0 {
syncCtx.Recorder().Warningf("AWSPlatformServiceLocationController", "Falling back to deprecated status.platform because infrastructures.%s/cluster status.platformStatus.type is empty", configv1.GroupName)
klog.Warningf("AWSPlatformServiceLocationController", "Falling back to deprecated status.platform because infrastructures.%s/cluster status.platformStatus.type is empty", configv1.GroupName)
platformName = currentInfra.Status.Platform
}
if platformName != configv1.AWSPlatformType {
Expand All @@ -82,8 +83,7 @@ func (c AWSPlatformServiceLocationController) sync(ctx context.Context, syncCtx

services := currentInfra.Spec.PlatformSpec.AWS.ServiceEndpoints
if err := validateServiceEndpoints(services); err != nil {
syncCtx.Recorder().Warningf("AWSPlatformServiceLocationController", "Invalid spec.platformSpec.aws.serviceEndpoints provided for infrastructures.%s/cluster", configv1.GroupName)
return err
return fmt.Errorf("invalid spec.platformSpec.aws.serviceEndpoints provided for infrastructures.%s/cluster: %v", configv1.GroupName, err)
}

sort.Slice(services, func(i, j int) bool {
Expand Down
3 changes: 2 additions & 1 deletion pkg/operator/secureaccesstoken/controller.go
Expand Up @@ -12,6 +12,7 @@ import (
operatorv1helpers "github.com/openshift/library-go/pkg/operator/v1helpers"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/klog"
)

const secureTokenStorageAnnotationKey = "oauth-apiserver.openshift.io/secure-token-storage"
Expand Down Expand Up @@ -42,7 +43,7 @@ func NewController(operatorClient operatorv1helpers.OperatorClient,
func (c Controller) sync(ctx context.Context, syncCtx factory.SyncContext) error {
obj, err := c.apiserverLister.Get("cluster")
if errors.IsNotFound(err) {
syncCtx.Recorder().Warningf("SecureAccessTokenAnnotationController", "Required apiservers.%s/cluster not found", configv1.GroupName)
klog.Warningf("SecureAccessTokenAnnotationController", "Required apiservers.%s/cluster not found", configv1.GroupName)
return nil
}
if err != nil {
Expand Down

0 comments on commit efbfab5

Please sign in to comment.