Skip to content
Open
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: 2 additions & 2 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Go 1.24
- name: Setup Go 1.25
uses: actions/setup-go@v5
with:
go-version: '1.24.5'
go-version: '1.25.3'

- uses: azure/setup-kubectl@v4
- uses: azure/setup-helm@v4.2.0
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
with:
fetch-depth: 0

- name: Setup Go 1.24
- name: Setup Go 1.25
uses: actions/setup-go@v5
with:
go-version: '1.24.5'
go-version: '1.25.3'

- name: Cache Go modules
uses: actions/cache@v4
Expand All @@ -45,16 +45,20 @@ jobs:
GOOS: linux
GOARCH: amd64
CGO_ENABLED: 0
GOEXPERIMENT: synctest

- name: Build Go binary arm64
run: go build -ldflags "-s -w -X main.GitCommit=$GITHUB_SHA -X main.GitRef=$GITHUB_REF -X main.Version=${RELEASE_TAG:-$VERSION_TAG}" -o bin/castai-cluster-controller-arm64 .
env:
GOOS: linux
GOARCH: arm64
CGO_ENABLED: 0
GOEXPERIMENT: synctest

- name: Test
run: go test -short -race -timeout 15m ./...
env:
GOEXPERIMENT: synctest

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
with:
fetch-depth: 0

- name: Setup Go 1.24
- name: Setup Go 1.25
uses: actions/setup-go@v5
with:
go-version: '1.24.5'
go-version: '1.25.3'

- name: Cache Go modules
uses: actions/cache@v4
Expand All @@ -43,16 +43,20 @@ jobs:
GOOS: linux
GOARCH: amd64
CGO_ENABLED: 0
GOEXPERIMENT: synctest

- name: Build Go binary arm64
run: go build -ldflags "-s -w -X main.GitCommit=$GITHUB_SHA -X main.GitRef=$GITHUB_REF -X main.Version=${VERSION_TAG}" -o bin/castai-cluster-controller-arm64 .
env:
GOOS: linux
GOARCH: arm64
CGO_ENABLED: 0
GOEXPERIMENT: synctest

- name: Test
run: go test -short -race -timeout 15m ./...
env:
GOEXPERIMENT: synctest

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ $(GOLANGCI_LINT):

## build: Build the binary for the specified architecture and create a Docker image. Usually this means ARCH=amd64 should be set if running on an ARM machine. Use `go build .` for simple local build.
build:
CGO_ENABLED=0 GOOS=linux GOARCH=$(ARCH) go build -ldflags "-s -w" -o bin/castai-cluster-controller-$(ARCH) .
CGO_ENABLED=0 GOOS=linux GOARCH=$(ARCH) GOEXPERIMENT=synctest go build -ldflags "-s -w" -o bin/castai-cluster-controller-$(ARCH) .
docker build --platform=linux/$(ARCH) --build-arg TARGETARCH=$(ARCH) -t $(DOCKER_REPOSITORY):$(VERSION) .

push:
Expand All @@ -41,7 +41,7 @@ fix: $(GOLANGCI_LINT)
.PHONY: fix

test:
go test ./... -race -parallel=20
GOEXPERIMENT=synctest go test ./... -race -parallel=20
.PHONY: test

generate-e2e-client:
Expand Down
18 changes: 18 additions & 0 deletions cmd/controller/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"github.com/castai/cluster-controller/internal/actions/csr"
"github.com/castai/cluster-controller/internal/castai"
"github.com/castai/cluster-controller/internal/config"
"github.com/castai/cluster-controller/internal/informer"
"github.com/castai/cluster-controller/internal/controller"
"github.com/castai/cluster-controller/internal/controller/logexporter"
"github.com/castai/cluster-controller/internal/controller/metricexporter"
Expand Down Expand Up @@ -131,6 +132,18 @@ func runController(

log.Infof("running castai-cluster-controller version %v, log-level: %v", binVersion, logger.Level)

// Create global informer manager if enabled
log.Info("initializing global informer manager...")
informerManager := informer.NewManager(
log,
clientset,
cfg.Informer.ResyncPeriod,
)

if err := informerManager.Start(ctx); err != nil {
return fmt.Errorf("starting informer manager: %w", err)
}

actionsConfig := controller.Config{
PollWaitInterval: 5 * time.Second,
PollTimeout: maxRequestTimeout,
Expand All @@ -153,11 +166,16 @@ func runController(
client,
helmClient,
healthzAction,
informerManager,
)
defer func() {
if err := svc.Close(); err != nil {
log.Errorf("failed to close controller service: %v", err)
}
// Stop informer manager on shutdown
if informerManager != nil {
informerManager.Stop()
}
}()

if cfg.Metrics.ExportEnabled {
Expand Down
3 changes: 2 additions & 1 deletion cmd/testserver/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ func run(ctx context.Context) error {
// Choose scenarios below by adding/removing/etc. instances of scenarios.XXX()
// All scenarios in the list run in parallel (but not necessarily at the same time if preparation takes different time).
testScenarios := []scenarios.TestScenario{
scenarios.CheckNodeDeletedStuck(300, logger),
// scenarios.CheckNodeDeletedStuck(300, logger),
scenarios.CheckNodeStatus(10000, logger),
}

var wg sync.WaitGroup
Expand Down
72 changes: 27 additions & 45 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,95 +1,81 @@
module github.com/castai/cluster-controller

go 1.24.6
go 1.25.3

require (
github.com/bombsimon/logrusr/v4 v4.1.0
github.com/cenkalti/backoff/v4 v4.3.0
github.com/deepmap/oapi-codegen v1.11.0
github.com/evanphx/json-patch v5.9.0+incompatible
github.com/evanphx/json-patch v5.9.11+incompatible
github.com/fsnotify/fsnotify v1.7.0
github.com/go-resty/resty/v2 v2.15.3
github.com/golang/mock v1.6.0
github.com/google/uuid v1.6.0
github.com/kelseyhightower/envconfig v1.4.0
github.com/prometheus/client_golang v1.21.1
github.com/prometheus/client_golang v1.22.0
github.com/prometheus/client_model v0.6.1
github.com/samber/lo v1.47.0
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.8.1
github.com/spf13/cobra v1.9.1
github.com/spf13/viper v1.19.0
github.com/stretchr/testify v1.10.0
go.uber.org/goleak v1.3.0
golang.org/x/net v0.42.0
golang.org/x/sync v0.16.0
helm.sh/helm/v3 v3.17.4
k8s.io/api v0.33.2
k8s.io/apiextensions-apiserver v0.32.2
k8s.io/apimachinery v0.33.2
k8s.io/apiserver v0.32.2
k8s.io/cli-runtime v0.32.2
k8s.io/client-go v0.33.2
k8s.io/component-base v0.32.2
helm.sh/helm/v3 v3.18.5
k8s.io/api v0.33.3
k8s.io/apiextensions-apiserver v0.33.3
k8s.io/apimachinery v0.33.3
k8s.io/apiserver v0.33.3
k8s.io/cli-runtime v0.33.3
k8s.io/client-go v0.33.3
k8s.io/component-base v0.33.3
k8s.io/klog/v2 v2.130.1
k8s.io/kubectl v0.32.2
k8s.io/kubectl v0.33.3
sigs.k8s.io/controller-runtime v0.19.0
sigs.k8s.io/yaml v1.4.0
sigs.k8s.io/yaml v1.5.0
)

require (
dario.cat/mergo v1.0.1 // indirect
github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6 // indirect
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
github.com/BurntSushi/toml v1.4.0 // indirect
github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect
github.com/BurntSushi/toml v1.5.0 // indirect
github.com/MakeNowJust/heredoc v1.0.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.3.0 // indirect
github.com/Masterminds/sprig/v3 v3.3.0 // indirect
github.com/Masterminds/squirrel v1.5.4 // indirect
github.com/Microsoft/hcsshim v0.12.9 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/chai2010/gettext-go v1.0.2 // indirect
github.com/containerd/cgroups/v3 v3.0.5 // indirect
github.com/containerd/containerd v1.7.27 // indirect
github.com/containerd/continuity v0.4.5 // indirect
github.com/containerd/containerd v1.7.29 // indirect
github.com/containerd/errdefs v1.0.0 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/containerd/platforms v0.2.1 // indirect
github.com/containerd/typeurl/v2 v2.2.3 // indirect
github.com/cyphar/filepath-securejoin v0.3.6 // indirect
github.com/cyphar/filepath-securejoin v0.4.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/cli v25.0.1+incompatible // indirect
github.com/docker/distribution v2.8.3+incompatible // indirect
github.com/docker/docker v28.3.3+incompatible // indirect
github.com/docker/docker-credential-helpers v0.9.3 // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-events v0.0.0-20250114142523-c867878c5e32 // indirect
github.com/docker/go-metrics v0.0.1 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f // indirect
github.com/fatih/color v1.14.1 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-gorp/gorp/v3 v3.1.0 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
github.com/google/btree v1.1.3 // indirect
github.com/google/gnostic-models v0.6.9 // indirect
github.com/google/go-cmp v0.7.0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 // indirect
github.com/gosuri/uitable v0.0.4 // indirect
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
Expand All @@ -115,10 +101,8 @@ require (
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/moby/locker v1.0.1 // indirect
github.com/moby/spdystream v0.5.0 // indirect
github.com/moby/sys/mountinfo v0.7.2 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/moby/term v0.5.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
Expand All @@ -132,27 +116,25 @@ require (
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/common v0.62.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/rubenv/sql-migrate v1.7.1 // indirect
github.com/rubenv/sql-migrate v1.8.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 // indirect
github.com/shopspring/decimal v1.4.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.7.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/pflag v1.0.7 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
github.com/xlab/treeprint v1.2.0 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0 // indirect
go.opentelemetry.io/otel v1.37.0 // indirect
go.opentelemetry.io/otel/metric v1.37.0 // indirect
go.opentelemetry.io/otel/trace v1.37.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.yaml.in/yaml/v2 v2.4.2 // indirect
go.yaml.in/yaml/v3 v3.0.3 // indirect
golang.org/x/crypto v0.41.0 // indirect
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f // indirect
golang.org/x/oauth2 v0.30.0 // indirect
Expand All @@ -169,10 +151,10 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff // indirect
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 // indirect
oras.land/oras-go v1.2.5 // indirect
oras.land/oras-go/v2 v2.6.0 // indirect
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect
sigs.k8s.io/kustomize/api v0.18.0 // indirect
sigs.k8s.io/kustomize/kyaml v0.18.1 // indirect
sigs.k8s.io/kustomize/api v0.19.0 // indirect
sigs.k8s.io/kustomize/kyaml v0.19.0 // indirect
sigs.k8s.io/randfill v1.0.0 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.6.0 // indirect
)
Loading