use istio client-go library instead of knative (#1661)

use istio client-go library instead of knative
bump kubernetes dependency version
change code coverage to codecov
This commit is contained in:
zryfish
2019-12-13 11:26:18 +08:00
committed by GitHub
parent f249a6e081
commit ea88c8803d
2071 changed files with 354531 additions and 108336 deletions

View File

@@ -129,6 +129,20 @@ func (r bgpConfigurations) ValidateDefaultOnlyFields(res *apiv3.BGPConfiguration
Reason: "Cannot set ASNumber on a non default BGP Configuration.",
})
}
if res.Spec.ServiceExternalIPs != nil && len(res.Spec.ServiceExternalIPs) > 0 {
errFields = append(errFields, cerrors.ErroredField{
Name: "BGPConfiguration.Spec.ServiceExternalIPs",
Reason: "Cannot set ServiceExternalIPs on a non default BGP Configuration.",
})
}
if res.Spec.ServiceClusterIPs != nil && len(res.Spec.ServiceClusterIPs) > 0 {
errFields = append(errFields, cerrors.ErroredField{
Name: "BGPConfiguration.Spec.ServiceClusterIPs",
Reason: "Cannot set ServiceClusterIPs on a non default BGP Configuration.",
})
}
}
if len(errFields) > 0 {

View File

@@ -24,10 +24,10 @@ import (
"strings"
"time"
"github.com/satori/go.uuid"
uuid "github.com/satori/go.uuid"
"github.com/projectcalico/libcalico-go/lib/apiconfig"
"github.com/projectcalico/libcalico-go/lib/apis/v3"
v3 "github.com/projectcalico/libcalico-go/lib/apis/v3"
"github.com/projectcalico/libcalico-go/lib/backend"
bapi "github.com/projectcalico/libcalico-go/lib/backend/api"
cerrors "github.com/projectcalico/libcalico-go/lib/errors"

View File

@@ -115,6 +115,32 @@ func (r nodes) Delete(ctx context.Context, name string, opts options.DeleteOptio
}
}
}
// Add in tunnel addresses if they exist for the node.
if n, err := r.client.Nodes().Get(ctx, name, options.GetOptions{}); err != nil {
if _, ok := err.(errors.ErrorResourceDoesNotExist); !ok {
return nil, err
}
// Resource does not exist, carry on and clean up as much as we can.
} else {
if n.Spec.BGP != nil && n.Spec.BGP.IPv4IPIPTunnelAddr != "" {
ipAddr, _, err := cnet.ParseCIDROrIP(n.Spec.BGP.IPv4IPIPTunnelAddr)
if err == nil {
ips = append(ips, *ipAddr)
} else {
log.WithError(err).Warnf("Failed to parse IPIP tunnel address CIDR: %s", n.Spec.BGP.IPv4IPIPTunnelAddr)
}
}
if n.Spec.IPv4VXLANTunnelAddr != "" {
ipAddr, _, err := cnet.ParseCIDROrIP(n.Spec.IPv4VXLANTunnelAddr)
if err == nil {
ips = append(ips, *ipAddr)
} else {
log.WithError(err).Warnf("Failed to parse VXLAN tunnel address CIDR: %s", n.Spec.IPv4VXLANTunnelAddr)
}
}
}
_, err = r.client.IPAM().ReleaseIPs(context.Background(), ips)
switch err.(type) {
case nil, errors.ErrorResourceDoesNotExist, errors.ErrorOperationNotSupported:

View File

@@ -20,7 +20,7 @@ import (
log "github.com/sirupsen/logrus"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/apis/meta/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/uuid"