Skip to content

Commit

Permalink
Merge branch 'indent-namespaceselector' into helm-and-securitycontext
Browse files Browse the repository at this point in the history
  • Loading branch information
rhaps0dy committed Apr 30, 2024
2 parents a4b1877 + 4ad3d09 commit 553ca6a
Show file tree
Hide file tree
Showing 150 changed files with 4,142 additions and 2,080 deletions.
26 changes: 25 additions & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ linters-settings:
- assignOp
- captLocal
- commentFormatting
- deprecatedComment
- elseif
- exitAfterDefer
- ifElseChain
Expand All @@ -20,6 +19,24 @@ linters-settings:
govet:
enable:
- nilness
gci:
# Section configuration to compare against.
# Section names are case-insensitive and may contain parameters in ().
# The default order of sections is `standard > default > custom > blank > dot > alias`,
# If `custom-order` is `true`, it follows the order of `sections` option.
# Default: ["standard", "default"]
sections:
- standard # Standard section: captures all standard packages.
- default # Default section: contains all imports that could not be matched to another section type.
- prefix(sigs.k8s.io/kueue) # Custom section: groups all imports with the specified Prefix.
# Skip generated files.
# Default: true
skip-generated: true
# Enable custom order of sections.
# If `true`, make the section order the same as the order of `sections`.
# Default: false
custom-order: true


# Settings for enabling and disabling linters
linters:
Expand All @@ -30,6 +47,7 @@ linters:
- gocritic
- goimports
- govet
- loggercheck
- misspell
- unconvert

Expand All @@ -38,6 +56,12 @@ issues:
# Which dirs to exclude: issues from them won't be reported
exclude-dirs:
- bin
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
- linters:
- staticcheck
# TODO(#768): Drop when incrementing the API version.
text: "SA1019: constants.QueueAnnotation is deprecated"
# Show all issues from a linter
max-issues-per-linter: 0
# Show all issues with the same text
Expand Down
54 changes: 34 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,15 @@ run-test-multikueue-e2e-%: FORCE
@echo Running multikueue e2e for k8s ${K8S_VERSION}
E2E_KIND_VERSION="kindest/node:v$(K8S_VERSION)" KIND_CLUSTER_NAME=$(KIND_CLUSTER_NAME) CREATE_KIND_CLUSTER=$(CREATE_KIND_CLUSTER) ARTIFACTS="$(ARTIFACTS)/$@" IMAGE_TAG=$(IMAGE_TAG) GINKGO_ARGS="$(GINKGO_ARGS)" JOBSET_VERSION=$(JOBSET_VERSION) ./hack/multikueue-e2e-test.sh

SCALABILITY_RUNNER := $(ARTIFACTS)/scalability-runner
.PHONY: scalability-runner
scalability-runner:
$(GO_BUILD_ENV) $(GO_CMD) build -ldflags="$(LD_FLAGS)" -o $(SCALABILITY_RUNNER) test/scalability/runner/main.go
SCALABILITY_RUNNER := $(PROJECT_DIR)/bin/performance-scheduler-runner
.PHONY: performance-scheduler-runner
performance-scheduler-runner:
$(GO_BUILD_ENV) $(GO_CMD) build -ldflags="$(LD_FLAGS)" -o $(SCALABILITY_RUNNER) test/performance/scheduler/runner/main.go

MINIMALKUEUE_RUNNER := $(PROJECT_DIR)/bin/minimalkueue
.PHONY: minimalkueue
minimalkueue:
$(GO_BUILD_ENV) $(GO_CMD) build -ldflags="$(LD_FLAGS)" -o $(ARTIFACTS)/minimalkueue test/scalability/minimalkueue/main.go
$(GO_BUILD_ENV) $(GO_CMD) build -ldflags="$(LD_FLAGS)" -o $(MINIMALKUEUE_RUNNER) test/performance/scheduler/minimalkueue/main.go

ifdef SCALABILITY_CPU_PROFILE
SCALABILITY_EXTRA_ARGS += --withCPUProfile=true
Expand All @@ -230,38 +231,51 @@ ifdef SCALABILITY_KUEUE_LOGS
SCALABILITY_EXTRA_ARGS += --withLogs=true --logToFile=true
endif

SCALABILITY_GENERATOR_CONFIG ?= $(PROJECT_DIR)/test/scalability/default_generator_config.yaml
ifdef SCALABILITY_SCRAPE_INTERVAL
SCALABILITY_SCRAPE_ARGS += --metricsScrapeInterval=$(SCALABILITY_SCRAPE_INTERVAL)
endif

ifdef SCALABILITY_SCRAPE_URL
SCALABILITY_SCRAPE_ARGS += --metricsScrapeURL=$(SCALABILITY_SCRAPE_URL)
endif

SCALABILITY_RUN_DIR := $(ARTIFACTS)/run-scalability
.PHONY: run-scalability
run-scalability: envtest scalability-runner minimalkueue
SCALABILITY_GENERATOR_CONFIG ?= $(PROJECT_DIR)/test/performance/scheduler/default_generator_config.yaml

SCALABILITY_RUN_DIR := $(ARTIFACTS)/run-performance-scheduler
.PHONY: run-performance-scheduler
run-performance-scheduler: envtest performance-scheduler-runner minimalkueue
mkdir -p $(SCALABILITY_RUN_DIR)
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" \
$(SCALABILITY_RUNNER) \
--o $(SCALABILITY_RUN_DIR) \
--crds=$(PROJECT_DIR)/config/components/crd/bases \
--generatorConfig=$(SCALABILITY_GENERATOR_CONFIG) \
--minimalKueue=$(ARTIFACTS)/minimalkueue $(SCALABILITY_EXTRA_ARGS)
--minimalKueue=$(MINIMALKUEUE_RUNNER) $(SCALABILITY_EXTRA_ARGS) $(SCALABILITY_SCRAPE_ARGS)

.PHONY: test-scalability
test-scalability: gotestsum run-scalability
$(GOTESTSUM) --junitfile $(ARTIFACTS)/junit.xml -- $(GO_TEST_FLAGS) ./test/scalability/checker \
.PHONY: test-performance-scheduler
test-performance-scheduler: gotestsum run-performance-scheduler
$(GOTESTSUM) --junitfile $(ARTIFACTS)/junit.xml -- $(GO_TEST_FLAGS) ./test/performance/scheduler/checker \
--summary=$(SCALABILITY_RUN_DIR)/summary.yaml \
--cmdStats=$(SCALABILITY_RUN_DIR)/minimalkueue.stats.yaml \
--range=$(PROJECT_DIR)/test/scalability/default_rangespec.yaml
--range=$(PROJECT_DIR)/test/performance/scheduler/default_rangespec.yaml

.PHONY: run-scalability-in-cluster
run-scalability-in-cluster: envtest scalability-runner
mkdir -p $(ARTIFACTS)/run-scalability-in-cluster
.PHONY: run-performance-scheduler-in-cluster
run-performance-scheduler-in-cluster: envtest performance-scheduler-runner
mkdir -p $(ARTIFACTS)/run-performance-scheduler-in-cluster
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" \
$(SCALABILITY_RUNNER) \
--o $(ARTIFACTS)/run-scalability-in-cluster \
--o $(ARTIFACTS)/run-performance-scheduler-in-cluster \
--generatorConfig=$(SCALABILITY_GENERATOR_CONFIG) \
--qps=1000 --burst=2000 --timeout=15m
--qps=1000 --burst=2000 --timeout=15m $(SCALABILITY_SCRAPE_ARGS)

.PHONY: ci-lint
ci-lint: golangci-lint
$(GOLANGCI_LINT) run --timeout 15m0s

.PHONY: lint-fix
lint-fix: golangci-lint
$(GOLANGCI_LINT) run --fix --timeout 15m0s

.PHONY: verify
verify: gomod-verify ci-lint fmt-verify shell-lint toc-verify manifests generate update-helm generate-apiref prepare-release-branch
git --no-pager diff --exit-code config/components apis charts/kueue/templates client-go site/
Expand Down Expand Up @@ -497,4 +511,4 @@ cluster-autoscaler-crd:

.PHONY: generate-apiref
generate-apiref: genref
cd $(PROJECT_DIR)/site/genref/ && $(GENREF) -o $(PROJECT_DIR)/site/content/en/docs/reference
cd $(PROJECT_DIR)/hack/genref/ && $(GENREF) -o $(PROJECT_DIR)/site/content/en/docs/reference
21 changes: 16 additions & 5 deletions apis/config/v1beta1/configuration_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,16 +238,24 @@ type RequeuingStrategy struct {
// Once the number is reached, the workload is deactivated (`.spec.activate`=`false`).
// When it is null, the workloads will repeatedly and endless re-queueing.
//
// Every backoff duration is about "1.41284738^(n-1)+Rand" where the "n" represents the "workloadStatus.requeueState.count",
// and the "Rand" represents the random jitter. During this time, the workload is taken as an inadmissible and
// Every backoff duration is about "b*2^(n-1)+Rand" where:
// - "b" represents the base set by "BackoffBaseSeconds" parameter,
// - "n" represents the "workloadStatus.requeueState.count",
// - "Rand" represents the random jitter.
// During this time, the workload is taken as an inadmissible and
// other workloads will have a chance to be admitted.
// For example, when the "waitForPodsReady.timeout" is the default, the workload deactivation time is as follows:
// {backoffLimitCount, workloadDeactivationSeconds}
// ~= {1, 601}, {2, 902}, ...,{5, 1811}, ...,{10, 3374}, ...,{20, 8730}, ...,{30, 86400(=24 hours)}, ...
// By default, the consecutive requeue delays are around: (10s, 20s, 40s, ...).
//
// Defaults to null.
// +optional
BackoffLimitCount *int32 `json:"backoffLimitCount,omitempty"`

// BackoffBaseSeconds defines the base for the exponential backoff for
// re-queuing an evicted workload.
//
// Defaults to 10.
// +optional
BackoffBaseSeconds *int32 `json:"backoffBaseSeconds,omitempty"`
}

type RequeuingTimestamp string
Expand Down Expand Up @@ -299,6 +307,9 @@ type Integrations struct {
// - "kubeflow.org/xgboostjob"
// - "pod"
Frameworks []string `json:"frameworks,omitempty"`
// List of GroupVersionKinds that are managed for Kueue by external controllers;
// the expected format is `Kind.version.group.com`.
ExternalFrameworks []string `json:"externalFrameworks,omitempty"`
// PodOptions defines kueue controller behaviour for pod objects
PodOptions *PodIntegrationOptions `json:"podOptions,omitempty"`

Expand Down
13 changes: 9 additions & 4 deletions apis/config/v1beta1/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const (
DefaultMultiKueueGCInterval = time.Minute
DefaultMultiKueueOrigin = "multikueue"
DefaultMultiKueueWorkerLostTimeout = 15 * time.Minute
DefaultRequeuingBackoffBaseSeconds = 10
)

func getOperatorNamespace() string {
Expand Down Expand Up @@ -121,10 +122,14 @@ func SetDefaults_Configuration(cfg *Configuration) {
}
cfg.WaitForPodsReady.BlockAdmission = &defaultBlockAdmission
}
if cfg.WaitForPodsReady.RequeuingStrategy == nil || cfg.WaitForPodsReady.RequeuingStrategy.Timestamp == nil {
cfg.WaitForPodsReady.RequeuingStrategy = &RequeuingStrategy{
Timestamp: ptr.To(EvictionTimestamp),
}
if cfg.WaitForPodsReady.RequeuingStrategy == nil {
cfg.WaitForPodsReady.RequeuingStrategy = &RequeuingStrategy{}
}
if cfg.WaitForPodsReady.RequeuingStrategy.Timestamp == nil {
cfg.WaitForPodsReady.RequeuingStrategy.Timestamp = ptr.To(EvictionTimestamp)
}
if cfg.WaitForPodsReady.RequeuingStrategy.BackoffBaseSeconds == nil {
cfg.WaitForPodsReady.RequeuingStrategy.BackoffBaseSeconds = ptr.To[int32](DefaultRequeuingBackoffBaseSeconds)
}
}
if cfg.Integrations == nil {
Expand Down
12 changes: 8 additions & 4 deletions apis/config/v1beta1/defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,8 @@ func TestSetDefaults_Configuration(t *testing.T) {
BlockAdmission: ptr.To(true),
Timeout: &podsReadyTimeoutTimeout,
RequeuingStrategy: &RequeuingStrategy{
Timestamp: ptr.To(EvictionTimestamp),
Timestamp: ptr.To(EvictionTimestamp),
BackoffBaseSeconds: ptr.To[int32](DefaultRequeuingBackoffBaseSeconds),
},
},
Namespace: ptr.To(DefaultNamespace),
Expand Down Expand Up @@ -393,7 +394,8 @@ func TestSetDefaults_Configuration(t *testing.T) {
BlockAdmission: ptr.To(false),
Timeout: &podsReadyTimeoutTimeout,
RequeuingStrategy: &RequeuingStrategy{
Timestamp: ptr.To(EvictionTimestamp),
Timestamp: ptr.To(EvictionTimestamp),
BackoffBaseSeconds: ptr.To[int32](DefaultRequeuingBackoffBaseSeconds),
},
},
Namespace: ptr.To(DefaultNamespace),
Expand All @@ -413,7 +415,8 @@ func TestSetDefaults_Configuration(t *testing.T) {
Enable: true,
Timeout: &podsReadyTimeoutOverwrite,
RequeuingStrategy: &RequeuingStrategy{
Timestamp: ptr.To(CreationTimestamp),
Timestamp: ptr.To(CreationTimestamp),
BackoffBaseSeconds: ptr.To[int32](63),
},
},
InternalCertManagement: &InternalCertManagement{
Expand All @@ -426,7 +429,8 @@ func TestSetDefaults_Configuration(t *testing.T) {
BlockAdmission: ptr.To(true),
Timeout: &podsReadyTimeoutOverwrite,
RequeuingStrategy: &RequeuingStrategy{
Timestamp: ptr.To(CreationTimestamp),
Timestamp: ptr.To(CreationTimestamp),
BackoffBaseSeconds: ptr.To[int32](63),
},
},
Namespace: ptr.To(DefaultNamespace),
Expand Down
10 changes: 10 additions & 0 deletions apis/config/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions apis/kueue/v1beta1/admissioncheck_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ const (
// Having multiple AdmissionChecks managed by the same controller where at least one has this condition
// set to true will cause the ClusterQueue to be marked as Inactive.
AdmissionChecksSingleInstanceInClusterQueue string = "SingleInstanceInClusterQueue"

// FlavorIndependentAdmissionCheck indicates if the AdmissionCheck cannot be applied at ResourceFlavor level.
FlavorIndependentAdmissionCheck string = "FlavorIndependent"
)

// +genclient
Expand Down
Loading

0 comments on commit 553ca6a

Please sign in to comment.