diff --git a/bin/main.ts b/bin/main.ts index 49fd5f0..757c3f9 100644 --- a/bin/main.ts +++ b/bin/main.ts @@ -1,12 +1,9 @@ import { App } from '@aws-cdk/core'; import * as ssp from '@aws-quickstart/ssp-amazon-eks'; -//import * as wego from '@weaveworksoss/weavegitops-ssp-addon'; import { RezilionAddOn } from '../lib'; const app = new App(); ssp.EksBlueprint.builder() - .addOns(new RezilionAddOn({ - apiKey: 'dynamic_test_api_key' - })) - .build(app, 'ssp-rezilion-addon'); + .addOns(new RezilionAddOn('dynamic_test_api_key')) + .build(app, 'lzl-rezilion-addon'); diff --git a/lib/index.ts b/lib/index.ts index ef6362c..3d3e09b 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -1,39 +1,30 @@ -import { ManagedPolicy } from '@aws-cdk/aws-iam'; -import { Construct } from '@aws-cdk/core'; +import {Construct} from '@aws-cdk/core'; import * as ssp from '@aws-quickstart/ssp-amazon-eks'; -import merge from "ts-deepmerge"; -import { HelmAddOn, HelmAddOnProps, HelmAddOnUserProps } from '@aws-quickstart/ssp-amazon-eks/dist/addons/helm-addon'; +import {HelmAddOn, HelmAddOnProps} from '@aws-quickstart/ssp-amazon-eks/dist/addons/helm-addon'; -export interface RezilionAddOnProps extends HelmAddOnUserProps { - apiKey: string -} - - -export const defaultProps: HelmAddOnProps & RezilionAddOnProps = { +export const defaultProps: HelmAddOnProps = { chart: 'rezilion', name: 'rezilion', namespace: 'kube-system', release: 'rezilion', version: '0.0.1', repository: 'https://lzl-ssp-helm-test.s3.eu-west-1.amazonaws.com', - apiKey: 'placeholder' } export class RezilionAddOn extends HelmAddOn { - readonly options: RezilionAddOnProps; + readonly apiKey: String; - constructor(props: RezilionAddOnProps) { + constructor(apiKey, props: HelmAddOnProps = defaultProps) { super({...defaultProps, ...props}); - this.options = this.props as RezilionAddOnProps; + this.apiKey = apiKey } deploy(clusterInfo: ssp.ClusterInfo): void | Promise { - const values = this.options.values ?? {}; - values['apiKey'] = this.options.apiKey + const values = this.props.values ?? {}; + values['apiKey'] = this.apiKey - const chart = this.addHelmChart(clusterInfo, - values); + const chart = this.addHelmChart(clusterInfo, values); return Promise.resolve(chart); }