feat(tools): add kubernetes homelab awareness tools
This commit is contained in:
+1
-1
@@ -1,3 +1,3 @@
|
||||
export { loadConfig, deepMerge } from './loader.js';
|
||||
export { persistConfig } from './persistence.js';
|
||||
export { configSchema, MODEL_PROVIDERS, type ModelProvider, type Config, type TelegramConfig, type ModelConfig, type CronJobConfig, type AgentsConfig, type CompactionConfig, type ToolProfile, type ToolOverrideConfig, type ToolsConfig, type SandboxConfig, type AgentConfigEntry, type RoutingConfig, type ServerConfig, type BackupConfig } from './schema.js';
|
||||
export { configSchema, MODEL_PROVIDERS, type ModelProvider, type Config, type TelegramConfig, type ModelConfig, type CronJobConfig, type AgentsConfig, type CompactionConfig, type ToolProfile, type ToolOverrideConfig, type ToolsConfig, type SandboxConfig, type AgentConfigEntry, type RoutingConfig, type ServerConfig, type BackupConfig, type K8sConfig } from './schema.js';
|
||||
|
||||
@@ -849,6 +849,35 @@ describe('configSchema — skills watcher', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('configSchema — k8s', () => {
|
||||
const baseConfig = {
|
||||
telegram: { bot_token: 'test-token', allowed_chat_ids: [123] },
|
||||
models: { default: { provider: 'anthropic', model: 'claude-sonnet' } },
|
||||
};
|
||||
|
||||
it('accepts config without k8s section', () => {
|
||||
const result = configSchema.parse(baseConfig);
|
||||
expect(result.k8s).toBeUndefined();
|
||||
});
|
||||
|
||||
it('accepts k8s config with namespace restrictions', () => {
|
||||
const result = configSchema.parse({
|
||||
...baseConfig,
|
||||
k8s: {
|
||||
enabled: true,
|
||||
kubectl_path: '/usr/local/bin/kubectl',
|
||||
default_namespace: 'observability',
|
||||
allowed_namespaces: ['observability', 'platform'],
|
||||
},
|
||||
});
|
||||
|
||||
expect(result.k8s?.enabled).toBe(true);
|
||||
expect(result.k8s?.kubectl_path).toBe('/usr/local/bin/kubectl');
|
||||
expect(result.k8s?.default_namespace).toBe('observability');
|
||||
expect(result.k8s?.allowed_namespaces).toEqual(['observability', 'platform']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('configSchema automation', () => {
|
||||
const baseConfig = {
|
||||
telegram: { bot_token: 'test-token', allowed_chat_ids: [123] },
|
||||
|
||||
@@ -605,6 +605,13 @@ const processSchema = z.object({
|
||||
buffer_size: z.number().min(1024).max(1048576).default(65536),
|
||||
}).default({});
|
||||
|
||||
const k8sSchema = z.object({
|
||||
enabled: z.boolean().default(false),
|
||||
kubectl_path: z.string().default('kubectl'),
|
||||
default_namespace: z.string().optional(),
|
||||
allowed_namespaces: z.array(z.string()).default([]),
|
||||
}).optional();
|
||||
|
||||
const retrySchema = z.object({
|
||||
enabled: z.boolean().default(true),
|
||||
max_retries: z.number().min(0).max(10).default(3),
|
||||
@@ -817,6 +824,7 @@ export const configSchema = z.object({
|
||||
memory: memorySchema,
|
||||
process: processSchema,
|
||||
browser: browserSchema,
|
||||
k8s: k8sSchema,
|
||||
retry: retrySchema,
|
||||
web_search: webSearchSchema,
|
||||
audio: audioSchema,
|
||||
@@ -846,6 +854,7 @@ export type WebSearchConfig = z.infer<typeof webSearchSchema>;
|
||||
export type AudioConfig = z.infer<typeof audioSchema>;
|
||||
export type ProcessConfig = z.infer<typeof processSchema>;
|
||||
export type BrowserConfig = z.infer<typeof browserSchema>;
|
||||
export type K8sConfig = z.infer<typeof k8sSchema>;
|
||||
export type DiscordConfig = z.infer<typeof discordSchema>;
|
||||
export type SlackConfig = z.infer<typeof slackSchema>;
|
||||
export type WhatsAppConfig = z.infer<typeof whatsappSchema>;
|
||||
|
||||
Reference in New Issue
Block a user