Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add k8s manifest operator #273

Merged
merged 4 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <c.one@thrimbda.com>"

# 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"
}
}
44 changes: 44 additions & 0 deletions apps/k8s-manifest-operator/package/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "@yuants/app-agent",
"version": "0.4.0",
"main": "lib/index.js",
"files": [
"dist",
"lib",
"temp"
],
"dependencies": {
"@rollup/browser": "~3.26.3",
"@yuants/agent": "0.5.0",
"@yuants/data-model": "0.1.5",
"@yuants/kernel": "0.5.0",
"@yuants/protocol": "0.3.1",
"ajv": "~8.12.0",
"fs-extra": "~11.1.1",
"javascript-obfuscator": "~4.0.2",
"path-browserify": "~1.0.1",
"rxjs": "~7.5.6",
"yaml": "~2.3.1"
},
"devDependencies": {
"@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/fs-extra": "~11.0.1",
"@types/heft-jest": "1.0.3",
"@types/json-schema": "~7.0.12",
"@types/node": "18",
"@types/path-browserify": "~1.0.0",
"@yuants/extension": "0.1.2",
"@yuants/tool-kit": "0.1.1",
"typescript": "~4.7.4"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org"
},
"scripts": {
"build": "heft test --clean && api-extractor run --local && yuan-toolkit post-build"
}
}
Loading