Commit 87cec733 authored by Sergio Gimenez's avatar Sergio Gimenez
Browse files

Properly organize variables

parent ca5c40fe
Loading
Loading
Loading
Loading
+166 −0
Original line number Diff line number Diff line
# Group Variables Organization

This directory contains Ansible group variables organized by component for better maintainability and discoverability.

## Structure

```
group_vars/
└── all/                           # Variables for the 'all' group (applies to all hosts)
    ├── all.yml                   # Global/shared variables
    ├── kind_cluster.yml          # Kind cluster configuration
    ├── monitoring.yml            # Prometheus/Grafana monitoring stack
    ├── node_feature_discovery.yml # NFD configuration
    ├── federation_manager.yml    # Federation Manager NodePorts
    ├── i2edge.yml                # i2edge edge cloud platform
    ├── lite2edge.yml             # lite2edge edge cloud platform
    ├── srm.yml                   # SRM (Service Resource Manager) - OOP module
    ├── oeg.yml                   # OEG (Open Exposure Gateway) - OOP module
    ├── artefact_manager.yml      # Artefact Manager - OOP module
    ├── zot.yml                   # Zot container registry
    └── homer.yml                 # Homer dashboard
```

## How It Works

Ansible automatically loads **all** `.yml` files from `group_vars/<group_name>/` for hosts in that group. Since all our hosts are in the `all` group, these variables are available everywhere.

## File Organization

### `all.yml` - Global Variables Only

Contains **only** truly global variables:

- Project paths (`op_automation_base`, `i2edge_base_path`)
- Docker registry configuration
- Kubernetes platform settings (`k8s_platform`)
- Network configuration (`api_server_address`, `api_server_port`)
- Kubeconfig settings

### Infrastructure Components

| File | Purpose | Type |
|------|---------|------|
| `kind_cluster.yml` | Kind cluster settings, K8s version, port mappings | Kubernetes Infrastructure |
| `monitoring.yml` | Prometheus, Grafana, Helm configuration | Monitoring Infrastructure |
| `node_feature_discovery.yml` | NFD version, namespaces, custom node labels | Node Management |
| `zot.yml` | Container registry | Artefact Registry Infrastructure |

### OOP Core Modules

These are the core components of the Open Operator Platform:

| File | Purpose | Description |
|------|---------|-------------|
| `srm.yml` | Service Resource Manager | Manages service resources and orchestration |
| `oeg.yml` | Open Exposure Gateway | API gateway and exposure management |
| `artefact_manager.yml` | Artefact Manager | Manages container images, Helm charts, and deployment descriptors |
| `federation_manager.yml` | Federation Manager | Enables federation and coordination between multiple OOPs |

### Supporting Services

| File | Purpose | Type |
|------|---------|------|
| `homer.yml` | Dashboard UI | Central navigation hub for operators |

### Edge Cloud Platforms

| File | Purpose | Description |
|------|---------|-------------|
| `i2edge.yml` | i2edge platform | Full-featured edge cloud platform |
| `lite2edge.yml` | lite2edge platform | Lightweight edge computing platform |

## Component Architecture

```
Open Operator Platform (OOP)

├── Core Modules
│   ├── SRM (Service Resource Manager)
│   ├── OEG (Open Exposure Gateway)
│   ├── Artefact Manager
│   └── Federation Manager (Multi-OOP coordination)

├── Infrastructure
│   ├── Kubernetes (Kind cluster)
│   ├── Monitoring (Prometheus/Grafana)
│   ├── Node Feature Discovery
│   └── Zot (Artefact Registry)

├── Supporting Services
│   └── Homer (Dashboard UI)

└── Edge Cloud Platforms
    ├── i2edge (Full-featured)
    └── lite2edge (Lightweight)
```

## Adding New Components

To add a new component:

1. Create `group_vars/all/<component>.yml`
2. Add a descriptive header explaining the component's role
3. Add component-specific variables
4. Update this README with the component's category

Example:

```yaml
---
# ==========================================
# New Component Configuration
# ==========================================
# Brief description of what this component does and its role in OOP

# Service NodePort
new_component_nodeport: 30999

# Component-specific settings
new_component_timeout: 300
```

## Variable Precedence

Ansible loads variables in this order (later wins):

1. `group_vars/all/*.yml` (alphabetically)
2. Playbook variables
3. Command-line extra vars (`-e`)

All files in `group_vars/all/` have equal precedence and are loaded alphabetically. Variables in later files can reference variables from earlier files.

## Quick Reference

**Find a variable?**

- Global config → `all.yml`
- Infrastructure → `kind_cluster.yml`, `monitoring.yml`, `node_feature_discovery.yml`, `zot.yml`
- OOP core modules → `srm.yml`, `oeg.yml`, `artefact_manager.yml`, `federation_manager.yml`
- Supporting services → `homer.yml`
- Edge platforms → `i2edge.yml`, `lite2edge.yml`

**All NodePorts at a glance:**

```yaml
# Infrastructure
prometheus_nodeport: 30090
grafana_nodeport: 30091
alertmanager_nodeport: 30092

# OOP Core
srm_nodeport: 32415
oeg_nodeport: 32263
artefact_manager_nodeport: 30080

# Supporting Services
zot_http_nodeport: 30050
federation_manager_nodeport: 30989
keycloak_nodeport: 30082
mongodb_nodeport: 30017
homer_nodeport: 30088

# Edge Platforms
i2edge_nodeport: 30769
lite2edge_nodeport: 30081
```
+63 −0
Original line number Diff line number Diff line
---
# ==========================================
# Global Configuration Variables
# ==========================================
# This file contains ONLY global/shared variables used across all components.
# Component-specific variables are organized in separate files:
#
#   - kind_cluster.yml          : Kind cluster configuration and port mappings
#   - monitoring.yml            : Prometheus/Grafana monitoring stack
#   - node_feature_discovery.yml: NFD configuration and custom labels
#   - i2edge.yml                : i2edge application settings
#   - federation_manager.yml    : Federation Manager NodePorts
#   - oop_platform.yml          : OOP components (SRM, OEG, Artefact Manager, etc.)
#
# Ansible automatically loads all files in group_vars/, so variables from
# component-specific files are available in all playbooks and roles.
# ==========================================

# ==========================================
# Project Paths
# ==========================================
op_automation_base: /home/sergio/i2cat/OperatorPlatform/OP_Automation
i2edge_base_path: /home/sergio/i2cat/OperatorPlatform/i2edge

# ==========================================
# Docker Registry Configuration
# ==========================================
docker_registry: "gitlab.i2cat.net:5050"
docker_registry_path: "areas/software-networks/operator-platform"
docker_registry_username: "oauth2"

# ==========================================
# Kubernetes Platform Settings
# ==========================================
# Set to 'kind' to enable kind-specific tasks like image loading
k8s_platform: kind

# ==========================================
# Network Configuration
# ==========================================
# Use 0.0.0.0 to bind to all interfaces, allowing external access
api_server_address: "0.0.0.0"
api_server_port: 6443

# External IP for kubeconfig (set to host IP for remote access)
external_host_ip: "{{ host_ip }}"

# ==========================================
# Certificate SANs (Subject Alternative Names)
# ==========================================
cert_sans:
  - "localhost"
  - "127.0.0.1"
  # Additional IPs (like ansible_default_ipv4.address) are automatically added by the template

# ==========================================
# Kubeconfig Settings
# ==========================================
# Automatically uses host IP, falls back to localhost
kubeconfig_server_host: "{{ ansible_default_ipv4.address | default('localhost') }}"
kubeconfig_server_url: "https://{{ kubeconfig_server_host }}:6443"
kubeconfig_output_dir: "{{ op_automation_base }}/automation/1-kind-cluster"
kubeconfig_filename: operator-platform-external-kubeconfig.yaml
+10 −0
Original line number Diff line number Diff line
---
# ==========================================
# Artefact Manager Configuration
# ==========================================
# Artefact Manager is a core OOP module that manages application artefacts,
# including container images, Helm charts, and deployment descriptors.
# It provides a catalog and lifecycle management for deployable artefacts.

# Service NodePort
artefact_manager_nodeport: 30080
+21 −0
Original line number Diff line number Diff line
---
# ==========================================
# Federation Manager Configuration
# ==========================================
# Federation Manager is a core OOP module that enables federation and coordination
# between multiple Operator Platform instances. It manages cross-platform service
# discovery, resource sharing, and inter-OOP communication.
#
# Dependencies: Keycloak (authentication) and MongoDB (state storage)
# Includes both local and remote instances for testing federation scenarios.

# Local Federation Manager NodePorts
federation_manager_nodeport: 30989
keycloak_nodeport: 30082
mongodb_nodeport: 30017

# Remote Federation Manager NodePorts
# Used to simulate a partner operator platform for testing federation
remote_federation_manager_nodeport: 30990
remote_keycloak_nodeport: 30083
remote_mongodb_nodeport: 30018
+10 −0
Original line number Diff line number Diff line
---
# ==========================================
# Homer Dashboard Configuration
# ==========================================
# Homer is a dashboard UI that provides an easy-to-use interface
# for accessing and monitoring all OOP platform services.
# It serves as a central navigation hub for operators.

# Service NodePort
homer_nodeport: 30088
Loading