Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add patterns for argo addon management #59

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions bin/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,13 @@ new KubeflowConstruct(app, 'kubeflow');

import EmrEksConstruct from '../lib/emr-eks';
import { dataTeam } from '../lib/teams/team-emr-on-eks';
new EmrEksConstruct().build(app, 'emrOnEks', [dataTeam]);

import GitOpsAddOnsConstruct from '../lib/gitops-addons-construct';
new GitOpsAddOnsConstruct(app, 'gitops-addons');

new EmrEksConstruct().build(app, 'emrOnEks', [dataTeam]);
import GitOpsAppOfAppsAddOnsConstruct from '../lib/gitops-app-of-apps-addons-construct';
new GitOpsAppOfAppsAddOnsConstruct(app, 'gitops-app-of-apps-addons');

//--------------------------------------------------------------------------
// Single Cluster, Secure Ingress Auth using cognito
Expand All @@ -174,4 +178,4 @@ new PipelineSecureIngressCognito()
.buildAsync(app, 'secure-ingress')
.catch(() => {
logger.info("Secure Ingress Auth pattern is not setup due to missing secrets for ArgoCD admin pwd. See Secure Ingress Auth in the readme for instructions");
});
});
43 changes: 43 additions & 0 deletions lib/gitops-addons-construct/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { Construct } from 'constructs';
import * as blueprints from '@aws-quickstart/eks-blueprints'

/**
* GitOps AddOns pattern shows how to install and manage cluster addons via ArgoCD GitOps
* The addons are provided in this repo as an example: https://github.com/aws-samples/eks-blueprints-add-ons
*/
export default class GitOpsAddOnsConstruct {

constructor(scope: Construct, id: string) {
// enable gitops bootstrapping with argocd
const bootstrapArgo = new blueprints.addons.ArgoCDAddOn({
bootstrapRepo: {
repoUrl: 'https://github.com/aws-samples/eks-blueprints-add-ons',
path: 'add-ons',
targetRevision: "eks-blueprints-cdk",
},
});

// AddOns for the cluster.
const addOns: Array<blueprints.ClusterAddOn> = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These all add-ons worked fine. What is the list of supported add-ons atm? Don't expect you to remember on top of your head, but if you can point to some that are not supported, don't work, please let me know.

bootstrapArgo,
new blueprints.AppMeshAddOn,
new blueprints.AwsLoadBalancerControllerAddOn,
new blueprints.ClusterAutoScalerAddOn,
new blueprints.MetricsServerAddOn,
new blueprints.NginxAddOn({
values: {
controller: { service: { create: false } }
}
}),
new blueprints.SecretsStoreAddOn,
];

const stackID = `${id}-blueprint`

blueprints.EksBlueprint.builder()
.region(process.env.CDK_DEFAULT_REGION!)
.addOns(...addOns)
.enableGitOps(blueprints.GitOpsMode.APPLICATION)
.build(scope, stackID);
}
}
43 changes: 43 additions & 0 deletions lib/gitops-app-of-apps-addons-construct/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { Construct } from 'constructs';
import * as blueprints from '@aws-quickstart/eks-blueprints'

/**
* GitOps AppOfApps AddOns pattern shows how to install and manage cluster addons via ArgoCD GitOps App of Apps
* The addons are provided in this repo as an example: https://github.com/aws-samples/eks-blueprints-add-ons
*/
export default class GitOpsAppOfAppsAddOnsConstruct {

constructor(scope: Construct, id: string) {
// enable gitops bootstrapping with argocd app of apps
const bootstrapArgo = new blueprints.addons.ArgoCDAddOn({
bootstrapRepo: {
repoUrl: 'https://github.com/aws-samples/eks-blueprints-add-ons',
path: 'chart',
targetRevision: "eks-blueprints-cdk",
},
});

// AddOns for the cluster.
const addOns: Array<blueprints.ClusterAddOn> = [
bootstrapArgo,
new blueprints.AppMeshAddOn,
new blueprints.AwsLoadBalancerControllerAddOn,
new blueprints.ClusterAutoScalerAddOn,
new blueprints.MetricsServerAddOn,
new blueprints.NginxAddOn({
values: {
controller: { service: { create: false } }
}
}),
new blueprints.SecretsStoreAddOn,
];

const stackID = `${id}-blueprint`

blueprints.EksBlueprint.builder()
.region(process.env.CDK_DEFAULT_REGION!)
.addOns(...addOns)
.enableGitOps(blueprints.GitOpsMode.APP_OF_APPS)
.build(scope, stackID);
}
}