diff --git a/.projen/deps.json b/.projen/deps.json index b2f7a56..f0c7b59 100644 --- a/.projen/deps.json +++ b/.projen/deps.json @@ -88,6 +88,10 @@ { "name": "typescript", "type": "build" + }, + { + "name": "cdk8s", + "type": "runtime" } ], "//": "~~ Generated by projen. To modify, edit .projenrc.ts and run \"npx projen\"." diff --git a/.projen/tasks.json b/.projen/tasks.json index c3dd198..d4d5832 100644 --- a/.projen/tasks.json +++ b/.projen/tasks.json @@ -263,13 +263,13 @@ }, "steps": [ { - "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/jest,eslint-import-resolver-typescript,eslint-plugin-import,jest,jsii-diff,jsii-docgen,jsii-pacmak,projen,ts-jest,ts-node,typescript" + "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/jest,eslint-import-resolver-typescript,eslint-plugin-import,jest,jsii-diff,jsii-docgen,jsii-pacmak,projen,ts-jest,ts-node,typescript,cdk8s" }, { "exec": "yarn install --check-files" }, { - "exec": "yarn upgrade @types/jest @types/node @typescript-eslint/eslint-plugin @typescript-eslint/parser constructs eslint-import-resolver-typescript eslint-plugin-import eslint jest jest-junit jsii-diff jsii-docgen jsii-pacmak jsii-rosetta jsii projen standard-version ts-jest ts-node typescript" + "exec": "yarn upgrade @types/jest @types/node @typescript-eslint/eslint-plugin @typescript-eslint/parser constructs eslint-import-resolver-typescript eslint-plugin-import eslint jest jest-junit jsii-diff jsii-docgen jsii-pacmak jsii-rosetta jsii projen standard-version ts-jest ts-node typescript cdk8s" }, { "exec": "npx projen" diff --git a/.projenrc.ts b/.projenrc.ts index 0099d3a..e2baf53 100644 --- a/.projenrc.ts +++ b/.projenrc.ts @@ -8,7 +8,9 @@ const project = new cdk.JsiiProject({ projenrcTs: true, repositoryUrl: 'git@github.com:bluedynamics/cdk8s-plone.git', - // deps: [], /* Runtime dependencies of this module. */ + deps: [ + "cdk8s", + ], // 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. */ diff --git a/API.md b/API.md new file mode 100644 index 0000000..6203015 --- /dev/null +++ b/API.md @@ -0,0 +1,39 @@ +# API Reference + + + +## Classes + +### Hello + +#### Initializers + +```typescript +import { Hello } from 'cdk8s-plone' + +new Hello() +``` + +| **Name** | **Type** | **Description** | +| --- | --- | --- | + +--- + +#### Methods + +| **Name** | **Description** | +| --- | --- | +| sayHello | *No description.* | + +--- + +##### `sayHello` + +```typescript +public sayHello(): string +``` + + + + + diff --git a/package.json b/package.json index 08d4f87..0002350 100644 --- a/package.json +++ b/package.json @@ -55,6 +55,9 @@ "ts-node": "^10.9.2", "typescript": "^5.4.5" }, + "dependencies": { + "cdk8s": "^2.68.79" + }, "main": "lib/index.js", "license": "Apache-2.0", "publishConfig": { diff --git a/src/backend-deployment.ts b/src/backend-deployment.ts new file mode 100644 index 0000000..f410852 --- /dev/null +++ b/src/backend-deployment.ts @@ -0,0 +1,38 @@ +import { Construct } from 'constructs'; + +export interface PloneBackendDeploymentOptions { + /** + * Specify a custom image for Plone Backend. + * @default "plone/plone-backend:latest" + */ + readonly image?: string; + + /** + * Number of replicas. + * @default 2 + */ + readonly replicas?: number; + + /** + * Port number. + * @default 8080 + */ + readonly port?: number; + + /** + * Extra labels to associate with resources. + * @default - none + */ + readonly labels?: { [name: string]: string }; +} + +export class PloneBackendDeployment extends Construct { + + constructor(scope: Construct, id: string, options: PloneBackendDeploymentOptions = { }) { + super(scope, id); + const baseImage = options.image ?? 'plone/plone-backend:latest'; + const replicas = options.replicas ?? 2; + const port = options.port ?? 8080; + const labels = options.labels ?? {}; + } +} diff --git a/src/backend-service.ts b/src/backend-service.ts new file mode 100644 index 0000000..0a5564f --- /dev/null +++ b/src/backend-service.ts @@ -0,0 +1,24 @@ +import { Construct } from 'constructs'; + +export interface PloneBackendServiceOptions { + /** + * Port number. + * @default 8080 + */ + readonly port?: number; + + /** + * Extra labels to associate with resources. + * @default - none + */ + readonly labels?: { [name: string]: string }; +} + +export class PloneBackendService extends Construct { + + constructor(scope: Construct, id: string, options: PloneBackendServiceOptions = {}) { + super(scope, id); + const port = options.port ?? 8080; + const labels = options.labels ?? {}; + } +} diff --git a/src/backend.ts b/src/backend.ts new file mode 100644 index 0000000..fd1ba4a --- /dev/null +++ b/src/backend.ts @@ -0,0 +1,23 @@ +import { Construct } from 'constructs'; +import { PloneBackendDeploymentOptions, PloneBackendDeployment } from './backend-deployment'; +import { PloneBackendServiceOptions, PloneBackendService } from './backend-service'; + +export interface PloneBackendOptions { + deployment?: PloneBackendDeploymentOptions; + service?: PloneBackendServiceOptions; +} + +export class PloneBackend extends Construct { + + constructor(scope: Construct, id: string, options: PloneBackendOptions = {}) { + super(scope, id); + const deployment = options.deployment ?? {}; + const service = options.service ?? {}; + + // Create a deployment + new PloneBackendDeployment(this, 'deployment', deployment); + + // Create a service + new PloneBackendService(this, 'service', service); + } +} diff --git a/src/index.ts b/src/index.ts index 92c94b8..5bce466 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,3 @@ -export class Hello { - public sayHello() { - return 'hello, world!'; - } -} \ No newline at end of file +export * from './backend-deployment'; +export * from './backend-service'; +export * from './backend'; diff --git a/yarn.lock b/yarn.lock index 7195dee..7adbb5e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1285,6 +1285,15 @@ case@^1.6.3: resolved "https://registry.yarnpkg.com/case/-/case-1.6.3.tgz#0a4386e3e9825351ca2e6216c60467ff5f1ea1c9" integrity sha512-mzDSXIPaFwVDvZAHqZ9VlbyF4yyXRuX6IvB06WvPYkqJVO24kX1PPhv9bfpKNFZyxYFmmgo03HUiD8iklmJYRQ== +cdk8s@^2.68.79: + version "2.68.79" + resolved "https://registry.yarnpkg.com/cdk8s/-/cdk8s-2.68.79.tgz#018fa7592c06c0230c40a0df45389898093dd317" + integrity sha512-aXYFGZU6FflDDz/Ywu2PJ/FHN2mLQbdbQjmzHjKypOk8P99iUcDq3rfWAUxAQGeErQlbyPCilKFfVEa1qqrRwg== + dependencies: + fast-json-patch "^3.1.1" + follow-redirects "^1.15.6" + yaml "2.4.5" + chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" @@ -2253,6 +2262,11 @@ flatted@^3.2.7, flatted@^3.2.9: resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.3.1.tgz#21db470729a6734d4997002f439cb308987f567a" integrity sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw== +follow-redirects@^1.15.6: + version "1.15.6" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.6.tgz#7f815c0cda4249c74ff09e95ef97c23b5fd0399b" + integrity sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA== + for-each@^0.3.3: version "0.3.3" resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e" @@ -4991,7 +5005,7 @@ yallist@^4.0.0: resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== -yaml@^2.2.2: +yaml@2.4.5, yaml@^2.2.2: version "2.4.5" resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.4.5.tgz#60630b206dd6d84df97003d33fc1ddf6296cca5e" integrity sha512-aBx2bnqDzVOyNKfsysjA2ms5ZlnjSAW2eG3/L5G/CSujfjLJTJsEw1bGw8kCf04KodQWk1pxlGnZ56CRxiawmg==