mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 05:57:25 +00:00
Merge pull request #90105 from xiaoanyunfei/cleanup/pkg_apis_core
Scheduler: remove pkg/apis/core/field_constants.go
This commit is contained in:
commit
a42ff247af
@ -28,7 +28,6 @@ import (
|
|||||||
"github.com/lithammer/dedent"
|
"github.com/lithammer/dedent"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"k8s.io/klog/v2"
|
|
||||||
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/fields"
|
"k8s.io/apimachinery/pkg/fields"
|
||||||
@ -38,6 +37,7 @@ import (
|
|||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
bootstrapapi "k8s.io/cluster-bootstrap/token/api"
|
bootstrapapi "k8s.io/cluster-bootstrap/token/api"
|
||||||
bootstraputil "k8s.io/cluster-bootstrap/token/util"
|
bootstraputil "k8s.io/cluster-bootstrap/token/util"
|
||||||
|
"k8s.io/klog/v2"
|
||||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
||||||
kubeadmapiv1beta2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta2"
|
kubeadmapiv1beta2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta2"
|
||||||
@ -367,9 +367,6 @@ func RunListTokens(out io.Writer, errW io.Writer, client clientset.Interface, pr
|
|||||||
klog.V(1).Infoln("[token] preparing selector for bootstrap token")
|
klog.V(1).Infoln("[token] preparing selector for bootstrap token")
|
||||||
tokenSelector := fields.SelectorFromSet(
|
tokenSelector := fields.SelectorFromSet(
|
||||||
map[string]string{
|
map[string]string{
|
||||||
// TODO: We hard-code "type" here until `field_constants.go` that is
|
|
||||||
// currently in `pkg/apis/core/` exists in the external API, i.e.
|
|
||||||
// k8s.io/api/v1. Should be v1.SecretTypeField
|
|
||||||
"type": string(bootstrapapi.SecretTypeBootstrapToken),
|
"type": string(bootstrapapi.SecretTypeBootstrapToken),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -239,7 +239,7 @@ func TestEncodePtr(t *testing.T) {
|
|||||||
TerminationGracePeriodSeconds: &grace,
|
TerminationGracePeriodSeconds: &grace,
|
||||||
|
|
||||||
SecurityContext: &api.PodSecurityContext{},
|
SecurityContext: &api.PodSecurityContext{},
|
||||||
SchedulerName: api.DefaultSchedulerName,
|
SchedulerName: v1.DefaultSchedulerName,
|
||||||
EnableServiceLinks: &enableServiceLinks,
|
EnableServiceLinks: &enableServiceLinks,
|
||||||
PreemptionPolicy: &preemptNever,
|
PreemptionPolicy: &preemptNever,
|
||||||
},
|
},
|
||||||
|
@ -30,7 +30,6 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/api/legacyscheme"
|
"k8s.io/kubernetes/pkg/api/legacyscheme"
|
||||||
_ "k8s.io/kubernetes/pkg/apis/apps/install"
|
_ "k8s.io/kubernetes/pkg/apis/apps/install"
|
||||||
. "k8s.io/kubernetes/pkg/apis/apps/v1"
|
. "k8s.io/kubernetes/pkg/apis/apps/v1"
|
||||||
api "k8s.io/kubernetes/pkg/apis/core"
|
|
||||||
_ "k8s.io/kubernetes/pkg/apis/core/install"
|
_ "k8s.io/kubernetes/pkg/apis/core/install"
|
||||||
utilpointer "k8s.io/utils/pointer"
|
utilpointer "k8s.io/utils/pointer"
|
||||||
)
|
)
|
||||||
@ -46,7 +45,7 @@ func TestSetDefaultDaemonSetSpec(t *testing.T) {
|
|||||||
RestartPolicy: v1.RestartPolicyAlways,
|
RestartPolicy: v1.RestartPolicyAlways,
|
||||||
SecurityContext: &v1.PodSecurityContext{},
|
SecurityContext: &v1.PodSecurityContext{},
|
||||||
TerminationGracePeriodSeconds: &period,
|
TerminationGracePeriodSeconds: &period,
|
||||||
SchedulerName: api.DefaultSchedulerName,
|
SchedulerName: v1.DefaultSchedulerName,
|
||||||
},
|
},
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: defaultLabels,
|
Labels: defaultLabels,
|
||||||
@ -58,7 +57,7 @@ func TestSetDefaultDaemonSetSpec(t *testing.T) {
|
|||||||
RestartPolicy: v1.RestartPolicyAlways,
|
RestartPolicy: v1.RestartPolicyAlways,
|
||||||
SecurityContext: &v1.PodSecurityContext{},
|
SecurityContext: &v1.PodSecurityContext{},
|
||||||
TerminationGracePeriodSeconds: &period,
|
TerminationGracePeriodSeconds: &period,
|
||||||
SchedulerName: api.DefaultSchedulerName,
|
SchedulerName: v1.DefaultSchedulerName,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
@ -186,7 +185,7 @@ func TestSetDefaultStatefulSet(t *testing.T) {
|
|||||||
RestartPolicy: v1.RestartPolicyAlways,
|
RestartPolicy: v1.RestartPolicyAlways,
|
||||||
SecurityContext: &v1.PodSecurityContext{},
|
SecurityContext: &v1.PodSecurityContext{},
|
||||||
TerminationGracePeriodSeconds: &period,
|
TerminationGracePeriodSeconds: &period,
|
||||||
SchedulerName: api.DefaultSchedulerName,
|
SchedulerName: v1.DefaultSchedulerName,
|
||||||
},
|
},
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: defaultLabels,
|
Labels: defaultLabels,
|
||||||
@ -326,7 +325,7 @@ func TestSetDefaultDeployment(t *testing.T) {
|
|||||||
RestartPolicy: v1.RestartPolicyAlways,
|
RestartPolicy: v1.RestartPolicyAlways,
|
||||||
SecurityContext: &v1.PodSecurityContext{},
|
SecurityContext: &v1.PodSecurityContext{},
|
||||||
TerminationGracePeriodSeconds: &period,
|
TerminationGracePeriodSeconds: &period,
|
||||||
SchedulerName: api.DefaultSchedulerName,
|
SchedulerName: v1.DefaultSchedulerName,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
|
@ -53,7 +53,6 @@ go_test(
|
|||||||
deps = [
|
deps = [
|
||||||
"//pkg/api/legacyscheme:go_default_library",
|
"//pkg/api/legacyscheme:go_default_library",
|
||||||
"//pkg/apis/apps/install:go_default_library",
|
"//pkg/apis/apps/install:go_default_library",
|
||||||
"//pkg/apis/core:go_default_library",
|
|
||||||
"//pkg/apis/core/install:go_default_library",
|
"//pkg/apis/core/install:go_default_library",
|
||||||
"//staging/src/k8s.io/api/apps/v1beta1:go_default_library",
|
"//staging/src/k8s.io/api/apps/v1beta1:go_default_library",
|
||||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||||
|
@ -22,14 +22,13 @@ import (
|
|||||||
|
|
||||||
appsv1beta1 "k8s.io/api/apps/v1beta1"
|
appsv1beta1 "k8s.io/api/apps/v1beta1"
|
||||||
|
|
||||||
"k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
apiequality "k8s.io/apimachinery/pkg/api/equality"
|
apiequality "k8s.io/apimachinery/pkg/api/equality"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apimachinery/pkg/util/intstr"
|
"k8s.io/apimachinery/pkg/util/intstr"
|
||||||
"k8s.io/kubernetes/pkg/api/legacyscheme"
|
"k8s.io/kubernetes/pkg/api/legacyscheme"
|
||||||
_ "k8s.io/kubernetes/pkg/apis/apps/install"
|
_ "k8s.io/kubernetes/pkg/apis/apps/install"
|
||||||
. "k8s.io/kubernetes/pkg/apis/apps/v1beta1"
|
. "k8s.io/kubernetes/pkg/apis/apps/v1beta1"
|
||||||
api "k8s.io/kubernetes/pkg/apis/core"
|
|
||||||
_ "k8s.io/kubernetes/pkg/apis/core/install"
|
_ "k8s.io/kubernetes/pkg/apis/core/install"
|
||||||
utilpointer "k8s.io/utils/pointer"
|
utilpointer "k8s.io/utils/pointer"
|
||||||
)
|
)
|
||||||
@ -44,7 +43,7 @@ func TestSetDefaultDeployment(t *testing.T) {
|
|||||||
RestartPolicy: v1.RestartPolicyAlways,
|
RestartPolicy: v1.RestartPolicyAlways,
|
||||||
SecurityContext: &v1.PodSecurityContext{},
|
SecurityContext: &v1.PodSecurityContext{},
|
||||||
TerminationGracePeriodSeconds: &period,
|
TerminationGracePeriodSeconds: &period,
|
||||||
SchedulerName: api.DefaultSchedulerName,
|
SchedulerName: v1.DefaultSchedulerName,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
|
@ -30,7 +30,6 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/api/legacyscheme"
|
"k8s.io/kubernetes/pkg/api/legacyscheme"
|
||||||
_ "k8s.io/kubernetes/pkg/apis/apps/install"
|
_ "k8s.io/kubernetes/pkg/apis/apps/install"
|
||||||
. "k8s.io/kubernetes/pkg/apis/apps/v1beta2"
|
. "k8s.io/kubernetes/pkg/apis/apps/v1beta2"
|
||||||
api "k8s.io/kubernetes/pkg/apis/core"
|
|
||||||
_ "k8s.io/kubernetes/pkg/apis/core/install"
|
_ "k8s.io/kubernetes/pkg/apis/core/install"
|
||||||
utilpointer "k8s.io/utils/pointer"
|
utilpointer "k8s.io/utils/pointer"
|
||||||
)
|
)
|
||||||
@ -46,7 +45,7 @@ func TestSetDefaultDaemonSetSpec(t *testing.T) {
|
|||||||
RestartPolicy: v1.RestartPolicyAlways,
|
RestartPolicy: v1.RestartPolicyAlways,
|
||||||
SecurityContext: &v1.PodSecurityContext{},
|
SecurityContext: &v1.PodSecurityContext{},
|
||||||
TerminationGracePeriodSeconds: &period,
|
TerminationGracePeriodSeconds: &period,
|
||||||
SchedulerName: api.DefaultSchedulerName,
|
SchedulerName: v1.DefaultSchedulerName,
|
||||||
},
|
},
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: defaultLabels,
|
Labels: defaultLabels,
|
||||||
@ -58,7 +57,7 @@ func TestSetDefaultDaemonSetSpec(t *testing.T) {
|
|||||||
RestartPolicy: v1.RestartPolicyAlways,
|
RestartPolicy: v1.RestartPolicyAlways,
|
||||||
SecurityContext: &v1.PodSecurityContext{},
|
SecurityContext: &v1.PodSecurityContext{},
|
||||||
TerminationGracePeriodSeconds: &period,
|
TerminationGracePeriodSeconds: &period,
|
||||||
SchedulerName: api.DefaultSchedulerName,
|
SchedulerName: v1.DefaultSchedulerName,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
@ -185,7 +184,7 @@ func TestSetDefaultStatefulSet(t *testing.T) {
|
|||||||
RestartPolicy: v1.RestartPolicyAlways,
|
RestartPolicy: v1.RestartPolicyAlways,
|
||||||
SecurityContext: &v1.PodSecurityContext{},
|
SecurityContext: &v1.PodSecurityContext{},
|
||||||
TerminationGracePeriodSeconds: &period,
|
TerminationGracePeriodSeconds: &period,
|
||||||
SchedulerName: api.DefaultSchedulerName,
|
SchedulerName: v1.DefaultSchedulerName,
|
||||||
},
|
},
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: defaultLabels,
|
Labels: defaultLabels,
|
||||||
@ -296,7 +295,7 @@ func TestSetDefaultDeployment(t *testing.T) {
|
|||||||
RestartPolicy: v1.RestartPolicyAlways,
|
RestartPolicy: v1.RestartPolicyAlways,
|
||||||
SecurityContext: &v1.PodSecurityContext{},
|
SecurityContext: &v1.PodSecurityContext{},
|
||||||
TerminationGracePeriodSeconds: &period,
|
TerminationGracePeriodSeconds: &period,
|
||||||
SchedulerName: api.DefaultSchedulerName,
|
SchedulerName: v1.DefaultSchedulerName,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
|
@ -5,7 +5,6 @@ go_library(
|
|||||||
srcs = [
|
srcs = [
|
||||||
"annotation_key_constants.go",
|
"annotation_key_constants.go",
|
||||||
"doc.go",
|
"doc.go",
|
||||||
"field_constants.go",
|
|
||||||
"json.go",
|
"json.go",
|
||||||
"objectreference.go",
|
"objectreference.go",
|
||||||
"register.go",
|
"register.go",
|
||||||
|
@ -1,38 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2016 The Kubernetes Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package core
|
|
||||||
|
|
||||||
// Field path constants that are specific to the internal API
|
|
||||||
// representation.
|
|
||||||
const (
|
|
||||||
NodeUnschedulableField = "spec.unschedulable"
|
|
||||||
ObjectNameField = "metadata.name"
|
|
||||||
PodHostField = "spec.nodeName"
|
|
||||||
PodStatusField = "status.phase"
|
|
||||||
SecretTypeField = "type"
|
|
||||||
|
|
||||||
EventReasonField = "action"
|
|
||||||
EventSourceField = "reportingComponent"
|
|
||||||
EventTypeField = "type"
|
|
||||||
EventInvolvedKindField = "involvedObject.kind"
|
|
||||||
EventInvolvedNamespaceField = "involvedObject.namespace"
|
|
||||||
EventInvolvedNameField = "involvedObject.name"
|
|
||||||
EventInvolvedUIDField = "involvedObject.uid"
|
|
||||||
EventInvolvedAPIVersionField = "involvedObject.apiVersion"
|
|
||||||
EventInvolvedResourceVersionField = "involvedObject.resourceVersion"
|
|
||||||
EventInvolvedFieldPathField = "involvedObject.fieldPath"
|
|
||||||
)
|
|
@ -23,7 +23,7 @@ import (
|
|||||||
|
|
||||||
fuzz "github.com/google/gofuzz"
|
fuzz "github.com/google/gofuzz"
|
||||||
|
|
||||||
corev1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/api/resource"
|
"k8s.io/apimachinery/pkg/api/resource"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
@ -83,10 +83,10 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
|||||||
s.Affinity = new(core.Affinity)
|
s.Affinity = new(core.Affinity)
|
||||||
}
|
}
|
||||||
if s.SchedulerName == "" {
|
if s.SchedulerName == "" {
|
||||||
s.SchedulerName = core.DefaultSchedulerName
|
s.SchedulerName = v1.DefaultSchedulerName
|
||||||
}
|
}
|
||||||
if s.EnableServiceLinks == nil {
|
if s.EnableServiceLinks == nil {
|
||||||
enableServiceLinks := corev1.DefaultEnableServiceLinks
|
enableServiceLinks := v1.DefaultEnableServiceLinks
|
||||||
s.EnableServiceLinks = &enableServiceLinks
|
s.EnableServiceLinks = &enableServiceLinks
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -5331,9 +5331,6 @@ type RangeAllocation struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// DefaultSchedulerName defines the name of default scheduler.
|
|
||||||
DefaultSchedulerName = "default-scheduler"
|
|
||||||
|
|
||||||
// DefaultHardPodAffinitySymmetricWeight is the weight of implicit PreferredDuringScheduling affinity rule.
|
// DefaultHardPodAffinitySymmetricWeight is the weight of implicit PreferredDuringScheduling affinity rule.
|
||||||
//
|
//
|
||||||
// RequiredDuringScheduling affinity is not symmetric, but there is an implicit PreferredDuringScheduling affinity rule
|
// RequiredDuringScheduling affinity is not symmetric, but there is an implicit PreferredDuringScheduling affinity rule
|
||||||
|
@ -3391,7 +3391,7 @@ func ValidateNodeSelectorRequirement(rq core.NodeSelectorRequirement, fldPath *f
|
|||||||
}
|
}
|
||||||
|
|
||||||
var nodeFieldSelectorValidators = map[string]func(string, bool) []string{
|
var nodeFieldSelectorValidators = map[string]func(string, bool) []string{
|
||||||
core.ObjectNameField: ValidateNodeName,
|
metav1.ObjectNameField: ValidateNodeName,
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateNodeFieldSelectorRequirement tests that the specified NodeSelectorRequirement fields has valid data
|
// ValidateNodeFieldSelectorRequirement tests that the specified NodeSelectorRequirement fields has valid data
|
||||||
|
@ -44,7 +44,6 @@ go_test(
|
|||||||
embed = [":go_default_library"],
|
embed = [":go_default_library"],
|
||||||
deps = [
|
deps = [
|
||||||
"//pkg/api/legacyscheme:go_default_library",
|
"//pkg/api/legacyscheme:go_default_library",
|
||||||
"//pkg/apis/core:go_default_library",
|
|
||||||
"//pkg/apis/core/install:go_default_library",
|
"//pkg/apis/core/install:go_default_library",
|
||||||
"//pkg/apis/extensions/install:go_default_library",
|
"//pkg/apis/extensions/install:go_default_library",
|
||||||
"//pkg/apis/networking:go_default_library",
|
"//pkg/apis/networking:go_default_library",
|
||||||
|
@ -23,14 +23,13 @@ import (
|
|||||||
|
|
||||||
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
|
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
|
||||||
|
|
||||||
"k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
apiequality "k8s.io/apimachinery/pkg/api/equality"
|
apiequality "k8s.io/apimachinery/pkg/api/equality"
|
||||||
"k8s.io/apimachinery/pkg/api/resource"
|
"k8s.io/apimachinery/pkg/api/resource"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apimachinery/pkg/util/intstr"
|
"k8s.io/apimachinery/pkg/util/intstr"
|
||||||
"k8s.io/kubernetes/pkg/api/legacyscheme"
|
"k8s.io/kubernetes/pkg/api/legacyscheme"
|
||||||
api "k8s.io/kubernetes/pkg/apis/core"
|
|
||||||
_ "k8s.io/kubernetes/pkg/apis/core/install"
|
_ "k8s.io/kubernetes/pkg/apis/core/install"
|
||||||
_ "k8s.io/kubernetes/pkg/apis/extensions/install"
|
_ "k8s.io/kubernetes/pkg/apis/extensions/install"
|
||||||
. "k8s.io/kubernetes/pkg/apis/extensions/v1beta1"
|
. "k8s.io/kubernetes/pkg/apis/extensions/v1beta1"
|
||||||
@ -46,7 +45,7 @@ func TestSetDefaultDaemonSetSpec(t *testing.T) {
|
|||||||
RestartPolicy: v1.RestartPolicyAlways,
|
RestartPolicy: v1.RestartPolicyAlways,
|
||||||
SecurityContext: &v1.PodSecurityContext{},
|
SecurityContext: &v1.PodSecurityContext{},
|
||||||
TerminationGracePeriodSeconds: &period,
|
TerminationGracePeriodSeconds: &period,
|
||||||
SchedulerName: api.DefaultSchedulerName,
|
SchedulerName: v1.DefaultSchedulerName,
|
||||||
},
|
},
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: defaultLabels,
|
Labels: defaultLabels,
|
||||||
@ -58,7 +57,7 @@ func TestSetDefaultDaemonSetSpec(t *testing.T) {
|
|||||||
RestartPolicy: v1.RestartPolicyAlways,
|
RestartPolicy: v1.RestartPolicyAlways,
|
||||||
SecurityContext: &v1.PodSecurityContext{},
|
SecurityContext: &v1.PodSecurityContext{},
|
||||||
TerminationGracePeriodSeconds: &period,
|
TerminationGracePeriodSeconds: &period,
|
||||||
SchedulerName: api.DefaultSchedulerName,
|
SchedulerName: v1.DefaultSchedulerName,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
@ -170,7 +169,7 @@ func TestSetDefaultDeployment(t *testing.T) {
|
|||||||
RestartPolicy: v1.RestartPolicyAlways,
|
RestartPolicy: v1.RestartPolicyAlways,
|
||||||
SecurityContext: &v1.PodSecurityContext{},
|
SecurityContext: &v1.PodSecurityContext{},
|
||||||
TerminationGracePeriodSeconds: &period,
|
TerminationGracePeriodSeconds: &period,
|
||||||
SchedulerName: api.DefaultSchedulerName,
|
SchedulerName: v1.DefaultSchedulerName,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
|
@ -737,7 +737,7 @@ func TestSimpleDaemonSetScheduleDaemonSetPodsLaunchesPods(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
field := nodeSelector.NodeSelectorTerms[0].MatchFields[0]
|
field := nodeSelector.NodeSelectorTerms[0].MatchFields[0]
|
||||||
if field.Key == api.ObjectNameField {
|
if field.Key == metav1.ObjectNameField {
|
||||||
if field.Operator != v1.NodeSelectorOpIn {
|
if field.Operator != v1.NodeSelectorOpIn {
|
||||||
t.Fatalf("the operation of hostname NodeAffinity is not %v", v1.NodeSelectorOpIn)
|
t.Fatalf("the operation of hostname NodeAffinity is not %v", v1.NodeSelectorOpIn)
|
||||||
}
|
}
|
||||||
@ -2699,7 +2699,7 @@ func TestDeleteUnscheduledPodForNotExistingNode(t *testing.T) {
|
|||||||
{
|
{
|
||||||
MatchFields: []v1.NodeSelectorRequirement{
|
MatchFields: []v1.NodeSelectorRequirement{
|
||||||
{
|
{
|
||||||
Key: api.ObjectNameField,
|
Key: metav1.ObjectNameField,
|
||||||
Operator: v1.NodeSelectorOpIn,
|
Operator: v1.NodeSelectorOpIn,
|
||||||
Values: []string{"node-2"},
|
Values: []string{"node-2"},
|
||||||
},
|
},
|
||||||
|
@ -12,7 +12,6 @@ go_library(
|
|||||||
importpath = "k8s.io/kubernetes/pkg/controller/daemon/util",
|
importpath = "k8s.io/kubernetes/pkg/controller/daemon/util",
|
||||||
deps = [
|
deps = [
|
||||||
"//pkg/api/v1/pod:go_default_library",
|
"//pkg/api/v1/pod:go_default_library",
|
||||||
"//pkg/apis/core:go_default_library",
|
|
||||||
"//pkg/apis/core/v1/helper:go_default_library",
|
"//pkg/apis/core/v1/helper:go_default_library",
|
||||||
"//staging/src/k8s.io/api/apps/v1:go_default_library",
|
"//staging/src/k8s.io/api/apps/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||||
@ -39,7 +38,6 @@ go_test(
|
|||||||
srcs = ["daemonset_util_test.go"],
|
srcs = ["daemonset_util_test.go"],
|
||||||
embed = [":go_default_library"],
|
embed = [":go_default_library"],
|
||||||
deps = [
|
deps = [
|
||||||
"//pkg/apis/core:go_default_library",
|
|
||||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/api/extensions/v1beta1:go_default_library",
|
"//staging/src/k8s.io/api/extensions/v1beta1:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||||
|
@ -25,7 +25,6 @@ import (
|
|||||||
extensions "k8s.io/api/extensions/v1beta1"
|
extensions "k8s.io/api/extensions/v1beta1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
podutil "k8s.io/kubernetes/pkg/api/v1/pod"
|
podutil "k8s.io/kubernetes/pkg/api/v1/pod"
|
||||||
api "k8s.io/kubernetes/pkg/apis/core"
|
|
||||||
v1helper "k8s.io/kubernetes/pkg/apis/core/v1/helper"
|
v1helper "k8s.io/kubernetes/pkg/apis/core/v1/helper"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -151,7 +150,7 @@ func SplitByAvailablePods(minReadySeconds int32, pods []*v1.Pod) ([]*v1.Pod, []*
|
|||||||
// Note that this function assumes that no NodeAffinity conflicts with the selected nodeName.
|
// Note that this function assumes that no NodeAffinity conflicts with the selected nodeName.
|
||||||
func ReplaceDaemonSetPodNodeNameNodeAffinity(affinity *v1.Affinity, nodename string) *v1.Affinity {
|
func ReplaceDaemonSetPodNodeNameNodeAffinity(affinity *v1.Affinity, nodename string) *v1.Affinity {
|
||||||
nodeSelReq := v1.NodeSelectorRequirement{
|
nodeSelReq := v1.NodeSelectorRequirement{
|
||||||
Key: api.ObjectNameField,
|
Key: metav1.ObjectNameField,
|
||||||
Operator: v1.NodeSelectorOpIn,
|
Operator: v1.NodeSelectorOpIn,
|
||||||
Values: []string{nodename},
|
Values: []string{nodename},
|
||||||
}
|
}
|
||||||
@ -220,11 +219,11 @@ func GetTargetNodeName(pod *v1.Pod) (string, error) {
|
|||||||
|
|
||||||
for _, term := range terms {
|
for _, term := range terms {
|
||||||
for _, exp := range term.MatchFields {
|
for _, exp := range term.MatchFields {
|
||||||
if exp.Key == api.ObjectNameField &&
|
if exp.Key == metav1.ObjectNameField &&
|
||||||
exp.Operator == v1.NodeSelectorOpIn {
|
exp.Operator == v1.NodeSelectorOpIn {
|
||||||
if len(exp.Values) != 1 {
|
if len(exp.Values) != 1 {
|
||||||
return "", fmt.Errorf("the matchFields value of '%s' is not unique for pod %s/%s",
|
return "", fmt.Errorf("the matchFields value of '%s' is not unique for pod %s/%s",
|
||||||
api.ObjectNameField, pod.Namespace, pod.Name)
|
metav1.ObjectNameField, pod.Namespace, pod.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
return exp.Values[0], nil
|
return exp.Values[0], nil
|
||||||
|
@ -27,7 +27,6 @@ import (
|
|||||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||||
"k8s.io/component-base/featuregate"
|
"k8s.io/component-base/featuregate"
|
||||||
featuregatetesting "k8s.io/component-base/featuregate/testing"
|
featuregatetesting "k8s.io/component-base/featuregate/testing"
|
||||||
api "k8s.io/kubernetes/pkg/apis/core"
|
|
||||||
utilpointer "k8s.io/utils/pointer"
|
utilpointer "k8s.io/utils/pointer"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -185,7 +184,7 @@ func TestReplaceDaemonSetPodNodeNameNodeAffinity(t *testing.T) {
|
|||||||
{
|
{
|
||||||
MatchFields: []v1.NodeSelectorRequirement{
|
MatchFields: []v1.NodeSelectorRequirement{
|
||||||
{
|
{
|
||||||
Key: api.ObjectNameField,
|
Key: metav1.ObjectNameField,
|
||||||
Operator: v1.NodeSelectorOpIn,
|
Operator: v1.NodeSelectorOpIn,
|
||||||
Values: []string{"host_1"},
|
Values: []string{"host_1"},
|
||||||
},
|
},
|
||||||
@ -222,7 +221,7 @@ func TestReplaceDaemonSetPodNodeNameNodeAffinity(t *testing.T) {
|
|||||||
{
|
{
|
||||||
MatchFields: []v1.NodeSelectorRequirement{
|
MatchFields: []v1.NodeSelectorRequirement{
|
||||||
{
|
{
|
||||||
Key: api.ObjectNameField,
|
Key: metav1.ObjectNameField,
|
||||||
Operator: v1.NodeSelectorOpIn,
|
Operator: v1.NodeSelectorOpIn,
|
||||||
Values: []string{"host_1"},
|
Values: []string{"host_1"},
|
||||||
},
|
},
|
||||||
@ -272,7 +271,7 @@ func TestReplaceDaemonSetPodNodeNameNodeAffinity(t *testing.T) {
|
|||||||
{
|
{
|
||||||
MatchFields: []v1.NodeSelectorRequirement{
|
MatchFields: []v1.NodeSelectorRequirement{
|
||||||
{
|
{
|
||||||
Key: api.ObjectNameField,
|
Key: metav1.ObjectNameField,
|
||||||
Operator: v1.NodeSelectorOpIn,
|
Operator: v1.NodeSelectorOpIn,
|
||||||
Values: []string{"host_1"},
|
Values: []string{"host_1"},
|
||||||
},
|
},
|
||||||
@ -291,7 +290,7 @@ func TestReplaceDaemonSetPodNodeNameNodeAffinity(t *testing.T) {
|
|||||||
{
|
{
|
||||||
MatchFields: []v1.NodeSelectorRequirement{
|
MatchFields: []v1.NodeSelectorRequirement{
|
||||||
{
|
{
|
||||||
Key: api.ObjectNameField,
|
Key: metav1.ObjectNameField,
|
||||||
Operator: v1.NodeSelectorOpIn,
|
Operator: v1.NodeSelectorOpIn,
|
||||||
Values: []string{"host_1", "host_2"},
|
Values: []string{"host_1", "host_2"},
|
||||||
},
|
},
|
||||||
@ -309,7 +308,7 @@ func TestReplaceDaemonSetPodNodeNameNodeAffinity(t *testing.T) {
|
|||||||
{
|
{
|
||||||
MatchFields: []v1.NodeSelectorRequirement{
|
MatchFields: []v1.NodeSelectorRequirement{
|
||||||
{
|
{
|
||||||
Key: api.ObjectNameField,
|
Key: metav1.ObjectNameField,
|
||||||
Operator: v1.NodeSelectorOpIn,
|
Operator: v1.NodeSelectorOpIn,
|
||||||
Values: []string{"host_1"},
|
Values: []string{"host_1"},
|
||||||
},
|
},
|
||||||
@ -330,7 +329,7 @@ func TestReplaceDaemonSetPodNodeNameNodeAffinity(t *testing.T) {
|
|||||||
{
|
{
|
||||||
MatchFields: []v1.NodeSelectorRequirement{
|
MatchFields: []v1.NodeSelectorRequirement{
|
||||||
{
|
{
|
||||||
Key: api.ObjectNameField,
|
Key: metav1.ObjectNameField,
|
||||||
Operator: v1.NodeSelectorOpIn,
|
Operator: v1.NodeSelectorOpIn,
|
||||||
Values: []string{"host_1"},
|
Values: []string{"host_1"},
|
||||||
},
|
},
|
||||||
@ -358,7 +357,7 @@ func TestReplaceDaemonSetPodNodeNameNodeAffinity(t *testing.T) {
|
|||||||
{
|
{
|
||||||
MatchFields: []v1.NodeSelectorRequirement{
|
MatchFields: []v1.NodeSelectorRequirement{
|
||||||
{
|
{
|
||||||
Key: api.ObjectNameField,
|
Key: metav1.ObjectNameField,
|
||||||
Operator: v1.NodeSelectorOpIn,
|
Operator: v1.NodeSelectorOpIn,
|
||||||
Values: []string{"host_2"},
|
Values: []string{"host_2"},
|
||||||
},
|
},
|
||||||
@ -376,7 +375,7 @@ func TestReplaceDaemonSetPodNodeNameNodeAffinity(t *testing.T) {
|
|||||||
{
|
{
|
||||||
MatchFields: []v1.NodeSelectorRequirement{
|
MatchFields: []v1.NodeSelectorRequirement{
|
||||||
{
|
{
|
||||||
Key: api.ObjectNameField,
|
Key: metav1.ObjectNameField,
|
||||||
Operator: v1.NodeSelectorOpIn,
|
Operator: v1.NodeSelectorOpIn,
|
||||||
Values: []string{"host_1"},
|
Values: []string{"host_1"},
|
||||||
},
|
},
|
||||||
@ -395,7 +394,7 @@ func TestReplaceDaemonSetPodNodeNameNodeAffinity(t *testing.T) {
|
|||||||
{
|
{
|
||||||
MatchFields: []v1.NodeSelectorRequirement{
|
MatchFields: []v1.NodeSelectorRequirement{
|
||||||
{
|
{
|
||||||
Key: api.ObjectNameField,
|
Key: metav1.ObjectNameField,
|
||||||
Operator: v1.NodeSelectorOpNotIn,
|
Operator: v1.NodeSelectorOpNotIn,
|
||||||
Values: []string{"host_2"},
|
Values: []string{"host_2"},
|
||||||
},
|
},
|
||||||
@ -413,7 +412,7 @@ func TestReplaceDaemonSetPodNodeNameNodeAffinity(t *testing.T) {
|
|||||||
{
|
{
|
||||||
MatchFields: []v1.NodeSelectorRequirement{
|
MatchFields: []v1.NodeSelectorRequirement{
|
||||||
{
|
{
|
||||||
Key: api.ObjectNameField,
|
Key: metav1.ObjectNameField,
|
||||||
Operator: v1.NodeSelectorOpIn,
|
Operator: v1.NodeSelectorOpIn,
|
||||||
Values: []string{"host_1"},
|
Values: []string{"host_1"},
|
||||||
},
|
},
|
||||||
@ -453,7 +452,7 @@ func TestReplaceDaemonSetPodNodeNameNodeAffinity(t *testing.T) {
|
|||||||
{
|
{
|
||||||
MatchFields: []v1.NodeSelectorRequirement{
|
MatchFields: []v1.NodeSelectorRequirement{
|
||||||
{
|
{
|
||||||
Key: api.ObjectNameField,
|
Key: metav1.ObjectNameField,
|
||||||
Operator: v1.NodeSelectorOpIn,
|
Operator: v1.NodeSelectorOpIn,
|
||||||
Values: []string{"host_1"},
|
Values: []string{"host_1"},
|
||||||
},
|
},
|
||||||
@ -519,7 +518,7 @@ func TestGetTargetNodeName(t *testing.T) {
|
|||||||
{
|
{
|
||||||
MatchFields: []v1.NodeSelectorRequirement{
|
MatchFields: []v1.NodeSelectorRequirement{
|
||||||
{
|
{
|
||||||
Key: api.ObjectNameField,
|
Key: metav1.ObjectNameField,
|
||||||
Operator: v1.NodeSelectorOpIn,
|
Operator: v1.NodeSelectorOpIn,
|
||||||
Values: []string{"node-1"},
|
Values: []string{"node-1"},
|
||||||
},
|
},
|
||||||
@ -547,7 +546,7 @@ func TestGetTargetNodeName(t *testing.T) {
|
|||||||
{
|
{
|
||||||
MatchFields: []v1.NodeSelectorRequirement{
|
MatchFields: []v1.NodeSelectorRequirement{
|
||||||
{
|
{
|
||||||
Key: api.ObjectNameField,
|
Key: metav1.ObjectNameField,
|
||||||
Operator: v1.NodeSelectorOpIn,
|
Operator: v1.NodeSelectorOpIn,
|
||||||
Values: []string{"node-1", "node-2"},
|
Values: []string{"node-1", "node-2"},
|
||||||
},
|
},
|
||||||
|
@ -17,20 +17,19 @@ limitations under the License.
|
|||||||
package config
|
package config
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/fields"
|
"k8s.io/apimachinery/pkg/fields"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
"k8s.io/client-go/tools/cache"
|
"k8s.io/client-go/tools/cache"
|
||||||
api "k8s.io/kubernetes/pkg/apis/core"
|
|
||||||
kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
|
kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewSourceApiserver creates a config source that watches and pulls from the apiserver.
|
// NewSourceApiserver creates a config source that watches and pulls from the apiserver.
|
||||||
func NewSourceApiserver(c clientset.Interface, nodeName types.NodeName, updates chan<- interface{}) {
|
func NewSourceApiserver(c clientset.Interface, nodeName types.NodeName, updates chan<- interface{}) {
|
||||||
lw := cache.NewListWatchFromClient(c.CoreV1().RESTClient(), "pods", metav1.NamespaceAll, fields.OneTermEqualSelector(api.PodHostField, string(nodeName)))
|
lw := cache.NewListWatchFromClient(c.CoreV1().RESTClient(), "pods", metav1.NamespaceAll, fields.OneTermEqualSelector("spec.nodeName", string(nodeName)))
|
||||||
newSourceApiserverFromLW(lw, updates)
|
newSourceApiserverFromLW(lw, updates)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
"k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
@ -60,7 +60,7 @@ func TestDecodeSinglePod(t *testing.T) {
|
|||||||
SecurityContext: securitycontext.ValidSecurityContextWithContainerDefaults(),
|
SecurityContext: securitycontext.ValidSecurityContextWithContainerDefaults(),
|
||||||
}},
|
}},
|
||||||
SecurityContext: &v1.PodSecurityContext{},
|
SecurityContext: &v1.PodSecurityContext{},
|
||||||
SchedulerName: core.DefaultSchedulerName,
|
SchedulerName: v1.DefaultSchedulerName,
|
||||||
EnableServiceLinks: &enableServiceLinks,
|
EnableServiceLinks: &enableServiceLinks,
|
||||||
},
|
},
|
||||||
Status: v1.PodStatus{
|
Status: v1.PodStatus{
|
||||||
@ -133,7 +133,7 @@ func TestDecodePodList(t *testing.T) {
|
|||||||
SecurityContext: securitycontext.ValidSecurityContextWithContainerDefaults(),
|
SecurityContext: securitycontext.ValidSecurityContextWithContainerDefaults(),
|
||||||
}},
|
}},
|
||||||
SecurityContext: &v1.PodSecurityContext{},
|
SecurityContext: &v1.PodSecurityContext{},
|
||||||
SchedulerName: core.DefaultSchedulerName,
|
SchedulerName: v1.DefaultSchedulerName,
|
||||||
EnableServiceLinks: &enableServiceLinks,
|
EnableServiceLinks: &enableServiceLinks,
|
||||||
},
|
},
|
||||||
Status: v1.PodStatus{
|
Status: v1.PodStatus{
|
||||||
|
@ -27,7 +27,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
apiequality "k8s.io/apimachinery/pkg/api/equality"
|
apiequality "k8s.io/apimachinery/pkg/api/equality"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
@ -155,7 +155,7 @@ func getTestCases(hostname types.NodeName) []*testCase {
|
|||||||
Spec: v1.PodSpec{
|
Spec: v1.PodSpec{
|
||||||
Containers: []v1.Container{{Name: "image", Image: "test/image", SecurityContext: securitycontext.ValidSecurityContextWithContainerDefaults()}},
|
Containers: []v1.Container{{Name: "image", Image: "test/image", SecurityContext: securitycontext.ValidSecurityContextWithContainerDefaults()}},
|
||||||
SecurityContext: &v1.PodSecurityContext{},
|
SecurityContext: &v1.PodSecurityContext{},
|
||||||
SchedulerName: api.DefaultSchedulerName,
|
SchedulerName: v1.DefaultSchedulerName,
|
||||||
},
|
},
|
||||||
Status: v1.PodStatus{
|
Status: v1.PodStatus{
|
||||||
Phase: v1.PodPending,
|
Phase: v1.PodPending,
|
||||||
@ -187,7 +187,7 @@ func getTestCases(hostname types.NodeName) []*testCase {
|
|||||||
TerminationMessagePolicy: v1.TerminationMessageReadFile,
|
TerminationMessagePolicy: v1.TerminationMessageReadFile,
|
||||||
}},
|
}},
|
||||||
SecurityContext: &v1.PodSecurityContext{},
|
SecurityContext: &v1.PodSecurityContext{},
|
||||||
SchedulerName: api.DefaultSchedulerName,
|
SchedulerName: v1.DefaultSchedulerName,
|
||||||
EnableServiceLinks: &enableServiceLinks,
|
EnableServiceLinks: &enableServiceLinks,
|
||||||
},
|
},
|
||||||
Status: v1.PodStatus{
|
Status: v1.PodStatus{
|
||||||
|
@ -150,7 +150,7 @@ func TestExtractPodsFromHTTP(t *testing.T) {
|
|||||||
NodeName: string(nodeName),
|
NodeName: string(nodeName),
|
||||||
Containers: []v1.Container{{Name: "1", Image: "foo", ImagePullPolicy: v1.PullAlways, TerminationMessagePolicy: v1.TerminationMessageReadFile}},
|
Containers: []v1.Container{{Name: "1", Image: "foo", ImagePullPolicy: v1.PullAlways, TerminationMessagePolicy: v1.TerminationMessageReadFile}},
|
||||||
SecurityContext: &v1.PodSecurityContext{},
|
SecurityContext: &v1.PodSecurityContext{},
|
||||||
SchedulerName: api.DefaultSchedulerName,
|
SchedulerName: v1.DefaultSchedulerName,
|
||||||
},
|
},
|
||||||
Status: v1.PodStatus{
|
Status: v1.PodStatus{
|
||||||
Phase: v1.PodPending,
|
Phase: v1.PodPending,
|
||||||
@ -172,7 +172,7 @@ func TestExtractPodsFromHTTP(t *testing.T) {
|
|||||||
DNSPolicy: v1.DNSClusterFirst,
|
DNSPolicy: v1.DNSClusterFirst,
|
||||||
SecurityContext: &v1.PodSecurityContext{},
|
SecurityContext: &v1.PodSecurityContext{},
|
||||||
TerminationGracePeriodSeconds: &grace,
|
TerminationGracePeriodSeconds: &grace,
|
||||||
SchedulerName: api.DefaultSchedulerName,
|
SchedulerName: v1.DefaultSchedulerName,
|
||||||
EnableServiceLinks: &enableServiceLinks,
|
EnableServiceLinks: &enableServiceLinks,
|
||||||
|
|
||||||
Containers: []v1.Container{{
|
Containers: []v1.Container{{
|
||||||
@ -205,7 +205,7 @@ func TestExtractPodsFromHTTP(t *testing.T) {
|
|||||||
NodeName: nodeName,
|
NodeName: nodeName,
|
||||||
Containers: []v1.Container{{Name: "1", Image: "foo", ImagePullPolicy: v1.PullAlways, TerminationMessagePolicy: v1.TerminationMessageReadFile}},
|
Containers: []v1.Container{{Name: "1", Image: "foo", ImagePullPolicy: v1.PullAlways, TerminationMessagePolicy: v1.TerminationMessageReadFile}},
|
||||||
SecurityContext: &v1.PodSecurityContext{},
|
SecurityContext: &v1.PodSecurityContext{},
|
||||||
SchedulerName: api.DefaultSchedulerName,
|
SchedulerName: v1.DefaultSchedulerName,
|
||||||
},
|
},
|
||||||
Status: v1.PodStatus{
|
Status: v1.PodStatus{
|
||||||
Phase: v1.PodPending,
|
Phase: v1.PodPending,
|
||||||
@ -220,7 +220,7 @@ func TestExtractPodsFromHTTP(t *testing.T) {
|
|||||||
NodeName: nodeName,
|
NodeName: nodeName,
|
||||||
Containers: []v1.Container{{Name: "2", Image: "bar:bartag", ImagePullPolicy: "", TerminationMessagePolicy: v1.TerminationMessageReadFile}},
|
Containers: []v1.Container{{Name: "2", Image: "bar:bartag", ImagePullPolicy: "", TerminationMessagePolicy: v1.TerminationMessageReadFile}},
|
||||||
SecurityContext: &v1.PodSecurityContext{},
|
SecurityContext: &v1.PodSecurityContext{},
|
||||||
SchedulerName: api.DefaultSchedulerName,
|
SchedulerName: v1.DefaultSchedulerName,
|
||||||
},
|
},
|
||||||
Status: v1.PodStatus{
|
Status: v1.PodStatus{
|
||||||
Phase: v1.PodPending,
|
Phase: v1.PodPending,
|
||||||
@ -244,7 +244,7 @@ func TestExtractPodsFromHTTP(t *testing.T) {
|
|||||||
DNSPolicy: v1.DNSClusterFirst,
|
DNSPolicy: v1.DNSClusterFirst,
|
||||||
TerminationGracePeriodSeconds: &grace,
|
TerminationGracePeriodSeconds: &grace,
|
||||||
SecurityContext: &v1.PodSecurityContext{},
|
SecurityContext: &v1.PodSecurityContext{},
|
||||||
SchedulerName: api.DefaultSchedulerName,
|
SchedulerName: v1.DefaultSchedulerName,
|
||||||
EnableServiceLinks: &enableServiceLinks,
|
EnableServiceLinks: &enableServiceLinks,
|
||||||
|
|
||||||
Containers: []v1.Container{{
|
Containers: []v1.Container{{
|
||||||
@ -273,7 +273,7 @@ func TestExtractPodsFromHTTP(t *testing.T) {
|
|||||||
DNSPolicy: v1.DNSClusterFirst,
|
DNSPolicy: v1.DNSClusterFirst,
|
||||||
TerminationGracePeriodSeconds: &grace,
|
TerminationGracePeriodSeconds: &grace,
|
||||||
SecurityContext: &v1.PodSecurityContext{},
|
SecurityContext: &v1.PodSecurityContext{},
|
||||||
SchedulerName: api.DefaultSchedulerName,
|
SchedulerName: v1.DefaultSchedulerName,
|
||||||
EnableServiceLinks: &enableServiceLinks,
|
EnableServiceLinks: &enableServiceLinks,
|
||||||
|
|
||||||
Containers: []v1.Container{{
|
Containers: []v1.Container{{
|
||||||
|
@ -442,7 +442,7 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
|
|||||||
|
|
||||||
if kubeDeps.KubeClient != nil {
|
if kubeDeps.KubeClient != nil {
|
||||||
kubeInformers := informers.NewSharedInformerFactoryWithOptions(kubeDeps.KubeClient, 0, informers.WithTweakListOptions(func(options *metav1.ListOptions) {
|
kubeInformers := informers.NewSharedInformerFactoryWithOptions(kubeDeps.KubeClient, 0, informers.WithTweakListOptions(func(options *metav1.ListOptions) {
|
||||||
options.FieldSelector = fields.Set{api.ObjectNameField: string(nodeName)}.String()
|
options.FieldSelector = fields.Set{metav1.ObjectNameField: string(nodeName)}.String()
|
||||||
}))
|
}))
|
||||||
nodeLister = kubeInformers.Core().V1().Nodes().Lister()
|
nodeLister = kubeInformers.Core().V1().Nodes().Lister()
|
||||||
nodeHasSynced = func() bool {
|
nodeHasSynced = func() bool {
|
||||||
|
@ -84,7 +84,7 @@ func validNewPod() *api.Pod {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
SecurityContext: &api.PodSecurityContext{},
|
SecurityContext: &api.PodSecurityContext{},
|
||||||
SchedulerName: api.DefaultSchedulerName,
|
SchedulerName: v1.DefaultSchedulerName,
|
||||||
EnableServiceLinks: &enableServiceLinks,
|
EnableServiceLinks: &enableServiceLinks,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -886,7 +886,7 @@ func TestEtcdUpdateScheduled(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
SecurityContext: &api.PodSecurityContext{},
|
SecurityContext: &api.PodSecurityContext{},
|
||||||
SchedulerName: api.DefaultSchedulerName,
|
SchedulerName: v1.DefaultSchedulerName,
|
||||||
},
|
},
|
||||||
}, nil, 1, false)
|
}, nil, 1, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -917,7 +917,7 @@ func TestEtcdUpdateScheduled(t *testing.T) {
|
|||||||
|
|
||||||
TerminationGracePeriodSeconds: &grace,
|
TerminationGracePeriodSeconds: &grace,
|
||||||
SecurityContext: &api.PodSecurityContext{},
|
SecurityContext: &api.PodSecurityContext{},
|
||||||
SchedulerName: api.DefaultSchedulerName,
|
SchedulerName: v1.DefaultSchedulerName,
|
||||||
EnableServiceLinks: &enableServiceLinks,
|
EnableServiceLinks: &enableServiceLinks,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -959,7 +959,7 @@ func TestEtcdUpdateStatus(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
SecurityContext: &api.PodSecurityContext{},
|
SecurityContext: &api.PodSecurityContext{},
|
||||||
SchedulerName: api.DefaultSchedulerName,
|
SchedulerName: v1.DefaultSchedulerName,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
err := storage.Storage.Create(ctx, key, &podStart, nil, 0, false)
|
err := storage.Storage.Create(ctx, key, &podStart, nil, 0, false)
|
||||||
@ -985,7 +985,7 @@ func TestEtcdUpdateStatus(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
SecurityContext: &api.PodSecurityContext{},
|
SecurityContext: &api.PodSecurityContext{},
|
||||||
SchedulerName: api.DefaultSchedulerName,
|
SchedulerName: v1.DefaultSchedulerName,
|
||||||
},
|
},
|
||||||
Status: api.PodStatus{
|
Status: api.PodStatus{
|
||||||
Phase: api.PodRunning,
|
Phase: api.PodRunning,
|
||||||
@ -1010,7 +1010,7 @@ func TestEtcdUpdateStatus(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
SecurityContext: &api.PodSecurityContext{},
|
SecurityContext: &api.PodSecurityContext{},
|
||||||
SchedulerName: api.DefaultSchedulerName,
|
SchedulerName: v1.DefaultSchedulerName,
|
||||||
},
|
},
|
||||||
Status: api.PodStatus{
|
Status: api.PodStatus{
|
||||||
Phase: api.PodRunning,
|
Phase: api.PodRunning,
|
||||||
|
@ -58,7 +58,6 @@ go_test(
|
|||||||
],
|
],
|
||||||
embed = [":go_default_library"],
|
embed = [":go_default_library"],
|
||||||
deps = [
|
deps = [
|
||||||
"//pkg/apis/core:go_default_library",
|
|
||||||
"//pkg/controller/volume/scheduling:go_default_library",
|
"//pkg/controller/volume/scheduling:go_default_library",
|
||||||
"//pkg/scheduler/apis/config:go_default_library",
|
"//pkg/scheduler/apis/config:go_default_library",
|
||||||
"//pkg/scheduler/core:go_default_library",
|
"//pkg/scheduler/core:go_default_library",
|
||||||
|
@ -14,7 +14,6 @@ go_library(
|
|||||||
importpath = "k8s.io/kubernetes/pkg/scheduler/apis/config/v1beta1",
|
importpath = "k8s.io/kubernetes/pkg/scheduler/apis/config/v1beta1",
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
"//pkg/apis/core:go_default_library",
|
|
||||||
"//pkg/features:go_default_library",
|
"//pkg/features:go_default_library",
|
||||||
"//pkg/scheduler/apis/config:go_default_library",
|
"//pkg/scheduler/apis/config:go_default_library",
|
||||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
|
v1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apiserver/pkg/util/feature"
|
"k8s.io/apiserver/pkg/util/feature"
|
||||||
componentbaseconfigv1alpha1 "k8s.io/component-base/config/v1alpha1"
|
componentbaseconfigv1alpha1 "k8s.io/component-base/config/v1alpha1"
|
||||||
@ -28,9 +29,6 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/features"
|
"k8s.io/kubernetes/pkg/features"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/apis/config"
|
"k8s.io/kubernetes/pkg/scheduler/apis/config"
|
||||||
"k8s.io/utils/pointer"
|
"k8s.io/utils/pointer"
|
||||||
|
|
||||||
// this package shouldn't really depend on other k8s.io/kubernetes code
|
|
||||||
api "k8s.io/kubernetes/pkg/apis/core"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var defaultResourceSpec = []v1beta1.ResourceSpec{
|
var defaultResourceSpec = []v1beta1.ResourceSpec{
|
||||||
@ -55,7 +53,7 @@ func SetDefaults_KubeSchedulerConfiguration(obj *v1beta1.KubeSchedulerConfigurat
|
|||||||
// Only apply a default scheduler name when there is a single profile.
|
// Only apply a default scheduler name when there is a single profile.
|
||||||
// Validation will ensure that every profile has a non-empty unique name.
|
// Validation will ensure that every profile has a non-empty unique name.
|
||||||
if len(obj.Profiles) == 1 && obj.Profiles[0].SchedulerName == nil {
|
if len(obj.Profiles) == 1 && obj.Profiles[0].SchedulerName == nil {
|
||||||
obj.Profiles[0].SchedulerName = pointer.StringPtr(api.DefaultSchedulerName)
|
obj.Profiles[0].SchedulerName = pointer.StringPtr(v1.DefaultSchedulerName)
|
||||||
}
|
}
|
||||||
|
|
||||||
// For Healthz and Metrics bind addresses, we want to check:
|
// For Healthz and Metrics bind addresses, we want to check:
|
||||||
|
@ -35,7 +35,6 @@ import (
|
|||||||
"k8s.io/client-go/tools/cache"
|
"k8s.io/client-go/tools/cache"
|
||||||
"k8s.io/client-go/tools/events"
|
"k8s.io/client-go/tools/events"
|
||||||
extenderv1 "k8s.io/kube-scheduler/extender/v1"
|
extenderv1 "k8s.io/kube-scheduler/extender/v1"
|
||||||
apicore "k8s.io/kubernetes/pkg/apis/core"
|
|
||||||
schedulerapi "k8s.io/kubernetes/pkg/scheduler/apis/config"
|
schedulerapi "k8s.io/kubernetes/pkg/scheduler/apis/config"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework"
|
"k8s.io/kubernetes/pkg/scheduler/framework"
|
||||||
frameworkplugins "k8s.io/kubernetes/pkg/scheduler/framework/plugins"
|
frameworkplugins "k8s.io/kubernetes/pkg/scheduler/framework/plugins"
|
||||||
@ -504,13 +503,13 @@ func TestDefaultErrorFunc_NodeNotFound(t *testing.T) {
|
|||||||
name: "node is deleted during a scheduling cycle",
|
name: "node is deleted during a scheduling cycle",
|
||||||
nodes: []v1.Node{*nodeFoo, *nodeBar},
|
nodes: []v1.Node{*nodeFoo, *nodeBar},
|
||||||
nodeNameToDelete: "foo",
|
nodeNameToDelete: "foo",
|
||||||
injectErr: apierrors.NewNotFound(apicore.Resource("node"), nodeFoo.Name),
|
injectErr: apierrors.NewNotFound(v1.Resource("node"), nodeFoo.Name),
|
||||||
expectNodeNames: sets.NewString("bar"),
|
expectNodeNames: sets.NewString("bar"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "node is not deleted but NodeNotFound is received incorrectly",
|
name: "node is not deleted but NodeNotFound is received incorrectly",
|
||||||
nodes: []v1.Node{*nodeFoo, *nodeBar},
|
nodes: []v1.Node{*nodeFoo, *nodeBar},
|
||||||
injectErr: apierrors.NewNotFound(apicore.Resource("node"), nodeFoo.Name),
|
injectErr: apierrors.NewNotFound(v1.Resource("node"), nodeFoo.Name),
|
||||||
expectNodeNames: sets.NewString("foo", "bar"),
|
expectNodeNames: sets.NewString("foo", "bar"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,6 @@ go_test(
|
|||||||
],
|
],
|
||||||
embed = [":go_default_library"],
|
embed = [":go_default_library"],
|
||||||
deps = [
|
deps = [
|
||||||
"//pkg/apis/core:go_default_library",
|
|
||||||
"//pkg/scheduler/framework:go_default_library",
|
"//pkg/scheduler/framework:go_default_library",
|
||||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||||
|
@ -17,10 +17,10 @@ limitations under the License.
|
|||||||
package helper
|
package helper
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"k8s.io/api/core/v1"
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
api "k8s.io/kubernetes/pkg/apis/core"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
v1 "k8s.io/api/core/v1"
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestPodMatchesNodeSelectorAndAffinityTerms(t *testing.T) {
|
func TestPodMatchesNodeSelectorAndAffinityTerms(t *testing.T) {
|
||||||
@ -513,7 +513,7 @@ func TestPodMatchesNodeSelectorAndAffinityTerms(t *testing.T) {
|
|||||||
{
|
{
|
||||||
MatchFields: []v1.NodeSelectorRequirement{
|
MatchFields: []v1.NodeSelectorRequirement{
|
||||||
{
|
{
|
||||||
Key: api.ObjectNameField,
|
Key: metav1.ObjectNameField,
|
||||||
Operator: v1.NodeSelectorOpIn,
|
Operator: v1.NodeSelectorOpIn,
|
||||||
Values: []string{"node_1"},
|
Values: []string{"node_1"},
|
||||||
},
|
},
|
||||||
@ -539,7 +539,7 @@ func TestPodMatchesNodeSelectorAndAffinityTerms(t *testing.T) {
|
|||||||
{
|
{
|
||||||
MatchFields: []v1.NodeSelectorRequirement{
|
MatchFields: []v1.NodeSelectorRequirement{
|
||||||
{
|
{
|
||||||
Key: api.ObjectNameField,
|
Key: metav1.ObjectNameField,
|
||||||
Operator: v1.NodeSelectorOpIn,
|
Operator: v1.NodeSelectorOpIn,
|
||||||
Values: []string{"node_1"},
|
Values: []string{"node_1"},
|
||||||
},
|
},
|
||||||
@ -565,7 +565,7 @@ func TestPodMatchesNodeSelectorAndAffinityTerms(t *testing.T) {
|
|||||||
{
|
{
|
||||||
MatchFields: []v1.NodeSelectorRequirement{
|
MatchFields: []v1.NodeSelectorRequirement{
|
||||||
{
|
{
|
||||||
Key: api.ObjectNameField,
|
Key: metav1.ObjectNameField,
|
||||||
Operator: v1.NodeSelectorOpIn,
|
Operator: v1.NodeSelectorOpIn,
|
||||||
Values: []string{"node_1"},
|
Values: []string{"node_1"},
|
||||||
},
|
},
|
||||||
@ -601,7 +601,7 @@ func TestPodMatchesNodeSelectorAndAffinityTerms(t *testing.T) {
|
|||||||
{
|
{
|
||||||
MatchFields: []v1.NodeSelectorRequirement{
|
MatchFields: []v1.NodeSelectorRequirement{
|
||||||
{
|
{
|
||||||
Key: api.ObjectNameField,
|
Key: metav1.ObjectNameField,
|
||||||
Operator: v1.NodeSelectorOpIn,
|
Operator: v1.NodeSelectorOpIn,
|
||||||
Values: []string{"node_1"},
|
Values: []string{"node_1"},
|
||||||
},
|
},
|
||||||
@ -635,7 +635,7 @@ func TestPodMatchesNodeSelectorAndAffinityTerms(t *testing.T) {
|
|||||||
{
|
{
|
||||||
MatchFields: []v1.NodeSelectorRequirement{
|
MatchFields: []v1.NodeSelectorRequirement{
|
||||||
{
|
{
|
||||||
Key: api.ObjectNameField,
|
Key: metav1.ObjectNameField,
|
||||||
Operator: v1.NodeSelectorOpIn,
|
Operator: v1.NodeSelectorOpIn,
|
||||||
Values: []string{"node_1"},
|
Values: []string{"node_1"},
|
||||||
},
|
},
|
||||||
@ -669,7 +669,7 @@ func TestPodMatchesNodeSelectorAndAffinityTerms(t *testing.T) {
|
|||||||
{
|
{
|
||||||
MatchFields: []v1.NodeSelectorRequirement{
|
MatchFields: []v1.NodeSelectorRequirement{
|
||||||
{
|
{
|
||||||
Key: api.ObjectNameField,
|
Key: metav1.ObjectNameField,
|
||||||
Operator: v1.NodeSelectorOpIn,
|
Operator: v1.NodeSelectorOpIn,
|
||||||
Values: []string{"node_1"},
|
Values: []string{"node_1"},
|
||||||
},
|
},
|
||||||
|
@ -35,7 +35,6 @@ go_test(
|
|||||||
srcs = ["node_affinity_test.go"],
|
srcs = ["node_affinity_test.go"],
|
||||||
embed = [":go_default_library"],
|
embed = [":go_default_library"],
|
||||||
deps = [
|
deps = [
|
||||||
"//pkg/apis/core:go_default_library",
|
|
||||||
"//pkg/scheduler/apis/config:go_default_library",
|
"//pkg/scheduler/apis/config:go_default_library",
|
||||||
"//pkg/scheduler/framework:go_default_library",
|
"//pkg/scheduler/framework:go_default_library",
|
||||||
"//pkg/scheduler/framework/runtime:go_default_library",
|
"//pkg/scheduler/framework/runtime:go_default_library",
|
||||||
|
@ -24,7 +24,6 @@ import (
|
|||||||
"github.com/google/go-cmp/cmp"
|
"github.com/google/go-cmp/cmp"
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
api "k8s.io/kubernetes/pkg/apis/core"
|
|
||||||
"k8s.io/kubernetes/pkg/scheduler/apis/config"
|
"k8s.io/kubernetes/pkg/scheduler/apis/config"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework"
|
"k8s.io/kubernetes/pkg/scheduler/framework"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework/runtime"
|
"k8s.io/kubernetes/pkg/scheduler/framework/runtime"
|
||||||
@ -510,7 +509,7 @@ func TestNodeAffinity(t *testing.T) {
|
|||||||
{
|
{
|
||||||
MatchFields: []v1.NodeSelectorRequirement{
|
MatchFields: []v1.NodeSelectorRequirement{
|
||||||
{
|
{
|
||||||
Key: api.ObjectNameField,
|
Key: metav1.ObjectNameField,
|
||||||
Operator: v1.NodeSelectorOpIn,
|
Operator: v1.NodeSelectorOpIn,
|
||||||
Values: []string{"node_1"},
|
Values: []string{"node_1"},
|
||||||
},
|
},
|
||||||
@ -535,7 +534,7 @@ func TestNodeAffinity(t *testing.T) {
|
|||||||
{
|
{
|
||||||
MatchFields: []v1.NodeSelectorRequirement{
|
MatchFields: []v1.NodeSelectorRequirement{
|
||||||
{
|
{
|
||||||
Key: api.ObjectNameField,
|
Key: metav1.ObjectNameField,
|
||||||
Operator: v1.NodeSelectorOpIn,
|
Operator: v1.NodeSelectorOpIn,
|
||||||
Values: []string{"node_1"},
|
Values: []string{"node_1"},
|
||||||
},
|
},
|
||||||
@ -561,7 +560,7 @@ func TestNodeAffinity(t *testing.T) {
|
|||||||
{
|
{
|
||||||
MatchFields: []v1.NodeSelectorRequirement{
|
MatchFields: []v1.NodeSelectorRequirement{
|
||||||
{
|
{
|
||||||
Key: api.ObjectNameField,
|
Key: metav1.ObjectNameField,
|
||||||
Operator: v1.NodeSelectorOpIn,
|
Operator: v1.NodeSelectorOpIn,
|
||||||
Values: []string{"node_1"},
|
Values: []string{"node_1"},
|
||||||
},
|
},
|
||||||
@ -596,7 +595,7 @@ func TestNodeAffinity(t *testing.T) {
|
|||||||
{
|
{
|
||||||
MatchFields: []v1.NodeSelectorRequirement{
|
MatchFields: []v1.NodeSelectorRequirement{
|
||||||
{
|
{
|
||||||
Key: api.ObjectNameField,
|
Key: metav1.ObjectNameField,
|
||||||
Operator: v1.NodeSelectorOpIn,
|
Operator: v1.NodeSelectorOpIn,
|
||||||
Values: []string{"node_1"},
|
Values: []string{"node_1"},
|
||||||
},
|
},
|
||||||
@ -630,7 +629,7 @@ func TestNodeAffinity(t *testing.T) {
|
|||||||
{
|
{
|
||||||
MatchFields: []v1.NodeSelectorRequirement{
|
MatchFields: []v1.NodeSelectorRequirement{
|
||||||
{
|
{
|
||||||
Key: api.ObjectNameField,
|
Key: metav1.ObjectNameField,
|
||||||
Operator: v1.NodeSelectorOpIn,
|
Operator: v1.NodeSelectorOpIn,
|
||||||
Values: []string{"node_1"},
|
Values: []string{"node_1"},
|
||||||
},
|
},
|
||||||
@ -663,7 +662,7 @@ func TestNodeAffinity(t *testing.T) {
|
|||||||
{
|
{
|
||||||
MatchFields: []v1.NodeSelectorRequirement{
|
MatchFields: []v1.NodeSelectorRequirement{
|
||||||
{
|
{
|
||||||
Key: api.ObjectNameField,
|
Key: metav1.ObjectNameField,
|
||||||
Operator: v1.NodeSelectorOpIn,
|
Operator: v1.NodeSelectorOpIn,
|
||||||
Values: []string{"node_1"},
|
Values: []string{"node_1"},
|
||||||
},
|
},
|
||||||
@ -718,7 +717,7 @@ func TestNodeAffinity(t *testing.T) {
|
|||||||
RequiredDuringSchedulingIgnoredDuringExecution: &v1.NodeSelector{
|
RequiredDuringSchedulingIgnoredDuringExecution: &v1.NodeSelector{
|
||||||
NodeSelectorTerms: []v1.NodeSelectorTerm{{
|
NodeSelectorTerms: []v1.NodeSelectorTerm{{
|
||||||
MatchFields: []v1.NodeSelectorRequirement{{
|
MatchFields: []v1.NodeSelectorRequirement{{
|
||||||
Key: api.ObjectNameField,
|
Key: metav1.ObjectNameField,
|
||||||
Operator: v1.NodeSelectorOpIn,
|
Operator: v1.NodeSelectorOpIn,
|
||||||
Values: []string{"node_2"},
|
Values: []string{"node_2"},
|
||||||
}},
|
}},
|
||||||
@ -757,7 +756,7 @@ func TestNodeAffinity(t *testing.T) {
|
|||||||
RequiredDuringSchedulingIgnoredDuringExecution: &v1.NodeSelector{
|
RequiredDuringSchedulingIgnoredDuringExecution: &v1.NodeSelector{
|
||||||
NodeSelectorTerms: []v1.NodeSelectorTerm{{
|
NodeSelectorTerms: []v1.NodeSelectorTerm{{
|
||||||
MatchFields: []v1.NodeSelectorRequirement{{
|
MatchFields: []v1.NodeSelectorRequirement{{
|
||||||
Key: api.ObjectNameField,
|
Key: metav1.ObjectNameField,
|
||||||
Operator: v1.NodeSelectorOpIn,
|
Operator: v1.NodeSelectorOpIn,
|
||||||
Values: []string{"node_2"},
|
Values: []string{"node_2"},
|
||||||
}},
|
}},
|
||||||
|
@ -6168,7 +6168,7 @@ type RangeAllocation struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// "default-scheduler" is the name of default scheduler.
|
// DefaultSchedulerName defines the name of default scheduler.
|
||||||
DefaultSchedulerName = "default-scheduler"
|
DefaultSchedulerName = "default-scheduler"
|
||||||
|
|
||||||
// RequiredDuringScheduling affinity is not symmetric, but there is an implicit PreferredDuringScheduling affinity rule
|
// RequiredDuringScheduling affinity is not symmetric, but there is an implicit PreferredDuringScheduling affinity rule
|
||||||
|
@ -99,10 +99,16 @@ type ListMeta struct {
|
|||||||
RemainingItemCount *int64 `json:"remainingItemCount,omitempty" protobuf:"bytes,4,opt,name=remainingItemCount"`
|
RemainingItemCount *int64 `json:"remainingItemCount,omitempty" protobuf:"bytes,4,opt,name=remainingItemCount"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Field path constants that are specific to the internal API
|
||||||
|
// representation.
|
||||||
|
const (
|
||||||
|
ObjectNameField = "metadata.name"
|
||||||
|
)
|
||||||
|
|
||||||
// These are internal finalizer values for Kubernetes-like APIs, must be qualified name unless defined here
|
// These are internal finalizer values for Kubernetes-like APIs, must be qualified name unless defined here
|
||||||
const (
|
const (
|
||||||
FinalizerOrphanDependents string = "orphan"
|
FinalizerOrphanDependents = "orphan"
|
||||||
FinalizerDeleteDependents string = "foregroundDeletion"
|
FinalizerDeleteDependents = "foregroundDeletion"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ObjectMeta is metadata that all persisted resources must have, which includes all objects
|
// ObjectMeta is metadata that all persisted resources must have, which includes all objects
|
||||||
@ -283,15 +289,15 @@ type ObjectMeta struct {
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
// NamespaceDefault means the object is in the default namespace which is applied when not specified by clients
|
// NamespaceDefault means the object is in the default namespace which is applied when not specified by clients
|
||||||
NamespaceDefault string = "default"
|
NamespaceDefault = "default"
|
||||||
// NamespaceAll is the default argument to specify on a context when you want to list or filter resources across all namespaces
|
// NamespaceAll is the default argument to specify on a context when you want to list or filter resources across all namespaces
|
||||||
NamespaceAll string = ""
|
NamespaceAll = ""
|
||||||
// NamespaceNone is the argument for a context when there is no namespace.
|
// NamespaceNone is the argument for a context when there is no namespace.
|
||||||
NamespaceNone string = ""
|
NamespaceNone = ""
|
||||||
// NamespaceSystem is the system namespace where we place system components.
|
// NamespaceSystem is the system namespace where we place system components.
|
||||||
NamespaceSystem string = "kube-system"
|
NamespaceSystem = "kube-system"
|
||||||
// NamespacePublic is the namespace where we place public info (ConfigMaps)
|
// NamespacePublic is the namespace where we place public info (ConfigMaps)
|
||||||
NamespacePublic string = "kube-public"
|
NamespacePublic = "kube-public"
|
||||||
)
|
)
|
||||||
|
|
||||||
// OwnerReference contains enough information to let you identify an owning
|
// OwnerReference contains enough information to let you identify an owning
|
||||||
|
@ -23,7 +23,6 @@ go_library(
|
|||||||
"//pkg/api/v1/pod:go_default_library",
|
"//pkg/api/v1/pod:go_default_library",
|
||||||
"//pkg/apis/apps:go_default_library",
|
"//pkg/apis/apps:go_default_library",
|
||||||
"//pkg/apis/batch:go_default_library",
|
"//pkg/apis/batch:go_default_library",
|
||||||
"//pkg/apis/core:go_default_library",
|
|
||||||
"//pkg/apis/extensions:go_default_library",
|
"//pkg/apis/extensions:go_default_library",
|
||||||
"//pkg/cluster/ports:go_default_library",
|
"//pkg/cluster/ports:go_default_library",
|
||||||
"//pkg/controller/daemon:go_default_library",
|
"//pkg/controller/daemon:go_default_library",
|
||||||
|
@ -33,7 +33,6 @@ import (
|
|||||||
|
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
api "k8s.io/kubernetes/pkg/apis/core"
|
|
||||||
nodepkg "k8s.io/kubernetes/pkg/controller/nodelifecycle"
|
nodepkg "k8s.io/kubernetes/pkg/controller/nodelifecycle"
|
||||||
"k8s.io/kubernetes/test/e2e/common"
|
"k8s.io/kubernetes/test/e2e/common"
|
||||||
"k8s.io/kubernetes/test/e2e/framework"
|
"k8s.io/kubernetes/test/e2e/framework"
|
||||||
@ -152,7 +151,7 @@ var _ = SIGDescribe("Network Partition [Disruptive] [Slow]", func() {
|
|||||||
if !e2enode.IsConditionSetAsExpected(&node, v1.NodeReady, true) {
|
if !e2enode.IsConditionSetAsExpected(&node, v1.NodeReady, true) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
podOpts = metav1.ListOptions{FieldSelector: fields.OneTermEqualSelector(api.PodHostField, node.Name).String()}
|
podOpts = metav1.ListOptions{FieldSelector: fields.OneTermEqualSelector("spec.nodeName", node.Name).String()}
|
||||||
pods, err := c.CoreV1().Pods(metav1.NamespaceAll).List(context.TODO(), podOpts)
|
pods, err := c.CoreV1().Pods(metav1.NamespaceAll).List(context.TODO(), podOpts)
|
||||||
if err != nil || len(pods.Items) <= 0 {
|
if err != nil || len(pods.Items) <= 0 {
|
||||||
return false
|
return false
|
||||||
@ -163,7 +162,7 @@ var _ = SIGDescribe("Network Partition [Disruptive] [Slow]", func() {
|
|||||||
framework.Failf("No eligible node were found: %d", len(nodes.Items))
|
framework.Failf("No eligible node were found: %d", len(nodes.Items))
|
||||||
}
|
}
|
||||||
node := nodes.Items[0]
|
node := nodes.Items[0]
|
||||||
podOpts = metav1.ListOptions{FieldSelector: fields.OneTermEqualSelector(api.PodHostField, node.Name).String()}
|
podOpts = metav1.ListOptions{FieldSelector: fields.OneTermEqualSelector("spec.nodeName", node.Name).String()}
|
||||||
if err = e2epod.WaitForMatchPodsCondition(c, podOpts, "Running and Ready", podReadyTimeout, testutils.PodRunningReady); err != nil {
|
if err = e2epod.WaitForMatchPodsCondition(c, podOpts, "Running and Ready", podReadyTimeout, testutils.PodRunningReady); err != nil {
|
||||||
framework.Failf("Pods on node %s are not ready and running within %v: %v", node.Name, podReadyTimeout, err)
|
framework.Failf("Pods on node %s are not ready and running within %v: %v", node.Name, podReadyTimeout, err)
|
||||||
}
|
}
|
||||||
@ -501,7 +500,7 @@ var _ = SIGDescribe("Network Partition [Disruptive] [Slow]", func() {
|
|||||||
if !e2enode.IsConditionSetAsExpected(&node, v1.NodeReady, true) {
|
if !e2enode.IsConditionSetAsExpected(&node, v1.NodeReady, true) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
podOpts = metav1.ListOptions{FieldSelector: fields.OneTermEqualSelector(api.PodHostField, node.Name).String()}
|
podOpts = metav1.ListOptions{FieldSelector: fields.OneTermEqualSelector("spec.nodeName", node.Name).String()}
|
||||||
pods, err := c.CoreV1().Pods(metav1.NamespaceAll).List(context.TODO(), podOpts)
|
pods, err := c.CoreV1().Pods(metav1.NamespaceAll).List(context.TODO(), podOpts)
|
||||||
if err != nil || len(pods.Items) <= 0 {
|
if err != nil || len(pods.Items) <= 0 {
|
||||||
return false
|
return false
|
||||||
@ -512,7 +511,7 @@ var _ = SIGDescribe("Network Partition [Disruptive] [Slow]", func() {
|
|||||||
framework.Failf("No eligible node were found: %d", len(nodes.Items))
|
framework.Failf("No eligible node were found: %d", len(nodes.Items))
|
||||||
}
|
}
|
||||||
node := nodes.Items[0]
|
node := nodes.Items[0]
|
||||||
podOpts = metav1.ListOptions{FieldSelector: fields.OneTermEqualSelector(api.PodHostField, node.Name).String()}
|
podOpts = metav1.ListOptions{FieldSelector: fields.OneTermEqualSelector("spec.nodeName", node.Name).String()}
|
||||||
if err := e2epod.WaitForMatchPodsCondition(c, podOpts, "Running and Ready", podReadyTimeout, testutils.PodRunningReadyOrSucceeded); err != nil {
|
if err := e2epod.WaitForMatchPodsCondition(c, podOpts, "Running and Ready", podReadyTimeout, testutils.PodRunningReadyOrSucceeded); err != nil {
|
||||||
framework.Failf("Pods on node %s are not ready and running within %v: %v", node.Name, podReadyTimeout, err)
|
framework.Failf("Pods on node %s are not ready and running within %v: %v", node.Name, podReadyTimeout, err)
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,6 @@ go_library(
|
|||||||
],
|
],
|
||||||
importpath = "k8s.io/kubernetes/test/e2e/autoscaling",
|
importpath = "k8s.io/kubernetes/test/e2e/autoscaling",
|
||||||
deps = [
|
deps = [
|
||||||
"//pkg/apis/core:go_default_library",
|
|
||||||
"//staging/src/k8s.io/api/apps/v1:go_default_library",
|
"//staging/src/k8s.io/api/apps/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/api/autoscaling/v2beta1:go_default_library",
|
"//staging/src/k8s.io/api/autoscaling/v2beta1:go_default_library",
|
||||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||||
|
@ -43,7 +43,6 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
"k8s.io/klog/v2"
|
"k8s.io/klog/v2"
|
||||||
api "k8s.io/kubernetes/pkg/apis/core"
|
|
||||||
"k8s.io/kubernetes/test/e2e/framework"
|
"k8s.io/kubernetes/test/e2e/framework"
|
||||||
e2emanifest "k8s.io/kubernetes/test/e2e/framework/manifest"
|
e2emanifest "k8s.io/kubernetes/test/e2e/framework/manifest"
|
||||||
e2enetwork "k8s.io/kubernetes/test/e2e/framework/network"
|
e2enetwork "k8s.io/kubernetes/test/e2e/framework/network"
|
||||||
@ -1450,7 +1449,7 @@ func drainNode(f *framework.Framework, node *v1.Node) {
|
|||||||
makeNodeUnschedulable(f.ClientSet, node)
|
makeNodeUnschedulable(f.ClientSet, node)
|
||||||
|
|
||||||
ginkgo.By("Manually drain the single node")
|
ginkgo.By("Manually drain the single node")
|
||||||
podOpts := metav1.ListOptions{FieldSelector: fields.OneTermEqualSelector(api.PodHostField, node.Name).String()}
|
podOpts := metav1.ListOptions{FieldSelector: fields.OneTermEqualSelector("spec.nodeName", node.Name).String()}
|
||||||
pods, err := f.ClientSet.CoreV1().Pods(metav1.NamespaceAll).List(context.TODO(), podOpts)
|
pods, err := f.ClientSet.CoreV1().Pods(metav1.NamespaceAll).List(context.TODO(), podOpts)
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
for _, pod := range pods.Items {
|
for _, pod := range pods.Items {
|
||||||
|
@ -16,7 +16,6 @@ go_library(
|
|||||||
importpath = "k8s.io/kubernetes/test/e2e/cloud/gcp",
|
importpath = "k8s.io/kubernetes/test/e2e/cloud/gcp",
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
"//pkg/apis/core:go_default_library",
|
|
||||||
"//pkg/cluster/ports:go_default_library",
|
"//pkg/cluster/ports:go_default_library",
|
||||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||||
|
@ -29,7 +29,6 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/labels"
|
"k8s.io/apimachinery/pkg/labels"
|
||||||
"k8s.io/apimachinery/pkg/util/sets"
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
api "k8s.io/kubernetes/pkg/apis/core"
|
|
||||||
"k8s.io/kubernetes/test/e2e/framework"
|
"k8s.io/kubernetes/test/e2e/framework"
|
||||||
e2enode "k8s.io/kubernetes/test/e2e/framework/node"
|
e2enode "k8s.io/kubernetes/test/e2e/framework/node"
|
||||||
e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
|
e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
|
||||||
@ -240,7 +239,7 @@ func printStatusAndLogsForNotReadyPods(c clientset.Interface, ns string, podName
|
|||||||
func rebootNode(c clientset.Interface, provider, name, rebootCmd string) bool {
|
func rebootNode(c clientset.Interface, provider, name, rebootCmd string) bool {
|
||||||
// Setup
|
// Setup
|
||||||
ns := metav1.NamespaceSystem
|
ns := metav1.NamespaceSystem
|
||||||
ps, err := testutils.NewPodStore(c, ns, labels.Everything(), fields.OneTermEqualSelector(api.PodHostField, name))
|
ps, err := testutils.NewPodStore(c, ns, labels.Everything(), fields.OneTermEqualSelector("spec.nodeName", name))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
framework.Logf("Couldn't initialize pod store: %v", err)
|
framework.Logf("Couldn't initialize pod store: %v", err)
|
||||||
return false
|
return false
|
||||||
|
@ -15,7 +15,6 @@ go_test(
|
|||||||
tags = ["integration"],
|
tags = ["integration"],
|
||||||
deps = [
|
deps = [
|
||||||
"//pkg/api/v1/pod:go_default_library",
|
"//pkg/api/v1/pod:go_default_library",
|
||||||
"//pkg/apis/core:go_default_library",
|
|
||||||
"//pkg/controller:go_default_library",
|
"//pkg/controller:go_default_library",
|
||||||
"//pkg/controller/daemon:go_default_library",
|
"//pkg/controller/daemon:go_default_library",
|
||||||
"//pkg/scheduler:go_default_library",
|
"//pkg/scheduler:go_default_library",
|
||||||
|
@ -41,7 +41,6 @@ import (
|
|||||||
"k8s.io/client-go/util/flowcontrol"
|
"k8s.io/client-go/util/flowcontrol"
|
||||||
"k8s.io/client-go/util/retry"
|
"k8s.io/client-go/util/retry"
|
||||||
podutil "k8s.io/kubernetes/pkg/api/v1/pod"
|
podutil "k8s.io/kubernetes/pkg/api/v1/pod"
|
||||||
api "k8s.io/kubernetes/pkg/apis/core"
|
|
||||||
"k8s.io/kubernetes/pkg/controller"
|
"k8s.io/kubernetes/pkg/controller"
|
||||||
"k8s.io/kubernetes/pkg/controller/daemon"
|
"k8s.io/kubernetes/pkg/controller/daemon"
|
||||||
"k8s.io/kubernetes/pkg/scheduler"
|
"k8s.io/kubernetes/pkg/scheduler"
|
||||||
@ -534,7 +533,7 @@ func TestDaemonSetWithNodeSelectorLaunchesPods(t *testing.T) {
|
|||||||
{
|
{
|
||||||
MatchFields: []v1.NodeSelectorRequirement{
|
MatchFields: []v1.NodeSelectorRequirement{
|
||||||
{
|
{
|
||||||
Key: api.ObjectNameField,
|
Key: metav1.ObjectNameField,
|
||||||
Operator: v1.NodeSelectorOpIn,
|
Operator: v1.NodeSelectorOpIn,
|
||||||
Values: []string{"node-1"},
|
Values: []string{"node-1"},
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user