Skip to content

Commit 3574aac

Browse files
authored
Bootstrap coder-k8s repository scaffolding (#1)
Add initial Go module/app, vendoring workflow, Nix dev shell, Goreleaser config, GitHub Actions CI/release workflows, and vendored Kubernetes bootstrap dependencies.\n\n---\n_Generated with [`mux`](https://github.com/coder/mux) • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh`_
1 parent f29c44e commit 3574aac

3,726 files changed

Lines changed: 1307244 additions & 0 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.

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake

.github/workflows/ci.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Go
17+
uses: actions/setup-go@v5
18+
with:
19+
go-version-file: go.mod
20+
cache: true
21+
22+
- name: Verify vendor is up to date
23+
run: |
24+
go mod tidy
25+
go mod vendor
26+
git diff --exit-code -- go.mod go.sum vendor/
27+
28+
- name: Run tests
29+
env:
30+
GOFLAGS: -mod=vendor
31+
run: go test ./...
32+
33+
- name: Build
34+
env:
35+
GOFLAGS: -mod=vendor
36+
run: go build ./...

.github/workflows/release.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
permissions:
8+
contents: write
9+
packages: write
10+
11+
jobs:
12+
goreleaser:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Setup Go
21+
uses: actions/setup-go@v5
22+
with:
23+
go-version-file: go.mod
24+
cache: true
25+
26+
- name: Set up Docker Buildx
27+
uses: docker/setup-buildx-action@v3
28+
29+
- name: Log in to GitHub Container Registry
30+
uses: docker/login-action@v3
31+
with:
32+
registry: ghcr.io
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Run GoReleaser
37+
uses: goreleaser/goreleaser-action@v6
38+
with:
39+
distribution: goreleaser
40+
version: latest
41+
args: release --clean
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Go
2+
/bin/
3+
*.test
4+
*.out
5+
6+
# Nix / direnv
7+
.direnv/
8+
9+
# IDE
10+
.vscode/
11+
.idea/

.goreleaser.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
project_name: coder-k8s
2+
3+
before:
4+
hooks:
5+
- go mod tidy
6+
- go mod vendor
7+
8+
builds:
9+
- id: coder-k8s
10+
main: ./
11+
binary: coder-k8s
12+
env:
13+
- CGO_ENABLED=0
14+
goos:
15+
- linux
16+
goarch:
17+
- amd64
18+
- arm64
19+
20+
archives:
21+
- id: default
22+
format: tar.gz
23+
files:
24+
- none*
25+
26+
dockers:
27+
- id: coder-k8s-image
28+
image_templates:
29+
- "ghcr.io/coder/coder-k8s:{{ .Version }}"
30+
- "ghcr.io/coder/coder-k8s:latest"
31+
dockerfile: Dockerfile.goreleaser
32+
use: buildx
33+
build_flag_templates:
34+
- "--pull"
35+
- "--platform=linux/amd64"
36+
37+
changelog:
38+
use: github

Dockerfile.goreleaser

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM gcr.io/distroless/static:nonroot
2+
3+
ENTRYPOINT ["/coder-k8s"]
4+
COPY coder-k8s /coder-k8s
5+
USER nonroot:nonroot

Makefile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
GOFLAGS ?= -mod=vendor
2+
VENDOR_STAMP := vendor/.modules.stamp
3+
MODULE_FILES := go.mod $(wildcard go.sum)
4+
5+
.PHONY: vendor test build verify-vendor codegen
6+
7+
$(VENDOR_STAMP): $(MODULE_FILES)
8+
go mod tidy
9+
go mod vendor
10+
@mkdir -p $(dir $@)
11+
@touch $@
12+
13+
vendor: $(VENDOR_STAMP)
14+
15+
test: $(VENDOR_STAMP)
16+
GOFLAGS=$(GOFLAGS) go test ./...
17+
18+
build: $(VENDOR_STAMP)
19+
GOFLAGS=$(GOFLAGS) go build ./...
20+
21+
verify-vendor:
22+
go mod tidy
23+
go mod vendor
24+
git diff --exit-code -- go.mod go.sum vendor/
25+
26+
codegen: $(VENDOR_STAMP)
27+
@echo "Run k8s.io/code-generator scripts from ./vendor once API packages exist"

flake.nix

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
description = "coder-k8s development environment";
3+
4+
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
5+
6+
outputs = { self, nixpkgs }:
7+
let
8+
supportedSystems = [
9+
"x86_64-linux"
10+
"aarch64-linux"
11+
"x86_64-darwin"
12+
"aarch64-darwin"
13+
];
14+
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
15+
in {
16+
devShells = forAllSystems (system:
17+
let
18+
pkgs = import nixpkgs { inherit system; };
19+
in {
20+
default = pkgs.mkShell {
21+
packages = with pkgs; [
22+
go
23+
gnumake
24+
git
25+
goreleaser
26+
];
27+
};
28+
}
29+
);
30+
};
31+
}

go.mod

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
module github.com/coder/coder-k8s
2+
3+
go 1.25.6
4+
5+
require (
6+
k8s.io/apimachinery v0.35.0
7+
k8s.io/client-go v0.35.0
8+
k8s.io/code-generator v0.35.0
9+
sigs.k8s.io/controller-runtime v0.23.1
10+
)
11+
12+
require (
13+
github.com/davecgh/go-spew v1.1.1 // indirect
14+
github.com/emicklei/go-restful/v3 v3.12.2 // indirect
15+
github.com/evanphx/json-patch/v5 v5.9.11 // indirect
16+
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
17+
github.com/go-logr/logr v1.4.3 // indirect
18+
github.com/go-openapi/jsonpointer v0.21.0 // indirect
19+
github.com/go-openapi/jsonreference v0.20.2 // indirect
20+
github.com/go-openapi/swag v0.23.0 // indirect
21+
github.com/google/gnostic-models v0.7.0 // indirect
22+
github.com/google/uuid v1.6.0 // indirect
23+
github.com/josharian/intern v1.0.0 // indirect
24+
github.com/json-iterator/go v1.1.12 // indirect
25+
github.com/mailru/easyjson v0.7.7 // indirect
26+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
27+
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
28+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
29+
github.com/spf13/pflag v1.0.9 // indirect
30+
github.com/x448/float16 v0.8.4 // indirect
31+
go.yaml.in/yaml/v2 v2.4.3 // indirect
32+
go.yaml.in/yaml/v3 v3.0.4 // indirect
33+
golang.org/x/mod v0.29.0 // indirect
34+
golang.org/x/net v0.47.0 // indirect
35+
golang.org/x/oauth2 v0.30.0 // indirect
36+
golang.org/x/sync v0.18.0 // indirect
37+
golang.org/x/sys v0.38.0 // indirect
38+
golang.org/x/term v0.37.0 // indirect
39+
golang.org/x/text v0.31.0 // indirect
40+
golang.org/x/time v0.9.0 // indirect
41+
golang.org/x/tools v0.38.0 // indirect
42+
google.golang.org/protobuf v1.36.8 // indirect
43+
gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect
44+
gopkg.in/inf.v0 v0.9.1 // indirect
45+
gopkg.in/yaml.v3 v3.0.1 // indirect
46+
k8s.io/api v0.35.0 // indirect
47+
k8s.io/gengo/v2 v2.0.0-20250922181213-ec3ebc5fd46b // indirect
48+
k8s.io/klog/v2 v2.130.1 // indirect
49+
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 // indirect
50+
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 // indirect
51+
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
52+
sigs.k8s.io/randfill v1.0.0 // indirect
53+
sigs.k8s.io/structured-merge-diff/v6 v6.3.2-0.20260122202528-d9cc6641c482 // indirect
54+
sigs.k8s.io/yaml v1.6.0 // indirect
55+
)

0 commit comments

Comments
 (0)