init
This commit is contained in:
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 }
|
||||
Reference in New Issue
Block a user