mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
rebase: update kubernetes to v1.20.0
updated kubernetes packages to latest release. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
4abe128bd8
commit
83559144b1
100
vendor/k8s.io/cloud-provider/volume/helpers/rounding.go
generated
vendored
100
vendor/k8s.io/cloud-provider/volume/helpers/rounding.go
generated
vendored
@ -39,74 +39,88 @@ const (
|
||||
KiB = 1024
|
||||
)
|
||||
|
||||
// RoundUpToGB rounds up given quantity to chunks of GB
|
||||
func RoundUpToGB(size resource.Quantity) int64 {
|
||||
requestBytes := size.Value()
|
||||
return roundUpSize(requestBytes, GB)
|
||||
}
|
||||
|
||||
// RoundUpToGiB rounds up given quantity upto chunks of GiB
|
||||
func RoundUpToGiB(size resource.Quantity) int64 {
|
||||
requestBytes := size.Value()
|
||||
return roundUpSize(requestBytes, GiB)
|
||||
func RoundUpToGiB(size resource.Quantity) (int64, error) {
|
||||
requestBytes, ok := size.AsInt64()
|
||||
if !ok {
|
||||
return 0, fmt.Errorf("quantity %s is too great, overflows int64", size.String())
|
||||
}
|
||||
return roundUpSize(requestBytes, GiB), nil
|
||||
}
|
||||
|
||||
// RoundUpToMB rounds up given quantity to chunks of MB
|
||||
func RoundUpToMB(size resource.Quantity) int64 {
|
||||
requestBytes := size.Value()
|
||||
return roundUpSize(requestBytes, MB)
|
||||
func RoundUpToMB(size resource.Quantity) (int64, error) {
|
||||
requestBytes, ok := size.AsInt64()
|
||||
if !ok {
|
||||
return 0, fmt.Errorf("quantity %s is too great, overflows int64", size.String())
|
||||
}
|
||||
return roundUpSize(requestBytes, MB), nil
|
||||
}
|
||||
|
||||
// RoundUpToMiB rounds up given quantity upto chunks of MiB
|
||||
func RoundUpToMiB(size resource.Quantity) int64 {
|
||||
requestBytes := size.Value()
|
||||
return roundUpSize(requestBytes, MiB)
|
||||
func RoundUpToMiB(size resource.Quantity) (int64, error) {
|
||||
requestBytes, ok := size.AsInt64()
|
||||
if !ok {
|
||||
return 0, fmt.Errorf("quantity %s is too great, overflows int64", size.String())
|
||||
}
|
||||
return roundUpSize(requestBytes, MiB), nil
|
||||
}
|
||||
|
||||
// RoundUpToKB rounds up given quantity to chunks of KB
|
||||
func RoundUpToKB(size resource.Quantity) int64 {
|
||||
requestBytes := size.Value()
|
||||
return roundUpSize(requestBytes, KB)
|
||||
func RoundUpToKB(size resource.Quantity) (int64, error) {
|
||||
requestBytes, ok := size.AsInt64()
|
||||
if !ok {
|
||||
return 0, fmt.Errorf("quantity %s is too great, overflows int64", size.String())
|
||||
}
|
||||
return roundUpSize(requestBytes, KB), nil
|
||||
}
|
||||
|
||||
// RoundUpToKiB rounds up given quantity upto chunks of KiB
|
||||
func RoundUpToKiB(size resource.Quantity) int64 {
|
||||
requestBytes := size.Value()
|
||||
return roundUpSize(requestBytes, KiB)
|
||||
}
|
||||
|
||||
// RoundUpToGBInt rounds up given quantity to chunks of GB. It returns an
|
||||
// int instead of an int64 and an error if there's overflow
|
||||
func RoundUpToGBInt(size resource.Quantity) (int, error) {
|
||||
requestBytes := size.Value()
|
||||
return roundUpSizeInt(requestBytes, GB)
|
||||
func RoundUpToKiB(size resource.Quantity) (int64, error) {
|
||||
requestBytes, ok := size.AsInt64()
|
||||
if !ok {
|
||||
return 0, fmt.Errorf("quantity %s is too great, overflows int64", size.String())
|
||||
}
|
||||
return roundUpSize(requestBytes, KiB), nil
|
||||
}
|
||||
|
||||
// RoundUpToGiBInt rounds up given quantity upto chunks of GiB. It returns an
|
||||
// int instead of an int64 and an error if there's overflow
|
||||
func RoundUpToGiBInt(size resource.Quantity) (int, error) {
|
||||
requestBytes := size.Value()
|
||||
requestBytes, ok := size.AsInt64()
|
||||
if !ok {
|
||||
return 0, fmt.Errorf("quantity %s is too great, overflows int64", size.String())
|
||||
}
|
||||
return roundUpSizeInt(requestBytes, GiB)
|
||||
}
|
||||
|
||||
// RoundUpToMBInt rounds up given quantity to chunks of MB. It returns an
|
||||
// int instead of an int64 and an error if there's overflow
|
||||
func RoundUpToMBInt(size resource.Quantity) (int, error) {
|
||||
requestBytes := size.Value()
|
||||
requestBytes, ok := size.AsInt64()
|
||||
if !ok {
|
||||
return 0, fmt.Errorf("quantity %s is too great, overflows int64", size.String())
|
||||
}
|
||||
return roundUpSizeInt(requestBytes, MB)
|
||||
}
|
||||
|
||||
// RoundUpToMiBInt rounds up given quantity upto chunks of MiB. It returns an
|
||||
// int instead of an int64 and an error if there's overflow
|
||||
func RoundUpToMiBInt(size resource.Quantity) (int, error) {
|
||||
requestBytes := size.Value()
|
||||
requestBytes, ok := size.AsInt64()
|
||||
if !ok {
|
||||
return 0, fmt.Errorf("quantity %s is too great, overflows int64", size.String())
|
||||
}
|
||||
return roundUpSizeInt(requestBytes, MiB)
|
||||
}
|
||||
|
||||
// RoundUpToKBInt rounds up given quantity to chunks of KB. It returns an
|
||||
// int instead of an int64 and an error if there's overflow
|
||||
func RoundUpToKBInt(size resource.Quantity) (int, error) {
|
||||
requestBytes := size.Value()
|
||||
requestBytes, ok := size.AsInt64()
|
||||
if !ok {
|
||||
return 0, fmt.Errorf("quantity %s is too great, overflows int64", size.String())
|
||||
}
|
||||
return roundUpSizeInt(requestBytes, KB)
|
||||
}
|
||||
|
||||
@ -117,6 +131,16 @@ func RoundUpToKiBInt(size resource.Quantity) (int, error) {
|
||||
return roundUpSizeInt(requestBytes, KiB)
|
||||
}
|
||||
|
||||
// RoundUpToGiBInt32 rounds up given quantity up to chunks of GiB. It returns an
|
||||
// int32 instead of an int64 and an error if there's overflow
|
||||
func RoundUpToGiBInt32(size resource.Quantity) (int32, error) {
|
||||
requestBytes, ok := size.AsInt64()
|
||||
if !ok {
|
||||
return 0, fmt.Errorf("quantity %s is too great, overflows int64", size.String())
|
||||
}
|
||||
return roundUpSizeInt32(requestBytes, GiB)
|
||||
}
|
||||
|
||||
// roundUpSizeInt calculates how many allocation units are needed to accommodate
|
||||
// a volume of given size. It returns an int instead of an int64 and an error if
|
||||
// there's overflow
|
||||
@ -129,6 +153,18 @@ func roundUpSizeInt(volumeSizeBytes int64, allocationUnitBytes int64) (int, erro
|
||||
return roundedUpInt, nil
|
||||
}
|
||||
|
||||
// roundUpSizeInt32 calculates how many allocation units are needed to accommodate
|
||||
// a volume of given size. It returns an int32 instead of an int64 and an error if
|
||||
// there's overflow
|
||||
func roundUpSizeInt32(volumeSizeBytes int64, allocationUnitBytes int64) (int32, error) {
|
||||
roundedUp := roundUpSize(volumeSizeBytes, allocationUnitBytes)
|
||||
roundedUpInt32 := int32(roundedUp)
|
||||
if int64(roundedUpInt32) != roundedUp {
|
||||
return 0, fmt.Errorf("quantity %v is too great, overflows int32", roundedUp)
|
||||
}
|
||||
return roundedUpInt32, nil
|
||||
}
|
||||
|
||||
// roundUpSize calculates how many allocation units are needed to accommodate
|
||||
// a volume of given size. E.g. when user wants 1500MiB volume, while AWS EBS
|
||||
// allocates volumes in gibibyte-sized chunks,
|
||||
|
10
vendor/k8s.io/cloud-provider/volume/helpers/zones.go
generated
vendored
10
vendor/k8s.io/cloud-provider/volume/helpers/zones.go
generated
vendored
@ -26,7 +26,7 @@ import (
|
||||
"k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
cloudvolume "k8s.io/cloud-provider/volume"
|
||||
"k8s.io/klog"
|
||||
"k8s.io/klog/v2"
|
||||
)
|
||||
|
||||
// LabelZonesToSet converts a PV label value from string containing a delimited list of zones to set
|
||||
@ -118,9 +118,9 @@ func SelectZonesForVolume(zoneParameterPresent, zonesParameterPresent bool, zone
|
||||
|
||||
// pick node's zone for one of the replicas
|
||||
var ok bool
|
||||
zoneFromNode, ok = node.ObjectMeta.Labels[v1.LabelZoneFailureDomain]
|
||||
zoneFromNode, ok = node.ObjectMeta.Labels[v1.LabelFailureDomainBetaZone]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("%s Label for node missing", v1.LabelZoneFailureDomain)
|
||||
return nil, fmt.Errorf("%s Label for node missing", v1.LabelFailureDomainBetaZone)
|
||||
}
|
||||
// if single replica volume and node with zone found, return immediately
|
||||
if numReplicas == 1 {
|
||||
@ -135,7 +135,7 @@ func SelectZonesForVolume(zoneParameterPresent, zonesParameterPresent bool, zone
|
||||
}
|
||||
|
||||
if (len(allowedTopologies) > 0) && (allowedZones.Len() == 0) {
|
||||
return nil, fmt.Errorf("no matchLabelExpressions with %s key found in allowedTopologies. Please specify matchLabelExpressions with %s key", v1.LabelZoneFailureDomain, v1.LabelZoneFailureDomain)
|
||||
return nil, fmt.Errorf("no matchLabelExpressions with %s key found in allowedTopologies. Please specify matchLabelExpressions with %s key", v1.LabelFailureDomainBetaZone, v1.LabelFailureDomainBetaZone)
|
||||
}
|
||||
|
||||
if allowedZones.Len() > 0 {
|
||||
@ -185,7 +185,7 @@ func ZonesFromAllowedTopologies(allowedTopologies []v1.TopologySelectorTerm) (se
|
||||
zones := make(sets.String)
|
||||
for _, term := range allowedTopologies {
|
||||
for _, exp := range term.MatchLabelExpressions {
|
||||
if exp.Key == v1.LabelZoneFailureDomain {
|
||||
if exp.Key == v1.LabelFailureDomainBetaZone {
|
||||
for _, value := range exp.Values {
|
||||
zones.Insert(value)
|
||||
}
|
||||
|
Reference in New Issue
Block a user