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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
- release-*

env:
GO_VERSION: '1.19'
GO_VERSION: '1.24.2'

jobs:

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- release-*

env:
GO_VERSION: '1.19'
GO_VERSION: '1.24.2'
KIND_VERSION: 'v0.14.0'
KIND_IMAGE: 'kindest/node:v1.22.2'
KIND_CLUSTER_NAME: 'e2e-test'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
permissions:
contents: write
env:
GO_VERSION: '1.19'
GO_VERSION: '1.24.2'

jobs:
Test:
Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19
go-version: 1.24.2

- name: Release with GoReleaser
uses: goreleaser/goreleaser-action@v2
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.19-alpine3.17 as builder
FROM golang:1.24.2-bookworm as builder
ARG TARGETOS
ARG TARGETARCH

Expand All @@ -9,7 +9,7 @@ COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download
#RUN #go mod download

# Copy the go source
COPY main.go main.go
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module kusionstack.io/kuperator

go 1.19
go 1.24.2

require (
github.com/evanphx/json-patch v5.7.0+incompatible
Expand All @@ -23,7 +23,7 @@ require (
k8s.io/kubernetes v0.0.0-00010101000000-000000000000
k8s.io/utils v0.0.0-20240102154912-e7106e64919e
kusionstack.io/kube-api v0.6.6
kusionstack.io/kube-utils v0.1.19-0.20250206032419-01aec11b2bfa
kusionstack.io/kube-utils v0.2.1-0.20250721060418-3d21299a4b25
kusionstack.io/resourceconsist v0.0.1
sigs.k8s.io/controller-runtime v0.17.3
)
Expand Down
9 changes: 7 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
Expand Down Expand Up @@ -544,6 +545,7 @@ github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6So
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
github.com/rubiojr/go-vhd v0.0.0-20200706105327-02e210299021/go.mod h1:DM5xW0nvfNNm2uytzsvhI3OnX8uzaRAg8UX/CnDqbto=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
Expand Down Expand Up @@ -586,6 +588,7 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
Expand Down Expand Up @@ -650,6 +653,7 @@ go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk=
go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
Expand Down Expand Up @@ -1060,6 +1064,7 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/gcfg.v1 v1.2.0/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o=
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
Expand Down Expand Up @@ -1148,8 +1153,8 @@ k8s.io/utils v0.0.0-20240102154912-e7106e64919e h1:eQ/4ljkx21sObifjzXwlPKpdGLrCf
k8s.io/utils v0.0.0-20240102154912-e7106e64919e/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
kusionstack.io/kube-api v0.6.6 h1:gMLUQL/eectQxkosnlv1m/R2xieY2crETliWRcxBICg=
kusionstack.io/kube-api v0.6.6/go.mod h1:J0+EHiroG/88X904Y9TV9iMRcoEuD5tXMTLMBDSwM+Y=
kusionstack.io/kube-utils v0.1.19-0.20250206032419-01aec11b2bfa h1:2yZnTzVtgevpNixyE/oF29KIZ5LKiy9y1H8lxL+3BxU=
kusionstack.io/kube-utils v0.1.19-0.20250206032419-01aec11b2bfa/go.mod h1:dm0cZBYBOiz+7GsHYP6AH7PDoSqoplTEes7RlxEJMHo=
kusionstack.io/kube-utils v0.2.1-0.20250721060418-3d21299a4b25 h1:sQht70lnBY+0hriWWUyPCp7C/M66f5zfiqdz7+jAs94=
kusionstack.io/kube-utils v0.2.1-0.20250721060418-3d21299a4b25/go.mod h1:5Uy3GCJ1JEGqZw/Sp/uVnHBJN1t9wjY6USPSZ9s4idk=
kusionstack.io/resourceconsist v0.0.1 h1:+k/jriq5Ld7fQUYfWSMGynz/FesHtl3Rk2fmQPjBe0g=
kusionstack.io/resourceconsist v0.0.1/go.mod h1:816xS/fY6EOUbPFjXIWW/TGs8/YE46qP4ElKeIiwFdU=
modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw=
Expand Down
13 changes: 11 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import (
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/healthz"

"kusionstack.io/kube-utils/controller/runnable"

"kusionstack.io/kuperator/pkg/controllers"
"kusionstack.io/kuperator/pkg/controllers/operationjob"
_ "kusionstack.io/kuperator/pkg/features"
Expand Down Expand Up @@ -77,7 +79,7 @@ func main() {
ctrl.SetLogger(klogr.New())

config := ctrl.GetConfigOrDie()
mgr, err := ctrl.NewManager(config, ctrl.Options{
opts := ctrl.Options{
Scheme: scheme,
MetricsBindAddress: metricsAddr,
Port: 9443,
Expand All @@ -99,7 +101,9 @@ func main() {
// if you are doing or is intended to do any operation such as perform cleanups
// after the manager stops then its usage might be unsafe.
// LeaderElectionReleaseOnCancel: true,
})
}

mgr, err := ctrl.NewManager(config, opts)
if err != nil {
setupLog.Error(err, "unable to start manager")
os.Exit(1)
Expand All @@ -122,6 +126,11 @@ func main() {
os.Exit(1)
}

if err = runnable.InitializeRunnable(mgr, opts); err != nil {
setupLog.Error(err, "unable to add runnable")
os.Exit(1)
}

// +kubebuilder:scaffold:builder
setupLog.Info("initialize webhook")
if err := webhook.Initialize(context.Background(), config, dnsName, certDir); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/controllers/collaset/synccontrol/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ func (u *inPlaceIfPossibleUpdater) GetPodUpdateFinishStatus(_ context.Context, p
return false, "no pod last state annotation", nil
} else if err := json.Unmarshal([]byte(lastStateJson), podLastState); err != nil {
msg := fmt.Sprintf("malformat pod last state annotation [%s]: %s", lastStateJson, err)
return false, msg, fmt.Errorf(msg)
return false, msg, fmt.Errorf("malformat pod last state annotation [%s]: %s", lastStateJson, err)
}

if podLastState.ContainerStates == nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/controllers/operationjob/operationjob_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (r *ReconcileOperationJob) getActionHandler(operationJob *appsv1alpha1.Oper
if handler == nil {
errMsg := fmt.Sprintf("unsupported operation type! please register handler for action: %s", action)
r.Recorder.Eventf(operationJob, corev1.EventTypeWarning, "OpsAction", errMsg)
return nil, false, fmt.Errorf(errMsg)
return nil, false, fmt.Errorf("unsupported operation type! please register handler for action: %s", action)
}

return handler, enablePodOpsLifecycle, nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (l *LabelCheckRuler) Filter(podTransitionRule *appsv1alpha1.PodTransitionRu
rejected := map[string]string{}
sel, err := metav1.LabelSelectorAsSelector(l.Selector)
if err != nil {
return rejectAllWithErr(subjects, passed, rejected, fmt.Sprintf("labelCheck error: %v", err))
return rejectAllWithErr(subjects, passed, rejected, "labelCheck error: %v", err)
}

for podName := range subjects {
Expand Down
3 changes: 2 additions & 1 deletion pkg/controllers/podtransitionrule/processor/rules/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"k8s.io/klog"

appsv1alpha1 "kusionstack.io/kube-api/apps/v1alpha1"

controllerutils "kusionstack.io/kuperator/pkg/controllers/podtransitionrule/utils"
"kusionstack.io/kuperator/pkg/utils"
utilshttp "kusionstack.io/kuperator/pkg/utils/http"
Expand Down Expand Up @@ -176,7 +177,7 @@ func (w *Webhook) Do(targets map[string]*corev1.Pod, subjects sets.String) *Filt
var errMsg string
if pollingResult.LastError != nil {
errMsg = fmt.Sprintf("polling task %s error, %v", taskId, pollingResult.LastError)
klog.Warningf(errMsg)
klog.Warningf("polling task %s error, %v", taskId, pollingResult.LastError)
}
var rejectMsg string
if pollingResult.Stopped {
Expand Down
2 changes: 1 addition & 1 deletion scripts/setup-envtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function fetch_envtest_tools {
tmp_root=/tmp
#envtest_root_dir=$tmp_root/envtest

k8s_version="${ENVTEST_K8S_VERSION:-1.19.2}"
k8s_version="${ENVTEST_K8S_VERSION:-1.24.2}"
goarch="$(go env GOARCH)"
goos="$(go env GOOS)"

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/framework/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ func (f *Framework) AfterEach() {
for namespaceKey, namespaceErr := range nsDeletionErrors {
messages = append(messages, fmt.Sprintf("Couldn't delete ns: %q: %s (%#v)", namespaceKey, namespaceErr, namespaceErr))
}
Failf(strings.Join(messages, ","))
Failf("%s", messages)
}
}()

Expand Down
Loading