Skip to content

Commit 2af739d

Browse files
Initial KeeperCluster implementation
0 parents  commit 2af739d

File tree

79 files changed

+7377
-0
lines changed

Some content is hidden

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

79 files changed

+7377
-0
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
2+
# Ignore build and test binaries.
3+
bin/

.github/workflows/ci.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Go CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build_and_test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Go
17+
uses: actions/setup-go@v5
18+
with:
19+
go-version: '1.24'
20+
21+
- name: Go Tidy
22+
run: go mod tidy && git diff --exit-code
23+
24+
- name: Go Mod
25+
run: go mod download
26+
27+
- name: Go Mod Verify
28+
run: go mod verify
29+
30+
- name: Check controller-gen generated
31+
run: make generate && git diff --exit-code
32+
33+
- name: Check manifests generated
34+
run: make manifests && git diff --exit-code
35+
36+
- name: Lint with golangci-lint
37+
uses: golangci/golangci-lint-action@v7
38+
with:
39+
version: v2.1
40+
41+
- name: Build
42+
run: go build -v cmd/main.go
43+
44+
- name: Run tests
45+
run: |
46+
go list ./... | grep -v /e2e
47+
make test-ci

.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Binaries for programs and plugins
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
7+
bin/*
8+
Dockerfile.cross
9+
10+
# Test binary, built with `go test -c`
11+
*.test
12+
13+
# Output of the go coverage tool, specifically when used with LiteIDE
14+
*.out
15+
16+
# Go workspace file
17+
go.work
18+
19+
# Kubernetes Generated files - skip generated files, except for vendored files
20+
!vendor/**/zz_generated.*
21+
22+
# editor and IDE paraphernalia
23+
.idea
24+
.vscode
25+
*.swp
26+
*.swo
27+
*~

.golangci.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
version: "2"
2+
run:
3+
allow-parallel-runners: true
4+
linters:
5+
default: none
6+
enable:
7+
- dupl
8+
- errcheck
9+
- ginkgolinter
10+
- goconst
11+
- gocyclo
12+
- govet
13+
- ineffassign
14+
- lll
15+
- misspell
16+
- nakedret
17+
- prealloc
18+
- revive
19+
- staticcheck
20+
- unconvert
21+
- unparam
22+
- unused
23+
- funcorder
24+
- asciicheck
25+
- bidichk
26+
- contextcheck
27+
- copyloopvar
28+
- godot
29+
- gosec
30+
settings:
31+
revive:
32+
rules:
33+
- name: comment-spacings
34+
gosec:
35+
excludes:
36+
- G204
37+
exclusions:
38+
generated: lax
39+
rules:
40+
- linters:
41+
- lll
42+
path: api/*
43+
- linters:
44+
- dupl
45+
- lll
46+
path: internal/*
47+
paths:
48+
- third_party$
49+
- builtin$
50+
- examples$
51+
formatters:
52+
enable:
53+
- gofmt
54+
- goimports
55+
settings:
56+
goimports:
57+
# Put imports beginning with prefix after 3rd-party packages.
58+
local-prefixes:
59+
- clickhouse.com/
60+
exclusions:
61+
generated: lax
62+
paths:
63+
- third_party$
64+
- builtin$
65+
- examples$

Dockerfile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Build the manager binary
2+
FROM golang:1.24.2 AS builder
3+
ARG TARGETOS
4+
ARG TARGETARCH
5+
6+
WORKDIR /workspace
7+
# Copy the Go Modules manifests
8+
COPY go.mod go.mod
9+
COPY go.sum go.sum
10+
# cache deps before building and copying source so that we don't need to re-download as much
11+
# and so that source changes don't invalidate our downloaded layer
12+
RUN go mod download
13+
14+
# Copy the go source
15+
COPY cmd/main.go cmd/main.go
16+
COPY api/ api/
17+
COPY internal/ internal/
18+
19+
# Build
20+
# the GOARCH has not a default value to allow the binary be built according to the host where the command
21+
# was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO
22+
# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore,
23+
# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform.
24+
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager cmd/main.go
25+
26+
# Use distroless as minimal base image to package the manager binary
27+
# Refer to https://github.com/GoogleContainerTools/distroless for more details
28+
FROM gcr.io/distroless/static:nonroot
29+
WORKDIR /
30+
COPY --from=builder /workspace/manager .
31+
USER 65532:65532
32+
33+
ENTRYPOINT ["/manager"]

0 commit comments

Comments
 (0)