enhancement: Create comprehensive examples and template library #39

Open
opened 2026-02-22 13:15:07 +00:00 by cpfarhood · 0 comments
cpfarhood commented 2026-02-22 13:15:07 +00:00 (Migrated from github.com)

Summary

Create a comprehensive library of examples and templates to help users quickly deploy dev containers for common scenarios and use cases.

Proposed Examples Structure

examples/
├── README.md                    # Examples overview and index
├── basic/
│   ├── basic-development.yaml
│   ├── quick-prototype.yaml
│   └── minimal-resources.yaml
├── team/
│   ├── team-workspace.yaml
│   ├── shared-development.yaml
│   └── code-review-env.yaml
├── specialized/
│   ├── ai-playground.yaml
│   ├── kubernetes-admin.yaml
│   ├── web-development.yaml
│   ├── data-science.yaml
│   └── security-testing.yaml
├── cloud-providers/
│   ├── aws-eks.yaml
│   ├── gcp-gke.yaml
│   ├── azure-aks.yaml
│   └── digitalocean-k8s.yaml
├── integrations/
│   ├── gitlab-integration.yaml
│   ├── jenkins-agent.yaml
│   ├── sonarqube-analysis.yaml
│   └── database-development.yaml
└── advanced/
    ├── multi-tenant.yaml
    ├── gpu-workstation.yaml
    ├── custom-extensions.yaml
    └── enterprise-setup.yaml

Example Categories

1. Basic Development Scenarios

basic-development.yaml - Standard full-stack development

name: fullstack-dev
githubRepo: https://github.com/company/webapp

ide:
  type: vscode

resources:
  requests:
    memory: "2Gi"
    cpu: "1000m"
  limits:
    memory: "8Gi"  
    cpu: "4000m"

mcp:
  sidecars:
    kubernetes:
      enabled: true
    playwright:
      enabled: true      # Web testing
    flux:
      enabled: false

# Secrets needed:
# kubectl create secret generic devcontainer-fullstack-dev-secrets-env \
#   --from-literal=GITHUB_TOKEN='ghp_...'

quick-prototype.yaml - Rapid prototyping setup

name: prototype
githubRepo: https://github.com/user/quick-experiment

ide:
  type: vscode

resources:
  requests:
    memory: "1Gi"
    cpu: "500m"
  limits:
    memory: "4Gi"
    cpu: "2000m"

storage:
  size: 16Gi

mcp:
  sidecars:
    kubernetes:
      enabled: false
    flux:
      enabled: false
    playwright:
      enabled: true     # Keep for testing
    # All others disabled for speed

2. Team Collaboration

team-workspace.yaml - Shared team environment

name: team-shared
githubRepo: https://github.com/company/monorepo

ide:
  type: vscode

ssh:
  enabled: true        # Multiple access methods

resources:
  requests:
    memory: "4Gi"
    cpu: "2000m"
  limits:
    memory: "16Gi"
    cpu: "8000m"

storage:
  size: 128Gi          # Large shared storage

clusterAccess: readwrite

mcp:
  sidecars:
    kubernetes:
      enabled: true
    flux:
      enabled: true
    playwright:
      enabled: true
    pgtuner:
      enabled: true     # Database work

3. Specialized Use Cases

ai-playground.yaml - AI/ML development

name: ai-lab
githubRepo: https://github.com/company/ml-experiments

ide:
  type: vscode

resources:
  requests:
    memory: "8Gi"
    cpu: "4000m"
  limits:
    memory: "32Gi"     # High memory for datasets
    cpu: "16000m"

storage:
  size: 256Gi          # Large datasets

# GPU support (if available)
# nodeSelector:
#   nvidia.com/gpu: "true"

mcp:
  sidecars:
    kubernetes:
      enabled: false   # Save resources
    flux:
      enabled: false
    playwright:
      enabled: true    # Web scraping for data
    pgtuner:
      enabled: false

# Additional tools mounted via init containers:
# - Jupyter notebooks
# - Python ML stack
# - CUDA toolkit

kubernetes-admin.yaml - Platform engineering

name: k8s-admin
githubRepo: https://github.com/company/k8s-platform

ide:
  type: vscode

clusterAccess: readwrite  # Full cluster access

resources:
  requests:
    memory: "3Gi"
    cpu: "1500m"
  limits:
    memory: "12Gi"
    cpu: "6000m"

mcp:
  sidecars:
    kubernetes:
      enabled: true
    flux:
      enabled: true     # GitOps operations
    pgtuner:
      enabled: true     # Database administration
    playwright:
      enabled: false    # Not needed

# Pre-installed tools:
# - kubectl, helm, kustomize
# - flux CLI, argocd CLI
# - terraform, pulumi

4. Cloud Provider Optimized

aws-eks.yaml - AWS EKS optimized setup

name: aws-dev
githubRepo: https://github.com/company/aws-project

storage:
  className: gp2        # AWS EBS optimized
  size: 64Gi

resources:
  # Optimized for t3.medium nodes
  requests:
    memory: "1.5Gi"
    cpu: "750m"
  limits:
    memory: "6Gi"
    cpu: "3000m"

# AWS-specific configurations
annotations:
  service.beta.kubernetes.io/aws-load-balancer-type: "nlb"

# IAM roles for service accounts (IRSA)
serviceAccount:
  annotations:
    eks.amazonaws.com/role-arn: arn:aws:iam::ACCOUNT:role/devcontainer-role

5. Integration Examples

gitlab-integration.yaml - GitLab CI/CD integration

name: gitlab-dev
githubRepo: https://gitlab.com/company/project  # GitLab repo

# GitLab-specific git configuration
environment:
  GIT_USER_NAME: "GitLab CI"
  GIT_USER_EMAIL: "ci@company.com"
  GITLAB_HOST: "gitlab.com"

mcp:
  sidecars:
    # Custom GitLab MCP (if available)
    # kubernetes: true for deployment testing
    kubernetes:
      enabled: true

# GitLab runner integration
labels:
  gitlab-runner: "enabled"

Template Generation System

Interactive Template Builder

# Command-line template generator
./scripts/generate-template.sh

# Prompts:
# 1. Use case category (basic/team/specialized/cloud/integration/advanced)
# 2. Resource profile (small/medium/large/xlarge)  
# 3. Required integrations (git provider, databases, etc.)
# 4. Deployment target (local/cloud provider)
# 5. Security requirements (ssh, rbac level)

# Generates custom values.yaml based on answers

Template Validation

# Validate all example templates
make validate-examples

# Test deployment of examples
make test-examples

Documentation for Examples

examples/README.md

# Dev Container Examples

This directory contains ready-to-use examples for common deployment scenarios.

## Quick Start

1. Choose an example that matches your use case
2. Copy the example file: `cp examples/basic/basic-development.yaml my-values.yaml`
3. Edit the `name` and `githubRepo` fields
4. Deploy: `helm install mydev ./chart -f my-values.yaml`

## Examples by Category

### 🚀 Basic Development
- [basic-development.yaml](basic/basic-development.yaml) - Full-stack web development
- [quick-prototype.yaml](basic/quick-prototype.yaml) - Rapid prototyping
- [minimal-resources.yaml](basic/minimal-resources.yaml) - Resource-constrained environments

### 👥 Team Collaboration  
- [team-workspace.yaml](team/team-workspace.yaml) - Shared development environment
- [code-review-env.yaml](team/code-review-env.yaml) - Code review and testing

### 🎯 Specialized Use Cases
- [ai-playground.yaml](specialized/ai-playground.yaml) - AI/ML development
- [kubernetes-admin.yaml](specialized/kubernetes-admin.yaml) - Platform engineering
- [data-science.yaml](specialized/data-science.yaml) - Data analysis workbench

### ☁️ Cloud Providers
- [aws-eks.yaml](cloud-providers/aws-eks.yaml) - AWS EKS optimization
- [gcp-gke.yaml](cloud-providers/gcp-gke.yaml) - Google GKE setup
- [azure-aks.yaml](cloud-providers/azure-aks.yaml) - Azure AKS configuration

## Example Usage Patterns

### One-Command Deployment
```bash
helm install mydev ./chart \
  --values examples/basic/basic-development.yaml \
  --set name=mydev \
  --set githubRepo=https://github.com/youruser/yourrepo

Secret Configuration

Each example includes secret requirements as comments:

# From basic-development.yaml comments:
kubectl create secret generic devcontainer-mydev-secrets-env \
  --from-literal=GITHUB_TOKEN='ghp_...' \
  --from-literal=VNC_PASSWORD='changeme'

Customization Guide

All examples can be customized by:

  1. Copying the example file
  2. Modifying resource requirements
  3. Enabling/disabling MCP sidecars
  4. Adjusting storage and access settings

## Benefits

- **Faster Time-to-Value**: Users can deploy immediately
- **Learning Resource**: Examples teach best practices
- **Reduced Errors**: Tested, working configurations
- **Inspiration**: Shows art of the possible
- **Community Contribution**: Users can contribute their own examples

## Maintenance Strategy

### Automated Testing
```yaml
# .github/workflows/test-examples.yaml
name: Test Examples
on:
  pull_request:
    paths: ['examples/**']

jobs:
  test-examples:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        example:
          - basic/basic-development.yaml
          - team/team-workspace.yaml
          - specialized/kubernetes-admin.yaml
    steps:
    - uses: actions/checkout@v4
    - name: Test example deployment
      run: |
        # Test helm template rendering
        helm template test ./chart -f examples/${{ matrix.example }}
        
        # Validate against schema
        helm template test ./chart -f examples/${{ matrix.example }} | \
          kubectl apply --dry-run=client -f -

Example Quality Standards

  • All examples must include:
    • Complete values.yaml configuration
    • Required secrets documentation
    • Resource requirements explanation
    • Use case description
    • Deployment instructions

Implementation Plan

  • Create examples directory structure
  • Develop basic development scenarios (3-5 examples)
  • Add team collaboration examples
  • Create specialized use case examples
  • Build cloud provider optimized templates
  • Add integration examples
  • Develop template generation system
  • Create comprehensive documentation
  • Set up automated testing for examples
  • Add contribution guidelines for community examples
## Summary Create a comprehensive library of examples and templates to help users quickly deploy dev containers for common scenarios and use cases. ## Proposed Examples Structure ``` examples/ ├── README.md # Examples overview and index ├── basic/ │ ├── basic-development.yaml │ ├── quick-prototype.yaml │ └── minimal-resources.yaml ├── team/ │ ├── team-workspace.yaml │ ├── shared-development.yaml │ └── code-review-env.yaml ├── specialized/ │ ├── ai-playground.yaml │ ├── kubernetes-admin.yaml │ ├── web-development.yaml │ ├── data-science.yaml │ └── security-testing.yaml ├── cloud-providers/ │ ├── aws-eks.yaml │ ├── gcp-gke.yaml │ ├── azure-aks.yaml │ └── digitalocean-k8s.yaml ├── integrations/ │ ├── gitlab-integration.yaml │ ├── jenkins-agent.yaml │ ├── sonarqube-analysis.yaml │ └── database-development.yaml └── advanced/ ├── multi-tenant.yaml ├── gpu-workstation.yaml ├── custom-extensions.yaml └── enterprise-setup.yaml ``` ## Example Categories ### 1. Basic Development Scenarios **basic-development.yaml** - Standard full-stack development ```yaml name: fullstack-dev githubRepo: https://github.com/company/webapp ide: type: vscode resources: requests: memory: "2Gi" cpu: "1000m" limits: memory: "8Gi" cpu: "4000m" mcp: sidecars: kubernetes: enabled: true playwright: enabled: true # Web testing flux: enabled: false # Secrets needed: # kubectl create secret generic devcontainer-fullstack-dev-secrets-env \ # --from-literal=GITHUB_TOKEN='ghp_...' ``` **quick-prototype.yaml** - Rapid prototyping setup ```yaml name: prototype githubRepo: https://github.com/user/quick-experiment ide: type: vscode resources: requests: memory: "1Gi" cpu: "500m" limits: memory: "4Gi" cpu: "2000m" storage: size: 16Gi mcp: sidecars: kubernetes: enabled: false flux: enabled: false playwright: enabled: true # Keep for testing # All others disabled for speed ``` ### 2. Team Collaboration **team-workspace.yaml** - Shared team environment ```yaml name: team-shared githubRepo: https://github.com/company/monorepo ide: type: vscode ssh: enabled: true # Multiple access methods resources: requests: memory: "4Gi" cpu: "2000m" limits: memory: "16Gi" cpu: "8000m" storage: size: 128Gi # Large shared storage clusterAccess: readwrite mcp: sidecars: kubernetes: enabled: true flux: enabled: true playwright: enabled: true pgtuner: enabled: true # Database work ``` ### 3. Specialized Use Cases **ai-playground.yaml** - AI/ML development ```yaml name: ai-lab githubRepo: https://github.com/company/ml-experiments ide: type: vscode resources: requests: memory: "8Gi" cpu: "4000m" limits: memory: "32Gi" # High memory for datasets cpu: "16000m" storage: size: 256Gi # Large datasets # GPU support (if available) # nodeSelector: # nvidia.com/gpu: "true" mcp: sidecars: kubernetes: enabled: false # Save resources flux: enabled: false playwright: enabled: true # Web scraping for data pgtuner: enabled: false # Additional tools mounted via init containers: # - Jupyter notebooks # - Python ML stack # - CUDA toolkit ``` **kubernetes-admin.yaml** - Platform engineering ```yaml name: k8s-admin githubRepo: https://github.com/company/k8s-platform ide: type: vscode clusterAccess: readwrite # Full cluster access resources: requests: memory: "3Gi" cpu: "1500m" limits: memory: "12Gi" cpu: "6000m" mcp: sidecars: kubernetes: enabled: true flux: enabled: true # GitOps operations pgtuner: enabled: true # Database administration playwright: enabled: false # Not needed # Pre-installed tools: # - kubectl, helm, kustomize # - flux CLI, argocd CLI # - terraform, pulumi ``` ### 4. Cloud Provider Optimized **aws-eks.yaml** - AWS EKS optimized setup ```yaml name: aws-dev githubRepo: https://github.com/company/aws-project storage: className: gp2 # AWS EBS optimized size: 64Gi resources: # Optimized for t3.medium nodes requests: memory: "1.5Gi" cpu: "750m" limits: memory: "6Gi" cpu: "3000m" # AWS-specific configurations annotations: service.beta.kubernetes.io/aws-load-balancer-type: "nlb" # IAM roles for service accounts (IRSA) serviceAccount: annotations: eks.amazonaws.com/role-arn: arn:aws:iam::ACCOUNT:role/devcontainer-role ``` ### 5. Integration Examples **gitlab-integration.yaml** - GitLab CI/CD integration ```yaml name: gitlab-dev githubRepo: https://gitlab.com/company/project # GitLab repo # GitLab-specific git configuration environment: GIT_USER_NAME: "GitLab CI" GIT_USER_EMAIL: "ci@company.com" GITLAB_HOST: "gitlab.com" mcp: sidecars: # Custom GitLab MCP (if available) # kubernetes: true for deployment testing kubernetes: enabled: true # GitLab runner integration labels: gitlab-runner: "enabled" ``` ## Template Generation System ### Interactive Template Builder ```bash # Command-line template generator ./scripts/generate-template.sh # Prompts: # 1. Use case category (basic/team/specialized/cloud/integration/advanced) # 2. Resource profile (small/medium/large/xlarge) # 3. Required integrations (git provider, databases, etc.) # 4. Deployment target (local/cloud provider) # 5. Security requirements (ssh, rbac level) # Generates custom values.yaml based on answers ``` ### Template Validation ```bash # Validate all example templates make validate-examples # Test deployment of examples make test-examples ``` ## Documentation for Examples ### examples/README.md ```markdown # Dev Container Examples This directory contains ready-to-use examples for common deployment scenarios. ## Quick Start 1. Choose an example that matches your use case 2. Copy the example file: `cp examples/basic/basic-development.yaml my-values.yaml` 3. Edit the `name` and `githubRepo` fields 4. Deploy: `helm install mydev ./chart -f my-values.yaml` ## Examples by Category ### 🚀 Basic Development - [basic-development.yaml](basic/basic-development.yaml) - Full-stack web development - [quick-prototype.yaml](basic/quick-prototype.yaml) - Rapid prototyping - [minimal-resources.yaml](basic/minimal-resources.yaml) - Resource-constrained environments ### 👥 Team Collaboration - [team-workspace.yaml](team/team-workspace.yaml) - Shared development environment - [code-review-env.yaml](team/code-review-env.yaml) - Code review and testing ### 🎯 Specialized Use Cases - [ai-playground.yaml](specialized/ai-playground.yaml) - AI/ML development - [kubernetes-admin.yaml](specialized/kubernetes-admin.yaml) - Platform engineering - [data-science.yaml](specialized/data-science.yaml) - Data analysis workbench ### ☁️ Cloud Providers - [aws-eks.yaml](cloud-providers/aws-eks.yaml) - AWS EKS optimization - [gcp-gke.yaml](cloud-providers/gcp-gke.yaml) - Google GKE setup - [azure-aks.yaml](cloud-providers/azure-aks.yaml) - Azure AKS configuration ## Example Usage Patterns ### One-Command Deployment ```bash helm install mydev ./chart \ --values examples/basic/basic-development.yaml \ --set name=mydev \ --set githubRepo=https://github.com/youruser/yourrepo ``` ### Secret Configuration Each example includes secret requirements as comments: ```bash # From basic-development.yaml comments: kubectl create secret generic devcontainer-mydev-secrets-env \ --from-literal=GITHUB_TOKEN='ghp_...' \ --from-literal=VNC_PASSWORD='changeme' ``` ### Customization Guide All examples can be customized by: 1. Copying the example file 2. Modifying resource requirements 3. Enabling/disabling MCP sidecars 4. Adjusting storage and access settings ``` ## Benefits - **Faster Time-to-Value**: Users can deploy immediately - **Learning Resource**: Examples teach best practices - **Reduced Errors**: Tested, working configurations - **Inspiration**: Shows art of the possible - **Community Contribution**: Users can contribute their own examples ## Maintenance Strategy ### Automated Testing ```yaml # .github/workflows/test-examples.yaml name: Test Examples on: pull_request: paths: ['examples/**'] jobs: test-examples: runs-on: ubuntu-latest strategy: matrix: example: - basic/basic-development.yaml - team/team-workspace.yaml - specialized/kubernetes-admin.yaml steps: - uses: actions/checkout@v4 - name: Test example deployment run: | # Test helm template rendering helm template test ./chart -f examples/${{ matrix.example }} # Validate against schema helm template test ./chart -f examples/${{ matrix.example }} | \ kubectl apply --dry-run=client -f - ``` ### Example Quality Standards - All examples must include: - Complete values.yaml configuration - Required secrets documentation - Resource requirements explanation - Use case description - Deployment instructions ## Implementation Plan - [ ] Create examples directory structure - [ ] Develop basic development scenarios (3-5 examples) - [ ] Add team collaboration examples - [ ] Create specialized use case examples - [ ] Build cloud provider optimized templates - [ ] Add integration examples - [ ] Develop template generation system - [ ] Create comprehensive documentation - [ ] Set up automated testing for examples - [ ] Add contribution guidelines for community examples
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: farhoodlabs/devcontainer#39