diff --git a/charts/connaisseur/templates/deployment.yaml b/charts/connaisseur/templates/deployment.yaml index 0e6959f87..9612ef164 100644 --- a/charts/connaisseur/templates/deployment.yaml +++ b/charts/connaisseur/templates/deployment.yaml @@ -42,13 +42,6 @@ spec: path: /ready port: https scheme: HTTPS - startupProbe: - httpGet: - path: /start - port: https - scheme: HTTPS - periodSeconds: 5 - failureThreshold: 30 securityContext: {{- toYaml .Values.kubernetes.deployment.securityContext | nindent 12 }} resources: diff --git a/cmd/connaisseur/main.go b/cmd/connaisseur/main.go index 980cd67f3..73451e4e7 100644 --- a/cmd/connaisseur/main.go +++ b/cmd/connaisseur/main.go @@ -36,7 +36,6 @@ func startServer(config *config.Config, alerting *alerting.Config) { mux.HandleFunc("/health", handler.HandleHealth) mux.HandleFunc("/ready", handler.HandleHealth) mux.HandleFunc("/mutate", handler.HandleMutate) - mux.HandleFunc("/start", handler.HandleStart) mux.HandleFunc("/metrics", promhttp.Handler().ServeHTTP) cache := caching.NewCacher() diff --git a/internal/handler/start.go b/internal/handler/start.go deleted file mode 100644 index 0f055f3c2..000000000 --- a/internal/handler/start.go +++ /dev/null @@ -1,25 +0,0 @@ -package handler - -import ( - "connaisseur/internal/caching" - "connaisseur/internal/constants" - "net/http" -) - -// HandleStart tries to ping the redis. Return 200 if successful, 503 otherwise. -func HandleStart(w http.ResponseWriter, r *http.Request) { - switch r.Method { - case http.MethodGet: - ctx := r.Context() - cache := ctx.Value(constants.Cache).(caching.Cacher) - - if err := cache.Ping(ctx); err != nil { - http.Error(w, constants.ServiceUnavailable, http.StatusServiceUnavailable) - return - } - - w.WriteHeader(http.StatusOK) - default: - http.Error(w, constants.MethodNotAllowed, http.StatusMethodNotAllowed) - } -} diff --git a/internal/handler/start_test.go b/internal/handler/start_test.go deleted file mode 100644 index 2cdd5f491..000000000 --- a/internal/handler/start_test.go +++ /dev/null @@ -1,42 +0,0 @@ -package handler - -import ( - "connaisseur/internal/constants" - "connaisseur/test/testhelper" - "context" - "net/http" - "net/http/httptest" - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestHandleStart(t *testing.T) { - handler := http.HandlerFunc(HandleStart) - - ctx := context.Background() - redis := testhelper.NewFailingCache(t, []testhelper.KeyValuePair{}, []string{}, true) - ctx = context.WithValue(ctx, constants.Cache, redis) - - req := testhelper.MockRequest("GET", ctx, nil) - resp := httptest.NewRecorder() - handler.ServeHTTP(resp, req) - - assert.Equal(t, http.StatusServiceUnavailable, resp.Code) - - ctx = context.Background() - redis = testhelper.NewFailingCache(t, []testhelper.KeyValuePair{}, []string{}, false) - ctx = context.WithValue(ctx, constants.Cache, redis) - - req = testhelper.MockRequest("GET", ctx, nil) - resp = httptest.NewRecorder() - handler.ServeHTTP(resp, req) - - assert.Equal(t, http.StatusOK, resp.Code) - - req = testhelper.MockRequest("POST", ctx, nil) - resp = httptest.NewRecorder() - handler.ServeHTTP(resp, req) - - assert.Equal(t, http.StatusMethodNotAllowed, resp.Code) -} diff --git a/internal/handler/validation/skip.go b/internal/handler/validation/skip.go index 179a3e759..a7c321b7d 100644 --- a/internal/handler/validation/skip.go +++ b/internal/handler/validation/skip.go @@ -8,6 +8,7 @@ import ( "context" "encoding/json" "fmt" + "strings" "github.com/sirupsen/logrus" ) @@ -106,6 +107,9 @@ func getCachedDigest( val, err := cache.Get(ctx, img.OriginalString()) if err != nil { + if strings.Contains(err.Error(), "dial tcp") { + logrus.Warnf("error connecting to cache: %s", err) + } return "", nil, fmt.Errorf("cache miss for image %s: %s", img.OriginalString(), err) }