Skip to content

Debug mode #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions applications/wg-easy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,30 @@ applications/wg-easy/
└── Taskfile.yaml # Main task definitions
```

## Quick Start

The pattern provides a complete workflow from development to deployment. Here are the essential commands:

```bash
# List all available tasks
task --list

# Create a test environment and deploy (verbose mode for detailed output)
task -v full-test-cycle

# Individual development tasks
task cluster-create # Create test cluster
task -v helm-install # Deploy charts with detailed output
task test # Run validation tests
task cluster-delete # Clean up resources

# Release preparation
task release-prepare # Package charts and merge configs
task release-create # Create and promote release
```

**Tip**: Use `task -v <taskname>` for detailed execution output during development and debugging.

## Architecture Overview

Key components:
Expand Down
26 changes: 2 additions & 24 deletions applications/wg-easy/Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,17 @@ vars:
CMX_VM_USER: '{{.CMX_VS_USER}}'
CMX_VM_PUBLIC_KEY: '{{.CMX_VM_PUBLIC_KEY}}'

silent: true

tasks:
default:
desc: Show available tasks
silent: true
cmds:
- task --list

cluster-create:
desc: Create a test cluster using Replicated Compatibility Matrix (use EMBEDDED=true for embedded clusters)
run: once
silent: false
vars:
EMBEDDED: '{{.EMBEDDED | default "false"}}'
TIMEOUT: '{{if eq .EMBEDDED "true"}}420{{else}}300{{end}}'
Expand Down Expand Up @@ -98,7 +98,6 @@ tasks:

test:
desc: Run a basic test suite
silent: false
cmds:
- echo "Running basic tests..."
- echo "This is a placeholder for actual tests"
Expand All @@ -107,7 +106,6 @@ tasks:

verify-kubeconfig:
desc: Verify kubeconfig
silent: false
run: once
cmds:
- |
Expand All @@ -125,7 +123,6 @@ tasks:

setup-kubeconfig:
desc: Get kubeconfig and prepare cluster for application deployment
silent: false
run: once
cmds:
- task: utils:get-kubeconfig
Expand All @@ -147,7 +144,6 @@ tasks:

dependencies-update:
desc: Update Helm dependencies for all charts
silent: false
run: once
cmds:
- echo "Updating Helm dependencies for all charts..."
Expand All @@ -161,7 +157,6 @@ tasks:

cluster-ports-expose:
desc: Expose configured ports for a cluster and capture exposed URLs
silent: false
run: once
status:
- |
Expand Down Expand Up @@ -190,7 +185,6 @@ tasks:

helm-preflight:
desc: Run preflight checks on Helm charts using preflight CLI (use DRY_RUN=true for dry-run)
silent: false
vars:
DRY_RUN: '{{.DRY_RUN | default "false"}}'
cmds:
Expand All @@ -209,7 +203,6 @@ tasks:

helm-install:
desc: Install all charts using helmfile
silent: true
vars:
HELM_ENV: '{{.HELM_ENV | default "default"}}'
cmds:
Expand All @@ -235,7 +228,6 @@ tasks:

helm-uninstall:
desc: Uninstall all charts using helm uninstall
silent: false
cmds:
- echo "Uninstalling all charts via helm"
- |
Expand All @@ -257,7 +249,6 @@ tasks:

cluster-delete:
desc: Delete all test clusters with matching name and clean up kubeconfig
silent: false
cmds:
- echo "Deleting clusters named {{.CLUSTER_NAME}}..."
- |
Expand All @@ -281,7 +272,6 @@ tasks:

release-prepare:
desc: Prepare release files by copying replicated YAML files and packaging Helm charts
silent: false
cmds:
- echo "Preparing release files..."
- rm -rf ./release
Expand Down Expand Up @@ -346,7 +336,6 @@ tasks:

release-create:
desc: Create and promote a release using the Replicated CLI
silent: false
run: once
vars:
RELEASE_CHANNEL: '{{.RELEASE_CHANNEL | default "Unstable"}}'
Expand All @@ -366,7 +355,6 @@ tasks:

customer-create:
desc: Create a new customer or get existing customer with matching name and return their ID
silent: false
run: once
vars:
CUSTOMER_NAME: '{{.CUSTOMER_NAME | default "test-customer"}}'
Expand Down Expand Up @@ -413,7 +401,6 @@ tasks:

gcp-vm-create:
desc: Create a simple GCP VM instance
silent: false
vars:
GCP_MACHINE_TYPE: '{{.GCP_MACHINE_TYPE | default "e2-standard-2"}}'
GCP_DISK_SIZE: '{{.GCP_DISK_SIZE | default "100"}}'
Expand All @@ -434,7 +421,6 @@ tasks:

gcp-vm-delete:
desc: Delete the GCP VM instance for K8s and VPN
silent: false
status:
- "! gcloud compute instances describe {{.VM_NAME}} --project={{.GCP_PROJECT}} --zone={{.GCP_ZONE}} &>/dev/null"
cmds:
Expand All @@ -447,7 +433,6 @@ tasks:

embedded-cluster-setup:
desc: Setup Replicated embedded cluster on the GCP VM
silent: false
vars:
RELEASE_CHANNEL: '{{.RELEASE_CHANNEL | default "Unstable"}}'
AUTH_TOKEN: '{{.AUTH_TOKEN | default "2usDXzovcJNcpn54yS5tFQVNvCq"}}'
Expand All @@ -470,7 +455,6 @@ tasks:

customer-ls:
desc: List customers for the application
silent: false
vars:
OUTPUT_FORMAT: '{{.OUTPUT_FORMAT | default "table"}}'
requires:
Expand All @@ -481,7 +465,6 @@ tasks:

customer-delete:
desc: Archive a customer by ID
silent: false
vars:
CUSTOMER_ID: '{{.CUSTOMER_ID}}'
requires:
Expand All @@ -507,7 +490,6 @@ tasks:

clean:
desc: Remove temporary Helm directories, chart dependencies, and release folder
silent: false
cmds:
- echo "Cleaning temporary directories and dependencies..."
- |
Expand Down Expand Up @@ -535,7 +517,6 @@ tasks:

full-test-cycle:
desc: Create cluster, get kubeconfig, expose ports, update dependencies, deploy charts, test, and delete, and clean up build artifacts
silent: false
cmds:
- task: cluster-create
- task: setup-kubeconfig
Expand All @@ -549,7 +530,6 @@ tasks:
cmx-vm-create:
desc: Create a CMX VM instance using Replicated CLI
run: once
silent: true
status:
- |
# Check if VM is running
Expand All @@ -575,15 +555,13 @@ tasks:

cmx-vm-delete:
desc: Delete a CMX VM instance
silent: true
cmds:
- |
echo "Deleting CMX VM {{.CMX_VM_NAME}}..."
replicated vm rm {{.CMX_VM_NAME}}

cmx-vm-install:
desc: Download and install the app as Embedded Cluster on CMX VM
silent: true
requires:
vars: [REPLICATED_LICENSE_ID]
vars:
Expand Down
30 changes: 30 additions & 0 deletions applications/wg-easy/docs/development-workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@ Before starting the development workflow, ensure you have the following tools in

All other tools will be automatically provided through task commands and containers.

### Debugging with Verbose Mode

All tasks run in silent mode by default. When debugging issues or understanding what's happening during development, use the verbose flag:

```bash
# Show detailed execution for debugging
task -v cluster-create
task -v helm-install

# Standard silent output for production use
task cluster-create
task helm-install
```

## Workflow Stages

### Stage 1: Chart Dependencies and Verification
Expand Down Expand Up @@ -135,6 +149,16 @@ Deploy individual charts to a test cluster to verify functionality.
task setup-kubeconfig
```

**Debugging cluster issues:**
```bash
# Use verbose mode to see detailed cluster creation process
task -v cluster-create
task -v setup-kubeconfig

# Check cluster status manually
task cluster-list
```

2. Run preflight checks on your chart:

```bash
Expand All @@ -143,6 +167,12 @@ Deploy individual charts to a test cluster to verify functionality.
helm template ./charts/wg-easy | kubectl preflight - --dry-run
```

**Debugging preflight issues:**
```bash
# See detailed preflight execution
task -v helm-preflight
```

3. Install a single chart:

```bash
Expand Down
33 changes: 33 additions & 0 deletions applications/wg-easy/docs/task-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,39 @@

This document provides a concise reference for the tasks available in the WG-Easy Helm chart development pattern, organized by their purpose in the development workflow.

## Task Control Options

All tasks are configured to run in silent mode by default, showing only essential output. You can control the verbosity level using Task's built-in flags:

| Flag | Description | Example |
|------|-------------|---------|
| `--verbose` or `-v` | Show detailed task execution information including commands being run | `task -v cluster-create` |
| `--silent` or `-s` | Suppress all output except errors | `task -s dependencies-update` |
| (default) | Silent mode - shows command output but not task execution details | `task cluster-create` |

### Verbose Mode Examples

**Development and Debugging:**
```bash
# See detailed cluster creation process
task -v cluster-create

# Debug helm installation issues
task -v helm-install

# Watch full test cycle execution
task -v full-test-cycle
```

**Production Use:**
```bash
# Suppress all output for automation
task -s release-prepare

# Standard output for CI/CD
task release-create
```

## Development Tasks

These tasks support the iterative development process, focusing on fast feedback loops.
Expand Down
6 changes: 0 additions & 6 deletions applications/wg-easy/taskfiles/utils.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ tasks:
get-kubeconfig:
desc: Get kubeconfig for the test cluster (internal)
internal: true
silent: false
run: once
cmds:
- |
Expand All @@ -16,7 +15,6 @@ tasks:
remove-k3s-traefik:
desc: Remove pre-installed Traefik from k3s clusters (internal)
internal: true
silent: false
run: once
status:
- |
Expand Down Expand Up @@ -58,7 +56,6 @@ tasks:
wait-for-cluster:
desc: Wait for cluster to be in running state
internal: true
silent: true
vars:
CLUSTER_NAME: '{{.CLUSTER_NAME}}'
TIMEOUT: '{{.TIMEOUT | default "300"}}'
Expand Down Expand Up @@ -90,7 +87,6 @@ tasks:

port-operations:
desc: Expose and check status of ports
silent: true
vars:
OPERATION: '{{.OPERATION | default "expose"}}'
CLUSTER_NAME: '{{.CLUSTER_NAME}}'
Expand Down Expand Up @@ -125,7 +121,6 @@ tasks:

vendor-api-auth:
desc: Verify authorization against Replicated Vendor API
silent: false
vars:
API_TOKEN: '{{.REPLICATED_API_TOKEN | default (env "REPLICATED_API_TOKEN")}}'
cmds:
Expand Down Expand Up @@ -160,7 +155,6 @@ tasks:
gcp-operations:
desc: GCP VM operations
internal: true
silent: true
vars:
OPERATION: '{{.OPERATION}}'
GCP_PROJECT: '{{.GCP_PROJECT}}'
Expand Down
Loading