Skip to content
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,5 @@ applications/wg-easy/release/
applications/wg-easy/*/charts/
applications/wg-easy/*/Chart.lock
.aider*
# SpecStory explanation file
.specstory/.what-is-this.md
2 changes: 0 additions & 2 deletions applications/wg-easy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ applications/wg-easy/

## Architecture Overview

![Architecture Diagram](docs/architecture.png)

Key components:
- **Taskfile**: Orchestrates the workflow with automated tasks
- **Helmfile**: Manages chart dependencies and installation order
Expand Down
31 changes: 16 additions & 15 deletions applications/wg-easy/Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ includes:

vars:
# Application configuration
APP_NAME: '{{.REPLICATED_APP | default "wg-easy"}}'
APP_SLUG: '{{.REPLICATED_APP | default "wg-easy"}}'

# Cluster configuration
CLUSTER_NAME: '{{.CLUSTER_NAME | default "test-cluster"}}'
Expand Down Expand Up @@ -38,8 +38,9 @@ vars:
tasks:
default:
desc: Show available tasks
silent: true
cmds:
- task -s --list
- task --list

cluster-create:
desc: Create a test cluster using Replicated Compatibility Matrix (use EMBEDDED=true for embedded clusters)
Expand All @@ -49,24 +50,24 @@ tasks:
EMBEDDED: '{{.EMBEDDED | default "false"}}'
LICENSE_ID: '{{if eq .EMBEDDED "true"}}{{.LICENSE_ID | default "2cmqT1dBVHZ3aSH21kPxWtgoYGr"}}{{end}}'
TIMEOUT: '{{if eq .EMBEDDED "true"}}420{{else}}300{{end}}'
TTL: '{{.TTL | default "4h"}}'
status:
- replicated cluster ls --output json | jq -e '.[] | select(.name == "{{.CLUSTER_NAME}}")' > /dev/null
cmds:
- |
if [ "{{.EMBEDDED}}" = "true" ]; then
echo "Creating embedded cluster {{.CLUSTER_NAME}} with license ID {{.LICENSE_ID}}..."
replicated cluster create --distribution embedded-cluster --name {{.CLUSTER_NAME}} --license-id {{.LICENSE_ID}}
replicated cluster create --distribution embedded-cluster --name {{.CLUSTER_NAME}} --license-id {{.LICENSE_ID}} --ttl {{.TTL}}
else
echo "Creating cluster {{.CLUSTER_NAME}} with distribution {{.DISTRIBUTION}}..."
replicated cluster create --name {{.CLUSTER_NAME}} --distribution {{.DISTRIBUTION}} --version {{.K8S_VERSION}} --disk {{.DISK_SIZE}} --instance-type {{.INSTANCE_TYPE}}
replicated cluster create --name {{.CLUSTER_NAME}} --distribution {{.DISTRIBUTION}} --version {{.K8S_VERSION}} --disk {{.DISK_SIZE}} --instance-type {{.INSTANCE_TYPE}} --ttl {{.TTL}}
fi
- task: utils:wait-for-cluster
vars:
TIMEOUT: "{{.TIMEOUT}}"

list-cluster:
cluster-list:
desc: List the cluster
silent: false
cmds:
- |
CLUSTER_ID=$(replicated cluster ls --output json | jq -r '.[] | select(.name == "{{.CLUSTER_NAME}}") | .id')
Expand All @@ -82,7 +83,6 @@ tasks:
- sleep 5
- echo "Tests completed!"


verify-kubeconfig:
desc: Verify kubeconfig
silent: false
Expand Down Expand Up @@ -126,6 +126,7 @@ tasks:
dependencies-update:
desc: Update Helm dependencies for all charts
silent: false
run: once
cmds:
- echo "Updating Helm dependencies for all charts..."
- |
Expand Down Expand Up @@ -189,7 +190,6 @@ tasks:
- setup-kubeconfig
- ports-expose


cluster-delete:
desc: Delete all test clusters with matching name and clean up kubeconfig
silent: false
Expand Down Expand Up @@ -278,22 +278,23 @@ tasks:

- echo "Release files prepared in ./release/ directory"
deps:
- update-version

- dependencies-update

release-create:
desc: Create and promote a release using the Replicated CLI
silent: false
vars:
CHANNEL: '{{.CHANNEL | default "Unstable"}}'
RELEASE_NOTES: '{{.RELEASE_NOTES | default "Release created via task release-create"}}'
requires:
vars: [APP_SLUG, VERSION]
cmds:
- echo "Creating and promoting release for $APP_NAME to channel $CHANNEL..."
- echo "Creating and promoting release for {{.APP_SLUG}} to channel {{.CHANNEL}}..."
- |
# Create and promote the release in one step
echo "Creating release from files in ./release directory..."
replicated release create --app $APP_NAME --yaml-dir ./release --release-notes "$RELEASE_NOTES" --promote $CHANNEL --version $VERSION
echo "Release version $VERSION created and promoted to channel $CHANNEL"
replicated release create --app {{.APP_SLUG}} --yaml-dir ./release --release-notes "{{.RELEASE_NOTES}}" --promote {{.CHANNEL}} --version {{.VERSION}}
echo "Release version {{.VERSION}} created and promoted to channel {{.CHANNEL}}"
deps:
- release-prepare

Expand Down Expand Up @@ -342,12 +343,12 @@ tasks:
status:
- |
# Check if the application tarball has already been downloaded and extracted
gcloud compute ssh {{.VM_NAME}} --project={{.GCP_PROJECT}} --zone={{.GCP_ZONE}} --command="test -d ./{{.APP_NAME}}" &>/dev/null
gcloud compute ssh {{.VM_NAME}} --project={{.GCP_PROJECT}} --zone={{.GCP_ZONE}} --command="test -d ./{{.APP_SLUG}}" &>/dev/null
cmds:
- task: utils:gcp-operations
vars:
OPERATION: "setup-embedded"
APP_NAME: '{{.APP_NAME}}'
APP_SLUG: '{{.APP_SLUG}}'
CHANNEL: '{{.CHANNEL}}'
AUTH_TOKEN: '{{.AUTH_TOKEN}}'
GCP_PROJECT: '{{.GCP_PROJECT}}'
Expand Down
9 changes: 8 additions & 1 deletion applications/wg-easy/container/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
curl \
jq \
less \
yq \
gnupg \
bash-completion \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seeing warnings from GH actions about this line ending in \ without anything coming after it


Expand All @@ -29,7 +28,7 @@

# Clean up
&& apt-get purge -y gnupg \
&& rm -rf /var/lib/apt/lists/*

Check warning on line 31 in applications/wg-easy/container/Containerfile

View workflow job for this annotation

GitHub Actions / build-and-push

Empty continuation lines will become errors in a future release

NoEmptyContinuation: Empty continuation line More info: https://docs.docker.com/go/dockerfile/rule/no-empty-continuation/

# Install helm
RUN curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash \
Expand All @@ -42,6 +41,14 @@
# Install Task
&& sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin \

# Install yq
&& curl -Ls $(curl -s https://api.github.com/repos/mikefarah/yq/releases/latest \
| grep "browser_download_url.*linux_${TARGETARCH}" \
| cut -d : -f 2,3 \
| tr -d \") -o yq \
&& chmod +x yq \
&& mv yq /usr/local/bin/yq \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seeing warnings from GH actions about this line ending in \ without anything coming after it


# Install Helmfile
&& curl -Ls $(curl -s https://api.github.com/repos/helmfile/helmfile/releases/latest \
| grep "browser_download_url.*linux_${TARGETARCH}.tar.gz" \
Expand All @@ -56,7 +63,7 @@
| cut -d : -f 2,3 \
| tr -d \") -o replicated.tar.gz \
&& tar xf replicated.tar.gz replicated && rm replicated.tar.gz \
&& mv replicated /usr/local/bin/replicated

Check warning on line 66 in applications/wg-easy/container/Containerfile

View workflow job for this annotation

GitHub Actions / build-and-push

Empty continuation lines will become errors in a future release

NoEmptyContinuation: Empty continuation line More info: https://docs.docker.com/go/dockerfile/rule/no-empty-continuation/

# Create a non-root user for better security
RUN groupadd -r devuser && useradd -r -g devuser -m -s /bin/bash devuser
Expand Down
4 changes: 1 addition & 3 deletions applications/wg-easy/docs/chart-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ This document explains the modular chart approach used in the WG-Easy Helm chart

## Modular Chart Architecture

![Chart Structure](architecture.png)

The WG-Easy pattern is built around a modular approach to Helm charts, where upstream charts are wrapped in local charts and enhanced with shared templates and customizations.

### Directory Structure
Expand Down Expand Up @@ -94,7 +92,7 @@ releases:
chart: ./cert-manager
createNamespace: true
wait: true

- name: cert-manager-issuers
namespace: cert-manager
chart: ./cert-manager-issuers
Expand Down
4 changes: 1 addition & 3 deletions applications/wg-easy/docs/development-workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ The core philosophy of this workflow is to start simple and add complexity incre
- Build confidence in changes through progressive validation
- Maintain high velocity while ensuring quality

![Workflow Diagram](workflow-diagram.png)

## Prerequisites

Before starting the development workflow, ensure you have the following tools installed:

- **Task:** The task runner used in this project. ([Installation Guide](https://taskfile.dev/installation/))
- **Container runtime tool** Either [Podman](https://podman.io/docs/installation) (default) or [Docker](https://docs.docker.com/get-docker/) for local development
- **Container runtime tool** Either [Podman](https://podman.io/docs/installation) (default) or [Docker](https://docs.docker.com/get-docker/) for local development. Export `CONTAINER_RUNTIME=docker` in your shell if you use docker.

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

Expand Down
1 change: 1 addition & 0 deletions applications/wg-easy/replicated/application.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
apiVersion: kots.io/v1beta1
kind: Application
metadata:
Expand Down