-
Notifications
You must be signed in to change notification settings - Fork 207
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 all 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. 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 |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import { HelmAddOn, HelmAddOnUserProps, HelmAddOnProps } from "../helm-addon"; | ||
import { Construct } from 'constructs'; | ||
import { Values, ClusterInfo } 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 HelmAddOnUserProps { | ||
|
||
/** | ||
* Controls if prometheus is installed with the addon or not. | ||
* default: true | ||
*/ | ||
installPrometheus?: boolean; | ||
/** | ||
* Controls what mesh provider from MeshProviderOptions enums list is used. | ||
* default: MeshProviderOptions.KUBERNETES | ||
*/ | ||
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: 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 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: ClusterInfo): Promise<Construct> { | ||
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. |
||
|
||
let values: Values = { | ||
prometheus: { | ||
install: this.options.installPrometheus ?? defaultProps.installPrometheus | ||
}, | ||
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?