Merge pull request #106242 from thockin/revive-copy-lb-status-type-to-ingress
Copy LoadBalancerStatus from core to networking Kubernetes-commit: 818b13544f6421cd414d648637db48c9271b0bb7
This commit is contained in:
commit
fb69b58abb
8
go.mod
8
go.mod
|
@ -29,10 +29,10 @@ require (
|
|||
github.com/stretchr/testify v1.8.0
|
||||
golang.org/x/sys v0.1.0
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
k8s.io/api v0.0.0-20221028075226-689257039cfb
|
||||
k8s.io/api v0.0.0-20221103075246-5448eb39ae20
|
||||
k8s.io/apimachinery v0.0.0-20221028155017-b03a432a2a6d
|
||||
k8s.io/cli-runtime v0.0.0-20221030161243-cf309f8903f6
|
||||
k8s.io/client-go v0.0.0-20221103035556-bc6266d159c3
|
||||
k8s.io/client-go v0.0.0-20221103075558-4fbef5bda929
|
||||
k8s.io/component-base v0.0.0-20221102201024-c22075132ffc
|
||||
k8s.io/component-helpers v0.0.0-20221028160522-56bb98a3ab81
|
||||
k8s.io/klog/v2 v2.80.1
|
||||
|
@ -91,10 +91,10 @@ require (
|
|||
)
|
||||
|
||||
replace (
|
||||
k8s.io/api => k8s.io/api v0.0.0-20221028075226-689257039cfb
|
||||
k8s.io/api => k8s.io/api v0.0.0-20221103075246-5448eb39ae20
|
||||
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20221028155017-b03a432a2a6d
|
||||
k8s.io/cli-runtime => k8s.io/cli-runtime v0.0.0-20221030161243-cf309f8903f6
|
||||
k8s.io/client-go => k8s.io/client-go v0.0.0-20221103035556-bc6266d159c3
|
||||
k8s.io/client-go => k8s.io/client-go v0.0.0-20221103075558-4fbef5bda929
|
||||
k8s.io/code-generator => k8s.io/code-generator v0.0.0-20221028154808-081720d0e256
|
||||
k8s.io/component-base => k8s.io/component-base v0.0.0-20221102201024-c22075132ffc
|
||||
k8s.io/component-helpers => k8s.io/component-helpers v0.0.0-20221028160522-56bb98a3ab81
|
||||
|
|
8
go.sum
8
go.sum
|
@ -540,14 +540,14 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
|
|||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
k8s.io/api v0.0.0-20221028075226-689257039cfb h1:QZsHf1k3xHSbYozSHt8DZOrH36F8MbdLP18n4ZkQ/1c=
|
||||
k8s.io/api v0.0.0-20221028075226-689257039cfb/go.mod h1:96woDPRgmgH0tVTXgsLdv0cwHXPUvZ97ghr8sMUtxx0=
|
||||
k8s.io/api v0.0.0-20221103075246-5448eb39ae20 h1:L4yzu0YYenWmYNm1WG/jJy/6ioJxAlgDewudcjz0uUE=
|
||||
k8s.io/api v0.0.0-20221103075246-5448eb39ae20/go.mod h1:G/3aN5AoXC2S2FQkBj1R024v+pPQBOzaaOCf3qJdj+A=
|
||||
k8s.io/apimachinery v0.0.0-20221028155017-b03a432a2a6d h1:fg/DbLqFKxFESf3AnU5iwCexZWOUnFFLb0JraG20wZo=
|
||||
k8s.io/apimachinery v0.0.0-20221028155017-b03a432a2a6d/go.mod h1:zSkBXgO5G/dSQOe256tx5Yo2OJytojpY3bsXu/4/ZJE=
|
||||
k8s.io/cli-runtime v0.0.0-20221030161243-cf309f8903f6 h1:qt3gwW+JHgYf49iawwhBdRn+C0PVn/ttSFUObjuSRsg=
|
||||
k8s.io/cli-runtime v0.0.0-20221030161243-cf309f8903f6/go.mod h1:VCK6BtIAZKGm+vtIuPX7Izszv8qB+hRMk7aSQl1ymRU=
|
||||
k8s.io/client-go v0.0.0-20221103035556-bc6266d159c3 h1:VF0fWscMp1fHOdvGbrevezXnAtpWgpTPahKaZdXfhwk=
|
||||
k8s.io/client-go v0.0.0-20221103035556-bc6266d159c3/go.mod h1:9OZTm80DH1AI7P4cpx8yehVlTU1xZQCsMtAtlJYLWDw=
|
||||
k8s.io/client-go v0.0.0-20221103075558-4fbef5bda929 h1:LJygi0+VRaOYeVCtigmX/WL48MXQRw60mbD0/vBfP7s=
|
||||
k8s.io/client-go v0.0.0-20221103075558-4fbef5bda929/go.mod h1:DseZqcKeJ6QOGVPzrKVRaNDHcO+jFueDaza2XFq7nv0=
|
||||
k8s.io/component-base v0.0.0-20221102201024-c22075132ffc h1:guQG2a4VRQzaH2/LBx/9b+yDzcEHhNgfB495DpJby9c=
|
||||
k8s.io/component-base v0.0.0-20221102201024-c22075132ffc/go.mod h1:6nB7Hvde4zeOk2qvFvfgSiMNhRpXM0Q2Q04zwBZIfPc=
|
||||
k8s.io/component-helpers v0.0.0-20221028160522-56bb98a3ab81 h1:3CC/oNrmdSptGTCO0NGfo4HsUGjQOfFL8xAret+O6Vc=
|
||||
|
|
|
@ -2645,7 +2645,7 @@ func (i *IngressDescriber) describeIngressV1(ing *networkingv1.Ingress, events *
|
|||
w.Write(LEVEL_0, "Name:\t%v\n", ing.Name)
|
||||
printLabelsMultiline(w, "Labels", ing.Labels)
|
||||
w.Write(LEVEL_0, "Namespace:\t%v\n", ing.Namespace)
|
||||
w.Write(LEVEL_0, "Address:\t%v\n", loadBalancerStatusStringer(ing.Status.LoadBalancer, true))
|
||||
w.Write(LEVEL_0, "Address:\t%v\n", ingressLoadBalancerStatusStringerV1(ing.Status.LoadBalancer, true))
|
||||
ingressClassName := "<none>"
|
||||
if ing.Spec.IngressClassName != nil {
|
||||
ingressClassName = *ing.Spec.IngressClassName
|
||||
|
@ -2697,7 +2697,7 @@ func (i *IngressDescriber) describeIngressV1beta1(ing *networkingv1beta1.Ingress
|
|||
w.Write(LEVEL_0, "Name:\t%v\n", ing.Name)
|
||||
printLabelsMultiline(w, "Labels", ing.Labels)
|
||||
w.Write(LEVEL_0, "Namespace:\t%v\n", ing.Namespace)
|
||||
w.Write(LEVEL_0, "Address:\t%v\n", loadBalancerStatusStringer(ing.Status.LoadBalancer, true))
|
||||
w.Write(LEVEL_0, "Address:\t%v\n", ingressLoadBalancerStatusStringerV1beta1(ing.Status.LoadBalancer, true))
|
||||
ingressClassName := "<none>"
|
||||
if ing.Spec.IngressClassName != nil {
|
||||
ingressClassName = *ing.Spec.IngressClassName
|
||||
|
@ -5580,9 +5580,29 @@ func findNodeRoles(node *corev1.Node) []string {
|
|||
return roles.List()
|
||||
}
|
||||
|
||||
// loadBalancerStatusStringer behaves mostly like a string interface and converts the given status to a string.
|
||||
// ingressLoadBalancerStatusStringerV1 behaves mostly like a string interface and converts the given status to a string.
|
||||
// `wide` indicates whether the returned value is meant for --o=wide output. If not, it's clipped to 16 bytes.
|
||||
func loadBalancerStatusStringer(s corev1.LoadBalancerStatus, wide bool) string {
|
||||
func ingressLoadBalancerStatusStringerV1(s networkingv1.IngressLoadBalancerStatus, wide bool) string {
|
||||
ingress := s.Ingress
|
||||
result := sets.NewString()
|
||||
for i := range ingress {
|
||||
if ingress[i].IP != "" {
|
||||
result.Insert(ingress[i].IP)
|
||||
} else if ingress[i].Hostname != "" {
|
||||
result.Insert(ingress[i].Hostname)
|
||||
}
|
||||
}
|
||||
|
||||
r := strings.Join(result.List(), ",")
|
||||
if !wide && len(r) > LoadBalancerWidth {
|
||||
r = r[0:(LoadBalancerWidth-3)] + "..."
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
// ingressLoadBalancerStatusStringerV1beta1 behaves mostly like a string interface and converts the given status to a string.
|
||||
// `wide` indicates whether the returned value is meant for --o=wide output. If not, it's clipped to 16 bytes.
|
||||
func ingressLoadBalancerStatusStringerV1beta1(s networkingv1beta1.IngressLoadBalancerStatus, wide bool) string {
|
||||
ingress := s.Ingress
|
||||
result := sets.NewString()
|
||||
for i := range ingress {
|
||||
|
|
Loading…
Reference in New Issue