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

Flagger addon #440

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open

Flagger addon #440

wants to merge 20 commits into from

Conversation

Eli1123
Copy link
Contributor

@Eli1123 Eli1123 commented Jul 20, 2022

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.

@Eli1123 Eli1123 requested review from aws-ia-ci and a team as code owners July 20, 2022 21:09
package.json Outdated
@@ -1,6 +1,6 @@
{
"name": "@aws-quickstart/eks-blueprints",
"version": "1.0.4",
"version": "1.0.5",
Copy link
Collaborator

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",
Copy link
Collaborator

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
Copy link
Collaborator

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.

Copy link
Collaborator

@shapirov103 shapirov103 left a 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.

@@ -0,0 +1,21 @@
apiVersion: autoscaling/v2beta2
Copy link
Collaborator

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?

Copy link
Contributor Author

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.

@@ -0,0 +1,78 @@
apiVersion: apps/v1
Copy link
Collaborator

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
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove this file


let values: Values = {
prometheus: {
install: true
Copy link
Collaborator

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.

prometheus: {
install: true
},
meshProvider: MeshProviderOptions.KUBERNETES
Copy link
Collaborator

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.

Copy link
Contributor Author

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?

@@ -0,0 +1,11 @@
import { ArnPrincipal } from 'aws-cdk-lib/aws-iam';
Copy link
Collaborator

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?

Copy link
Contributor Author

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.

Copy link
Collaborator

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?

Copy link
Contributor Author

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
Copy link
Collaborator

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';
Copy link
Collaborator

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.

Copy link
Contributor Author

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'?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator

@shapirov103 shapirov103 left a 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.

```typescript
import * as blueprints from '@aws-quickstart/eks-blueprints';

const flagger = new blueprints.addons.FlaggerAddOn({
Copy link
Collaborator

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?

Copy link
Contributor Author

@Eli1123 Eli1123 Jul 27, 2022

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?

Copy link
Collaborator

@shapirov103 shapirov103 Jul 27, 2022

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.

Copy link
Contributor Author

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

docs/addons/index.md Show resolved Hide resolved
@@ -0,0 +1,72 @@
import 'source-map-support/register';
Copy link
Collaborator

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?

Copy link
Contributor Author

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.

/**
* User provided options for the FlaggerAddonProps values.
*/
export interface FlaggerAddOnProps extends blueprints.HelmAddOnUserProps {//this is the root level
Copy link
Collaborator

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

Copy link
Contributor Author

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.

export interface FlaggerAddOnProps extends blueprints.HelmAddOnUserProps {//this is the root level
prometheusInstall?: boolean;
meshProvider?: MeshProviderOptions;
crd?: boolean;
Copy link
Collaborator

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.

Copy link
Contributor Author

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?


let values: Values = {
prometheus: {
install: this.options.prometheusInstall ?? true
Copy link
Collaborator

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

Copy link
Contributor Author

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.

@@ -0,0 +1,11 @@
import { ArnPrincipal } from 'aws-cdk-lib/aws-iam';
Copy link
Collaborator

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?

@shapirov103
Copy link
Collaborator

@Eli1123 the checks are failing now on make list.

Copy link
Collaborator

@shapirov103 shapirov103 left a 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


## Functionality

1. Creates the `flagger` namespace.
Copy link
Collaborator

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.

Copy link
Contributor Author

@Eli1123 Eli1123 Jul 28, 2022

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.

* User provided options for the FlaggerAddonProps values.
*/
export interface FlaggerAddOnProps extends blueprints.HelmAddOnUserProps {
prometheusInstall?: boolean;
Copy link
Collaborator

@shapirov103 shapirov103 Jul 28, 2022

Choose a reason for hiding this comment

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

Copy link
Contributor Author

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;
Copy link
Collaborator

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

Copy link
Contributor Author

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?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, please revert.

Copy link
Collaborator

@shapirov103 shapirov103 left a 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.

@@ -0,0 +1,66 @@
import { HelmAddOn, HelmAddOnUserProps, HelmAddOnProps } from "../helm-addon";
import { ClusterInfo } from "../../spi";
Copy link
Collaborator

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.

Copy link
Contributor Author

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.

lib/addons/flagger/index.ts Show resolved Hide resolved
lib/addons/flagger/index.ts Show resolved Hide resolved
lib/addons/flagger/index.ts Show resolved Hide resolved
* 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;
Copy link
Collaborator

@shapirov103 shapirov103 Jul 28, 2022

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) {
Copy link
Collaborator

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> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

line break here.

* User provided options for the FlaggerAddonProps values.
*/
export interface FlaggerAddOnProps extends HelmAddOnUserProps {

Copy link
Collaborator

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.

Copy link
Contributor Author

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.

Copy link
Collaborator

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.

Copy link
Contributor Author

@Eli1123 Eli1123 Jul 29, 2022

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.

Copy link
Contributor Author

@Eli1123 Eli1123 Jul 29, 2022

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;
}

Copy link
Collaborator

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.

Copy link
Contributor Author

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;

Copy link
Collaborator

@shapirov103 shapirov103 Jul 29, 2022

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;

Copy link
Contributor Author

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;

Copy link
Collaborator

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.

release: "flagger",
repository: "https://flagger.app",
values: {

Copy link
Collaborator

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.

deploy(clusterInfo: ClusterInfo): Promise<Construct> {

let values: Values = {

Copy link
Collaborator

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.

@elamaran11
Copy link
Collaborator

@Eli1123 Are you planning to work on this PR?

Copy link

This PR has been automatically marked as stale because it has been open 60 days
with no activity. Remove stale label or comment or this PR will be closed in 10 days

Copy link

This PR has been automatically marked as stale because it has been open 60 days
with no activity. Remove stale label or comment or this PR will be closed in 10 days

@elamaran11
Copy link
Collaborator

@Eli1123 Are you planning to work on this PR?

Copy link

github-actions bot commented Jun 6, 2024

This PR has been automatically marked as stale because it has been open 60 days
with no activity. Remove stale label or comment or this PR will be closed in 10 days

@github-actions github-actions bot added the stale label Jun 6, 2024
@elamaran11 elamaran11 removed the stale label Jun 6, 2024
@Eli1123
Copy link
Contributor Author

Eli1123 commented Jul 1, 2024

@Eli1123 Are you planning to work on this PR?

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.

Copy link

This PR has been automatically marked as stale because it has been open 60 days
with no activity. Remove stale label or comment or this PR will be closed in 10 days

@github-actions github-actions bot added the stale label Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants