# tigera-solutions/cc-gke-demo architecture

> Architecture diagram of the GitHub repository tigera-solutions/cc-gke-demo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-10-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tigera-solutions/cc-gke-demo
- Repository: https://github.com/tigera-solutions/cc-gke-demo

## Overview

##### Project type and purpose
- This is a Kubernetes PoC/demo repository for Calico Cloud on Google Kubernetes Engine (GKE).
- It automates provisioning a GKE cluster, deploying the Online Boutique microservices app, and applying Calico Cloud network‐security and observability features.

##### File structure
- Top level:
- manifests/ – Calico network policy YAMLs organized into three tiers (application, platform, security).
- scripts/ – Shell scripts that provision the cluster, deploy the sample app, onboard to Calico Cloud, create tiers and policies, then clean up.
- docs/ – Quickstart, prerequisites, troubleshooting, observability guidance, FAQ, references and cheatsheet.
- validation/ – Test scenarios and validation script for end‐to‐end checks.
- No application source code here: the Online Boutique microservices manifests are applied by scripts.

##### Key insights from README
- Purpose: “Zero to secured app in under an hour.”
- Steps: cluster provisioning → app deployment → Calico Cloud onboarding → apply network policies → observe and validate → teardown.
- Demonstrates: microservices traffic flows, security enforcement, live observability.

##### Main components
a. User and CLI:
- Operator’s workstation running the scripts (gcloud, kubectl, calicoctl).
b. GCP Environment:
- Google Cloud account and VPC (network).
- GKE control plane (managed).
- GKE worker nodes in a node pool.
c. Calico Cloud:
- Calico Cloud management plane (hosted by Tigera).
- Calico Cloud agent (calico-node DaemonSet) running on each GKE node.
d. Online Boutique microservices:
- Frontend service (LoadBalancer).
- Internal microservices: productcatalog, currency, recommendation, paymentservice, loadgen, redis, etc.
e. External dependencies:
- GitHub (for egress).
- DNS provider (cluster DNS).
f. Observability components:
- Metrics/Logs exported to Calico Cloud or Prometheus/Grafana (if configured by scripts).
g. Network policy tiers:
- Tier-security, platform, application (enforced by Calico CNI).

##### Relationships and data flows
- Operator invokes scripts → uses gcloud to create GKE cluster → uses kubectl to deploy pods → Calico agent registers with Calico Cloud.
- End users → HTTP(S) → Frontend LoadBalancer → Frontend Pod.
- Frontend Pod → gRPC/HTTP → productcatalog, currency, recommendation, paymentservice Pods.
- loadgen Pod generates traffic for demonstration.
- Pods interact with external services only where allowed by Calico policies (e.g., egress to GitHub, DNS).
- Calico agent enforces policies at the pod‐to‐pod network level.
- Observability data flows from agents to Calico Cloud management plane.

##### Architectural patterns and design principles
- Microservices architecture: many small services communicating over the network.
- Layered network security: separate tiers for default‐deny policies, platform policies (e.g., allow kube-api, DNS), application policies (allow only needed service-to-service flows).
- Infrastructure-as-code: scripts automate provisioning, deployment, policy application, teardown.
- Zero-trust networking: default deny, explicit egress/ingress rules.

##### Essential details to capture
- Clear separation of responsibilities: operator vs GKE vs Calico Cloud.
- Explicit policy tiers and how they map onto pod communication flows.
- Observability and validation components.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Operator Workstation and Scripts
    subgraph "Operator Workstation"
        ScriptsDir["CLI & Scripts"]:::scripts
        click ScriptsDir "https://github.com/tigera-solutions/cc-gke-demo/tree/main/scripts/"
        ScriptsDir --> ClusterSetup["01-setup-cluster.sh"]:::scripts
        click ClusterSetup "https://github.com/tigera-solutions/cc-gke-demo/blob/main/scripts/01-setup-cluster.sh"
        ClusterSetup --> DeployApp["02-deploy-online-boutique.sh"]:::scripts
        click DeployApp "https://github.com/tigera-solutions/cc-gke-demo/blob/main/scripts/02-deploy-online-boutique.sh"
        DeployApp --> OnboardCalico["03-connect-calico-cloud.sh"]:::scripts
        click OnboardCalico "https://github.com/tigera-solutions/cc-gke-demo/blob/main/scripts/03-connect-calico-cloud.sh"
        OnboardCalico --> CreateTiers["04-create-tiers.sh"]:::scripts
        click CreateTiers "https://github.com/tigera-solutions/cc-gke-demo/blob/main/scripts/04-create-tiers.sh"
        CreateTiers --> ApplyPolicies["05-apply-policies.sh"]:::scripts
        click ApplyPolicies "https://github.com/tigera-solutions/cc-gke-demo/blob/main/scripts/05-apply-policies.sh"
        ApplyPolicies --> Cleanup["99-cleanup-all.sh"]:::scripts
        click Cleanup "https://github.com/tigera-solutions/cc-gke-demo/blob/main/scripts/99-cleanup-all.sh"
    end

    %% GCP Environment
    subgraph "GCP Environment"
        subgraph "GKE Control Plane"
            GKEControlPlane["GKE Control Plane"]:::compute
        end
        subgraph "GKE Node Pool"
            WorkerNode["Worker Node"]:::compute
            subgraph "Pods"
                FE["frontend (LoadBalancer)"]:::compute
                PC["productcatalog"]:::compute
                Currency["currency"]:::compute
                Rec["recommendation"]:::compute
                Pay["paymentservice"]:::compute
                LG["loadgen"]:::compute
                Redis["redis"]:::compute
            end
            CalicoAgent["calico-node DaemonSet"]:::compute
        end
    end

    %% Calico Cloud
    subgraph "Calico Cloud"
        CalicoPlane["Management Plane"]:::external
    end

    %% Network Policies
    subgraph "Network Policies (manifests)"
        AppTier["tier-application"]:::policy
        click AppTier "https://github.com/tigera-solutions/cc-gke-demo/tree/main/manifests/01-calico-policies/tier-application/"
        PlatformTier["tier-platform"]:::policy
        click PlatformTier "https://github.com/tigera-solutions/cc-gke-demo/tree/main/manifests/01-calico-policies/tier-platform/"
        SecurityTier["tier-security"]:::policy
        click SecurityTier "https://github.com/tigera-solutions/cc-gke-demo/tree/main/manifests/01-calico-policies/tier-security/"
    end

    %% Documentation
    subgraph "Documentation"
        Quickstart["Quickstart Guide"]:::docs
        click Quickstart "https://github.com/tigera-solutions/cc-gke-demo/blob/main/docs/00-quickstart-guide.md"
        Prereq["Prerequisites Guide"]:::docs
        click Prereq "https://github.com/tigera-solutions/cc-gke-demo/blob/main/docs/01-prerequisites.md"
        Troubleshoot["Troubleshooting Guide"]:::docs
        click Troubleshoot "https://github.com/tigera-solutions/cc-gke-demo/blob/main/docs/02-troubleshooting.md"
        ObservabilityDoc["Observability Guidance"]:::docs
        click ObservabilityDoc "https://github.com/tigera-solutions/cc-gke-demo/blob/main/docs/03-observability.md"
        FAQ["FAQ"]:::docs
        click FAQ "https://github.com/tigera-solutions/cc-gke-demo/blob/main/docs/04-faq.md"
        References["References"]:::docs
        click References "https://github.com/tigera-solutions/cc-gke-demo/blob/main/docs/05-references.md"
        Cheatsheet["Cheatsheet"]:::docs
        click Cheatsheet "https://github.com/tigera-solutions/cc-gke-demo/blob/main/docs/06-cheatsheet.md"
        README["README.md"]:::docs
        click README "https://github.com/tigera-solutions/cc-gke-demo/blob/main/README.md"
    end

    %% Validation
    subgraph "Validation"
        Scenarios["Test Scenarios"]:::docs
        click Scenarios "https://github.com/tigera-solutions/cc-gke-demo/blob/main/validation/00-test-scenarios.md"
        ValidationScript["Validation Script"]:::scripts
        click ValidationScript "https://github.com/tigera-solutions/cc-gke-demo/blob/main/validation/01-validation.sh"
    end

    %% External Services
    ExternalGitHub["GitHub"]:::external
    ExternalDNS["DNS"]:::external
    User["End User"]:::external

    %% Data and Control Flows
    ScriptsDir -.->|gcloud/kubectl/calicoctl| GKEControlPlane
    GKEControlPlane -.->|provision| WorkerNode
    DeployApp -->|kubectl apply| FE
    OnboardCalico -.->|agent registration| CalicoPlane
    CreateTiers -->|define tiers| CalicoAgent
    ApplyPolicies -->|apply policies| CalicoAgent
    Cleanup -.->|teardown| GKEControlPlane

    User -->|HTTP/HTTPS| FE
    LG -->|demo traffic| FE
    FE -->|gRPC/HTTP| PC
    FE -->|gRPC/HTTP| Currency
    FE -->|gRPC/HTTP| Rec
    FE -->|gRPC/HTTP| Pay
    PC -->|DNS lookup| ExternalDNS
    Currency -->|DNS lookup| ExternalDNS
    Rec -->|DNS lookup| ExternalDNS
    Pay -->|DNS lookup| ExternalDNS
    PC -->|egress| ExternalGitHub
    Currency -->|egress| ExternalGitHub

    CalicoAgent -->|enforce policies| FE
    CalicoAgent -->|enforce policies| PC
    CalicoAgent -->|enforce policies| Currency
    CalicoAgent -->|enforce policies| Rec
    CalicoAgent -->|enforce policies| Pay
    CalicoAgent -->|enforce policies| LG
    CalicoAgent -->|metrics/logs| CalicoPlane

    ValidationScript -->|validate flows| FE

    %% Class Definitions
    classDef compute fill:#D0E8FF,stroke:#0066CC
    classDef external fill:#FFE0B2,stroke:#FF8000
    classDef policy fill:#DFF2BF,stroke:#4F8A10
    classDef scripts fill:#E6E6FA,stroke:#9370DB
    classDef docs fill:#F5F5F5,stroke:#999999
```
