mirror of https://github.com/k3s-io/k3s
apimachinery: remove Scheme.DeepCopy
parent
19285b7357
commit
ed586da147
|
@ -392,11 +392,11 @@ func (fjc *FederationJobController) reconcileJob(key string) (reconciliationStat
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a copy before modifying the obj to prevent race condition with other readers of obj from store.
|
// Create a copy before modifying the obj to prevent race condition with other readers of obj from store.
|
||||||
obj, err := api.Scheme.DeepCopy(objFromStore)
|
fjob, ok := objFromStore.(*batchv1.Job)
|
||||||
fjob, ok := obj.(*batchv1.Job)
|
if !ok {
|
||||||
if err != nil || !ok {
|
|
||||||
return statusError, err
|
return statusError, err
|
||||||
}
|
}
|
||||||
|
fjob = fjob.DeepCopy()
|
||||||
|
|
||||||
// delete job
|
// delete job
|
||||||
if fjob.DeletionTimestamp != nil {
|
if fjob.DeletionTimestamp != nil {
|
||||||
|
|
|
@ -34,7 +34,6 @@ import (
|
||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
"k8s.io/apimachinery/pkg/api/errors"
|
"k8s.io/apimachinery/pkg/api/errors"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -221,8 +220,7 @@ func waitForJob(c *fedclientset.Clientset, namespace string, jobName string, clu
|
||||||
}
|
}
|
||||||
|
|
||||||
func verifyJob(fedJob, localJob *batchv1.Job) bool {
|
func verifyJob(fedJob, localJob *batchv1.Job) bool {
|
||||||
localJobObj, _ := api.Scheme.DeepCopy(localJob)
|
localJob = localJob.DeepCopy()
|
||||||
localJob = localJobObj.(*batchv1.Job)
|
|
||||||
localJob.Spec.ManualSelector = fedJob.Spec.ManualSelector
|
localJob.Spec.ManualSelector = fedJob.Spec.ManualSelector
|
||||||
localJob.Spec.Completions = fedJob.Spec.Completions
|
localJob.Spec.Completions = fedJob.Spec.Completions
|
||||||
localJob.Spec.Parallelism = fedJob.Spec.Parallelism
|
localJob.Spec.Parallelism = fedJob.Spec.Parallelism
|
||||||
|
|
|
@ -430,14 +430,7 @@ func TestValidateStatefulSetUpdate(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
obj, err := api.Scheme.DeepCopy(validPodTemplate)
|
addContainersValidTemplate := validPodTemplate.DeepCopy()
|
||||||
if err != nil {
|
|
||||||
t.Errorf("failure during test setup when copying PodTemplate: %v", err)
|
|
||||||
}
|
|
||||||
addContainersValidTemplate, ok := obj.(api.PodTemplate)
|
|
||||||
if !ok {
|
|
||||||
t.Errorf("failure during test setup, copied pod template is not a pod template")
|
|
||||||
}
|
|
||||||
addContainersValidTemplate.Template.Spec.Containers = append(addContainersValidTemplate.Template.Spec.Containers,
|
addContainersValidTemplate.Template.Spec.Containers = append(addContainersValidTemplate.Template.Spec.Containers,
|
||||||
api.Container{Name: "def", Image: "image2", ImagePullPolicy: "IfNotPresent"})
|
api.Container{Name: "def", Image: "image2", ImagePullPolicy: "IfNotPresent"})
|
||||||
if len(addContainersValidTemplate.Template.Spec.Containers) != len(validPodTemplate.Template.Spec.Containers)+1 {
|
if len(addContainersValidTemplate.Template.Spec.Containers) != len(validPodTemplate.Template.Spec.Containers)+1 {
|
||||||
|
|
|
@ -29,7 +29,6 @@ import (
|
||||||
"k8s.io/apimachinery/pkg/api/resource"
|
"k8s.io/apimachinery/pkg/api/resource"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
|
||||||
kubefeatures "k8s.io/kubernetes/pkg/features"
|
kubefeatures "k8s.io/kubernetes/pkg/features"
|
||||||
"k8s.io/kubernetes/pkg/kubelet/events"
|
"k8s.io/kubernetes/pkg/kubelet/events"
|
||||||
evictionapi "k8s.io/kubernetes/pkg/kubelet/eviction/api"
|
evictionapi "k8s.io/kubernetes/pkg/kubelet/eviction/api"
|
||||||
|
@ -238,16 +237,7 @@ func (cm *containerManagerImpl) validateNodeAllocatable() error {
|
||||||
var errors []string
|
var errors []string
|
||||||
nar := cm.GetNodeAllocatableReservation()
|
nar := cm.GetNodeAllocatableReservation()
|
||||||
for k, v := range nar {
|
for k, v := range nar {
|
||||||
capacityClone, err := api.Scheme.DeepCopy(cm.capacity[k])
|
value := cm.capacity[k].DeepCopy()
|
||||||
if err != nil {
|
|
||||||
errors = append(errors, fmt.Sprintf("DeepCopy capacity error"))
|
|
||||||
}
|
|
||||||
value, ok := capacityClone.(resource.Quantity)
|
|
||||||
if !ok {
|
|
||||||
return fmt.Errorf(
|
|
||||||
"failed to cast object %#v to Quantity",
|
|
||||||
capacityClone)
|
|
||||||
}
|
|
||||||
value.Sub(v)
|
value.Sub(v)
|
||||||
|
|
||||||
if value.Sign() < 0 {
|
if value.Sign() < 0 {
|
||||||
|
|
|
@ -370,12 +370,9 @@ func TestPodUpdateAnnotations(t *testing.T) {
|
||||||
pod.Annotations = make(map[string]string, 0)
|
pod.Annotations = make(map[string]string, 0)
|
||||||
pod.Annotations["kubernetes.io/blah"] = "blah"
|
pod.Annotations["kubernetes.io/blah"] = "blah"
|
||||||
|
|
||||||
clone, err := scheme.Scheme.DeepCopy(pod)
|
clone := pod.DeepCopy()
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("%v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
podUpdate := CreatePodUpdate(kubetypes.SET, TestSource, CreateValidPod("foo1", "new"), clone.(*v1.Pod), CreateValidPod("foo3", "new"))
|
podUpdate := CreatePodUpdate(kubetypes.SET, TestSource, CreateValidPod("foo1", "new"), clone, CreateValidPod("foo3", "new"))
|
||||||
channel <- podUpdate
|
channel <- podUpdate
|
||||||
expectPodUpdate(t, ch, CreatePodUpdate(kubetypes.ADD, TestSource, CreateValidPod("foo1", "new"), pod, CreateValidPod("foo3", "new")))
|
expectPodUpdate(t, ch, CreatePodUpdate(kubetypes.ADD, TestSource, CreateValidPod("foo1", "new"), pod, CreateValidPod("foo3", "new")))
|
||||||
|
|
||||||
|
@ -402,12 +399,9 @@ func TestPodUpdateLabels(t *testing.T) {
|
||||||
pod.Labels = make(map[string]string, 0)
|
pod.Labels = make(map[string]string, 0)
|
||||||
pod.Labels["key"] = "value"
|
pod.Labels["key"] = "value"
|
||||||
|
|
||||||
clone, err := scheme.Scheme.DeepCopy(pod)
|
clone := pod.DeepCopy()
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("%v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
podUpdate := CreatePodUpdate(kubetypes.SET, TestSource, clone.(*v1.Pod))
|
podUpdate := CreatePodUpdate(kubetypes.SET, TestSource, clone)
|
||||||
channel <- podUpdate
|
channel <- podUpdate
|
||||||
expectPodUpdate(t, ch, CreatePodUpdate(kubetypes.ADD, TestSource, pod))
|
expectPodUpdate(t, ch, CreatePodUpdate(kubetypes.ADD, TestSource, pod))
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@ import (
|
||||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||||
"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/conversion"
|
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
utilnet "k8s.io/apimachinery/pkg/util/net"
|
utilnet "k8s.io/apimachinery/pkg/util/net"
|
||||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||||
|
@ -118,15 +117,9 @@ func (kl *Kubelet) tryRegisterWithAPIServer(node *v1.Node) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
clonedNode, err := conversion.NewCloner().DeepCopy(existingNode)
|
originalNode := existingNode.DeepCopy()
|
||||||
if err != nil {
|
if originalNode == nil {
|
||||||
glog.Errorf("Unable to clone %q node object %#v: %v", kl.nodeName, existingNode, err)
|
glog.Errorf("Nil %q node object", kl.nodeName)
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
originalNode, ok := clonedNode.(*v1.Node)
|
|
||||||
if !ok || originalNode == nil {
|
|
||||||
glog.Errorf("Unable to cast %q node object %#v to v1.Node", kl.nodeName, clonedNode)
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -409,14 +402,9 @@ func (kl *Kubelet) tryUpdateNodeStatus(tryNumber int) error {
|
||||||
return fmt.Errorf("error getting node %q: %v", kl.nodeName, err)
|
return fmt.Errorf("error getting node %q: %v", kl.nodeName, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
clonedNode, err := conversion.NewCloner().DeepCopy(node)
|
originalNode := node.DeepCopy()
|
||||||
if err != nil {
|
if originalNode == nil {
|
||||||
return fmt.Errorf("error clone node %q: %v", kl.nodeName, err)
|
return fmt.Errorf("nil %q node object", kl.nodeName)
|
||||||
}
|
|
||||||
|
|
||||||
originalNode, ok := clonedNode.(*v1.Node)
|
|
||||||
if !ok || originalNode == nil {
|
|
||||||
return fmt.Errorf("failed to cast %q node object %#v to v1.Node", kl.nodeName, clonedNode)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
kl.updatePodCIDR(node.Spec.PodCIDR)
|
kl.updatePodCIDR(node.Spec.PodCIDR)
|
||||||
|
|
|
@ -22,7 +22,6 @@ import (
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
|
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
"k8s.io/client-go/kubernetes/scheme"
|
|
||||||
"k8s.io/kubernetes/pkg/api/v1/resource"
|
"k8s.io/kubernetes/pkg/api/v1/resource"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -51,15 +50,7 @@ func (kl *Kubelet) defaultPodLimitsForDownwardAPI(pod *v1.Pod, container *v1.Con
|
||||||
|
|
||||||
var outputContainer *v1.Container
|
var outputContainer *v1.Container
|
||||||
if container != nil {
|
if container != nil {
|
||||||
containerCopy, err := scheme.Scheme.DeepCopy(container)
|
outputContainer = container.DeepCopy()
|
||||||
if err != nil {
|
|
||||||
return nil, nil, fmt.Errorf("failed to perform a deep copy of container object: %v", err)
|
|
||||||
}
|
|
||||||
var ok bool
|
|
||||||
outputContainer, ok = containerCopy.(*v1.Container)
|
|
||||||
if !ok {
|
|
||||||
return nil, nil, fmt.Errorf("unexpected type returned from deep copy of container object")
|
|
||||||
}
|
|
||||||
resource.MergeContainerResourceLimits(outputContainer, allocatable)
|
resource.MergeContainerResourceLimits(outputContainer, allocatable)
|
||||||
}
|
}
|
||||||
return outputPod, outputContainer, nil
|
return outputPod, outputContainer, nil
|
||||||
|
|
|
@ -22,7 +22,6 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
"k8s.io/client-go/kubernetes/scheme"
|
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
|
@ -163,10 +162,8 @@ func (m *manager) SetPodStatus(pod *v1.Pod, status v1.PodStatus) {
|
||||||
m.podStatusesLock.Lock()
|
m.podStatusesLock.Lock()
|
||||||
defer m.podStatusesLock.Unlock()
|
defer m.podStatusesLock.Unlock()
|
||||||
// Make sure we're caching a deep copy.
|
// Make sure we're caching a deep copy.
|
||||||
status, err := copyStatus(&status)
|
status = *status.DeepCopy()
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// Force a status update if deletion timestamp is set. This is necessary
|
// Force a status update if deletion timestamp is set. This is necessary
|
||||||
// because if the pod is in the non-running state, the pod worker still
|
// because if the pod is in the non-running state, the pod worker still
|
||||||
// needs to be able to trigger an update and/or deletion.
|
// needs to be able to trigger an update and/or deletion.
|
||||||
|
@ -205,10 +202,7 @@ func (m *manager) SetContainerReadiness(podUID types.UID, containerID kubecontai
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure we're not updating the cached version.
|
// Make sure we're not updating the cached version.
|
||||||
status, err := copyStatus(&oldStatus.status)
|
status := *oldStatus.status.DeepCopy()
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
containerStatus, _, _ = findContainerStatus(&status, containerID.String())
|
containerStatus, _, _ = findContainerStatus(&status, containerID.String())
|
||||||
containerStatus.Ready = ready
|
containerStatus.Ready = ready
|
||||||
|
|
||||||
|
@ -256,10 +250,7 @@ func (m *manager) TerminatePod(pod *v1.Pod) {
|
||||||
if cachedStatus, ok := m.podStatuses[pod.UID]; ok {
|
if cachedStatus, ok := m.podStatuses[pod.UID]; ok {
|
||||||
oldStatus = &cachedStatus.status
|
oldStatus = &cachedStatus.status
|
||||||
}
|
}
|
||||||
status, err := copyStatus(oldStatus)
|
status := *oldStatus.DeepCopy()
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
for i := range status.ContainerStatuses {
|
for i := range status.ContainerStatuses {
|
||||||
status.ContainerStatuses[i].State = v1.ContainerState{
|
status.ContainerStatuses[i].State = v1.ContainerState{
|
||||||
Terminated: &v1.ContainerStateTerminated{},
|
Terminated: &v1.ContainerStateTerminated{},
|
||||||
|
@ -513,13 +504,10 @@ func (m *manager) needsReconcile(uid types.UID, status v1.PodStatus) bool {
|
||||||
pod = mirrorPod
|
pod = mirrorPod
|
||||||
}
|
}
|
||||||
|
|
||||||
podStatus, err := copyStatus(&pod.Status)
|
podStatus := pod.Status.DeepCopy()
|
||||||
if err != nil {
|
normalizeStatus(pod, podStatus)
|
||||||
return false
|
|
||||||
}
|
|
||||||
normalizeStatus(pod, &podStatus)
|
|
||||||
|
|
||||||
if isStatusEqual(&podStatus, &status) {
|
if isStatusEqual(podStatus, &status) {
|
||||||
// If the status from the source is the same with the cached status,
|
// If the status from the source is the same with the cached status,
|
||||||
// reconcile is not needed. Just return.
|
// reconcile is not needed. Just return.
|
||||||
return false
|
return false
|
||||||
|
@ -586,13 +574,3 @@ func normalizeStatus(pod *v1.Pod, status *v1.PodStatus) *v1.PodStatus {
|
||||||
kubetypes.SortInitContainerStatuses(pod, status.InitContainerStatuses)
|
kubetypes.SortInitContainerStatuses(pod, status.InitContainerStatuses)
|
||||||
return status
|
return status
|
||||||
}
|
}
|
||||||
|
|
||||||
func copyStatus(source *v1.PodStatus) (v1.PodStatus, error) {
|
|
||||||
clone, err := scheme.Scheme.DeepCopy(source)
|
|
||||||
if err != nil {
|
|
||||||
glog.Errorf("Failed to clone status %+v: %v", source, err)
|
|
||||||
return v1.PodStatus{}, err
|
|
||||||
}
|
|
||||||
status := *clone.(*v1.PodStatus)
|
|
||||||
return status, nil
|
|
||||||
}
|
|
||||||
|
|
|
@ -32,7 +32,6 @@ import (
|
||||||
"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/kubernetes/scheme"
|
|
||||||
"k8s.io/kubernetes/pkg/kubelet/config"
|
"k8s.io/kubernetes/pkg/kubelet/config"
|
||||||
kubecontainer "k8s.io/kubernetes/pkg/kubelet/container"
|
kubecontainer "k8s.io/kubernetes/pkg/kubelet/container"
|
||||||
"k8s.io/kubernetes/pkg/kubelet/pod"
|
"k8s.io/kubernetes/pkg/kubelet/pod"
|
||||||
|
@ -386,18 +385,7 @@ func (dswp *desiredStateOfWorldPopulator) createVolumeSpec(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not return the original volume object, since the source could mutate it
|
// Do not return the original volume object, since the source could mutate it
|
||||||
clonedPodVolumeObj, err := scheme.Scheme.DeepCopy(&podVolume)
|
clonedPodVolume := podVolume.DeepCopy()
|
||||||
if err != nil || clonedPodVolumeObj == nil {
|
|
||||||
return nil, "", fmt.Errorf(
|
|
||||||
"failed to deep copy %q volume object. err=%v", podVolume.Name, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
clonedPodVolume, ok := clonedPodVolumeObj.(*v1.Volume)
|
|
||||||
if !ok {
|
|
||||||
return nil, "", fmt.Errorf(
|
|
||||||
"failed to cast clonedPodVolume %#v to v1.Volume",
|
|
||||||
clonedPodVolumeObj)
|
|
||||||
}
|
|
||||||
|
|
||||||
return volume.NewSpecFromVolume(clonedPodVolume), "", nil
|
return volume.NewSpecFromVolume(clonedPodVolume), "", nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -242,11 +242,7 @@ func DeleteTaint(taints []v1.Taint, taintToDelete *v1.Taint) ([]v1.Taint, bool)
|
||||||
// RemoveTaint tries to remove a taint from annotations list. Returns a new copy of updated Node and true if something was updated
|
// RemoveTaint tries to remove a taint from annotations list. Returns a new copy of updated Node and true if something was updated
|
||||||
// false otherwise.
|
// false otherwise.
|
||||||
func RemoveTaint(node *v1.Node, taint *v1.Taint) (*v1.Node, bool, error) {
|
func RemoveTaint(node *v1.Node, taint *v1.Taint) (*v1.Node, bool, error) {
|
||||||
objCopy, err := api.Scheme.DeepCopy(node)
|
newNode := node.DeepCopy()
|
||||||
if err != nil {
|
|
||||||
return nil, false, err
|
|
||||||
}
|
|
||||||
newNode := objCopy.(*v1.Node)
|
|
||||||
nodeTaints := newNode.Spec.Taints
|
nodeTaints := newNode.Spec.Taints
|
||||||
if len(nodeTaints) == 0 {
|
if len(nodeTaints) == 0 {
|
||||||
return newNode, false, nil
|
return newNode, false, nil
|
||||||
|
@ -264,11 +260,7 @@ func RemoveTaint(node *v1.Node, taint *v1.Taint) (*v1.Node, bool, error) {
|
||||||
// AddOrUpdateTaint tries to add a taint to annotations list. Returns a new copy of updated Node and true if something was updated
|
// AddOrUpdateTaint tries to add a taint to annotations list. Returns a new copy of updated Node and true if something was updated
|
||||||
// false otherwise.
|
// false otherwise.
|
||||||
func AddOrUpdateTaint(node *v1.Node, taint *v1.Taint) (*v1.Node, bool, error) {
|
func AddOrUpdateTaint(node *v1.Node, taint *v1.Taint) (*v1.Node, bool, error) {
|
||||||
objCopy, err := api.Scheme.DeepCopy(node)
|
newNode := node.DeepCopy()
|
||||||
if err != nil {
|
|
||||||
return nil, false, err
|
|
||||||
}
|
|
||||||
newNode := objCopy.(*v1.Node)
|
|
||||||
nodeTaints := newNode.Spec.Taints
|
nodeTaints := newNode.Spec.Taints
|
||||||
|
|
||||||
var newTaints []v1.Taint
|
var newTaints []v1.Taint
|
||||||
|
|
|
@ -93,6 +93,7 @@ import (
|
||||||
// +protobuf.embed=string
|
// +protobuf.embed=string
|
||||||
// +protobuf.options.marshal=false
|
// +protobuf.options.marshal=false
|
||||||
// +protobuf.options.(gogoproto.goproto_stringer)=false
|
// +protobuf.options.(gogoproto.goproto_stringer)=false
|
||||||
|
// +k8s:deepcopy-gen=true
|
||||||
// +k8s:openapi-gen=true
|
// +k8s:openapi-gen=true
|
||||||
type Quantity struct {
|
type Quantity struct {
|
||||||
// i is the quantity in int64 scaled form, if d.Dec == nil
|
// i is the quantity in int64 scaled form, if d.Dec == nil
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
// +build !ignore_autogenerated
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright 2017 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
|
||||||
|
|
||||||
|
package resource
|
||||||
|
|
||||||
|
import (
|
||||||
|
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||||
|
reflect "reflect"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetGeneratedDeepCopyFuncs returns the generated funcs, since we aren't registering them.
|
||||||
|
//
|
||||||
|
// Deprecated: deepcopy registration will go away when static deepcopy is fully implemented.
|
||||||
|
func GetGeneratedDeepCopyFuncs() []conversion.GeneratedDeepCopyFunc {
|
||||||
|
return []conversion.GeneratedDeepCopyFunc{
|
||||||
|
{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||||
|
in.(*Quantity).DeepCopyInto(out.(*Quantity))
|
||||||
|
return nil
|
||||||
|
}, InType: reflect.TypeOf(&Quantity{})},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *Quantity) DeepCopyInto(out *Quantity) {
|
||||||
|
*out = in.DeepCopy()
|
||||||
|
return
|
||||||
|
}
|
|
@ -420,11 +420,6 @@ func (s *Scheme) Default(src Object) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Performs a deep copy of the given object.
|
|
||||||
func (s *Scheme) DeepCopy(src interface{}) (interface{}, error) {
|
|
||||||
return s.cloner.DeepCopy(src)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert will attempt to convert in into out. Both must be pointers. For easy
|
// Convert will attempt to convert in into out. Both must be pointers. For easy
|
||||||
// testing of conversion functions. Returns an error if the conversion isn't
|
// testing of conversion functions. Returns an error if the conversion isn't
|
||||||
// possible. You can call this with types that haven't been registered (for example,
|
// possible. You can call this with types that haven't been registered (for example,
|
||||||
|
|
|
@ -26,7 +26,6 @@ import (
|
||||||
"k8s.io/api/core/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/client-go/kubernetes/scheme"
|
|
||||||
"k8s.io/kubernetes/pkg/kubelet/apis/kubeletconfig"
|
"k8s.io/kubernetes/pkg/kubelet/apis/kubeletconfig"
|
||||||
"k8s.io/kubernetes/pkg/kubelet/cm/cpumanager"
|
"k8s.io/kubernetes/pkg/kubelet/cm/cpumanager"
|
||||||
"k8s.io/kubernetes/pkg/kubelet/cm/cpuset"
|
"k8s.io/kubernetes/pkg/kubelet/cm/cpuset"
|
||||||
|
@ -146,9 +145,7 @@ func enableCPUManagerInKubelet(f *framework.Framework) (oldCfg *kubeletconfig.Ku
|
||||||
// Enable CPU Manager in Kubelet with static policy.
|
// Enable CPU Manager in Kubelet with static policy.
|
||||||
oldCfg, err := getCurrentKubeletConfig()
|
oldCfg, err := getCurrentKubeletConfig()
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
clone, err := scheme.Scheme.DeepCopy(oldCfg)
|
newCfg := oldCfg.DeepCopy()
|
||||||
framework.ExpectNoError(err)
|
|
||||||
newCfg := clone.(*kubeletconfig.KubeletConfiguration)
|
|
||||||
|
|
||||||
// Enable CPU Manager using feature gate.
|
// Enable CPU Manager using feature gate.
|
||||||
if newCfg.FeatureGates != "" {
|
if newCfg.FeatureGates != "" {
|
||||||
|
|
Loading…
Reference in New Issue