mirror of https://github.com/openkruise/kruise.git
update golang-lint to v2 and fix related goimports error (#2019)
Signed-off-by: 守辰 <shouchen.zz@alibaba-inc.com>
This commit is contained in:
parent
a6fafc5fb4
commit
d8bf9c9b53
|
@ -14,7 +14,7 @@ permissions: read-all
|
|||
env:
|
||||
# Common versions
|
||||
GO_VERSION: '1.22'
|
||||
GOLANGCI_VERSION: 'v1.55.2'
|
||||
GOLANGCI_VERSION: 'v2.1'
|
||||
DOCKER_BUILDX_VERSION: 'v0.4.2'
|
||||
|
||||
# Common users. We can't run a step 'if secrets.AWS_USR != ""' but we can run
|
||||
|
@ -58,7 +58,7 @@ jobs:
|
|||
run: |
|
||||
make generate
|
||||
- name: Lint golang code
|
||||
uses: golangci/golangci-lint-action@2226d7cb06a077cd73e56eedd38eecad18e5d837 # v6.5.0
|
||||
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
|
||||
with:
|
||||
version: ${{ env.GOLANGCI_VERSION }}
|
||||
args: --verbose
|
||||
|
|
136
.golangci.yml
136
.golangci.yml
|
@ -1,93 +1,73 @@
|
|||
# options for analysis running
|
||||
version: "2"
|
||||
run:
|
||||
# default concurrency is a available CPU number
|
||||
concurrency: 4
|
||||
|
||||
# timeout for analysis, e.g. 30s, 5m, default is 1m
|
||||
deadline: 5m
|
||||
|
||||
# exit code when at least one issue was found, default is 1
|
||||
issues-exit-code: 1
|
||||
|
||||
# include test files or not, default is true
|
||||
tests: true
|
||||
|
||||
# list of build tags, all linters use it. Default is empty list.
|
||||
#build-tags:
|
||||
# - mytag
|
||||
|
||||
# which dirs to skip: they won't be analyzed;
|
||||
# can use regexp here: generated.*, regexp is applied on full path;
|
||||
# default value is empty list, but next dirs are always skipped independently
|
||||
# from this option's value:
|
||||
# third_party$, testdata$, examples$, Godeps$, builtin$
|
||||
skip-dirs:
|
||||
- apis
|
||||
- pkg/client
|
||||
- vendor
|
||||
- test
|
||||
|
||||
# which files to skip: they will be analyzed, but issues from them
|
||||
# won't be reported. Default value is empty list, but there is
|
||||
# no need to include all autogenerated files, we confidently recognize
|
||||
# autogenerated files. If it's not please let us know.
|
||||
skip-files:
|
||||
# - ".*\\.my\\.go$"
|
||||
# - lib/bad.go
|
||||
|
||||
# output configuration options
|
||||
output:
|
||||
# colored-line-number|line-number|json|tab|checkstyle, default is "colored-line-number"
|
||||
format: colored-line-number
|
||||
|
||||
# print lines of code with issue, default is true
|
||||
print-issued-lines: true
|
||||
|
||||
# print linter name in the end of issue text, default is true
|
||||
print-linter-name: true
|
||||
|
||||
|
||||
# all available settings of specific linters
|
||||
linters-settings:
|
||||
golint:
|
||||
# minimal confidence for issues, default is 0.8
|
||||
min-confidence: 0.8
|
||||
gofmt:
|
||||
# simplify code: gofmt with `-s` option, true by default
|
||||
simplify: true
|
||||
goimports:
|
||||
# put imports beginning with prefix after 3rd-party packages;
|
||||
# it's a comma-separated list of prefixes
|
||||
#local-prefixes: github.com/openkruise/kruise
|
||||
misspell:
|
||||
# Correct spellings using locale preferences for US or UK.
|
||||
# Default is to use a neutral variety of English.
|
||||
# Setting locale to US will correct the British spelling of 'colour' to 'color'.
|
||||
locale: default
|
||||
#ignore-words:
|
||||
# - someword
|
||||
depguard:
|
||||
rules:
|
||||
forbid-pkg-errors:
|
||||
deny:
|
||||
- pkg: "github.com/pkg/errors"
|
||||
dsc: Should be replaced with standard lib errors or fmt.Errorf
|
||||
|
||||
formats:
|
||||
text:
|
||||
path: stdout
|
||||
colors: true
|
||||
linters:
|
||||
fast: false
|
||||
disable-all: true
|
||||
default: none
|
||||
enable:
|
||||
# TODO Enforce the below linters later
|
||||
- gofmt
|
||||
- depguard
|
||||
- govet
|
||||
- goimports
|
||||
- ineffassign
|
||||
- misspell
|
||||
- vet
|
||||
- unconvert
|
||||
- unused
|
||||
- depguard
|
||||
issues:
|
||||
exclude:
|
||||
# staticcheck
|
||||
- 'SA1019: package github.com/golang/protobuf/proto is deprecated: Use the "google.golang.org/protobuf/proto" package instead'
|
||||
settings:
|
||||
misspell:
|
||||
# Correct spellings using locale preferences for US or UK.
|
||||
# Default is to use a neutral variety of English.
|
||||
# Setting locale to US will correct the British spelling of 'colour' to 'color'.
|
||||
locale: US
|
||||
depguard:
|
||||
rules:
|
||||
forbid-pkg-errors:
|
||||
deny:
|
||||
- pkg: "github.com/pkg/errors"
|
||||
desc: Should be replaced with standard lib errors or fmt.Errorf
|
||||
exclusions:
|
||||
generated: lax
|
||||
presets:
|
||||
- comments
|
||||
- common-false-positives
|
||||
- legacy
|
||||
- std-error-handling
|
||||
rules:
|
||||
- path: (.+)\.go$
|
||||
text: 'SA1019: package github.com/golang/protobuf/proto is deprecated: Use the "google.golang.org/protobuf/proto" package instead'
|
||||
paths:
|
||||
- third_party$
|
||||
- builtin$
|
||||
- examples$
|
||||
- apis
|
||||
- pkg/client
|
||||
- vendor
|
||||
- test
|
||||
formatters:
|
||||
enable:
|
||||
- gofmt
|
||||
- goimports
|
||||
settings:
|
||||
gofmt:
|
||||
simplify: true
|
||||
goimports:
|
||||
# put imports beginning with prefix after 3rd-party packages;
|
||||
local-prefixes:
|
||||
- github.com/openkruise/kruise
|
||||
exclusions:
|
||||
generated: lax
|
||||
paths:
|
||||
- third_party$
|
||||
- builtin$
|
||||
- examples$
|
||||
- apis
|
||||
- pkg/client
|
||||
- vendor
|
||||
- test
|
||||
|
|
|
@ -20,9 +20,10 @@ import (
|
|||
"context"
|
||||
"log"
|
||||
|
||||
kruiseclientset "github.com/openkruise/kruise/pkg/client/clientset/versioned"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/rest"
|
||||
|
||||
kruiseclientset "github.com/openkruise/kruise/pkg/client/clientset/versioned"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -23,11 +23,12 @@ import (
|
|||
"os"
|
||||
"strings"
|
||||
|
||||
"k8s.io/kube-openapi/pkg/common"
|
||||
"k8s.io/kube-openapi/pkg/validation/spec"
|
||||
|
||||
appspub "github.com/openkruise/kruise/apis/apps/pub"
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
appsv1beta1 "github.com/openkruise/kruise/apis/apps/v1beta1"
|
||||
"k8s.io/kube-openapi/pkg/common"
|
||||
"k8s.io/kube-openapi/pkg/validation/spec"
|
||||
)
|
||||
|
||||
// Generate OpenAPI spec definitions for Kruise Resources
|
||||
|
|
|
@ -17,12 +17,13 @@ limitations under the License.
|
|||
package pubcontrol
|
||||
|
||||
import (
|
||||
policyv1alpha1 "github.com/openkruise/kruise/apis/policy/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/util/controllerfinder"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/tools/record"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
policyv1alpha1 "github.com/openkruise/kruise/apis/policy/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/util/controllerfinder"
|
||||
)
|
||||
|
||||
var PubControl pubControl
|
||||
|
|
|
@ -22,13 +22,6 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
appspub "github.com/openkruise/kruise/apis/apps/pub"
|
||||
policyv1alpha1 "github.com/openkruise/kruise/apis/policy/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/control/sidecarcontrol"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
utilclient "github.com/openkruise/kruise/pkg/util/client"
|
||||
"github.com/openkruise/kruise/pkg/util/controllerfinder"
|
||||
"github.com/openkruise/kruise/pkg/util/inplaceupdate"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
@ -36,6 +29,14 @@ import (
|
|||
"k8s.io/klog/v2"
|
||||
kubecontroller "k8s.io/kubernetes/pkg/controller"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
appspub "github.com/openkruise/kruise/apis/apps/pub"
|
||||
policyv1alpha1 "github.com/openkruise/kruise/apis/policy/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/control/sidecarcontrol"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
utilclient "github.com/openkruise/kruise/pkg/util/client"
|
||||
"github.com/openkruise/kruise/pkg/util/controllerfinder"
|
||||
"github.com/openkruise/kruise/pkg/util/inplaceupdate"
|
||||
)
|
||||
|
||||
type commonControl struct {
|
||||
|
|
|
@ -20,8 +20,9 @@ import (
|
|||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/openkruise/kruise/apis/apps/pub"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
|
||||
"github.com/openkruise/kruise/apis/apps/pub"
|
||||
)
|
||||
|
||||
func TestIsPodUnavailableChanged(t *testing.T) {
|
||||
|
|
|
@ -21,8 +21,9 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"k8s.io/apimachinery/pkg/util/rand"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
)
|
||||
|
||||
// SidecarSetHash returns a hash of the SidecarSet.
|
||||
|
|
|
@ -3,9 +3,10 @@ package sidecarcontrol
|
|||
import (
|
||||
"testing"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
)
|
||||
|
||||
var always = corev1.ContainerRestartPolicyAlways
|
||||
|
|
|
@ -25,13 +25,6 @@ import (
|
|||
"strings"
|
||||
|
||||
jsonpatch "github.com/evanphx/json-patch"
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/features"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
utilclient "github.com/openkruise/kruise/pkg/util/client"
|
||||
"github.com/openkruise/kruise/pkg/util/configuration"
|
||||
"github.com/openkruise/kruise/pkg/util/expectations"
|
||||
utilfeature "github.com/openkruise/kruise/pkg/util/feature"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
@ -42,6 +35,14 @@ import (
|
|||
kubecontroller "k8s.io/kubernetes/pkg/controller"
|
||||
"k8s.io/kubernetes/pkg/fieldpath"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/features"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
utilclient "github.com/openkruise/kruise/pkg/util/client"
|
||||
"github.com/openkruise/kruise/pkg/util/configuration"
|
||||
"github.com/openkruise/kruise/pkg/util/expectations"
|
||||
utilfeature "github.com/openkruise/kruise/pkg/util/feature"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -24,14 +24,15 @@ import (
|
|||
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
"github.com/openkruise/kruise/pkg/util/configuration"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client/fake"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
"github.com/openkruise/kruise/pkg/util/configuration"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
|
|
@ -5,8 +5,9 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"k8s.io/klog/v2"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
)
|
||||
|
||||
func FindTemplateKind(spec appsv1alpha1.AdvancedCronJobSpec) appsv1alpha1.TemplateKind {
|
||||
|
|
|
@ -21,10 +21,11 @@ import (
|
|||
"fmt"
|
||||
"time"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/klog/v2"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
)
|
||||
|
||||
// IsJobFinished returns true when finishing job
|
||||
|
|
|
@ -20,12 +20,6 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
clonesetcore "github.com/openkruise/kruise/pkg/controller/cloneset/core"
|
||||
clonesetutils "github.com/openkruise/kruise/pkg/controller/cloneset/utils"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
imagejobutilfunc "github.com/openkruise/kruise/pkg/util/imagejob/utilfunction"
|
||||
"github.com/openkruise/kruise/pkg/util/inplaceupdate"
|
||||
apps "k8s.io/api/apps/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
|
@ -35,6 +29,13 @@ import (
|
|||
"k8s.io/klog/v2"
|
||||
"k8s.io/kubernetes/pkg/controller/history"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
clonesetcore "github.com/openkruise/kruise/pkg/controller/cloneset/core"
|
||||
clonesetutils "github.com/openkruise/kruise/pkg/controller/cloneset/utils"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
imagejobutilfunc "github.com/openkruise/kruise/pkg/util/imagejob/utilfunction"
|
||||
"github.com/openkruise/kruise/pkg/util/inplaceupdate"
|
||||
)
|
||||
|
||||
func (r *ReconcileCloneSet) createImagePullJobsForInPlaceUpdate(cs *appsv1alpha1.CloneSet, currentRevision, updateRevision *apps.ControllerRevision) error {
|
||||
|
|
|
@ -20,16 +20,17 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
clonesetcore "github.com/openkruise/kruise/pkg/controller/cloneset/core"
|
||||
"github.com/openkruise/kruise/pkg/controller/cloneset/sync"
|
||||
clonesetutils "github.com/openkruise/kruise/pkg/controller/cloneset/utils"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/client-go/util/retry"
|
||||
"k8s.io/klog/v2"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
clonesetcore "github.com/openkruise/kruise/pkg/controller/cloneset/core"
|
||||
"github.com/openkruise/kruise/pkg/controller/cloneset/sync"
|
||||
clonesetutils "github.com/openkruise/kruise/pkg/controller/cloneset/utils"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
)
|
||||
|
||||
// StatusUpdater is interface for updating CloneSet status.
|
||||
|
|
|
@ -17,10 +17,11 @@ limitations under the License.
|
|||
package core
|
||||
|
||||
import (
|
||||
v1 "k8s.io/api/core/v1"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
clonesetutils "github.com/openkruise/kruise/pkg/controller/cloneset/utils"
|
||||
"github.com/openkruise/kruise/pkg/util/inplaceupdate"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
)
|
||||
|
||||
type Control interface {
|
||||
|
|
|
@ -17,15 +17,16 @@ limitations under the License.
|
|||
package sync
|
||||
|
||||
import (
|
||||
apps "k8s.io/api/apps/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/client-go/tools/record"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
clonesetutils "github.com/openkruise/kruise/pkg/controller/cloneset/utils"
|
||||
"github.com/openkruise/kruise/pkg/util/controllerfinder"
|
||||
"github.com/openkruise/kruise/pkg/util/inplaceupdate"
|
||||
"github.com/openkruise/kruise/pkg/util/lifecycle"
|
||||
apps "k8s.io/api/apps/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/client-go/tools/record"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
)
|
||||
|
||||
// Interface for managing pods scaling and updating.
|
||||
|
|
|
@ -24,12 +24,6 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
appspub "github.com/openkruise/kruise/apis/apps/pub"
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
clonesettest "github.com/openkruise/kruise/pkg/controller/cloneset/test"
|
||||
clonesetutils "github.com/openkruise/kruise/pkg/controller/cloneset/utils"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
"github.com/openkruise/kruise/pkg/util/expectations"
|
||||
apps "k8s.io/api/apps/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
|
@ -45,6 +39,13 @@ import (
|
|||
utilpointer "k8s.io/utils/pointer"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client/fake"
|
||||
|
||||
appspub "github.com/openkruise/kruise/apis/apps/pub"
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
clonesettest "github.com/openkruise/kruise/pkg/controller/cloneset/test"
|
||||
clonesetutils "github.com/openkruise/kruise/pkg/controller/cloneset/utils"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
"github.com/openkruise/kruise/pkg/util/expectations"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -21,15 +21,16 @@ import (
|
|||
"reflect"
|
||||
"testing"
|
||||
|
||||
apps "k8s.io/api/apps/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
|
||||
appspub "github.com/openkruise/kruise/apis/apps/pub"
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/features"
|
||||
utilfeature "github.com/openkruise/kruise/pkg/util/feature"
|
||||
"github.com/openkruise/kruise/pkg/util/revision"
|
||||
apps "k8s.io/api/apps/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
)
|
||||
|
||||
func TestCalculateDiffsWithExpectation(t *testing.T) {
|
||||
|
|
|
@ -22,6 +22,13 @@ import (
|
|||
"sort"
|
||||
"time"
|
||||
|
||||
apps "k8s.io/api/apps/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/klog/v2"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
appspub "github.com/openkruise/kruise/apis/apps/pub"
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
policyv1alpha1 "github.com/openkruise/kruise/apis/policy/v1alpha1"
|
||||
|
@ -35,12 +42,6 @@ import (
|
|||
"github.com/openkruise/kruise/pkg/util/lifecycle"
|
||||
"github.com/openkruise/kruise/pkg/util/specifieddelete"
|
||||
"github.com/openkruise/kruise/pkg/util/updatesort"
|
||||
apps "k8s.io/api/apps/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/klog/v2"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
)
|
||||
|
||||
func (c *realControl) Update(cs *appsv1alpha1.CloneSet,
|
||||
|
|
|
@ -17,6 +17,10 @@ limitations under the License.
|
|||
package controller
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
"k8s.io/klog/v2"
|
||||
"sigs.k8s.io/controller-runtime/pkg/manager"
|
||||
|
||||
"github.com/openkruise/kruise/pkg/controller/advancedcronjob"
|
||||
"github.com/openkruise/kruise/pkg/controller/broadcastjob"
|
||||
"github.com/openkruise/kruise/pkg/controller/cloneset"
|
||||
|
@ -38,9 +42,6 @@ import (
|
|||
"github.com/openkruise/kruise/pkg/controller/statefulset"
|
||||
"github.com/openkruise/kruise/pkg/controller/uniteddeployment"
|
||||
"github.com/openkruise/kruise/pkg/controller/workloadspread"
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
"k8s.io/klog/v2"
|
||||
"sigs.k8s.io/controller-runtime/pkg/manager"
|
||||
)
|
||||
|
||||
var controllerAddFuncs []func(manager.Manager) error
|
||||
|
|
|
@ -23,8 +23,6 @@ import (
|
|||
"fmt"
|
||||
"reflect"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
apps "k8s.io/api/apps/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
@ -34,6 +32,9 @@ import (
|
|||
"k8s.io/klog/v2"
|
||||
kubecontroller "k8s.io/kubernetes/pkg/controller"
|
||||
labelsutil "k8s.io/kubernetes/pkg/util/labels"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
)
|
||||
|
||||
func (dsc *ReconcileDaemonSet) constructHistory(ctx context.Context, ds *appsv1alpha1.DaemonSet) (cur *apps.ControllerRevision, old []*apps.ControllerRevision, err error) {
|
||||
|
|
|
@ -21,7 +21,6 @@ import (
|
|||
"reflect"
|
||||
"testing"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
apps "k8s.io/api/apps/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
|
@ -32,6 +31,8 @@ import (
|
|||
kubecontroller "k8s.io/kubernetes/pkg/controller"
|
||||
"k8s.io/kubernetes/pkg/securitycontext"
|
||||
labelsutil "k8s.io/kubernetes/pkg/util/labels"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
)
|
||||
|
||||
func Test_nodeInSameCondition(t *testing.T) {
|
||||
|
|
|
@ -3,8 +3,9 @@ package econtainer
|
|||
import (
|
||||
"time"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
)
|
||||
|
||||
type EphemeralContainerInterface interface {
|
||||
|
|
|
@ -22,8 +22,6 @@ import (
|
|||
"reflect"
|
||||
"strings"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
|
@ -31,6 +29,9 @@ import (
|
|||
"k8s.io/klog/v2"
|
||||
utilpointer "k8s.io/utils/pointer"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
)
|
||||
|
||||
type syncAction string
|
||||
|
|
|
@ -20,12 +20,13 @@ import (
|
|||
"reflect"
|
||||
"testing"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
utilpointer "k8s.io/utils/pointer"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
)
|
||||
|
||||
func TestTargetFromSource(t *testing.T) {
|
||||
|
|
|
@ -23,9 +23,10 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/openkruise/kruise/pkg/util/configuration"
|
||||
"k8s.io/utils/ptr"
|
||||
|
||||
"github.com/openkruise/kruise/pkg/util/configuration"
|
||||
|
||||
ctrlUtil "github.com/openkruise/kruise/pkg/controller/util"
|
||||
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
|
|
|
@ -20,14 +20,15 @@ import (
|
|||
"context"
|
||||
"testing"
|
||||
|
||||
appspub "github.com/openkruise/kruise/apis/apps/pub"
|
||||
utilpodreadiness "github.com/openkruise/kruise/pkg/util/podreadiness"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client/fake"
|
||||
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
||||
|
||||
appspub "github.com/openkruise/kruise/apis/apps/pub"
|
||||
utilpodreadiness "github.com/openkruise/kruise/pkg/util/podreadiness"
|
||||
)
|
||||
|
||||
func TestReconcile(t *testing.T) {
|
||||
|
|
|
@ -20,10 +20,11 @@ import (
|
|||
"testing"
|
||||
|
||||
fuzz "github.com/AdaLogics/go-fuzz-headers"
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
fuzzutils "github.com/openkruise/kruise/test/fuzz"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
fuzzutils "github.com/openkruise/kruise/test/fuzz"
|
||||
)
|
||||
|
||||
func FuzzMatchFunctions(f *testing.F) {
|
||||
|
|
|
@ -25,6 +25,8 @@ import (
|
|||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
podutil "k8s.io/kubernetes/pkg/api/v1/pod"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/control/sidecarcontrol"
|
||||
controlutil "github.com/openkruise/kruise/pkg/controller/util"
|
||||
|
@ -33,7 +35,6 @@ import (
|
|||
"github.com/openkruise/kruise/pkg/util/fieldindex"
|
||||
historyutil "github.com/openkruise/kruise/pkg/util/history"
|
||||
webhookutil "github.com/openkruise/kruise/pkg/webhook/util"
|
||||
podutil "k8s.io/kubernetes/pkg/api/v1/pod"
|
||||
|
||||
apps "k8s.io/api/apps/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
|
|
|
@ -19,13 +19,14 @@ package sidecarterminator
|
|||
import (
|
||||
"context"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
"k8s.io/client-go/util/retry"
|
||||
"k8s.io/klog/v2"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
)
|
||||
|
||||
func (r *ReconcileSidecarTerminator) executeInPlaceUpdateAction(originalPod *corev1.Pod, sidecars sets.Set[string]) error {
|
||||
|
|
|
@ -20,13 +20,14 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
"k8s.io/klog/v2"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
)
|
||||
|
||||
func (r *ReconcileSidecarTerminator) executeKillContainerAction(pod *corev1.Pod, sidecars sets.Set[string]) error {
|
||||
|
|
|
@ -23,7 +23,6 @@ import (
|
|||
"sort"
|
||||
"testing"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
@ -34,6 +33,8 @@ import (
|
|||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client/fake"
|
||||
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -19,9 +19,10 @@ package sidecarterminator
|
|||
import (
|
||||
"strings"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
)
|
||||
|
||||
func isInterestingPod(pod *corev1.Pod) bool {
|
||||
|
|
|
@ -19,10 +19,11 @@ package sidecarterminator
|
|||
import (
|
||||
"testing"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
)
|
||||
|
||||
func TestInterestingPod(t *testing.T) {
|
||||
|
|
|
@ -26,7 +26,6 @@ import (
|
|||
"strconv"
|
||||
"time"
|
||||
|
||||
apiutil "github.com/openkruise/kruise/pkg/util/api"
|
||||
apps "k8s.io/api/apps/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
@ -39,6 +38,8 @@ import (
|
|||
"k8s.io/kubernetes/pkg/controller"
|
||||
"k8s.io/kubernetes/pkg/controller/history"
|
||||
|
||||
apiutil "github.com/openkruise/kruise/pkg/util/api"
|
||||
|
||||
appspub "github.com/openkruise/kruise/apis/apps/pub"
|
||||
appsv1beta1 "github.com/openkruise/kruise/apis/apps/v1beta1"
|
||||
"github.com/openkruise/kruise/pkg/features"
|
||||
|
|
|
@ -19,14 +19,15 @@ package adapter
|
|||
import (
|
||||
"testing"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/apis/apps/v1beta1"
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/client-go/scale/scheme/appsv1beta1"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client/fake"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/apis/apps/v1beta1"
|
||||
)
|
||||
|
||||
func TestPostUpdate(t *testing.T) {
|
||||
|
|
|
@ -19,12 +19,13 @@ package adapter
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/validation"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
podutil "k8s.io/kubernetes/pkg/api/v1/pod"
|
||||
"k8s.io/kubernetes/pkg/controller"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
)
|
||||
|
||||
func getSubsetPrefix(controllerName, subsetName string) string {
|
||||
|
|
|
@ -9,15 +9,16 @@ import (
|
|||
"k8s.io/klog/v2"
|
||||
"k8s.io/utils/ptr"
|
||||
|
||||
alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
"github.com/openkruise/kruise/pkg/util/refmanager"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
|
||||
|
||||
alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
"github.com/openkruise/kruise/pkg/util/refmanager"
|
||||
)
|
||||
|
||||
type CloneSetAdapter struct {
|
||||
|
|
|
@ -21,9 +21,10 @@ import (
|
|||
"sort"
|
||||
"testing"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/utils/pointer"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
)
|
||||
|
||||
func sortToAllocator(infos subsetInfos) *specificAllocator {
|
||||
|
|
|
@ -20,13 +20,14 @@ import (
|
|||
"testing"
|
||||
|
||||
fuzz "github.com/AdaLogics/go-fuzz-headers"
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/controller/uniteddeployment/adapter"
|
||||
fuzzutils "github.com/openkruise/kruise/test/fuzz"
|
||||
v1 "k8s.io/api/apps/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/controller/uniteddeployment/adapter"
|
||||
fuzzutils "github.com/openkruise/kruise/test/fuzz"
|
||||
)
|
||||
|
||||
var fakeScheme = runtime.NewScheme()
|
||||
|
|
|
@ -17,9 +17,10 @@ limitations under the License.
|
|||
package uniteddeployment
|
||||
|
||||
import (
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
)
|
||||
|
||||
// Subset stores the details of a subset resource owned by one UnitedDeployment.
|
||||
|
|
|
@ -8,9 +8,6 @@ import (
|
|||
|
||||
"math/rand"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/apis/apps/v1beta1"
|
||||
"github.com/openkruise/kruise/pkg/controller/uniteddeployment/adapter"
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
@ -18,6 +15,10 @@ import (
|
|||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/utils/ptr"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client/fake"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/apis/apps/v1beta1"
|
||||
"github.com/openkruise/kruise/pkg/controller/uniteddeployment/adapter"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
|
|
@ -8,8 +8,6 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/onsi/gomega"
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
appsv1beta1 "github.com/openkruise/kruise/apis/apps/v1beta1"
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
|
@ -19,6 +17,9 @@ import (
|
|||
"k8s.io/apimachinery/pkg/util/rand"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
appsv1beta1 "github.com/openkruise/kruise/apis/apps/v1beta1"
|
||||
)
|
||||
|
||||
func TestCloneSetAll(t *testing.T) {
|
||||
|
|
|
@ -22,8 +22,6 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/onsi/gomega"
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
utilclient "github.com/openkruise/kruise/pkg/util/client"
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
|
@ -31,6 +29,9 @@ import (
|
|||
"k8s.io/apimachinery/pkg/types"
|
||||
"sigs.k8s.io/controller-runtime/pkg/manager"
|
||||
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
utilclient "github.com/openkruise/kruise/pkg/util/client"
|
||||
)
|
||||
|
||||
var expectedRequest = reconcile.Request{NamespacedName: types.NamespacedName{Name: "foo", Namespace: "default"}}
|
||||
|
|
|
@ -23,11 +23,12 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/util/expectations"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/util/expectations"
|
||||
)
|
||||
|
||||
const updateRetries = 5
|
||||
|
|
|
@ -21,12 +21,13 @@ import (
|
|||
"testing"
|
||||
|
||||
fuzz "github.com/AdaLogics/go-fuzz-headers"
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
fuzzutils "github.com/openkruise/kruise/test/fuzz"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client/fake"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
fuzzutils "github.com/openkruise/kruise/test/fuzz"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -20,10 +20,11 @@ import (
|
|||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/openkruise/kruise/pkg/controller/util"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/klog/v2"
|
||||
|
||||
"github.com/openkruise/kruise/pkg/controller/util"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
wsutil "github.com/openkruise/kruise/pkg/webhook/workloadspread/validating"
|
||||
)
|
||||
|
|
|
@ -25,8 +25,6 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
"github.com/openkruise/kruise/pkg/util/configuration"
|
||||
apps "k8s.io/api/apps/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
apiequality "k8s.io/apimachinery/pkg/api/equality"
|
||||
|
@ -44,6 +42,9 @@ import (
|
|||
"sigs.k8s.io/controller-runtime/pkg/client/fake"
|
||||
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
||||
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
"github.com/openkruise/kruise/pkg/util/configuration"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/util/controllerfinder"
|
||||
"github.com/openkruise/kruise/pkg/util/fieldindex"
|
||||
|
|
|
@ -20,13 +20,14 @@ import (
|
|||
"encoding/json"
|
||||
"reflect"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/strategicpatch"
|
||||
schedulecorev1 "k8s.io/component-helpers/scheduling/corev1"
|
||||
"k8s.io/component-helpers/scheduling/corev1/nodeaffinity"
|
||||
"k8s.io/klog/v2"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
)
|
||||
|
||||
// NewWorkloadSpreadSubsetCondition creates a new WorkloadSpreadSubset condition.
|
||||
|
|
|
@ -20,11 +20,12 @@ import (
|
|||
"fmt"
|
||||
"testing"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -21,13 +21,14 @@ import (
|
|||
"fmt"
|
||||
"time"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/klog/v2"
|
||||
kubeletcontainer "k8s.io/kubernetes/pkg/kubelet/container"
|
||||
utilpointer "k8s.io/utils/pointer"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -24,10 +24,11 @@ import (
|
|||
"fmt"
|
||||
"os"
|
||||
|
||||
runtimeimage "github.com/openkruise/kruise/pkg/daemon/criruntime/imageruntime"
|
||||
daemonutil "github.com/openkruise/kruise/pkg/daemon/util"
|
||||
"k8s.io/klog/v2"
|
||||
kubeletutil "k8s.io/kubernetes/pkg/kubelet/util"
|
||||
|
||||
runtimeimage "github.com/openkruise/kruise/pkg/daemon/criruntime/imageruntime"
|
||||
daemonutil "github.com/openkruise/kruise/pkg/daemon/util"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -22,12 +22,13 @@ import (
|
|||
"math/rand"
|
||||
"time"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
clientalpha1 "github.com/openkruise/kruise/pkg/client/clientset/versioned/typed/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
"golang.org/x/time/rate"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/klog/v2"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
clientalpha1 "github.com/openkruise/kruise/pkg/client/clientset/versioned/typed/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
)
|
||||
|
||||
func logNewImages(oldObj, newObj *appsv1alpha1.NodeImage) {
|
||||
|
|
|
@ -189,7 +189,7 @@ func (m *genericRuntimeManager) KillContainer(pod *v1.Pod, containerID kubeletco
|
|||
// kubelet restart.
|
||||
// To solve this problem, we've already written necessary information into container labels. Here we
|
||||
// just need to retrieve them from container labels and restore the specs.
|
||||
// TODO(random-liu): Add a node e2e test to test this behaviour.
|
||||
// TODO(random-liu): Add a node e2e test to test this behavior.
|
||||
// TODO(random-liu): Change the lifecycle handler to just accept information needed, so that we can
|
||||
// just pass the needed function not create the fake object.
|
||||
func (m *genericRuntimeManager) restoreSpecsFromContainerLabels(containerID kubeletcontainer.ContainerID) (*v1.Pod, *v1.Container, error) {
|
||||
|
|
|
@ -19,9 +19,10 @@ package podprobe
|
|||
import (
|
||||
"sync"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/util/workqueue"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
)
|
||||
|
||||
const maxSyncProbeTime = 600
|
||||
|
|
|
@ -22,10 +22,11 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
appsalphav1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/util/workqueue"
|
||||
|
||||
appsalphav1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
)
|
||||
|
||||
func TestResultManagerSet(t *testing.T) {
|
||||
|
|
|
@ -21,11 +21,12 @@ import (
|
|||
"math/rand"
|
||||
"time"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
clientset "k8s.io/client-go/kubernetes"
|
||||
"k8s.io/klog/v2"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
)
|
||||
|
||||
// SecretManager is the interface to get secrets from API Server.
|
||||
|
|
|
@ -21,10 +21,11 @@ import (
|
|||
"reflect"
|
||||
"testing"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/kubernetes/fake"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
)
|
||||
|
||||
func TestGetSecretsFromCache(t *testing.T) {
|
||||
|
|
|
@ -22,10 +22,11 @@ import (
|
|||
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -17,10 +17,11 @@ limitations under the License.
|
|||
package configuration
|
||||
|
||||
import (
|
||||
"github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
|
||||
"github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -20,8 +20,9 @@ import (
|
|||
"fmt"
|
||||
"strconv"
|
||||
|
||||
appspub "github.com/openkruise/kruise/apis/apps/pub"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
|
||||
appspub "github.com/openkruise/kruise/apis/apps/pub"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -19,10 +19,6 @@ package controllerfinder
|
|||
import (
|
||||
"context"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
appsv1beta1 "github.com/openkruise/kruise/apis/apps/v1beta1"
|
||||
apiutil "github.com/openkruise/kruise/pkg/util/api"
|
||||
"github.com/openkruise/kruise/pkg/util/configuration"
|
||||
apps "k8s.io/api/apps/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
|
@ -40,6 +36,11 @@ import (
|
|||
scaleclient "k8s.io/client-go/scale"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/controller-runtime/pkg/manager"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
appsv1beta1 "github.com/openkruise/kruise/apis/apps/v1beta1"
|
||||
apiutil "github.com/openkruise/kruise/pkg/util/api"
|
||||
"github.com/openkruise/kruise/pkg/util/configuration"
|
||||
)
|
||||
|
||||
var Finder *ControllerFinder
|
||||
|
|
|
@ -20,9 +20,6 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
utilclient "github.com/openkruise/kruise/pkg/util/client"
|
||||
"github.com/openkruise/kruise/pkg/util/fieldindex"
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
@ -31,6 +28,10 @@ import (
|
|||
"k8s.io/klog/v2"
|
||||
kubecontroller "k8s.io/kubernetes/pkg/controller"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
utilclient "github.com/openkruise/kruise/pkg/util/client"
|
||||
"github.com/openkruise/kruise/pkg/util/fieldindex"
|
||||
)
|
||||
|
||||
// GetPodsForRef return target workload's podList and spec.replicas.
|
||||
|
|
|
@ -22,14 +22,15 @@ import (
|
|||
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
|
||||
"github.com/openkruise/kruise/apis"
|
||||
"github.com/openkruise/kruise/pkg/client"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"k8s.io/client-go/util/retry"
|
||||
"k8s.io/klog/v2"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client/apiutil"
|
||||
|
||||
"github.com/openkruise/kruise/apis"
|
||||
"github.com/openkruise/kruise/pkg/client"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -5,8 +5,9 @@ import (
|
|||
"reflect"
|
||||
"testing"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
)
|
||||
|
||||
func TestIndexSidecarSet(t *testing.T) {
|
||||
|
|
|
@ -20,8 +20,6 @@ import (
|
|||
"reflect"
|
||||
"testing"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
apps "k8s.io/api/apps/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
@ -29,6 +27,9 @@ import (
|
|||
"k8s.io/apimachinery/pkg/util/uuid"
|
||||
"k8s.io/kubernetes/pkg/controller/history"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client/fake"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
)
|
||||
|
||||
func TestRevisionHistory(t *testing.T) {
|
||||
|
|
|
@ -22,11 +22,6 @@ import (
|
|||
"sort"
|
||||
"sync"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
sortingcontrol "github.com/openkruise/kruise/pkg/control/sorting"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
utilclient "github.com/openkruise/kruise/pkg/util/client"
|
||||
"github.com/openkruise/kruise/pkg/util/fieldindex"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
@ -37,6 +32,12 @@ import (
|
|||
kubecontroller "k8s.io/kubernetes/pkg/controller"
|
||||
"k8s.io/kubernetes/pkg/util/slice"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
sortingcontrol "github.com/openkruise/kruise/pkg/control/sorting"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
utilclient "github.com/openkruise/kruise/pkg/util/client"
|
||||
"github.com/openkruise/kruise/pkg/util/fieldindex"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -21,9 +21,6 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
appspub "github.com/openkruise/kruise/apis/apps/pub"
|
||||
"github.com/openkruise/kruise/pkg/util/podadapter"
|
||||
"github.com/openkruise/kruise/pkg/util/podreadiness"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
coreinformers "k8s.io/client-go/informers/core/v1"
|
||||
|
@ -31,6 +28,10 @@ import (
|
|||
"k8s.io/klog/v2"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
|
||||
|
||||
appspub "github.com/openkruise/kruise/apis/apps/pub"
|
||||
"github.com/openkruise/kruise/pkg/util/podadapter"
|
||||
"github.com/openkruise/kruise/pkg/util/podreadiness"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -20,14 +20,15 @@ import (
|
|||
"context"
|
||||
"strings"
|
||||
|
||||
appsalphav1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
utilclient "github.com/openkruise/kruise/pkg/util/client"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/klog/v2"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
appsalphav1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
utilclient "github.com/openkruise/kruise/pkg/util/client"
|
||||
)
|
||||
|
||||
func GetPodProbeMarkerForPod(reader client.Reader, pod *corev1.Pod) ([]*appsalphav1.PodProbeMarker, error) {
|
||||
|
|
|
@ -19,10 +19,11 @@ package podreadiness
|
|||
import (
|
||||
"sort"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
|
||||
appspub "github.com/openkruise/kruise/apis/apps/pub"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
"github.com/openkruise/kruise/pkg/util/podadapter"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
)
|
||||
|
||||
type Interface interface {
|
||||
|
|
|
@ -19,12 +19,13 @@ package podreadiness
|
|||
import (
|
||||
"encoding/json"
|
||||
|
||||
appspub "github.com/openkruise/kruise/apis/apps/pub"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
"github.com/openkruise/kruise/pkg/util/podadapter"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/util/retry"
|
||||
|
||||
appspub "github.com/openkruise/kruise/apis/apps/pub"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
"github.com/openkruise/kruise/pkg/util/podadapter"
|
||||
)
|
||||
|
||||
func addNotReadyKey(adp podadapter.Adapter, pod *v1.Pod, msg Message, condType v1.PodConditionType) error {
|
||||
|
|
|
@ -23,7 +23,6 @@ import (
|
|||
"reflect"
|
||||
"sync"
|
||||
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
|
@ -31,6 +30,8 @@ import (
|
|||
utilerrors "k8s.io/apimachinery/pkg/util/errors"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
|
||||
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
)
|
||||
|
||||
// RefManager provides the method to
|
||||
|
|
|
@ -19,12 +19,13 @@ package revision
|
|||
import (
|
||||
"strings"
|
||||
|
||||
apps "k8s.io/api/apps/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
|
||||
appspub "github.com/openkruise/kruise/apis/apps/pub"
|
||||
"github.com/openkruise/kruise/pkg/features"
|
||||
utilfeature "github.com/openkruise/kruise/pkg/util/feature"
|
||||
"github.com/openkruise/kruise/pkg/util/lifecycle"
|
||||
apps "k8s.io/api/apps/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
)
|
||||
|
||||
// IsPodUpdate return true when:
|
||||
|
|
|
@ -19,12 +19,13 @@ package revision
|
|||
import (
|
||||
"testing"
|
||||
|
||||
appspub "github.com/openkruise/kruise/apis/apps/pub"
|
||||
"github.com/openkruise/kruise/pkg/features"
|
||||
utilfeature "github.com/openkruise/kruise/pkg/util/feature"
|
||||
apps "k8s.io/api/apps/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
appspub "github.com/openkruise/kruise/apis/apps/pub"
|
||||
"github.com/openkruise/kruise/pkg/features"
|
||||
utilfeature "github.com/openkruise/kruise/pkg/util/feature"
|
||||
)
|
||||
|
||||
func TestIsPodUpdate(t *testing.T) {
|
||||
|
|
|
@ -4,11 +4,12 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
|
||||
daemonutil "github.com/openkruise/kruise/pkg/daemon/util"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/klog/v2"
|
||||
"k8s.io/kubernetes/pkg/credentialprovider"
|
||||
credentialprovidersecrets "k8s.io/kubernetes/pkg/credentialprovider/secrets"
|
||||
|
||||
daemonutil "github.com/openkruise/kruise/pkg/daemon/util"
|
||||
)
|
||||
|
||||
func AuthInfos(ctx context.Context, imageName, tag string, pullSecrets []corev1.Secret) []daemonutil.AuthInfo {
|
||||
|
|
|
@ -20,11 +20,12 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
)
|
||||
|
||||
func IsSpecifiedDelete(obj metav1.Object) bool {
|
||||
|
|
|
@ -20,10 +20,11 @@ import (
|
|||
"sort"
|
||||
"strconv"
|
||||
|
||||
appspub "github.com/openkruise/kruise/apis/apps/pub"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
|
||||
appspub "github.com/openkruise/kruise/apis/apps/pub"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
)
|
||||
|
||||
type prioritySort struct {
|
||||
|
|
|
@ -19,8 +19,9 @@ package updatesort
|
|||
import (
|
||||
"testing"
|
||||
|
||||
appspub "github.com/openkruise/kruise/apis/apps/pub"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
appspub "github.com/openkruise/kruise/apis/apps/pub"
|
||||
)
|
||||
|
||||
func TestCompare(t *testing.T) {
|
||||
|
|
|
@ -20,8 +20,9 @@ import (
|
|||
"math"
|
||||
"sort"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
)
|
||||
|
||||
type scatterSort struct {
|
||||
|
|
|
@ -22,9 +22,10 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
)
|
||||
|
||||
func TestGenerateRules(t *testing.T) {
|
||||
|
|
|
@ -20,9 +20,10 @@ import (
|
|||
"testing"
|
||||
|
||||
fuzz "github.com/AdaLogics/go-fuzz-headers"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
fuzzutils "github.com/openkruise/kruise/test/fuzz"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
)
|
||||
|
||||
func FuzzNestedField(f *testing.F) {
|
||||
|
|
|
@ -22,10 +22,11 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
intstrutil "k8s.io/apimachinery/pkg/util/intstr"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
)
|
||||
|
||||
func hasPercentSubset(ws *appsv1alpha1.WorkloadSpread) (has bool) {
|
||||
|
|
|
@ -4,11 +4,12 @@ import (
|
|||
"reflect"
|
||||
"testing"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
intstrutil "k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/utils/ptr"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
)
|
||||
|
||||
func TestNestedField(t *testing.T) {
|
||||
|
|
|
@ -44,6 +44,8 @@ import (
|
|||
kubecontroller "k8s.io/kubernetes/pkg/controller"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
appsv1beta1 "github.com/openkruise/kruise/apis/apps/v1beta1"
|
||||
kubeClient "github.com/openkruise/kruise/pkg/client"
|
||||
|
@ -51,7 +53,6 @@ import (
|
|||
"github.com/openkruise/kruise/pkg/util"
|
||||
utilclient "github.com/openkruise/kruise/pkg/util/client"
|
||||
"github.com/openkruise/kruise/pkg/util/configuration"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -26,7 +26,6 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/openkruise/kruise/pkg/util/configuration"
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
batchv1 "k8s.io/api/batch/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
|
@ -47,6 +46,8 @@ import (
|
|||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client/fake"
|
||||
|
||||
"github.com/openkruise/kruise/pkg/util/configuration"
|
||||
|
||||
appspub "github.com/openkruise/kruise/apis/apps/pub"
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
appsv1beta1 "github.com/openkruise/kruise/apis/apps/v1beta1"
|
||||
|
|
|
@ -75,11 +75,11 @@ func (h *AdvancedCronJobCreateUpdateHandler) Handle(ctx context.Context, req adm
|
|||
if reflect.DeepEqual(obj, copy) {
|
||||
return admission.Allowed("")
|
||||
}
|
||||
marshalled, err := json.Marshal(obj)
|
||||
marshaled, err := json.Marshal(obj)
|
||||
if err != nil {
|
||||
return admission.Errored(http.StatusInternalServerError, err)
|
||||
}
|
||||
return admission.PatchResponseFromRaw(req.AdmissionRequest.Object.Raw, marshalled)
|
||||
return admission.PatchResponseFromRaw(req.AdmissionRequest.Object.Raw, marshaled)
|
||||
}
|
||||
|
||||
//var _ inject.Client = &BroadcastJobCreateUpdateHandler{}
|
||||
|
|
|
@ -23,9 +23,10 @@ import (
|
|||
|
||||
batchv1 "k8s.io/api/batch/v1"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"k8s.io/apimachinery/pkg/util/validation/field"
|
||||
"k8s.io/utils/pointer"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
)
|
||||
|
||||
func TestValidateCronJobSpec(t *testing.T) {
|
||||
|
|
|
@ -75,11 +75,11 @@ func (h *BroadcastJobCreateUpdateHandler) Handle(ctx context.Context, req admiss
|
|||
return admission.Allowed("")
|
||||
}
|
||||
|
||||
marshalled, err := json.Marshal(obj)
|
||||
marshaled, err := json.Marshal(obj)
|
||||
if err != nil {
|
||||
return admission.Errored(http.StatusInternalServerError, err)
|
||||
}
|
||||
return admission.PatchResponseFromRaw(req.AdmissionRequest.Object.Raw, marshalled)
|
||||
return admission.PatchResponseFromRaw(req.AdmissionRequest.Object.Raw, marshaled)
|
||||
}
|
||||
|
||||
//var _ inject.Client = &BroadcastJobCreateUpdateHandler{}
|
||||
|
|
|
@ -19,11 +19,12 @@ package validating
|
|||
import (
|
||||
"testing"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/stretchr/testify/assert"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/validation/field"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
)
|
||||
|
||||
var valInt32 int32 = 1
|
||||
|
|
|
@ -71,11 +71,11 @@ func (h *CloneSetCreateUpdateHandler) Handle(ctx context.Context, req admission.
|
|||
if reflect.DeepEqual(obj, copy) {
|
||||
return admission.Allowed("")
|
||||
}
|
||||
marshalled, err := json.Marshal(obj)
|
||||
marshaled, err := json.Marshal(obj)
|
||||
if err != nil {
|
||||
return admission.Errored(http.StatusInternalServerError, err)
|
||||
}
|
||||
resp := admission.PatchResponseFromRaw(req.AdmissionRequest.Object.Raw, marshalled)
|
||||
resp := admission.PatchResponseFromRaw(req.AdmissionRequest.Object.Raw, marshaled)
|
||||
if len(resp.Patches) > 0 {
|
||||
klog.V(5).InfoS("Admit CloneSet patches", "namespace", obj.Namespace, "name", obj.Name, "patches", util.DumpJSON(resp.Patches))
|
||||
}
|
||||
|
|
|
@ -140,11 +140,11 @@ func (h *ContainerRecreateRequestHandler) Handle(ctx context.Context, req admiss
|
|||
if reflect.DeepEqual(obj, copy) {
|
||||
return admission.Allowed("")
|
||||
}
|
||||
marshalled, err := json.Marshal(obj)
|
||||
marshaled, err := json.Marshal(obj)
|
||||
if err != nil {
|
||||
return admission.Errored(http.StatusInternalServerError, err)
|
||||
}
|
||||
return admission.PatchResponseFromRaw(req.AdmissionRequest.Object.Raw, marshalled)
|
||||
return admission.PatchResponseFromRaw(req.AdmissionRequest.Object.Raw, marshaled)
|
||||
}
|
||||
|
||||
func isTerminatedBySidecarTerminator(pod *v1.Pod) bool {
|
||||
|
|
|
@ -58,11 +58,11 @@ func (h *DaemonSetCreateUpdateHandler) Handle(ctx context.Context, req admission
|
|||
if reflect.DeepEqual(obj, copy) {
|
||||
return admission.Allowed("")
|
||||
}
|
||||
marshalled, err := json.Marshal(obj)
|
||||
marshaled, err := json.Marshal(obj)
|
||||
if err != nil {
|
||||
return admission.Errored(http.StatusInternalServerError, err)
|
||||
}
|
||||
resp := admission.PatchResponseFromRaw(req.AdmissionRequest.Object.Raw, marshalled)
|
||||
resp := admission.PatchResponseFromRaw(req.AdmissionRequest.Object.Raw, marshaled)
|
||||
if len(resp.Patches) > 0 {
|
||||
klog.V(5).InfoS("Admit DaemonSet patches", "namespace", obj.Namespace, "name", obj.Name, "patches", util.DumpJSON(resp.Patches))
|
||||
}
|
||||
|
|
|
@ -51,11 +51,11 @@ func (h *ImageListPullJobCreateUpdateHandler) Handle(ctx context.Context, req ad
|
|||
if reflect.DeepEqual(obj, copy) {
|
||||
return admission.Allowed("")
|
||||
}
|
||||
marshalled, err := json.Marshal(obj)
|
||||
marshaled, err := json.Marshal(obj)
|
||||
if err != nil {
|
||||
return admission.Errored(http.StatusInternalServerError, err)
|
||||
}
|
||||
resp := admission.PatchResponseFromRaw(req.AdmissionRequest.Object.Raw, marshalled)
|
||||
resp := admission.PatchResponseFromRaw(req.AdmissionRequest.Object.Raw, marshaled)
|
||||
if len(resp.Patches) > 0 {
|
||||
klog.V(5).InfoS("Admit ImageListPullJob patches", "name", obj.Name, "patches", util.DumpJSON(resp.Patches))
|
||||
}
|
||||
|
|
|
@ -52,11 +52,11 @@ func (h *ImagePullJobCreateUpdateHandler) Handle(ctx context.Context, req admiss
|
|||
if reflect.DeepEqual(obj, copy) {
|
||||
return admission.Allowed("")
|
||||
}
|
||||
marshalled, err := json.Marshal(obj)
|
||||
marshaled, err := json.Marshal(obj)
|
||||
if err != nil {
|
||||
return admission.Errored(http.StatusInternalServerError, err)
|
||||
}
|
||||
resp := admission.PatchResponseFromRaw(req.AdmissionRequest.Object.Raw, marshalled)
|
||||
resp := admission.PatchResponseFromRaw(req.AdmissionRequest.Object.Raw, marshaled)
|
||||
if len(resp.Patches) > 0 {
|
||||
klog.V(5).InfoS("Admit ImagePullJob patches", "name", obj.Name, "patches", util.DumpJSON(resp.Patches))
|
||||
}
|
||||
|
|
|
@ -21,15 +21,16 @@ import (
|
|||
"fmt"
|
||||
"net/http"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
daemonutil "github.com/openkruise/kruise/pkg/daemon/util"
|
||||
"github.com/openkruise/kruise/pkg/features"
|
||||
utilfeature "github.com/openkruise/kruise/pkg/util/feature"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
"k8s.io/klog/v2"
|
||||
utilpointer "k8s.io/utils/pointer"
|
||||
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
daemonutil "github.com/openkruise/kruise/pkg/daemon/util"
|
||||
"github.com/openkruise/kruise/pkg/features"
|
||||
utilfeature "github.com/openkruise/kruise/pkg/util/feature"
|
||||
)
|
||||
|
||||
// ImagePullJobCreateUpdateHandler handles ImagePullJob
|
||||
|
|
|
@ -63,11 +63,11 @@ func (h *NodeImageCreateUpdateHandler) Handle(ctx context.Context, req admission
|
|||
if reflect.DeepEqual(obj, copy) {
|
||||
return admission.Allowed("")
|
||||
}
|
||||
marshalled, err := json.Marshal(obj)
|
||||
marshaled, err := json.Marshal(obj)
|
||||
if err != nil {
|
||||
return admission.Errored(http.StatusInternalServerError, err)
|
||||
}
|
||||
resp := admission.PatchResponseFromRaw(req.AdmissionRequest.Object.Raw, marshalled)
|
||||
resp := admission.PatchResponseFromRaw(req.AdmissionRequest.Object.Raw, marshaled)
|
||||
if len(resp.Patches) > 0 {
|
||||
klog.V(5).InfoS("Admit NodeImage patches", "name", obj.Name, "patches", util.DumpJSON(resp.Patches))
|
||||
}
|
||||
|
|
|
@ -19,16 +19,17 @@ package mutating
|
|||
import (
|
||||
"context"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
utilclient "github.com/openkruise/kruise/pkg/util/client"
|
||||
"github.com/openkruise/kruise/pkg/util/configuration"
|
||||
admissionv1 "k8s.io/api/admission/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/klog/v2"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
utilclient "github.com/openkruise/kruise/pkg/util/client"
|
||||
"github.com/openkruise/kruise/pkg/util/configuration"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -120,7 +120,7 @@ func (h *PodCreateHandler) Handle(ctx context.Context, req admission.Request) ad
|
|||
if !changed {
|
||||
return admission.Allowed("")
|
||||
}
|
||||
marshalled, err := json.Marshal(obj)
|
||||
marshaled, err := json.Marshal(obj)
|
||||
if err != nil {
|
||||
return admission.Errored(http.StatusInternalServerError, err)
|
||||
}
|
||||
|
@ -128,5 +128,5 @@ func (h *PodCreateHandler) Handle(ctx context.Context, req admission.Request) ad
|
|||
if err != nil {
|
||||
return admission.Errored(http.StatusInternalServerError, err)
|
||||
}
|
||||
return admission.PatchResponseFromRaw(original, marshalled)
|
||||
return admission.PatchResponseFromRaw(original, marshaled)
|
||||
}
|
||||
|
|
|
@ -21,14 +21,15 @@ import (
|
|||
"fmt"
|
||||
"strings"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
"github.com/openkruise/kruise/pkg/util/podprobemarker"
|
||||
admissionv1 "k8s.io/api/admission/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/klog/v2"
|
||||
"k8s.io/kube-openapi/pkg/util/sets"
|
||||
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
|
||||
|
||||
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
|
||||
"github.com/openkruise/kruise/pkg/util"
|
||||
"github.com/openkruise/kruise/pkg/util/podprobemarker"
|
||||
)
|
||||
|
||||
// mutating relate-pub annotation in pod
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue