[pull] master from kubernetes:master#2305
Merged
pull[bot] merged 33 commits intohttpsgithu:masterfrom Mar 14, 2025
Merged
Conversation
Signed-off-by: xin.li <xin.li@daocloud.io>
NewTypedDelayingQueueWithConfig spawns a goroutine, but apparently shutdown is already handled somehow. Therefore only the option to set a logger gets added to the Config struct. The problem then becomes that developers might forget to set that logger. logcheck can't detect that. For now, all in-tree users get updated immediately.
Remove manual default: ``` $ git diff diff --git a/pkg/apis/core/v1/defaults.go b/pkg/apis/core/v1/defaults.go index e66de8b..1dd28dd35fb 100644 --- a/pkg/apis/core/v1/defaults.go +++ b/pkg/apis/core/v1/defaults.go @@ -60,10 +60,6 @@ func SetDefaults_ReplicationController(obj *v1.ReplicationController) { obj.Labels = labels } } - if obj.Spec.Replicas == nil { - obj.Spec.Replicas = new(int32) - *obj.Spec.Replicas = 1 - } } func SetDefaults_Volume(obj *v1.Volume) { if ptr.AllPtrFieldsNil(&obj.VolumeSource) { ``` The test fails: ``` $ go test ./pkg/apis/core/v1 | grep -v gate | grep -v SetEmulationVersion --- FAIL: TestSetDefaultReplicationControllerReplicas (0.00s) defaults_test.go:1608: expected: 1 replicas, got: 0 FAIL FAIL k8s.io/kubernetes/pkg/apis/core/v1 0.269s FAIL ``` Declare the default, update codegen and re-run the test: ``` $ git diff diff --git a/staging/src/k8s.io/api/core/v1/types.go b/staging/src/k8s.io/api/core/v1/types.go index 406ab56..7e5136f 100644 --- a/staging/src/k8s.io/api/core/v1/types.go +++ b/staging/src/k8s.io/api/core/v1/types.go @@ -5101,6 +5101,7 @@ type ReplicationControllerSpec struct { // Defaults to 1. // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#what-is-a-replicationcontroller // +optional + // +default=1 // +k8s:minimum=0 Replicas *int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"` $ ./hack/update-codegen.sh default +++ [1219 08:58:43] Generating defaulter code for 102 targets $ git diff diff --git a/pkg/apis/core/v1/zz_generated.defaults.go b/pkg/apis/core/v1/zz_generated.defaults.go index 3b6eb4f..567c490 100644 --- a/pkg/apis/core/v1/zz_generated.defaults.go +++ b/pkg/apis/core/v1/zz_generated.defaults.go @@ -878,6 +878,10 @@ func SetObjectDefaults_PodTemplateList(in *corev1.PodTemplateList) { func SetObjectDefaults_ReplicationController(in *corev1.ReplicationController) { SetDefaults_ReplicationController(in) + if in.Spec.Replicas == nil { + var ptrVar1 int32 = 1 + in.Spec.Replicas = &ptrVar1 + } if in.Spec.Template != nil { SetDefaults_PodSpec(&in.Spec.Template.Spec) for i := range in.Spec.Template.Spec.Volumes { $ go test ./pkg/apis/core/v1 | grep -v gate | grep -v SetEmulationVersion ok k8s.io/kubernetes/pkg/apis/core/v1 (cached) ```
The existing test run both declarative and manual validation and it still passes.
# Conflicts: # staging/src/k8s.io/api/core/v1/types.go
+k8s:optional should be used everywhere +optional is. This does not change the vailidation of the field, but it is a good practice, and code generator recognizes the fields tags and outputs this comment above the field validation as a result: "optional value-type fields with zero-value defaults are purely documentation".
Signed-off-by: carlory <baofa.fan@daocloud.io>
abort the test in the unlikely case we fail to create the Policy object. Exactly because this is unlikely we should fail loudly. In my case this happened because unrelated bad parameters, which was hard to catch Signed-off-by: Francesco Romani <fromani@redhat.com>
There's no need to use the generic reflect.DeepEqual, we can use the cpuset Equals method in tests, which is more idiomatic and a tad clearer. Signed-off-by: Francesco Romani <fromani@redhat.com>
get nicer output for free Signed-off-by: Francesco Romani <fromani@redhat.com>
fix test name. Cosmetic only. Signed-off-by: Francesco Romani <fromani@redhat.com>
add missing metric about uncore / L3 / Last-Level cache alignment, plus its e2e tests. Exposing uncore alignment requires a bit of refactoring in the static policy implementation because, differently from full PCPUs alignment and NUMA alignment, can't be easily and safely inferred by construction. The main reason for this is that uncore cache alignment is preferred, not mandatory, thus the cpu allocator can legally use cross-uncore allocation. Because of that, the final cpuset union step can create a final cpuset which is not uncore-aligned even though all its parts are uncore-aligned. The safest way seems thus to run just a final uncore-alignment check once the final cpuset is computed. Signed-off-by: Francesco Romani <fromani@redhat.com>
Signed-off-by: Lionel Jouin <lionel.jouin@est.tech>
pkg/volume: remove unused function
client-go workqueue: add optional logger
…ions-test Removed parallel execution for test/subtest where AllocsPerRun is used
Concurrentmap Iteration
remove duplicated test on configmap volume
…s-to-declarative Migrate to declarative validation: ReplicationController spec.replicas and spec.minReadySeconds fields
node: cpumgr: metrics: add uncore cache alignment metrics
…dding_pod_to_backoffq Call PreEnqueue plugins before adding pod to backoffQ
remove unneeded e2e features
[KEP-4817] DRAResourceClaimDeviceStatus to Beta
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.1)
Can you help keep this open source service alive? 💖 Please sponsor : )