# aqibkhan-qa/vsphere-8-lab-deployment architecture

> Architecture diagram of the GitHub repository aqibkhan-qa/vsphere-8-lab-deployment, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aqibkhan-qa/vsphere-8-lab-deployment
- Repository: https://github.com/aqibkhan-qa/vsphere-8-lab-deployment

## Overview

##### Project Type and Purpose
- This is an automation tool (PowerShell/PowerCLI script) for deploying a nested vSphere 8.x and vSAN lab in an existing vCenter environment.
- The script (`vsphere-vsan-8-lab-deployment.ps1`) uses a user‐supplied configuration file (`sample-my-config.ps1`) to drive the provisioning of a VCSA appliance and multiple nested ESXi VMs, set up networking, vSAN, and wrap them in a vApp.

##### File Structure Analysis
- Top‐level files:
- `vsphere-vsan-8-lab-deployment.ps1` — main deployment script
- `sample-my-config.ps1` — example environment/configuration file
- `README.md` — documentation and architecture overview
- `screenshots/` — reference deployment state visuals
- No frontend/backend split—this is a single‐module CLI‐driven automation tool.
- No build or packaging subdirectories—execution is ad hoc via PowerShell Core with PowerCLI modules installed.

##### Extracted Architectural Insights from README
- The script communicates over the vSphere API to vCenter Server.
- It requires local access to the VCSA installer files & Nested ESXi OVA templates.
- It provisions:
- VCSA Appliance (via CLI installer)
- N nested ESXi VMs (OVA import + customization)
- Network configuration (port groups, IPs)
- vSAN cluster configuration
- Packaging of all workloads into a vApp
- Logging is written locally (`vsphere-vsan-8-lab-deployment.log`).

##### Main Components
a. User Workstation (PowerShell Core + PowerCLI)
b. Configuration Source (`sample-my-config.ps1`)
c. Deployment Script (`vsphere-vsan-8-lab-deployment.ps1`)
d. vCenter Server (API endpoint)
e. vSphere Infrastructure:
- Datacenter & Cluster
- vSAN datastore
- VM Network / Portgroups
f. Artifacts/Inputs:
- VCSA Installer directory
- Nested ESXi OVA template
g. Outputs:
- Deployed VCSA VM
- Nested ESXi VMs (3+)
- vApp container
- Log file

##### Relationships and Interactions
- The User Workstation loads the Configuration Source and invokes the Deployment Script.
- The Script reads variables (credentials, IPs, resources, file paths).
- The Script connects to vCenter Server over PowerCLI (HTTPS).
- It uploads/deploys the VCSA installer, runs CLI-based deployment.
- It imports the Nested ESXi OVA(s), applies custom CPU/Memory/Disk/Network settings.
- It creates/configures the Datacenter, Cluster, vDS, Portgroups, and vSAN cluster.
- It groups all deployed VMs into a vApp.
- Throughout, it writes verbose logs locally.

##### Architectural Patterns & Design Principles
- Infrastructure-as-Code / Declarative Configuration: all variables are externalized.
- Single orchestration module driving multiple steps (no microservices).
- Clear separation of “what” (config file) vs. “how” (script).
- Idempotent operations where possible (re-running script picks up from state).

##### Technologies, Frameworks, Libraries
- PowerShell Core
- PowerCLI 12.1 Core modules
- VMware vSphere API (SOAP/REST under the hood)
- VCSA CLI installer

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User and Control Plane
    Workstation["User Workstation\nPowerShell Core + PowerCLI"]:::control
    Config["Configuration File\nsample-my-config.ps1"]:::artifact
    Script["Deployment Script\nvsphere-vsan-8-lab-deployment.ps1"]:::control
    Docs["Documentation\nREADME.md"]:::artifact
    Screenshots["Reference Visuals\nscreenshots/"]:::artifact

    %% External System
    VCenter["vCenter Server\n(API Endpoint)"]:::server

    %% Artifacts
    VCSA_ISO["VCSA Installer Directory"]:::artifact
    OVA["Nested ESXi OVA Template"]:::artifact

    %% Logging
    Log["Log File\nvsphere-vsan-8-lab-deployment.log"]:::artifact

    %% vSphere Infrastructure Hierarchy
    subgraph "vSphere Infrastructure" 
        direction TB
        Datacenter["Datacenter"]:::infra
        subgraph "Cluster (vDS, Portgroups, vSAN)"
            direction TB
            Cluster["Compute Cluster"]:::infra
            subgraph "vApp Container"
                direction TB
                vApp["vApp"]:::infra
                VCSA_VM["VCSA Appliance VM"]:::infra
                ESXI_VM["Nested ESXi VMs (1..N)"]:::infra
            end
        end
    end

    %% Connections
    Workstation -->|load config| Config
    Workstation -->|invoke script| Script
    Script -->|reads config| Config
    Script -->|references docs| Docs
    Script -->|fetch visuals| Screenshots

    Script -->|consumes artifact| VCSA_ISO
    Script -->|consumes artifact| OVA

    Script -->|"Connect() over HTTPS"| VCenter
    VCenter -->|provision API calls| Datacenter

    Script -->|"Deploy VCSA Appliance"| Cluster
    Script -->|"Import & Customize ESXi OVA"| Cluster
    Script -->|"Configure vDS & Portgroups"| Cluster
    Script -->|"Configure vSAN Cluster"| Cluster
    Script -->|"Package into vApp"| vApp

    Script -->|write logs| Log

    %% Click Events
    click Config "https://github.com/aqibkhan-qa/vsphere-8-lab-deployment/blob/master/sample-my-config.ps1"
    click Script "https://github.com/aqibkhan-qa/vsphere-8-lab-deployment/blob/master/vsphere-vsan-8-lab-deployment.ps1"
    click Docs "https://github.com/aqibkhan-qa/vsphere-8-lab-deployment/blob/master/README.md"
    click Screenshots "https://github.com/aqibkhan-qa/vsphere-8-lab-deployment/tree/master/screenshots/"

    %% Styles
    classDef control fill:#D0E8FF,stroke:#0288D1,color:#000
    classDef artifact fill:#FEF3C7,stroke:#F9A825,color:#000
    classDef server fill:#ECEFF1,stroke:#546E7A,color:#000
    classDef infra fill:#E8F5E9,stroke:#2E7D32,color:#000
```
