-
Notifications
You must be signed in to change notification settings - Fork 0
/
.projenrc.ts
230 lines (212 loc) · 5.84 KB
/
.projenrc.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
import * as path from "path";
import { MonorepoTsProject } from "@aws/pdk/monorepo";
import { AwsCdkConstructLibrary, AwsCdkTypeScriptApp } from "projen/lib/awscdk";
import { Cdk8sTypeScriptApp, ConstructLibraryCdk8s } from "projen/lib/cdk8s";
import { ConstructLibraryCdktf } from "projen/lib/cdktf";
import { GithubCredentials } from "projen/lib/github";
import { NodePackageManager } from "projen/lib/javascript";
import { TypeScriptProject } from "projen/lib/typescript";
import { CdkTfTypescriptApp } from "./packages/projects/src/cdktf/cdktf-app";
// Metadata
const AUTHOR = "awlsring";
const AUTHOR_CONTACT = "contact@matthewrawlings.com";
const REPOSITORY_URL = "github.com/awlsring/Homelab";
const REPOSITORY = "github:awlsring/Homelab";
// CDK Versioning
const CONSTRUCTS_VERSION = "10.3.0";
const AWS_CDK_VERSION = "2.118.0";
const CDKANS_VERSION = "0.0.0";
const CDKTF_VERSION = "0.20.1";
const CDK8S_VERSION = "2.68.23";
const CDK8S_CLI_VERSION = "2.198.27";
const CDK8S_PLUS_VERSION = "2.7.70";
const K8S_MINOR_VERSION = 27;
// common props for all projects
const projectCommonProps = {
jsiiVersion: "~5",
packageManager: NodePackageManager.PNPM,
author: AUTHOR,
authorName: AUTHOR,
authorEmail: AUTHOR_CONTACT,
authorAddress: AUTHOR_CONTACT,
defaultReleaseBranch: "main",
repository: REPOSITORY,
repositoryUrl: REPOSITORY_URL,
};
const monorepo = new MonorepoTsProject({
...projectCommonProps,
devDeps: ["@aws/pdk"],
name: "Homelab",
packageManager: NodePackageManager.PNPM,
projenrcTs: true,
docgen: true,
github: true,
monorepoUpgradeDeps: true,
autoApproveUpgrades: true,
autoApproveOptions: {
secret: "GITHUB_TOKEN",
allowedUsernames: ["awlsring"],
},
githubOptions: {
projenCredentials: GithubCredentials.fromPersonalAccessToken({
secret: "PROJEN_GITHUB_TOKEN",
}),
},
});
const subprojectProps = {
...projectCommonProps,
eslint: false,
parent: monorepo,
constructsVersion: CONSTRUCTS_VERSION,
cdkVersion: AWS_CDK_VERSION,
cdkansVersion: CDKANS_VERSION,
cdktfVersion: CDKTF_VERSION,
cdk8sVersion: CDK8S_VERSION,
cdk8sPlusVersion: CDK8S_PLUS_VERSION,
cdk8sCliVersion: CDK8S_CLI_VERSION,
k8sMinorVersion: K8S_MINOR_VERSION,
};
// Construct Libraries
// aws cdk constructs
const awsCdkConstructs = new AwsCdkConstructLibrary({
...subprojectProps,
name: "cdk-constructs",
outdir: "packages/aws-cdk-constructs",
devDeps: ["@types/jest"],
testdir: "",
});
// cdktf constructs
const cdktfConstructs = new ConstructLibraryCdktf({
...subprojectProps,
name: "cdktf-constructs",
outdir: "packages/cdktf-constructs",
gitignore: ["src/gen"],
testdir: "",
});
cdktfConstructs.preCompileTask.exec("cdktf get");
// Like CDK8s plus, minus versions
const cdk8sPlusMinus = new ConstructLibraryCdk8s({
...subprojectProps,
name: "cdk8s-plus-minus",
outdir: "packages/cdk8s-plus-minus",
devDeps: [
`cdk8s-cli@${CDK8S_CLI_VERSION}`,
"@types/minimatch",
"@pnpm/logger",
],
peerDeps: ["cdk8s"],
deps: ["minimatch"],
bundledDeps: ["minimatch"],
testdir: "",
});
const importTask = cdk8sPlusMinus.addTask("import", {
exec: `cdk8s -l typescript -o ${path.join("src", "imports")} import k8s`,
description: "Updates imports based on latest version of cdk8s-cli.",
});
cdk8sPlusMinus.compileTask.prependSpawn(importTask);
// cdk8s constructs
const cdk8sConstructs = new ConstructLibraryCdk8s({
...subprojectProps,
name: "cdk8s-constructs",
outdir: "packages/cdk8s-constructs",
deps: [
`cdk8s-plus-27@^${CDK8S_PLUS_VERSION}`,
cdk8sPlusMinus.package.packageName,
],
peerDeps: [
`cdk8s-plus-27@^${CDK8S_PLUS_VERSION}`,
cdk8sPlusMinus.package.packageName,
],
testdir: "",
});
// cdk8s crossplane constructs
const crossplaneCdk8s = new ConstructLibraryCdk8s({
...subprojectProps,
name: "cdk8s-crossplane",
outdir: "packages/cdk8s-crossplane",
devDeps: [`cdk8s-cli@${CDK8S_CLI_VERSION}`],
testdir: "",
});
crossplaneCdk8s.preCompileTask.exec("scripts/make-l1.sh");
// projen projects
new TypeScriptProject({
...subprojectProps,
name: "projen-projects",
outdir: "packages/projects",
deps: ["projen", "semver", "uuid"],
devDeps: ["@types/semver", "@types/uuid", "@types/jest"],
testdir: "",
});
// Projects
// aws resources
new AwsCdkTypeScriptApp({
...subprojectProps,
name: "aws",
outdir: "infrastructure/aws",
deps: [
"@awlsring/cdk-aws-discord-notifiers",
awsCdkConstructs.package.packageName,
],
});
// terraform resources
new CdkTfTypescriptApp({
...subprojectProps,
name: "terraform",
outdir: "infrastructure/terraform",
codeMakerOutput: "src/gen",
terraformProviders: [
{
name: "b2",
source: "backblaze/b2",
version: "0.8.4",
},
{
name: "truenas",
source: "dariusbakunas/truenas",
version: "0.11.0",
},
{
name: "unifi",
source: "paultyng/unifi",
version: "0.41.0",
},
],
deps: [cdktfConstructs.package.packageName, "dotenv"],
gitignore: ["src/gen", ".env"],
});
// Charts
const cluster = new Cdk8sTypeScriptApp({
...subprojectProps,
outdir: "infrastructure/kubernetes",
name: "kubernetes",
deps: [
cdk8sConstructs.package.packageName,
crossplaneCdk8s.package.packageName,
cdk8sPlusMinus.package.packageName,
],
});
cluster.postCompileTask.exec(
"rm -rf charts && mkdir -p charts && cp -r dist/* charts",
);
// new CdkAnsApp({
// ...subprojectProps,
// name: "cluster",
// outdir: "infrastructure/cluster",
// imports: [
// {
// type: ImportType.MODULE,
// namespace: "ansible.builtin",
// source: {
// repo: "https://github.com/ansible/ansible.git",
// },
// },
// {
// type: ImportType.MODULE,
// namespace: "ansible.posix",
// source: {
// repo: "https://github.com/ansible-collections/ansible.posix.git",
// },
// },
// ],
// });
monorepo.synth();