Skip to content

Commit

Permalink
logs
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeykazakov committed Aug 8, 2024
1 parent a6fae42 commit 3c43ec9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/autoscaler/autoscaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"k8s.io/apimachinery/pkg/runtime/serializer"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/log"
)

type BufferConfiguration interface {
Expand All @@ -26,13 +27,20 @@ func Deploy(ctx context.Context, cl client.Client, s *runtime.Scheme, namespace
if err != nil {
return err
}
logger := log.FromContext(ctx)

applyClient := applycl.NewApplyClient(cl)
// create all objects that are within the template, and update only when the object has changed.
for _, obj := range objs {
if _, err := applyClient.ApplyObject(ctx, obj); err != nil {
applied, err := applyClient.ApplyObject(ctx, obj)
if err != nil {
return errs.Wrap(err, "cannot deploy autoscaling buffer template")
}
if applied {
logger.Info("Autoscaling Buffer object created or updated", "kind", obj.GetObjectKind(), "namespace", obj.GetNamespace(), "name", obj.GetName())
} else {
logger.Info("Autoscaling Buffer object has not changed", "kind", obj.GetObjectKind(), "namespace", obj.GetNamespace(), "name", obj.GetName())

Check warning on line 42 in pkg/autoscaler/autoscaler.go

View check run for this annotation

Codecov / codecov/patch

pkg/autoscaler/autoscaler.go#L42

Added line #L42 was not covered by tests
}
}
return nil
}
Expand Down

0 comments on commit 3c43ec9

Please sign in to comment.