github.com/jenkins-x/jx/v2@v2.1.155/pkg/cloud/amazon/eks/interface.go (about) 1 package eks 2 3 import ( 4 "github.com/aws/aws-sdk-go/service/eks" 5 "github.com/jenkins-x/jx/v2/pkg/cluster" 6 ) 7 8 // EKSer is an interface that abstracts the use of the EKS API 9 //go:generate pegomock generate github.com/jenkins-x/jx/v2/pkg/cloud/amazon/eks EKSer -o mocks/ekserMock.go 10 type EKSer interface { 11 // EksClusterExists returns whether a cluster exists 12 EksClusterExists(clusterName string, profile string, region string) (bool, error) 13 14 // DescribeCluster describes a cluster and returns an internal cluster.Cluster representation 15 DescribeCluster(clusterName string) (*cluster.Cluster, string, error) 16 17 // ListClusters returns a list of clusters in the AWS account 18 ListClusters() ([]*cluster.Cluster, error) 19 20 // GetClusterAsEKSCluster returns a cluster as eks.Cluster with extra information 21 GetClusterAsEKSCluster(clusterName string) (*eks.Cluster, error) 22 23 // AddTagsToCluster adds the given tags to a cluster 24 AddTagsToCluster(clusterName string, tags map[string]*string) error 25 26 // EksClusterObsoleteStackExists detects if there is obsolete CloudFormation stack for given EKS cluster. 27 // 28 // If EKS cluster creation process is interrupted, there will be CloudFormation stack in ROLLBACK_COMPLETE state left. 29 // Such dead stack prevents eksctl from creating cluster with the same name. This is common activity then to remove stacks 30 // like this and this function performs this action. 31 EksClusterObsoleteStackExists(clusterName string, profile string, region string) (bool, error) 32 33 // CleanUpObsoleteEksClusterStack removes dead eksctl CloudFormation stack associated with given EKS cluster name. 34 CleanUpObsoleteEksClusterStack(clusterName string, profile string, region string) error 35 }