Skip to content

Commit

Permalink
feat: add k8s manifest operator (#273)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thrimbda authored Nov 24, 2023
1 parent 5bfad27 commit 692b598
Show file tree
Hide file tree
Showing 21 changed files with 2,413 additions and 12 deletions.
411 changes: 411 additions & 0 deletions apps/k8s-manifest-operator/api-extractor.json

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions apps/k8s-manifest-operator/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# syntax = docker/dockerfile:1.4

FROM node:18.17.0-bullseye-slim

LABEL maintainer="Siyuan Wang <[email protected]>"

# https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#handling-kernel-signals
ARG TINI_VERSION=v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod a+x /tini
ENTRYPOINT ["/tini", "--"]

USER node

WORKDIR /app

ENV NODE_ENV=production

COPY --chown=node:node ./out/app-k8s-manifest-operator-out /app

RUN node create-links.js create

WORKDIR /app/apps/k8s-manifest-operator

# USER nobody
CMD ["node", "./lib/index.js"]
3 changes: 3 additions & 0 deletions apps/k8s-manifest-operator/config/jest.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "@rushstack/heft-node-rig/profiles/default/config/jest.config.json"
}
18 changes: 18 additions & 0 deletions apps/k8s-manifest-operator/config/rig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// The "rig.json" file directs tools to look for their config files in an external package.
// Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package
{
"$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json",

/**
* (Required) The name of the rig package to inherit from.
* It should be an NPM package name with the "-rig" suffix.
*/
"rigPackageName": "@rushstack/heft-node-rig"

/**
* (Optional) Selects a config profile from the rig package. The name must consist of
* lowercase alphanumeric words separated by hyphens, for example "sample-profile".
* If omitted, then the "default" profile will be used."
*/
// "rigProfile": "your-profile-name"
}
87 changes: 87 additions & 0 deletions apps/k8s-manifest-operator/config/typescript.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/**
* Configures the TypeScript plugin for Heft. This plugin also manages linting.
*/
{
"$schema": "https://developer.microsoft.com/json-schemas/heft/typescript.schema.json",

/**
* Optionally specifies another JSON config file that this file extends from. This provides a way for standard
* settings to be shared across multiple projects.
*/
// "extends": "base-project/config/typescript.json",

/**
* Can be set to "copy" or "hardlink". If set to "copy", copy files from cache.
* If set to "hardlink", files will be hardlinked to the cache location.
* This option is useful when producing a tarball of build output as TAR files don't
* handle these hardlinks correctly. "hardlink" is the default behavior.
*/
// "copyFromCacheMode": "copy",

/**
* If provided, emit these module kinds in addition to the modules specified in the tsconfig.
* Note that this option only applies to the main tsconfig.json configuration.
*/
"additionalModuleKindsToEmit": [
{
"moduleKind": "esnext",
"outFolderName": "dist"
}
// {
// /**
// * (Required) Must be one of "commonjs", "amd", "umd", "system", "es2015", "esnext"
// */
// "moduleKind": "amd",
//
// /**
// * (Required) The name of the folder where the output will be written.
// */
// "outFolderName": "lib-amd"
// }
],

/**
* Specifies the intermediary folder that tests will use. Because Jest uses the
* Node.js runtime to execute tests, the module format must be CommonJS.
*
* The default value is "lib".
*/
// "emitFolderNameForTests": "lib-commonjs",

/**
* If set to "true", the TSlint task will not be invoked.
*/
// "disableTslint": true,

/**
* Set this to change the maximum number of file handles that will be opened concurrently for writing.
* The default is 50.
*/
// "maxWriteParallelism": 50,

/**
* Configures additional file types that should be copied into the TypeScript compiler's emit folders, for example
* so that these files can be resolved by import statements.
*/
"staticAssetsToCopy": {
/**
* File extensions that should be copied from the src folder to the destination folder(s).
*/
// "fileExtensions": [
// ".json", ".css"
// ],
/**
* Glob patterns that should be explicitly included.
*/
// "includeGlobs": [
// "some/path/*.js"
// ],
/**
* Glob patterns that should be explicitly excluded. This takes precedence over globs listed
* in "includeGlobs" and files that match the file extensions provided in "fileExtensions".
*/
// "excludeGlobs": [
// "some/path/*.css"
// ]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## API Report File for "@yuants/app-k8s-manifest-operator"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts

// (No @packageDocumentation comment for this package)

```
36 changes: 36 additions & 0 deletions apps/k8s-manifest-operator/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "@yuants/app-k8s-manifest-operator",
"version": "0.0.0",
"main": "lib/index.js",
"scripts": {
"build": "heft test --clean && api-extractor run --local && yuan-toolkit post-build",
"dev": "node lib/index.js"
},
"dependencies": {
"@kubernetes/client-node": "0.20.0",
"@yuants/extension": "workspace:*",
"deep-equal": "~2.2.2",
"rxjs": "~7.5.6",
"@yuants/data-model": "workspace:*",
"tar": "~6.2.0",
"node-fetch": "~2.7.0"
},
"devDependencies": {
"@types/deep-equal": "~1.0.3",
"@microsoft/api-extractor": "~7.30.0",
"@rushstack/heft": "~0.47.5",
"@rushstack/heft-jest-plugin": "~0.3.30",
"@rushstack/heft-node-rig": "~1.10.7",
"@types/heft-jest": "1.0.3",
"@types/json-schema": "~7.0.14",
"@types/node": "18",
"@yuants/tool-kit": "workspace:*",
"typescript": "~4.7.4",
"@types/node-fetch": "~2.6.9",
"@types/tar": "~6.1.10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org",
"access": "public"
}
}
Loading

0 comments on commit 692b598

Please sign in to comment.