Quellcode durchsuchen

Revert aws-iam-authenticator (#2602)

* revert aws change

* revert helm changes

* go mod changes

* go mod tidy
Stefan McShane vor 3 Jahren
Ursprung
Commit
96afba4c32
61 geänderte Dateien mit 15441 neuen und 784 gelöschten Zeilen
  1. 1 1
      api/client/release.go
  2. 1 1
      api/server/authz/release.go
  3. 38 28
      api/server/handlers/cluster_integration/aws/get_cluster_info.go
  4. 1 1
      api/server/handlers/namespace/create_env_group.go
  5. 2 7
      api/server/handlers/project_integration/create_aws.go
  6. 1 2
      api/server/handlers/project_integration/list_aws.go
  7. 1 2
      api/server/handlers/project_integration/overwrite_aws.go
  8. 12 6
      api/server/handlers/registry/get_token.go
  9. 1 1
      api/server/handlers/release/create.go
  10. 1 1
      api/server/handlers/release/create_addon.go
  11. 1 1
      api/server/handlers/release/create_webhook.go
  12. 1 1
      api/server/handlers/release/delete.go
  13. 1 1
      api/server/handlers/release/get.go
  14. 1 1
      api/server/handlers/release/get_all_pods.go
  15. 1 1
      api/server/handlers/release/get_components.go
  16. 1 1
      api/server/handlers/release/get_controllers.go
  17. 1 1
      api/server/handlers/release/get_job_status.go
  18. 1 1
      api/server/handlers/release/get_jobs.go
  19. 1 1
      api/server/handlers/release/get_latest_job_run.go
  20. 1 1
      api/server/handlers/release/stream_form.go
  21. 1 1
      api/server/handlers/release/update_git_action_config.go
  22. 1 1
      api/server/handlers/release/update_rollback.go
  23. 1 1
      api/server/handlers/release/upgrade.go
  24. 1 1
      api/server/handlers/stack/add_application.go
  25. 1 1
      api/server/handlers/stack/create.go
  26. 1 1
      api/server/handlers/stack/helpers.go
  27. 1 1
      api/server/handlers/v1/env_group/create.go
  28. 1 1
      api/server/handlers/v1/release/upgrade.go
  29. 1 1
      api/types/namespace.go
  30. 1 1
      api/types/release.go
  31. 1 1
      api/types/template.go
  32. 9 5
      cli/cmd/connect/ecr.go
  33. 1 1
      cli/cmd/get.go
  34. 1 1
      cli/cmd/list.go
  35. 14754 1
      dashboard/package-lock.json
  36. 85 99
      go.mod
  37. 182 162
      go.sum
  38. 4 4
      internal/helm/agent.go
  39. 3 3
      internal/helm/agent_test.go
  40. 5 5
      internal/helm/config.go
  41. 2 2
      internal/helm/loader/loader.go
  42. 3 6
      internal/helm/postrenderer.go
  43. 1 1
      internal/helm/repo/repo.go
  44. 2 2
      internal/helm/storage.go
  45. 3 3
      internal/helm/storage_test.go
  46. 1 1
      internal/kubernetes/agent.go
  47. 1 3
      internal/kubernetes/config.go
  48. 1 1
      internal/kubernetes/envgroup/create.go
  49. 159 0
      internal/models/integrations/aws.go
  50. 0 177
      internal/models/integrations/aws_v2.go
  51. 1 1
      internal/opa/opa.go
  52. 92 67
      internal/registry/registry.go
  53. 1 1
      internal/stacks/hooks.go
  54. 1 1
      internal/templater/helm/manifests/reader.go
  55. 2 2
      internal/templater/helm/values/reader.go
  56. 1 1
      internal/templater/helm/values/writer.go
  57. 2 2
      internal/templater/parser/parser.go
  58. 34 45
      provisioner/integrations/storage/s3/s3.go
  59. 8 114
      provisioner/server/handlers/state/create_resource.go
  60. 1 1
      workers/jobs/helm_revisions_count_tracker.go
  61. 1 1
      workers/utils/retry_helm_agent.go

+ 1 - 1
api/client/release.go

@@ -5,7 +5,7 @@ import (
 	"fmt"
 
 	"github.com/porter-dev/porter/api/types"
-	"github.com/stefanmcshane/helm/pkg/release"
+	"helm.sh/helm/v3/pkg/release"
 )
 
 func (c *Client) ListReleases(

+ 1 - 1
api/server/authz/release.go

@@ -11,7 +11,7 @@ import (
 	"github.com/porter-dev/porter/api/server/shared/requestutils"
 	"github.com/porter-dev/porter/api/types"
 	"github.com/porter-dev/porter/internal/models"
-	"github.com/stefanmcshane/helm/pkg/release"
+	"helm.sh/helm/v3/pkg/release"
 )
 
 type ReleaseScopedFactory struct {

+ 38 - 28
api/server/handlers/cluster_integration/aws/get_cluster_info.go

@@ -6,10 +6,9 @@ import (
 	"net/http"
 	"strings"
 
-	"github.com/aws/aws-sdk-go-v2/aws"
-	"github.com/aws/aws-sdk-go-v2/service/ec2"
-	ec2Types "github.com/aws/aws-sdk-go-v2/service/ec2/types"
-	"github.com/aws/aws-sdk-go-v2/service/eks"
+	"github.com/aws/aws-sdk-go/aws"
+	"github.com/aws/aws-sdk-go/service/ec2"
+	"github.com/aws/aws-sdk-go/service/eks"
 	"github.com/porter-dev/porter/api/server/handlers"
 	"github.com/porter-dev/porter/api/server/shared"
 	"github.com/porter-dev/porter/api/server/shared/apierrors"
@@ -34,8 +33,6 @@ func NewGetClusterInfoHandler(
 }
 
 func (c *GetClusterInfoHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
-	ctx := r.Context()
-
 	proj, _ := r.Context().Value(types.ProjectScope).(*models.Project)
 	cluster, _ := r.Context().Value(types.ClusterScope).(*models.Cluster)
 
@@ -58,19 +55,31 @@ func (c *GetClusterInfoHandler) ServeHTTP(w http.ResponseWriter, r *http.Request
 		return
 	}
 
-	// clusterName := cluster.Name
+	awsSession, err := awsInt.GetSession()
 
-	if strings.HasPrefix(cluster.Name, "arn:aws:eks:") {
-		parts := strings.Split(cluster.Name, "/")
-		cluster.Name = parts[len(parts)-1]
+	if err != nil {
+		c.HandleAPIError(w, r, apierrors.NewErrPassThroughToClient(fmt.Errorf("error fetching new session for AWS with "+
+			"project ID: %d and integration ID: %d. Error: %w", proj.ID, cluster.AWSIntegrationID, err), http.StatusConflict))
+		return
 	}
 
-	awsConf := awsInt.Config()
+	clusterName := cluster.Name
 
-	eksSvc := eks.NewFromConfig(awsConf)
+	if strings.HasPrefix(clusterName, "arn:aws:eks:") {
+		parts := strings.Split(clusterName, "/")
+		clusterName = parts[len(parts)-1]
+	}
+
+	awsConf := aws.NewConfig()
+
+	if awsInt.AWSRegion != "" {
+		awsConf = awsConf.WithRegion(awsInt.AWSRegion)
+	}
 
-	clusterInfo, err := eksSvc.DescribeCluster(ctx, &eks.DescribeClusterInput{
-		Name: &cluster.Name,
+	eksSvc := eks.New(awsSession, awsConf)
+
+	clusterInfo, err := eksSvc.DescribeCluster(&eks.DescribeClusterInput{
+		Name: &clusterName,
 	})
 
 	if err != nil || clusterInfo.Cluster == nil {
@@ -78,39 +87,40 @@ func (c *GetClusterInfoHandler) ServeHTTP(w http.ResponseWriter, r *http.Request
 		return
 	}
 
-	ec2Svc := ec2.NewFromConfig(awsConf)
+	ec2Svc := ec2.New(awsSession, awsConf)
 
 	res := &types.GetAWSClusterInfoResponse{
-		Name:       cluster.Name,
+		Name:       clusterName,
 		ARN:        *clusterInfo.Cluster.Arn,
-		Status:     string(clusterInfo.Cluster.Status),
+		Status:     *clusterInfo.Cluster.Status,
 		K8sVersion: *clusterInfo.Cluster.Version,
 		EKSVersion: *clusterInfo.Cluster.PlatformVersion,
 	}
 
-	subnetPaginate := ec2.NewDescribeSubnetsPaginator(ec2Svc, &ec2.DescribeSubnetsInput{
-		Filters: []ec2Types.Filter{
+	err = ec2Svc.DescribeSubnetsPages(&ec2.DescribeSubnetsInput{
+		Filters: []*ec2.Filter{
 			{
 				Name: aws.String("vpc-id"),
-				Values: []string{
-					*clusterInfo.Cluster.ResourcesVpcConfig.VpcId,
+				Values: []*string{
+					clusterInfo.Cluster.ResourcesVpcConfig.VpcId,
 				},
 			},
 		},
-	})
-	for subnetPaginate.HasMorePages() {
-		page, err := subnetPaginate.NextPage(ctx)
-		if err != nil {
-			continue
+	}, func(page *ec2.DescribeSubnetsOutput, lastPage bool) bool {
+		if page == nil {
+			return false
 		}
+
 		for _, subnet := range page.Subnets {
 			res.Subnets = append(res.Subnets, &types.AWSSubnet{
 				SubnetID:                *subnet.SubnetId,
 				AvailabilityZone:        *subnet.AvailabilityZone,
-				AvailableIPAddressCount: int64(*subnet.AvailableIpAddressCount),
+				AvailableIPAddressCount: *subnet.AvailableIpAddressCount,
 			})
 		}
-	}
+
+		return !lastPage
+	})
 
 	if err != nil {
 		c.HandleAPIError(w, r, apierrors.NewErrInternal(err))

+ 1 - 1
api/server/handlers/namespace/create_env_group.go

@@ -8,7 +8,7 @@ import (
 
 	"sigs.k8s.io/yaml"
 
-	"github.com/stefanmcshane/helm/pkg/release"
+	"helm.sh/helm/v3/pkg/release"
 	v1 "k8s.io/api/core/v1"
 
 	"github.com/porter-dev/porter/api/server/authz"

+ 2 - 7
api/server/handlers/project_integration/create_aws.go

@@ -1,7 +1,6 @@
 package project_integration
 
 import (
-	"context"
 	"net/http"
 
 	"github.com/porter-dev/porter/api/server/handlers"
@@ -46,18 +45,14 @@ func (p *CreateAWSHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 
-	aint := aws.ToAWSIntegrationType()
-
 	res := types.CreateAWSResponse{
-		AWSIntegration: &aint,
+		AWSIntegration: aws.ToAWSIntegrationType(),
 	}
 
 	p.WriteResult(w, r, res)
 }
 
 func CreateAWSIntegration(request *types.CreateAWSRequest, projectID, userID uint) *ints.AWSIntegration {
-	ctx := context.Background()
-
 	resp := &ints.AWSIntegration{
 		UserID:             userID,
 		ProjectID:          projectID,
@@ -69,7 +64,7 @@ func CreateAWSIntegration(request *types.CreateAWSRequest, projectID, userID uin
 	}
 
 	// attempt to populate the ARN
-	resp.PopulateAWSArn(ctx)
+	resp.PopulateAWSArn()
 
 	return resp
 }

+ 1 - 2
api/server/handlers/project_integration/list_aws.go

@@ -37,8 +37,7 @@ func (p *ListAWSHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 	var res types.ListAWSResponse = make([]*types.AWSIntegration, 0)
 
 	for _, awsInt := range awsInts {
-		aint := awsInt.ToAWSIntegrationType()
-		res = append(res, &aint)
+		res = append(res, awsInt.ToAWSIntegrationType())
 	}
 
 	p.WriteResult(w, r, res)

+ 1 - 2
api/server/handlers/project_integration/overwrite_aws.go

@@ -73,10 +73,9 @@ func (p *OverwriteAWSHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
 	}
 
 	// app.Logger.Info().Msgf("AWS integration overwritten: %d", awsIntegration.ID)
-	aint := awsIntegration.ToAWSIntegrationType()
 
 	res := types.OverwriteAWSResponse{
-		AWSIntegration: &aint,
+		AWSIntegration: awsIntegration.ToAWSIntegrationType(),
 	}
 
 	p.WriteResult(w, r, res)

+ 12 - 6
api/server/handlers/registry/get_token.go

@@ -6,7 +6,7 @@ import (
 	"strings"
 	"time"
 
-	"github.com/aws/aws-sdk-go-v2/service/ecr"
+	"github.com/aws/aws-sdk-go/service/ecr"
 	"github.com/porter-dev/porter/api/server/handlers"
 	"github.com/porter-dev/porter/api/server/shared"
 	"github.com/porter-dev/porter/api/server/shared/apierrors"
@@ -16,7 +16,7 @@ import (
 	"github.com/porter-dev/porter/internal/oauth"
 	"github.com/porter-dev/porter/internal/registry"
 
-	"github.com/aws/aws-sdk-go-v2/aws/arn"
+	"github.com/aws/aws-sdk-go/aws/arn"
 )
 
 type RegistryGetECRTokenHandler struct {
@@ -34,7 +34,6 @@ func NewRegistryGetECRTokenHandler(
 }
 
 func (c *RegistryGetECRTokenHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
-	ctx := r.Context()
 	proj, _ := r.Context().Value(types.ProjectScope).(*models.Project)
 
 	request := &types.GetRegistryECRTokenRequest{}
@@ -65,7 +64,7 @@ func (c *RegistryGetECRTokenHandler) ServeHTTP(w http.ResponseWriter, r *http.Re
 
 			// if the aws integration doesn't have an ARN populated, populate it
 			if awsInt.AWSArn == "" {
-				err = awsInt.PopulateAWSArn(ctx)
+				err = awsInt.PopulateAWSArn()
 
 				if err != nil {
 					continue
@@ -81,9 +80,16 @@ func (c *RegistryGetECRTokenHandler) ServeHTTP(w http.ResponseWriter, r *http.Re
 			// if the account id is passed as part of the request, verify the account id matches the account id in the ARN
 			if awsInt.AWSRegion == request.Region && (request.AccountID == "" || request.AccountID == parsedARN.AccountID) {
 				// get the aws integration and session
-				ecrSvc := ecr.NewFromConfig(awsInt.Config())
+				sess, err := awsInt.GetSession()
 
-				output, err := ecrSvc.GetAuthorizationToken(ctx, &ecr.GetAuthorizationTokenInput{})
+				if err != nil {
+					c.HandleAPIError(w, r, apierrors.NewErrInternal(err))
+					return
+				}
+
+				ecrSvc := ecr.New(sess)
+
+				output, err := ecrSvc.GetAuthorizationToken(&ecr.GetAuthorizationTokenInput{})
 
 				if err != nil {
 					c.HandleAPIError(w, r, apierrors.NewErrInternal(err))

+ 1 - 1
api/server/handlers/release/create.go

@@ -25,9 +25,9 @@ import (
 	"github.com/porter-dev/porter/internal/models"
 	"github.com/porter-dev/porter/internal/oauth"
 	"github.com/porter-dev/porter/internal/registry"
-	"github.com/stefanmcshane/helm/pkg/release"
 	"golang.org/x/crypto/bcrypt"
 	"gopkg.in/yaml.v2"
+	"helm.sh/helm/v3/pkg/release"
 	v1 "k8s.io/api/core/v1"
 )
 

+ 1 - 1
api/server/handlers/release/create_addon.go

@@ -15,7 +15,7 @@ import (
 	"github.com/porter-dev/porter/internal/helm/loader"
 	"github.com/porter-dev/porter/internal/models"
 	"github.com/porter-dev/porter/internal/oauth"
-	"github.com/stefanmcshane/helm/pkg/chart"
+	"helm.sh/helm/v3/pkg/chart"
 )
 
 type CreateAddonHandler struct {

+ 1 - 1
api/server/handlers/release/create_webhook.go

@@ -9,7 +9,7 @@ import (
 	"github.com/porter-dev/porter/api/server/shared/config"
 	"github.com/porter-dev/porter/api/types"
 	"github.com/porter-dev/porter/internal/models"
-	"github.com/stefanmcshane/helm/pkg/release"
+	"helm.sh/helm/v3/pkg/release"
 )
 
 type CreateWebhookHandler struct {

+ 1 - 1
api/server/handlers/release/delete.go

@@ -13,7 +13,7 @@ import (
 	"github.com/porter-dev/porter/api/types"
 	"github.com/porter-dev/porter/internal/integrations/ci/gitlab"
 	"github.com/porter-dev/porter/internal/models"
-	"github.com/stefanmcshane/helm/pkg/release"
+	"helm.sh/helm/v3/pkg/release"
 )
 
 type DeleteReleaseHandler struct {

+ 1 - 1
api/server/handlers/release/get.go

@@ -13,8 +13,8 @@ import (
 	"github.com/porter-dev/porter/internal/helm/loader"
 	"github.com/porter-dev/porter/internal/models"
 	"github.com/porter-dev/porter/internal/templater/parser"
-	"github.com/stefanmcshane/helm/pkg/release"
 	"gorm.io/gorm"
+	"helm.sh/helm/v3/pkg/release"
 )
 
 type ReleaseGetHandler struct {

+ 1 - 1
api/server/handlers/release/get_all_pods.go

@@ -14,7 +14,7 @@ import (
 	"github.com/porter-dev/porter/internal/helm/grapher"
 	"github.com/porter-dev/porter/internal/kubernetes"
 	"github.com/porter-dev/porter/internal/models"
-	"github.com/stefanmcshane/helm/pkg/release"
+	"helm.sh/helm/v3/pkg/release"
 	v1 "k8s.io/api/core/v1"
 )
 

+ 1 - 1
api/server/handlers/release/get_components.go

@@ -9,7 +9,7 @@ import (
 	"github.com/porter-dev/porter/api/server/shared/config"
 	"github.com/porter-dev/porter/api/types"
 	"github.com/porter-dev/porter/internal/helm/grapher"
-	"github.com/stefanmcshane/helm/pkg/release"
+	"helm.sh/helm/v3/pkg/release"
 )
 
 type GetComponentsHandler struct {

+ 1 - 1
api/server/handlers/release/get_controllers.go

@@ -15,7 +15,7 @@ import (
 	"github.com/porter-dev/porter/internal/helm/grapher"
 	"github.com/porter-dev/porter/internal/kubernetes"
 	"github.com/porter-dev/porter/internal/models"
-	"github.com/stefanmcshane/helm/pkg/release"
+	"helm.sh/helm/v3/pkg/release"
 
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 )

+ 1 - 1
api/server/handlers/release/get_job_status.go

@@ -10,7 +10,7 @@ import (
 	"github.com/porter-dev/porter/api/server/shared/config"
 	"github.com/porter-dev/porter/api/types"
 	"github.com/porter-dev/porter/internal/models"
-	"github.com/stefanmcshane/helm/pkg/release"
+	"helm.sh/helm/v3/pkg/release"
 )
 
 type GetJobsStatusHandler struct {

+ 1 - 1
api/server/handlers/release/get_jobs.go

@@ -12,7 +12,7 @@ import (
 	"github.com/porter-dev/porter/api/types"
 	"github.com/porter-dev/porter/internal/kubernetes"
 	"github.com/porter-dev/porter/internal/models"
-	"github.com/stefanmcshane/helm/pkg/release"
+	"helm.sh/helm/v3/pkg/release"
 )
 
 type GetJobsHandler struct {

+ 1 - 1
api/server/handlers/release/get_latest_job_run.go

@@ -10,7 +10,7 @@ import (
 	"github.com/porter-dev/porter/api/server/shared/config"
 	"github.com/porter-dev/porter/api/types"
 	"github.com/porter-dev/porter/internal/models"
-	"github.com/stefanmcshane/helm/pkg/release"
+	"helm.sh/helm/v3/pkg/release"
 )
 
 type GetLatestJobRunHandler struct {

+ 1 - 1
api/server/handlers/release/stream_form.go

@@ -14,7 +14,7 @@ import (
 	"github.com/porter-dev/porter/api/types"
 	"github.com/porter-dev/porter/internal/models"
 	"github.com/porter-dev/porter/internal/templater/parser"
-	"github.com/stefanmcshane/helm/pkg/release"
+	"helm.sh/helm/v3/pkg/release"
 )
 
 type StreamFormHandler struct {

+ 1 - 1
api/server/handlers/release/update_git_action_config.go

@@ -9,8 +9,8 @@ import (
 	"github.com/porter-dev/porter/api/server/shared/config"
 	"github.com/porter-dev/porter/api/types"
 	"github.com/porter-dev/porter/internal/models"
-	"github.com/stefanmcshane/helm/pkg/release"
 	"gorm.io/gorm"
+	"helm.sh/helm/v3/pkg/release"
 )
 
 type UpdateGitActionConfigHandler struct {

+ 1 - 1
api/server/handlers/release/update_rollback.go

@@ -12,7 +12,7 @@ import (
 	"github.com/porter-dev/porter/api/server/shared/config"
 	"github.com/porter-dev/porter/api/types"
 	"github.com/porter-dev/porter/internal/models"
-	"github.com/stefanmcshane/helm/pkg/release"
+	"helm.sh/helm/v3/pkg/release"
 )
 
 type RollbackReleaseHandler struct {

+ 1 - 1
api/server/handlers/release/upgrade.go

@@ -18,7 +18,7 @@ import (
 	"github.com/porter-dev/porter/internal/notifier"
 	"github.com/porter-dev/porter/internal/notifier/slack"
 	"github.com/porter-dev/porter/internal/stacks"
-	"github.com/stefanmcshane/helm/pkg/release"
+	"helm.sh/helm/v3/pkg/release"
 )
 
 var (

+ 1 - 1
api/server/handlers/stack/add_application.go

@@ -14,7 +14,7 @@ import (
 	"github.com/porter-dev/porter/api/types"
 	"github.com/porter-dev/porter/internal/models"
 	"github.com/porter-dev/porter/internal/stacks"
-	helmrelease "github.com/stefanmcshane/helm/pkg/release"
+	helmrelease "helm.sh/helm/v3/pkg/release"
 )
 
 type StackAddApplicationHandler struct {

+ 1 - 1
api/server/handlers/stack/create.go

@@ -16,7 +16,7 @@ import (
 	"github.com/porter-dev/porter/internal/kubernetes/envgroup"
 	"github.com/porter-dev/porter/internal/models"
 
-	helmrelease "github.com/stefanmcshane/helm/pkg/release"
+	helmrelease "helm.sh/helm/v3/pkg/release"
 )
 
 type StackCreateHandler struct {

+ 1 - 1
api/server/handlers/stack/helpers.go

@@ -6,7 +6,7 @@ import (
 	"github.com/porter-dev/porter/internal/helm"
 	"github.com/porter-dev/porter/internal/helm/loader"
 	"github.com/porter-dev/porter/internal/models"
-	"github.com/stefanmcshane/helm/pkg/release"
+	"helm.sh/helm/v3/pkg/release"
 )
 
 type applyAppResourceOpts struct {

+ 1 - 1
api/server/handlers/v1/env_group/create.go

@@ -8,7 +8,7 @@ import (
 
 	"sigs.k8s.io/yaml"
 
-	"github.com/stefanmcshane/helm/pkg/release"
+	"helm.sh/helm/v3/pkg/release"
 	v1 "k8s.io/api/core/v1"
 
 	"github.com/porter-dev/porter/api/server/authz"

+ 1 - 1
api/server/handlers/v1/release/upgrade.go

@@ -18,7 +18,7 @@ import (
 	"github.com/porter-dev/porter/internal/models"
 	"github.com/porter-dev/porter/internal/notifier"
 	"github.com/porter-dev/porter/internal/notifier/slack"
-	"github.com/stefanmcshane/helm/pkg/release"
+	"helm.sh/helm/v3/pkg/release"
 )
 
 var (

+ 1 - 1
api/types/namespace.go

@@ -3,7 +3,7 @@ package types
 import (
 	"time"
 
-	"github.com/stefanmcshane/helm/pkg/action"
+	"helm.sh/helm/v3/pkg/action"
 	v1 "k8s.io/api/core/v1"
 )
 

+ 1 - 1
api/types/release.go

@@ -1,7 +1,7 @@
 package types
 
 import (
-	"github.com/stefanmcshane/helm/pkg/release"
+	"helm.sh/helm/v3/pkg/release"
 	v1 "k8s.io/api/core/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 )

+ 1 - 1
api/types/template.go

@@ -2,7 +2,7 @@ package types
 
 import (
 	"github.com/porter-dev/porter/internal/helm/upgrade"
-	"github.com/stefanmcshane/helm/pkg/chart"
+	"helm.sh/helm/v3/pkg/chart"
 )
 
 const (

+ 9 - 5
cli/cmd/connect/ecr.go

@@ -9,7 +9,7 @@ import (
 
 	"github.com/porter-dev/porter/api/types"
 
-	"github.com/aws/aws-sdk-go-v2/service/ecr"
+	"github.com/aws/aws-sdk-go/service/ecr"
 	"github.com/fatih/color"
 	api "github.com/porter-dev/porter/api/client"
 	"github.com/porter-dev/porter/cli/cmd/utils"
@@ -154,18 +154,22 @@ func linkRegistry(client *api.Client, projectID uint, intID uint) (uint, error)
 }
 
 func waitForAuthorizationToken(region string, creds *aws.PorterAWSCredentials) error {
-	ctx := context.Background()
-
 	awsInt := &integrations.AWSIntegration{
 		AWSRegion:          region,
 		AWSAccessKeyID:     []byte(creds.AWSAccessKeyID),
 		AWSSecretAccessKey: []byte(creds.AWSSecretAccessKey),
 	}
 
-	ecrSvc := ecr.NewFromConfig(awsInt.Config())
+	sess, err := awsInt.GetSession()
+
+	if err != nil {
+		return err
+	}
+
+	ecrSvc := ecr.New(sess)
 
 	for i := 0; i < 30; i++ {
-		_, err := ecrSvc.GetAuthorizationToken(ctx, &ecr.GetAuthorizationTokenInput{})
+		_, err := ecrSvc.GetAuthorizationToken(&ecr.GetAuthorizationTokenInput{})
 
 		if err == nil {
 			return nil

+ 1 - 1
cli/cmd/get.go

@@ -9,8 +9,8 @@ import (
 	api "github.com/porter-dev/porter/api/client"
 	"github.com/porter-dev/porter/api/types"
 	"github.com/spf13/cobra"
-	"github.com/stefanmcshane/helm/pkg/time"
 	"gopkg.in/yaml.v2"
+	"helm.sh/helm/v3/pkg/time"
 )
 
 // getCmd represents the "porter get" base command when called

+ 1 - 1
cli/cmd/list.go

@@ -10,7 +10,7 @@ import (
 	api "github.com/porter-dev/porter/api/client"
 	"github.com/porter-dev/porter/api/types"
 	"github.com/spf13/cobra"
-	"github.com/stefanmcshane/helm/pkg/release"
+	"helm.sh/helm/v3/pkg/release"
 )
 
 var allNamespaces bool

Datei-Diff unterdrückt, da er zu groß ist
+ 14754 - 1
dashboard/package-lock.json


+ 85 - 99
go.mod

@@ -3,11 +3,11 @@ module github.com/porter-dev/porter
 go 1.18
 
 require (
-	cloud.google.com/go v0.104.0 // indirect
+	cloud.google.com/go v0.102.0 // indirect
 	github.com/AlecAivazis/survey/v2 v2.2.9
-	github.com/Masterminds/semver/v3 v3.2.0
-	github.com/aws/aws-sdk-go v1.44.143
-	github.com/bradleyfalzon/ghinstallation/v2 v2.0.4
+	github.com/Masterminds/semver/v3 v3.1.1
+	github.com/aws/aws-sdk-go v1.44.160
+	github.com/bradleyfalzon/ghinstallation/v2 v2.0.3
 	github.com/buildpacks/pack v0.27.0
 	github.com/cli/cli v1.11.0
 	github.com/dgrijalva/jwt-go v3.2.0+incompatible
@@ -33,8 +33,8 @@ require (
 	github.com/gorilla/websocket v1.4.2
 	github.com/itchyny/gojq v0.12.1
 	github.com/joeshaw/envdecode v0.0.0-20200121155833-099f1fc765bd
-	github.com/kris-nova/logger v0.2.1
-	github.com/mitchellh/mapstructure v1.5.0
+	github.com/kris-nova/logger v0.0.0-20181127235838-fd0d87064b06
+	github.com/mitchellh/mapstructure v1.4.3
 	github.com/moby/moby v20.10.6+incompatible
 	github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6
 	github.com/opencontainers/image-spec v1.0.3-0.20220114050600-8b9d41f48198
@@ -42,100 +42,84 @@ require (
 	github.com/porter-dev/switchboard v0.0.0-20221019155755-67ff2bf04935
 	github.com/rs/zerolog v1.26.0
 	github.com/sendgrid/sendgrid-go v3.8.0+incompatible
-	github.com/spf13/cobra v1.6.1
+	github.com/spf13/cobra v1.5.0
 	github.com/spf13/pflag v1.0.5
-	github.com/spf13/viper v1.13.0
-	github.com/stretchr/testify v1.8.1
-	golang.org/x/crypto v0.3.0
-	golang.org/x/net v0.2.0
-	golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1
-	google.golang.org/api v0.97.0
-	google.golang.org/genproto v0.0.0-20220926220553-6981cbe3cfce
+	github.com/spf13/viper v1.10.0
+	github.com/stretchr/testify v1.8.0
+	golang.org/x/crypto v0.4.0
+	golang.org/x/net v0.4.0
+	golang.org/x/oauth2 v0.3.0
+	google.golang.org/api v0.88.0
+	google.golang.org/genproto v0.0.0-20220628213854-d9e0b6570c03
 	google.golang.org/grpc v1.49.0
 	google.golang.org/protobuf v1.28.1
-	gorm.io/driver/sqlite v1.1.3
-	gorm.io/gorm v1.22.3
-	k8s.io/api v0.25.2
-	k8s.io/apimachinery v0.25.2
-	k8s.io/cli-runtime v0.25.2
-	k8s.io/client-go v0.25.2
+	gorm.io/driver/sqlite v1.4.3
+	gorm.io/gorm v1.24.2
+	helm.sh/helm/v3 v3.9.0
+	k8s.io/api v0.26.0
+	k8s.io/apimachinery v0.26.0
+	k8s.io/cli-runtime v0.24.2
+	k8s.io/client-go v0.26.0
 	k8s.io/helm v2.17.0+incompatible
-	k8s.io/kubectl v0.25.2
+	k8s.io/kubectl v0.24.1
+	sigs.k8s.io/aws-iam-authenticator v0.6.1
 	sigs.k8s.io/yaml v1.3.0
 )
 
 require (
-	cloud.google.com/go/artifactregistry v1.6.0
-	cloud.google.com/go/iam v0.5.0
+	cloud.google.com/go/artifactregistry v1.3.0
+	cloud.google.com/go/iam v0.3.0
 	github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.1
 	github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry v0.5.0
-	github.com/aws/aws-sdk-go-v2 v1.17.2
-	github.com/aws/aws-sdk-go-v2/credentials v1.13.4
-	github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.43
-	github.com/aws/aws-sdk-go-v2/service/ec2 v1.72.0
-	github.com/aws/aws-sdk-go-v2/service/ecr v1.17.5
-	github.com/aws/aws-sdk-go-v2/service/eks v1.25.0
-	github.com/aws/aws-sdk-go-v2/service/s3 v1.29.5
-	github.com/aws/aws-sdk-go-v2/service/sts v1.17.6
-	github.com/aws/smithy-go v1.13.5
 	github.com/briandowns/spinner v1.18.1
 	github.com/open-policy-agent/opa v0.44.0
 	github.com/santhosh-tekuri/jsonschema/v5 v5.0.1
-	github.com/stefanmcshane/helm v0.0.0-20221213002717-88a4a2c6e77d
 	github.com/xanzy/go-gitlab v0.68.0
 	go.uber.org/goleak v1.1.12
 	gopkg.in/segmentio/analytics-go.v3 v3.1.0
 	gopkg.in/yaml.v2 v2.4.0
-	gorm.io/driver/postgres v1.2.3
+	gorm.io/driver/postgres v1.4.5
 	istio.io/client-go v1.16.0
 )
 
 require (
-	cloud.google.com/go/compute v1.10.0 // indirect
-	github.com/Azure/azure-sdk-for-go v66.0.0+incompatible // indirect
+	cloud.google.com/go/compute v1.7.0 // indirect
+	github.com/Azure/azure-sdk-for-go v65.0.0+incompatible // indirect
 	github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 // indirect
 	github.com/Azure/go-autorest/autorest/azure/auth v0.5.11 // indirect
 	github.com/Azure/go-autorest/autorest/azure/cli v0.4.5 // indirect
 	github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect
 	github.com/OneOfOne/xxhash v1.2.8 // indirect
 	github.com/agnivade/levenshtein v1.1.1 // indirect
-	github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10 // indirect
-	github.com/aws/aws-sdk-go-v2/config v1.18.4 // indirect
-	github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.20 // indirect
-	github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.26 // indirect
-	github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.20 // indirect
-	github.com/aws/aws-sdk-go-v2/internal/ini v1.3.27 // indirect
-	github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.17 // indirect
+	github.com/aws/aws-sdk-go-v2 v1.16.4 // indirect
+	github.com/aws/aws-sdk-go-v2/config v1.15.9 // indirect
+	github.com/aws/aws-sdk-go-v2/credentials v1.12.4 // indirect
+	github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.5 // indirect
+	github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.11 // indirect
+	github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.5 // indirect
+	github.com/aws/aws-sdk-go-v2/internal/ini v1.3.12 // indirect
+	github.com/aws/aws-sdk-go-v2/service/ecr v1.17.5 // indirect
 	github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.13.5 // indirect
-	github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.11 // indirect
-	github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.21 // indirect
-	github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.20 // indirect
-	github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.20 // indirect
-	github.com/aws/aws-sdk-go-v2/service/sso v1.11.26 // indirect
-	github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.9 // indirect
+	github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.5 // indirect
+	github.com/aws/aws-sdk-go-v2/service/sso v1.11.7 // indirect
+	github.com/aws/aws-sdk-go-v2/service/sts v1.16.6 // indirect
+	github.com/aws/smithy-go v1.11.2 // indirect
 	github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20220517224237-e6f29200ae04 // indirect
 	github.com/chrismellard/docker-credential-acr-env v0.0.0-20220327082430-c57b701bfc08 // indirect
 	github.com/dimchansky/utfbom v1.1.1 // indirect
-	github.com/elazarl/goproxy v0.0.0-20190421051319-9d40249d3c2f // indirect
-	github.com/emicklei/go-restful/v3 v3.8.0 // indirect
+	github.com/emicklei/go-restful/v3 v3.9.0 // indirect
 	github.com/go-gorp/gorp/v3 v3.0.2 // indirect
 	github.com/golang-jwt/jwt v3.2.1+incompatible // indirect
 	github.com/google/gnostic v0.6.9 // indirect
 	github.com/googleapis/enterprise-certificate-proxy v0.1.0 // indirect
 	github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
 	github.com/hashicorp/go-retryablehttp v0.7.1 // indirect
-	github.com/kris-nova/novaarchive v0.0.0-20210219195539-c7c1cabb2577 // indirect
 	github.com/kylelemons/godebug v1.1.0 // indirect
 	github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
-	github.com/onsi/ginkgo/v2 v2.5.1 // indirect
-	github.com/onsi/gomega v1.24.1 // indirect
-	github.com/pelletier/go-toml/v2 v2.0.5 // indirect
 	github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect
 	github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
-	github.com/rogpeppe/go-internal v1.9.0 // indirect
 	github.com/tchap/go-patricia/v2 v2.3.1 // indirect
 	github.com/yashtewari/glob-intersection v0.1.0 // indirect
-	golang.org/x/tools v0.3.0 // indirect
 	istio.io/api v0.0.0-20221109202042-b9e5d446a83d // indirect
 )
 
@@ -143,16 +127,16 @@ require (
 	github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0
 	github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
 	github.com/Azure/go-autorest v14.2.0+incompatible // indirect
-	github.com/Azure/go-autorest/autorest v0.11.28 // indirect
+	github.com/Azure/go-autorest/autorest v0.11.27 // indirect
 	github.com/Azure/go-autorest/autorest/adal v0.9.20 // indirect
 	github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
 	github.com/Azure/go-autorest/logger v0.2.1 // indirect
 	github.com/Azure/go-autorest/tracing v0.6.0 // indirect
-	github.com/BurntSushi/toml v1.2.1 // indirect
+	github.com/BurntSushi/toml v1.1.0 // indirect
 	github.com/MakeNowJust/heredoc v1.0.0 // indirect
 	github.com/Masterminds/goutils v1.1.1 // indirect
 	github.com/Masterminds/semver v1.5.0 // indirect
-	github.com/Masterminds/sprig/v3 v3.2.3 // indirect
+	github.com/Masterminds/sprig/v3 v3.2.2 // indirect
 	github.com/Masterminds/squirrel v1.5.3 // indirect
 	github.com/Microsoft/go-winio v0.5.2 // indirect
 	github.com/Microsoft/hcsshim v0.9.4 // indirect
@@ -161,12 +145,12 @@ require (
 	github.com/beorn7/perks v1.0.1 // indirect
 	github.com/buildpacks/imgutil v0.0.0-20220527150729-7a271a852e31 // indirect
 	github.com/buildpacks/lifecycle v0.14.1 // indirect
-	github.com/cespare/xxhash/v2 v2.1.2 // indirect
-	github.com/chai2010/gettext-go v1.0.2 // indirect
+	github.com/cespare/xxhash/v2 v2.2.0 // indirect
+	github.com/chai2010/gettext-go v0.0.0-20160711120539-c6fed771bfd5 // indirect
 	github.com/cli/safeexec v1.0.0 // indirect
 	github.com/containerd/cgroups v1.0.3 // indirect
 	github.com/containerd/containerd v1.6.8 // indirect
-	github.com/containerd/stargz-snapshotter/estargz v0.12.0 // indirect
+	github.com/containerd/stargz-snapshotter/estargz v0.11.4 // indirect
 	github.com/cyphar/filepath-securejoin v0.2.3 // indirect
 	github.com/davecgh/go-spew v1.1.1 // indirect
 	github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
@@ -188,57 +172,59 @@ require (
 	github.com/go-playground/locales v0.13.0 // indirect
 	github.com/go-playground/universal-translator v0.17.0 // indirect
 	github.com/gobwas/glob v0.2.3 // indirect
+	github.com/gofrs/flock v0.8.1 // indirect
 	github.com/gogo/protobuf v1.3.2 // indirect
 	github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
 	github.com/google/btree v1.1.2 // indirect
 	github.com/google/go-cmp v0.5.9 // indirect
-	github.com/google/go-containerregistry v0.11.0 // indirect
+	github.com/google/go-containerregistry v0.9.0 // indirect
 	github.com/google/go-querystring v1.1.0 // indirect
 	github.com/google/gofuzz v1.2.0 // indirect
 	github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
 	github.com/google/uuid v1.3.0
-	github.com/googleapis/gax-go/v2 v2.5.1 // indirect
+	github.com/googleapis/gax-go/v2 v2.4.0 // indirect
 	github.com/gorilla/mux v1.8.0 // indirect
 	github.com/gosuri/uitable v0.0.4 // indirect
 	github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
 	github.com/hashicorp/hcl v1.0.0 // indirect
 	github.com/heroku/color v0.0.6 // indirect
-	github.com/huandu/xstrings v1.3.3 // indirect
+	github.com/huandu/xstrings v1.3.2 // indirect
 	github.com/imdario/mergo v0.3.13 // indirect
-	github.com/inconshreveable/mousetrap v1.0.1 // indirect
+	github.com/inconshreveable/mousetrap v1.0.0 // indirect
 	github.com/itchyny/astgen-go v0.0.0-20210113000433-0da0671862a3 // indirect
 	github.com/itchyny/timefmt-go v0.1.1 // indirect
 	github.com/jackc/chunkreader/v2 v2.0.1 // indirect
-	github.com/jackc/pgconn v1.10.1 // indirect
+	github.com/jackc/pgconn v1.13.0 // indirect
 	github.com/jackc/pgio v1.0.0 // indirect
 	github.com/jackc/pgpassfile v1.0.0 // indirect
-	github.com/jackc/pgproto3/v2 v2.2.0 // indirect
+	github.com/jackc/pgproto3/v2 v2.3.1 // indirect
 	github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
-	github.com/jackc/pgtype v1.9.0 // indirect
-	github.com/jackc/pgx/v4 v4.14.0 // indirect
+	github.com/jackc/pgtype v1.13.0 // indirect
+	github.com/jackc/pgx/v4 v4.17.2 // indirect
 	github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
 	github.com/jinzhu/inflection v1.0.0 // indirect
-	github.com/jinzhu/now v1.1.2 // indirect
+	github.com/jinzhu/now v1.1.5 // indirect
 	github.com/jmespath/go-jmespath v0.4.0 // indirect
 	github.com/jmoiron/sqlx v1.3.5 // indirect
 	github.com/josharian/intern v1.0.0 // indirect
 	github.com/json-iterator/go v1.1.12 // indirect
 	github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
 	github.com/kevinburke/ssh_config v1.2.0 // indirect
-	github.com/klauspost/compress v1.15.8 // indirect
+	github.com/klauspost/compress v1.15.7 // indirect
+	github.com/kris-nova/lolgopher v0.0.0-20180921204813-313b3abb0d9b // indirect
 	github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
 	github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
 	github.com/leodido/go-urn v1.2.0 // indirect
-	github.com/lib/pq v1.10.7 // indirect
+	github.com/lib/pq v1.10.6 // indirect
 	github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
 	github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
-	github.com/magiconair/properties v1.8.6 // indirect
+	github.com/magiconair/properties v1.8.5 // indirect
 	github.com/mailru/easyjson v0.7.7 // indirect
-	github.com/mattn/go-colorable v0.1.13 // indirect
-	github.com/mattn/go-isatty v0.0.16 // indirect
+	github.com/mattn/go-colorable v0.1.12 // indirect
+	github.com/mattn/go-isatty v0.0.14 // indirect
 	github.com/mattn/go-runewidth v0.0.13 // indirect
-	github.com/mattn/go-sqlite3 v1.14.15 // indirect
-	github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
+	github.com/mattn/go-sqlite3 v1.14.16 // indirect
+	github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
 	github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
 	github.com/mitchellh/copystructure v1.2.0 // indirect
 	github.com/mitchellh/go-homedir v1.1.0 // indirect
@@ -260,13 +246,13 @@ require (
 	github.com/pelletier/go-toml v1.9.5 // indirect
 	github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
 	github.com/pmezard/go-difflib v1.0.0 // indirect
-	github.com/prometheus/client_golang v1.13.0 // indirect
-	github.com/prometheus/client_model v0.2.0 // indirect
-	github.com/prometheus/common v0.37.0 // indirect
+	github.com/prometheus/client_golang v1.14.0 // indirect
+	github.com/prometheus/client_model v0.3.0 // indirect
+	github.com/prometheus/common v0.39.0 // indirect
 	github.com/prometheus/procfs v0.8.0 // indirect
 	github.com/rivo/tview v0.0.0-20220307222120-9994674d60a8 // indirect
 	github.com/rivo/uniseg v0.2.0 // indirect
-	github.com/rubenv/sql-migrate v1.2.0 // indirect
+	github.com/rubenv/sql-migrate v1.1.2 // indirect
 	github.com/russross/blackfriday v1.6.0 // indirect
 	github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 // indirect
 	github.com/segmentio/backo-go v0.0.0-20200129164019-23eae7c10bd3 // indirect
@@ -274,11 +260,11 @@ require (
 	github.com/sergi/go-diff v1.2.0 // indirect
 	github.com/shopspring/decimal v1.3.1 // indirect
 	github.com/sirupsen/logrus v1.9.0 // indirect
-	github.com/spf13/afero v1.9.3 // indirect
+	github.com/spf13/afero v1.6.0 // indirect
 	github.com/spf13/cast v1.5.0 // indirect
 	github.com/spf13/jwalterweatherman v1.1.0 // indirect
 	github.com/src-d/gcfg v1.4.0 // indirect
-	github.com/subosito/gotenv v1.4.1 // indirect
+	github.com/subosito/gotenv v1.2.0 // indirect
 	github.com/vbatts/tar-split v0.11.2 // indirect
 	github.com/xanzy/ssh-agent v0.3.1 // indirect
 	github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
@@ -288,28 +274,28 @@ require (
 	github.com/xtgo/uuid v0.0.0-20140804021211-a0b114877d4c // indirect
 	go.opencensus.io v0.23.0 // indirect
 	go.starlark.net v0.0.0-20220328144851-d1966c6b9fcd // indirect
-	golang.org/x/mod v0.7.0 // indirect
-	golang.org/x/sync v0.1.0 // indirect
-	golang.org/x/sys v0.2.0 // indirect
-	golang.org/x/term v0.2.0 // indirect
-	golang.org/x/text v0.4.0 // indirect
+	golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
+	golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect
+	golang.org/x/sys v0.3.0 // indirect
+	golang.org/x/term v0.3.0 // indirect
+	golang.org/x/text v0.5.0 // indirect
 	golang.org/x/time v0.0.0-20220609170525-579cf78fd858 // indirect
 	google.golang.org/appengine v1.6.7 // indirect
 	gopkg.in/inf.v0 v0.9.1 // indirect
-	gopkg.in/ini.v1 v1.67.0 // indirect
+	gopkg.in/ini.v1 v1.66.2 // indirect
 	gopkg.in/src-d/go-billy.v4 v4.3.2 // indirect
 	gopkg.in/src-d/go-git.v4 v4.13.1 // indirect
 	gopkg.in/warnings.v0 v0.1.2 // indirect
 	gopkg.in/yaml.v3 v3.0.1 // indirect
-	k8s.io/apiextensions-apiserver v0.25.2 // indirect
-	k8s.io/apiserver v0.25.2 // indirect
-	k8s.io/component-base v0.25.2 // indirect
+	k8s.io/apiextensions-apiserver v0.24.2 // indirect
+	k8s.io/apiserver v0.24.2 // indirect
+	k8s.io/component-base v0.24.2 // indirect
 	k8s.io/klog/v2 v2.80.1 // indirect
-	k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 // indirect
-	k8s.io/utils v0.0.0-20220922104903-7796b5f52b7e // indirect
+	k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 // indirect
+	k8s.io/utils v0.0.0-20221128185143-99ec85e7a448 // indirect
 	oras.land/oras-go v1.2.0 // indirect
-	sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
-	sigs.k8s.io/kustomize/api v0.12.1 // indirect
-	sigs.k8s.io/kustomize/kyaml v0.13.9 // indirect
+	sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
+	sigs.k8s.io/kustomize/api v0.11.5 // indirect
+	sigs.k8s.io/kustomize/kyaml v0.13.7 // indirect
 	sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
 )

Datei-Diff unterdrückt, da er zu groß ist
+ 182 - 162
go.sum


+ 4 - 4
internal/helm/agent.go

@@ -10,11 +10,11 @@ import (
 
 	"github.com/pkg/errors"
 	"github.com/porter-dev/porter/internal/helm/loader"
-	"github.com/stefanmcshane/helm/pkg/action"
-	"github.com/stefanmcshane/helm/pkg/chart"
-	"github.com/stefanmcshane/helm/pkg/release"
-	"github.com/stefanmcshane/helm/pkg/storage/driver"
 	"golang.org/x/oauth2"
+	"helm.sh/helm/v3/pkg/action"
+	"helm.sh/helm/v3/pkg/chart"
+	"helm.sh/helm/v3/pkg/release"
+	"helm.sh/helm/v3/pkg/storage/driver"
 	corev1 "k8s.io/api/core/v1"
 	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/helm/pkg/chartutil"

+ 3 - 3
internal/helm/agent_test.go

@@ -3,14 +3,14 @@ package helm_test
 import (
 	"testing"
 
-	"github.com/stefanmcshane/helm/pkg/storage/driver"
+	"helm.sh/helm/v3/pkg/storage/driver"
 
 	"github.com/porter-dev/porter/api/types"
 	"github.com/porter-dev/porter/internal/helm"
 	"github.com/porter-dev/porter/pkg/logger"
 
-	"github.com/stefanmcshane/helm/pkg/chart"
-	"github.com/stefanmcshane/helm/pkg/release"
+	"helm.sh/helm/v3/pkg/chart"
+	"helm.sh/helm/v3/pkg/release"
 )
 
 func newAgentFixture(t *testing.T, namespace string) *helm.Agent {

+ 5 - 5
internal/helm/config.go

@@ -9,12 +9,12 @@ import (
 	"github.com/porter-dev/porter/internal/models"
 	"github.com/porter-dev/porter/internal/repository"
 	"github.com/porter-dev/porter/pkg/logger"
-	"github.com/stefanmcshane/helm/pkg/action"
-	"github.com/stefanmcshane/helm/pkg/chartutil"
-	"github.com/stefanmcshane/helm/pkg/kube"
-	kubefake "github.com/stefanmcshane/helm/pkg/kube/fake"
-	"github.com/stefanmcshane/helm/pkg/storage"
 	"golang.org/x/oauth2"
+	"helm.sh/helm/v3/pkg/action"
+	"helm.sh/helm/v3/pkg/chartutil"
+	"helm.sh/helm/v3/pkg/kube"
+	kubefake "helm.sh/helm/v3/pkg/kube/fake"
+	"helm.sh/helm/v3/pkg/storage"
 	k8s "k8s.io/client-go/kubernetes"
 )
 

+ 2 - 2
internal/helm/loader/loader.go

@@ -12,8 +12,8 @@ import (
 	"sigs.k8s.io/yaml"
 
 	"github.com/porter-dev/porter/api/types"
-	"github.com/stefanmcshane/helm/pkg/chart"
-	chartloader "github.com/stefanmcshane/helm/pkg/chart/loader"
+	"helm.sh/helm/v3/pkg/chart"
+	chartloader "helm.sh/helm/v3/pkg/chart/loader"
 )
 
 // RepoIndexToPorterChartList converts an index file to a list of porter charts

+ 3 - 6
internal/helm/postrenderer.go

@@ -2,7 +2,6 @@ package helm
 
 import (
 	"bytes"
-	"context"
 	"fmt"
 	"io"
 	"net/url"
@@ -10,13 +9,13 @@ import (
 	"sort"
 	"strings"
 
-	"github.com/aws/aws-sdk-go-v2/aws/arn"
+	"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/repository"
-	"github.com/stefanmcshane/helm/pkg/postrender"
 	"golang.org/x/oauth2"
 	"gopkg.in/yaml.v2"
+	"helm.sh/helm/v3/pkg/postrender"
 
 	"github.com/docker/distribution/reference"
 )
@@ -464,8 +463,6 @@ func (d *DockerSecretsPostRenderer) getImageList(podSpec resource) []string {
 var ecrPattern = regexp.MustCompile(`(^[a-zA-Z0-9][a-zA-Z0-9-_]*)\.dkr\.ecr(\-fips)?\.([a-zA-Z0-9][a-zA-Z0-9-_]*)\.amazonaws\.com(\.cn)?`)
 
 func (d *DockerSecretsPostRenderer) isRegistryNative(regName string) bool {
-	ctx := context.Background()
-
 	isNative := false
 
 	if strings.Contains(regName, "gcr") && d.Cluster.AuthMechanism == models.GCP {
@@ -506,7 +503,7 @@ func (d *DockerSecretsPostRenderer) isRegistryNative(regName string) bool {
 			return false
 		}
 
-		err = awsInt.PopulateAWSArn(ctx)
+		err = awsInt.PopulateAWSArn()
 
 		if err != nil {
 			return false

+ 1 - 1
internal/helm/repo/repo.go

@@ -6,7 +6,7 @@ import (
 	"github.com/porter-dev/porter/api/types"
 	"github.com/porter-dev/porter/internal/helm/loader"
 	"github.com/porter-dev/porter/internal/models"
-	"github.com/stefanmcshane/helm/pkg/chart"
+	"helm.sh/helm/v3/pkg/chart"
 
 	"github.com/porter-dev/porter/internal/repository"
 )

+ 2 - 2
internal/helm/storage.go

@@ -16,8 +16,8 @@ package helm
 import (
 	"github.com/porter-dev/porter/pkg/logger"
 
-	"github.com/stefanmcshane/helm/pkg/storage"
-	"github.com/stefanmcshane/helm/pkg/storage/driver"
+	"helm.sh/helm/v3/pkg/storage"
+	"helm.sh/helm/v3/pkg/storage/driver"
 	corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
 )
 

+ 3 - 3
internal/helm/storage_test.go

@@ -4,13 +4,13 @@ import (
 	"reflect"
 	"testing"
 
-	"github.com/stefanmcshane/helm/pkg/chart"
-	"github.com/stefanmcshane/helm/pkg/release"
+	"helm.sh/helm/v3/pkg/chart"
+	"helm.sh/helm/v3/pkg/release"
 
 	"github.com/porter-dev/porter/internal/helm"
 	"github.com/porter-dev/porter/internal/kubernetes"
 	"github.com/porter-dev/porter/pkg/logger"
-	"github.com/stefanmcshane/helm/pkg/storage"
+	"helm.sh/helm/v3/pkg/storage"
 	"k8s.io/client-go/kubernetes/fake"
 )
 

+ 1 - 1
internal/kubernetes/agent.go

@@ -46,7 +46,7 @@ import (
 	"k8s.io/client-go/tools/remotecommand"
 	"k8s.io/kubectl/pkg/scheme"
 
-	rspb "github.com/stefanmcshane/helm/pkg/release"
+	rspb "helm.sh/helm/v3/pkg/release"
 
 	istiov1beta1 "istio.io/client-go/pkg/apis/networking/v1beta1"
 	versionedclient "istio.io/client-go/pkg/clientset/versioned"

+ 1 - 3
internal/kubernetes/config.go

@@ -1,7 +1,6 @@
 package kubernetes
 
 import (
-	"context"
 	"errors"
 	"fmt"
 	"path/filepath"
@@ -229,7 +228,6 @@ func (conf *OutOfClusterConfig) GetClientConfigFromCluster() (clientcmd.ClientCo
 
 func (conf *OutOfClusterConfig) CreateRawConfigFromCluster() (*api.Config, error) {
 	cluster := conf.Cluster
-	ctx := context.Background()
 
 	apiConfig := &api.Config{}
 
@@ -354,7 +352,7 @@ func (conf *OutOfClusterConfig) CreateRawConfigFromCluster() (*api.Config, error
 			shouldOverride = true
 		}
 
-		tok, err := awsAuth.GetBearerToken(ctx, conf.getTokenCache, conf.setTokenCache, awsClusterID, shouldOverride)
+		tok, err := awsAuth.GetBearerToken(conf.getTokenCache, conf.setTokenCache, awsClusterID, shouldOverride)
 
 		if err != nil {
 			return nil, err

+ 1 - 1
internal/kubernetes/envgroup/create.go

@@ -9,7 +9,7 @@ import (
 	"github.com/porter-dev/porter/api/types"
 	"github.com/porter-dev/porter/internal/helm"
 	"github.com/porter-dev/porter/internal/kubernetes"
-	"github.com/stefanmcshane/helm/pkg/release"
+	"helm.sh/helm/v3/pkg/release"
 	v1 "k8s.io/api/core/v1"
 )
 

+ 159 - 0
internal/models/integrations/aws.go

@@ -0,0 +1,159 @@
+package integrations
+
+import (
+	"gorm.io/gorm"
+
+	"github.com/aws/aws-sdk-go/aws"
+	"github.com/aws/aws-sdk-go/service/sts"
+
+	"github.com/aws/aws-sdk-go/aws/credentials"
+	"github.com/aws/aws-sdk-go/aws/session"
+	"github.com/porter-dev/porter/api/types"
+	"sigs.k8s.io/aws-iam-authenticator/pkg/token"
+)
+
+// AWSIntegration is an auth mechanism that uses a AWS IAM user to
+// authenticate
+type AWSIntegration struct {
+	gorm.Model
+
+	// The id of the user that linked this auth mechanism
+	UserID uint `json:"user_id"`
+
+	// The project that this integration belongs to
+	ProjectID uint `json:"project_id"`
+
+	// The AWS arn this is integration is linked to
+	AWSArn string `json:"aws_arn"`
+
+	// The optional AWS region (required by some session configurations)
+	AWSRegion string `json:"aws_region"`
+
+	// The assumed role ARN to use for sessions
+	AWSAssumeRoleArn string
+
+	// ------------------------------------------------------------------
+	// All fields encrypted before storage.
+	// ------------------------------------------------------------------
+
+	// The AWS cluster ID
+	// See https://github.com/kubernetes-sigs/aws-iam-authenticator#what-is-a-cluster-id
+	AWSClusterID []byte `json:"aws_cluster_id"`
+
+	// The AWS access key for this IAM user
+	AWSAccessKeyID []byte `json:"aws_access_key_id"`
+
+	// The AWS secret key for this IAM user
+	AWSSecretAccessKey []byte `json:"aws_secret_access_key"`
+
+	// An optional session token, if the user is assuming a role
+	AWSSessionToken []byte `json:"aws_session_token"`
+}
+
+func (a *AWSIntegration) ToAWSIntegrationType() *types.AWSIntegration {
+	return &types.AWSIntegration{
+		CreatedAt: a.CreatedAt,
+		ID:        a.ID,
+		UserID:    a.UserID,
+		ProjectID: a.ProjectID,
+		AWSArn:    a.AWSArn,
+	}
+}
+
+// GetSession retrieves an AWS session to use based on the access key and secret
+// access key
+func (a *AWSIntegration) GetSession() (*session.Session, error) {
+	awsConf := &aws.Config{
+		Credentials: credentials.NewStaticCredentials(
+			string(a.AWSAccessKeyID),
+			string(a.AWSSecretAccessKey),
+			string(a.AWSSessionToken),
+		),
+	}
+
+	if a.AWSRegion != "" {
+		awsConf.Region = &a.AWSRegion
+	}
+
+	return session.NewSessionWithOptions(session.Options{
+		SharedConfigState: session.SharedConfigEnable,
+		Config:            *awsConf,
+	})
+}
+
+// PopulateAWSArn uses the access key/secret to get the caller identity, and
+// attaches it to the AWS integration
+func (a *AWSIntegration) PopulateAWSArn() error {
+	sess, err := a.GetSession()
+
+	if err != nil {
+		return err
+	}
+
+	svc := sts.New(sess)
+
+	result, err := svc.GetCallerIdentity(&sts.GetCallerIdentityInput{})
+
+	if err != nil {
+		return err
+	}
+
+	a.AWSArn = *result.Arn
+
+	return nil
+}
+
+// GetBearerToken retrieves a bearer token for an AWS account
+func (a *AWSIntegration) GetBearerToken(
+	getTokenCache GetTokenCacheFunc,
+	setTokenCache SetTokenCacheFunc,
+	clusterID string,
+	shouldClusterIdOverride bool,
+) (string, error) {
+	cache, err := getTokenCache()
+
+	// check the token cache for a non-expired token
+	if cache != nil {
+		if tok := cache.Token; err == nil && !cache.IsExpired() && len(tok) > 0 {
+			return string(tok), nil
+		}
+	}
+
+	generator, err := token.NewGenerator(false, false)
+
+	if err != nil {
+		return "", err
+	}
+
+	sess, err := a.GetSession()
+
+	if err != nil {
+		return "", err
+	}
+
+	var validClusterId string
+
+	if shouldClusterIdOverride {
+		validClusterId = clusterID
+	} else {
+		validClusterId = string(a.AWSClusterID)
+
+		if validClusterId == "" {
+			validClusterId = clusterID
+		}
+	}
+
+	tok, err := generator.GetWithOptions(&token.GetTokenOptions{
+		AssumeRoleARN: a.AWSAssumeRoleArn,
+		Session:       sess,
+		ClusterID:     validClusterId,
+	})
+
+	if err != nil {
+		return "", err
+	}
+
+	setTokenCache(tok.Token, tok.Expiration)
+
+	return tok.Token, nil
+}

+ 0 - 177
internal/models/integrations/aws_v2.go

@@ -1,177 +0,0 @@
-package integrations
-
-import (
-	"context"
-	"encoding/base64"
-	"fmt"
-	"time"
-
-	"github.com/aws/aws-sdk-go-v2/aws"
-	"github.com/aws/aws-sdk-go-v2/credentials"
-	"github.com/aws/aws-sdk-go-v2/service/sts"
-	smithyhttp "github.com/aws/smithy-go/transport/http"
-	"github.com/porter-dev/porter/api/types"
-	"gorm.io/gorm"
-)
-
-// AWSIntegration is an auth mechanism that uses a AWS IAM user to
-// authenticate
-type AWSIntegration struct {
-	gorm.Model
-
-	// The id of the user that linked this auth mechanism
-	UserID uint `json:"user_id"`
-
-	// The project that this integration belongs to
-	ProjectID uint `json:"project_id"`
-
-	// The AWS arn this is integration is linked to
-	AWSArn string `json:"aws_arn"`
-
-	// The optional AWS region (required by some session configurations)
-	AWSRegion string `json:"aws_region"`
-
-	// The assumed role ARN to use for sessions
-	AWSAssumeRoleArn string
-
-	// ------------------------------------------------------------------
-	// All fields encrypted before storage.
-	// ------------------------------------------------------------------
-
-	// The AWS cluster ID
-	// See https://github.com/kubernetes-sigs/aws-iam-authenticator#what-is-a-cluster-id
-	AWSClusterID []byte `json:"aws_cluster_id"`
-
-	// The AWS access key for this IAM user
-	AWSAccessKeyID []byte `json:"aws_access_key_id"`
-
-	// The AWS secret key for this IAM user
-	AWSSecretAccessKey []byte `json:"aws_secret_access_key"`
-
-	// An optional session token, if the user is assuming a role
-	AWSSessionToken []byte `json:"aws_session_token"`
-}
-
-func (a *AWSIntegration) ToAWSIntegrationType() types.AWSIntegration {
-	return types.AWSIntegration{
-		CreatedAt: a.CreatedAt,
-		ID:        a.ID,
-		UserID:    a.UserID,
-		ProjectID: a.ProjectID,
-		AWSArn:    a.AWSArn,
-	}
-}
-
-// Config returns a populated AWS Config for use with aws-go-sdk-v2 services
-func (a *AWSIntegration) Config() aws.Config {
-	awsConf := aws.Config{
-		Credentials: credentials.NewStaticCredentialsProvider(
-			*aws.String(string(a.AWSAccessKeyID)),
-			*aws.String(string(a.AWSSecretAccessKey)),
-			*aws.String(string(a.AWSSessionToken)),
-		),
-	}
-
-	if a.AWSRegion != "" {
-		awsConf.Region = a.AWSRegion
-	}
-
-	return awsConf
-}
-
-// PopulateAWSArn uses the access key/secret to get the caller identity, and
-// attaches it to the AWS integration
-func (a *AWSIntegration) PopulateAWSArn(ctx context.Context) error {
-	svc := sts.NewFromConfig(a.Config())
-
-	result, err := svc.GetCallerIdentity(ctx, &sts.GetCallerIdentityInput{})
-
-	if err != nil {
-		return err
-	}
-
-	a.AWSArn = *result.Arn
-
-	return nil
-}
-
-// GetBearerToken retrieves a bearer token for an AWS account
-func (a *AWSIntegration) GetBearerToken(
-	ctx context.Context,
-	getTokenCache GetTokenCacheFunc,
-	setTokenCache SetTokenCacheFunc,
-	clusterID string,
-	shouldClusterIdOverride bool,
-) (string, error) {
-	cache, err := getTokenCache()
-
-	// check the token cache for a non-expired token
-	if cache != nil {
-		if tok := cache.Token; err == nil && !cache.IsExpired() && len(tok) > 0 {
-			return string(tok), nil
-		}
-	}
-
-	var validClusterId string
-
-	if shouldClusterIdOverride {
-		validClusterId = clusterID
-	} else {
-		validClusterId = string(a.AWSClusterID)
-
-		if validClusterId == "" {
-			validClusterId = clusterID
-		}
-	}
-
-	token, err := a.GetWithSTS(ctx, clusterID)
-	if err != nil {
-		return "", err
-	}
-
-	setTokenCache(token.Token, token.Expiration)
-
-	return token.Token, nil
-}
-
-// Token is generated and used by Kubernetes client-go to authenticate with a Kubernetes cluster.
-// Original source: https://github.com/weaveworks/eksctl/blob/5f2a59056a4852470c66502205d2db0aa7c84c5e/pkg/eks/auth/generator.go#LL46C24-L46C24
-type Token struct {
-	Token      string
-	Expiration time.Time
-}
-
-const (
-	clusterIDHeader        = "x-k8s-aws-id"
-	presignedURLExpiration = 10 * time.Minute
-	v1Prefix               = "k8s-aws-v1."
-)
-
-// GetWithSTS returns a token valid for clusterID using the given STS client.
-// This implementation follows the steps outlined here:
-// https://github.com/kubernetes-sigs/aws-iam-authenticator#api-authorization-from-outside-a-cluster
-// We either add this implementation or have to maintain two versions of STS since aws-iam-authenticator is
-// not switching over to aws-go-sdk-v2.
-func (a AWSIntegration) GetWithSTS(ctx context.Context, clusterID string) (Token, error) {
-	presignClient := sts.NewPresignClient(sts.NewFromConfig(a.Config()))
-	// generate a sts:GetCallerIdentity request and add our custom cluster ID header
-	presignedURLRequest, err := presignClient.PresignGetCallerIdentity(ctx, &sts.GetCallerIdentityInput{}, func(presignOptions *sts.PresignOptions) {
-		presignOptions.ClientOptions = append(presignOptions.ClientOptions, a.appendPresignHeaderValuesFunc(clusterID))
-	})
-	if err != nil {
-		return Token{}, fmt.Errorf("failed to presign caller identity: %w", err)
-	}
-
-	tokenExpiration := time.Now().Local().Add(presignedURLExpiration)
-	// Add the token with k8s-aws-v1. prefix.
-	return Token{v1Prefix + base64.RawURLEncoding.EncodeToString([]byte(presignedURLRequest.URL)), tokenExpiration}, nil
-}
-
-func (a AWSIntegration) appendPresignHeaderValuesFunc(clusterID string) func(stsOptions *sts.Options) {
-	return func(stsOptions *sts.Options) {
-		// Add clusterId Header
-		stsOptions.APIOptions = append(stsOptions.APIOptions, smithyhttp.SetHeaderValue(clusterIDHeader, clusterID))
-		// Add X-Amz-Expires query param
-		stsOptions.APIOptions = append(stsOptions.APIOptions, smithyhttp.SetHeaderValue("X-Amz-Expires", "60"))
-	}
-}

+ 1 - 1
internal/opa/opa.go

@@ -13,7 +13,7 @@ import (
 	"github.com/porter-dev/porter/internal/kubernetes"
 	"github.com/porter-dev/porter/internal/models"
 	"github.com/porter-dev/porter/pkg/logger"
-	"github.com/stefanmcshane/helm/pkg/release"
+	"helm.sh/helm/v3/pkg/release"
 	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/apimachinery/pkg/runtime"
 	"k8s.io/apimachinery/pkg/runtime/schema"

+ 92 - 67
internal/registry/registry.go

@@ -4,7 +4,6 @@ import (
 	"context"
 	"encoding/base64"
 	"encoding/json"
-	"errors"
 	"fmt"
 	"net/http"
 	"net/url"
@@ -13,18 +12,10 @@ import (
 	"time"
 
 	artifactregistry "cloud.google.com/go/artifactregistry/apiv1beta2"
-	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
 	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
-	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry"
-	"github.com/aws/aws-sdk-go-v2/service/ecr"
-	ecrTypes "github.com/aws/aws-sdk-go-v2/service/ecr/types"
-	"github.com/digitalocean/godo"
-	"github.com/docker/cli/cli/config/configfile"
-	"github.com/docker/cli/cli/config/types"
-	"github.com/docker/distribution/reference"
-	ptypes "github.com/porter-dev/porter/api/types"
+	"github.com/aws/aws-sdk-go/aws/awserr"
+	"github.com/aws/aws-sdk-go/service/ecr"
 	"github.com/porter-dev/porter/internal/models"
-	ints "github.com/porter-dev/porter/internal/models/integrations"
 	"github.com/porter-dev/porter/internal/oauth"
 	"github.com/porter-dev/porter/internal/repository"
 	"golang.org/x/oauth2"
@@ -32,22 +23,40 @@ import (
 	"google.golang.org/api/iterator"
 	"google.golang.org/api/option"
 	artifactregistrypb "google.golang.org/genproto/googleapis/devtools/artifactregistry/v1beta2"
+
+	ints "github.com/porter-dev/porter/internal/models/integrations"
+
+	ptypes "github.com/porter-dev/porter/api/types"
+
+	"github.com/digitalocean/godo"
+	"github.com/docker/cli/cli/config/configfile"
+	"github.com/docker/cli/cli/config/types"
+	"github.com/docker/distribution/reference"
+
+	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry"
+
+	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
 )
 
 // Registry wraps the gorm Registry model
 type Registry models.Registry
 
 func GetECRRegistryURL(awsIntRepo repository.AWSIntegrationRepository, projectID, awsIntID uint) (string, error) {
-	ctx := context.Background()
-
 	awsInt, err := awsIntRepo.ReadAWSIntegration(projectID, awsIntID)
+
 	if err != nil {
 		return "", err
 	}
 
-	svc := ecr.NewFromConfig(awsInt.Config())
+	sess, err := awsInt.GetSession()
+
+	if err != nil {
+		return "", err
+	}
 
-	output, err := svc.GetAuthorizationToken(ctx, &ecr.GetAuthorizationTokenInput{})
+	ecrSvc := ecr.New(sess)
+
+	output, err := ecrSvc.GetAuthorizationToken(&ecr.GetAuthorizationTokenInput{})
 
 	if err != nil {
 		return "", err
@@ -371,8 +380,6 @@ func (r *Registry) listGARRepositories(
 }
 
 func (r *Registry) listECRRepositories(repo repository.Repository) ([]*ptypes.RegistryRepository, error) {
-	ctx := context.Background()
-
 	aws, err := repo.AWSIntegration().ReadAWSIntegration(
 		r.ProjectID,
 		r.AWSIntegrationID,
@@ -382,9 +389,15 @@ func (r *Registry) listECRRepositories(repo repository.Repository) ([]*ptypes.Re
 		return nil, err
 	}
 
-	svc := ecr.NewFromConfig(aws.Config())
+	sess, err := aws.GetSession()
+
+	if err != nil {
+		return nil, err
+	}
+
+	svc := ecr.New(sess)
 
-	resp, err := svc.DescribeRepositories(ctx, &ecr.DescribeRepositoriesInput{})
+	resp, err := svc.DescribeRepositories(&ecr.DescribeRepositoriesInput{})
 
 	if err != nil {
 		return nil, err
@@ -764,8 +777,6 @@ func (r *Registry) createECRRepository(
 	repo repository.Repository,
 	name string,
 ) error {
-	ctx := context.Background()
-
 	aws, err := repo.AWSIntegration().ReadAWSIntegration(
 		r.ProjectID,
 		r.AWSIntegrationID,
@@ -775,23 +786,27 @@ func (r *Registry) createECRRepository(
 		return err
 	}
 
-	svc := ecr.NewFromConfig(aws.Config())
+	sess, err := aws.GetSession()
+
+	if err != nil {
+		return err
+	}
+
+	svc := ecr.New(sess)
 
 	// determine if repository already exists
-	_, err = svc.DescribeRepositories(ctx, &ecr.DescribeRepositoriesInput{
-		RepositoryNames: []string{name},
+	_, err = svc.DescribeRepositories(&ecr.DescribeRepositoriesInput{
+		RepositoryNames: []*string{&name},
 	})
-	if err != nil {
-		// if the repository was not found, create it
-		var nsk *ecrTypes.RegistryPolicyNotFoundException
-		if errors.As(err, &nsk) {
-			_, err = svc.CreateRepository(ctx, &ecr.CreateRepositoryInput{
-				RepositoryName: &name,
-			})
-			if err != nil {
-				return err
-			}
-		}
+
+	// if the repository was not found, create it
+	if aerr, ok := err.(awserr.Error); ok && aerr.Code() == ecr.ErrCodeRepositoryNotFoundException {
+		_, err = svc.CreateRepository(&ecr.CreateRepositoryInput{
+			RepositoryName: &name,
+		})
+
+		return err
+	} else if err != nil {
 		return err
 	}
 
@@ -894,22 +909,26 @@ func (r *Registry) GetECRPaginatedImages(
 	maxResults int64,
 	nextToken *string,
 ) ([]*ptypes.Image, *string, error) {
-	ctx := context.Background()
-
 	aws, err := repo.AWSIntegration().ReadAWSIntegration(
 		r.ProjectID,
 		r.AWSIntegrationID,
 	)
+
 	if err != nil {
 		return nil, nil, err
 	}
 
-	svc := ecr.NewFromConfig(aws.Config())
+	sess, err := aws.GetSession()
 
-	mr := int32(maxResults)
-	resp, err := svc.ListImages(ctx, &ecr.ListImagesInput{
+	if err != nil {
+		return nil, nil, err
+	}
+
+	svc := ecr.New(sess)
+
+	resp, err := svc.ListImages(&ecr.ListImagesInput{
 		RepositoryName: &repoName,
-		MaxResults:     &mr,
+		MaxResults:     &maxResults,
 		NextToken:      nextToken,
 	})
 
@@ -922,11 +941,11 @@ func (r *Registry) GetECRPaginatedImages(
 	}
 
 	imageIDLen := len(resp.ImageIds)
-	imageDetails := make([]ecrTypes.ImageDetail, 0)
+	imageDetails := make([]*ecr.ImageDetail, 0)
 	imageIDMap := make(map[string]bool)
 
 	for _, id := range resp.ImageIds {
-		if id.ImageDigest != nil && id.ImageTag != nil {
+		if id != nil && id.ImageTag != nil {
 			imageIDMap[*id.ImageTag] = true
 		}
 	}
@@ -946,7 +965,7 @@ func (r *Registry) GetECRPaginatedImages(
 		go func(start, end int) {
 			defer wg.Done()
 
-			describeResp, err := svc.DescribeImages(ctx, &ecr.DescribeImagesInput{
+			describeResp, err := svc.DescribeImages(&ecr.DescribeImagesInput{
 				RepositoryName: &repoName,
 				ImageIds:       resp.ImageIds[start:end],
 			})
@@ -970,14 +989,14 @@ func (r *Registry) GetECRPaginatedImages(
 		for _, tag := range img.ImageTags {
 			newImage := &ptypes.Image{
 				Digest:         *img.ImageDigest,
-				Tag:            tag,
+				Tag:            *tag,
 				RepositoryName: repoName,
 				PushedAt:       img.ImagePushedAt,
 			}
 
-			if _, ok := imageIDMap[tag]; ok {
-				if _, ok := imageInfoMap[tag]; !ok {
-					imageInfoMap[tag] = newImage
+			if _, ok := imageIDMap[*tag]; ok {
+				if _, ok := imageInfoMap[*tag]; !ok {
+					imageInfoMap[*tag] = newImage
 				}
 			}
 
@@ -999,8 +1018,6 @@ func (r *Registry) GetECRPaginatedImages(
 }
 
 func (r *Registry) listECRImages(repoName string, repo repository.Repository) ([]*ptypes.Image, error) {
-	ctx := context.Background()
-
 	aws, err := repo.AWSIntegration().ReadAWSIntegration(
 		r.ProjectID,
 		r.AWSIntegrationID,
@@ -1010,16 +1027,21 @@ func (r *Registry) listECRImages(repoName string, repo repository.Repository) ([
 		return nil, err
 	}
 
-	svc := ecr.NewFromConfig(aws.Config())
+	sess, err := aws.GetSession()
+
+	if err != nil {
+		return nil, err
+	}
+
+	svc := ecr.New(sess)
 
 	maxResults := int64(1000)
 
-	var imageIDs []ecrTypes.ImageIdentifier
+	var imageIDs []*ecr.ImageIdentifier
 
-	mr := int32(maxResults)
-	resp, err := svc.ListImages(ctx, &ecr.ListImagesInput{
+	resp, err := svc.ListImages(&ecr.ListImagesInput{
 		RepositoryName: &repoName,
-		MaxResults:     &mr,
+		MaxResults:     &maxResults,
 	})
 
 	if err != nil {
@@ -1035,9 +1057,9 @@ func (r *Registry) listECRImages(repoName string, repo repository.Repository) ([
 	nextToken := resp.NextToken
 
 	for nextToken != nil {
-		resp, err := svc.ListImages(ctx, &ecr.ListImagesInput{
+		resp, err := svc.ListImages(&ecr.ListImagesInput{
 			RepositoryName: &repoName,
-			MaxResults:     &mr,
+			MaxResults:     &maxResults,
 			NextToken:      nextToken,
 		})
 
@@ -1050,7 +1072,7 @@ func (r *Registry) listECRImages(repoName string, repo repository.Repository) ([
 	}
 
 	imageIDLen := len(imageIDs)
-	imageDetails := make([]ecrTypes.ImageDetail, 0)
+	imageDetails := make([]*ecr.ImageDetail, 0)
 
 	var wg sync.WaitGroup
 	var mu sync.Mutex
@@ -1067,7 +1089,7 @@ func (r *Registry) listECRImages(repoName string, repo repository.Repository) ([
 		go func(start, end int) {
 			defer wg.Done()
 
-			describeResp, err := svc.DescribeImages(ctx, &ecr.DescribeImagesInput{
+			describeResp, err := svc.DescribeImages(&ecr.DescribeImagesInput{
 				RepositoryName: &repoName,
 				ImageIds:       imageIDs[start:end],
 			})
@@ -1091,13 +1113,13 @@ func (r *Registry) listECRImages(repoName string, repo repository.Repository) ([
 		for _, tag := range img.ImageTags {
 			newImage := &ptypes.Image{
 				Digest:         *img.ImageDigest,
-				Tag:            tag,
+				Tag:            *tag,
 				RepositoryName: repoName,
 				PushedAt:       img.ImagePushedAt,
 			}
 
-			if _, ok := imageInfoMap[tag]; !ok {
-				imageInfoMap[tag] = newImage
+			if _, ok := imageInfoMap[*tag]; !ok {
+				imageInfoMap[*tag] = newImage
 			}
 		}
 	}
@@ -1566,9 +1588,6 @@ func (r *Registry) GetDockerConfigJSON(
 func (r *Registry) getECRDockerConfigFile(
 	repo repository.Repository,
 ) (*configfile.ConfigFile, error) {
-
-	ctx := context.Background()
-
 	aws, err := repo.AWSIntegration().ReadAWSIntegration(
 		r.ProjectID,
 		r.AWSIntegrationID,
@@ -1578,9 +1597,15 @@ func (r *Registry) getECRDockerConfigFile(
 		return nil, err
 	}
 
-	svc := ecr.NewFromConfig(aws.Config())
+	sess, err := aws.GetSession()
+
+	if err != nil {
+		return nil, err
+	}
+
+	ecrSvc := ecr.New(sess)
 
-	output, err := svc.GetAuthorizationToken(ctx, &ecr.GetAuthorizationTokenInput{})
+	output, err := ecrSvc.GetAuthorizationToken(&ecr.GetAuthorizationTokenInput{})
 
 	if err != nil {
 		return nil, err

+ 1 - 1
internal/stacks/hooks.go

@@ -6,8 +6,8 @@ import (
 
 	"github.com/porter-dev/porter/api/server/shared/config"
 	"github.com/porter-dev/porter/api/types"
-	"github.com/stefanmcshane/helm/pkg/release"
 	"gorm.io/gorm"
+	"helm.sh/helm/v3/pkg/release"
 )
 
 func UpdateHelmRevision(config *config.Config, projID, clusterID uint, rel *release.Release) error {

+ 1 - 1
internal/templater/helm/manifests/reader.go

@@ -6,7 +6,7 @@ import (
 
 	"github.com/porter-dev/porter/internal/templater"
 	"github.com/porter-dev/porter/internal/templater/utils"
-	"github.com/stefanmcshane/helm/pkg/release"
+	"helm.sh/helm/v3/pkg/release"
 	"sigs.k8s.io/yaml"
 )
 

+ 2 - 2
internal/templater/helm/values/reader.go

@@ -6,8 +6,8 @@ import (
 	"github.com/porter-dev/porter/internal/templater"
 	"github.com/porter-dev/porter/internal/templater/utils"
 
-	"github.com/stefanmcshane/helm/pkg/chart"
-	"github.com/stefanmcshane/helm/pkg/release"
+	"helm.sh/helm/v3/pkg/chart"
+	"helm.sh/helm/v3/pkg/release"
 )
 
 // TemplateReader implements the templater.TemplateReader for reading from

+ 1 - 1
internal/templater/helm/values/writer.go

@@ -4,7 +4,7 @@ import (
 	"fmt"
 
 	"github.com/porter-dev/porter/internal/helm"
-	"github.com/stefanmcshane/helm/pkg/chart"
+	"helm.sh/helm/v3/pkg/chart"
 )
 
 // TemplateWriter upgrades and installs charts by setting Helm values

+ 2 - 2
internal/templater/parser/parser.go

@@ -10,8 +10,8 @@ import (
 	"github.com/porter-dev/porter/internal/templater"
 	"github.com/porter-dev/porter/internal/templater/infra"
 	"github.com/porter-dev/porter/internal/templater/utils"
-	"github.com/stefanmcshane/helm/pkg/chart"
-	"github.com/stefanmcshane/helm/pkg/release"
+	"helm.sh/helm/v3/pkg/chart"
+	"helm.sh/helm/v3/pkg/release"
 	"k8s.io/client-go/dynamic"
 	"sigs.k8s.io/yaml"
 

+ 34 - 45
provisioner/integrations/storage/s3/s3.go

@@ -2,27 +2,24 @@ package s3
 
 import (
 	"bytes"
-	"context"
-	"errors"
 	"fmt"
 	"io"
 
-	"github.com/aws/aws-sdk-go-v2/aws"
-	"github.com/aws/aws-sdk-go-v2/credentials"
-	"github.com/aws/aws-sdk-go-v2/feature/s3/manager"
-	"github.com/aws/aws-sdk-go-v2/service/s3"
-	"github.com/aws/aws-sdk-go-v2/service/s3/types"
+	"github.com/aws/aws-sdk-go/aws"
+	"github.com/aws/aws-sdk-go/aws/awserr"
+	"github.com/aws/aws-sdk-go/aws/credentials"
+	"github.com/aws/aws-sdk-go/aws/session"
+	"github.com/aws/aws-sdk-go/service/s3"
 	"github.com/porter-dev/porter/internal/encryption"
 	"github.com/porter-dev/porter/internal/models"
 	"github.com/porter-dev/porter/provisioner/integrations/storage"
 )
 
 type S3StorageClient struct {
-	client        *s3.Client
+	client        *s3.S3
 	bucket        string
 	encryptionKey *[32]byte
 }
-
 type S3Options struct {
 	AWSRegion      string
 	AWSAccessKeyID string
@@ -32,102 +29,98 @@ type S3Options struct {
 }
 
 func NewS3StorageClient(opts *S3Options) (*S3StorageClient, error) {
+	var sess *session.Session
+	var err error
 
-	awsConf := aws.Config{
-		Credentials: credentials.NewStaticCredentialsProvider(
+	awsConf := &aws.Config{
+		Credentials: credentials.NewStaticCredentials(
 			opts.AWSAccessKeyID,
 			opts.AWSSecretKey,
 			"",
 		),
-		Region: opts.AWSRegion,
+		Region: &opts.AWSRegion,
 	}
 
-	// TODO: delete this comment by 2023-01-30 if no issues are noticed when creating a new S3 client
-	// aws-sdk-go used a SharedConfigState: enabled which is no longer available in v2, without specifying the file name
-	client := s3.NewFromConfig(awsConf)
+	sess, err = session.NewSessionWithOptions(session.Options{
+		SharedConfigState: session.SharedConfigEnable,
+		Config:            *awsConf,
+	})
+
+	if err != nil {
+		return nil, fmt.Errorf("cannot create AWS session: %v", err)
+	}
 
 	return &S3StorageClient{
 		bucket:        opts.AWSBucketName,
 		encryptionKey: opts.EncryptionKey,
-		client:        client,
+		client:        s3.New(sess),
 	}, nil
 }
-
 func (s *S3StorageClient) WriteFile(infra *models.Infra, name string, fileBytes []byte, shouldEncrypt bool) error {
-	ctx := context.Background()
-
 	body := fileBytes
 	var err error
 	if shouldEncrypt {
 		body, err = encryption.Encrypt(fileBytes, s.encryptionKey)
-
 		if err != nil {
 			return err
 		}
 	}
 
-	_, err = s.client.PutObject(ctx, &s3.PutObjectInput{
-		Body:   manager.ReadSeekCloser(bytes.NewReader(body)),
+	_, err = s.client.PutObject(&s3.PutObjectInput{
+		Body:   aws.ReadSeekCloser(bytes.NewReader(body)),
 		Bucket: &s.bucket,
 		Key:    aws.String(getKeyFromInfra(infra, name)),
 	})
-
 	return err
 }
 
 func (s *S3StorageClient) WriteFileWithKey(fileBytes []byte, shouldEncrypt bool, key string) error {
-	ctx := context.Background()
-
 	body := fileBytes
 	var err error
 	if shouldEncrypt {
 		body, err = encryption.Encrypt(fileBytes, s.encryptionKey)
-
 		if err != nil {
 			return err
 		}
 	}
 
-	_, err = s.client.PutObject(ctx, &s3.PutObjectInput{
-		Body:   manager.ReadSeekCloser(bytes.NewReader(body)),
+	_, err = s.client.PutObject(&s3.PutObjectInput{
+		Body:   aws.ReadSeekCloser(bytes.NewReader(body)),
 		Bucket: &s.bucket,
 		Key:    aws.String(key),
 	})
-
 	return err
 }
 
 func (s *S3StorageClient) ReadFile(infra *models.Infra, name string, shouldDecrypt bool) ([]byte, error) {
-	ctx := context.Background()
-
-	output, err := s.client.GetObject(ctx, &s3.GetObjectInput{
+	output, err := s.client.GetObject(&s3.GetObjectInput{
 		Bucket: &s.bucket,
 		Key:    aws.String(getKeyFromInfra(infra, name)),
 	})
 
 	if err != nil {
-		var nsk *types.NoSuchKey
-		if errors.As(err, &nsk) {
-			return nil, storage.FileDoesNotExist
+		if aerr, ok := err.(awserr.Error); ok {
+			switch aerr.Code() {
+			case s3.ErrCodeNoSuchKey:
+				return nil, storage.FileDoesNotExist
+			default:
+				return nil, err
+			}
 		}
+
 		return nil, err
 	}
 
 	if shouldDecrypt {
 		var encryptedData bytes.Buffer
-
 		_, err = encryptedData.ReadFrom(output.Body)
-
 		if err != nil {
 			return nil, err
 		}
-
 		data, err := encryption.Decrypt(encryptedData.Bytes(), s.encryptionKey)
-
 		if err != nil {
 			return nil, err
 		}
-
 		return data, nil
 	} else {
 		return io.ReadAll(output.Body)
@@ -135,17 +128,13 @@ func (s *S3StorageClient) ReadFile(infra *models.Infra, name string, shouldDecry
 }
 
 func (s *S3StorageClient) DeleteFile(infra *models.Infra, name string) error {
-	ctx := context.Background()
-
-	_, err := s.client.DeleteObject(ctx, &s3.DeleteObjectInput{
+	_, err := s.client.DeleteObject(&s3.DeleteObjectInput{
 		Bucket: &s.bucket,
 		Key:    aws.String(getKeyFromInfra(infra, name)),
 	})
-
 	if err != nil {
 		return err
 	}
-
 	return nil
 }
 

+ 8 - 114
provisioner/server/handlers/state/create_resource.go

@@ -1,7 +1,6 @@
 package state
 
 import (
-	"context"
 	"encoding/base64"
 	"encoding/json"
 	"errors"
@@ -10,7 +9,7 @@ import (
 	"regexp"
 	"strings"
 
-	"github.com/aws/aws-sdk-go-v2/service/ecr"
+	"github.com/aws/aws-sdk-go/service/ecr"
 	"github.com/porter-dev/porter/api/server/shared"
 	"github.com/porter-dev/porter/api/server/shared/apierrors"
 	"github.com/porter-dev/porter/api/types"
@@ -37,61 +36,45 @@ func NewCreateResourceHandler(
 		decoderValidator: shared.NewDefaultRequestDecoderValidator(config.Logger, config.Alerter),
 	}
 }
-
 func (c *CreateResourceHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 	// read the infra from the attached scope
 	infra, _ := r.Context().Value(types.InfraScope).(*models.Infra)
 	operation, _ := r.Context().Value(types.OperationScope).(*models.Operation)
-
 	req := &ptypes.CreateResourceRequest{}
-
 	if ok := c.decoderValidator.DecodeAndValidate(w, r, req); !ok {
 		return
 	}
-
 	// update the operation to indicate completion
 	operation.Status = "completed"
-
 	operation, err := c.Config.Repo.Infra().UpdateOperation(operation)
-
 	if err != nil {
 		apierrors.HandleAPIError(c.Config.Logger, c.Config.Alerter, w, r, apierrors.NewErrInternal(err), true)
 		return
 	}
-
 	// push to the operation stream
 	err = redis_stream.SendOperationCompleted(c.Config.RedisClient, infra, operation)
-
 	if err != nil {
 		apierrors.HandleAPIError(c.Config.Logger, c.Config.Alerter, w, r, apierrors.NewErrInternal(err), true)
 		return
 	}
-
 	// push to the global stream
 	err = redis_stream.PushToGlobalStream(c.Config.RedisClient, infra, operation, "created")
-
 	if err != nil {
 		apierrors.HandleAPIError(c.Config.Logger, c.Config.Alerter, w, r, apierrors.NewErrInternal(err), true)
 		return
 	}
-
 	// update the infra to indicate completion
 	infra.Status = "created"
-
 	infra, err = c.Config.Repo.Infra().UpdateInfra(infra)
-
 	if err != nil {
 		apierrors.HandleAPIError(c.Config.Logger, c.Config.Alerter, w, r, apierrors.NewErrInternal(err), true)
 		return
 	}
-
 	// switch on the kind of resource and write the corresponding objects to the database
 	switch req.Kind {
 	case string(types.InfraEKS), string(types.InfraDOKS), string(types.InfraGKE), string(types.InfraAKS):
 		var cluster *models.Cluster
-
 		cluster, err = createCluster(c.Config, infra, operation, req.Output)
-
 		if cluster != nil {
 			c.Config.AnalyticsClient.Track(analytics.ClusterProvisioningSuccessTrack(
 				&analytics.ClusterProvisioningSuccessTrackOpts{
@@ -116,7 +99,6 @@ func (c *CreateResourceHandler) ServeHTTP(w http.ResponseWriter, r *http.Request
 	case string(types.InfraACR):
 		_, err = createACRRegistry(c.Config, infra, operation, req.Output)
 	}
-
 	if err != nil {
 		apierrors.HandleAPIError(c.Config.Logger, c.Config.Alerter, w, r, apierrors.NewErrInternal(err), true)
 		return
@@ -124,56 +106,49 @@ func (c *CreateResourceHandler) ServeHTTP(w http.ResponseWriter, r *http.Request
 }
 
 func createECRRegistry(config *config.Config, infra *models.Infra, operation *models.Operation, output map[string]interface{}) (*models.Registry, error) {
-	ctx := context.Background()
-
 	reg := &models.Registry{
 		ProjectID:        infra.ProjectID,
 		AWSIntegrationID: infra.AWSIntegrationID,
 		InfraID:          infra.ID,
 		Name:             output["name"].(string),
 	}
-
 	// parse raw data into ECR type
 	awsInt, err := config.Repo.AWSIntegration().ReadAWSIntegration(reg.ProjectID, reg.AWSIntegrationID)
+	if err != nil {
+		return nil, err
+	}
+
+	sess, err := awsInt.GetSession()
 
 	if err != nil {
 		return nil, err
 	}
 
-	svc := ecr.NewFromConfig(awsInt.Config())
+	ecrSvc := ecr.New(sess)
 
-	authOutput, err := svc.GetAuthorizationToken(ctx, &ecr.GetAuthorizationTokenInput{})
+	authOutput, err := ecrSvc.GetAuthorizationToken(&ecr.GetAuthorizationTokenInput{})
 
 	if err != nil {
 		return nil, err
 	}
-
 	reg.URL = *authOutput.AuthorizationData[0].ProxyEndpoint
-
 	reg, err = config.Repo.Registry().CreateRegistry(reg)
-
 	if err != nil {
 		return nil, err
 	}
-
 	return reg, nil
 }
-
 func createRDSDatabase(config *config.Config, infra *models.Infra, operation *models.Operation, output map[string]interface{}) (*models.Database, error) {
 	// check for infra id being 0 as a safeguard so that all non-provisioned
 	// clusters are not matched by read
 	if infra.ID == 0 {
 		return nil, fmt.Errorf("infra id cannot be 0")
 	}
-
 	var database *models.Database
 	var err error
 	var isNotFound bool
-
 	database, err = config.Repo.Database().ReadDatabaseByInfraID(infra.ProjectID, infra.ID)
-
 	isNotFound = err != nil && errors.Is(err, gorm.ErrRecordNotFound)
-
 	if isNotFound {
 		database = &models.Database{
 			ProjectID: infra.ProjectID,
@@ -184,127 +159,95 @@ func createRDSDatabase(config *config.Config, infra *models.Infra, operation *mo
 	} else if err != nil {
 		return nil, err
 	}
-
 	database.InstanceID = output["rds_instance_id"].(string)
 	database.InstanceEndpoint = output["rds_connection_endpoint"].(string)
 	database.InstanceName = output["rds_instance_name"].(string)
-
 	if isNotFound {
 		database, err = config.Repo.Database().CreateDatabase(database)
 	} else {
 		database, err = config.Repo.Database().UpdateDatabase(database)
 	}
-
 	infra.DatabaseID = database.ID
 	infra, err = config.Repo.Infra().UpdateInfra(infra)
-
 	if err != nil {
 		return nil, err
 	}
 	lastApplied := make(map[string]interface{})
-
 	err = json.Unmarshal(operation.LastApplied, &lastApplied)
-
 	if err != nil {
 		return nil, err
 	}
-
 	err = createRDSEnvGroup(config, infra, database, lastApplied)
-
 	if err != nil {
 		return nil, err
 	}
-
 	return database, nil
 }
-
 func createS3Bucket(config *config.Config, infra *models.Infra, operation *models.Operation, output map[string]interface{}) error {
 	lastApplied := make(map[string]interface{})
-
 	err := json.Unmarshal(operation.LastApplied, &lastApplied)
-
 	if err != nil {
 		return err
 	}
-
 	return createS3EnvGroup(config, infra, lastApplied, output)
 }
-
 func createCluster(config *config.Config, infra *models.Infra, operation *models.Operation, output map[string]interface{}) (*models.Cluster, error) {
 	// check for infra id being 0 as a safeguard so that all non-provisioned
 	// clusters are not matched by read
 	if infra.ID == 0 {
 		return nil, fmt.Errorf("infra id cannot be 0")
 	}
-
 	var cluster *models.Cluster
 	var err error
 	var isNotFound bool
-
 	// look for cluster matching infra in database; if the cluster already exists, update the cluster but
 	// don't add it again
 	cluster, err = config.Repo.Cluster().ReadClusterByInfraID(infra.ProjectID, infra.ID)
-
 	isNotFound = err != nil && errors.Is(err, gorm.ErrRecordNotFound)
-
 	if isNotFound {
 		cluster = getNewCluster(infra)
 	} else if err != nil {
 		return nil, err
 	}
-
 	caData, err := transformClusterCAData([]byte(output["cluster_ca_data"].(string)))
-
 	if err != nil {
 		return nil, err
 	}
-
 	// if cluster_token is output and infra is azure, update the azure integration
 	if _, exists := output["cluster_token"]; exists && infra.AzureIntegrationID != 0 {
 		azInt, err := config.Repo.AzureIntegration().ReadAzureIntegration(infra.ProjectID, infra.AzureIntegrationID)
-
 		if err != nil {
 			return nil, err
 		}
-
 		azInt.AKSPassword = []byte(output["cluster_token"].(string))
-
 		azInt, err = config.Repo.AzureIntegration().OverwriteAzureIntegration(azInt)
-
 		if err != nil {
 			return nil, err
 		}
 	}
-
 	// only update the cluster name if this is during creation - we don't want to overwrite the cluster name
 	// which may have been manually set
 	if isNotFound {
 		cluster.Name = output["cluster_name"].(string)
 	}
-
 	cluster.Server = output["cluster_endpoint"].(string)
 	cluster.CertificateAuthorityData = caData
-
 	if isNotFound {
 		cluster, err = config.Repo.Cluster().CreateCluster(cluster)
 	} else {
 		cluster, err = config.Repo.Cluster().UpdateCluster(cluster)
 	}
-
 	if err != nil {
 		return nil, err
 	}
-
 	return cluster, nil
 }
-
 func getNewCluster(infra *models.Infra) *models.Cluster {
 	res := &models.Cluster{
 		ProjectID:           infra.ProjectID,
 		InfraID:             infra.ID,
 		MonitorHelmReleases: true,
 	}
-
 	switch infra.Kind {
 	case types.InfraEKS:
 		res.AuthMechanism = models.AWS
@@ -319,30 +262,22 @@ func getNewCluster(infra *models.Infra) *models.Cluster {
 		res.AuthMechanism = models.Azure
 		res.AzureIntegrationID = infra.AzureIntegrationID
 	}
-
 	return res
 }
-
 func transformClusterCAData(ca []byte) ([]byte, error) {
 	re := regexp.MustCompile(`^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)?$`)
-
 	// if it matches the base64 regex, decode it
 	caData := string(ca)
-
 	if re.MatchString(caData) {
 		decoded, err := base64.StdEncoding.DecodeString(caData)
-
 		if err != nil {
 			return nil, err
 		}
-
 		return []byte(decoded), nil
 	}
-
 	// otherwise just return the CA
 	return ca, nil
 }
-
 func createDOCRRegistry(config *config.Config, infra *models.Infra, operation *models.Operation, output map[string]interface{}) (*models.Registry, error) {
 	reg := &models.Registry{
 		ProjectID:       infra.ProjectID,
@@ -351,10 +286,8 @@ func createDOCRRegistry(config *config.Config, infra *models.Infra, operation *m
 		URL:             output["url"].(string),
 		Name:            output["name"].(string),
 	}
-
 	return config.Repo.Registry().CreateRegistry(reg)
 }
-
 func createGCRRegistry(config *config.Config, infra *models.Infra, operation *models.Operation, output map[string]interface{}) (*models.Registry, error) {
 	reg := &models.Registry{
 		ProjectID:        infra.ProjectID,
@@ -363,10 +296,8 @@ func createGCRRegistry(config *config.Config, infra *models.Infra, operation *mo
 		URL:              output["url"].(string),
 		Name:             "gcr-registry",
 	}
-
 	return config.Repo.Registry().CreateRegistry(reg)
 }
-
 func createGARRegistry(config *config.Config, infra *models.Infra, operation *models.Operation, output map[string]interface{}) (*models.Registry, error) {
 	reg := &models.Registry{
 		ProjectID:        infra.ProjectID,
@@ -375,10 +306,8 @@ func createGARRegistry(config *config.Config, infra *models.Infra, operation *mo
 		URL:              output["url"].(string),
 		Name:             "gar-registry",
 	}
-
 	return config.Repo.Registry().CreateRegistry(reg)
 }
-
 func createACRRegistry(config *config.Config, infra *models.Infra, operation *models.Operation, output map[string]interface{}) (*models.Registry, error) {
 	reg := &models.Registry{
 		ProjectID:          infra.ProjectID,
@@ -387,38 +316,29 @@ func createACRRegistry(config *config.Config, infra *models.Infra, operation *mo
 		URL:                output["url"].(string),
 		Name:               output["name"].(string),
 	}
-
 	return config.Repo.Registry().CreateRegistry(reg)
 }
-
 func createRDSEnvGroup(config *config.Config, infra *models.Infra, database *models.Database, lastApplied map[string]interface{}) error {
 	cluster, err := config.Repo.Cluster().ReadCluster(infra.ProjectID, infra.ParentClusterID)
-
 	if err != nil {
 		return err
 	}
-
 	ooc := &kubernetes.OutOfClusterConfig{
 		Repo:              config.Repo,
 		DigitalOceanOAuth: config.DOConf,
 		Cluster:           cluster,
 	}
-
 	agent, err := kubernetes.GetAgentOutOfClusterConfig(ooc)
-
 	if err != nil {
 		return fmt.Errorf("failed to get agent: %s", err.Error())
 	}
-
 	// split the instance endpoint on the port
 	port := "5432"
 	host := database.InstanceEndpoint
-
 	if strArr := strings.Split(database.InstanceEndpoint, ":"); len(strArr) == 2 {
 		host = strArr[0]
 		port = strArr[1]
 	}
-
 	_, err = envgroup.CreateEnvGroup(agent, types.ConfigMapInput{
 		Name:      fmt.Sprintf("rds-credentials-%s", lastApplied["db_name"].(string)),
 		Namespace: "default",
@@ -430,61 +350,45 @@ func createRDSEnvGroup(config *config.Config, infra *models.Infra, database *mod
 			"PGUSER":     lastApplied["db_user"].(string),
 		},
 	})
-
 	if err != nil {
 		return fmt.Errorf("failed to create RDS env group: %s", err.Error())
 	}
-
 	return nil
 }
-
 func deleteRDSEnvGroup(config *config.Config, infra *models.Infra, lastApplied map[string]interface{}) error {
 	cluster, err := config.Repo.Cluster().ReadCluster(infra.ProjectID, infra.ParentClusterID)
-
 	if err != nil {
 		return err
 	}
-
 	ooc := &kubernetes.OutOfClusterConfig{
 		Repo:              config.Repo,
 		DigitalOceanOAuth: config.DOConf,
 		Cluster:           cluster,
 	}
-
 	agent, err := kubernetes.GetAgentOutOfClusterConfig(ooc)
-
 	if err != nil {
 		return fmt.Errorf("failed to get agent: %s", err.Error())
 	}
-
 	err = envgroup.DeleteEnvGroup(agent, fmt.Sprintf("rds-credentials-%s", lastApplied["db_name"].(string)), "default")
-
 	if err != nil {
 		return fmt.Errorf("failed to create RDS env group: %s", err.Error())
 	}
-
 	return nil
 }
-
 func createS3EnvGroup(config *config.Config, infra *models.Infra, lastApplied map[string]interface{}, output map[string]interface{}) error {
 	cluster, err := config.Repo.Cluster().ReadCluster(infra.ProjectID, infra.ParentClusterID)
-
 	if err != nil {
 		return err
 	}
-
 	ooc := &kubernetes.OutOfClusterConfig{
 		Repo:              config.Repo,
 		DigitalOceanOAuth: config.DOConf,
 		Cluster:           cluster,
 	}
-
 	agent, err := kubernetes.GetAgentOutOfClusterConfig(ooc)
-
 	if err != nil {
 		return fmt.Errorf("failed to get agent: %s", err.Error())
 	}
-
 	// split the instance endpoint on the port
 	_, err = envgroup.CreateEnvGroup(agent, types.ConfigMapInput{
 		Name:      fmt.Sprintf("s3-credentials-%s", lastApplied["bucket_name"].(string)),
@@ -496,38 +400,28 @@ func createS3EnvGroup(config *config.Config, infra *models.Infra, lastApplied ma
 			"S3_BUCKET_NAME":       output["s3_bucket_name"].(string),
 		},
 	})
-
 	if err != nil {
 		return fmt.Errorf("failed to create S3 env group: %s", err.Error())
 	}
-
 	return nil
 }
-
 func deleteS3EnvGroup(config *config.Config, infra *models.Infra, lastApplied map[string]interface{}) error {
 	cluster, err := config.Repo.Cluster().ReadCluster(infra.ProjectID, infra.ParentClusterID)
-
 	if err != nil {
 		return err
 	}
-
 	ooc := &kubernetes.OutOfClusterConfig{
 		Repo:              config.Repo,
 		DigitalOceanOAuth: config.DOConf,
 		Cluster:           cluster,
 	}
-
 	agent, err := kubernetes.GetAgentOutOfClusterConfig(ooc)
-
 	if err != nil {
 		return fmt.Errorf("failed to get agent: %s", err.Error())
 	}
-
 	err = envgroup.DeleteEnvGroup(agent, fmt.Sprintf("s3-credentials-%s", lastApplied["bucket_name"].(string)), "default")
-
 	if err != nil {
 		return fmt.Errorf("failed to create RDS env group: %s", err.Error())
 	}
-
 	return nil
 }

+ 1 - 1
workers/jobs/helm_revisions_count_tracker.go

@@ -41,9 +41,9 @@ import (
 	"github.com/porter-dev/porter/internal/repository"
 	rcreds "github.com/porter-dev/porter/internal/repository/credentials"
 	rgorm "github.com/porter-dev/porter/internal/repository/gorm"
-	"github.com/stefanmcshane/helm/pkg/releaseutil"
 	"golang.org/x/oauth2"
 	"gorm.io/gorm"
+	"helm.sh/helm/v3/pkg/releaseutil"
 )
 
 var stepSize int = 20

+ 1 - 1
workers/utils/retry_helm_agent.go

@@ -11,7 +11,7 @@ import (
 	"github.com/porter-dev/porter/api/types"
 	"github.com/porter-dev/porter/internal/helm"
 	"github.com/porter-dev/porter/pkg/logger"
-	"github.com/stefanmcshane/helm/pkg/release"
+	"helm.sh/helm/v3/pkg/release"
 )
 
 type RetryHelmAgent struct {

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.