diff --git a/.gitignore b/.gitignore index 7caad1e2..40e7995f 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/applications/wg-easy/README.md b/applications/wg-easy/README.md index b6ef8ddd..d8b92464 100644 --- a/applications/wg-easy/README.md +++ b/applications/wg-easy/README.md @@ -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 diff --git a/applications/wg-easy/Taskfile.yaml b/applications/wg-easy/Taskfile.yaml index d35852a3..adf7f65b 100644 --- a/applications/wg-easy/Taskfile.yaml +++ b/applications/wg-easy/Taskfile.yaml @@ -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"}}' @@ -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) @@ -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') @@ -82,7 +83,6 @@ tasks: - sleep 5 - echo "Tests completed!" - verify-kubeconfig: desc: Verify kubeconfig silent: false @@ -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..." - | @@ -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 @@ -278,8 +278,7 @@ 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 @@ -287,13 +286,15 @@ tasks: 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 @@ -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}}' diff --git a/applications/wg-easy/container/Containerfile b/applications/wg-easy/container/Containerfile index ccde16dc..c628dfbf 100644 --- a/applications/wg-easy/container/Containerfile +++ b/applications/wg-easy/container/Containerfile @@ -17,7 +17,6 @@ RUN apt-get update && apt-get install -y \ curl \ jq \ less \ - yq \ gnupg \ bash-completion \ @@ -42,6 +41,14 @@ RUN curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | b # 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 \ + # Install Helmfile && curl -Ls $(curl -s https://api.github.com/repos/helmfile/helmfile/releases/latest \ | grep "browser_download_url.*linux_${TARGETARCH}.tar.gz" \ diff --git a/applications/wg-easy/docs/chart-structure.md b/applications/wg-easy/docs/chart-structure.md index d4052896..f68aa483 100644 --- a/applications/wg-easy/docs/chart-structure.md +++ b/applications/wg-easy/docs/chart-structure.md @@ -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 @@ -94,7 +92,7 @@ releases: chart: ./cert-manager createNamespace: true wait: true - + - name: cert-manager-issuers namespace: cert-manager chart: ./cert-manager-issuers diff --git a/applications/wg-easy/docs/development-workflow.md b/applications/wg-easy/docs/development-workflow.md index 4a1ca689..3c7e36d9 100644 --- a/applications/wg-easy/docs/development-workflow.md +++ b/applications/wg-easy/docs/development-workflow.md @@ -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. diff --git a/applications/wg-easy/helmfile.yaml b/applications/wg-easy/helmfile.yaml.gotmpl similarity index 100% rename from applications/wg-easy/helmfile.yaml rename to applications/wg-easy/helmfile.yaml.gotmpl diff --git a/applications/wg-easy/replicated/application.yaml b/applications/wg-easy/replicated/application.yaml index 0e2484e4..eab11e5f 100644 --- a/applications/wg-easy/replicated/application.yaml +++ b/applications/wg-easy/replicated/application.yaml @@ -1,3 +1,4 @@ +--- apiVersion: kots.io/v1beta1 kind: Application metadata: