Explorar el Código

Merge branch 'master' of github.com-meehawk:porter-dev/porter into fix/logging

Soham Parekh hace 3 años
padre
commit
f3f72a9f0b
Se han modificado 2 ficheros con 9 adiciones y 6 borrados
  1. 6 1
      api/server/handlers/registry/list_images.go
  2. 3 5
      internal/opa/config.yaml

+ 6 - 1
api/server/handlers/registry/list_images.go

@@ -1,7 +1,9 @@
 package registry
 
 import (
+	"fmt"
 	"net/http"
+	"strings"
 
 	"github.com/porter-dev/porter/api/server/handlers"
 	"github.com/porter-dev/porter/api/server/shared"
@@ -37,7 +39,10 @@ func (c *RegistryListImagesHandler) ServeHTTP(w http.ResponseWriter, r *http.Req
 
 	imgs, err := regAPI.ListImages(repoName, c.Repo(), c.Config().DOConf)
 
-	if err != nil {
+	if err != nil && strings.Contains(err.Error(), "RepositoryNotFoundException") {
+		c.HandleAPIError(w, r, apierrors.NewErrNotFound(fmt.Errorf("no such repository: %s", repoName)))
+		return
+	} else if err != nil {
 		c.HandleAPIError(w, r, apierrors.NewErrInternal(err))
 		return
 	}

+ 3 - 5
internal/opa/config.yaml

@@ -97,15 +97,13 @@ porter_agent_pod:
   policies:
   - path: "./policies/pod/running.rego"
     name: "pod.running"
-porter_agent_redis_pod:
+porter_agent_loki_pod:
   kind: "pod"
   match:
     namespace: porter-agent-system
     labels:
-      app.kubernetes.io/component: "master"
-      app.kubernetes.io/instance: "porter-agent"
-      app.kubernetes.io/managed-by: "Helm"
-      app.kubernetes.io/name: "redis"
+      app: "loki"
+      name: "porter-agent-loki"
   policies:
   - path: "./policies/pod/running.rego"
     name: "pod.running"