Skip to content
Open
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
7 changes: 2 additions & 5 deletions cluster-autoscaler/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
ALL_ARCH = amd64 arm64 s390x
all: $(addprefix build-arch-,$(ALL_ARCH))

# TODO: #8127 - Use default analyzers set by `go test` to include `printf` analyzer.
# Default analyzers that go test runs according to https://github.com/golang/go/blob/52624e533fe52329da5ba6ebb9c37712048168e0/src/cmd/go/internal/test/test.go#L649
# This doesn't include the `printf` analyzer until cluster-autoscaler libraries are updated.
GO_TEST_DEFAULT_ANALYZERS?=atomic,bool,buildtags,directive,errorsas,ifaceassert,nilfunc,slog,stringintconv,tests
GO_TEST_DEFAULT_ANALYZERS?=atomic,bool,buildtags,directive,errorsas,ifaceassert,nilfunc,slog,stringintconv,tests,printf
TAG?=dev
FLAGS=
LDFLAGS?=-s
Expand Down Expand Up @@ -58,7 +55,7 @@ test-build-tags:
done

test-unit: clean build
go test --test.short -race ./... -vet="${GO_TEST_DEFAULT_ANALYZERS}" ${TAGS_FLAG}
go test --test.short -race $$(go list ./... | grep -v vendor | grep -v sdk-go | grep -v go-sdk) -vet="${GO_TEST_DEFAULT_ANALYZERS}" ${TAGS_FLAG}

dev-release: dev-release-arch-$(GOARCH)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ func (m *asgCache) DeleteInstances(instances []*AwsInstanceRef) error {
if err != nil {
return err
}
klog.V(4).Infof(*resp.Activity.Description)
klog.V(4).Infof("%s", *resp.Activity.Description)

// Proactively decrement the size so autoscaler makes better decisions
commonAsg.curSize--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ func (cfg *sharedConfig) setFromIniFiles(profiles map[string]struct{}, profile s
if cfg.hasSSOTokenProviderConfiguration() {
skippedFiles = 0
for _, f := range files {
section, ok := f.IniData.GetSection(fmt.Sprintf(ssoSectionPrefix + strings.TrimSpace(cfg.SSOSessionName)))
section, ok := f.IniData.GetSection(ssoSectionPrefix + strings.TrimSpace(cfg.SSOSessionName))
if ok {
var ssoSession ssoSession
ssoSession.setFromIniSection(section)
Expand Down
6 changes: 3 additions & 3 deletions cluster-autoscaler/cloudprovider/azure/azure_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,15 +259,15 @@ func normalizeForK8sVMASScalingUp(templateMap map[string]interface{}) error {
if ok && resourceType == nsgResourceType {
if nsgIndex != -1 {
err := fmt.Errorf("found 2 resources with type %s in the template. There should only be 1", nsgResourceType)
klog.Errorf(err.Error())
klog.Errorf("%s", err.Error())
return err
}
nsgIndex = index
}
if ok && resourceType == rtResourceType {
if rtIndex != -1 {
err := fmt.Errorf("found 2 resources with type %s in the template. There should only be 1", rtResourceType)
klog.Warningf(err.Error())
klog.Warningf("%s", err.Error())
return err
}
rtIndex = index
Expand Down Expand Up @@ -296,7 +296,7 @@ func normalizeForK8sVMASScalingUp(templateMap map[string]interface{}) error {
indexesToRemove := []int{}
if nsgIndex == -1 {
err := fmt.Errorf("found no resources with type %s in the template. There should have been 1", nsgResourceType)
klog.Errorf(err.Error())
klog.Errorf("%s", err.Error())
return err
}
if rtIndex == -1 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ func Debug(title, message string) {
klog.V(5).Infof("----------------------------DEBUG: start of %s ----------------------------", title)
}

klog.V(5).Infof(message)
klog.V(5).Infof("%s", message)

if title != "" {
klog.V(5).Infof("----------------------------DEBUG: end of %s------------------------------", title)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,7 @@ func decodeError(err error) error {
err := errors.New(msg.String())
return KubernetesClusterInvalidNameError.wrap(err)
default:
err := fmt.Errorf(fmt.Sprintf("Unknown error response - status: %s, code: %d, reason: %s", errorData.Status, errorData.Code, errorData.Reason))
err := fmt.Errorf("Unknown error response - status: %s, code: %d, reason: %s", errorData.Status, errorData.Code, errorData.Reason)
return CommonError.wrap(err)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,5 +133,5 @@ func (sr ServiceResponseError) Error() string {
if err != nil {
return fmt.Sprintf("{\"ErrorMessage\": \"%s\",\"ErrorCode\": \"%s\"}", sr.ErrorMessage, sr.ErrorCode)
}
return fmt.Sprintf(string(data))
return string(data)
}
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ func (c *instancePoolCache) findInstanceByDetails(ociInstance ocicommon.OciRef)

if c.unownedInstances[ociInstance] {
// We already know this instance is not part of a configured pool. Return early and avoid additional API calls.
klog.V(4).Infof("Node " + ociInstance.Name + " is known to not be a member of any of the specified instance pool(s)")
klog.V(4).Infof("Node %s is known to not be a member of any of the specified instance pool(s)", ociInstance.Name)
return nil, errInstanceInstancePoolNotFound
}

Expand Down Expand Up @@ -307,7 +307,7 @@ func (c *instancePoolCache) findInstanceByDetails(ociInstance ocicommon.OciRef)
}

c.unownedInstances[ociInstance] = true
klog.V(4).Infof(ociInstance.Name + " is not a member of any of the specified instance pool(s)")
klog.V(4).Infof("%s is not a member of any of the specified instance pool(s)", ociInstance.Name)
return nil, errInstanceInstancePoolNotFound
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ package instancepools

import (
"fmt"
npconsts "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/oci/nodepools/consts"
"os"
"strconv"
"strings"
"time"

npconsts "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/oci/nodepools/consts"

ocicommon "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/oci/common"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/oci/instancepools/consts"

Expand Down Expand Up @@ -310,8 +311,7 @@ func (m *InstancePoolManagerImpl) GetInstancePoolNodes(ip InstancePoolNodeGroup)
func (m *InstancePoolManagerImpl) GetInstancePoolForInstance(instanceDetails ocicommon.OciRef) (*InstancePoolNodeGroup, error) {
if m.cfg.Global.UseNonMemberAnnotation && instanceDetails.InstancePoolID == consts.OciInstancePoolIDNonPoolMember {
// Instance is not part of a configured pool. Return early and avoid additional API calls.
klog.V(4).Infof(instanceDetails.Name + " is not a member of any of the specified instance pool(s) and already annotated as " +
consts.OciInstancePoolIDNonPoolMember)
klog.V(4).Infof("%s is not a member of any of the specified instance pool(s) and already annotated as %s", instanceDetails.Name, consts.OciInstancePoolIDNonPoolMember)
return nil, errInstanceInstancePoolNotFound
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (s *StsProvider) Retrieve() (Value, error) {
if _err != nil {
return Value{}, _err
}
return Value{}, fmt.Errorf(string(bb))
return Value{}, fmt.Errorf("%s", string(bb))
}
return Value{}, err
}
Expand Down
Loading