diff --git a/go.mod b/go.mod index cd081fb7d..6e27c1af9 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/cilium/hubble go 1.17 require ( - github.com/cilium/cilium v1.11.0 + github.com/cilium/cilium v1.11.1 github.com/fatih/color v1.13.0 github.com/google/go-cmp v0.5.6 github.com/sirupsen/logrus v1.8.1 diff --git a/go.sum b/go.sum index 60fd7cf67..eb4e68cae 100644 --- a/go.sum +++ b/go.sum @@ -149,20 +149,18 @@ github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZo github.com/aws/aws-sdk-go v1.34.28/go.mod h1:H7NKnBqNVzoTJpGfLrQkkD+ytBA93eiDYi/+8rV9s48= github.com/aws/aws-sdk-go v1.40.45/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q= github.com/aws/aws-sdk-go-v2 v1.9.1/go.mod h1:cK/D0BBs0b/oWPIcX/Z/obahJK1TT7IPVjy53i/mX/4= -github.com/aws/aws-sdk-go-v2 v1.11.0/go.mod h1:SQfA+m2ltnu1cA0soUkj4dRSsmITiVQUJvBIZjzfPyQ= -github.com/aws/aws-sdk-go-v2 v1.11.1/go.mod h1:SQfA+m2ltnu1cA0soUkj4dRSsmITiVQUJvBIZjzfPyQ= -github.com/aws/aws-sdk-go-v2/config v1.10.0/go.mod h1:xuqoV5etD3N3B8Ts9je4ijgAv6mb+6NiOPFMUhwRcjA= -github.com/aws/aws-sdk-go-v2/credentials v1.6.0/go.mod h1:rQkYdQPDXRrvPLeEuCNwSgtwMzBo9eDGWlTNC69Sh/0= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.8.0/go.mod h1:5E1J3/TTYy6z909QNR0QnXGBpfESYGDqd3O0zqONghU= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.8.1/go.mod h1:MYiG3oeEcmrdBOV7JOIWhionzyRZJWCnByS5FmvhAoU= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.0/go.mod h1:NO3Q5ZTTQtO2xIg2+xTXYDiT7knSejfeDm7WGDaOo0U= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.0.0/go.mod h1:anlUzBoEWglcUxUQwZA7HQOEVEnQALVZsizAapB2hq8= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.0/go.mod h1:6oXGy4GLpypD3uCh8wcqztigGgmhLToMfjavgh+VySg= +github.com/aws/aws-sdk-go-v2 v1.11.2/go.mod h1:SQfA+m2ltnu1cA0soUkj4dRSsmITiVQUJvBIZjzfPyQ= +github.com/aws/aws-sdk-go-v2/config v1.11.0/go.mod h1:VrQDJGFBM5yZe+IOeenNZ/DWoErdny+k2MHEIpwDsEY= +github.com/aws/aws-sdk-go-v2/credentials v1.6.4/go.mod h1:tTrhvBPHyPde4pdIPSba4Nv7RYr4wP9jxXEDa1bKn/8= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.8.2/go.mod h1:dF2F6tXEOgmW5X1ZFO/EPtWrcm7XkW07KNcJUGNtt4s= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.2/go.mod h1:SgKKNBIoDC/E1ZCDhhMW3yalWjwuLjMcpLzsM/QQnWo= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.0.2/go.mod h1:xT4XX6w5Sa3dhg50JrYyy3e4WPYo/+WjY/BXtqXVunU= +github.com/aws/aws-sdk-go-v2/internal/ini v1.3.2/go.mod h1:VITe/MdW6EMXPb0o0txu/fsonXbMHUU2OC2Qp7ivU4o= github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.8.1/go.mod h1:CM+19rL1+4dFWnOQKwDc7H1KwXTz+h61oUSHyhV0b3o= -github.com/aws/aws-sdk-go-v2/service/ec2 v1.21.0/go.mod h1:kK7lSKNwAqIMKVCTsfVcN82m8pvuPUf+6g/zrz/PnE0= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.5.0/go.mod h1:Mq6AEc+oEjCUlBuLiK5YwW4shSOAKCQ3tXN0sQeYoBA= -github.com/aws/aws-sdk-go-v2/service/sso v1.6.0/go.mod h1:Q/l0ON1annSU+mc0JybDy1Gy6dnJxIcWjphO6qJPzvM= -github.com/aws/aws-sdk-go-v2/service/sts v1.9.0/go.mod h1:jLKCFqS+1T4i7HDqCP9GM4Uk75YW1cS0o82LdxpMyOE= +github.com/aws/aws-sdk-go-v2/service/ec2 v1.25.0/go.mod h1:cIbz+b70nxJafXf9lT07Xj03pef6CsVdYTCCR0DQEQc= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.5.2/go.mod h1:FgR1tCsn8C6+Hf+N5qkfrE4IXvUL1RgW87sunJ+5J4I= +github.com/aws/aws-sdk-go-v2/service/sso v1.6.2/go.mod h1:KnIpszaIdwI33tmc/W/GGXyn22c1USYxA/2KyvoeDY0= +github.com/aws/aws-sdk-go-v2/service/sts v1.11.1/go.mod h1:UV2N5HaPfdbDpkgkz4sRzWCvQswZjdO1FfqCWl0t7RA= github.com/aws/smithy-go v1.8.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= github.com/aws/smithy-go v1.9.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= @@ -206,8 +204,8 @@ github.com/christarazi/controller-tools v0.6.2/go.mod h1:oaeGpjXn6+ZSEIQkUe/+3I4 github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/cilium/cilium v1.11.0 h1:uHgtn78k0ug2sQYUvytIVmWFaYxYFplDv0ScLBxgieA= -github.com/cilium/cilium v1.11.0/go.mod h1:mbw4BGSsHXJkeNu09TH8S+sOzI/yEHC/VgzhBqS3des= +github.com/cilium/cilium v1.11.1 h1:Q6GRmmZxADW/GxaYKJc2vo2z5n8haBxav3pLCgzjsdI= +github.com/cilium/cilium v1.11.1/go.mod h1:xdLxOE/3FhilCPBFrOyhuyUzze3siRoIWmEQ2uJGHQk= github.com/cilium/customvet v0.0.0-20201209211516-9852765c1ac4/go.mod h1:MEn5V1CejgUNFP3Y1JKmBC6Mb9TuK53ecHG9lffctFg= github.com/cilium/deepequal-gen v0.0.0-20200406125435-ad6a9003139e/go.mod h1:c4R5wxGyXhbM6zyKeRKNIc9aab5EZi4z4oOSZvUMvZA= github.com/cilium/dns v1.1.4-0.20190417235132-8e25ec9a0ff3/go.mod h1:cXN7jgo+gsGlNvQ7Vqu2ELdc3f7i7PPgupHqSkLzzBo= @@ -1933,34 +1931,35 @@ k8s.io/api v0.20.2/go.mod h1:d7n6Ehyzx+S+cE3VhTGfVNNqtGc/oL9DCdYYahlurV8= k8s.io/api v0.20.4/go.mod h1:++lNL1AJMkDymriNniQsWRkMDzRaX2Y/POTUi8yvqYQ= k8s.io/api v0.20.6/go.mod h1:X9e8Qag6JV/bL5G6bU8sdVRltWKmdHsFUGS3eVndqE8= k8s.io/api v0.21.3/go.mod h1:hUgeYHUbBp23Ue4qdX9tR8/ANi/g3ehylAqDn9NWVOg= -k8s.io/api v0.24.0-alpha.0/go.mod h1:deWo+4OwHTtia+zwLZirxNA0Unp1Y/a4lsmydSRUqp8= +k8s.io/api v0.23.0/go.mod h1:8wmDdLBHBNxtOIytwLstXt5E9PddnZb0GaMcqsvDBpg= k8s.io/apiextensions-apiserver v0.21.3/go.mod h1:kl6dap3Gd45+21Jnh6utCx8Z2xxLm8LGDkprcd+KbsE= -k8s.io/apiextensions-apiserver v0.24.0-alpha.0/go.mod h1:CFbn7MgT/EzL4JFBWbHQOdlATbzXtFaMoiBZuIqhE6k= +k8s.io/apiextensions-apiserver v0.23.0/go.mod h1:xIFAEEDlAZgpVBl/1VSjGDmLoXAWRG40+GsWhKhAxY4= k8s.io/apimachinery v0.20.1/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU= k8s.io/apimachinery v0.20.2/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU= k8s.io/apimachinery v0.20.4/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU= k8s.io/apimachinery v0.20.6/go.mod h1:ejZXtW1Ra6V1O5H8xPBGz+T3+4gfkTCeExAHKU57MAc= k8s.io/apimachinery v0.21.3/go.mod h1:H/IM+5vH9kZRNJ4l3x/fXP/5bOPJaVP/guptnZPeCFI= +k8s.io/apimachinery v0.23.0/go.mod h1:fFCTTBKvKcwTPFzjlcxp91uPFZr+JA0FubU4fLzzFYc= k8s.io/apimachinery v0.24.0-alpha.0 h1:FChRBdwz3dJDpfIBXaSRlDQQ6FOHiRvgAHaRAynx73s= k8s.io/apimachinery v0.24.0-alpha.0/go.mod h1:SqloDTPqePPNhEp8K4qUgqpKc3tE+ymn05iIUbSAQ7g= k8s.io/apiserver v0.20.1/go.mod h1:ro5QHeQkgMS7ZGpvf4tSMx6bBOgPfE+f52KwvXfScaU= k8s.io/apiserver v0.20.4/go.mod h1:Mc80thBKOyy7tbvFtB4kJv1kbdD0eIH8k8vianJcbFM= k8s.io/apiserver v0.20.6/go.mod h1:QIJXNt6i6JB+0YQRNcS0hdRHJlMhflFmsBDeSgT1r8Q= k8s.io/apiserver v0.21.3/go.mod h1:eDPWlZG6/cCCMj/JBcEpDoK+I+6i3r9GsChYBHSbAzU= -k8s.io/apiserver v0.24.0-alpha.0/go.mod h1:Wzy5gdcJO/YD+eQ7ehQpVnC36E2HPZ9kDtQcFF+5qmM= +k8s.io/apiserver v0.23.0/go.mod h1:Cec35u/9zAepDPPFyT+UMrgqOCjgJ5qtfVJDxjZYmt4= k8s.io/client-go v0.20.1/go.mod h1:/zcHdt1TeWSd5HoUe6elJmHSQ6uLLgp4bIJHVEuy+/Y= k8s.io/client-go v0.20.2/go.mod h1:kH5brqWqp7HDxUFKoEgiI4v8G1xzbe9giaCenUWJzgE= k8s.io/client-go v0.20.4/go.mod h1:LiMv25ND1gLUdBeYxBIwKpkSC5IsozMMmOOeSJboP+k= k8s.io/client-go v0.20.6/go.mod h1:nNQMnOvEUEsOzRRFIIkdmYOjAZrC8bgq0ExboWSU1I0= k8s.io/client-go v0.21.3/go.mod h1:+VPhCgTsaFmGILxR/7E1N0S+ryO010QBeNCv5JwRGYU= -k8s.io/client-go v0.24.0-alpha.0/go.mod h1:tQEmSne6/r+o6F5m9q0zx2R7zgm9xXmnNuIgsUWcMxw= +k8s.io/client-go v0.23.0/go.mod h1:hrDnpnK1mSr65lHHcUuIZIXDgEbzc7/683c6hyG4jTA= k8s.io/code-generator v0.21.3/go.mod h1:K3y0Bv9Cz2cOW2vXUrNZlFbflhuPvuadW6JdnN6gGKo= -k8s.io/code-generator v0.24.0-alpha.0/go.mod h1:mObJbeTbuUA4VfVCtZI0nS/oLJRp+s2A07sH+fMregI= +k8s.io/code-generator v0.23.0/go.mod h1:vQvOhDXhuzqiVfM/YHp+dmg10WDZCchJVObc9MvowsE= k8s.io/component-base v0.20.1/go.mod h1:guxkoJnNoh8LNrbtiQOlyp2Y2XFCZQmrcg2n/DeYNLk= k8s.io/component-base v0.20.4/go.mod h1:t4p9EdiagbVCJKrQ1RsA5/V4rFQNDfRlevJajlGwgjI= k8s.io/component-base v0.20.6/go.mod h1:6f1MPBAeI+mvuts3sIdtpjljHWBQ2cIy38oBIWMYnrM= k8s.io/component-base v0.21.3/go.mod h1:kkuhtfEHeZM6LkX0saqSK8PbdO7A0HigUngmhhrwfGQ= -k8s.io/component-base v0.24.0-alpha.0/go.mod h1:oV8LeZkXpFiAHKmrdYcgsHzeF4HaDVipKo701EjtAt8= +k8s.io/component-base v0.23.0/go.mod h1:DHH5uiFvLC1edCpvcTDV++NKULdYYU6pR9Tt3HIKMKI= k8s.io/cri-api v0.17.3/go.mod h1:X1sbHmuXhwaHs9xxYffLqJogVsnI+f6cPRcgPel7ywM= k8s.io/cri-api v0.20.1/go.mod h1:2JRbKt+BFLTjtrILYVqQK5jqhI+XNdF6UiGMgczeBCI= k8s.io/cri-api v0.20.4/go.mod h1:2JRbKt+BFLTjtrILYVqQK5jqhI+XNdF6UiGMgczeBCI= diff --git a/vendor/github.com/cilium/cilium/AUTHORS b/vendor/github.com/cilium/cilium/AUTHORS index 9c2570d49..62f35af8d 100644 --- a/vendor/github.com/cilium/cilium/AUTHORS +++ b/vendor/github.com/cilium/cilium/AUTHORS @@ -11,6 +11,7 @@ Akshat Agarwal humancalico@disroot.org Alban Crequy alban@kinvolk.io Aleksei Zakharov zakharov.a.g@yandex.ru Alexander Alemayhu alexander@alemayhu.com +Alexander Block ablock84@gmail.com Alexandre Perrin alex@kaworu.ch Alexei Starovoitov alexei.starovoitov@gmail.com Alex Romanov alex@romanov.ws @@ -130,6 +131,7 @@ Gowtham Sundara gowtham.sundara@rapyuta-robotics.com Guilherme Oki guilherme.oki@wildlifestudios.com Guilherme Souza 101073+guilhermef@users.noreply.github.com Han Zhou hzhou8@ebay.com +Hemanth Malla hemanth.malla@datadoghq.com Hemslo Wang hemslo.wang@gmail.com huangxuesen huangxuesen@kuaishou.com Hui Kong hui.kong@qunar.com @@ -138,6 +140,7 @@ Ian Vernon ian@cilium.io Ifeanyi Ubah ify1992@yahoo.com Ilya Dmitrichenko errordeveloper@gmail.com Ilya Shaisultanov ilya.shaisultanov@gmail.com +Ivan Makarychev i.makarychev@tinkoff.ru Ivar Lazzaro ivarlazzaro@gmail.com Jaff Cheng jaff.cheng.sh@gmail.com Jaime Caamaño Ruiz jcaamano@suse.com @@ -239,6 +242,7 @@ Nate Sweet nathanjsweet@pm.me Nathan Bird njbird@infiniteenergy.com nathannaveen 42319948+nathannaveen@users.noreply.github.com Nathan Taylor ntaylor1781@gmail.com +Necatican Yıldırım necaticanyildirim@gmail.com Neela Jacques neela@isovalent.com Neil Wilson neil@aldur.co.uk Nick M 4718+rkage@users.noreply.github.com @@ -260,6 +264,7 @@ Pranavi Roy pranvyr@gmail.com Pratyush Singhal psinghal20@gmail.com Qasim Sarfraz qasim.sarfraz@esailors.de Quentin Monnet quentin@isovalent.com +Raamnath Mani ram29@bskyb.com Raghu Gyambavantha raghug@bld-ml-loan4.olympus.f5net.com Rahul Jadhav nyrahul@gmail.com Rajat Jindal rajatjindal83@gmail.com @@ -289,6 +294,7 @@ Sean Winn sean@isovalent.com Sebastian Wicki sebastian@isovalent.com Sergey Generalov sergey@isovalent.com Sergey Monakhov monakhov@puzl.ee +Sergio Ballesteros snaker@locolandia.net Shantanu Deshpande shantanud106@gmail.com Simon Pasquier spasquier@mirantis.com Smaine Kahlouch smainklh@gmail.com @@ -343,6 +349,7 @@ Wenxian Li wofanli@gmail.com Will Deuschle wdeuschle@palantir.com Will Stewart will@northflank.com Xinyuan Zhang zhangxinyuan@google.com +yanhongchang yanhongchang@100tal.com Yiannis Yiakoumis yiannis@selfienetworks.com Yongkun Gui ygui@google.com Yosh de Vos yosh@elzorro.nl diff --git a/vendor/github.com/cilium/cilium/api/v1/health/models/endpoint_status.go b/vendor/github.com/cilium/cilium/api/v1/health/models/endpoint_status.go new file mode 100644 index 000000000..cf6a50de1 --- /dev/null +++ b/vendor/github.com/cilium/cilium/api/v1/health/models/endpoint_status.go @@ -0,0 +1,109 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// Copyright 2017-2021 Authors of Cilium +// SPDX-License-Identifier: Apache-2.0 + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// EndpointStatus Connectivity status to host cilium-health endpoints via different paths +// +// +// swagger:model EndpointStatus +type EndpointStatus struct { + + // primary address + PrimaryAddress *PathStatus `json:"primary-address,omitempty"` + + // secondary addresses + SecondaryAddresses []*PathStatus `json:"secondary-addresses"` +} + +// Validate validates this endpoint status +func (m *EndpointStatus) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validatePrimaryAddress(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSecondaryAddresses(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *EndpointStatus) validatePrimaryAddress(formats strfmt.Registry) error { + + if swag.IsZero(m.PrimaryAddress) { // not required + return nil + } + + if m.PrimaryAddress != nil { + if err := m.PrimaryAddress.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("primary-address") + } + return err + } + } + + return nil +} + +func (m *EndpointStatus) validateSecondaryAddresses(formats strfmt.Registry) error { + + if swag.IsZero(m.SecondaryAddresses) { // not required + return nil + } + + for i := 0; i < len(m.SecondaryAddresses); i++ { + if swag.IsZero(m.SecondaryAddresses[i]) { // not required + continue + } + + if m.SecondaryAddresses[i] != nil { + if err := m.SecondaryAddresses[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("secondary-addresses" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *EndpointStatus) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *EndpointStatus) UnmarshalBinary(b []byte) error { + var res EndpointStatus + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/cilium/cilium/api/v1/health/models/node_status.go b/vendor/github.com/cilium/cilium/api/v1/health/models/node_status.go index 5d9cbc944..5df4b4c68 100644 --- a/vendor/github.com/cilium/cilium/api/v1/health/models/node_status.go +++ b/vendor/github.com/cilium/cilium/api/v1/health/models/node_status.go @@ -19,9 +19,14 @@ import ( // swagger:model NodeStatus type NodeStatus struct { - // Connectivity status to simulated endpoint on node IP + // DEPRECATED: Please use the health-endpoint field instead, which + // supports reporting the status of different addresses for the endpoint + // Endpoint *PathStatus `json:"endpoint,omitempty"` + // Connectivity status to simulated endpoint on the node + HealthEndpoint *EndpointStatus `json:"health-endpoint,omitempty"` + // Connectivity status to cilium-health instance on node IP Host *HostStatus `json:"host,omitempty"` @@ -37,6 +42,10 @@ func (m *NodeStatus) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateHealthEndpoint(formats); err != nil { + res = append(res, err) + } + if err := m.validateHost(formats); err != nil { res = append(res, err) } @@ -65,6 +74,24 @@ func (m *NodeStatus) validateEndpoint(formats strfmt.Registry) error { return nil } +func (m *NodeStatus) validateHealthEndpoint(formats strfmt.Registry) error { + + if swag.IsZero(m.HealthEndpoint) { // not required + return nil + } + + if m.HealthEndpoint != nil { + if err := m.HealthEndpoint.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("health-endpoint") + } + return err + } + } + + return nil +} + func (m *NodeStatus) validateHost(formats strfmt.Registry) error { if swag.IsZero(m.Host) { // not required diff --git a/vendor/github.com/cilium/cilium/pkg/health/client/client.go b/vendor/github.com/cilium/cilium/pkg/health/client/client.go index da40c9e33..fe93c9834 100644 --- a/vendor/github.com/cilium/cilium/pkg/health/client/client.go +++ b/vendor/github.com/cilium/cilium/pkg/health/client/client.go @@ -158,6 +158,23 @@ func GetPathConnectivityStatusType(cp *models.PathStatus) ConnectivityStatusType return status } +func SummarizePathConnectivityStatusType(cps []*models.PathStatus) ConnectivityStatusType { + status := ConnStatusReachable + for _, cp := range cps { + switch GetPathConnectivityStatusType(cp) { + case ConnStatusUnreachable: + // If any status is unreachable, return it immediately. + return ConnStatusUnreachable + case ConnStatusUnknown: + // If the status is unknown, prepare to return it. It's + // going to be returned if there is no unreachable + // status in next iterations. + status = ConnStatusUnknown + } + } + return status +} + func formatConnectivityStatus(w io.Writer, cs *models.ConnectivityStatus, path, indent string) { status := cs.Status switch GetConnectivityStatusType(cs) { @@ -186,30 +203,32 @@ func formatPathStatus(w io.Writer, name string, cp *models.PathStatus, indent st } } -// pathIsHealthyOrUnknown checks whether ICMP and TCP(HTTP) connectivity to the -// given path is available or had no explicit error status (which usually is the -// case when the new node is provisioned). -func pathIsHealthyOrUnknown(cp *models.PathStatus) bool { - if cp == nil { - return false - } - - statuses := []*models.ConnectivityStatus{ - cp.Icmp, - cp.HTTP, - } - for _, status := range statuses { - switch GetConnectivityStatusType(status) { - case ConnStatusUnreachable: +// allPathsAreHealthyOrUnknown checks whether ICMP and TCP(HTTP) connectivity +// to the given paths is available or had no explicit error status +// (which usually is the case when the new node is provisioned). +func allPathsAreHealthyOrUnknown(cps []*models.PathStatus) bool { + for _, cp := range cps { + if cp == nil { return false } + + statuses := []*models.ConnectivityStatus{ + cp.Icmp, + cp.HTTP, + } + for _, status := range statuses { + switch GetConnectivityStatusType(status) { + case ConnStatusUnreachable: + return false + } + } } return true } func nodeIsHealthy(node *models.NodeStatus) bool { - return pathIsHealthyOrUnknown(GetHostPrimaryAddress(node)) && - (node.Endpoint == nil || pathIsHealthyOrUnknown(node.Endpoint)) + return allPathsAreHealthyOrUnknown(GetAllHostAddresses(node)) && + allPathsAreHealthyOrUnknown(GetAllEndpointAddresses(node)) } func nodeIsLocalhost(node *models.NodeStatus, self *models.SelfStatus) bool { @@ -234,6 +253,57 @@ func GetHostPrimaryAddress(node *models.NodeStatus) *models.PathStatus { return node.Host.PrimaryAddress } +// GetHostSecondaryAddresses returns the secondary host addresses (if any) +func GetHostSecondaryAddresses(node *models.NodeStatus) []*models.PathStatus { + if node.Host == nil { + return nil + } + + return node.Host.SecondaryAddresses +} + +// GetAllHostAddresses returns a list of all addresses (primary and any +// and any secondary) for the host of a given node. If node.Host is nil, +// returns nil. +func GetAllHostAddresses(node *models.NodeStatus) []*models.PathStatus { + if node.Host == nil { + return nil + } + + return append([]*models.PathStatus{node.Host.PrimaryAddress}, node.Host.SecondaryAddresses...) +} + +// GetEndpointPrimaryAddress returns the PrimaryAddress for the health endpoint +// within node. If node.HealthEndpoint is nil, returns nil. +func GetEndpointPrimaryAddress(node *models.NodeStatus) *models.PathStatus { + if node.HealthEndpoint == nil { + return nil + } + + return node.HealthEndpoint.PrimaryAddress +} + +// GetEndpointSecondaryAddresses returns the secondary health endpoint addresses +// (if any) +func GetEndpointSecondaryAddresses(node *models.NodeStatus) []*models.PathStatus { + if node.HealthEndpoint == nil { + return nil + } + + return node.HealthEndpoint.SecondaryAddresses +} + +// GetAllEndpointAddresses returns a list of all addresses (primary and any +// and any secondary) for the health endpoint within a given node. +// If node.HealthEndpoint is nil, returns nil. +func GetAllEndpointAddresses(node *models.NodeStatus) []*models.PathStatus { + if node.HealthEndpoint == nil { + return nil + } + + return node.HealthEndpoint.SecondaryAddresses +} + func formatNodeStatus(w io.Writer, node *models.NodeStatus, printAll, succinct, verbose, localhost bool) { localStr := "" if localhost { @@ -241,21 +311,27 @@ func formatNodeStatus(w io.Writer, node *models.NodeStatus, printAll, succinct, } if succinct { if printAll || !nodeIsHealthy(node) { - fmt.Fprintf(w, " %s%s\t%s\t%s\t%s\n", node.Name, localStr, getPrimaryAddressIP(node), - GetPathConnectivityStatusType(GetHostPrimaryAddress(node)).String(), - GetPathConnectivityStatusType(node.Endpoint).String()) + SummarizePathConnectivityStatusType(GetAllHostAddresses(node)).String(), + SummarizePathConnectivityStatusType(GetAllEndpointAddresses(node)).String()) } } else { fmt.Fprintf(w, " %s%s:\n", node.Name, localStr) formatPathStatus(w, "Host", GetHostPrimaryAddress(node), " ", verbose) - if verbose && node.Host != nil { + unhealthyPaths := !allPathsAreHealthyOrUnknown(GetHostSecondaryAddresses(node)) + if (verbose || unhealthyPaths) && node.Host != nil { for _, addr := range node.Host.SecondaryAddresses { formatPathStatus(w, "Secondary", addr, " ", verbose) } } - formatPathStatus(w, "Endpoint", node.Endpoint, " ", verbose) + formatPathStatus(w, "Endpoint", GetEndpointPrimaryAddress(node), " ", verbose) + unhealthyPaths = !allPathsAreHealthyOrUnknown(GetEndpointSecondaryAddresses(node)) + if (verbose || unhealthyPaths) && node.HealthEndpoint != nil { + for _, addr := range node.HealthEndpoint.SecondaryAddresses { + formatPathStatus(w, "Secondary", addr, " ", verbose) + } + } } } diff --git a/vendor/github.com/cilium/cilium/pkg/identity/numericidentity.go b/vendor/github.com/cilium/cilium/pkg/identity/numericidentity.go index c85cf0953..e1f626c7c 100644 --- a/vendor/github.com/cilium/cilium/pkg/identity/numericidentity.go +++ b/vendor/github.com/cilium/cilium/pkg/identity/numericidentity.go @@ -311,10 +311,13 @@ func InitWellKnownIdentities(c Configuration) int { WellKnown.add(ReservedCiliumEtcdOperator2, append(ciliumEtcdOperatorLabels, fmt.Sprintf("k8s:%s=%s", api.PodNamespaceMetaNameLabel, c.CiliumNamespaceName()))) - // For ClusterID > 0, the identity range just starts from cluster shift, - // no well known identities need to be reserved from that range. if option.Config.ClusterID > 0 { + // For ClusterID > 0, the identity range just starts from cluster shift, + // no well-known-identities need to be reserved from the range. MinimalAllocationIdentity = NumericIdentity((1 << ClusterIDShift) * option.Config.ClusterID) + // The maximum identity also needs to be recalculated as ClusterID + // may be overwritten by runtime parameters. + MaximumAllocationIdentity = NumericIdentity((1<