add vendor files
Signed-off-by: Garrybest <garrybest@foxmail.com>
This commit is contained in:
parent
026781f207
commit
40becff2a1
2
go.mod
2
go.mod
|
@ -9,7 +9,6 @@ require (
|
|||
github.com/gogo/protobuf v1.3.2
|
||||
github.com/golang/mock v1.6.0
|
||||
github.com/google/go-cmp v0.5.6
|
||||
github.com/google/uuid v1.1.2
|
||||
github.com/kr/pretty v0.3.0
|
||||
github.com/olekukonko/tablewriter v0.0.4
|
||||
github.com/onsi/ginkgo/v2 v2.1.3
|
||||
|
@ -87,6 +86,7 @@ require (
|
|||
github.com/google/gofuzz v1.2.0 // indirect
|
||||
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect
|
||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
|
||||
github.com/google/uuid v1.1.2 // indirect
|
||||
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect
|
||||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
Copyright 2020 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.
|
||||
*/
|
||||
|
||||
package topology
|
||||
|
||||
import (
|
||||
"k8s.io/api/core/v1"
|
||||
)
|
||||
|
||||
// GetZoneKey is a helper function that builds a string identifier that is unique per failure-zone;
|
||||
// it returns empty-string for no zone.
|
||||
// Since there are currently two separate zone keys:
|
||||
// * "failure-domain.beta.kubernetes.io/zone"
|
||||
// * "topology.kubernetes.io/zone"
|
||||
// GetZoneKey will first check failure-domain.beta.kubernetes.io/zone and if not exists, will then check
|
||||
// topology.kubernetes.io/zone
|
||||
func GetZoneKey(node *v1.Node) string {
|
||||
labels := node.Labels
|
||||
if labels == nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
// TODO: "failure-domain.beta..." names are deprecated, but will
|
||||
// stick around a long time due to existing on old extant objects like PVs.
|
||||
// Maybe one day we can stop considering them (see #88493).
|
||||
zone, ok := labels[v1.LabelFailureDomainBetaZone]
|
||||
if !ok {
|
||||
zone, _ = labels[v1.LabelTopologyZone]
|
||||
}
|
||||
|
||||
region, ok := labels[v1.LabelFailureDomainBetaRegion]
|
||||
if !ok {
|
||||
region, _ = labels[v1.LabelTopologyRegion]
|
||||
}
|
||||
|
||||
if region == "" && zone == "" {
|
||||
return ""
|
||||
}
|
||||
|
||||
// We include the null character just in case region or failureDomain has a colon
|
||||
// (We do assume there's no null characters in a region or failureDomain)
|
||||
// As a nice side-benefit, the null character is not printed by fmt.Print or glog
|
||||
return region + ":\x00:" + zone
|
||||
}
|
|
@ -1383,6 +1383,7 @@ k8s.io/component-base/version
|
|||
# k8s.io/component-helpers v0.24.2
|
||||
## explicit; go 1.16
|
||||
k8s.io/component-helpers/apimachinery/lease
|
||||
k8s.io/component-helpers/node/topology
|
||||
k8s.io/component-helpers/scheduling/corev1
|
||||
k8s.io/component-helpers/scheduling/corev1/nodeaffinity
|
||||
# k8s.io/gengo v0.0.0-20211129171323-c02415ce4185
|
||||
|
|
Loading…
Reference in New Issue