@owlmeans/kluster 0.1.15 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -69,10 +69,9 @@ Extends `ServerConfig` with optional `namespace: string`.
|
|
|
69
69
|
<!-- owlmeans:agent-guidance:start -->
|
|
70
70
|
## Agent guidance
|
|
71
71
|
|
|
72
|
-
This package ships embedded
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
(`.claude/skills/` and `.github/instructions/`):
|
|
72
|
+
This package ships embedded agent skills under `agent-meta/`. After installing your
|
|
73
|
+
`@owlmeans/*` packages, run the OwlMeans agent-skills installer to place them into
|
|
74
|
+
your project's skill store (`.agents/skills/`):
|
|
76
75
|
|
|
77
76
|
```sh
|
|
78
77
|
npx @owlmeans/agent-skills
|
package/agent-meta/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"schemaVersion":
|
|
2
|
+
"schemaVersion": 2,
|
|
3
3
|
"package": "@owlmeans/kluster",
|
|
4
|
-
"version": "0.1.
|
|
5
|
-
"generatedAt": "2026-08-
|
|
4
|
+
"version": "0.1.16",
|
|
5
|
+
"generatedAt": "2026-08-14T10:14:48.857Z",
|
|
6
6
|
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
@@ -10,14 +10,7 @@
|
|
|
10
10
|
"name": "kluster",
|
|
11
11
|
"category": "package-specific",
|
|
12
12
|
"file": "skills/kluster/SKILL.md",
|
|
13
|
-
"canonicalPath": ".
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"kind": "instruction",
|
|
17
|
-
"name": "kluster",
|
|
18
|
-
"category": "package-specific",
|
|
19
|
-
"file": "instructions/kluster.instructions.md",
|
|
20
|
-
"canonicalPath": ".github/instructions/kluster.instructions.md"
|
|
13
|
+
"canonicalPath": ".agents/skills/kluster/SKILL.md"
|
|
21
14
|
}
|
|
22
15
|
]
|
|
23
16
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owlmeans/kluster",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@kubernetes/client-node": "^1.4.0",
|
|
25
|
-
"@owlmeans/config": "^0.1.
|
|
26
|
-
"@owlmeans/context": "^0.1.
|
|
27
|
-
"@owlmeans/server-config": "^0.1.
|
|
28
|
-
"@owlmeans/server-context": "^0.1.
|
|
25
|
+
"@owlmeans/config": "^0.1.16",
|
|
26
|
+
"@owlmeans/context": "^0.1.16",
|
|
27
|
+
"@owlmeans/server-config": "^0.1.16",
|
|
28
|
+
"@owlmeans/server-context": "^0.1.16"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@owlmeans/dep-config": "workspace:*",
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: "How to use @owlmeans/kluster — Kubernetes API client service. Resolve via context.service(DEFAULT_ALIAS) to access the cluster API for service discovery, secrets, config maps, and Gateway API (Gateway/HTTPRoute via CustomObjectsApi)."
|
|
3
|
-
applyTo: "**/*.ts, **/*.tsx"
|
|
4
|
-
---
|
|
5
|
-
<!-- AUTO-GENERATED — do not edit. Regenerate via sync-agent-meta. -->
|
|
6
|
-
|
|
7
|
-
# @owlmeans/kluster
|
|
8
|
-
|
|
9
|
-
**Layer:** Infra
|
|
10
|
-
**Install:** `"@owlmeans/kluster": "^0.1.15"` in `dependencies`
|
|
11
|
-
|
|
12
|
-
## Key Exports
|
|
13
|
-
|
|
14
|
-
| Export | Description |
|
|
15
|
-
|--------|-------------|
|
|
16
|
-
| `DEFAULT_ALIAS` | Kluster service alias |
|
|
17
|
-
| `makeKlusterService()` | Kubernetes client service factory |
|
|
18
|
-
| `KlusterService` | Service interface |
|
|
19
|
-
| `isNotFoundError(e)` | Returns true if an API error is HTTP 404 |
|
|
20
|
-
| Helpers | Service discovery, secret resolution |
|
|
21
|
-
|
|
22
|
-
## Usage
|
|
23
|
-
|
|
24
|
-
```typescript
|
|
25
|
-
import { DEFAULT_ALIAS as KLUSTER_SERVICE, makeKlusterService } from '@owlmeans/kluster'
|
|
26
|
-
|
|
27
|
-
context.registerService(makeKlusterService())
|
|
28
|
-
context.kluster = () => context.service(KLUSTER_SERVICE)
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## KlusterService API
|
|
32
|
-
|
|
33
|
-
After `await kluster.ready()`:
|
|
34
|
-
|
|
35
|
-
| Method | Returns | Purpose |
|
|
36
|
-
|--------|---------|---------|
|
|
37
|
-
| `kluster.api` | `CoreV1Api` | Core APIs — Pods, Services, Secrets, ConfigMaps |
|
|
38
|
-
| `kluster.makeNetworkingApi()` | `NetworkingV1Api` | Legacy networking (kept for compatibility) |
|
|
39
|
-
| `kluster.makeAppsApi()` | `AppsV1Api` | Deployments, StatefulSets |
|
|
40
|
-
| `kluster.makeCustomObjectsApi()` | `CustomObjectsApi` | CRDs — **use for Gateway API resources** |
|
|
41
|
-
| `kluster.getHostnames(selector, ns)` | `string[]` | Pod IPs by label selector |
|
|
42
|
-
| `kluster.getServiceHostname(selector, ns)` | `string \| null` | ClusterIP by label selector |
|
|
43
|
-
|
|
44
|
-
## Gateway API via CustomObjectsApi
|
|
45
|
-
|
|
46
|
-
Gateway API resources (`Gateway`, `HTTPRoute`) are Kubernetes CRDs. Access them via `makeCustomObjectsApi()`:
|
|
47
|
-
|
|
48
|
-
```typescript
|
|
49
|
-
import { DEFAULT_ALIAS as KLUSTER_SERVICE } from '@owlmeans/kluster'
|
|
50
|
-
import type { KlusterService } from '@owlmeans/kluster'
|
|
51
|
-
import { isNotFoundError } from '@owlmeans/kluster'
|
|
52
|
-
|
|
53
|
-
const kluster = context.service<KlusterService>(KLUSTER_SERVICE)
|
|
54
|
-
await kluster.ready()
|
|
55
|
-
const customObjects = kluster.makeCustomObjectsApi()
|
|
56
|
-
const coreV1 = kluster.api! // CoreV1Api for port resolution
|
|
57
|
-
|
|
58
|
-
const GATEWAY_GROUP = 'gateway.networking.k8s.io'
|
|
59
|
-
const GATEWAY_VERSION = 'v1'
|
|
60
|
-
|
|
61
|
-
// Read a Gateway
|
|
62
|
-
const gw = await customObjects.getNamespacedCustomObject({
|
|
63
|
-
group: GATEWAY_GROUP, version: GATEWAY_VERSION,
|
|
64
|
-
namespace: 'default', plural: 'gateways', name: 'my-gateway',
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
// Create an HTTPRoute
|
|
68
|
-
await customObjects.createNamespacedCustomObject({
|
|
69
|
-
group: GATEWAY_GROUP, version: GATEWAY_VERSION,
|
|
70
|
-
namespace: 'default', plural: 'httproutes',
|
|
71
|
-
body: {
|
|
72
|
-
apiVersion: 'gateway.networking.k8s.io/v1',
|
|
73
|
-
kind: 'HTTPRoute',
|
|
74
|
-
metadata: { name: 'my-route', namespace: 'default' },
|
|
75
|
-
spec: {
|
|
76
|
-
parentRefs: [{ name: 'my-gateway', sectionName: 'web-https' }],
|
|
77
|
-
hostnames: ['example.com'],
|
|
78
|
-
rules: [{
|
|
79
|
-
matches: [{ path: { type: 'PathPrefix', value: '/' } }],
|
|
80
|
-
backendRefs: [{ name: 'my-service', port: 80 }], // numeric port required
|
|
81
|
-
}],
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
})
|
|
85
|
-
|
|
86
|
-
// Handle 404 gracefully
|
|
87
|
-
try {
|
|
88
|
-
await customObjects.getNamespacedCustomObject({ ... })
|
|
89
|
-
} catch (e) {
|
|
90
|
-
if (isNotFoundError(e)) { /* resource absent */ }
|
|
91
|
-
else throw e
|
|
92
|
-
}
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
**Important**: HTTPRoute `backendRefs[].port` must be **numeric**. Named ports are not supported.
|
|
96
|
-
To resolve a named port, read the Service via `CoreV1Api`:
|
|
97
|
-
```typescript
|
|
98
|
-
const svc = await coreV1.readNamespacedService({ name: 'my-service', namespace })
|
|
99
|
-
const port = svc.spec?.ports?.find(p => p.name === 'backend-port')?.port ?? 80
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
## Depends On
|
|
103
|
-
|
|
104
|
-
- `@owlmeans/server-context`, `@owlmeans/config`, `@kubernetes/client-node`
|