Skip to content
This repository has been archived by the owner on May 17, 2023. It is now read-only.

Commit

Permalink
chore: bump aws load balancer controller, nexus chart adapting to net…
Browse files Browse the repository at this point in the history
…work api v1 (#160)
  • Loading branch information
loneizhao committed Jul 22, 2022
1 parent c9b56aa commit 16fabf4
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lambda-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: >-
Expand Down
45 changes: 29 additions & 16 deletions src/lib/sonatype-nexus3-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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.',
Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -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,
},
},
},
},
],
Expand All @@ -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,
},
},
},
},
],
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -1009,4 +1022,4 @@ export class SonatypeNexus3Stack extends cdk.Stack {
},
});
}
}
}
12 changes: 6 additions & 6 deletions test/sonatype-nexus3.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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': [
Expand Down Expand Up @@ -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"}]}}',
],
],
},
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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}}',
],
],
},
Expand Down Expand Up @@ -719,4 +719,4 @@ function initializeStackWithContextsAndEnvs(app: cdk.App, stack: cdk.Stack,
env: env,
});
return { app, stack };
}
}

0 comments on commit 16fabf4

Please sign in to comment.