Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Downgrade info logs in clusterresource controller #89

Merged
merged 1 commit into from
Apr 30, 2020
Merged
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
15 changes: 7 additions & 8 deletions pkg/clusterresource/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,14 @@ func (c *controller) syncNamespace(ctx context.Context, namespace NamespaceName,
templateFileName := templateFile.Name()
if filepath.Ext(templateFileName) != ".yaml" {
// nothing to do.
logger.Infof(ctx, "syncing namespace [%s]: ignoring unrecognized filetype [%s]",
logger.Debugf(ctx, "syncing namespace [%s]: ignoring unrecognized filetype [%s]",
Copy link
Contributor

Choose a reason for hiding this comment

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

is this not a warning? We are ignoring something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not necessarily, we only look at yaml files (because of how kubernetes mounts configmaps with symlinks this was causing problems in the sandbox mode)

namespace, templateFile.Name())
continue
}

if c.templateAlreadyApplied(namespace, templateFile) {
// nothing to do.
logger.Infof(ctx, "syncing namespace [%s]: templateFile [%s] already applied, nothing to do.", namespace, templateFile.Name())
logger.Debugf(ctx, "syncing namespace [%s]: templateFile [%s] already applied, nothing to do.", namespace, templateFile.Name())
continue
}

Expand Down Expand Up @@ -315,7 +315,7 @@ func (c *controller) syncNamespace(ctx context.Context, namespace NamespaceName,

if err != nil {
c.metrics.TemplateUpdateErrors.Inc()
logger.Infof(ctx, "Failed to update resource [%+v] in namespace [%s] with err :%v",
logger.Warningf(ctx, "Failed to update resource [%+v] in namespace [%s] with err :%v",
Copy link
Contributor

Choose a reason for hiding this comment

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

%+v, maybe that is a problem?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

how so?

Copy link
Contributor

Choose a reason for hiding this comment

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

we are dumping out the entire object, is that want you intend to do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we're only dumping out the Kind

k8sObj.GetObjectKind().GroupVersionKind().Kind, namespace, err)
collectedErrs = append(collectedErrs, err)
} else {
Expand All @@ -333,7 +333,7 @@ func (c *controller) syncNamespace(ctx context.Context, namespace NamespaceName,
collectedErrs = append(collectedErrs, err)
}
} else {
logger.Infof(ctx, "Created resource [%+v] for namespace [%s] in kubernetes",
logger.Debugf(ctx, "Created resource [%+v] for namespace [%s] in kubernetes",
k8sObj.GetObjectKind().GroupVersionKind().Kind, namespace)
c.metrics.KubernetesResourcesCreated.Inc()
c.appliedTemplates[namespace][templateFile.Name()] = templateFile.ModTime()
Expand All @@ -354,7 +354,7 @@ func (c *controller) Sync(ctx context.Context) error {
}
}()
c.metrics.SyncStarted.Inc()
logger.Info(ctx, "Running an invocation of ClusterResource Sync")
logger.Debugf(ctx, "Running an invocation of ClusterResource Sync")

// Prefer to sync projects most newly created to ensure their resources get created first when other resources exist.
projects, err := c.db.ProjectRepo().ListAll(ctx, descCreatedAtSortParam)
Expand Down Expand Up @@ -389,9 +389,8 @@ func (c *controller) Sync(ctx context.Context) error {
c.metrics.ResourceAddErrors.Inc()
errs = append(errs, err)
} else {
logger.Infof(ctx, "Created cluster resources for namespace [%s] in kubernetes", namespace)
c.metrics.ResourcesAdded.Inc()
logger.Debugf(ctx, "Successfully created kubernetes resources for [%s-%s]", project.Identifier, domain.ID)
logger.Debugf(ctx, "Successfully created kubernetes resources for [%s]", namespace)
}
}
}
Expand All @@ -403,7 +402,7 @@ func (c *controller) Sync(ctx context.Context) error {

func (c *controller) Run() {
ctx := context.Background()
logger.Infof(ctx, "Running ClusterResourceController")
logger.Debugf(ctx, "Running ClusterResourceController")
interval := c.config.ClusterResourceConfiguration().GetRefreshInterval()
wait.Forever(func() {
err := c.Sync(ctx)
Expand Down