Skip to content

Commit

Permalink
feat: initial kubectl layer construct (#1)
Browse files Browse the repository at this point in the history
This is nearly a direct copy from https://github.com/aws/aws-cdk/tree/main/packages/%40aws-cdk/lambda-layer-kubectl with some changes to make it v2-compatible and projen-compatible.

Note: this exposes a `kubeCtlLayer` construct, not the final form `kubeCtlAsset`. I figure it is better to start here and then update this repo in subsequent PRs. However, that means there are some inconsistencies with what I say this library exposes -- since this is not meant for active use right now, I feel like that is ok and will be corrected in a future PR.
  • Loading branch information
kaizencc authored Sep 19, 2022
1 parent 0af7ebe commit d38d49d
Show file tree
Hide file tree
Showing 24 changed files with 1,792 additions and 836 deletions.
2 changes: 2 additions & 0 deletions .gitattributes

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions .github/workflows/auto-approve.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 8 additions & 5 deletions .github/workflows/build.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/pull-request-lint.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 8 additions & 5 deletions .github/workflows/release.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions .github/workflows/upgrade-main.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 10 additions & 7 deletions .projen/deps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .projen/files.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 9 additions & 4 deletions .projen/tasks.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 30 additions & 6 deletions .projenrc.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,39 @@
const { awscdk } = require('projen');
const { awscdk, JsonPatch } = require('projen');
const project = new awscdk.AwsCdkConstructLibrary({
author: 'Kaizen Conroy',
authorAddress: 'zen.conroy@gmail.com',
cdkVersion: '2.1.0',
author: 'Amazon Web Services',
cdkVersion: '2.0.0',
defaultReleaseBranch: 'main',
name: 'awscdk-asset-kubectl',
name: '@aws-cdk/asset-kubectl-v20',
description: 'An Asset construct that contains kubectl, for use in Lambda Layers',
repositoryUrl: 'https://github.com/cdklabs/awscdk-asset-kubectl.git',

homepage: 'https://github.com/cdklabs/aws-asset-awscli#readme',
autoApproveOptions: {
allowedUsernames: ['cdklabs-automation'],
secret: 'GITHUB_TOKEN',
},
autoApproveUpgrades: true,
workflowBootstrapSteps: [
{
// This step is required to allow the build workflow to build docker images.
name: 'Change permissions on /var/run/docker.sock',
run: 'sudo chown superchain /var/run/docker.sock',
},
],
// deps: [], /* Runtime dependencies of this module. */
// description: undefined, /* The description is just a string that helps people understand the purpose of the package. */
// devDeps: [], /* Build dependencies for this module. */
// packageName: undefined, /* The "name" in package.json. */
});

// These patches are required to enable sudo commands in the workflows under `workflowBootstrapSteps`,
// see `workflowBootstrapSteps` above for why a sudo command is needed.
const buildWorkflow = project.tryFindObjectFile('.github/workflows/build.yml');
buildWorkflow.patch(JsonPatch.add('/jobs/build/container/options', '--group-add sudo'));
const releaseWorkflow = project.tryFindObjectFile('.github/workflows/release.yml');
releaseWorkflow.patch(JsonPatch.add('/jobs/release/container/options', '--group-add sudo'));
const upgradeWorkflow = project.tryFindObjectFile('.github/workflows/upgrade-main.yml');
upgradeWorkflow.patch(JsonPatch.add('/jobs/upgrade/container/options', '--group-add sudo'));

project.preCompileTask.exec('layer/build.sh');

project.synth();
Loading

0 comments on commit d38d49d

Please sign in to comment.