Quellcode durchsuchen

Merge branch 'nafees/gcp-gar' into dev

Mohammed Nafees vor 3 Jahren
Ursprung
Commit
698354e6bd
1 geänderte Dateien mit 2 neuen und 31 gelöschten Zeilen
  1. 2 31
      internal/helm/postrenderer.go

+ 2 - 31
internal/helm/postrenderer.go

@@ -12,7 +12,6 @@ import (
 	"github.com/aws/aws-sdk-go/aws/arn"
 	"github.com/porter-dev/porter/internal/kubernetes"
 	"github.com/porter-dev/porter/internal/models"
-	"github.com/porter-dev/porter/internal/models/integrations"
 	"github.com/porter-dev/porter/internal/repository"
 	"golang.org/x/oauth2"
 	"gopkg.in/yaml.v2"
@@ -516,36 +515,6 @@ func (d *DockerSecretsPostRenderer) isRegistryNative(regName string) bool {
 		}
 
 		isNative = parsedARN.AccountID == eksAccountID && parsedARN.Region == eksRegion
-	} else if strings.Contains(regName, "pkg.dev") && d.Cluster.AuthMechanism == models.GCP {
-		// get the project id of the cluster
-		gcpInt, err := d.Repo.GCPIntegration().ReadGCPIntegration(d.Cluster.ProjectID, d.Cluster.GCPIntegrationID)
-
-		if err != nil {
-			return false
-		}
-
-		gkeProjectID, err := integrations.GCPProjectIDFromJSON(gcpInt.GCPKeyData)
-
-		if err != nil {
-			return false
-		}
-
-		regURL := regName
-
-		if !strings.HasSuffix(regURL, "https://") {
-			regURL = "https://" + regURL
-		}
-
-		parsedURL, err := url.Parse(regURL)
-
-		if err != nil {
-			return false
-		}
-
-		// parse the project id of the gcr url
-		regNameSlice := strings.Split(parsedURL.Path, "/")
-
-		isNative = gkeProjectID == regNameSlice[0]
 	}
 
 	return isNative
@@ -844,6 +813,8 @@ func getRegNameFromImageRef(image string) (string, error) {
 	// if registry is dockerhub, leave the image name as-is
 	if strings.Contains(domain, "docker.io") {
 		regName = "index.docker.io/" + path
+	} else if strings.Contains(domain, "pkg.dev") {
+		regName = domain + "/" + strings.Split(path, "/")[0]
 	} else {
 		regName = domain