Skip to content

Commit b4f75c4

Browse files
committed
🤖 fix: remove aggregation CRD generation and guard demo conflicts
Stop generating aggregation.coder.com CRDs into config/crd/bases and delete previously generated aggregation CRD manifests. This makes `kubectl apply -f config/crd/bases/` safe for demo workflows while keeping docs approachable. Also add a fail-fast guard in hack/kind-dev.sh that detects stale APIService+aggregation-CRD conflicts and prints the exact cleanup command. --- _Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$0.00`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=0.00 -->
1 parent 450fb4e commit b4f75c4

5 files changed

Lines changed: 56 additions & 183 deletions

File tree

‎config/crd/bases/aggregation.coder.com_codertemplates.yaml‎

Lines changed: 0 additions & 90 deletions
This file was deleted.

‎config/crd/bases/aggregation.coder.com_coderworkspaces.yaml‎

Lines changed: 0 additions & 92 deletions
This file was deleted.

‎docs/how-to/troubleshooting.md‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,30 @@ kubectl apply -f config/crd/bases/
4040
kubectl get clusterrolebinding coder-k8s-controller
4141
```
4242

43+
## Aggregated `codertemplates` / `coderworkspaces` reads are empty or inconsistent
44+
45+
If `kubectl get codertemplates.aggregation.coder.com` or `kubectl get coderworkspaces.aggregation.coder.com` returns empty data unexpectedly, check for CRD/APIService conflicts.
46+
47+
When both of these exist at once:
48+
49+
- `APIService` `v1alpha1.aggregation.coder.com`
50+
- CRDs `codertemplates.aggregation.coder.com` and/or `coderworkspaces.aggregation.coder.com`
51+
52+
Kubernetes may not route reads the way you expect for demos.
53+
54+
```bash
55+
kubectl get apiservice v1alpha1.aggregation.coder.com
56+
kubectl get crd codertemplates.aggregation.coder.com coderworkspaces.aggregation.coder.com
57+
```
58+
59+
For APIService-based demos, remove the conflicting aggregation CRDs:
60+
61+
```bash
62+
kubectl delete crd codertemplates.aggregation.coder.com coderworkspaces.aggregation.coder.com
63+
kubectl apply -f deploy/apiserver-apiservice.yaml
64+
kubectl wait --for=condition=Available apiservice/v1alpha1.aggregation.coder.com --timeout=120s
65+
```
66+
4367
## Aggregated APIService shows `False` / `Unavailable`
4468

4569
- Ensure the deployment and service exist:

‎hack/kind-dev.sh‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,29 @@ ensure_cluster_node_image_matches() {
7676
exit 1
7777
}
7878

79+
assert_no_aggregation_resource_conflict() {
80+
local has_apiservice="false"
81+
local has_template_crd="false"
82+
local has_workspace_crd="false"
83+
84+
if kubectl_ctx get apiservice v1alpha1.aggregation.coder.com >/dev/null 2>&1; then
85+
has_apiservice="true"
86+
fi
87+
if kubectl_ctx get crd codertemplates.aggregation.coder.com >/dev/null 2>&1; then
88+
has_template_crd="true"
89+
fi
90+
if kubectl_ctx get crd coderworkspaces.aggregation.coder.com >/dev/null 2>&1; then
91+
has_workspace_crd="true"
92+
fi
93+
94+
if [[ "${has_apiservice}" == "true" && ( "${has_template_crd}" == "true" || "${has_workspace_crd}" == "true" ) ]]; then
95+
echo "assertion failed: detected aggregation API conflict in ${KUBE_CONTEXT}: APIService v1alpha1.aggregation.coder.com and aggregation.coder.com CRDs are both installed." >&2
96+
echo "Delete conflicting CRDs before aggregated API demos:" >&2
97+
echo " kubectl --context ${KUBE_CONTEXT} delete crd codertemplates.aggregation.coder.com coderworkspaces.aggregation.coder.com" >&2
98+
exit 1
99+
fi
100+
}
101+
79102
build_binary() {
80103
local resolved_goarch="${GOARCH}"
81104
if [[ -z "${resolved_goarch}" ]]; then
@@ -115,8 +138,10 @@ cmd_up() {
115138
kubectl config use-context "${KUBE_CONTEXT}" >/dev/null
116139

117140
kubectl_ctx wait --for=condition=Ready node --all --timeout="${NODE_READY_TIMEOUT}"
141+
assert_no_aggregation_resource_conflict
118142

119143
kubectl_ctx apply -f config/e2e/namespace.yaml
144+
# config/crd/bases intentionally contains only operator-owned coder.com CRDs.
120145
kubectl_ctx apply -f config/crd/bases/
121146
kubectl_ctx apply -f config/rbac/
122147

‎hack/update-manifests.sh‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,15 @@ if [[ ! -d "${SCRIPT_ROOT}/internal/controller" ]]; then
1414
fi
1515

1616
cd "${SCRIPT_ROOT}"
17+
18+
# Generate CRDs for operator-owned coder.com APIs only.
1719
GOFLAGS=-mod=vendor go run ./vendor/sigs.k8s.io/controller-tools/cmd/controller-gen \
1820
crd:crdVersions=v1 \
21+
paths=./api/v1alpha1 \
22+
output:crd:artifacts:config=config/crd/bases
23+
24+
# Generate RBAC across the repo.
25+
GOFLAGS=-mod=vendor go run ./vendor/sigs.k8s.io/controller-tools/cmd/controller-gen \
1926
rbac:roleName=manager-role \
2027
paths=./... \
21-
output:crd:artifacts:config=config/crd/bases \
2228
output:rbac:artifacts:config=config/rbac

0 commit comments

Comments
 (0)