import * as cdk from 'aws-cdk-lib'; import { AutoScalingGroup } from 'aws-cdk-lib/aws-autoscaling'; import * as eks from 'aws-cdk-lib/aws-eks'; import * as eksv2 from 'aws-cdk-lib/aws-eks-v2'; import { Construct, IConstruct, IMixin, Node } from 'constructs'; import { ResourceProvider } from '.'; import { EksBlueprintProps } from '../stacks'; import * as constraints from '../utils/constraints-utils'; import { EbsDeviceVolumeType } from 'aws-cdk-lib/aws-ec2'; /** * Supported EKS capability types */ export declare enum CapabilityType { ARGOCD = "argocd", ACK = "ack", KRO = "kro" } export declare enum ArgoCDSsoRole { ADMIN = "ADMIN", EDITOR = "EDITOR", VIEWER = "VIEWER" } export declare enum SsoIdentityType { SSO_USER = "SSO_USER", SSO_GROUP = "SSO_GROUP" } /** * Data type defining helm repositories for GitOps bootstrapping. */ export interface HelmRepository { repoUrl: string; name: string; username?: string; password?: string; } /** * Utility type for values passed to Helm or GitOps applications. */ export type Values = { [key: string]: any; }; /** * Utility type for Kubernetes taints passed to Helm or GitOps applications. */ export type Taint = { key: string; value?: string; effect: "NoSchedule" | "PreferNoSchedule" | "NoExecute"; }; export type Sec = `${number}s`; export type Min = `${number}m`; export type Hour = `${number}h`; export interface BlockDeviceMapping { deviceName?: string; virtualName?: string; ebs?: EbsVolumeMapping; noDevice?: string; } export interface EbsVolumeMapping { deleteOnTermination?: boolean; iops?: number; snapshotId?: string; volumeSize?: string; volumeType?: EbsDeviceVolumeType; kmsKeyId?: string; throughput?: number; outpostArn?: string; encrypted?: boolean; } /** * Interface that includes a reference to a Git repository for reuse, without credentials * and other access information. */ export interface GitRepositoryReference { /** * Expected to support helm style repo at the moment */ repoUrl: string; /** * Path within the repository */ path?: string; /** * Optional name for the bootstrap application */ name?: string; /** * Optional target revision for the repository. * TargetRevision defines the revision of the source * to sync the application to. In case of Git, this can be * commit, tag, or branch. If omitted, will equal to HEAD. * In case of Helm, this is a semver tag for the Chart's version. */ targetRevision?: string; } /** * Data type defining an application repository (git). */ export interface ApplicationRepository extends GitRepositoryReference { /** * Secret from AWS Secrets Manager to import credentials to access the specified git repository. * The secret must exist in the same region and account where the stack will run. */ credentialsSecretName?: string; /** * Depending on credentials type the arn should either point to an SSH key (plain text value) * or a json file with username/password attributes. * For TOKEN type username can be any non-empty username and token value as password. */ credentialsType?: "USERNAME" | "TOKEN" | "SSH"; } /** * Adds Constraints to application repository */ export declare class ApplicationRepositoryConstraints implements constraints.ConstraintsType { credentialsSecretName: constraints.InternetHostStringConstraint; } /** * Provides API to register resource providers and get access to the provided resources. */ export declare class ResourceContext { readonly scope: Construct; readonly blueprintProps: EksBlueprintProps; private readonly resources; constructor(scope: Construct, blueprintProps: EksBlueprintProps); /** * Adds a new resource provider and specifies the name under which the provided resource will be registered, * @param name Specifies the name key under which the provided resources will be registered for subsequent look-ups. * @param provider Implementation of the resource provider interface * @returns the provided resource */ add(name: string, provider: ResourceProvider): T; /** * Gets the provided resource by the supplied name. * @param name under which the resource provider was registered * @returns the resource or undefined if the specified resource was not found */ get(name: string): T | undefined; /** * Adds a namespace resource provider. * @param namespace the namespace name * @param provider Implementation of the resource provider interface * @returns the provided resource */ addNamespace(namespace: string, provider: ResourceProvider): T; /** * Gets a namespace resource by name. * @param namespace the namespace name * @returns the namespace resource or undefined if not found */ getNamespace(namespace: string): T | undefined; getResources(): Map; } export declare enum GlobalResources { Vpc = "vpc", HostedZone = "hosted-zone", Certificate = "certificate", KmsKey = "kms-key", Amp = "amp" } /** * Cluster info supplies required information on the cluster configuration, registered resources and add-ons * which could be leveraged by the framework, add-on implementations and teams. */ export declare class ClusterInfo { readonly cluster: eks.ICluster; readonly version: eks.KubernetesVersion; readonly nodeGroups?: eks.Nodegroup[] | undefined; readonly autoscalingGroups?: AutoScalingGroup[] | undefined; readonly autoMode?: boolean | undefined; readonly fargateProfiles?: eks.FargateProfile[] | undefined; readonly clusterv2?: eksv2.ICluster | undefined; readonly nodegroupsv2?: eksv2.Nodegroup[] | undefined; private readonly provisionedAddOns; private readonly scheduledAddOns; private readonly orderedAddOns; private readonly capabilities; private resourceContext; private addonContext; /** * Constructor for ClusterInfo * @param props */ constructor(cluster: eks.ICluster, version: eks.KubernetesVersion, nodeGroups?: eks.Nodegroup[] | undefined, autoscalingGroups?: AutoScalingGroup[] | undefined, autoMode?: boolean | undefined, fargateProfiles?: eks.FargateProfile[] | undefined, clusterv2?: eksv2.ICluster | undefined, nodegroupsv2?: eksv2.Nodegroup[] | undefined); /** * Provides the resource context object associated with this instance of the EKS Blueprint. * @returns resource context object */ getResourceContext(): ResourceContext; /** * Injection method to provide resource context. * @param resourceContext */ setResourceContext(resourceContext: ResourceContext): void; /** * Update provisionedAddOns map * @param addOn * @param construct */ addProvisionedAddOn(addOn: string, construct: Construct): void; /** * Given the addOn name, return the provisioned addOn construct * @param addOn * @returns undefined */ getProvisionedAddOn(addOn: string): Construct | undefined; /** * Returns all provisioned addons * @returns scheduledAddOns: Map */ getAllProvisionedAddons(): Map; /** * Set the preProvisionedAddOn map with the promise for the construct * of the addon being provisioned * @param addOn * @param promise * @param ordered if addon depends on previous addons for completion (runs serially) */ addScheduledAddOn(addOn: string, promise: Promise, ordered: boolean): void; /** * Indicates if strict ordering is applied to the addon * @param addOn addOn key * @returns */ isOrderedAddOn(addOn: string): boolean; /** * Returns the promise for the Addon construct * @param addOn * @returns Promise */ getScheduledAddOn(addOn: string): Promise | undefined; /** * Returns all scheduled addons * @returns scheduledAddOns: Map> */ getAllScheduledAddons(): Map>; /** * Provides the resource registered under supplied name * @param name of the resource to be returned * @returns Resource object or undefined if no resource was found */ getResource(name: string): T | undefined; /** * Same as {@link getResource} but will fail if the specified resource is not found * @param name of the resource to be returned * @returns Resource object (fails if not found) */ getRequiredResource(name: string): T; /** * Update addonContext map * @param addOn * @param Values */ addAddOnContext(addOn: string, values: Values): void; /** * Returns all addon contexts * @returns addonContext: Map */ getAddOnContexts(): Map; /** * Add a capability to the cluster * @param name capability name * @param capability capability instance */ addCapability(name: string, capability: Construct): void; /** * Get a capability by name * @param name capability name * @returns capability instance or undefined */ getCapability(name: string): Construct | undefined; /** * Get all capabilities * @returns Map of all capabilities */ getAllCapabilities(): Map; } /** * Class for returning multiple objects from a Resource provider * example: VPC as primaryResource and Secondary Subnets as subResources */ export declare class MultiConstruct implements cdk.IResource { readonly stack: cdk.Stack; readonly env: cdk.ResourceEnvironment; readonly node: Node; primaryResource: T; subResources?: R[]; constructor(primaryResource: T, subResources?: R[]); with(...mixins: IMixin[]): IConstruct; applyRemovalPolicy(policy: cdk.RemovalPolicy): void; } export interface AccessPolicyAssociationProps { accessPolicies: eks.IAccessPolicy[]; roleArn: string; clusterName: string; } export declare class AssociateAccessPolicy extends Construct { constructor(scope: Construct, id: string, props: AccessPolicyAssociationProps); } /** * Enum type for two different GitOps operating modes */ export declare enum GitOpsMode { /** * CDK deploys the `Application` resource for each AddOn enabled or customer workloads, * and ArgoCD deploys the actual AddOn and workloads via GitOps based on the `Application` resource. */ APPLICATION = 0, /** * CDK deploys only one `Application` resource for the App of Apps, aka `bootstrap-apps`, * and ArgoCD deploys all the AddOns based on the child `Application` defined in `bootstrap-apps`. */ APP_OF_APPS = 1 }