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


##########
.test-infra/pipelines/src/main/go/cmd/api_overuse_study/echo/main.go:
##########
@@ -0,0 +1,124 @@
+// 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.
+
+// Echo executes the service to fulfill requests that mock a quota-aware API
+// endpoint.
+// 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/echo"
+       
"github.com/apache/beam/test-infra/pipelines/src/main/go/internal/environment"
+       
"github.com/apache/beam/test-infra/pipelines/src/main/go/internal/logging"
+       "github.com/redis/go-redis/v9"
+       "google.golang.org/grpc"
+       "sigs.k8s.io/controller-runtime/pkg/manager/signals"
+)
+
+var (
+       port environment.Variable = "PORT"
+
+       address = fmt.Sprintf(":%s", port.Value())

Review Comment:
   It's subjective but environment variables are cleaner in a Kubernetes 
context. Consider if flags are needed shown below. I've seen more errors 
related to using flags than environment variables.
   
   ```
   # Deployment Pod Spec
       spec:
         containers:
         - name: echo
         - command: ['--flag1=value1', '--flag2=value2']
   ```
   
   versus as environment variables:
   ```
   apiVersion: v1
   kind: ConfigMap
   metadata:
     name: my-configmap
   data:
       ENV1: value1
       ENV2: value2
   
   # Deployment Pod Spec
       spec:
         containers:
         - name: some-service
           env:
               valueFrom:
                   configMapRef:
                       name: my-configmap
   
   ```



-- 
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