Skip to content

Commit

Permalink
add startup parameters to config log (#400)
Browse files Browse the repository at this point in the history
Signed-off-by: wangshuide <[email protected]>
Co-authored-by: wangshuide2020 <[email protected]>
  • Loading branch information
wsd0543 and wangshuide2020 authored Dec 14, 2023
1 parent b9fb430 commit a0b9705
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
8 changes: 7 additions & 1 deletion cmd/aeraki/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package main

import (
"flag"
"os"
"os/signal"
"strings"
Expand All @@ -24,6 +23,8 @@ import (
"github.com/google/uuid"
"istio.io/pkg/log"

flag "github.com/spf13/pflag"

"github.com/aeraki-mesh/aeraki/internal/bootstrap"
"github.com/aeraki-mesh/aeraki/internal/config/constants"
"github.com/aeraki-mesh/aeraki/internal/envoyfilter"
Expand Down Expand Up @@ -63,6 +64,8 @@ func main() {
flag.StringVar(&args.KubeDomainSuffix, "domain", defaultKubernetesDomain, "Kubernetes DNS domain suffix")
flag.StringVar(&args.HTTPSAddr, "httpsAddr", ":15017", "validation service HTTPS address")
flag.StringVar(&args.HTTPAddr, "httpAddr", ":8080", "Aeraki readiness service HTTP address")
loggingOptions := log.DefaultOptions()
loggingOptions.AttachFlags(flag.StringArrayVar, flag.StringVar, flag.IntVar, flag.BoolVar)
flag.Parse()

flag.VisitAll(func(flag *flag.Flag) {
Expand All @@ -77,6 +80,9 @@ func main() {
log.Infof("Aeraki bootstrap parameter: %v", args)

setLogLevels(args.LogLevel)
if err := log.Configure(loggingOptions); err != nil {
log.Error("Failed to init Aeraki log: %v", err)
}
// Create the stop channel for all of the servers.
stopChan := make(chan struct{}, 1)
args.Protocols = initGenerators()
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ RUN apk update && \
apk add curl

COPY ${AERAKI_ROOT_BIN_DIR}/${ARCH}/${OS}/aeraki /usr/local/bin/
ENTRYPOINT /usr/local/bin/aeraki
ENTRYPOINT ["/usr/local/bin/aeraki"]
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ require (
github.com/google/uuid v1.3.0
github.com/hashicorp/go-multierror v1.1.1
github.com/pkg/errors v0.9.1
github.com/spf13/pflag v1.0.5
github.com/zhaohuabing/debounce v1.0.0
go.uber.org/atomic v1.11.0
golang.org/x/net v0.17.0
Expand Down Expand Up @@ -169,7 +170,6 @@ require (
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/cobra v1.7.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stoewer/go-strcase v1.3.0 // indirect
github.com/stretchr/testify v1.8.4 // indirect
github.com/vbatts/tar-split v0.11.3 // indirect
Expand Down
3 changes: 2 additions & 1 deletion k8s/aeraki.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ spec:
- name: aeraki
image: ${AERAKI_IMAGE}:${AERAKI_TAG}
args:
- /usr/local/bin/aeraki
- --master=true
- --enable-envoy-filter-namespace-scope=false
- --log_output_level=all:info
- --log_rotate=/home/aeraki_run.log
# imagePullPolicy should be set to Never so Minikube can use local image for e2e testing
imagePullPolicy: ${AERAKI_IMG_PULL_POLICY}
ports:
Expand Down

0 comments on commit a0b9705

Please sign in to comment.