Skip to content

Commit f6ea8bc

Browse files
authored
🤖 feat: add local dev workflow, envtest integration tests, and Kind e2e CI (#8)
## Summary Add complete local cluster development workflow, envtest integration testing, and CI coverage for the `coder-k8s` operator. ## Background The repo had kubebuilder markers in API types and RBAC markers in the controller, but no CRD YAML manifests, no integration tests, no local dev workflow documentation, and no CI envtest or e2e coverage. This PR addresses all of those gaps. ## Implementation ### Phase 1: Manifest generation pipeline - Added `sigs.k8s.io/controller-tools v0.20.0` as a vendored dependency (via `internal/deps/controllergen_tools.go` build-tagged file) - Added `hack/update-manifests.sh` script with fail-fast assertions (mirrors existing `hack/update-codegen.sh` pattern) - Added `make manifests` target - Generated and committed CRD (`config/crd/bases/`), RBAC (`config/rbac/`), and sample CR (`config/samples/`) ### Phase 2: envtest integration tests - Added `internal/controller/suite_test.go` — envtest `TestMain` lifecycle harness with scheme registration and defensive assertions - Added `internal/controller/codercontrolplane_controller_test.go` — 4 integration test cases: - `TestReconcile_NotFound` — reconcile non-existent CR returns nil - `TestReconcile_ExistingResource` — reconcile existing CR returns nil - `TestReconcile_NilClient` — assertion error on nil client - `TestReconcile_NilScheme` — assertion error on nil scheme - Added `make setup-envtest` and `make test-integration` targets - Updated `make test` to automatically set up envtest assets ### Phase 3: CI updates - Updated `test` job to install envtest assets and export `KUBEBUILDER_ASSETS` - Added `e2e-kind` job: creates Kind cluster, builds/loads image, deploys controller with CRDs/RBAC/e2e manifests, applies sample CR, and verifies resource exists - All actions SHA-pinned (matching repo convention) ### Documentation - Expanded `README.md` with: project description, prerequisites, OrbStack quick start, essential commands, testing strategy, and project structure sections ## Risks - **Low**: `setup-envtest@release-0.23` uses a branch ref rather than a pinned commit. This tracks the controller-runtime v0.23.x release branch. Could be pinned to a pseudo-version if strict immutability is desired. - **Low**: The `e2e-kind` job assumes `jq` is present on `ubuntu-latest` (currently true). --- <details> <summary>📋 Implementation Plan</summary> # Implementation Plan: Local cluster development + integration/e2e testing for `coder-k8s` ## Context / Why You want a concrete execution plan an agent can follow to: (1) develop quickly against a local Kubernetes cluster, (2) add reliable integration testing, and (3) add CI coverage in GitHub Actions. The current repository is scaffold-level, so the plan prioritizes a fast inner loop first (OrbStack), then deterministic tests (`envtest`), then a real-cluster smoke test (Kind in CI). This plan explicitly addresses your CRD note: **the API types/markers exist, but generated CRD YAML manifests are not currently present in the repo**. ## Evidence - `api/v1alpha1/codercontrolplane_types.go` contains kubebuilder markers (`+kubebuilder:resource`, `+kubebuilder:subresource:status`) and CRD types. - `hack/update-codegen.sh` only runs `deepcopy-gen`; no CRD/manifest generation. - `Makefile` has `test/build/lint/vuln/codegen` but no `manifests`, `install`, or integration/e2e targets. - `.github/workflows/ci.yaml` runs lint/unit/build checks only; no envtest/Kind job. - `main.go` uses `ctrl.GetConfigOrDie()`, so local out-of-cluster runs depend on kubeconfig context. - `main_test.go` currently contains unit-style checks only. - Repo root currently has no `config/crd` or sample manifests (YAML files are only workflows/tooling YAML plus vendor files). These files are sufficient to design a full implementation path. ## Implementation details ### Planned edit map (ordered) 1. `internal/deps/deps.go` — import block: add blank import for `sigs.k8s.io/controller-tools/cmd/controller-gen` (vendoring anchor). 2. `hack/update-manifests.sh` (new) — script entrypoint + fail-fast assertions + `controller-gen` invocation. 3. `Makefile` — `.PHONY` list + new targets: `manifests`, `setup-envtest`, `test-integration`. 4. `config/crd/bases/*`, `config/rbac/*`, `config/samples/*` (new/generated) — committed generated manifests + sample CR. 5. `README.md` — new “Local development (OrbStack)” and “Testing strategy” sections. 6. `internal/controller/suite_test.go` (new) — `TestMain` envtest lifecycle harness. 7. `internal/controller/codercontrolplane_controller_test.go` (new) — integration tests around `Reconcile` assertions and not-found/exists flows. 8. `.github/workflows/ci.yaml` — `test` job envtest setup; new `e2e-kind` job. 9. `test/e2e/*` or `config/e2e/*` (new) — minimal Kind smoke deployment/test assets. ### Phase 1 — OrbStack-first local development workflow (recommended first) 1. **Add manifest generation pipeline (CRD/RBAC) and commit generated outputs.** - Edit `internal/deps/deps.go` to keep `controller-tools` vendored, then run `go mod tidy && go mod vendor`. - Add `hack/update-manifests.sh` with fail-fast assertions and deterministic output directories. - Add `Makefile` target `manifests` and wire it into local docs/CI checks where appropriate. - Create and commit: - `config/crd/bases/coder.com_codercontrolplanes.yaml` - `config/rbac/role.yaml` (and related generated RBAC if produced) - `config/samples/coder_v1alpha1_codercontrolplane.yaml` ```bash # hack/update-manifests.sh (shape) #!/usr/bin/env bash set -euo pipefail SCRIPT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" [[ -d "${SCRIPT_ROOT}/api/v1alpha1" ]] || { echo "assertion failed: expected API package at ${SCRIPT_ROOT}/api/v1alpha1" >&2 exit 1 } cd "${SCRIPT_ROOT}" GOFLAGS=-mod=vendor go run ./vendor/sigs.k8s.io/controller-tools/cmd/controller-gen \ crd:crdVersions=v1 \ rbac:roleName=manager-role \ paths=./... \ output:crd:artifacts:config=config/crd/bases \ output:rbac:artifacts:config=config/rbac ``` 2. **Add a simple OrbStack local-dev runbook in `README.md`.** - Include exact commands for applying CRDs, running controller, applying sample CR, and checking logs/events. - Keep this as the default dev loop; no Kind required for normal iteration. ```bash make manifests kubectl apply -f config/crd/bases/ GOFLAGS=-mod=vendor go run . kubectl apply -f config/samples/coder_v1alpha1_codercontrolplane.yaml kubectl get codercontrolplanes -A ``` 3. **Acceptance criteria (Phase 1).** - Fresh clone can generate/apply CRDs and create a sample `CoderControlPlane`. - Controller runs locally against OrbStack context without extra cluster tooling. --- ### Phase 2 — Add `envtest` integration tests (highest-value test investment) 1. **Create envtest suite harness for controller package.** - Add `internal/controller/suite_test.go` that starts/stops `envtest.Environment`. - Register `client-go` and `coderv1alpha1` schemes and construct a controller-runtime client. - Keep defensive assertions (nil checks + explicit assertion-failed text) in helpers. ```go // internal/controller/suite_test.go (shape) var ( testEnv *envtest.Environment cfg *rest.Config k8sClient client.Client ) func TestMain(m *testing.M) { testEnv = &envtest.Environment{CRDDirectoryPaths: []string{"../../config/crd/bases"}} var err error cfg, err = testEnv.Start() if err != nil { panic(fmt.Errorf("assertion failed: envtest start: %w", err)) } // build scheme + client code := m.Run() if stopErr := testEnv.Stop(); stopErr != nil { panic(stopErr) } os.Exit(code) } ``` 2. **Add reconciliation integration tests in `internal/controller/codercontrolplane_controller_test.go`.** - Cases to add now: - Reconcile returns nil when CR exists. - Reconcile returns nil on NotFound. - Reconcile returns assertion error when `Client` is nil. - Reconcile returns assertion error when `Scheme` is nil. - Keep tests minimal and deterministic while reconciler is still placeholder logic. 3. **Add explicit Make targets for integration tests + envtest binary setup.** - Add targets like: - `make setup-envtest` - `make test-integration` - Ensure targets fail fast if envtest assets are missing. 4. **Acceptance criteria (Phase 2).** - `make test` (or split unit/integration pair) passes locally with vendoring. - Integration tests run without requiring a running Kubernetes cluster. --- ### Phase 3 — CI updates (GitHub Actions) 1. **Extend existing `test` job in `.github/workflows/ci.yaml` to run envtest-backed tests.** - Install envtest binaries in CI. - Export `KUBEBUILDER_ASSETS`. - Run `go test ./...` with `GOFLAGS=-mod=vendor`. ```yaml - name: Setup envtest assets run: | go run sigs.k8s.io/controller-runtime/tools/setup-envtest@v0.23.1 use 1.35.x --bin-dir ./bin -p path > /tmp/kubebuilder_assets_path echo "KUBEBUILDER_ASSETS=$(cat /tmp/kubebuilder_assets_path)" >> $GITHUB_ENV - name: Run tests env: GOFLAGS: -mod=vendor KUBEBUILDER_ASSETS: ${{ env.KUBEBUILDER_ASSETS }} run: go test ./... -count=1 ``` 2. **Add separate Kind-based smoke e2e job (new job, not replacement).** - Add `e2e-kind` job after `test`. - Use `helm/kind-action` (or equivalent pinned action) to create ephemeral cluster. - Build image, load into Kind, apply CRDs, deploy controller manifest, apply sample CR. - Assert smoke outcome (resource exists; controller pod healthy; no crashloop). ```yaml e2e-kind: runs-on: ubuntu-latest needs: [test] steps: - uses: actions/checkout@... - uses: helm/kind-action@... - run: make manifests - run: kubectl apply -f config/crd/bases/ - run: docker build -f Dockerfile.goreleaser -t coder-k8s:e2e . - run: kind load docker-image coder-k8s:e2e - run: kubectl apply -f config/e2e/ # deployment + RBAC + sample - run: kubectl wait --for=condition=Available deploy/coder-k8s -n coder-system --timeout=120s ``` 3. **Acceptance criteria (Phase 3).** - PR CI covers lint/unit/integration plus a real-cluster smoke job. - Failures clearly indicate whether logic broke (`test`) or cluster packaging/deploy broke (`e2e-kind`). --- ### Phase 4 — Optional DevSpace/Tilt layer (defer unless team asks) 1. **Decision gate:** only implement if multiple developers need standardized hot-reload/dev deployment workflows. 2. If enabled, add `devspace.yaml` (or `Tiltfile`) that wraps the **same** manifests and image build path used in CI. 3. Keep OrbStack path as baseline fallback and document both flows succinctly. <details> <summary>Why deferred</summary> This repo currently has a minimal reconciler and no complex dependent resources yet. Adding DevSpace/Tilt immediately would increase maintenance surface before there is enough deployment complexity to justify it. </details> ## Execution order (for agent handoff) 1. Phase 1 manifests + OrbStack docs. 2. Phase 2 envtest harness/tests. 3. Phase 3 CI envtest + Kind smoke job. 4. Phase 4 optional tooling only if requested. ## Validation checklist the implementing agent must run - `make verify-vendor` - `make manifests` (new target) - `make test` - `make build` - If workflows changed: `go run github.com/rhysd/actionlint/cmd/actionlint@v1.7.10` - Optional local smoke: run controller against OrbStack and apply sample CR. </details> --- _Generated with `mux` • Model: `anthropic:claude-opus-4-6` • Thinking: `xhigh` • Cost: `$0.68`_ <!-- mux-attribution: model=anthropic:claude-opus-4-6 thinking=xhigh costs=0.68 -->
1 parent d7941ba commit f6ea8bc

382 files changed

Lines changed: 68749 additions & 729 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yaml

Lines changed: 72 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,84 @@ jobs:
108108
go mod vendor
109109
git diff --exit-code -- go.mod go.sum vendor/
110110
111+
- name: Setup envtest assets
112+
env:
113+
GOFLAGS: -mod=vendor
114+
run: |
115+
KUBEBUILDER_ASSETS_PATH="$(go run ./vendor/sigs.k8s.io/controller-runtime/tools/setup-envtest use 1.35.x --bin-dir "${{ github.workspace }}/bin/envtest" -p path)"
116+
echo "KUBEBUILDER_ASSETS=${KUBEBUILDER_ASSETS_PATH}" >> "$GITHUB_ENV"
117+
111118
- name: Run tests
112119
env:
113120
GOFLAGS: -mod=vendor
114-
run: go test ./...
121+
KUBEBUILDER_ASSETS: ${{ env.KUBEBUILDER_ASSETS }}
122+
run: go test ./... -count=1
115123

116124
- name: Build
117125
env:
118126
GOFLAGS: -mod=vendor
119127
run: go build ./...
120128

129+
e2e-kind:
130+
name: E2E Smoke (Kind)
131+
needs: [changes, test]
132+
if: needs.changes.outputs.go == 'true'
133+
runs-on: ubuntu-latest
134+
steps:
135+
- name: Checkout
136+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
137+
with:
138+
persist-credentials: false
139+
140+
- name: Setup Go
141+
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
142+
with:
143+
go-version-file: go.mod
144+
cache: true
145+
146+
- name: Create Kind cluster
147+
uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1.12.0
148+
with:
149+
cluster_name: e2e
150+
151+
- name: Build binary
152+
env:
153+
GOFLAGS: -mod=vendor
154+
CGO_ENABLED: "0"
155+
GOOS: linux
156+
GOARCH: amd64
157+
run: go build -o coder-k8s ./
158+
159+
- name: Build and load image
160+
run: |
161+
docker build -f Dockerfile.goreleaser -t ghcr.io/coder/coder-k8s:e2e .
162+
kind load docker-image ghcr.io/coder/coder-k8s:e2e --name e2e
163+
164+
- name: Apply CRDs and RBAC
165+
run: |
166+
kubectl apply -f config/crd/bases/
167+
kubectl apply -f config/rbac/
168+
169+
- name: Deploy controller
170+
run: |
171+
kubectl apply -f config/e2e/namespace.yaml
172+
kubectl apply -f config/e2e/
173+
174+
- name: Wait for controller
175+
run: kubectl wait --for=condition=Available deploy/coder-k8s -n coder-system --timeout=120s
176+
177+
- name: Apply sample CR
178+
run: kubectl apply -f config/samples/coder_v1alpha1_codercontrolplane.yaml
179+
180+
- name: Verify CR exists
181+
run: |
182+
kubectl get codercontrolplanes -A
183+
COUNT=$(kubectl get codercontrolplanes -A -o json | jq '.items | length')
184+
if [ "$COUNT" -lt 1 ]; then
185+
echo "assertion failed: expected at least 1 CoderControlPlane resource" >&2
186+
exit 1
187+
fi
188+
121189
lint-actions:
122190
name: Lint GitHub Actions
123191
needs: changes
@@ -167,15 +235,16 @@ jobs:
167235

168236
publish-main:
169237
name: Publish GHCR :main
170-
needs: [changes, test, lint, lint-actions]
238+
needs: [changes, test, lint, lint-actions, e2e-kind]
171239
if: |
172240
always() &&
173241
github.event_name == 'push' &&
174242
github.ref == 'refs/heads/main' &&
175243
needs.changes.outputs.publish == 'true' &&
176244
(needs.test.result == 'success' || needs.test.result == 'skipped') &&
177245
(needs.lint.result == 'success' || needs.lint.result == 'skipped') &&
178-
(needs.lint-actions.result == 'success' || needs.lint-actions.result == 'skipped')
246+
(needs.lint-actions.result == 'success' || needs.lint-actions.result == 'skipped') &&
247+
(needs.e2e-kind.result == 'success' || needs.e2e-kind.result == 'skipped')
179248
runs-on: ubuntu-latest
180249
permissions:
181250
contents: read

Makefile

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
GOFLAGS ?= -mod=vendor
22
VENDOR_STAMP := vendor/.modules.stamp
33
MODULE_FILES := go.mod $(wildcard go.sum)
4+
ENVTEST_K8S_VERSION ?= 1.35.x
5+
ENVTEST_ASSETS_DIR := $(shell pwd)/bin/envtest
46

5-
.PHONY: vendor test build lint vuln verify-vendor codegen
7+
.PHONY: vendor test test-integration setup-envtest build lint vuln verify-vendor codegen manifests
68

79
$(VENDOR_STAMP): $(MODULE_FILES)
810
go mod tidy
@@ -12,9 +14,17 @@ $(VENDOR_STAMP): $(MODULE_FILES)
1214

1315
vendor: $(VENDOR_STAMP)
1416

15-
test: $(VENDOR_STAMP)
17+
setup-envtest:
18+
GOFLAGS=-mod=vendor go run ./vendor/sigs.k8s.io/controller-runtime/tools/setup-envtest use $(ENVTEST_K8S_VERSION) --bin-dir $(ENVTEST_ASSETS_DIR) -p path > /dev/null
19+
20+
test: $(VENDOR_STAMP) setup-envtest
21+
KUBEBUILDER_ASSETS="$$(GOFLAGS=-mod=vendor go run ./vendor/sigs.k8s.io/controller-runtime/tools/setup-envtest use $(ENVTEST_K8S_VERSION) --bin-dir $(ENVTEST_ASSETS_DIR) -p path)" \
1622
GOFLAGS=$(GOFLAGS) go test ./...
1723

24+
test-integration: $(VENDOR_STAMP) setup-envtest
25+
KUBEBUILDER_ASSETS="$$(GOFLAGS=-mod=vendor go run ./vendor/sigs.k8s.io/controller-runtime/tools/setup-envtest use $(ENVTEST_K8S_VERSION) --bin-dir $(ENVTEST_ASSETS_DIR) -p path)" \
26+
GOFLAGS=$(GOFLAGS) go test ./internal/controller/... -count=1 -v
27+
1828
build: $(VENDOR_STAMP)
1929
GOFLAGS=$(GOFLAGS) go build ./...
2030

@@ -32,5 +42,8 @@ verify-vendor:
3242
go mod vendor
3343
git diff --exit-code -- go.mod go.sum vendor/
3444

45+
manifests: $(VENDOR_STAMP)
46+
bash ./hack/update-manifests.sh
47+
3548
codegen: $(VENDOR_STAMP)
3649
bash ./hack/update-codegen.sh

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,57 @@
11
# coder-k8s
2+
3+
## Project description
4+
5+
`coder-k8s` is a Go-based Kubernetes operator for managing `CoderControlPlane` resources (`coder.com/v1alpha1`). It is built with `sigs.k8s.io/controller-runtime`.
6+
7+
## Prerequisites
8+
9+
- Go 1.25+ (`go.mod` currently declares Go 1.25.7)
10+
- A Kubernetes cluster (OrbStack is recommended for local development; any cluster works)
11+
- `kubectl` configured to point at your cluster context
12+
13+
## Quick start / Local development (OrbStack)
14+
15+
```bash
16+
# Generate CRD and RBAC manifests
17+
make manifests
18+
19+
# Apply CRDs to your cluster
20+
kubectl apply -f config/crd/bases/
21+
22+
# Run the controller locally (uses your kubeconfig context)
23+
GOFLAGS=-mod=vendor go run .
24+
25+
# In another terminal: apply the sample CR
26+
kubectl apply -f config/samples/coder_v1alpha1_codercontrolplane.yaml
27+
28+
# Verify
29+
kubectl get codercontrolplanes -A
30+
```
31+
32+
## Essential commands
33+
34+
| Command | Description |
35+
| --- | --- |
36+
| `make build` | Build the project |
37+
| `make test` | Run tests |
38+
| `make manifests` | Generate CRD/RBAC manifests |
39+
| `make codegen` | Run deepcopy code generation |
40+
| `make verify-vendor` | Verify vendor consistency |
41+
| `make lint` | Run linter (requires `golangci-lint`) |
42+
| `make vuln` | Run vulnerability check (requires `govulncheck`) |
43+
44+
## Testing strategy
45+
46+
- **Unit tests**: `make test` runs all tests, including unit tests in `main_test.go`.
47+
- **Integration tests**: Use `envtest` to exercise reconciliation against a lightweight API server (no real cluster needed). Run them via `make test` (included in the full suite) or `make test-integration` (focused on controller tests only).
48+
- **E2E smoke tests**: Recommended CI smoke coverage uses a Kind-based flow that deploys the controller image and verifies pod health.
49+
50+
## Project structure
51+
52+
- `api/v1alpha1/` — CRD types and generated deepcopy code
53+
- `internal/controller/` — Reconciliation logic
54+
- `config/crd/bases/` — Generated CRD manifests
55+
- `config/rbac/` — Generated RBAC manifests
56+
- `config/samples/` — Sample custom resources
57+
- `hack/` — Code generation and maintenance scripts
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
apiVersion: apiextensions.k8s.io/v1
3+
kind: CustomResourceDefinition
4+
metadata:
5+
annotations:
6+
controller-gen.kubebuilder.io/version: v0.20.0
7+
name: codercontrolplanes.coder.com
8+
spec:
9+
group: coder.com
10+
names:
11+
kind: CoderControlPlane
12+
listKind: CoderControlPlaneList
13+
plural: codercontrolplanes
14+
singular: codercontrolplane
15+
scope: Namespaced
16+
versions:
17+
- name: v1alpha1
18+
schema:
19+
openAPIV3Schema:
20+
description: CoderControlPlane is the schema for Coder control plane resources.
21+
properties:
22+
apiVersion:
23+
description: |-
24+
APIVersion defines the versioned schema of this representation of an object.
25+
Servers should convert recognized schemas to the latest internal value, and
26+
may reject unrecognized values.
27+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
28+
type: string
29+
kind:
30+
description: |-
31+
Kind is a string value representing the REST resource this object represents.
32+
Servers may infer this from the endpoint the client submits requests to.
33+
Cannot be updated.
34+
In CamelCase.
35+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
36+
type: string
37+
metadata:
38+
type: object
39+
spec:
40+
description: CoderControlPlaneSpec defines the desired state of a CoderControlPlane.
41+
properties:
42+
image:
43+
description: Image is the placeholder container image for the control
44+
plane deployment.
45+
type: string
46+
type: object
47+
status:
48+
description: CoderControlPlaneStatus defines the observed state of a CoderControlPlane.
49+
properties:
50+
phase:
51+
description: Phase is a placeholder status field for future reconciliation
52+
stages.
53+
type: string
54+
type: object
55+
type: object
56+
served: true
57+
storage: true
58+
subresources:
59+
status: {}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRoleBinding
3+
metadata:
4+
name: coder-k8s
5+
roleRef:
6+
apiGroup: rbac.authorization.k8s.io
7+
kind: ClusterRole
8+
name: manager-role
9+
subjects:
10+
- kind: ServiceAccount
11+
name: coder-k8s
12+
namespace: coder-system

config/e2e/deployment.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: coder-k8s
5+
namespace: coder-system
6+
labels:
7+
app: coder-k8s
8+
spec:
9+
replicas: 1
10+
selector:
11+
matchLabels:
12+
app: coder-k8s
13+
template:
14+
metadata:
15+
labels:
16+
app: coder-k8s
17+
spec:
18+
serviceAccountName: coder-k8s
19+
containers:
20+
- name: manager
21+
image: ghcr.io/coder/coder-k8s:e2e
22+
imagePullPolicy: Never
23+
ports:
24+
- containerPort: 8081
25+
name: health
26+
livenessProbe:
27+
httpGet:
28+
path: /healthz
29+
port: health
30+
initialDelaySeconds: 5
31+
periodSeconds: 10
32+
readinessProbe:
33+
httpGet:
34+
path: /readyz
35+
port: health
36+
initialDelaySeconds: 5
37+
periodSeconds: 10

config/e2e/namespace.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: coder-system

config/e2e/serviceaccount.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: v1
2+
kind: ServiceAccount
3+
metadata:
4+
name: coder-k8s
5+
namespace: coder-system

config/rbac/role.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: ClusterRole
4+
metadata:
5+
name: manager-role
6+
rules:
7+
- apiGroups:
8+
- coder.com
9+
resources:
10+
- codercontrolplanes
11+
verbs:
12+
- create
13+
- delete
14+
- get
15+
- list
16+
- patch
17+
- update
18+
- watch
19+
- apiGroups:
20+
- coder.com
21+
resources:
22+
- codercontrolplanes/finalizers
23+
verbs:
24+
- update
25+
- apiGroups:
26+
- coder.com
27+
resources:
28+
- codercontrolplanes/status
29+
verbs:
30+
- get
31+
- patch
32+
- update
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: coder.com/v1alpha1
2+
kind: CoderControlPlane
3+
metadata:
4+
name: codercontrolplane-sample
5+
namespace: default
6+
spec:
7+
image: "ghcr.io/coder/coder-k8s:main"

0 commit comments

Comments
 (0)