Skip to content

Commit 1b3ff0a

Browse files
committed
readmes
1 parent 5bc015e commit 1b3ff0a

File tree

3 files changed

+100
-11
lines changed

3 files changed

+100
-11
lines changed

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,16 @@ Write infrastructure like you write apps—modular, composable, and testable. Ku
1919

2020
> No more brittle YAML. No more hidden chart logic. Just pure, type-safe Kubernetes from the language you already use.
2121
22+
2223
## Features
2324

2425
- **🔒 Fully Typed**: Complete TypeScript definitions for all functions and models for an enhanced development experience.
2526
- **🚀 Zero Dependencies**: Works out of the box without the need for additional installations.
2627
- **📡 Full Kubernetes API Coverage**: Supports all Kubernetes API endpoints with detailed TypeScript types.
2728
- **🌐 Cross-Platform**: Works with both Node.js and browser environments.
2829

30+
With KubernetesJS, you don’t shell out to `kubectl`, grep logs, or decode YAML trees. You write real code—typed, composable, inspectable.
31+
2932
## Installation
3033

3134
To install KubernetesJS, you can use npm or yarn:
@@ -159,10 +162,6 @@ if (result.items && result.items.length) {
159162
}
160163
```
161164

162-
> With KubernetesJS, you don’t shell out to `kubectl`, grep logs, or decode YAML trees. You write real code—typed, composable, inspectable.
163-
164-
This example lists all pods in the `default` namespace and cleanly inspects both regular and init containers, including their readiness and state.
165-
166165
## Related
167166

168167
Checkout these related projects:

packages/kubernetesjs/README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,16 @@ Write infrastructure like you write apps—modular, composable, and testable. Ku
1919

2020
> No more brittle YAML. No more hidden chart logic. Just pure, type-safe Kubernetes from the language you already use.
2121
22+
2223
## Features
2324

2425
- **🔒 Fully Typed**: Complete TypeScript definitions for all functions and models for an enhanced development experience.
2526
- **🚀 Zero Dependencies**: Works out of the box without the need for additional installations.
2627
- **📡 Full Kubernetes API Coverage**: Supports all Kubernetes API endpoints with detailed TypeScript types.
2728
- **🌐 Cross-Platform**: Works with both Node.js and browser environments.
2829

30+
With KubernetesJS, you don’t shell out to `kubectl`, grep logs, or decode YAML trees. You write real code—typed, composable, inspectable.
31+
2932
## Installation
3033

3134
To install KubernetesJS, you can use npm or yarn:
@@ -159,10 +162,6 @@ if (result.items && result.items.length) {
159162
}
160163
```
161164

162-
> With KubernetesJS, you don’t shell out to `kubectl`, grep logs, or decode YAML trees. You write real code—typed, composable, inspectable.
163-
164-
This example lists all pods in the `default` namespace and cleanly inspects both regular and init containers, including their readiness and state.
165-
166165
## Related
167166

168167
Checkout these related projects:

packages/react/README.md

Lines changed: 94 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@
1313
</a>
1414
</p>
1515

16+
KubernetesJS is a **fully-typed**, zero-dependency TypeScript client for Kubernetes.
17+
18+
Write infrastructure like you write apps—modular, composable, and testable. KubernetesJS gives you direct, programmatic access to the entire Kubernetes API, with the developer experience of modern JavaScript tooling.
19+
20+
> No more brittle YAML. No more hidden chart logic. Just pure, type-safe Kubernetes from the language you already use.
1621
17-
KubernetesJS is a **fully-typed**, zero-dependency TypeScript library designed to simplify interactions with Kubernetes APIs. With comprehensive TypeScript support, it provides a strongly-typed interface that makes managing Kubernetes resources clear and predictable, ideal for TypeScript developers looking to integrate Kubernetes management into their applications.
1822

1923
## Features
2024

@@ -23,6 +27,8 @@ KubernetesJS is a **fully-typed**, zero-dependency TypeScript library designed t
2327
- **📡 Full Kubernetes API Coverage**: Supports all Kubernetes API endpoints with detailed TypeScript types.
2428
- **🌐 Cross-Platform**: Works with both Node.js and browser environments.
2529

30+
With KubernetesJS, you don’t shell out to `kubectl`, grep logs, or decode YAML trees. You write real code—typed, composable, inspectable.
31+
2632
## Installation
2733

2834
To install KubernetesJS, you can use npm or yarn:
@@ -34,9 +40,94 @@ yarn add kubernetesjs
3440

3541
```
3642

37-
## Example
43+
## Your Infrastructure, Like a Component
44+
45+
This is what we mean by "*React for infrastructure*":
46+
47+
```ts
48+
import { KubernetesClient } from "kubernetesjs";
49+
50+
const client = new KubernetesClient({
51+
restEndpoint: process.env.KUBERNETES_API_URL || 'http://127.0.0.1:8001'
52+
});
53+
54+
await client.createAppsV1NamespacedDeployment({
55+
path: { namespace: 'default' },
56+
body: {
57+
apiVersion: 'apps/v1',
58+
kind: 'Deployment',
59+
metadata: { name: 'hello-world' },
60+
spec: {
61+
replicas: 1,
62+
selector: { matchLabels: { app: 'hello-world' } },
63+
template: {
64+
metadata: { labels: { app: 'hello-world' } },
65+
spec: {
66+
containers: [
67+
{
68+
name: 'app',
69+
image: 'node:18-alpine',
70+
command: ['node', '-e', 'require("http").createServer((_,res)=>res.end("ok")).listen(3000)'],
71+
ports: [{ containerPort: 3000 }]
72+
}
73+
]
74+
}
75+
}
76+
}
77+
}
78+
});
79+
```
80+
81+
## Test Your Cluster Like You Test Code
82+
83+
Run infrastructure as part of your test suite, with assertions.
84+
85+
```ts
86+
describe('PostgreSQL Deployment', () => {
87+
const namespace = 'default';
88+
const deploymentName = 'postgres-pgvector';
89+
90+
it('creates a PostgreSQL deployment + service', async () => {
91+
const deployment = await client.createAppsV1NamespacedDeployment({ ... });
92+
const service = await client.createCoreV1NamespacedService({ ... });
93+
94+
expect(deployment.metadata?.name).toBe(deploymentName);
95+
expect(service.metadata?.name).toBe(deploymentName);
96+
97+
const status = await client.readAppsV1NamespacedDeployment({
98+
path: { namespace, name: deploymentName }
99+
});
100+
101+
expect(status.status?.readyReplicas).toBe(1);
102+
});
103+
});
104+
```
105+
106+
> Type-safe Kubernetes. With `expect()`.
107+
108+
---
109+
110+
## Declarative Loops, Composability, Reuse
111+
112+
You can now treat infrastructure like reusable components or functions:
113+
114+
```ts
115+
function createPostgresDeployment(name: string) {
116+
return client.createAppsV1NamespacedDeployment({
117+
path: { namespace: 'default' },
118+
body: {
119+
apiVersion: 'apps/v1',
120+
kind: 'Deployment',
121+
metadata: { name },
122+
spec: { /* ... */ }
123+
}
124+
});
125+
}
126+
```
127+
128+
## Example: Inspect Init Containers in Running Pods
38129

39-
```js
130+
```ts
40131
import { KubernetesClient } from "kubernetesjs";
41132

42133
const client = new KubernetesClient({

0 commit comments

Comments
 (0)