init
This commit is contained in:
4
packages/resource-authentik/.gitignore
vendored
Normal file
4
packages/resource-authentik/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
/node_modules/
|
||||
/dist/
|
||||
/coverage/
|
||||
/.env
|
||||
30
packages/resource-authentik/package.json
Normal file
30
packages/resource-authentik/package.json
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"type": "module",
|
||||
"main": "dist/exports.js",
|
||||
"scripts": {
|
||||
"build": "tsc --build",
|
||||
"test:unit": "vitest --run --passWithNoTests",
|
||||
"test": "pnpm run \"/^test:/\""
|
||||
},
|
||||
"packageManager": "pnpm@10.6.0",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"exports": {
|
||||
".": "./dist/exports.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "catalog:",
|
||||
"@vitest/coverage-v8": "catalog:",
|
||||
"typescript": "catalog:",
|
||||
"vitest": "catalog:",
|
||||
"@morten-olsen/box-configs": "workspace:*",
|
||||
"@morten-olsen/box-tests": "workspace:*"
|
||||
},
|
||||
"dependencies": {
|
||||
"@morten-olsen/box-k8s": "workspace:*",
|
||||
"@morten-olsen/box-utils": "workspace:*"
|
||||
},
|
||||
"name": "@morten-olsen/box-resource-authentik",
|
||||
"version": "1.0.0"
|
||||
}
|
||||
0
packages/resource-authentik/src/exports.ts
Normal file
0
packages/resource-authentik/src/exports.ts
Normal file
2
packages/resource-authentik/src/global.d.ts
vendored
Normal file
2
packages/resource-authentik/src/global.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
declare type ExplicitAny = any;
|
||||
@@ -0,0 +1,24 @@
|
||||
import { z } from "@morten-olsen/box-k8s";
|
||||
|
||||
const valueOrSecret = z.object({
|
||||
value: z.string().optional(),
|
||||
secret: z.string().optional(),
|
||||
key: z.string().optional(),
|
||||
});
|
||||
|
||||
const serverSpec = z.object({
|
||||
allowedNamespaces: z.array(z.string()).optional(),
|
||||
domain: z.string(),
|
||||
storageClass: z.string().optional(),
|
||||
redis: z.object({
|
||||
url: valueOrSecret,
|
||||
}),
|
||||
database: z.object({
|
||||
url: valueOrSecret,
|
||||
}),
|
||||
clients: z.object({
|
||||
substitutions: z.record(z.string(), z.string()).optional()
|
||||
}).optional(),
|
||||
});
|
||||
|
||||
export { serverSpec };
|
||||
27
packages/resource-authentik/src/resources/server/server.ts
Normal file
27
packages/resource-authentik/src/resources/server/server.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { CustomResource, Secret, type CustomResourceOptions } from "@morten-olsen/box-k8s";
|
||||
import { serverSpec } from "./server.schemas.js";
|
||||
import { API_VERSION } from '@morten-olsen/box-utils/consts';
|
||||
|
||||
type SecretData = {
|
||||
secret: string;
|
||||
};
|
||||
|
||||
class AuthentikServer extends CustomResource<typeof serverSpec> {
|
||||
public static readonly apiVersion = API_VERSION;
|
||||
public static readonly kind = 'AuthentikServer';
|
||||
public static readonly spec = serverSpec;
|
||||
public static readonly scope = 'Namespaced';
|
||||
|
||||
#secret: Secret<SecretData>;
|
||||
|
||||
constructor(options: CustomResourceOptions<typeof serverSpec>) {
|
||||
super(options);
|
||||
this.#secret = this.resources.get(Secret<SecretData>, `${this.name}-secret`, this.namespace);
|
||||
this.#secret.on('changed', this.queueReconcile);
|
||||
}
|
||||
|
||||
public reconcile = async () => {
|
||||
};
|
||||
}
|
||||
|
||||
export { AuthentikServer }
|
||||
10
packages/resource-authentik/tsconfig.json
Normal file
10
packages/resource-authentik/tsconfig.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"include": [
|
||||
"src/**/*.ts"
|
||||
],
|
||||
"extends": "@morten-olsen/box-configs/tsconfig.json"
|
||||
}
|
||||
12
packages/resource-authentik/vitest.config.ts
Normal file
12
packages/resource-authentik/vitest.config.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { defineConfig } from 'vitest/config';
|
||||
import { getAliases } from '@morten-olsen/box-tests/vitest';
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default defineConfig(async () => {
|
||||
const aliases = await getAliases();
|
||||
return {
|
||||
resolve: {
|
||||
alias: aliases,
|
||||
},
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user