Implement EKS support [#5]

I *think* this will work, but without access to an EKS cluster I can't
actually test it.
This commit is contained in:
Erin Call
2019-12-27 10:39:06 -08:00
parent d8d2e33b20
commit 9c1ed849ab
7 changed files with 68 additions and 3 deletions

View File

@@ -15,6 +15,8 @@ type InitKube struct {
APIServer string
ServiceAccount string
Token string
EKSCluster string
EKSRoleARN string
TemplateFile string
ConfigFile string
@@ -30,6 +32,8 @@ type kubeValues struct {
Namespace string
ServiceAccount string
Token string
EKSCluster string
EKSRoleARN string
}
// Execute generates a kubernetes config file from drone-helm3's template.
@@ -48,9 +52,12 @@ func (i *InitKube) Prepare(cfg Config) error {
if i.APIServer == "" {
return errors.New("an API Server is needed to deploy")
}
if i.Token == "" {
if i.Token == "" && i.EKSCluster == "" {
return errors.New("token is needed to deploy")
}
if i.Token != "" && i.EKSCluster != "" {
return errors.New("token cannot be used simultaneously with eksCluster")
}
if i.ServiceAccount == "" {
i.ServiceAccount = "helm"
@@ -70,6 +77,8 @@ func (i *InitKube) Prepare(cfg Config) error {
APIServer: i.APIServer,
ServiceAccount: i.ServiceAccount,
Token: i.Token,
EKSCluster: i.EKSCluster,
EKSRoleARN: i.EKSRoleARN,
Namespace: cfg.Namespace,
}