Skip to content

Commit

Permalink
Merge pull request kubernetes#78598 from yastij/revert-75744-runtimec…
Browse files Browse the repository at this point in the history
…lass-scheduling-api

Revert "Introduce topology into the runtimeClass API"
  • Loading branch information
k8s-ci-robot authored Jun 2, 2019
2 parents cc30c0d + 480d5e4 commit 6e23ef6
Show file tree
Hide file tree
Showing 27 changed files with 76 additions and 1,341 deletions.
48 changes: 0 additions & 48 deletions api/openapi-spec/swagger.json

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

1 change: 0 additions & 1 deletion pkg/apis/node/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ go_library(
importpath = "k8s.io/kubernetes/pkg/apis/node",
visibility = ["//visibility:public"],
deps = [
"//pkg/apis/core:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
Expand Down
26 changes: 0 additions & 26 deletions pkg/apis/node/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package node

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/kubernetes/pkg/apis/core"
)

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down Expand Up @@ -46,31 +45,6 @@ type RuntimeClass struct {
// The Handler must conform to the DNS Label (RFC 1123) requirements, and is
// immutable.
Handler string

// Scheduling holds the scheduling constraints to ensure that pods running
// with this RuntimeClass are scheduled to nodes that support it.
// If scheduling is nil, this RuntimeClass is assumed to be supported by all
// nodes.
// +optional
Scheduling *Scheduling
}

// Scheduling specifies the scheduling constraints for nodes supporting a
// RuntimeClass.
type Scheduling struct {
// nodeSelector lists labels that must be present on nodes that support this
// RuntimeClass. Pods using this RuntimeClass can only be scheduled to a
// node matched by this selector. The RuntimeClass nodeSelector is merged
// with a pod's existing nodeSelector. Any conflicts will cause the pod to
// be rejected in admission.
// +optional
NodeSelector map[string]string

// tolerations are appended (excluding duplicates) to pods running with this
// RuntimeClass during admission, effectively unioning the set of nodes
// tolerated by the pod and the RuntimeClass.
// +optional
Tolerations []core.Toleration
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down
4 changes: 0 additions & 4 deletions pkg/apis/node/v1alpha1/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ go_library(
importpath = "k8s.io/kubernetes/pkg/apis/node/v1alpha1",
visibility = ["//visibility:public"],
deps = [
"//pkg/apis/core:go_default_library",
"//pkg/apis/node:go_default_library",
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/api/node/v1alpha1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
Expand All @@ -40,9 +38,7 @@ go_test(
srcs = ["conversion_test.go"],
embed = [":go_default_library"],
deps = [
"//pkg/apis/core:go_default_library",
"//pkg/apis/node:go_default_library",
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/api/node/v1alpha1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/github.com/stretchr/testify/assert:go_default_library",
Expand Down
8 changes: 0 additions & 8 deletions pkg/apis/node/v1alpha1/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,11 @@ func addConversionFuncs(s *runtime.Scheme) error {
func Convert_v1alpha1_RuntimeClass_To_node_RuntimeClass(in *v1alpha1.RuntimeClass, out *node.RuntimeClass, s conversion.Scope) error {
out.ObjectMeta = in.ObjectMeta
out.Handler = in.Spec.RuntimeHandler
if in.Spec.Scheduling != nil {
out.Scheduling = new(node.Scheduling)
autoConvert_v1alpha1_Scheduling_To_node_Scheduling(in.Spec.Scheduling, out.Scheduling, s)
}
return nil
}

func Convert_node_RuntimeClass_To_v1alpha1_RuntimeClass(in *node.RuntimeClass, out *v1alpha1.RuntimeClass, s conversion.Scope) error {
out.ObjectMeta = in.ObjectMeta
out.Spec.RuntimeHandler = in.Handler
if in.Scheduling != nil {
out.Spec.Scheduling = new(v1alpha1.Scheduling)
autoConvert_node_Scheduling_To_v1alpha1_Scheduling(in.Scheduling, out.Spec.Scheduling, s)
}
return nil
}
87 changes: 16 additions & 71 deletions pkg/apis/node/v1alpha1/conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
corev1 "k8s.io/api/core/v1"
v1alpha1 "k8s.io/api/node/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
core "k8s.io/kubernetes/pkg/apis/core"
node "k8s.io/kubernetes/pkg/apis/node"
)

Expand All @@ -33,77 +31,24 @@ func TestRuntimeClassConversion(t *testing.T) {
name = "puppy"
handler = "heidi"
)
tests := map[string]struct {
internal *node.RuntimeClass
external *v1alpha1.RuntimeClass
}{
"fully-specified": {
internal: &node.RuntimeClass{
ObjectMeta: metav1.ObjectMeta{Name: name},
Handler: handler,
Scheduling: &node.Scheduling{
NodeSelector: map[string]string{"extra-soft": "true"},
Tolerations: []core.Toleration{{
Key: "stinky",
Operator: core.TolerationOpExists,
Effect: core.TaintEffectNoSchedule,
}},
},
},
external: &v1alpha1.RuntimeClass{
ObjectMeta: metav1.ObjectMeta{Name: name},
Spec: v1alpha1.RuntimeClassSpec{
RuntimeHandler: handler,
Scheduling: &v1alpha1.Scheduling{
NodeSelector: map[string]string{"extra-soft": "true"},
Tolerations: []corev1.Toleration{{
Key: "stinky",
Operator: corev1.TolerationOpExists,
Effect: corev1.TaintEffectNoSchedule,
}},
},
},
},
},
"empty-scheduling": {
internal: &node.RuntimeClass{
ObjectMeta: metav1.ObjectMeta{Name: name},
Handler: handler,
Scheduling: &node.Scheduling{},
},
external: &v1alpha1.RuntimeClass{
ObjectMeta: metav1.ObjectMeta{Name: name},
Spec: v1alpha1.RuntimeClassSpec{
RuntimeHandler: handler,
Scheduling: &v1alpha1.Scheduling{},
},
},
},
"empty": {
internal: &node.RuntimeClass{
ObjectMeta: metav1.ObjectMeta{Name: name},
Handler: handler,
},
external: &v1alpha1.RuntimeClass{
ObjectMeta: metav1.ObjectMeta{Name: name},
Spec: v1alpha1.RuntimeClassSpec{
RuntimeHandler: handler,
},
},
internalRC := node.RuntimeClass{
ObjectMeta: metav1.ObjectMeta{Name: name},
Handler: handler,
}
v1alpha1RC := v1alpha1.RuntimeClass{
ObjectMeta: metav1.ObjectMeta{Name: name},
Spec: v1alpha1.RuntimeClassSpec{
RuntimeHandler: handler,
},
}

for name, test := range tests {
t.Run(name, func(t *testing.T) {
convertedInternal := &node.RuntimeClass{}
require.NoError(t,
Convert_v1alpha1_RuntimeClass_To_node_RuntimeClass(test.external, convertedInternal, nil))
assert.Equal(t, test.internal, convertedInternal, "external -> internal")
convertedInternal := node.RuntimeClass{}
require.NoError(t,
Convert_v1alpha1_RuntimeClass_To_node_RuntimeClass(&v1alpha1RC, &convertedInternal, nil))
assert.Equal(t, internalRC, convertedInternal)

convertedV1alpha1 := &v1alpha1.RuntimeClass{}
require.NoError(t,
Convert_node_RuntimeClass_To_v1alpha1_RuntimeClass(test.internal, convertedV1alpha1, nil))
assert.Equal(t, test.external, convertedV1alpha1, "internal -> external")
})
}
convertedV1alpha1 := v1alpha1.RuntimeClass{}
require.NoError(t,
Convert_node_RuntimeClass_To_v1alpha1_RuntimeClass(&internalRC, &convertedV1alpha1, nil))
assert.Equal(t, v1alpha1RC, convertedV1alpha1)
}
37 changes: 0 additions & 37 deletions pkg/apis/node/v1alpha1/zz_generated.conversion.go

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

2 changes: 0 additions & 2 deletions pkg/apis/node/v1beta1/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ go_library(
importpath = "k8s.io/kubernetes/pkg/apis/node/v1beta1",
visibility = ["//visibility:public"],
deps = [
"//pkg/apis/core:go_default_library",
"//pkg/apis/node:go_default_library",
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/api/node/v1beta1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
Expand Down
Loading

0 comments on commit 6e23ef6

Please sign in to comment.