From 879fdf4239e61adbe12bd5759e5bd555cd2c2503 Mon Sep 17 00:00:00 2001 From: Shaun Arman Date: Mon, 8 Jun 2026 20:16:55 -0500 Subject: [PATCH] feat(kube): add TypeScript types and command stubs for all new K8s resources Add interfaces and invoke() wrappers for new resource types, Helm, CRDs, resource actions (attach, force-delete, describe, get-yaml, log streaming), and workload controls (restart/scale statefulset/daemonset/replicaset, cronjob ops). Co-Authored-By: TFTSR Engineering --- src/lib/tauriCommands.ts | 252 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 252 insertions(+) diff --git a/src/lib/tauriCommands.ts b/src/lib/tauriCommands.ts index ba8c89d3..47a1bef4 100644 --- a/src/lib/tauriCommands.ts +++ b/src/lib/tauriCommands.ts @@ -1239,3 +1239,255 @@ export const createResourceCmd = (clusterId: string, namespace: string, resource export const editResourceCmd = (clusterId: string, namespace: string, resourceType: string, resourceName: string, yamlContent: string) => invoke("edit_resource", { clusterId, namespace, resourceType, resourceName, yamlContent }); + +// ─── Missing Resource Types ─────────────────────────────────────────────────── + +export interface ReplicationControllerInfo { + name: string; + namespace: string; + desired: number; + ready: number; + current: number; + age: string; +} + +export interface PodDisruptionBudgetInfo { + name: string; + namespace: string; + min_available: string; + max_unavailable: string; + disruptions_allowed: number; + age: string; +} + +export interface PriorityClassInfo { + name: string; + value: number; + global_default: boolean; + age: string; +} + +export interface RuntimeClassInfo { + name: string; + handler: string; + age: string; +} + +export interface LeaseInfo { + name: string; + namespace: string; + holder: string; + age: string; +} + +export interface WebhookConfigInfo { + name: string; + webhooks: number; + age: string; +} + +export interface EndpointInfo { + name: string; + namespace: string; + addresses: string[]; + ports: string[]; + age: string; +} + +export interface EndpointSliceInfo { + name: string; + namespace: string; + address_type: string; + endpoints: number; + ports: string[]; + age: string; +} + +export interface IngressClassInfo { + name: string; + controller: string; + is_default: boolean; + age: string; +} + +export interface NamespaceResourceInfo { + name: string; + status: string; + age: string; +} + +// ─── Helm Types ─────────────────────────────────────────────────────────────── + +export interface HelmRepository { + name: string; + url: string; +} + +export interface HelmChart { + name: string; + chart_version: string; + app_version: string; + description: string; + repository: string; +} + +export interface HelmRelease { + name: string; + namespace: string; + chart: string; + chart_version: string; + app_version: string; + status: string; + updated: string; +} + +// ─── Custom Resource / CRD Types ───────────────────────────────────────────── + +export interface CrdInfo { + name: string; + group: string; + version: string; + kind: string; + scope: string; + age: string; +} + +export interface CustomResourceInfo { + name: string; + namespace: string; + age: string; +} + +// ─── Resource Actions ───────────────────────────────────────────────────────── + +export interface DescribeResponse { + output: string; +} + +export interface LogStreamConfig { + cluster_id: string; + namespace: string; + pod_name: string; + container_name: string; + follow: boolean; + timestamps: boolean; + tail_lines?: number; +} + +// ─── New Resource List Commands ─────────────────────────────────────────────── + +export const listReplicationcontrollersCmd = (clusterId: string, namespace: string) => + invoke("list_replicationcontrollers", { clusterId, namespace }); + +export const listPoddisruptionbudgetsCmd = (clusterId: string, namespace: string) => + invoke("list_poddisruptionbudgets", { clusterId, namespace }); + +export const listPriorityclassesCmd = (clusterId: string) => + invoke("list_priorityclasses", { clusterId }); + +export const listRuntimeclassesCmd = (clusterId: string) => + invoke("list_runtimeclasses", { clusterId }); + +export const listLeasesCmd = (clusterId: string, namespace: string) => + invoke("list_leases", { clusterId, namespace }); + +export const listMutatingwebhookconfigurationsCmd = (clusterId: string) => + invoke("list_mutatingwebhookconfigurations", { clusterId }); + +export const listValidatingwebhookconfigurationsCmd = (clusterId: string) => + invoke("list_validatingwebhookconfigurations", { clusterId }); + +export const listEndpointsCmd = (clusterId: string, namespace: string) => + invoke("list_endpoints", { clusterId, namespace }); + +export const listEndpointslicesCmd = (clusterId: string, namespace: string) => + invoke("list_endpointslices", { clusterId, namespace }); + +export const listIngressclassesCmd = (clusterId: string) => + invoke("list_ingressclasses", { clusterId }); + +export const listNamespacesResourceCmd = (clusterId: string) => + invoke("list_namespaces_resource", { clusterId }); + +export const createNamespaceCmd = (clusterId: string, name: string) => + invoke("create_namespace", { clusterId, name }); + +export const deleteNamespaceCmd = (clusterId: string, name: string) => + invoke("delete_namespace", { clusterId, name }); + +// ─── Resource Action Commands ───────────────────────────────────────────────── + +export const attachPodCmd = (clusterId: string, namespace: string, podName: string, containerName: string) => + invoke("attach_pod", { clusterId, namespace, podName, containerName }); + +export const forceDeleteResourceCmd = (clusterId: string, resourceType: string, namespace: string, resourceName: string) => + invoke("force_delete_resource", { clusterId, resourceType, namespace, resourceName }); + +export const describeResourceCmd = (clusterId: string, resourceType: string, namespace: string, resourceName: string) => + invoke("describe_resource", { clusterId, resourceType, namespace, resourceName }); + +export const getResourceYamlCmd = (clusterId: string, resourceType: string, namespace: string, resourceName: string) => + invoke("get_resource_yaml", { clusterId, resourceType, namespace, resourceName }); + +export const restartStatefulsetCmd = (clusterId: string, namespace: string, name: string) => + invoke("restart_statefulset", { clusterId, namespace, name }); + +export const restartDaemonsetCmd = (clusterId: string, namespace: string, name: string) => + invoke("restart_daemonset", { clusterId, namespace, name }); + +export const scaleStatefulsetCmd = (clusterId: string, namespace: string, name: string, replicas: number) => + invoke("scale_statefulset", { clusterId, namespace, name, replicas }); + +export const scaleReplicasetCmd = (clusterId: string, namespace: string, name: string, replicas: number) => + invoke("scale_replicaset", { clusterId, namespace, name, replicas }); + +export const scaleReplicationcontrollerCmd = (clusterId: string, namespace: string, name: string, replicas: number) => + invoke("scale_replicationcontroller", { clusterId, namespace, name, replicas }); + +export const suspendCronjobCmd = (clusterId: string, namespace: string, name: string) => + invoke("suspend_cronjob", { clusterId, namespace, name }); + +export const resumeCronjobCmd = (clusterId: string, namespace: string, name: string) => + invoke("resume_cronjob", { clusterId, namespace, name }); + +export const triggerCronjobCmd = (clusterId: string, namespace: string, name: string) => + invoke("trigger_cronjob", { clusterId, namespace, name }); + +// ─── Log Streaming Commands ─────────────────────────────────────────────────── + +export const streamPodLogsCmd = (config: LogStreamConfig) => + invoke("stream_pod_logs", { config }); + +export const stopLogStreamCmd = (streamId: string) => + invoke("stop_log_stream", { streamId }); + +// ─── Helm Commands ──────────────────────────────────────────────────────────── + +export const helmListReposCmd = (clusterId: string) => + invoke("helm_list_repos", { clusterId }); + +export const helmAddRepoCmd = (clusterId: string, name: string, url: string) => + invoke("helm_add_repo", { clusterId, name, url }); + +export const helmUpdateReposCmd = (clusterId: string) => + invoke("helm_update_repos", { clusterId }); + +export const helmSearchRepoCmd = (clusterId: string, query: string) => + invoke("helm_search_repo", { clusterId, query }); + +export const helmListReleasesCmd = (clusterId: string, namespace: string) => + invoke("helm_list_releases", { clusterId, namespace }); + +export const helmUninstallCmd = (clusterId: string, namespace: string, releaseName: string) => + invoke("helm_uninstall", { clusterId, namespace, releaseName }); + +export const helmRollbackCmd = (clusterId: string, namespace: string, releaseName: string, revision?: number) => + invoke("helm_rollback", { clusterId, namespace, releaseName, revision }); + +// ─── CRD / Custom Resource Commands ────────────────────────────────────────── + +export const listCrdsCmd = (clusterId: string) => + invoke("list_crds", { clusterId }); + +export const listCustomResourcesCmd = (clusterId: string, group: string, version: string, resource: string, namespace: string) => + invoke("list_custom_resources", { clusterId, group, version, resource, namespace });