-
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
Conversation
package.json
Outdated
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "@aws-quickstart/eks-blueprints", | |||
"version": "1.0.4", | |||
"version": "1.0.5", |
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.
1.1.1
package.json
Outdated
@@ -28,6 +28,7 @@ | |||
"typescript": "~4.5.4" | |||
}, | |||
"dependencies": { | |||
"@aws-quickstart/eks-blueprints": "file:/Users/pevetoej/environment/cdk-eks-blueprints/aws-quickstart-eks-blueprints-1.0.5.tgz", |
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.
drop this change, it was needed for the patterns repo and we made a mistake to run npm i here.
@@ -0,0 +1,15 @@ | |||
apiVersion: v1 |
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.
please drop all redundant files.
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.
you will need to add addon to the mkdocs.yaml file for navigation.
lib/addons/flagger/hpa.yaml
Outdated
@@ -0,0 +1,21 @@ | |||
apiVersion: autoscaling/v2beta2 |
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.
what is this file for ? why is it in the source control?
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.
It was in the file example I got this from and figured an example api version in the file wouldn't hurt the test I was using it for. And I have not deleted those temporary yaml files yet, I can do that now.
lib/addons/flagger/load-tester.yaml
Outdated
@@ -0,0 +1,78 @@ | |||
apiVersion: apps/v1 |
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.
remove this file
@@ -0,0 +1,56 @@ | |||
apiVersion: flagger.app/v1beta1 |
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.
remove this file
lib/addons/flagger/index.ts
Outdated
|
||
let values: Values = { | ||
prometheus: { | ||
install: true |
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.
you are hardcoding the option that we allows customers to pass, ignoring their setting.
lib/addons/flagger/index.ts
Outdated
prometheus: { | ||
install: true | ||
}, | ||
meshProvider: MeshProviderOptions.KUBERNETES |
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.
Please don't hardcode there values.
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.
I thought the way this worked was it set values to these, then if the user put in their own values values = merge(values, this.props.values ?? {});
would override the hardcoded values I put? I hardcoded them since they are the default if the user did not put in anything was the idea. Or should I not have anything by default?
lib/teams/application-team/index.ts
Outdated
@@ -0,0 +1,11 @@ | |||
import { ArnPrincipal } from 'aws-cdk-lib/aws-iam'; |
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.
why is this file here?
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.
Oops when I was trying to figure stuff out for patterns and add a team for it I think I put this into the wrong program when I swapped between them.
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.
it is still in the code, why?
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.
It is gone now, guess I got distracted by other issues and never got around to deleting it. I have done it now though.
.build(app, 'my-stack-name'); | ||
``` | ||
|
||
## Functionality |
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?
@@ -5,6 +5,7 @@ import { Construct } from "constructs"; | |||
import * as blueprints from '../../lib'; |
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.
Fix the GitHub actions warnings.
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.
I am not sure what you mean by that? Are you saying I should have it instead of ../../lib be the import * as blueprints from '@aws-quickstart/eks-blueprints'
?
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.
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.
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.
A few comments for you. Mostly minor. The biggest is related to CRD being part of the API. We need to understand its impact.
Desired behavior: CRD must be installed by default.
docs/addons/flagger.md
Outdated
```typescript | ||
import * as blueprints from '@aws-quickstart/eks-blueprints'; | ||
|
||
const flagger = new blueprints.addons.FlaggerAddOn({ |
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.
Why would you provide an example which ignores your own configuration options and leverages values directly? It defeats the purpose.
Please drop the values (that falls under the standard helm add-on configuraton) and provide an example that is using root level properties only (installPrometheus and meshProvider).
With respect to crd.install
: you mentioned that it is not needed, and moreover if customers pass it as true
stack will fail? Or is it needed?
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.
Well by default Prometheus is true as I stated on line 29 so I figured I would show an example if you wanted to change it. So prometheus has only the option to be false to differ from default, but meshProvider is easier since it has many options. Or is it better to just have the example do FlaggerAddOn()
as a pure default example.
And crd is only needed to be true if you have helm v2, if its helm v3 it will break. Should I just remove it all together? Or is that something that should be kept?
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.
We should only demonstrate the use of our root level props and provide a reference to the yaml file if they want to pass something else. It does not make sense to show customers how to ignore your properties and go straight to values. If you want to show usage of values, please pick something that does not overlap with root level properties.
With respect to CRD: we are creating an addon so that customers don't have to use helm. It is irrelevant what version of helm customer installed on their laptop. Our lambda layer is using helm3, that is the only thing that matters here.
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.
Okay then I would say its best to remove it then if that is the case
lib/addons/flagger/index.ts
Outdated
@@ -0,0 +1,72 @@ | |||
import 'source-map-support/register'; |
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.
we don't need this import. Why was it added?
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.
Not sure might have been from a quick fix I did but it was not faded so I assumed it was doing something. I have deleted it and see it did not mess anything up.
lib/addons/flagger/index.ts
Outdated
/** | ||
* User provided options for the FlaggerAddonProps values. | ||
*/ | ||
export interface FlaggerAddOnProps extends blueprints.HelmAddOnUserProps {//this is the root level |
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.
please remove the comment // this is the root level
it is evident
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.
That was a personal note I forgot to remove, thanks for the catch.
lib/addons/flagger/index.ts
Outdated
export interface FlaggerAddOnProps extends blueprints.HelmAddOnUserProps {//this is the root level | ||
prometheusInstall?: boolean; | ||
meshProvider?: MeshProviderOptions; | ||
crd?: boolean; |
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.
let's finalize whether we need CRDs to be installed.
simple question: if this is not specified are CRDs installed by default?
If the answer is yes
, let's drop it.
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.
That depends on the Helm version the user has. Should we keep it in order to support someone on helm v2 or should we assume all are using helm v3?
lib/addons/flagger/index.ts
Outdated
|
||
let values: Values = { | ||
prometheus: { | ||
install: this.options.prometheusInstall ?? true |
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.
generally we define default values in the defaultProps
structure (line 35) as opposed to hardcoding in the code.
so install: this.options.prometheusInstall ?? defaultProps.prometheusInstall
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.
Good point, better to have the code in one place in case they need to be changed and all values are in one place to know what they are for users.
lib/teams/application-team/index.ts
Outdated
@@ -0,0 +1,11 @@ | |||
import { ArnPrincipal } from 'aws-cdk-lib/aws-iam'; |
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.
it is still in the code, why?
@Eli1123 the checks are failing now on |
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.
almost there, just a few comments
docs/addons/flagger.md
Outdated
|
||
## Functionality | ||
|
||
1. Creates the `flagger` namespace. |
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.
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 comment
The 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.
lib/addons/flagger/index.ts
Outdated
* 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 comment
The reason will be displayed to describe this comment to others. Learn more.
let's rename to installPrometheus
to keep it consistent with all flags like that <verb><subject>
, e.g.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense.
@@ -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 comment
The 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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, please revert.
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.
Almost there. some minor comments on code style.
lib/addons/flagger/index.ts
Outdated
@@ -0,0 +1,66 @@ | |||
import { HelmAddOn, HelmAddOnUserProps, HelmAddOnProps } from "../helm-addon"; | |||
import { ClusterInfo } from "../../spi"; |
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.
please group import together. So whatever is coming from ../../spi should be a single import.
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.
Oh did not notice I did that.
* 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 comment
The reason will be displayed to describe this comment to others. Learn more.
line break here.
HelmAddOn{Space}{
line breaks after class declaration, after member declaration, method. Inside methods if there are distinct paragraphs like {init block}, {call this API block}, {if/then/else} block, use line breaks to segregate.
*/ | ||
export class FlaggerAddOn extends HelmAddOn{ | ||
readonly options: FlaggerAddOnProps; | ||
constructor(props?: FlaggerAddOnProps) { |
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.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
line break here.
lib/addons/flagger/index.ts
Outdated
* User provided options for the FlaggerAddonProps values. | ||
*/ | ||
export interface FlaggerAddOnProps extends HelmAddOnUserProps { | ||
|
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.
public docs for public members of the interface.
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.
I am unsure what you are asking for by that.
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.
Docs for public members of the interface. Jsdocs.
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.
I don't believe I've done a jsdoc yet, I'll have to look into it. Or is that what the @ comments were called.
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.
Like this? (The * are translated into bullets in this text box)
/**
- User provided options for the FlaggerAddonProps values.
- @extends {HelmAddOnUserProps} is needed to set Helm chart values for the interface.
- @prop {boolean} "determines if prometheus is installed with the addon."
- @prop {MeshProviderOptions} "Determines what value for mesh provider is used."
*/
export interface FlaggerAddOnProps extends HelmAddOnUserProps {
installPrometheus?: boolean;
meshProvider?: MeshProviderOptions;
}
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.
Just regular jsdocs on the public member. That means doc above installPrometheus
and doc above meshProvider
so that when developers use your addon, they will see what it means.
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.
so more like this?
/**
- installPrometheus controls if prometheus is installed with the addon or not.
/
installPrometheus?: boolean;
/* - meshProvider controls what mesh provider from MeshProviderOptions enums list is used.
*/
meshProvider?: MeshProviderOptions;
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.
Please don't repeat the name of the field in the doc.
/**
* Controls if prometheus is installed with the addon or not.
* default: true
*/
installPrometheus?: boolean;
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.
That makes sense, so more like this:
/**
- 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;
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.
Yes. Note the formatting of comments.
lib/addons/flagger/index.ts
Outdated
release: "flagger", | ||
repository: "https://flagger.app", | ||
values: { | ||
|
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.
this space is not needed, it is a json structure, not code.
lib/addons/flagger/index.ts
Outdated
deploy(clusterInfo: ClusterInfo): Promise<Construct> { | ||
|
||
let values: Values = { | ||
|
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.
don't break json structures. They are not code.
@Eli1123 Are you planning to work on this PR? |
This PR has been automatically marked as stale because it has been open 60 days |
This PR has been automatically marked as stale because it has been open 60 days |
@Eli1123 Are you planning to work on this PR? |
This PR has been automatically marked as stale because it has been open 60 days |
Sorry, missed this. Currently not planning to continue my intern project here as other projects are keeping me busy. Perhaps later down the road but if someone else wishes to pick up where I left off in the mean time they can feel free to do so. |
This PR has been automatically marked as stale because it has been open 60 days |
Issue #, if available:
Description of changes:
trying to make a pull request without the history of my past pull request.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.