From 4ca4082195d3f70a53f5a2110f109ac1d71308f4 Mon Sep 17 00:00:00 2001 From: Bob Callaway Date: Sun, 25 Jun 2023 08:10:43 -0400 Subject: [PATCH] swap killswitch for 'docker-compose restart' Signed-off-by: Bob Callaway --- cmd/rekor-server/app/root.go | 2 -- cmd/rekor-server/app/serve.go | 21 --------------------- docker-compose.test.yml | 2 -- e2e-test.sh | 3 +-- tests/e2e-test.sh | 3 +-- 5 files changed, 2 insertions(+), 29 deletions(-) diff --git a/cmd/rekor-server/app/root.go b/cmd/rekor-server/app/root.go index c91013fe9..34ba087cd 100644 --- a/cmd/rekor-server/app/root.go +++ b/cmd/rekor-server/app/root.go @@ -72,8 +72,6 @@ func init() { rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.rekor-server.yaml)") rootCmd.PersistentFlags().StringVar(&logType, "log_type", "dev", "logger type to use (dev/prod)") rootCmd.PersistentFlags().BoolVar(&enablePprof, "enable_pprof", false, "enable pprof for profiling on port 6060") - rootCmd.PersistentFlags().Bool("enable_killswitch", false, "enable killswitch for TESTING ONLY on port 2345") - _ = rootCmd.PersistentFlags().MarkHidden("enable_killswitch") rootCmd.PersistentFlags().String("trillian_log_server.address", "127.0.0.1", "Trillian log server address") rootCmd.PersistentFlags().Uint16("trillian_log_server.port", 8090, "Trillian log server port") diff --git a/cmd/rekor-server/app/serve.go b/cmd/rekor-server/app/serve.go index 51829556a..a8cc161c3 100644 --- a/cmd/rekor-server/app/serve.go +++ b/cmd/rekor-server/app/serve.go @@ -126,27 +126,6 @@ var serveCmd = &cobra.Command{ _ = srv.ListenAndServe() }() - if viper.GetBool("enable_killswitch") { - go func() { - mux := http.NewServeMux() - mux.Handle("/kill", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if err := server.Shutdown(); err != nil { - log.Logger.Error(err) - } - w.WriteHeader(http.StatusOK) - })) - - srv := &http.Server{ - Addr: ":2345", - ReadTimeout: 10 * time.Second, - WriteTimeout: 10 * time.Second, - Handler: mux, - } - - _ = srv.ListenAndServe() - }() - } - if err := server.Serve(); err != nil { log.Logger.Fatal(err) } diff --git a/docker-compose.test.yml b/docker-compose.test.yml index 0721f7229..3eaf67dde 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -31,10 +31,8 @@ services: "--rekor_server.signer=memory", "--enable_attestation_storage", "--attestation_storage_bucket=file:///var/run/attestations", - "--enable_killswitch", "--max_request_body_size=32792576", ] ports: - "3000:3000" - "2112:2112" - - "2345:2345" diff --git a/e2e-test.sh b/e2e-test.sh index 5d494e7a6..19232da04 100755 --- a/e2e-test.sh +++ b/e2e-test.sh @@ -62,8 +62,7 @@ if docker-compose logs --no-color | grep -q "panic: runtime error:" ; then fi echo "generating code coverage" -curl -X GET 0.0.0.0:2345/kill -sleep 5 +docker-compose restart rekor-server if ! docker cp $(docker ps -aqf "name=rekor_rekor-server"):go/rekor-server.cov /tmp/pkg-rekor-server.cov ; then # failed to copy code coverage report from server diff --git a/tests/e2e-test.sh b/tests/e2e-test.sh index 8bf13f356..a8472b9fb 100755 --- a/tests/e2e-test.sh +++ b/tests/e2e-test.sh @@ -65,8 +65,7 @@ if docker-compose logs --no-color | grep -q "panic: runtime error:" ; then fi echo "generating code coverage" -curl -X GET 0.0.0.0:2345/kill -sleep 5 +docker-compose restart rekor-server if ! docker cp $(docker ps -aqf "name=rekor_rekor-server"):go/rekor-server.cov /tmp/rekor-server.cov ; then # failed to copy code coverage report from server