瀏覽代碼

Merge branch 'staging' of https://github.com/porter-dev/porter into staging

Justin Rhee 3 年之前
父節點
當前提交
ee1d535178

+ 8 - 6
api/server/authz/cluster.go

@@ -95,12 +95,14 @@ func (d *OutOfClusterAgentGetter) GetOutOfClusterConfig(cluster *models.Cluster)
 }
 
 func (d *OutOfClusterAgentGetter) GetAgent(r *http.Request, cluster *models.Cluster, namespace string) (*kubernetes.Agent, error) {
-	// look for the agent in context
-	ctxAgentVal := r.Context().Value(KubernetesAgentCtxKey)
-
-	if ctxAgentVal != nil {
-		if agent, ok := ctxAgentVal.(*kubernetes.Agent); ok {
-			return agent, nil
+	// look for the agent in context if cluster isnt a capi cluster
+	if cluster.ProvisionedBy != "CAPI" {
+		ctxAgentVal := r.Context().Value(KubernetesAgentCtxKey)
+
+		if ctxAgentVal != nil {
+			if agent, ok := ctxAgentVal.(*kubernetes.Agent); ok {
+				return agent, nil
+			}
 		}
 	}
 

+ 0 - 1
api/server/handlers/project_integration/create_aws.go

@@ -65,7 +65,6 @@ func (p *CreateAWSHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 			return
 		}
 		res.CloudProviderCredentialIdentifier = credResp.Msg.TargetArn
-		fmt.Println("stefan", credResp.Msg.ProjectId, credResp.Msg.TargetArn)
 	}
 
 	p.WriteResult(w, r, res)

+ 0 - 6
api/server/handlers/project_integration/list_aws.go

@@ -72,11 +72,5 @@ func (p *ListAWSHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 		res = append(res, awsInt.ToAWSIntegrationType())
 	}
 
-	if len(awsInts) == 0 {
-		// so that the datatype stays the same on all returns
-		p.WriteResult(w, r, []types.AWSIntegration{})
-		return
-	}
-
 	p.WriteResult(w, r, res)
 }