jx: github.com/jenkins-x/jx/pkg/cloud/amazon Index | Files | Directories

package amazon

import "github.com/jenkins-x/jx/pkg/cloud/amazon"


Package Files

cli.go common.go ecr.go eks.go permissions.go routes.go s3.go zones.go


const (
    // PoliciesTemplateName is the name of the custom policies CloudFormation stack that will be executed before
    // calling the eksctl commands
    PoliciesTemplateName = "jenkinsx-policies.yml"
    // ConfigTemplatesFolder is part of the path to the configuration templates
    ConfigTemplatesFolder = "templates"
    // IRSATemplateName is the name of the eksctl configuration file that will be processed after creating the policies
    IRSATemplateName = "irsa.tmpl.yaml"
const DefaultRegion = "us-west-2"

func AvailabilityZones Uses

func AvailabilityZones() ([]string, error)

func CleanUpObsoleteEksClusterStack Uses

func CleanUpObsoleteEksClusterStack(clusterName string, profile string, region string) error

CleanUpObsoleteEksClusterStack removes dead eksctl CloudFormation stack associated with given EKS cluster name.

func CreateIRSAManagedServiceAccounts Uses

func CreateIRSAManagedServiceAccounts(requirements *config.RequirementsConfig, kubeProvidersDir string) error

CreateIRSAManagedServiceAccounts takes the KubeProviders directory and the requirements configuration and creates new ServiceAccounts annotated with a role ARN that is generated by eksctl. The policies attached to these roles are defined in the jenkinsx-policies.yml file within kubeProviders/eks/templates Note: this can't yet be executed in the master pipeline of the Dev Environment because in order to recreate the ServiceAccounts, we need to delete them and the roles first, which causes the next commands to fail

func CreateS3Bucket Uses

func CreateS3Bucket(bucketName string, profile string, region string) (string, error)

CreateS3Bucket creates a new S3 bucket in the default region with the given bucket name returning the location string

func EksClusterExists Uses

func EksClusterExists(clusterName string, profile string, region string) (bool, error)

EksClusterExists checks if EKS cluster with given name exists in given region.

func EksClusterObsoleteStackExists Uses

func EksClusterObsoleteStackExists(clusterName string, profile string, region string) (bool, error)

EksClusterObsoleteStackExists detects if there is obsolete CloudFormation stack for given EKS cluster.

If EKS cluster creation process is interrupted, there will be CloudFormation stack in ROLLBACK_COMPLETE state left. Such dead stack prevents eksctl from creating cluster with the same name. This is common activity then to remove stacks like this and this function performs this action.

func EksctlStackName Uses

func EksctlStackName(clusterName string) string

EksctlStackName generates CloudFormation stack name for given EKS cluster name. This function follows eksctl naming convention.

func EnableIRSASupportInCluster Uses

func EnableIRSASupportInCluster(requirements *config.RequirementsConfig) error

EnableIRSASupportInCluster Associates IAM as an OIDC provider so it can sign requests and assume roles

func GetAccountIDAndRegion Uses

func GetAccountIDAndRegion(profile string, region string) (string, string, error)

GetAccountIDAndRegion returns the current account ID and region

func GetClusterNameAndRegionFromAWS Uses

func GetClusterNameAndRegionFromAWS(profileOption string, regionOption string, kubeEndpoint string) (string, string, error)

GetClusterNameAndRegionFromAWS uses the AWS SDK to parse through each EKS cluster until it finds one that matches the endpoint in the kubeconfig. From there it will retrieve the cluster name

func GetContainerRegistryHost Uses

func GetContainerRegistryHost() (string, error)


func GetCurrentlyConnectedRegionAndClusterName Uses

func GetCurrentlyConnectedRegionAndClusterName() (string, string, error)

GetCurrentlyConnectedRegionAndClusterName gets the current context for the connected cluster and parses it to extract both the Region and the ClusterName

func GetRegionFromContainerRegistryHost Uses

func GetRegionFromContainerRegistryHost(kubeClient kubernetes.Interface, namespace string, dockerRegistry string) string


This function is kept for backwards compatibility. AWS region should not be resolved from ECR address, but read from ConfigMap (see RememberRegion function). To keep backwards compatibility with existing installations this function will be kept for a while and it will perform migration to config map. Eventually it will be removed from a codebase.

func InstallAwsIamAuthenticator Uses

func InstallAwsIamAuthenticator(skipPathScan bool) error

InstallAwsIamAuthenticator install iam authenticator for AWS

func InstallAwsIamAuthenticatorWithVersion Uses

func InstallAwsIamAuthenticatorWithVersion(version string, skipPathScan bool) error

InstallAwsIamAuthenticatorWithVersion install a specific version of iam authenticator for AWS

func InstallEksCtl Uses

func InstallEksCtl(skipPathScan bool) error

InstallEksCtl installs eks cli

func InstallEksCtlWithVersion Uses

func InstallEksCtlWithVersion(version string, skipPathScan bool) error

InstallEksCtlWithVersion install a specific version of eks cli

func InstallKops Uses

func InstallKops() error

InstallKops installs kops

func LazyCreateRegistry Uses

func LazyCreateRegistry(kube kubernetes.Interface, namespace string, region string, dockerRegistry string, orgName string, appName string) error

LazyCreateRegistry lazily creates the ECR registry if it does not already exist

func NewAwsSession Uses

func NewAwsSession(profileOption string, regionOption string) (*session.Session, error)

func NewAwsSessionWithoutOptions Uses

func NewAwsSessionWithoutOptions() (*session.Session, error)

func ParseContext Uses

func ParseContext(context string) (string, string, error)

ParseContext parses the EKS cluster context to extract the cluster name and the region

func RegisterAwsCustomDomain Uses

func RegisterAwsCustomDomain(customDomain string, elbAddress string) error

RegisterAwsCustomDomain registers a wildcard ALIAS for the custom domain to point at the given ELB host name

func ResolveRegion Uses

func ResolveRegion(profileOption string, regionOption string) (string, error)

func ResolveRegionWithoutOptions Uses

func ResolveRegionWithoutOptions() (string, error)

func UserHomeDir Uses

func UserHomeDir() string

UserHomeDir returns the home directory for the user the process is running under. This is a copy of shareddefaults.UserHomeDir in the internal AWS package. We can't user user.Current().HomeDir as we want to override this during testing. :-|



Package amazon imports 34 packages (graph) and is imported by 10 packages. Updated 2019-11-11. Refresh now. Tools for package owners.