mirror of
https://github.com/morten-olsen/homelab-operator.git
synced 2026-02-08 01:36:28 +01:00
more
This commit is contained in:
@@ -30,7 +30,8 @@
|
|||||||
"openapi-fetch": "^0.14.0",
|
"openapi-fetch": "^0.14.0",
|
||||||
"pg": "^8.16.3",
|
"pg": "^8.16.3",
|
||||||
"sqlite3": "^5.1.7",
|
"sqlite3": "^5.1.7",
|
||||||
"yaml": "^2.8.0"
|
"yaml": "^2.8.0",
|
||||||
|
"zod": "^4.0.14"
|
||||||
},
|
},
|
||||||
"packageManager": "pnpm@10.6.0",
|
"packageManager": "pnpm@10.6.0",
|
||||||
"pnpm": {
|
"pnpm": {
|
||||||
|
|||||||
17
pnpm-lock.yaml
generated
17
pnpm-lock.yaml
generated
@@ -4,11 +4,6 @@ settings:
|
|||||||
autoInstallPeers: true
|
autoInstallPeers: true
|
||||||
excludeLinksFromLockfile: false
|
excludeLinksFromLockfile: false
|
||||||
|
|
||||||
patchedDependencies:
|
|
||||||
'@kubernetes/client-node':
|
|
||||||
hash: 0b0e5d32aa2930107c8c9b45df2639faf53fa12a389a551885d6e42d71f9429d
|
|
||||||
path: patches/@kubernetes__client-node.patch
|
|
||||||
|
|
||||||
importers:
|
importers:
|
||||||
|
|
||||||
.:
|
.:
|
||||||
@@ -18,7 +13,7 @@ importers:
|
|||||||
version: 2025.6.3-1751754396
|
version: 2025.6.3-1751754396
|
||||||
'@kubernetes/client-node':
|
'@kubernetes/client-node':
|
||||||
specifier: ^1.3.0
|
specifier: ^1.3.0
|
||||||
version: 1.3.0(patch_hash=0b0e5d32aa2930107c8c9b45df2639faf53fa12a389a551885d6e42d71f9429d)(encoding@0.1.13)
|
version: 1.3.0(encoding@0.1.13)
|
||||||
'@sinclair/typebox':
|
'@sinclair/typebox':
|
||||||
specifier: ^0.34.38
|
specifier: ^0.34.38
|
||||||
version: 0.34.38
|
version: 0.34.38
|
||||||
@@ -40,6 +35,9 @@ importers:
|
|||||||
yaml:
|
yaml:
|
||||||
specifier: ^2.8.0
|
specifier: ^2.8.0
|
||||||
version: 2.8.0
|
version: 2.8.0
|
||||||
|
zod:
|
||||||
|
specifier: ^4.0.14
|
||||||
|
version: 4.0.14
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@eslint/eslintrc':
|
'@eslint/eslintrc':
|
||||||
specifier: 3.3.1
|
specifier: 3.3.1
|
||||||
@@ -2484,6 +2482,9 @@ packages:
|
|||||||
resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==}
|
resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==}
|
||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
|
|
||||||
|
zod@4.0.14:
|
||||||
|
resolution: {integrity: sha512-nGFJTnJN6cM2v9kXL+SOBq3AtjQby3Mv5ySGFof5UGRHrRioSJ5iG680cYNjE/yWk671nROcpPj4hAS8nyLhSw==}
|
||||||
|
|
||||||
snapshots:
|
snapshots:
|
||||||
|
|
||||||
'@babel/code-frame@7.27.1':
|
'@babel/code-frame@7.27.1':
|
||||||
@@ -2566,7 +2567,7 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
jsep: 1.4.0
|
jsep: 1.4.0
|
||||||
|
|
||||||
'@kubernetes/client-node@1.3.0(patch_hash=0b0e5d32aa2930107c8c9b45df2639faf53fa12a389a551885d6e42d71f9429d)(encoding@0.1.13)':
|
'@kubernetes/client-node@1.3.0(encoding@0.1.13)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/js-yaml': 4.0.9
|
'@types/js-yaml': 4.0.9
|
||||||
'@types/node': 22.16.5
|
'@types/node': 22.16.5
|
||||||
@@ -5275,3 +5276,5 @@ snapshots:
|
|||||||
yargs-parser@21.1.1: {}
|
yargs-parser@21.1.1: {}
|
||||||
|
|
||||||
yocto-queue@0.1.0: {}
|
yocto-queue@0.1.0: {}
|
||||||
|
|
||||||
|
zod@4.0.14: {}
|
||||||
|
|||||||
26
src/crds/backup/backup-report.ts/backup-report.ts
Normal file
26
src/crds/backup/backup-report.ts/backup-report.ts
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import { createCustomResource } from '../../../custom-resource/custom-resource.base.ts';
|
||||||
|
|
||||||
|
const backupReportSchema = z.object({
|
||||||
|
spec: z.object({
|
||||||
|
startedAt: z.string({
|
||||||
|
format: 'date-time',
|
||||||
|
}),
|
||||||
|
finishedAt: z.string({
|
||||||
|
format: 'date-time',
|
||||||
|
}),
|
||||||
|
status: z.enum(['success', 'failed']),
|
||||||
|
error: z.string().optional(),
|
||||||
|
message: z.string().optional(),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
const BackupReport = createCustomResource({
|
||||||
|
kind: 'BackupReport',
|
||||||
|
spec: backupReportSchema,
|
||||||
|
names: {
|
||||||
|
plural: 'backupreports',
|
||||||
|
singular: 'backupreport',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export { BackupReport };
|
||||||
0
src/crds/backup/backup/backup.ts
Normal file
0
src/crds/backup/backup/backup.ts
Normal file
@@ -2,6 +2,7 @@ import { type Static, type TObject, type TSchema } from '@sinclair/typebox';
|
|||||||
|
|
||||||
import { GROUP } from '../utils/consts.ts';
|
import { GROUP } from '../utils/consts.ts';
|
||||||
import type { Services } from '../utils/service.ts';
|
import type { Services } from '../utils/service.ts';
|
||||||
|
import { noopAsync } from '../utils/types.js';
|
||||||
|
|
||||||
import { customResourceStatusSchema, type CustomResourceRequest } from './custom-resource.request.ts';
|
import { customResourceStatusSchema, type CustomResourceRequest } from './custom-resource.request.ts';
|
||||||
|
|
||||||
@@ -103,4 +104,28 @@ abstract class CustomResource<TSpec extends TSchema> {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export { CustomResource, type CustomResourceConstructor, type CustomResourceHandlerOptions, type EnsureSecretOptions };
|
const createCustomResource = <TSpec extends TSchema>(
|
||||||
|
options: CustomResourceConstructor<TSpec> & {
|
||||||
|
update?: (options: CustomResourceHandlerOptions<TSpec>) => Promise<void>;
|
||||||
|
create?: (options: CustomResourceHandlerOptions<TSpec>) => Promise<void>;
|
||||||
|
delete?: (options: CustomResourceHandlerOptions<TSpec>) => Promise<void>;
|
||||||
|
},
|
||||||
|
) => {
|
||||||
|
return class extends CustomResource<TSpec> {
|
||||||
|
constructor() {
|
||||||
|
super(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
public update = options.update ?? noopAsync;
|
||||||
|
public create = options.create;
|
||||||
|
public delete = options.delete;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export {
|
||||||
|
CustomResource,
|
||||||
|
type CustomResourceConstructor,
|
||||||
|
type CustomResourceHandlerOptions,
|
||||||
|
type EnsureSecretOptions,
|
||||||
|
createCustomResource,
|
||||||
|
};
|
||||||
|
|||||||
8
src/utils/types.d.ts
vendored
8
src/utils/types.d.ts
vendored
@@ -3,4 +3,10 @@ declare global {
|
|||||||
type ExpectedAny = any;
|
type ExpectedAny = any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export {};
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||||
|
const noop = () => {};
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||||
|
const noopAsync = async () => {};
|
||||||
|
|
||||||
|
export { noop, noopAsync };
|
||||||
|
|||||||
Reference in New Issue
Block a user