mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #61806 from hzxuzhonghu/LoadBalancerStatus-DeepCopy
Automatic merge from submit-queue (batch tested with PRs 61806, 61508, 62075, 62079, 62052). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. make use of auto generated LoadBalancerStatus.DeepCopy Remove LoadBalancerStatusDeepCopy in helpers.go, and use the auto generated `LoadBalancerStatus.DeepCopy` in pkg/apis/core/zz_generated.deepcopy.go. **Release note**: ```release-note NONE ```
This commit is contained in:
commit
b08ede9535
@ -323,16 +323,6 @@ func ingressEqual(lhs, rhs *core.LoadBalancerIngress) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: make method on LoadBalancerStatus?
|
|
||||||
func LoadBalancerStatusDeepCopy(lb *core.LoadBalancerStatus) *core.LoadBalancerStatus {
|
|
||||||
c := &core.LoadBalancerStatus{}
|
|
||||||
c.Ingress = make([]core.LoadBalancerIngress, len(lb.Ingress))
|
|
||||||
for i := range lb.Ingress {
|
|
||||||
c.Ingress[i] = lb.Ingress[i]
|
|
||||||
}
|
|
||||||
return c
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetAccessModesAsString returns a string representation of an array of access modes.
|
// GetAccessModesAsString returns a string representation of an array of access modes.
|
||||||
// modes, when present, are always in the same order: RWO,ROX,RWX.
|
// modes, when present, are always in the same order: RWO,ROX,RWX.
|
||||||
func GetAccessModesAsString(modes []core.PersistentVolumeAccessMode) string {
|
func GetAccessModesAsString(modes []core.PersistentVolumeAccessMode) string {
|
||||||
|
@ -1045,12 +1045,7 @@ func (ctrl *PersistentVolumeController) reclaimVolume(volume *v1.PersistentVolum
|
|||||||
|
|
||||||
// doRerecycleVolumeOperationcycleVolume recycles a volume. This method is
|
// doRerecycleVolumeOperationcycleVolume recycles a volume. This method is
|
||||||
// running in standalone goroutine and already has all necessary locks.
|
// running in standalone goroutine and already has all necessary locks.
|
||||||
func (ctrl *PersistentVolumeController) recycleVolumeOperation(arg interface{}) {
|
func (ctrl *PersistentVolumeController) recycleVolumeOperation(volume *v1.PersistentVolume) {
|
||||||
volume, ok := arg.(*v1.PersistentVolume)
|
|
||||||
if !ok {
|
|
||||||
glog.Errorf("Cannot convert recycleVolumeOperation argument to volume, got %#v", arg)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
glog.V(4).Infof("recycleVolumeOperation [%s] started", volume.Name)
|
glog.V(4).Infof("recycleVolumeOperation [%s] started", volume.Name)
|
||||||
|
|
||||||
// This method may have been waiting for a volume lock for some time.
|
// This method may have been waiting for a volume lock for some time.
|
||||||
@ -1134,13 +1129,7 @@ func (ctrl *PersistentVolumeController) recycleVolumeOperation(arg interface{})
|
|||||||
|
|
||||||
// deleteVolumeOperation deletes a volume. This method is running in standalone
|
// deleteVolumeOperation deletes a volume. This method is running in standalone
|
||||||
// goroutine and already has all necessary locks.
|
// goroutine and already has all necessary locks.
|
||||||
func (ctrl *PersistentVolumeController) deleteVolumeOperation(arg interface{}) error {
|
func (ctrl *PersistentVolumeController) deleteVolumeOperation(volume *v1.PersistentVolume) error {
|
||||||
volume, ok := arg.(*v1.PersistentVolume)
|
|
||||||
if !ok {
|
|
||||||
glog.Errorf("Cannot convert deleteVolumeOperation argument to volume, got %#v", arg)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
glog.V(4).Infof("deleteVolumeOperation [%s] started", volume.Name)
|
glog.V(4).Infof("deleteVolumeOperation [%s] started", volume.Name)
|
||||||
|
|
||||||
// This method may have been waiting for a volume lock for some time.
|
// This method may have been waiting for a volume lock for some time.
|
||||||
@ -1331,13 +1320,7 @@ func (ctrl *PersistentVolumeController) provisionClaim(claim *v1.PersistentVolum
|
|||||||
|
|
||||||
// provisionClaimOperation provisions a volume. This method is running in
|
// provisionClaimOperation provisions a volume. This method is running in
|
||||||
// standalone goroutine and already has all necessary locks.
|
// standalone goroutine and already has all necessary locks.
|
||||||
func (ctrl *PersistentVolumeController) provisionClaimOperation(claimObj interface{}) {
|
func (ctrl *PersistentVolumeController) provisionClaimOperation(claim *v1.PersistentVolumeClaim) {
|
||||||
claim, ok := claimObj.(*v1.PersistentVolumeClaim)
|
|
||||||
if !ok {
|
|
||||||
glog.Errorf("Cannot convert provisionClaimOperation argument to claim, got %#v", claimObj)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
claimClass := v1helper.GetPersistentVolumeClaimClass(claim)
|
claimClass := v1helper.GetPersistentVolumeClaimClass(claim)
|
||||||
glog.V(4).Infof("provisionClaimOperation [%s] started, class: %q", claimToClaimKey(claim), claimClass)
|
glog.V(4).Infof("provisionClaimOperation [%s] started, class: %q", claimToClaimKey(claim), claimClass)
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@ go_library(
|
|||||||
deps = [
|
deps = [
|
||||||
"//pkg/api/service:go_default_library",
|
"//pkg/api/service:go_default_library",
|
||||||
"//pkg/apis/core:go_default_library",
|
"//pkg/apis/core:go_default_library",
|
||||||
"//pkg/apis/core/helper:go_default_library",
|
|
||||||
"//pkg/proxy/util:go_default_library",
|
"//pkg/proxy/util:go_default_library",
|
||||||
"//pkg/util/net:go_default_library",
|
"//pkg/util/net:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
"//vendor/github.com/golang/glog:go_default_library",
|
||||||
|
@ -30,7 +30,6 @@ import (
|
|||||||
"k8s.io/client-go/tools/record"
|
"k8s.io/client-go/tools/record"
|
||||||
apiservice "k8s.io/kubernetes/pkg/api/service"
|
apiservice "k8s.io/kubernetes/pkg/api/service"
|
||||||
api "k8s.io/kubernetes/pkg/apis/core"
|
api "k8s.io/kubernetes/pkg/apis/core"
|
||||||
"k8s.io/kubernetes/pkg/apis/core/helper"
|
|
||||||
utilproxy "k8s.io/kubernetes/pkg/proxy/util"
|
utilproxy "k8s.io/kubernetes/pkg/proxy/util"
|
||||||
utilnet "k8s.io/kubernetes/pkg/util/net"
|
utilnet "k8s.io/kubernetes/pkg/util/net"
|
||||||
)
|
)
|
||||||
@ -91,7 +90,7 @@ func (sct *ServiceChangeTracker) newBaseServiceInfo(port *api.ServicePort, servi
|
|||||||
Protocol: port.Protocol,
|
Protocol: port.Protocol,
|
||||||
NodePort: int(port.NodePort),
|
NodePort: int(port.NodePort),
|
||||||
// Deep-copy in case the service instance changes
|
// Deep-copy in case the service instance changes
|
||||||
LoadBalancerStatus: *helper.LoadBalancerStatusDeepCopy(&service.Status.LoadBalancer),
|
LoadBalancerStatus: *service.Status.LoadBalancer.DeepCopy(),
|
||||||
SessionAffinityType: service.Spec.SessionAffinity,
|
SessionAffinityType: service.Spec.SessionAffinity,
|
||||||
StickyMaxAgeSeconds: stickyMaxAgeSeconds,
|
StickyMaxAgeSeconds: stickyMaxAgeSeconds,
|
||||||
OnlyNodeLocalEndpoints: onlyNodeLocalEndpoints,
|
OnlyNodeLocalEndpoints: onlyNodeLocalEndpoints,
|
||||||
|
@ -447,7 +447,7 @@ func (proxier *Proxier) mergeService(service *api.Service) sets.String {
|
|||||||
info.portal.port = int(servicePort.Port)
|
info.portal.port = int(servicePort.Port)
|
||||||
info.externalIPs = service.Spec.ExternalIPs
|
info.externalIPs = service.Spec.ExternalIPs
|
||||||
// Deep-copy in case the service instance changes
|
// Deep-copy in case the service instance changes
|
||||||
info.loadBalancerStatus = *helper.LoadBalancerStatusDeepCopy(&service.Status.LoadBalancer)
|
info.loadBalancerStatus = *service.Status.LoadBalancer.DeepCopy()
|
||||||
info.nodePort = int(servicePort.NodePort)
|
info.nodePort = int(servicePort.NodePort)
|
||||||
info.sessionAffinityType = service.Spec.SessionAffinity
|
info.sessionAffinityType = service.Spec.SessionAffinity
|
||||||
// Kube-apiserver side guarantees SessionAffinityConfig won't be nil when session affinity type is ClientIP
|
// Kube-apiserver side guarantees SessionAffinityConfig won't be nil when session affinity type is ClientIP
|
||||||
|
@ -175,7 +175,7 @@ func newServiceInfo(svcPortName proxy.ServicePortName, port *api.ServicePort, se
|
|||||||
nodePort: int(port.NodePort),
|
nodePort: int(port.NodePort),
|
||||||
targetPort: port.TargetPort.IntValue(),
|
targetPort: port.TargetPort.IntValue(),
|
||||||
// Deep-copy in case the service instance changes
|
// Deep-copy in case the service instance changes
|
||||||
loadBalancerStatus: *helper.LoadBalancerStatusDeepCopy(&service.Status.LoadBalancer),
|
loadBalancerStatus: *service.Status.LoadBalancer.DeepCopy(),
|
||||||
sessionAffinityType: service.Spec.SessionAffinity,
|
sessionAffinityType: service.Spec.SessionAffinity,
|
||||||
stickyMaxAgeSeconds: stickyMaxAgeSeconds,
|
stickyMaxAgeSeconds: stickyMaxAgeSeconds,
|
||||||
loadBalancerSourceRanges: make([]string, len(service.Spec.LoadBalancerSourceRanges)),
|
loadBalancerSourceRanges: make([]string, len(service.Spec.LoadBalancerSourceRanges)),
|
||||||
|
Loading…
Reference in New Issue
Block a user