mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 12:43:23 +00:00
Improve comments for Azure Blob Disk Controller
This commit is contained in:
parent
b729472952
commit
2a401c7ec7
@ -303,7 +303,7 @@ func (c *BlobDiskController) DeleteBlobDisk(diskURI string) error {
|
|||||||
func (c *BlobDiskController) setUniqueStrings() {
|
func (c *BlobDiskController) setUniqueStrings() {
|
||||||
uniqueString := c.common.resourceGroup + c.common.location + c.common.subscriptionID
|
uniqueString := c.common.resourceGroup + c.common.location + c.common.subscriptionID
|
||||||
hash := MakeCRC32(uniqueString)
|
hash := MakeCRC32(uniqueString)
|
||||||
//used to generate a unqie container name used by this cluster PVC
|
//used to generate a unique container name used by this cluster PVC
|
||||||
defaultContainerName = hash
|
defaultContainerName = hash
|
||||||
|
|
||||||
storageAccountNamePrefix = fmt.Sprintf(storageAccountNameTemplate, hash)
|
storageAccountNamePrefix = fmt.Sprintf(storageAccountNameTemplate, hash)
|
||||||
@ -359,13 +359,13 @@ func (c *BlobDiskController) ensureDefaultContainer(storageAccountName string) e
|
|||||||
var err error
|
var err error
|
||||||
var blobSvc azstorage.BlobStorageClient
|
var blobSvc azstorage.BlobStorageClient
|
||||||
|
|
||||||
// short circut the check via local cache
|
// short circuit the check via local cache
|
||||||
// we are forgiving the fact that account may not be in cache yet
|
// we are forgiving the fact that account may not be in cache yet
|
||||||
if v, ok := c.accounts[storageAccountName]; ok && v.defaultContainerCreated {
|
if v, ok := c.accounts[storageAccountName]; ok && v.defaultContainerCreated {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// not cached, check existance and readiness
|
// not cached, check existence and readiness
|
||||||
bExist, provisionState, _ := c.getStorageAccountState(storageAccountName)
|
bExist, provisionState, _ := c.getStorageAccountState(storageAccountName)
|
||||||
|
|
||||||
// account does not exist
|
// account does not exist
|
||||||
@ -392,7 +392,7 @@ func (c *BlobDiskController) ensureDefaultContainer(storageAccountName string) e
|
|||||||
c.accounts[storageAccountName].isValidating = 0
|
c.accounts[storageAccountName].isValidating = 0
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// short circut the check again.
|
// short circuit the check again.
|
||||||
if v, ok := c.accounts[storageAccountName]; ok && v.defaultContainerCreated {
|
if v, ok := c.accounts[storageAccountName]; ok && v.defaultContainerCreated {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -559,9 +559,9 @@ func (c *BlobDiskController) findSANameForDisk(storageAccountType storage.SkuNam
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// note: we compute avge stratified by type.
|
// note: we compute avg stratified by type.
|
||||||
// this to enable user to grow per SA type to avoid low
|
// this is to enable user to grow per SA type to avoid low
|
||||||
//avg utilization on one account type skewing all data.
|
// avg utilization on one account type skewing all data.
|
||||||
|
|
||||||
if v.saType == storageAccountType {
|
if v.saType == storageAccountType {
|
||||||
// compute average
|
// compute average
|
||||||
@ -574,7 +574,7 @@ func (c *BlobDiskController) findSANameForDisk(storageAccountType storage.SkuNam
|
|||||||
// empty account
|
// empty account
|
||||||
if dCount == 0 {
|
if dCount == 0 {
|
||||||
glog.V(2).Infof("azureDisk - account %s identified for a new disk is because it has 0 allocated disks", v.name)
|
glog.V(2).Infof("azureDisk - account %s identified for a new disk is because it has 0 allocated disks", v.name)
|
||||||
return v.name, nil // shortcircut, avg is good and no need to adjust
|
return v.name, nil // short circuit, avg is good and no need to adjust
|
||||||
}
|
}
|
||||||
// if this account is less allocated
|
// if this account is less allocated
|
||||||
if dCount < maxDiskCount {
|
if dCount < maxDiskCount {
|
||||||
@ -600,7 +600,7 @@ func (c *BlobDiskController) findSANameForDisk(storageAccountType storage.SkuNam
|
|||||||
avgUtilization := float64(disksAfter) / float64(countAccounts*maxDisksPerStorageAccounts)
|
avgUtilization := float64(disksAfter) / float64(countAccounts*maxDisksPerStorageAccounts)
|
||||||
aboveAvg := (avgUtilization > storageAccountUtilizationBeforeGrowing)
|
aboveAvg := (avgUtilization > storageAccountUtilizationBeforeGrowing)
|
||||||
|
|
||||||
// avg are not create and we should craete more accounts if we can
|
// avg are not create and we should create more accounts if we can
|
||||||
if aboveAvg && countAccounts < maxStorageAccounts {
|
if aboveAvg && countAccounts < maxStorageAccounts {
|
||||||
glog.V(2).Infof("azureDisk - shared storageAccounts utilzation(%v) > grow-at-avg-utilization (%v). New storage account will be created", avgUtilization, storageAccountUtilizationBeforeGrowing)
|
glog.V(2).Infof("azureDisk - shared storageAccounts utilzation(%v) > grow-at-avg-utilization (%v). New storage account will be created", avgUtilization, storageAccountUtilizationBeforeGrowing)
|
||||||
SAName = getAccountNameForNum(c.getNextAccountNum())
|
SAName = getAccountNameForNum(c.getNextAccountNum())
|
||||||
|
Loading…
Reference in New Issue
Block a user