Alexander Belanger 4 лет назад
Родитель
Сommit
a6e4699eaf

+ 2 - 1
api/server/handlers/provision/provision_ecr.go

@@ -110,7 +110,8 @@ func (c *ProvisionECRHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
 
 	opts.CredentialExchange.VaultToken = vaultToken
 	opts.ECR = &ecr.Conf{
-		ECRName: request.ECRName,
+		AWSRegion: awsInt.AWSRegion,
+		ECRName:   request.ECRName,
 	}
 	opts.OperationKind = provisioner.Apply
 

+ 1 - 0
api/server/handlers/provision/provision_eks.go

@@ -110,6 +110,7 @@ func (c *ProvisionEKSHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
 
 	opts.CredentialExchange.VaultToken = vaultToken
 	opts.EKS = &eks.Conf{
+		AWSRegion:   awsInt.AWSRegion,
 		ClusterName: request.EKSName,
 		MachineType: request.MachineType,
 	}

+ 6 - 1
internal/kubernetes/provisioner/aws/ecr/ecr.go

@@ -4,11 +4,16 @@ import v1 "k8s.io/api/core/v1"
 
 // Conf is the ECR cluster config required for the provisioner
 type Conf struct {
-	ECRName string
+	AWSRegion, ECRName string
 }
 
 // AttachECREnv adds the relevant ECR env for the provisioner
 func (conf *Conf) AttachECREnv(env []v1.EnvVar) []v1.EnvVar {
+	env = append(env, v1.EnvVar{
+		Name:  "AWS_REGION",
+		Value: conf.AWSRegion,
+	})
+
 	env = append(env, v1.EnvVar{
 		Name:  "ECR_NAME",
 		Value: conf.ECRName,

+ 6 - 0
internal/kubernetes/provisioner/aws/eks/eks.go

@@ -4,12 +4,18 @@ import v1 "k8s.io/api/core/v1"
 
 // Conf is the EKS cluster config required for the provisioner
 type Conf struct {
+	AWSRegion   string
 	ClusterName string
 	MachineType string
 }
 
 // AttachEKSEnv adds the relevant EKS env for the provisioner
 func (conf *Conf) AttachEKSEnv(env []v1.EnvVar) []v1.EnvVar {
+	env = append(env, v1.EnvVar{
+		Name:  "AWS_REGION",
+		Value: conf.AWSRegion,
+	})
+
 	env = append(env, v1.EnvVar{
 		Name:  "EKS_CLUSTER_NAME",
 		Value: conf.ClusterName,

+ 0 - 20
internal/kubernetes/provisioner/do/do.go

@@ -1,20 +0,0 @@
-package do
-
-import (
-	v1 "k8s.io/api/core/v1"
-)
-
-// Conf is just a DO token
-type Conf struct {
-	DOToken string
-}
-
-// AttachDOEnv adds the relevant DO env for the provisioner
-func (conf *Conf) AttachDOEnv(env []v1.EnvVar) []v1.EnvVar {
-	env = append(env, v1.EnvVar{
-		Name:  "DO_TOKEN",
-		Value: conf.DOToken,
-	})
-
-	return env
-}

+ 0 - 30
internal/kubernetes/provisioner/gcp/gcp.go

@@ -1,30 +0,0 @@
-package gcp
-
-import (
-	v1 "k8s.io/api/core/v1"
-)
-
-// Conf wraps the GCP integration model
-type Conf struct {
-	GCPRegion, GCPProjectID, GCPKeyData string
-}
-
-// AttachGCPEnv adds the relevant AWS env for the provisioner
-func (conf *Conf) AttachGCPEnv(env []v1.EnvVar) []v1.EnvVar {
-	env = append(env, v1.EnvVar{
-		Name:  "GCP_REGION",
-		Value: conf.GCPRegion,
-	})
-
-	env = append(env, v1.EnvVar{
-		Name:  "GCP_CREDENTIALS",
-		Value: conf.GCPKeyData,
-	})
-
-	env = append(env, v1.EnvVar{
-		Name:  "GCP_PROJECT_ID",
-		Value: conf.GCPProjectID,
-	})
-
-	return env
-}

+ 0 - 1
internal/kubernetes/provisioner/input/docr.go

@@ -5,7 +5,6 @@ import (
 )
 
 type DOCR struct {
-	DOToken              string `json:"do_token"`
 	DOCRName             string `json:"docr_name"`
 	DOCRSubscriptionTier string `json:"docr_subscription_tier"`
 }

+ 0 - 1
internal/kubernetes/provisioner/input/doks.go

@@ -6,7 +6,6 @@ import (
 
 type DOKS struct {
 	DORegion    string `json:"do_region"`
-	DOToken     string `json:"do_token"`
 	ClusterName string `json:"cluster_name"`
 }
 

+ 2 - 4
internal/kubernetes/provisioner/input/ecr.go

@@ -5,10 +5,8 @@ import (
 )
 
 type ECR struct {
-	AWSRegion    string `json:"aws_region"`
-	AWSAccessKey string `json:"aws_access_key"`
-	AWSSecretKey string `json:"aws_secret_key"`
-	ECRName      string `json:"ecr_name"`
+	AWSRegion string `json:"aws_region"`
+	ECRName   string `json:"ecr_name"`
 }
 
 func (ecr *ECR) GetInput() ([]byte, error) {

+ 2 - 4
internal/kubernetes/provisioner/input/eks.go

@@ -5,10 +5,8 @@ import (
 )
 
 type EKS struct {
-	AWSRegion    string `json:"aws_region"`
-	AWSAccessKey string `json:"aws_access_key"`
-	AWSSecretKey string `json:"aws_secret_key"`
-	ClusterName  string `json:"cluster_name"`
+	AWSRegion   string `json:"aws_region"`
+	ClusterName string `json:"cluster_name"`
 }
 
 func (eks *EKS) GetInput() ([]byte, error) {

+ 2 - 3
internal/kubernetes/provisioner/input/gcr.go

@@ -5,9 +5,8 @@ import (
 )
 
 type GCR struct {
-	GCPCredentials string `json:"gcp_credentials"`
-	GCPRegion      string `json:"gcp_region"`
-	GCPProjectID   string `json:"gcp_project_id"`
+	GCPRegion    string `json:"gcp_region"`
+	GCPProjectID string `json:"gcp_project_id"`
 }
 
 func (gcr *GCR) GetInput() ([]byte, error) {

+ 3 - 4
internal/kubernetes/provisioner/input/gke.go

@@ -5,10 +5,9 @@ import (
 )
 
 type GKE struct {
-	GCPCredentials string `json:"gcp_credentials"`
-	GCPRegion      string `json:"gcp_region"`
-	GCPProjectID   string `json:"gcp_project_id"`
-	ClusterName    string `json:"cluster_name"`
+	GCPRegion    string `json:"gcp_region"`
+	GCPProjectID string `json:"gcp_project_id"`
+	ClusterName  string `json:"cluster_name"`
 }
 
 func (gke *GKE) GetInput() ([]byte, error) {