diff --git a/.github/workflows/lambda-integration-test.yml b/.github/workflows/lambda-integration-test.yml index 82ac23d..d77da7a 100644 --- a/.github/workflows/lambda-integration-test.yml +++ b/.github/workflows/lambda-integration-test.yml @@ -55,7 +55,7 @@ jobs: pytest -m integration services: nexus: - image: 'quay.io/travelaudience/docker-nexus:3.27.0' + image: 'quay.io/travelaudience/docker-nexus:3.37.3-02' ports: - '8081:8081' options: >- diff --git a/src/lib/sonatype-nexus3-stack.ts b/src/lib/sonatype-nexus3-stack.ts index c7a8305..f9cc5d3 100644 --- a/src/lib/sonatype-nexus3-stack.ts +++ b/src/lib/sonatype-nexus3-stack.ts @@ -18,7 +18,6 @@ import { import { AwsCliLayer } from '@aws-cdk/lambda-layer-awscli'; import { KubectlLayer } from '@aws-cdk/lambda-layer-kubectl'; import * as pjson from '../../package.json'; - const assert = require('assert').strict; export class SonatypeNexus3Stack extends cdk.Stack { @@ -234,10 +233,9 @@ export class SonatypeNexus3Stack extends cdk.Stack { eksVersion = new cdk.CfnParameter(this, 'KubernetesVersion', { type: 'String', allowedValues: [ + '1.22', '1.21', '1.20', - '1.19', - '1.18', ], default: '1.20', description: 'The version of Kubernetes.', @@ -324,7 +322,7 @@ export class SonatypeNexus3Stack extends cdk.Stack { } // install AWS load balancer via Helm charts - const awsLoadBalancerControllerVersion = 'v2.2.1'; + const awsLoadBalancerControllerVersion = 'v2.4.1'; const awsControllerBaseResourceBaseUrl = `https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/${awsLoadBalancerControllerVersion}/docs`; const awsControllerPolicyUrl = `${awsControllerBaseResourceBaseUrl}/install/iam_policy${targetRegion.startsWith('cn-') ? '_cn' : ''}.json`; const albNamespace = 'kube-system'; @@ -366,7 +364,7 @@ export class SonatypeNexus3Stack extends cdk.Stack { repository: partitionMapping.findInMap(cdk.Aws.PARTITION, 'albHelmChartRepo'), namespace: albNamespace, release: 'aws-load-balancer-controller', - version: '1.2.7', // mapping to v2.2.4 + version: '1.4.1', // mapping to v2.4.1 wait: true, timeout: cdk.Duration.minutes(15), values: { @@ -560,10 +558,15 @@ export class SonatypeNexus3Stack extends cdk.Stack { http: { paths: [ { - path: '/*', + path: '/', + pathType: 'Prefix', backend: { - serviceName: `${nexus3ChartName}-sonatype-nexus`, - servicePort: nexusPort, + service: { + name: `${nexus3ChartName}-sonatype-nexus`, + port: { + number: nexusPort, + }, + }, }, }, ], @@ -584,17 +587,27 @@ export class SonatypeNexus3Stack extends cdk.Stack { http: { paths: [ { - path: '/*', + path: '/', + pathType: 'Prefix', backend: { - serviceName: 'ssl-redirect', - servicePort: 'use-annotation', + service: { + name: 'ssl-redirect', + port: { + number: 'use-annotation', + }, + }, }, }, { - path: '/*', + path: '/', + pathType: 'Prefix', backend: { - serviceName: `${nexus3ChartName}-sonatype-nexus`, - servicePort: nexusPort, + service: { + name: `${nexus3ChartName}-sonatype-nexus`, + port: { + number: nexusPort, + }, + }, }, }, ], @@ -650,7 +663,7 @@ export class SonatypeNexus3Stack extends cdk.Stack { } const enableAutoConfigured: boolean = this.node.tryGetContext('enableAutoConfigured') || false; - const nexus3ChartVersion = '5.2.1'; + const nexus3ChartVersion = '5.4.0'; const nexus3PurgeFunc = new lambda_python.PythonFunction(this, 'Nexus3Purge', { description: 'Func purges the resources(such as pvc) left after deleting Nexus3 helm chart', @@ -1009,4 +1022,4 @@ export class SonatypeNexus3Stack extends cdk.Stack { }, }); } -} \ No newline at end of file +} diff --git a/test/sonatype-nexus3.test.ts b/test/sonatype-nexus3.test.ts index 33a643f..961d7af 100644 --- a/test/sonatype-nexus3.test.ts +++ b/test/sonatype-nexus3.test.ts @@ -124,13 +124,13 @@ describe('Nexus OSS stack', () => { { Ref: 'DomainName', }, - '","http":{"paths":[{"path":"/*","backend":{"serviceName":"ssl-redirect","servicePort":"use-annotation"}},{"path":"/*","backend":{"serviceName":"nexus3-sonatype-nexus","servicePort":8081}}]}},{"http":{"paths":[{"path":"/*","backend":{"serviceName":"nexus3-sonatype-nexus","servicePort":8081}}]}}]},"serviceAccount":{"create":false}}', + '","http":{"paths":[{"path":"/","pathType":"Prefix","backend":{"service":{"name":"ssl-redirect","port":{"number":"use-annotation"}}}},{"path":"/","pathType":"Prefix","backend":{"service":{"name":"nexus3-sonatype-nexus","port":{"number":8081}}}}]}},{"http":{"paths":[{"path":"/","pathType":"Prefix","backend":{"service":{"name":"nexus3-sonatype-nexus","port":{"number":8081}}}}]}}]},"serviceAccount":{"create":false}}', ], ], }, Release: 'nexus3', Chart: 'sonatype-nexus', - Version: '5.2.1', + Version: '5.4.0', Namespace: 'default', Repository: { 'Fn::FindInMap': [ @@ -299,7 +299,7 @@ describe('Nexus OSS stack', () => { { Ref: 'DomainName', }, - '","http":{"paths":[{"path":"/*","backend":{"serviceName":"ssl-redirect","servicePort":"use-annotation"}},{"path":"/*","backend":{"serviceName":"nexus3-sonatype-nexus","servicePort":8081}}]}},{"http":{"paths":[{"path":"/*","backend":{"serviceName":"nexus3-sonatype-nexus","servicePort":8081}}]}}]},"serviceAccount":{"create":false},"config":{"enabled":true,"data":{"nexus.properties":"nexus.scripts.allowCreation=true"}},"deployment":{"additionalVolumeMounts":[{"mountPath":"/nexus-data/etc/nexus.properties","subPath":"nexus.properties","name":"sonatype-nexus-conf"}]}}', + '","http":{"paths":[{"path":"/","pathType":"Prefix","backend":{"service":{"name":"ssl-redirect","port":{"number":"use-annotation"}}}},{"path":"/","pathType":"Prefix","backend":{"service":{"name":"nexus3-sonatype-nexus","port":{"number":8081}}}}]}},{"http":{"paths":[{"path":"/","pathType":"Prefix","backend":{"service":{"name":"nexus3-sonatype-nexus","port":{"number":8081}}}}]}}]},"serviceAccount":{"create":false},"config":{"enabled":true,"data":{"nexus.properties":"nexus.scripts.allowCreation=true"}},"deployment":{"additionalVolumeMounts":[{"mountPath":"/nexus-data/etc/nexus.properties","subPath":"nexus.properties","name":"sonatype-nexus-conf"}]}}', ], ], }, @@ -371,7 +371,7 @@ describe('Nexus OSS stack', () => { expect(stack).toHaveResourceLike('Custom::AWSCDK-EKS-HelmChart', { Release: 'aws-load-balancer-controller', Chart: 'aws-load-balancer-controller', - Version: '1.2.7', + Version: '1.4.1', Repository: { 'Fn::FindInMap': [ 'PartitionMapping', @@ -681,7 +681,7 @@ describe('Nexus OSS stack', () => { { Ref: 'LogBucketCC3B17E8', }, - ',access_logs.s3.prefix=albAccessLog"},"tls":{"enabled":false},"rules":[{"http":{"paths":[{"path":"/*","backend":{"serviceName":"nexus3-sonatype-nexus","servicePort":8081}}]}}]},"serviceAccount":{"create":false}}', + ',access_logs.s3.prefix=albAccessLog"},"tls":{"enabled":false},"rules":[{"http":{"paths":[{"path":"/","pathType":"Prefix","backend":{"service":{"name":"nexus3-sonatype-nexus","port":{"number":8081}}}}]}}]},"serviceAccount":{"create":false}}', ], ], }, @@ -719,4 +719,4 @@ function initializeStackWithContextsAndEnvs(app: cdk.App, stack: cdk.Stack, env: env, }); return { app, stack }; -} \ No newline at end of file +}