# learnk8s/xlskubectl architecture

> Architecture diagram of the GitHub repository learnk8s/xlskubectl, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/learnk8s/xlskubectl
- Repository: https://github.com/learnk8s/xlskubectl

## Overview

xlskubectl is a browser-based bridge for viewing Kubernetes deployments in Google Sheets and changing desired replica counts from the spreadsheet. The user opens the served page, connects Google credentials, and the client loads deployments, synchronizes spreadsheet rows, and watches Kubernetes updates; spreadsheet edits can trigger deployment scaling. The source excerpt shows these responsibilities in one JavaScript file, so the nodes separate its main runtime roles rather than implying separate modules. The HTML’s implementation details and some event-handling branches were not sampled.

Main entry points: [`gsheet.js`](https://github.com/learnk8s/xlskubectl/blob/master/gsheet.js) (Bridge client), [`index.html`](https://github.com/learnk8s/xlskubectl/blob/master/index.html) (App page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Browser interface"]
  node_page["App page<br/>[index.html]"]
end

subgraph group_bridge["Cluster bridge"]
  node_client["Bridge client<br/>[gsheet.js]"]
  node_deployment_sync["Deployment sync<br/>[gsheet.js]"]
  node_stream["Update stream<br/>[gsheet.js]"]
end

subgraph group_sync["Spreadsheet sync"]
  node_sheet_state["Sheet state<br/>[gsheet.js]"]
  node_sheet_io["Sheet I/O<br/>[gsheet.js]"]
end

node_user(("Operator"))
node_kubernetes["Kubernetes API"]
node_google_sheets["Google Sheets API"]

node_user -->|"opens"| node_page
node_page -.->|"loads client"| node_client
node_client -->|"authorizes"| node_google_sheets
node_client -->|"starts sync"| node_deployment_sync
node_deployment_sync -->|"fetches deployments"| node_kubernetes
node_deployment_sync -->|"upserts deployments"| node_sheet_state
node_client -->|"starts watch"| node_stream
node_stream -->|"watches updates"| node_kubernetes
node_client -->|"reads sheet names"| node_sheet_io
node_sheet_state -->|"renders rows"| node_sheet_io
node_sheet_io -->|"reads and writes"| node_google_sheets
node_client -->|"reads desired counts"| node_google_sheets
node_client -->|"patches replicas"| node_kubernetes

click node_page "https://github.com/learnk8s/xlskubectl/blob/master/index.html"
click node_client "https://github.com/learnk8s/xlskubectl/blob/master/gsheet.js"
click node_deployment_sync "https://github.com/learnk8s/xlskubectl/blob/master/gsheet.js"
click node_stream "https://github.com/learnk8s/xlskubectl/blob/master/gsheet.js"
click node_sheet_state "https://github.com/learnk8s/xlskubectl/blob/master/gsheet.js"
click node_sheet_io "https://github.com/learnk8s/xlskubectl/blob/master/gsheet.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_page toneBlue
class node_client,node_deployment_sync,node_stream toneAmber
class node_sheet_state,node_sheet_io,node_kubernetes,node_google_sheets toneMint
class node_user toneIndigo
```

## Components

### Browser interface

- [App page](https://github.com/learnk8s/xlskubectl/blob/master/index.html): `index.html`

### Cluster bridge

- [Bridge client](https://github.com/learnk8s/xlskubectl/blob/master/gsheet.js): `gsheet.js`
- [Deployment sync](https://github.com/learnk8s/xlskubectl/blob/master/gsheet.js): `gsheet.js`
- [Update stream](https://github.com/learnk8s/xlskubectl/blob/master/gsheet.js): `gsheet.js`

### Spreadsheet sync

- [Sheet state](https://github.com/learnk8s/xlskubectl/blob/master/gsheet.js): `gsheet.js`
- [Sheet I/O](https://github.com/learnk8s/xlskubectl/blob/master/gsheet.js): `gsheet.js`

### Other components

- **Operator**
- **Kubernetes API**
- **Google Sheets API**

## Connections

- Operator → App page: opens (evidence: `README.md`)
- App page → Bridge client: loads client
- Bridge client → Google Sheets API: authorizes (evidence: `gsheet.js`)
- Bridge client → Deployment sync: starts sync (evidence: `gsheet.js`)
- Deployment sync → Kubernetes API: fetches deployments (evidence: `gsheet.js`)
- Deployment sync → Sheet state: upserts deployments (evidence: `gsheet.js`)
- Bridge client → Update stream: starts watch (evidence: `gsheet.js`)
- Update stream → Kubernetes API: watches updates (evidence: `gsheet.js`)
- Bridge client → Sheet I/O: reads sheet names (evidence: `gsheet.js`)
- Sheet state → Sheet I/O: renders rows (evidence: `gsheet.js`)
- Sheet I/O → Google Sheets API: reads and writes (evidence: `gsheet.js`)
- Bridge client → Google Sheets API: reads desired counts (evidence: `gsheet.js`)
- Bridge client → Kubernetes API: patches replicas (evidence: `gsheet.js`)
