- 
                Notifications
    
You must be signed in to change notification settings  - Fork 4
 
Description
Migration Analysis: Launchpad-Namespaces (Helmfile) to ArgoCD ApplicationSets
Executive Summary
This issue documents comprehensive research on migrating from launchpad-namespaces' helmfile-based approach to ArgoCD ApplicationSets. The analysis covers architectural differences, migration feasibility, namespace-specific challenges, and recommendations for a phased migration approach.
Current Architecture: Launchpad-Namespaces with Helmfile
Key Characteristics
- CUE Schema Generation: Uses CUE (Configure, Unify, Execute) to define schemas in 
src/schemas/that generate helmfile configurations - Namespace Organization: Organizes charts into functional namespaces (ethereum, storage, graph, etc.)
 - Feature Flags: Supports conditional deployment of components via feature flags
 - Scaling Parameters: Allows configuration of deployment scaling (e.g., number of instances)
 - Release Channels: Supports both 
stableandcanaryrelease channels - Value Overrides: Flexible configuration with multiple levels of value overrides
 
Templating & Generation
- Go Templating: Extensive use of Go templates for dynamic configuration
 - Complex Conditionals: Supports complex conditional logic for feature toggling
 - Label Management: Sophisticated label and annotation management
 - Release Generation: Dynamic generation of releases based on scaling parameters
 
ArgoCD ApplicationSets Capabilities
Key Characteristics
- Generator-based: Uses generators (Git, List, Cluster, etc.) to produce parameters
 - Template-based: Templates define how Applications are created from parameters
 - Patch-based: Supports advanced patching for complex configurations
 - Matrix Combinations: Can combine multiple generators for complex deployment patterns
 
Templating & Generation
- Go Templating: Uses Go templates with Sprig functions
 - Custom Functions: Provides additional functions like 
normalizeandslugify - Helm Integration: Uses Helm only for templating (
helm template), not lifecycle management - Value Management: Supports multiple ways to provide values to Helm charts
 
Namespace-by-Namespace Analysis
1. Sealed-Secrets Namespace
Features:
- Simple deployment of sealed-secrets controller
 - Single component with simple configuration
 
Migration Feasibility: Very Easy
- No complex feature flags or scaling parameters
 - Minimal templating requirements
 - Can serve as a proof of concept for the migration approach
 
ApplicationSet Implementation:
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: sealed-secrets
spec:
  generators:
  - list:
      elements:
      - component: sealed-secrets
  template:
    metadata:
      name: 'sealed-secrets'
    spec:
      project: default
      source:
        repoURL: https://charts.bitnami.com/bitnami
        chart: sealed-secrets
        targetRevision: '{{.Values.chartVersion | default "latest"}}'
      destination:
        server: https://kubernetes.default.svc
        namespace: '{{.Values.targetNamespace | default "sealed-secrets"}}'2. Postgres-Operator Namespace
Features:
- Simple deployment of postgres-operator
 - Single component with simple configuration
 
Migration Feasibility: Very Easy
- No complex features
 - Straightforward templating
 
3. Storage Namespace
Features:
- Provides OpenEBS for software-defined storage
 - Supports two storage engines: rawfile and ZFS
 - Uses feature flags for enabling different storage engines
 
Migration Feasibility: Moderate
- Easy to Replicate:
- Basic chart deployment structure
 - Simple feature flags (rawfile, zfs)
 - Namespace configuration
 
 - Challenging:
- Storage class configuration which relies on resource-injector
 
 
4. Ingress Namespace
Features:
- Ingress controller
 - Certificate management
 - Resource configuration
 
Migration Feasibility: Moderate
- Easy to Replicate:
- Basic component deployment
 - Simple configuration
 
 - Challenging:
- Certificate resource management
 
 
5. Monitoring Namespace
Features:
- Prometheus, Grafana, Loki stack
 - Dashboard configuration
 - Alert configuration
 
Migration Feasibility: Moderate to Difficult
- Easy to Replicate:
- Basic component deployment
 - Simple configuration
 
 - Challenging:
- Dashboard configuration
 - Alert configuration
 
 
6. Ethereum Namespace
Features:
- Supports multiple networks (mainnet, holesky, sepolia, hoodi)
 - Complex feature flags (nimbus, lighthouse, proxyd)
 - Scaling parameters for multiple deployments
 - Complex label management
 
Migration Feasibility: Difficult
- Easy to Replicate:
- Network flavor configuration
 - Basic chart deployment
 
 - Challenging:
- Complex scaling parameters
 - Dynamic release generation based on scaling
 - Complex label and annotation management
 - JWT authentication between execution and consensus clients
 
 
ApplicationSet Implementation Example:
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: ethereum
spec:
  generators:
  - matrix:
      generators:
      - list:
          elements:
          - flavor: mainnet
            targetNamespace: eth-mainnet
          - flavor: holesky
            targetNamespace: eth-holesky
          - flavor: sepolia
            targetNamespace: eth-sepolia
      - list:
          elements:
          - component: erigon
            layer: execution
          - component: nimbus
            layer: consensus
            feature: nimbus
          - component: lighthouse
            layer: consensus
            feature: lighthouse
          - component: proxyd
            layer: proxy
            feature: proxyd
  template:
    metadata:
      name: 'ethereum-{{flavor}}-{{component}}'
    spec:
      project: default
      source:
        repoURL: https://graphops.github.io/launchpad-charts
        chart: '{{component}}'
        targetRevision: '{{.Values.chartVersion | default "latest"}}'
        helm:
          valueFiles:
          - values/common.yaml
          - values/{{flavor}}/{{component}}.yaml
          values:
            scaling:
              deployments: '{{.Values.scaling.deployments | default 1}}'
            labels:
              app.launchpad.graphops.xyz/layer: '{{layer}}'
              app.launchpad.graphops.xyz/component: '{{component}}'
              app.launchpad.graphops.xyz/network: '{{flavor}}'
      destination:
        server: https://kubernetes.default.svc
        namespace: '{{targetNamespace}}'7. Graph Namespace
Features:
- Complex interdependent components
 - Database configuration
 - Indexer configuration with multiple components
 - Subgraph deployment rules
 
Migration Feasibility: Very Difficult
- Easy to Replicate:
- Basic component deployment
 
 - Challenging:
- Complex interdependencies between components
 - Indexer configuration with multiple related components
 - Subgraph deployment rules
 - Database configuration
 
 
Migration Challenges
- Schema Translation: Converting CUE schemas to ApplicationSet templates
 - Feature Flag Implementation: Implementing feature flags using ApplicationSet generators
 - Scaling Parameters: Replicating scaling parameters using ApplicationSet generators
 - Release Channel Management: Managing stable and canary releases in ApplicationSets
 - Value Override Hierarchy: Maintaining the complex value override hierarchy
 
Recommended Migration Approach
Phase 1: Proof of Concept
- Start with Sealed-Secrets Namespace as the simplest namespace
 - Create ApplicationSet templates that replicate the helmfile functionality
 - Test and validate the templates
 
Phase 2: Simple Namespaces
- Migrate Postgres-Operator Namespace
 - Migrate Storage Namespace with feature flag implementation
 
Phase 3: Moderate Complexity
- Migrate Ingress Namespace
 - Migrate Monitoring Namespace
 
Phase 4: Complex Namespaces
- Migrate Ethereum Namespace with full scaling and feature flag support
 - Migrate Graph Namespace with complex interdependencies
 
Key Migration Strategies
- Git Generator with Directory Structure: Use the Git directory generator to create Applications based on namespace directories
 - Matrix Generator for Feature Flags: Use Matrix generator to combine feature flags with namespace configurations
 - Template Patch for Complex Configuration: Use templatePatch for complex configurations that can't be expressed in simple templates
 - Value Management: Use Helm valueFiles and values for managing the configuration hierarchy
 - Release Channel Implementation: Use Git references or branches to manage stable and canary releases
 
Conclusion
Migrating from Launchpad-Namespaces with Helmfile to ArgoCD ApplicationSets is feasible but requires significant effort to replicate the complex templating and generation capabilities. The migration should follow a phased approach, starting with the simplest namespaces (sealed-secrets, postgres-operator) and gradually moving to more complex ones (ethereum, graph).
The most challenging aspects will be maintaining the complex conditional logic and value override hierarchy. However, ApplicationSets' Matrix generator and templatePatch capabilities provide powerful tools to address these challenges.
Next Steps
- Create a proof of concept with the sealed-secrets namespace
 - Develop a migration framework that can be reused across namespaces
 - Document migration patterns for common scenarios (feature flags, scaling, etc.)
 - Create a migration guide for each namespace
 - Test thoroughly in a staging environment before production migration