# Fleet Environment Template

This guide walks you through the prerequisites and step-by-step configuration of a **Fleet Environment Template** to perform bulk updates across multiple environments using the Template Catalog.

---

## Prerequisites

Before starting, ensure the following are available:

- **API Key**  
  Must belong to a user with sufficient RBAC permissions to modify environments across the targeted projects or organization.

- **Controller Endpoint**  
  Typically `console.rafay.dev`. This targets the correct Rafay Controller environment.

- **Access to the Template Catalog**  
  Ensure the Fleet Environment Template is available within your system template catalog and that you have permission to use it.

---

## Use Case Overview

The Fleet Template enables centralized, bulk configuration updates across environments based on:
- Project filters
- Environment labels
- Template name and version
- Input variable changes

This is ideal for **day-2 operations** such as:
- Kubernetes version upgrades
- Blueprint updates
- AMI updates

---

## Step-by-Step Configuration Guide

Follow the steps below to use the Fleet Environment Template effectively.

### Step 1: Access and Share the Template

1. Navigate to the **Template Catalog** in the **Rafay Console**.
2. Locate and select the **Fleet Environment Template**.
3. **Share** the template with a **central project** where your environments are managed.
4. From that central project, **launch the Fleet template** to begin configuration.

---

### Step 2: Identify Target Environments

Use filters to define which environments should be targeted. These filters help narrow down the environments that will be impacted by the update.

#### Filter Input Variables

| Name | Default Value | Description |
| --- | --- | --- |
| Project List | `[`"ALL"`]` | A list of projects whose environments should be targeted. If set to `ALL`, it includes environments from all projects |
| Environment Template Name | _(Required)_ | Name of the environment template to be applied |
| Environment Template Version(s) | `[]` | Specific version(s) of the environment template to target |
| Environment Labels | `{ "environment-label-key": "environment-label-value" }` | Key-value pairs used to filter environments based on assigned labels |

---

### Step 3: Define Updated Input Variables

Specify the key-value map of variables that should be updated in the matched environments.

#### Updated Input Variables

| Name | Default Value | Description |
| --- | --- | --- |
| Updated Input Variables | `{ "key": "value" }` | Map of updated variables to apply to each environment |

> These variables must already exist and be defined as **mutable** in the environment template.

Example:

```
{
  "Blueprint Name": "default",
  "Cluster Kubernetes Version": "1.31"
}
```

### Step 4: Set Required Environment Variables

Set the global variables required for authentication and targeting the correct controller.

#### Environment Variables

| Name | Required | Default | Description |
| --- | --- | --- | --- |
| API Key | Yes | — | API key for authentication |
| Controller Endpoint | Yes Populated By Default | `console.rafay.dev` | The target Rafay Controller URL |

---

### Step 5: Save and Deploy the Fleet Template

After completing the input fields:

1. Review all configured values including filters, updated variables, and environment variables.
2. Click **Save and Deploy** to initiate the fleet update.
3. The system will:
   1. Filter and evaluate matching environments
   2. Apply the input variable updates in bulk
   3. Display success or error status per environment in the results

---

## Conclusion

The Fleet Environment Template provides a scalable, centralized way to update environment configurations across projects—ideal for Day-2 operations such as Kubernetes version upgrades, blueprint updates, and AMI rollouts.

By launching the template from a shared central project, platform teams ensure consistency, reduce operational overhead, and eliminate manual effort.
