damondouglas commented on code in PR #27158:
URL: https://github.com/apache/beam/pull/27158#discussion_r1237308597


##########
.test-infra/pipelines/src/main/go/cmd/api_overuse_study/quota/main.go:
##########
@@ -0,0 +1,144 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Quota executes the service to fulfill requests that manage the API quota.
+// To execute, simply run as a normal go executable. The application relies on
+// environment variables for ease and compatibility with conventional cloud
+// deployments such as a Kubernetes deployment specification.
+// The executable reports missing required environment variables and serves
+// as its own self-documenting usage.
+//
+// See logging.LevelVariable for details on how to change the log level.
+package main
+
+import (
+       "context"
+       "fmt"
+       "net"
+
+       "github.com/apache/beam/test-infra/pipelines/src/main/go/internal/cache"
+       
"github.com/apache/beam/test-infra/pipelines/src/main/go/internal/environment"
+       "github.com/apache/beam/test-infra/pipelines/src/main/go/internal/k8s"
+       
"github.com/apache/beam/test-infra/pipelines/src/main/go/internal/logging"
+       "github.com/apache/beam/test-infra/pipelines/src/main/go/internal/quota"
+       "github.com/redis/go-redis/v9"
+       "google.golang.org/grpc"
+       "sigs.k8s.io/controller-runtime/pkg/manager/signals"
+)
+
+var (
+       port           environment.Variable = "PORT"
+       refresherImage environment.Variable = "REFRESHER_IMAGE"
+       namespace      environment.Variable = "NAMESPACE"
+
+       spec = &quota.ServiceSpec{
+               RefresherServiceSpec: &quota.RefresherServiceSpec{
+                       ContainerName: "refresher",
+                       Image:         refresherImage.Value(),
+                       Environment: []environment.Variable{
+                               namespace,
+                               cache.Host,
+                               logging.LevelVariable,
+                       },
+               },
+       }
+
+       logger = logging.New(
+               context.Background(),
+               
"github.com/apache/beam/.test-infra/pipelines/src/main/go/cmd/api_overuse_study/quota",
+               logging.LevelVariable)
+
+       required = []environment.Variable{
+               port,
+               cache.Host,
+               namespace,
+               refresherImage,
+       }
+
+       env     = environment.Map(required...)

Review Comment:
   See https://github.com/apache/beam/pull/27158#discussion_r1237308304



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to