From 47a400bce59f324da46b5543f7c3a2f3fa8b675e Mon Sep 17 00:00:00 2001 From: Michael Kalantar Date: Fri, 22 Dec 2023 14:50:03 -0500 Subject: [PATCH] bump remaining version references (#1663) * bump remaining version references Signed-off-by: Michael Kalantar * fix lint problems Signed-off-by: Michael Kalantar * fix lint issues Signed-off-by: Michael Kalantar --------- Signed-off-by: Michael Kalantar --- abn/service.go | 4 ++-- abn/service_test.go | 2 +- base/internal/common.go | 2 +- .../helloworld/helloworld/greeter_server.go | 8 +++---- base/notify_test.go | 2 +- base/readiness.go | 4 ++-- base/run.go | 2 +- base/test_helpers_driver.go | 2 +- base/util.go | 4 ++-- cmd/krun.go | 2 +- controllers/routemap.go | 24 +++++++++---------- docker/Dockerfile | 2 +- driver/kubedriver.go | 5 +--- metrics/server.go | 4 ++-- 14 files changed, 32 insertions(+), 35 deletions(-) diff --git a/abn/service.go b/abn/service.go index 2db7b282f..ae5cff569 100644 --- a/abn/service.go +++ b/abn/service.go @@ -36,7 +36,7 @@ type abnServer struct { // Lookup identifies a versionNumber (index to list of versions) that should be used for a given user // This method is exposed to gRPC clients -func (server *abnServer) Lookup(ctx context.Context, appMsg *pb.Application) (*pb.VersionRecommendation, error) { +func (server *abnServer) Lookup(_ context.Context, appMsg *pb.Application) (*pb.VersionRecommendation, error) { log.Logger.Tracef("Lookup called for application=%s, user=%s", appMsg.GetName(), appMsg.GetUser()) defer log.Logger.Trace("Lookup completed") @@ -64,7 +64,7 @@ func (server *abnServer) Lookup(ctx context.Context, appMsg *pb.Application) (*p // WriteMetric identifies the version with which a metric is associated (from user) and // writes the metric value -func (server *abnServer) WriteMetric(ctx context.Context, metricMsg *pb.MetricValue) (*emptypb.Empty, error) { +func (server *abnServer) WriteMetric(_ context.Context, metricMsg *pb.MetricValue) (*emptypb.Empty, error) { log.Logger.Trace("WriteMetric called") defer log.Logger.Trace("WriteMetric completed") diff --git a/abn/service_test.go b/abn/service_test.go index c60ea725b..0774eea73 100644 --- a/abn/service_test.go +++ b/abn/service_test.go @@ -144,7 +144,7 @@ func testWriteMetric(t *testing.T, grpcClient *pb.ABNClient, scenario Scenario) } } -func setupRoutemaps(t *testing.T, initialroutemaps ...testroutemap) testroutemaps { +func setupRoutemaps(_ *testing.T, initialroutemaps ...testroutemap) testroutemaps { routemaps := testroutemaps{ nsRoutemap: make(map[string]testroutemapsByName), } diff --git a/base/internal/common.go b/base/internal/common.go index 8c5c5c358..5b8a7955d 100644 --- a/base/internal/common.go +++ b/base/internal/common.go @@ -19,7 +19,7 @@ const LocalHostPort = "localhost:12345" // StartServer starts the server. // // For testing only. -func StartServer(secure bool) (*helloworld.Greeter, *grpc.Server, error) { +func StartServer(_ bool) (*helloworld.Greeter, *grpc.Server, error) { lis, err := net.Listen("tcp", LocalHostPort) if err != nil { return nil, nil, err diff --git a/base/internal/helloworld/helloworld/greeter_server.go b/base/internal/helloworld/helloworld/greeter_server.go index 9d594378f..5dd813290 100644 --- a/base/internal/helloworld/helloworld/greeter_server.go +++ b/base/internal/helloworld/helloworld/greeter_server.go @@ -320,12 +320,12 @@ func (s *Greeter) GetCountByWorker(key CallType) map[string]int { } // HandleConn handle the connection -func (c *HWStatsHandler) HandleConn(ctx context.Context, cs stats.ConnStats) { +func (c *HWStatsHandler) HandleConn(_ context.Context, _ stats.ConnStats) { // no-op } // TagConn exists to satisfy gRPC stats.Handler. -func (c *HWStatsHandler) TagConn(ctx context.Context, cti *stats.ConnTagInfo) context.Context { +func (c *HWStatsHandler) TagConn(ctx context.Context, _ *stats.ConnTagInfo) context.Context { c.mutex.Lock() c.connCount++ c.mutex.Unlock() @@ -334,11 +334,11 @@ func (c *HWStatsHandler) TagConn(ctx context.Context, cti *stats.ConnTagInfo) co } // HandleRPC implements per-RPC tracing and stats instrumentation. -func (c *HWStatsHandler) HandleRPC(ctx context.Context, rs stats.RPCStats) { +func (c *HWStatsHandler) HandleRPC(_ context.Context, _ stats.RPCStats) { // no-op } // TagRPC implements per-RPC context management. -func (c *HWStatsHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context { +func (c *HWStatsHandler) TagRPC(ctx context.Context, _ *stats.RPCTagInfo) context.Context { return ctx } diff --git a/base/notify_test.go b/base/notify_test.go index ba9a59b59..31445214f 100644 --- a/base/notify_test.go +++ b/base/notify_test.go @@ -16,7 +16,7 @@ const ( templatePath = "/template" ) -func getNotifyTask(t *testing.T, n notifyInputs) *notifyTask { +func getNotifyTask(_ *testing.T, n notifyInputs) *notifyTask { // valid collect database task... should succeed nt := ¬ifyTask{ TaskMeta: TaskMeta{ diff --git a/base/readiness.go b/base/readiness.go index f66c25751..16dbe3888 100644 --- a/base/readiness.go +++ b/base/readiness.go @@ -71,7 +71,7 @@ func (t *readinessTask) validateInputs() error { } // run executes the task -func (t *readinessTask) run(exp *Experiment) error { +func (t *readinessTask) run(_ *Experiment) error { // validation err := t.validateInputs() if err != nil { @@ -125,7 +125,7 @@ func (t *readinessTask) run(exp *Experiment) error { // checkObjectExistsAndConditionTrue determines if the object exists // if so, it further checks if the requested condition is "True" -func checkObjectExistsAndConditionTrue(t *readinessTask, restCfg *rest.Config) error { +func checkObjectExistsAndConditionTrue(t *readinessTask, _ *rest.Config) error { log.Logger.Trace("looking for resource (", t.With.Group, "/", t.With.Version, ") ", t.With.Resource, ": ", t.With.Name, " in namespace ", *t.With.Namespace) obj, err := kd.dynamicClient.Resource(gvr(&t.With)).Namespace(*t.With.Namespace).Get(context.Background(), t.With.Name, metav1.GetOptions{}) diff --git a/base/run.go b/base/run.go index bdcc26e18..367641d9c 100644 --- a/base/run.go +++ b/base/run.go @@ -44,7 +44,7 @@ func (t *runTask) getCommand() *exec.Cmd { } // run the command -func (t *runTask) run(exp *Experiment) error { +func (t *runTask) run(_ *Experiment) error { err := t.validateInputs() if err != nil { return err diff --git a/base/test_helpers_driver.go b/base/test_helpers_driver.go index 72f35bef4..f3c08e80e 100644 --- a/base/test_helpers_driver.go +++ b/base/test_helpers_driver.go @@ -8,7 +8,7 @@ import ( ) // initKubeFake initialize the Kube clientset with a fake -func initKubeFake(kd *KubeDriver, objects ...runtime.Object) { +func initKubeFake(kd *KubeDriver, _ ...runtime.Object) { kd.dynamicClient = dynamicfake.NewSimpleDynamicClient(runtime.NewScheme()) } diff --git a/base/util.go b/base/util.go index b95158ec5..0f4f0377d 100644 --- a/base/util.go +++ b/base/util.go @@ -19,11 +19,11 @@ import ( // MajorMinor is the minor version of Iter8 // set this manually whenever the major or minor version changes -var MajorMinor = "v0.18" +var MajorMinor = "v1.1" // Version is the semantic version of Iter8 (with the `v` prefix) // Version is intended to be set using LDFLAGS at build time -var Version = "v0.18.0" +var Version = "v1.1.0" const ( toYAMLString = "toYaml" diff --git a/cmd/krun.go b/cmd/krun.go index 1dc573545..8c04f43a3 100644 --- a/cmd/krun.go +++ b/cmd/krun.go @@ -18,7 +18,7 @@ This command is intended for use within the Iter8 Docker image that is used to e ` // newKRunCmd creates the Kubernetes run command -func newKRunCmd(kd *driver.KubeDriver, out io.Writer) *cobra.Command { +func newKRunCmd(kd *driver.KubeDriver, _ io.Writer) *cobra.Command { actor := ia.NewRunOpts(kd) actor.EnvSettings = settings cmd := &cobra.Command{ diff --git a/controllers/routemap.go b/controllers/routemap.go index a9509986c..6ebeccf3c 100644 --- a/controllers/routemap.go +++ b/controllers/routemap.go @@ -196,22 +196,22 @@ func (s *routemap) getWeightOverrides() []*uint32 { if r.Namespace != nil { ns = *r.Namespace } - if obj, err1 := appInformers[r.GVRShort].Lister().ByNamespace(ns).Get(r.Name); err1 != nil { + obj, err1 := appInformers[r.GVRShort].Lister().ByNamespace(ns).Get(r.Name) + if err1 != nil { log.Logger.Trace("could not get resource: ", r.Name, " with gvrShort: ", r.GVRShort) log.Logger.Trace(err1) continue - } else { - u := obj.(*unstructured.Unstructured) - if weightStr, ok := u.GetAnnotations()[weightAnnotation]; ok { - if weight64, err2 := strconv.ParseUint(weightStr, 10, 32); err2 == nil { - weight32 := uint32(weight64) - override[i] = &weight32 - } else { - log.Logger.Error("invalid weight annotation") - } + } + u := obj.(*unstructured.Unstructured) + if weightStr, ok := u.GetAnnotations()[weightAnnotation]; ok { + if weight64, err2 := strconv.ParseUint(weightStr, 10, 32); err2 == nil { + weight32 := uint32(weight64) + override[i] = &weight32 } else { - log.Logger.Trace("no weight annotation for version resource 1") + log.Logger.Error("invalid weight annotation") } + } else { + log.Logger.Trace("no weight annotation for version resource 1") } } } @@ -491,7 +491,7 @@ func getObservedGeneration(obj *unstructured.Unstructured, condition map[string] } // validate routemap CM -func validateRoutemapCM(confMap *corev1.ConfigMap) error { +func validateRoutemapCM(_ *corev1.ConfigMap) error { return nil } diff --git a/docker/Dockerfile b/docker/Dockerfile index 36ab31828..4e511e8cc 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -22,5 +22,5 @@ COPY --from=build-stage /app/bin/iter8 /bin/iter8 # Set Iter8 version from build args ARG TAG -ENV TAG=${TAG:-v0.18.0} +ENV TAG=${TAG:-v1.1.0} diff --git a/driver/kubedriver.go b/driver/kubedriver.go index 7e980b050..fce4c8a9f 100644 --- a/driver/kubedriver.go +++ b/driver/kubedriver.go @@ -122,10 +122,7 @@ func (kd *KubeDriver) Init() error { if err := kd.initHelm(); err != nil { return err } - if err := kd.initRevision(); err != nil { - return err - } - return nil + return kd.initRevision() } // getLastRelease fetches the last release of an Iter8 experiment diff --git a/metrics/server.go b/metrics/server.go index fd93586cc..993a022bc 100644 --- a/metrics/server.go +++ b/metrics/server.go @@ -468,7 +468,7 @@ func getHTTPHistogram(fortioHistogram []fstats.Bucket, decimalPlace float64) gra return grafanaHistogram } -func getHTTPStatistics(fortioHistogram *fstats.HistogramData, decimalPlace float64) storage.SummarizedMetric { +func getHTTPStatistics(fortioHistogram *fstats.HistogramData, _ float64) storage.SummarizedMetric { return storage.SummarizedMetric{ Count: uint64(fortioHistogram.Count), Mean: fortioHistogram.Avg * 1000, @@ -593,7 +593,7 @@ func getHTTPDashboard(w http.ResponseWriter, r *http.Request) { _, _ = w.Write(dashboardBytes) } -func getGRPCHistogram(ghzHistogram []runner.Bucket, decimalPlace float64) grafanaHistogram { +func getGRPCHistogram(ghzHistogram []runner.Bucket, _ float64) grafanaHistogram { grafanaHistogram := grafanaHistogram{} for _, bucket := range ghzHistogram {