> ## Documentation Index
> Fetch the complete documentation index at: https://orphelix.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# YAML Editor

> Edit Kubernetes manifests with Monaco editor and create pull requests for GitOps workflow

## Overview

The YAML Editor provides a powerful in-browser editing experience for Kubernetes manifests. Built on Monaco Editor (the same editor powering VS Code), it offers syntax highlighting, auto-completion, and real-time validation.

![YAML Editor](https://mintlify.s3.us-west-1.amazonaws.com/orphelix/images/yaml-editor.png)

## Opening the Editor

Access the YAML editor from several places:

> [tab] Deployment Detail
>
> Click **"Edit YAML"** button on deployment detail page
>
> **1. Navigate to Deployment**
>
> Go to Deployments → Click deployment name
>
> **2. Click Edit YAML**
>
> Button in top-right of detail page
>
> **3. Editor Opens**
>
> Modal displays full YAML manifest

> [tab] Repository Browser
>
> Edit files directly in repo browser
>
> **1. Open Repo Browser**
>
> Navigate to Repository Browser page
>
> **2. Select Repository**
>
> Choose GitHub repository
>
> **3. Navigate to File**
>
> Browse file tree to YAML file
>
> **4. Click Edit**
>
> Click file to view, then Edit button

> [tab] List View
>
> Quick edit from deployment list
>
> Click **"Edit"** icon in Actions column

## Editor Features

### Syntax Highlighting

![Syntax Highlighting](https://mintlify.s3.us-west-1.amazonaws.com/orphelix/images/yaml-syntax.png)

**Colored by token type:**

* **Blue**: Keys (metadata, spec, containers)
* **Green**: String values
* **Orange**: Numbers and booleans
* **Gray**: Comments
* **Red**: Syntax errors

### Auto-completion

![Auto-completion](https://mintlify.s3.us-west-1.amazonaws.com/orphelix/images/yaml-autocomplete.png)

**Intelligent suggestions:**

> [accordion] Key Suggestions
>
> Type partial key name for suggestions:
>
> ```yaml theme={null}
> spec:
>   temp|    # Suggests: template, terminationGracePeriodSeconds
> ```

> [accordion] Resource Types
>
> Kubernetes resource type suggestions:
>
> ```yaml theme={null}
> kind: D|   # Suggests: Deployment, DaemonSet, etc.
> ```

> [accordion] Enum Values
>
> Known value suggestions:
>
> ```yaml theme={null}
> imagePullPolicy: |   # Suggests: Always, IfNotPresent, Never
> ```

> [accordion] Snippets
>
> Common patterns:
>
> Type `container` → Full container template
> Type `probe` → Health probe template
> Type `volume` → Volume mount template

**Trigger:**

* Automatic after typing
* Manual: `Ctrl+Space` (Windows/Linux) or `Cmd+Space` (Mac)

### Error Detection

![Error Detection](https://mintlify.s3.us-west-1.amazonaws.com/orphelix/images/yaml-errors.png)

**Real-time validation:**

> [tab] Syntax Errors
>
> **Red squiggly underlines** for YAML syntax issues
>
> Examples:
>
> * Invalid indentation
> * Missing colons
> * Quote mismatch
> * Invalid characters
>
> ```yaml theme={null}
> spec
>   replicas 3    # Error: Missing colons
> ```

> [tab] Schema Errors
>
> **Yellow underlines** for Kubernetes schema violations
>
> Examples:
>
> * Unknown fields
> * Wrong value types
> * Missing required fields
>
> ```yaml theme={null}
> spec:
>   replicaCount: 3    # Warning: Should be "replicas"
> ```

> [tab] Hover for Details
>
> Hover over errors for explanation:
>
> ```
> ⚠️ Property "replicaCount" is not allowed
> Did you mean "replicas"?
> ```

### Code Actions

Right-click for quick actions:

> [accordion] Quick Fixes
>
> Automatic fixes for common issues
>
> Example:
>
> ```yaml theme={null}
> imagePullPolicy: always    # Lowercase
>
> Quick Fix: Change to "Always"
> ```

> [accordion] Refactoring
>
> Code improvements:
>
> * Extract to ConfigMap
> * Move to Secret
> * Add resource limits

> [accordion] Go to Definition
>
> Jump to resource definitions:
>
> * ConfigMap reference → View ConfigMap
> * Secret reference → View Secret

### Keyboard Shortcuts

| Action | Windows/Linux | Mac |
| - | - | - |
| **Save** | Ctrl+S | Cmd+S |
| **Find** | Ctrl+F | Cmd+F |
| **Replace** | Ctrl+H | Cmd+H |
| **Undo** | Ctrl+Z | Cmd+Z |
| **Redo** | Ctrl+Y | Cmd+Shift+Z |
| **Comment Line** | Ctrl+/ | Cmd+/ |
| **Format Document** | Shift+Alt+F | Shift+Option+F |
| **Go to Line** | Ctrl+G | Cmd+G |
| **Multi-cursor** | Alt+Click | Option+Click |
| **Select All Occurrences** | Ctrl+Shift+L | Cmd+Shift+L |

### Multi-cursor Editing

Edit multiple locations simultaneously:

**1. Add Cursors**

* Alt+Click to add cursor
* Ctrl+Alt+↑/↓ to add cursor above/below

**2. Select Occurrences**

* Ctrl+D to select next occurrence
* Ctrl+Shift+L to select all occurrences

**3. Edit**

Type to edit all selected locations at once

**Example:** Change all `nginx:1.20` to `nginx:1.21`:

1. Select `nginx:1.20`
2. Press Ctrl+Shift+L
3. Type `nginx:1.21`

## Common Editing Tasks

### Update Container Image

> [tab] Find Image
>
> Search for `image:` in YAML
>
> ```yaml theme={null}
> containers:
> - name: app
>   image: myapp:v1.0.0    # Current version
> ```

> [tab] Change Tag
>
> Update version tag
>
> ```yaml theme={null}
> containers:
> - name: app
>   image: myapp:v1.1.0    # New version
> ```

> [tab] Save Changes
>
> Click "Create PR" to submit changes

### Add Environment Variable

```yaml theme={null}
# Before
containers:
- name: app
  image: myapp:v1.0.0

# After
containers:
- name: app
  image: myapp:v1.0.0
  env:
  - name: LOG_LEVEL
    value: "debug"
  - name: DATABASE_URL
    valueFrom:
      secretKeyRef:
        name: db-credentials
        key: url
```

### Update Resource Limits

```yaml theme={null}
# Before
resources:
  limits:
    memory: "512Mi"
    cpu: "500m"
  requests:
    memory: "256Mi"
    cpu: "250m"

# After (increased for better performance)
resources:
  limits:
    memory: "1Gi"
    cpu: "1000m"
  requests:
    memory: "512Mi"
    cpu: "500m"
```

### Add Health Probes

```yaml theme={null}
# Before
containers:
- name: app
  image: myapp:v1.0.0
  ports:
  - containerPort: 8080

# After (with probes)
containers:
- name: app
  image: myapp:v1.0.0
  ports:
  - containerPort: 8080
  livenessProbe:
    httpGet:
      path: /healthz
      port: 8080
    initialDelaySeconds: 30
    periodSeconds: 10
  readinessProbe:
    httpGet:
      path: /ready
      port: 8080
    initialDelaySeconds: 5
    periodSeconds: 5
```

### Change Replica Count

```yaml theme={null}
# Before
spec:
  replicas: 3

# After (scaled up)
spec:
  replicas: 5
```

> [!WARNING]
>
> Changing replicas in YAML won't have immediate effect - the change must be merged and applied to the cluster

## File Matching

Orphelix can automatically find the YAML file in your repository:

![File Matching](https://mintlify.s3.us-west-1.amazonaws.com/orphelix/images/file-matching.png)

### AI-Powered Matching

**Requires:** OpenAI API key configured in settings

**1. Analyze Deployment**

Extracts:

* Deployment name
* Namespace
* Labels
* Container images

**2. Scan Repository**

Reads files in repository:

* YAML files
* Kustomize bases
* Helm values

**3. AI Matching**

Uses GPT-4o-mini to:

* Compare deployment spec with files
* Calculate similarity scores
* Identify best match

**4. Present Results**

Shows matched file with confidence score:

```
✓ Found: k8s/deployments/myapp.yaml (95% confidence)
```

### Pattern-based Matching

**Fallback method** when AI unavailable:

Matches by filename patterns:

* `{deployment-name}.yaml`
* `deployment-{name}.yaml`
* `{name}-deployment.yaml`
* `k8s/{name}.yaml`

Example:

```
Deployment: "api-gateway"
Matches:
  ✓ k8s/api-gateway.yaml
  ✓ deployments/api-gateway.yaml
  ✓ api-gateway-deployment.yaml
```

### Kustomize Support

Detects and handles Kustomize structure:

![Kustomize Editor](https://mintlify.s3.us-west-1.amazonaws.com/orphelix/images/kustomize-editor.png)

**1. Detect Kustomize**

Finds kustomization.yaml files

**2. Show Tabs**

Editor displays multiple tabs:

* Base: `base/deployment.yaml`
* Overlay: `overlays/production/deployment.yaml`

**3. Edit Both**

Modify base or overlays as needed

**4. Create Multi-file PR**

Changes to multiple files in single PR

## Creating Pull Requests

After editing, submit changes via GitHub:

**1. Review Changes**

Editor shows diff of your modifications

![YAML Diff](https://mintlify.s3.us-west-1.amazonaws.com/orphelix/images/yaml-diff.png)

* Green: Added lines
* Red: Removed lines
* Yellow: Modified lines

**2. Add Commit Message**

Enter descriptive commit message:

```
Update myapp image to v1.1.0

- Bumps image from v1.0.0 to v1.1.0
- Increases memory limit to 1Gi
- Adds liveness probe on /healthz endpoint
```

**3. Select Branch**

Choose branch strategy:

> [tab] Create New Branch
>
> **Recommended for production**
>
> Branch name: `update-myapp-v1.1.0`
>
> Creates new branch → Opens PR

> [tab] Commit to Main
>
> **For development environments**
>
> Commits directly to main/master
>
> No PR created (immediate effect)

**4. Create PR**

Click **"Create Pull Request"**

Orphelix:

1. Creates branch (if selected)
2. Commits changes
3. Opens PR on GitHub
4. Returns PR URL

**5. Review on GitHub**

Click PR URL to view on GitHub:

* Review changes
* Request reviews from team
* Run CI/CD checks
* Merge when ready

### PR Template

Orphelix auto-generates PR description:

```markdown theme={null}
## Changes

Updated deployment: `myapp`

### Modified Files
- `k8s/deployments/myapp.yaml`

### Changes Made
- Updated container image from `myapp:v1.0.0` to `myapp:v1.1.0`
- Increased memory limit from `512Mi` to `1Gi`
- Added liveness probe on `/healthz` endpoint

### Testing
- [ ] Deploy to staging
- [ ] Verify application starts successfully
- [ ] Test liveness probe endpoint
- [ ] Monitor memory usage

---
🤖 Generated with [Orphelix](https://github.com/corapoid/orphelix)
```

## Best Practices

> [accordion] Small, Focused Changes
>
> One logical change per PR:
>
> * ✅ Update image tag
> * ✅ Add health probe
> * ❌ Update image + change replicas + add probes (too much!)

> [accordion] Descriptive Commit Messages
>
> Clear, specific commit messages:
>
> ✅ Good:
>
> ```
> Update nginx image to 1.21.6 for CVE fix
> ```
>
> ❌ Bad:
>
> ```
> Update image
> ```

> [accordion] Review Before Submitting
>
> Always review changes:
>
> * Check diff for unintended modifications
> * Verify indentation is correct
> * Ensure no secrets are exposed
> * Test in staging first

> [accordion] Use Branch Protection
>
> Configure GitHub branch protection:
>
> * Require pull request reviews
> * Require status checks
> * Prevent force push to main

> [accordion] Link to Issues
>
> Reference related issues in PR:
>
> ```
> Fixes #123
>
> Update deployment to fix memory leak reported in #123
> ```

## Troubleshooting

### File Not Found

**Symptom:** "Cannot find YAML file in repository"

**Solutions:**

1. **Manual File Selection**
   * Click "Browse Files" button
   * Navigate to correct file
   * Select manually

2. **Check Repository**
   * Verify correct repository selected
   * Confirm file exists in repo
   * Check branch (main vs master)

3. **Update File Matching Settings**
   * Add custom file patterns in settings
   * Configure OpenAI API key for AI matching

### Permission Denied

**Symptom:** "Failed to create PR: permission denied"

**Check:**

1. **GitHub App Permissions**
   * Contents: Read & Write
   * Pull Requests: Read & Write

2. **Repository Access**
   * Orphelix app installed on repository?
   * Repository not archived/disabled?

3. **Branch Protection**
   * Can create branches?
   * PR allowed from fork?

### Merge Conflicts

**Symptom:** PR shows merge conflicts

**Resolution:**

**1. Fetch Latest**

Pull latest changes from main

**2. Resolve Conflicts**

Open GitHub, resolve conflicts in UI

**3. Alternative: Start Fresh**

Close PR, fetch latest, make changes again

## Next Steps

> [card] [Pull Requests](https://orphelix.mintlify.site/user/github/pull-requests.md)
>
> Learn about PR management

> [card] [GitHub Setup](https://orphelix.mintlify.site/user/github/github-app-setup.md)
>
> Configure GitHub App

> [card] [Deployments](https://orphelix.mintlify.site/user/deployments.md)
>
> Back to deployments

> [card] [Repository Browser](https://orphelix.mintlify.site/user/repo-browser)
>
> Browse repository files


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.