Skip to content

Commit 40f9ec4

Browse files
adamancinihedge-sparrowchris-sanders
authored
move wg-easy application away from replicated-library (#61)
Co-authored-by: hedge-sparrow <[email protected]> Co-authored-by: Chris Sanders <[email protected]>
1 parent 0d98776 commit 40f9ec4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+448
-4008
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*.tgz
1010

1111
# Ignore IDE and editor folders
12+
.cursorindexingignore
1213
.idea/
1314
.vscode/
1415
*.swp
@@ -42,6 +43,9 @@ __pycache__/
4243
# Cursor
4344
.cursor/
4445

46+
# Claude
47+
.claude/
48+
4549
# Mlflow specific
4650
applications/mlflow/tests/.venv/
4751
**/charts/.rendered-templates/
@@ -53,3 +57,5 @@ applications/wg-easy/release/
5357
# SpecStory explanation file
5458
.specstory/.what-is-this.md
5559
*.tar.gz
60+
61+
**/.claude/settings.local.json

applications/wg-easy/CLAUDE.md

Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
# CLAUDE.md for WG-Easy Helm Chart Development
2+
3+
This file contains common commands and workflows for working with the WG-Easy Helm chart project.
4+
5+
## Core Principles
6+
7+
The WG-Easy Helm Chart pattern is built on five fundamental principles:
8+
9+
### 1. Progressive Complexity
10+
11+
Start simple with individual chart validation and progressively move to more complex environments. This allows issues to be caught early when they are easier to fix.
12+
13+
- Begin with local chart validation
14+
- Move to single chart deployments
15+
- Progress to multi-chart integration
16+
- Finally test in production-like environments
17+
18+
### 2. Fast Feedback Loops
19+
20+
Get immediate feedback at each development stage by automating testing and validation. This shortens the overall development cycle.
21+
22+
- Automated chart validation
23+
- Quick cluster creation and deployment
24+
- Standardized testing at each stage
25+
- Fast iteration between changes
26+
27+
### 3. Reproducible Steps
28+
29+
Ensure consistent environments and processes across all stages of development, eliminating "works on my machine" issues.
30+
31+
- Consistent chart configurations
32+
- Automated environment setup
33+
- Deterministic dependency management
34+
- Standardized deployment procedures
35+
36+
### 4. Modular Configuration
37+
38+
Allow different components to own their configuration independently, which can be merged at release time.
39+
40+
- Per-chart configuration files
41+
- Automatic configuration merging
42+
- Clear ownership boundaries
43+
- Simplified collaborative development
44+
45+
### 5. Automation First
46+
47+
Use tools to automate repetitive tasks, reducing human error and increasing development velocity.
48+
49+
- Task-based workflow automation
50+
- Helmfile for orchestration
51+
- Automated validation and testing
52+
- Streamlined release process
53+
54+
## Project Filesystem Layout
55+
56+
- `charts/` - Contains all Helm charts
57+
- `cert-manager/` - Wrapped cert-manager chart
58+
- `cert-manager-issuers/` - Chart for cert-manager issuers
59+
- `replicated-sdk/` - Replicated SDK chart
60+
- `templates/` - Common templates shared across charts
61+
- `traefik/` - Wrapped Traefik chart
62+
- `wg-easy/` - Main application chart
63+
- `replicated/` - Root Replicated configuration
64+
- `taskfiles/` - Task utility functions
65+
- `helmfile.yaml.gotmpl` - Defines chart installation order
66+
- `Taskfile.yaml` - Main task definitions
67+
68+
## Architecture Overview
69+
70+
Key components:
71+
- **Taskfile**: Orchestrates the workflow with automated tasks
72+
- **Helmfile**: Manages chart dependencies and installation order
73+
- **Wrapped Charts**: Encapsulate upstream charts for consistency
74+
- **Shared Templates**: Provide reusable components across charts
75+
- **Replicated Integration**: Enables enterprise distribution
76+
77+
## `wg-easy` Chart
78+
79+
wg-easy uses the `bjw-s/common` [library chart](https://github.com/bjw-s-labs/helm-charts/tree/main) to generate Kubernetes resources. Library charts are commonly used to create DRY templates when authoring Helm charts.
80+
81+
Example values inputs to the bjw-s/common library chart are defined at https://github.com/bjw-s-labs/helm-charts/blob/main/charts/library/common/values.yaml and the schema for validation is defined at https://github.com/bjw-s-labs/helm-charts/blob/main/charts/library/common/values.schema.json
82+
83+
## `templates` Chart
84+
85+
The `templates` chart is imported as a dependency in Chart.yaml and is used to generate some common Kubernetes resources like Traefik routes.
86+
87+
## Development Environment Setup
88+
89+
```bash
90+
# Start the development container
91+
task dev:start
92+
93+
# Get a shell in the development container
94+
task dev:shell
95+
96+
# Stop the development container
97+
task dev:stop
98+
99+
# Rebuild the development container image
100+
task dev:build-image
101+
```
102+
103+
## Cluster Management
104+
105+
```bash
106+
# Create a test cluster (K3s by default)
107+
task cluster-create
108+
109+
# Get information about the current cluster
110+
task cluster-list
111+
112+
# Set up kubeconfig for the test cluster
113+
task setup-kubeconfig
114+
115+
# Expose ports for the cluster
116+
task cluster-ports-expose
117+
118+
# Delete the test cluster
119+
task cluster-delete
120+
```
121+
122+
## Chart Development
123+
124+
```bash
125+
# Update Helm dependencies for all charts
126+
task dependencies-update
127+
128+
# Install all charts using Helmfile
129+
task helm-install
130+
131+
# Run tests
132+
task test
133+
134+
# Full test cycle (create cluster, deploy, test, delete)
135+
task full-test-cycle
136+
```
137+
138+
## Release Management
139+
140+
```bash
141+
# Prepare release files
142+
task release-prepare
143+
144+
# Create and promote a release
145+
task release-create RELEASE_VERSION=x.y.z RELEASE_CHANNEL=Unstable
146+
147+
# Customer management
148+
task customer-create CUSTOMER_NAME=example
149+
task customer-ls
150+
task customer-delete CUSTOMER_ID=your-customer-id
151+
```
152+
153+
## Customization Options
154+
155+
Common variables that can be overridden:
156+
157+
```bash
158+
# Cluster configuration
159+
CLUSTER_NAME=test-cluster
160+
K8S_VERSION=1.32.2
161+
DISK_SIZE=100
162+
INSTANCE_TYPE=r1.small
163+
DISTRIBUTION=k3s
164+
165+
# Release configuration
166+
RELEASE_CHANNEL=Unstable
167+
RELEASE_VERSION=0.0.1
168+
RELEASE_NOTES="Release notes"
169+
170+
# Application configuration
171+
APP_SLUG=wg-easy-cre
172+
```
173+
174+
## Claude Code Configuration
175+
176+
When using Claude Code with this repository, use these timeout settings for long-running operations:
177+
178+
- `task helm-install`: Use 1200000ms (20 minutes) timeout - double the helmfile timeout of 600s
179+
- `task full-test-cycle`: Use 1800000ms (30 minutes) timeout - accounts for cluster creation + deployment + testing
180+
- `task cluster-create`: Use 600000ms (10 minutes) timeout - double typical cluster creation time
181+
182+
Example: When running `task helm-install` via Bash tool, use `timeout: 1200000` parameter.
183+
184+
## Common Workflows
185+
186+
### Local Development
187+
188+
1. Start development container: `task dev:start`
189+
2. Get a shell in the container: `task dev:shell`
190+
3. Create a test cluster: `task cluster-create`
191+
4. Set up kubeconfig: `task setup-kubeconfig`
192+
5. Update dependencies: `task dependencies-update`
193+
6. Deploy charts: `task helm-install`
194+
7. Run tests: `task test`
195+
8. Clean up: `task cluster-delete`
196+
197+
### Creating a Release
198+
199+
1. Update chart versions in respective `Chart.yaml` files
200+
2. Prepare release files: `task release-prepare`
201+
3. Create and promote release: `task release-create RELEASE_VERSION=x.y.z RELEASE_CHANNEL=Unstable`
202+
203+
### Testing a Release
204+
205+
1. Create a customer if needed: `task customer-create CUSTOMER_NAME=test-customer`
206+
2. Create a test cluster: `task cluster-create`
207+
3. Set up kubeconfig: `task setup-kubeconfig`
208+
4. Expose ports: `task cluster-ports-expose`
209+
5. Deploy application: `task helm-install`
210+
6. Run tests: `task test`
211+
7. Clean up: `task cluster-delete`
212+
213+
## Additional Resources
214+
215+
- [Chart Structure Guide](docs/chart-structure.md)
216+
- [Development Workflow](docs/development-workflow.md)
217+
- [Task Reference](docs/task-reference.md)
218+
- [Replicated Integration](docs/replicated-integration.md)
219+
- [Example Patterns](docs/examples.md)

0 commit comments

Comments
 (0)