-
Notifications
You must be signed in to change notification settings - Fork 204
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
Flagger addon #440
base: main
Are you sure you want to change the base?
Flagger addon #440
Changes from 13 commits
25a5798
85c3fd9
159cb5a
050652a
81916a4
9e1705c
9d2db1f
79135f2
2cca7a8
39215e8
8459432
4ac7046
5768589
4361c80
4efc9bb
1a1a313
12da84c
795899c
6a788b2
3b7a146
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
## Flagger Add-On | ||
|
||
[Flagger](https://flagger.app/) is a progressive delivery tool that automates the release process for applications running on Kubernetes. It reduces the risk of introducing a new software version in production by gradually shifting traffic to the new version while measuring metrics and running conformance tests. The Flagger add-on provisions the necessary Helm chart, and namespace to allow support for flagger in an EKS workload. | ||
|
||
## Usage | ||
|
||
```typescript | ||
import 'source-map-support/register'; | ||
import * as cdk from 'aws-cdk-lib'; | ||
import * as blueprints from '@aws-quickstart/eks-blueprints'; | ||
|
||
const app = new cdk.App(); | ||
|
||
const addOn = new blueprints.addons.Flagger(); | ||
|
||
const blueprint = blueprints.EksBlueprint.builder() | ||
.addOns(addOn) | ||
.build(app, 'my-stack-name'); | ||
``` | ||
|
||
## Functionality | ||
|
||
1. Creates the `flagger` namespace. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this parameter is optional and may provided by the user in the namespace field of your addon props. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed it to this: 1. Creates the 'flagger' namespace. This parameter is optional and may be provided by the user in the namespace field of your addon props. |
||
2. Deploys the `flagger` Helm chart into the cluster. | ||
3. Supports [standard helm configuration options](./index.md#standard-helm-add-on-configuration-options) | ||
|
||
## Configuration Options | ||
|
||
- `prometheus`: Pass true or false if you wish to track deployment metrics via prometheus. `True by default`. | ||
- `meshProvider`: Pass from the following enum list of meshProviderOptions. `KUBERNETES by default`. | ||
|
||
```typescript | ||
export const enum MeshProviderOptions { | ||
KUBERNETES = 'kubernetes', | ||
ISTIO = 'istio', | ||
LINKERD = 'linkerd', | ||
APPMESH = 'appmesh', | ||
CONTOUR = 'contour', | ||
NGINX = 'nginx', | ||
GLOO = 'gloo', | ||
SKIPPER = 'skipper', | ||
TRAEFIK = 'traefik', | ||
OSM = 'osm' | ||
} | ||
``` | ||
|
||
- Example Configuration: | ||
|
||
```typescript | ||
import * as blueprints from '@aws-quickstart/eks-blueprints'; | ||
|
||
const flagger = new blueprints.addons.FlaggerAddOn(); | ||
`` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,8 @@ import * as ec2 from "aws-cdk-lib/aws-ec2"; | |
import { CapacityType, KubernetesVersion, NodegroupAmiType } from 'aws-cdk-lib/aws-eks'; | ||
import { Construct } from "constructs"; | ||
import * as blueprints from '../../lib'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix the GitHub actions warnings. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure what you mean by that? Are you saying I should have it instead of ../../lib be the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use file view : https://github.com/aws-quickstart/cdk-eks-blueprints/pull/440/files#diff-40d4a72c979379c5b6ab47139c410af18bd607fd5b4f8a26d1aaef9956d8d447 scroll down from my comment and observe github actions warnings. |
||
import { HelmAddOn } from '../../lib'; | ||
import * as team from '../teams'; | ||
import {FlaggerAddOn} from '../../lib/addons/flagger'; | ||
|
||
const burnhamManifestDir = './examples/teams/team-burnham/'; | ||
const rikerManifestDir = './examples/teams/team-riker/'; | ||
|
@@ -20,7 +20,7 @@ export interface BlueprintConstructProps { | |
export default class BlueprintConstruct { | ||
constructor(scope: Construct, props: cdk.StackProps) { | ||
|
||
HelmAddOn.validateHelmVersions = true; | ||
//HelmAddOn.validateHelmVersions = true; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please fix the three github actions warning below like 'teams' is assigned a value but never used There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should I revert this file back to what it was before since I was using it for testing purposes? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, please revert. |
||
|
||
// TODO: fix IAM user provisioning for admin user | ||
// Setup platform team. | ||
|
@@ -132,9 +132,9 @@ export default class BlueprintConstruct { | |
}); | ||
|
||
blueprints.EksBlueprint.builder() | ||
.addOns(...addOns) | ||
.clusterProvider(clusterProvider) | ||
.teams(...teams) | ||
.addOns(new FlaggerAddOn())//...addOns) | ||
//.clusterProvider(clusterProvider) | ||
.teams()//...teams) | ||
.enableControlPlaneLogTypes(blueprints.ControlPlaneLogType.API) | ||
.build(scope, blueprintID, props); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import * as blueprints from '../../'; | ||
import { Construct } from 'constructs'; | ||
import { Values } from "../../spi"; | ||
import merge from "ts-deepmerge"; | ||
|
||
/** | ||
shapirov103 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* User provided options for the FlaggerAddonProps values. | ||
*/ | ||
export interface FlaggerAddOnProps extends blueprints.HelmAddOnUserProps { | ||
prometheusInstall?: boolean; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's rename to https://github.com/aws-quickstart/cdk-eks-blueprints/blob/main/lib/addons/appmesh/index.ts#L17 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That makes sense. |
||
meshProvider?: MeshProviderOptions; | ||
} | ||
|
||
/** | ||
shapirov103 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* All the meshProvider values that can be chosen by the user. | ||
*/ | ||
export const enum MeshProviderOptions { | ||
KUBERNETES = 'kubernetes', | ||
ISTIO = 'istio', | ||
LINKERD = 'linkerd', | ||
APPMESH = 'appmesh', | ||
CONTOUR = 'contour', | ||
NGINX = 'nginx', | ||
GLOO = 'gloo', | ||
SKIPPER = 'skipper', | ||
TRAEFIK = 'traefik', | ||
OSM = 'osm' | ||
} | ||
|
||
/** | ||
shapirov103 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* defaultProps makes the flagger namespace and chart. | ||
*/ | ||
export const defaultProps: blueprints.HelmAddOnProps & FlaggerAddOnProps = { | ||
name: "flagger", | ||
namespace: "flagger", | ||
chart: "flagger", | ||
version: "1.22.0", | ||
release: "flagger", | ||
repository: "https://flagger.app", | ||
values: { | ||
prometheus: { | ||
install: true | ||
}, | ||
meshProvider: MeshProviderOptions.KUBERNETES | ||
} | ||
}; | ||
|
||
/** | ||
* This creates and deploys a cluster with the FlaggerAddOnProps values for flagger settings with preset values unless the user specifies their own values. | ||
*/ | ||
export class FlaggerAddOn extends blueprints.HelmAddOn { | ||
|
||
readonly options: FlaggerAddOnProps; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. line break here. |
||
|
||
constructor(props?: FlaggerAddOnProps) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. line break here. |
||
super({ ...defaultProps, ...props }); | ||
this.options = this.props as FlaggerAddOnProps; | ||
} | ||
|
||
deploy(clusterInfo: blueprints.ClusterInfo): Promise<Construct> { | ||
|
||
let values: Values = { | ||
prometheus: { | ||
install: this.options.prometheusInstall ?? defaultProps.prometheusInstall | ||
}, | ||
meshProvider: this.options.meshProvider ?? defaultProps.meshProvider | ||
}; | ||
|
||
values = merge(values, this.props.values ?? {}); | ||
const chart = this.addHelmChart(clusterInfo, values); | ||
return Promise.resolve(chart); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you want to describe supported configuration options?