Skip to content

feat(vm-gitops-export): capture VM defs for GitOps#16

Open
stevefulme1 wants to merge 1 commit intoredhat-cop:mainfrom
stevefulme1:feat/vm-gitops-export
Open

feat(vm-gitops-export): capture VM defs for GitOps#16
stevefulme1 wants to merge 1 commit intoredhat-cop:mainfrom
stevefulme1:feat/vm-gitops-export

Conversation

@stevefulme1
Copy link
Copy Markdown

Summary

  • Adds new vm_gitops_export role and playbook to capture running VirtualMachine definitions from OpenShift and store cleaned manifests in a Git repository
  • Strips runtime fields (uid, resourceVersion, managedFields, status, etc.) to produce GitOps-ready YAML
  • Supports SSH key and HTTPS token authentication for protected repositories
  • Leverages the existing vm_collect role for VM discovery (by name or label selectors)
  • Configurable Git branch, target path, commit author, and commit message

Resolves

MFG-273 — Capture VirtualMachine Definitions for use in GitOps repository

Usage Example

vm_gitops_export_request:
  - namespace: production
    names:
      - web-server-01
      - db-server-01
  - namespace: staging
    label_selectors:
      - app=frontend

vm_gitops_export_git_repo_url: "git@github.com:org/vm-manifests.git"
vm_gitops_export_git_ssh_key: "/path/to/id_rsa"
vm_gitops_export_git_branch: "main"
vm_gitops_export_git_path: "virtualmachines"

Test plan

  • Verify yamllint passes (confirmed — warnings only on playbook env lookups)
  • Verify ansible-lint --offline passes production profile (confirmed — 0 failures, 0 warnings)
  • Integration test: export VM definitions by name to a test Git repo via SSH
  • Integration test: export VM definitions by label selector via HTTPS token
  • Verify manifests are cleaned of runtime fields (no uid, resourceVersion, managedFields, status)
  • Verify idempotency — re-running with unchanged VMs produces no commit
  • Verify cleanup of working directory after export

🤖 Generated with Claude Code

Add a new role and playbook to capture running VirtualMachine definitions
from OpenShift, clean runtime fields from manifests, and export the
resulting YAML to a Git repository. Supports SSH and HTTPS token auth,
named VM targeting and label selectors for bulk capture.

Resolves: MFG-273

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant