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
4 changes: 3 additions & 1 deletion .github/workflows/weft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,9 @@ jobs:
run: |
set -euo pipefail
version='${{ steps.version.outputs.value }}'
sed -i "s|^ digest: .*| digest: \"${DIGEST}\"|" charts/weft/values.yaml
# In a file rather than values.yaml, so helm upgrade --reuse-values
# cannot carry a previous release's digest over this one.
printf '%s' "${DIGEST}" > charts/weft/files/image-digest
helm package charts/weft --destination dist \
--version "$version" --app-version "$version"
helm push dist/weft-*.tgz "oci://${CHARTS}" 2>&1 | tee push.log
Expand Down
8 changes: 8 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# CLAUDE.md

## Attribution

Do not add AI attribution anywhere in this repository: no `Co-Authored-By`
trailers naming an AI, no "Generated with" lines in commit messages, pull
request descriptions, issues, code comments or documentation. Commits and pull
requests are written as the author's own.
26 changes: 21 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ to make.
The chart and the image always carry the same version. `Chart.yaml` holds a
placeholder that is replaced at package time, and the chart's `appVersion` is
what selects the image tag, so a packaged chart points at the image the same run
pushed. Releases additionally pin `image.digest`, so an installed release cannot
drift under a moved tag.
pushed. Every published chart additionally pins the image by digest, written to
`charts/weft/files/image-digest` rather than `values.yaml` so that
`helm upgrade --reuse-values` cannot carry an old digest forward, and an
installed release cannot drift under a moved tag.

`latest` follows real releases only. A prerelease carries a label and never
moves it.
Expand Down Expand Up @@ -151,9 +153,23 @@ one of those looks arbitrary, read the comment before changing it:
make generate
```

This regenerates the deepcopy functions, the CRD and the controller ClusterRole,
and copies the CRD into the chart. CI fails if the result differs from what is
committed, so run it before pushing.
This regenerates the deepcopy functions, the CRDs and the controller
ClusterRole, and copies the CRDs into the chart. CI fails if the result differs
from what is committed, so run it before pushing.

## Two API groups

Weft serves `weft.alethic.solutions/v1` and, for installations that predate it,
`weft.run/v1alpha1`. The canonical types live in `api/v1`; `api/v1alpha1`
embeds v1's spec and status, so the schemas cannot drift, and a test asserts
that the generated CRDs agree. The controller reconciles everything as v1,
with one reconciler per group (`internal/controller/served.go`).

Every key a Weave writes into a cluster comes from `internal/naming`, per
group. The `weft.run` identifiers are frozen, and `TestLegacyIdentifiersAreFrozen`
fails if one changes: they are on objects in clusters that predate v1, and
changing one strands those objects. [docs/migrating.md](docs/migrating.md)
describes the handover from one group to the other from the user's side.

## The parts that are not negotiable

Expand Down
15 changes: 8 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ IMG ?= ghcr.io/alethic/weft:latest
# GitVersion owns the version. It is derived from the branch and the history,
# so nothing is tagged by hand and a build knows what it is without being told.
# git describe is the fallback for a checkout without the tool installed.
VERSION ?= $(shell dotnet-gitversion -showvariable SemVer 2>/dev/null | tr -d '' || true)
VERSION ?= $(shell dotnet-gitversion -showvariable SemVer 2>/dev/null | tr -d '\r' || true)
ifeq ($(strip $(VERSION)),)
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
endif
Expand All @@ -17,7 +17,7 @@ CONTROLLER_GEN ?= go tool controller-gen
SETUP_ENVTEST ?= go tool setup-envtest
# Pinned so a local run and CI disagree about nothing. Bumping it here is the
# only place it changes.
GOLANGCI_LINT_VERSION ?= v2.13.2
GOLANGCI_LINT_VERSION ?= v2.15.0
GOLANGCI_LINT ?= $(shell command -v golangci-lint 2>/dev/null || echo $(shell go env GOPATH)/bin/golangci-lint)
ENVTEST_K8S_VERSION ?= 1.34.x
ENVTEST_DIR := $(CURDIR)/bin/envtest
Expand All @@ -27,12 +27,13 @@ all: generate fmt vet lint test build

.PHONY: generate
generate: ## Regenerate deepcopy, the CRD and the controller ClusterRole.
$(CONTROLLER_GEN) object paths=./api/v1alpha1/...
$(CONTROLLER_GEN) crd paths=./api/v1alpha1/... output:crd:artifacts:config=config/crd
$(CONTROLLER_GEN) object paths=./api/v1/... paths=./api/v1alpha1/...
$(CONTROLLER_GEN) crd paths=./api/v1/... paths=./api/v1alpha1/... output:crd:artifacts:config=config/crd
$(CONTROLLER_GEN) rbac:roleName=weft-controller paths=./internal/controller/... output:rbac:artifacts:config=config/rbac
# The chart ships the generated CRD verbatim so the two cannot drift.
# The chart ships the generated CRDs verbatim so the two cannot drift.
# TestChartCRDMatchesGenerated fails if this copy is skipped.
cp config/crd/weft.run_weaves.yaml $(CHART)/files/weaves-crd.yaml
mkdir -p $(CHART)/files/crds
cp config/crd/*.yaml $(CHART)/files/crds/

.PHONY: fmt
fmt:
Expand Down Expand Up @@ -77,7 +78,7 @@ lint-chart: ## Lint and render the chart.

.PHONY: install
install: ## Install just the CRD.
kubectl apply -f config/crd/weft.run_weaves.yaml
kubectl apply -f config/crd/

.PHONY: deploy
deploy: ## Install the controller with Helm.
Expand Down
Loading
Loading