import { execCmdWithExitOnFailure } from '../cmd-utils' ; import { installGenericHelmChart } from '../helm_deploy' ; import { outputIncludes } from '../utils' ; import { BaseClusterConfig , BaseClusterManager , CloudProvider } from './base' ; /**
 * Basic info for an EKS cluster
 */ export interface AwsClusterConfig extends BaseClusterConfig { clusterRegion : string ; resourceGroupTag : string ; } export class AwsClusterManager extends BaseClusterManager { async switchToSubscription ( ) { } async getAndSwitchToClusterContext ( ) { await execCmdWithExitOnFailure ( `aws eks --region ${ this . clusterConfig . clusterRegion } update-kubeconfig --name ${ this . clusterConfig . clusterName } --alias ${ this . clusterConfig . clusterName }` ) ; } async setupCluster ( context ? ) { await super . setupCluster ( context ) ; await this . installKube2Iam ( ) ; } async installKube2Iam ( ) { const releaseName = 'kube2iam' ; const exists = await outputIncludes ( `helm list` , releaseName , `${ releaseName } exists, skipping install` ) ; if ( ! exists ) { console . info ( `Installing ${ releaseName }` ) ; await installGenericHelmChart ( 'default' , releaseName , 'stable/kube2iam' , [ `--set host.iptables=true` , `--set host.interface="eni+"` , `--set rbac.create=true` , ] , false ) ; } } get clusterConfig ( ) : AwsClusterConfig { return this . _clusterConfig as AwsClusterConfig ; } get kubernetesContextName ( ) : string { return this . clusterConfig . clusterName ; } get cloudProvider ( ) : CloudProvider { return CloudProvider . AWS ; } }