# moulick/ingress-whitelister architecture

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

- Interactive diagram: https://gitdiagram.com/moulick/ingress-whitelister
- Repository: https://github.com/moulick/ingress-whitelister

## Overview

##### Main Components

a. Kubernetes Components:
- Kubernetes API Server
- Ingress Resources
- Custom Resource Definitions (CRDs)
- IPWhitelistConfig Custom Resources

b. Operator Components:
- Controller Manager
- IPWhitelistConfig Controller
- Reconciliation Loop
- External Provider Integration (Cloudflare, Akamai)

**┌─────────────────────────────────────────────────────────────┐**
- Kubernetes Cluster                         │
- ┌─────────────────┐      ┌──────────────────────────┐     │
- Ingress         │      │ Ingress Whitelister      │     │
- Resources       │◄─────┤ Operator                 │     │
- ┘      │  ├─ Controller Manager   │     │
- Reconciliation Loop   │     │
- ┌─────────────────┐      │          ▲               │     │
- IPWhitelistConfig│─────►          │               │     │
- (CRD)           │      └──────────┴───────────────┘     │
- ┘               ▲                        │

- ┼────────────────────────┘

- ┌────────────────┴───────────────┐
- External Providers          │
- ┌─────────────┐ ┌─────────────┐│
- Cloudflare  │ │   Akamai    ││
- API       │ │    API      ││
- ┘ └─────────────┘│
- ┘

##### Key Workflows to Highlight

a. Control Loop:
- How the operator watches for Ingress resources
- Reconciliation process
- Annotation update flow

b. External Provider Integration:
- API calls to Cloudflare/Akamai
- IP range fetching and processing

##### Important Details

a. Configuration Elements:
- RBAC components
- CRD structure
- Configuration flow

b. Monitoring and Metrics:
- Prometheus integration points
- Metrics collection flow

##### Implementation Details
- Controller-runtime framework integration
- Use of Kubebuilder
- Webhook configuration (if applicable)

##### The security implications and provider integration points

Remember to:
- Clear boundaries between cluster and external components
- Relevant configuration paths and data flows

- How the operator integrates with Kubernetes
- The flow of IP whitelist updates
- The interaction with external providers
- The configuration and customization options available

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Kubernetes["Kubernetes Cluster"]
        API[Kubernetes API Server]:::k8s
        
        subgraph Resources["Kubernetes Resources"]
            CRD["Custom Resource Definition"]:::k8s
            click CRD "https://github.com/Moulick/ingress-whitelister/blob/main/config/crd/bases/ingress.security.moulick_ipwhitelistconfigs.yaml"
            
            RBAC["RBAC Configuration"]:::k8s
            click RBAC "https://github.com/Moulick/ingress-whitelister/tree/main/config/rbac"
            
            ING["Ingress Resources"]:::k8s
            
            IPWC["IPWhitelistConfig CR"]:::k8s
            click IPWC "https://github.com/Moulick/ingress-whitelister/blob/main/api/v1beta1/ipwhitelistconfig_types.go"
            
            PROM["Prometheus Metrics"]:::monitoring
            click PROM "https://github.com/Moulick/ingress-whitelister/blob/main/config/prometheus/monitor.yaml"
        end
        
        subgraph Operator["Ingress Whitelister Operator"]
            CM["Controller Manager"]:::operator
            click CM "https://github.com/Moulick/ingress-whitelister/tree/main/config/manager"
            
            CONT["IPWhitelistConfig Controller"]:::operator
            click CONT "https://github.com/Moulick/ingress-whitelister/blob/main/controllers/ipwhitelistconfig_controller.go"
            
            UTIL["Utility Functions"]:::operator
            click UTIL "https://github.com/Moulick/ingress-whitelister/blob/main/utils/utils.go"
            
            MAIN["Main Application"]:::operator
            click MAIN "https://github.com/Moulick/ingress-whitelister/blob/main/main.go"
        end
    end
    
    subgraph External["External Providers"]
        CF["Cloudflare API"]:::external
        AK["Akamai API"]:::external
    end
    
    %% Relationships
    API --> CRD
    API --> RBAC
    API --> ING
    API --> IPWC
    
    IPWC --> CONT
    CONT --> CM
    CONT --> UTIL
    CM --> MAIN
    
    CONT --> CF
    CONT --> AK
    
    CONT --> ING
    CONT --> PROM
    
    %% Styles
    classDef k8s fill:#326CE5,color:white
    classDef operator fill:#00C7B7,color:white
    classDef external fill:#FF6B6B,color:white
    classDef monitoring fill:#FFA500,color:white
    
    %% Legend
    subgraph Legend
        K8S["Kubernetes Components"]:::k8s
        OP["Operator Components"]:::operator
        EXT["External Services"]:::external
        MON["Monitoring"]:::monitoring
    end
```
