Commit 37f3ee3d authored by Sergio Gimenez's avatar Sergio Gimenez
Browse files

Fix ansible and polish docs

parent aba16cd6
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -111,7 +111,7 @@ Before opening a PR, ensure your changes are working correctly:
2. **Run Playbook Tests**:
   - Example:
     ```bash
     ansible-playbook playbooks/scenarios/deploy_quick_single_oop.yml -e @secrets.yml
     ansible-playbook playbooks/scenarios/all_in_one/deploy.yml -e @secrets.yml
     ```

3. **Verify Cleanup**:
+37 −64
Original line number Diff line number Diff line
# Operator Platform Automation

[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
Deploy Operator Platform environments with Ansible.

Deploy the Operator Platform quickly and reliably using Ansible-based automation. This repository is designed for developers, operators, and organizations looking to streamline the deployment of a complete Operator Platform environment with minimal manual effort.
This repository is mainly used to:

---
- prepare target hosts
- create Kind-based Kubernetes clusters
- deploy Operator Platform components
- run single-host or dual-host federation scenarios

## Features
## Start here

- **Complete Stack**: Deploy Kubernetes clusters, platform components, and utilities.
- **Idempotent Playbooks**: Re-run playbooks safely.
- **Flexible Deployment Scenarios**: Single-node and multi-cluster federation setups.
- **Customizable Configurations**: Modify variables to suit your needs.
- **Fully Tested**: Verified by ansible-lint and end-to-end testing.
- `docs/getting-started.md`: environment, inventory, secrets, first deployment
- `docs/deployment.md`: scenario selection, commands, kubeconfigs, undeploy

---
## Quick start

## Prerequisites

Before using this repository, ensure the following:

1. **Software Dependencies**:
   - Python 3.8+
   - pip
   - Ansible (>= 2.10)
   - Docker (for Kind-based clusters)

2. **Install Required Python Packages**:
```bash
cd ansible
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
   ```

3. **Access and Permissions**:
   - Kubernetes cluster admin access (or setup local Kind cluster).

---

## Quick Start
ansible-galaxy collection install -r requirements.yml

Follow these steps to deploy the Operator Platform on a local Kind cluster:
ansible-playbook playbooks/scenarios/all_in_one/deploy.yml -e @secrets.yml
```

```bash
# Step 1: Clone the repository
 git clone https://gitlab.i2cat.net/areas/software-networks/operator-platform/op-automation.git
cd op-automation
## Main scenarios

# Step 2: Set up your environment
ansible-playbook playbooks/infrastructure/prerequisites/setup-docker.yml
- `playbooks/scenarios/all_in_one/deploy.yml`: one host, easiest test setup
- `playbooks/scenarios/full_oop/deploy.yml`: one complete Operator Platform
- `playbooks/scenarios/dual_oop/deploy.yml`: two hosts, real federation

# Step 3: Deploy Operator Platform (Single OOP scenario)
ansible-playbook playbooks/scenarios/deploy_quick_single_oop.yml -e @ansible/secrets.yml
## Kubeconfigs

# Step 4: Verify deployed components
kubectl get pods --all-namespaces
For remote deployments, kubeconfigs are fetched locally to:

# Optional: Undeploy Operator Platform
ansible-playbook playbooks/scenarios/clean_quick_single_oop.yml -e @ansible/secrets.yml
```text
~/kind-cluster-configs/<inventory-host>/
```

---
Examples:

## Documentation
- `~/kind-cluster-configs/openop_3/op1-kubeconfig.yaml`
- `~/kind-cluster-configs/openop_2/op2-kubeconfig.yaml`

**Full Documentation** is available in the `docs/` directory. To view locally:
## Docs preview

1. Create and activate a virtual environment:
```bash
python3 -m venv .venv
source .venv/bin/activate
    ```
2. Install dependencies:
    ```bash
pip install -r docs/requirements.txt
    ```
3. Serve the documentation locally:
    ```bash
zensical serve
```
4. Open [http://127.0.0.1:8000](http://127.0.0.1:8000) in your browser.

---

## License

This project is licensed under the Apache License, Version 2.0. See the [LICENSE](LICENSE) file for details.
Apache 2.0. See `LICENSE`.
+37 −165
Original line number Diff line number Diff line
# Group Variables Organization
# Group Variables

This directory contains Ansible group variables organized by component for better maintainability and discoverability.
This directory holds shared Ansible variables under `inventory/group_vars/all/`.

## Structure
## Main files

```
group_vars/
└── all/                           # Variables for the 'all' group (applies to all hosts)
    ├── all.yml                   # Global/shared variables
    ├── k8s_cluster.yml           # K8s cluster configuration (distro-agnostic)
    ├── 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_orchestrator config
    ├── 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 + artifact_registry config
    └── 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.

## Pluggable Components

The platform supports pluggable implementations for several components:

### Kubernetes Distribution (`k8s_distribution`)
- **kind** (default): Deploy Kind cluster
- **existing**: Use existing cluster (skip provisioning)

### Artifact Registry (`artifact_registry`)
- **zot** (default): Deploy Zot OCI registry
- **harbor**: Deploy Harbor registry (not yet implemented)
- **none**: Skip artifact registry deployment

### EdgeCloud Platform (`edgecloud_platform`)
- **lite2edge** (default): Deploy lite2edge platform
- **i2edge**: Deploy i2edge platform
- **none**: Skip edgecloud platform deployment

## 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 |
|------|---------|------|
| `k8s_cluster.yml` | K8s distribution, cluster settings, 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` | Artifact registry type, Zot configuration | Artifact 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
- `all.yml`: global paths, network defaults, kubeconfig settings
- `k8s_cluster.yml`: Kind settings, cluster defaults, shared port mappings
- `monitoring.yml`: Prometheus and Grafana ports and settings
- `node_feature_discovery.yml`: NFD settings
- `zot.yml`: Zot registry settings
- `artefact_manager.yml`: Artefact Manager settings
- `srm.yml`: SRM settings
- `oeg.yml`: OEG settings
- `federation_manager.yml`: Federation Manager, Keycloak, MongoDB ports and vars
- `homer.yml`: Homer settings
- `lite2edge.yml`: Lite2Edge settings
- `i2edge.yml`: i2edge settings

Ansible loads variables in this order (later wins):
## How to think about overrides

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

All files in `group_vars/all/` have equal precedence and are loaded alphabetically. Variables in later files can reference variables from earlier files.
1. defaults in `inventory/group_vars/all/*.yml`
2. scenario-specific playbook vars
3. command-line `-e`

## Quick Reference
If you want to change behavior for one run only, prefer `-e`.

**Find a variable?**
## Most useful places to edit

- 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`
- cluster and port mappings: `inventory/group_vars/all/k8s_cluster.yml`
- host-independent kubeconfig defaults: `inventory/group_vars/all/all.yml`
- service ports: component-specific files such as `artefact_manager.yml`, `homer.yml`, `lite2edge.yml`, `federation_manager.yml`

**All NodePorts at a glance:**
## Common NodePorts

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

# OOP Core
zot_http_nodeport: 30050
artefact_manager_nodeport: 30080
lite2edge_nodeport: 30081
homer_nodeport: 30088
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
Federation Manager related ports are defined in `inventory/group_vars/all/federation_manager.yml`.

# Edge Platforms
i2edge_nodeport: 30769
lite2edge_nodeport: 30081
```
## Notes

- Files in `inventory/group_vars/all/` are loaded automatically.
- Keep secrets out of this directory; put them in `ansible/secrets.yml`.
- If a deployment hits a port conflict, check `k8s_cluster.yml` first because Kind port mappings are assembled there.
+1 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
# This file contains ONLY global/shared variables used across all components.
# Component-specific variables are organized in separate files:
#
#   - k8s_cluster.yml            : K8s cluster configuration (distro-agnostic)
#   - k8s_cluster.yml            : Kind and cluster configuration
#   - monitoring.yml            : Prometheus/Grafana monitoring stack
#   - node_feature_discovery.yml: NFD configuration and custom labels
#   - i2edge.yml                : i2edge application settings
+2 −3
Original line number Diff line number Diff line
@@ -80,6 +80,5 @@ all:
        op2_nodes:

  vars:
    # Generic cluster configuration (moved to group_vars/all/k8s_cluster.yml)
    # kubeconfig_output_dir and kubeconfig_filename are defined in group_vars/all/all.yml
    # Generic cluster configuration lives in inventory/group_vars/all/k8s_cluster.yml
    # kubeconfig_output_dir and kubeconfig_filename are defined in inventory/group_vars/all/all.yml
Loading