Skip to content

apply.sh: kubeconfig merge + auto-apply mode; simplify README #37

@rowan-stein

Description

@rowan-stein

User request

  • Add kubeconfig update to apply.sh using kubectl config view --merge --flatten; ask before updating in interactive mode.
  • Add auto-apply mode to apply.sh: do not ask for domain/port; run Terraform with auto-apply flag(s); kubeconfig should be updated automatically.
  • Rewrite root README.md: remove current content; keep only 3 sections:
    • Requirements: terraform, kubectl (optional)
    • Setup: Fast (chmod + run apply.sh), Manual (terraform init + terraform apply for each stack + kubeconfig update)
    • Usage: list exposed services with prebuilt links for default domain+port

Specification

apply.sh

  1. Kubeconfig merge (post-apply)
  • After all stacks apply successfully, optionally merge the generated kubeconfig at:
$(pwd)/stacks/k8s/.kube/agyn-local-kubeconfig.yaml

into:

$HOME/.kube/config

using:

KUBECONFIG="$KUBECONFIG:$HOME/.kube/config:$(pwd)/stacks/k8s/.kube/agyn-local-kubeconfig.yaml" \
  kubectl config view --merge --flatten
  • Interactive mode (no auto-apply flag): prompt before modifying ~/.kube/config:
    • Merge k3d kubeconfig into ~/.kube/config? [Y/n]: (default Yes)
  • Auto-apply mode: update kubeconfig automatically (no prompt).
  • Implement the merge safely (don’t redirect output directly into an input file). Use a temp file + atomic mv (e.g. mktemp in ~/.kube/) or equivalent safe buffering.
  • If kubectl is missing or the generated kubeconfig file is missing, print a warning and skip (non-fatal).
  1. Auto-apply mode behavior
  • Add/ensure a CLI flag (existing -y is OK) that:
    • runs Terraform with -input=false -auto-approve
    • does not prompt for domain/port
    • uses defaults when DOMAIN / PORT are unset
    • updates kubeconfig automatically (see above)
  1. Domain/port resolution
  • In interactive mode: if DOMAIN/PORT env vars are unset, prompt with defaults (existing behavior).
  • In auto-apply mode: if DOMAIN/PORT env vars are unset, use defaults without prompting.

README.md (rewrite)

Replace the entire file with exactly 3 top-level sections:

  1. Requirements
  • List only:
    • terraform
    • kubectl (optional; only needed for kubeconfig merge / interacting with cluster)
  1. Setup
  • Fast: chmod +x apply.sh then run ./apply.sh (mention -y for auto-apply mode).
  • Manual: show terraform init + terraform apply for each stack in order (stacks/k8s, stacks/system, stacks/routing, stacks/platform) + kubeconfig update step.
  1. Usage
  • List exposed services with prebuilt links for the defaults:
    • domain: agyn.dev
    • port: 2496
  • Services to include (as defined by routing manifests):
    • Platform UI: https://agyn.dev:2496/
    • Platform API: https://agyn.dev:2496/api
    • Argo CD: https://argocd.agyn.dev:2496/
    • LiteLLM: https://litellm.agyn.dev:2496/
    • Vault: https://vault.agyn.dev:2496/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions