Skip to content

Commit d40538a

Browse files
committed
Remove manual created k8s types in favor of generated ones
1 parent 03b3121 commit d40538a

File tree

3 files changed

+47
-286
lines changed

3 files changed

+47
-286
lines changed

npm/index.d.ts

Lines changed: 6 additions & 284 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
import {Namespace, Service} from "kubernetes-types/core/v1";
2+
import {Ingress, IngressClass} from "kubernetes-types/networking/v1";
3+
import {Deployment} from "kubernetes-types/apps/v1";
4+
5+
export type Tuple = Record<string, string | number | boolean>;
6+
17
declare global {
28
const $env: {
39
/** Parses `C8X_MY_TEST=abc` into abc */
@@ -56,8 +62,6 @@ declare global {
5662
};
5763
}
5864

59-
export type Tuple = Record<string, string | number | boolean>;
60-
6165
export type Chart = {
6266
namespace?: Namespace;
6367
components: (
@@ -66,287 +70,5 @@ export type Chart = {
6670
| Deployment
6771
| Service
6872
| IngressClass
69-
| null
70-
| undefined
7173
)[];
7274
};
73-
74-
// Definition für eine IngressClass (Kubernetes 1.31, TypeScript 5)
75-
export type IngressClass = {
76-
apiVersion: "networking.k8s.io/v1";
77-
kind: "IngressClass";
78-
metadata: Metadata;
79-
spec: IngressClassSpec;
80-
};
81-
82-
export type IngressClassSpec = {
83-
controller: string;
84-
parameters?: IngressClassParameters;
85-
};
86-
87-
export type IngressClassParameters = {
88-
apiGroup?: string;
89-
kind: string;
90-
name: string;
91-
namespace?: string;
92-
};
93-
94-
export type Namespace = {
95-
apiVersion: "v1";
96-
kind: "Namespace";
97-
metadata: Metadata;
98-
spec?: NamespaceSpec;
99-
status?: NamespaceStatus;
100-
};
101-
102-
export type NamespaceSpec = {
103-
finalizers?: string[];
104-
};
105-
106-
export type NamespaceStatus = {
107-
phase?: "Active" | "Terminating";
108-
};
109-
110-
// Definition für einen Pod (Kubernetes 1.31, TypeScript 5)
111-
112-
export type Pod = {
113-
apiVersion: "v1";
114-
kind: "Pod";
115-
metadata: Metadata;
116-
spec: PodSpec;
117-
status?: PodStatus;
118-
};
119-
120-
export type Metadata = {
121-
name: string;
122-
namespace?: string;
123-
labels?: Record<string, string | boolean | number>;
124-
annotations?: Record<string, string | boolean | number>;
125-
uid?: string;
126-
creationTimestamp?: string;
127-
ownerReferences?: OwnerReference[];
128-
};
129-
130-
export type OwnerReference = {
131-
apiVersion: string;
132-
kind: string;
133-
name: string;
134-
uid: string;
135-
controller?: boolean;
136-
blockOwnerDeletion?: boolean;
137-
};
138-
139-
export type PodSpec = {
140-
containers: Container[];
141-
restartPolicy?: "Always" | "OnFailure" | "Never";
142-
nodeName?: string;
143-
nodeSelector?: Tuple;
144-
serviceAccountName?: string;
145-
automountServiceAccountToken?: boolean;
146-
};
147-
148-
export type Container = {
149-
name: string;
150-
image: string;
151-
ports?: ContainerPort[];
152-
resources?: ResourceRequirements;
153-
env?: EnvVar[];
154-
};
155-
156-
export type ContainerPort = {
157-
containerPort: number;
158-
protocol?: "TCP" | "UDP" | "SCTP";
159-
};
160-
161-
export type ResourceRequirements = {
162-
limits?: Tuple;
163-
requests?: Tuple;
164-
};
165-
166-
export type EnvVar = {
167-
name: string;
168-
value?: string;
169-
valueFrom?: EnvVarSource;
170-
};
171-
172-
export type EnvVarSource = {
173-
fieldRef?: { fieldPath: string };
174-
resourceFieldRef?: { containerName?: string; resource: string };
175-
};
176-
177-
export type PodStatus = {
178-
phase: string;
179-
conditions?: PodCondition[];
180-
hostIP?: string;
181-
podIP?: string;
182-
startTime?: string;
183-
};
184-
185-
export type PodCondition = {
186-
type: string;
187-
status: string;
188-
lastProbeTime?: string;
189-
lastTransitionTime?: string;
190-
};
191-
192-
// Definition für ein Deployment (Kubernetes 1.31, TypeScript 5)
193-
export type Deployment = {
194-
apiVersion: "apps/v1";
195-
kind: "Deployment";
196-
metadata?: Metadata;
197-
spec?: DeploymentSpec;
198-
status?: DeploymentStatus;
199-
};
200-
201-
export type DeploymentSpec = {
202-
replicas?: number;
203-
selector: {
204-
matchLabels: Tuple;
205-
};
206-
template: PodTemplate;
207-
strategy?: DeploymentStrategy;
208-
};
209-
210-
export type PodTemplate = {
211-
metadata: Metadata;
212-
spec: PodSpec;
213-
};
214-
215-
export type DeploymentStrategy = {
216-
type: "Recreate" | "RollingUpdate";
217-
rollingUpdate?: RollingUpdateDeployment;
218-
};
219-
220-
export type RollingUpdateDeployment = {
221-
maxUnavailable?: number | string;
222-
maxSurge?: number | string;
223-
};
224-
225-
export type DeploymentStatus = {
226-
observedGeneration?: number;
227-
replicas: number;
228-
updatedReplicas?: number;
229-
readyReplicas?: number;
230-
availableReplicas?: number;
231-
};
232-
233-
// Definition für einen Service (Kubernetes 1.31, TypeScript 5)
234-
export type Service = {
235-
apiVersion: "v1";
236-
kind: "Service";
237-
metadata: Metadata;
238-
spec: ServiceSpec;
239-
status?: ServiceStatus;
240-
};
241-
242-
export type ServiceSpec = {
243-
type: "ClusterIP" | "NodePort" | "LoadBalancer";
244-
ports: ServicePort[];
245-
selector?: Tuple;
246-
clusterIP?: string;
247-
externalIPs?: string[];
248-
sessionAffinity?: "None" | "ClientIP";
249-
};
250-
251-
export type ServicePort = {
252-
protocol?: "TCP" | "UDP" | "SCTP";
253-
port: number;
254-
targetPort?: number | string;
255-
nodePort?: number;
256-
};
257-
258-
export type ServiceStatus = {
259-
loadBalancer?: {
260-
ingress?: { ip: string; hostname?: string }[];
261-
};
262-
};
263-
264-
// Definition für eine ConfigMap (Kubernetes 1.31, TypeScript 5)
265-
export type ConfigMap = {
266-
apiVersion: "v1";
267-
kind: "ConfigMap";
268-
metadata: Metadata;
269-
data: Tuple;
270-
binaryData?: Tuple;
271-
};
272-
273-
// Definition für ein Secret (Kubernetes 1.31, TypeScript 5)
274-
export type Secret = {
275-
apiVersion: "v1";
276-
kind: "Secret";
277-
metadata: Metadata;
278-
data: Tuple;
279-
stringData?: Tuple;
280-
type: string;
281-
};
282-
283-
// Definition für einen Ingress (Kubernetes 1.31, TypeScript 5)
284-
export type Ingress = {
285-
apiVersion: "networking.k8s.io/v1";
286-
kind: "Ingress";
287-
metadata?: Metadata;
288-
spec: IngressSpec;
289-
status?: IngressStatus;
290-
};
291-
292-
export type IngressSpec = {
293-
rules: IngressRule[];
294-
tls?: IngressTLS[];
295-
};
296-
297-
export type IngressRule = {
298-
host: string;
299-
http: {
300-
paths: IngressPath[];
301-
};
302-
};
303-
304-
export type IngressPath = {
305-
path: string;
306-
pathType: "Prefix" | "Exact" | "ImplementationSpecific";
307-
backend: {
308-
service: {
309-
name: string;
310-
port: {
311-
number: number;
312-
};
313-
};
314-
};
315-
};
316-
317-
export type IngressTLS = {
318-
hosts: string[];
319-
secretName: string;
320-
};
321-
322-
export type IngressStatus = {
323-
loadBalancer?: {
324-
ingress?: { ip: string; hostname?: string }[];
325-
};
326-
};
327-
328-
// Definition für ein PersistentVolumeClaim (PVC) (Kubernetes 1.31, TypeScript 5)
329-
export type PersistentVolumeClaim = {
330-
apiVersion: "v1";
331-
kind: "PersistentVolumeClaim";
332-
metadata: Metadata;
333-
spec: PersistentVolumeClaimSpec;
334-
status?: PersistentVolumeClaimStatus;
335-
};
336-
337-
export type PersistentVolumeClaimSpec = {
338-
accessModes: ("ReadWriteOnce" | "ReadOnlyMany" | "ReadWriteMany")[];
339-
resources: {
340-
requests: {
341-
storage: string;
342-
};
343-
};
344-
storageClassName?: string;
345-
volumeMode?: "Filesystem" | "Block";
346-
};
347-
348-
export type PersistentVolumeClaimStatus = {
349-
phase: string;
350-
capacity?: Tuple;
351-
accessModes?: string[];
352-
};

npm/package-lock.json

Lines changed: 38 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

npm/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "c8x",
3-
"version": "0.0.18",
3+
"version": "0.0.19",
44
"description": "Deploy and manage kubernetes charts with cybernetes",
55
"main": "index.d.ts",
66
"bin": {
@@ -29,6 +29,7 @@
2929
},
3030
"license": "MIT",
3131
"dependencies": {
32-
"typescript": "^5.7.3"
32+
"typescript": "^5.7.3",
33+
"kubernetes-types": "^1.30.0"
3334
}
3435
}

0 commit comments

Comments
 (0)