-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce LocalSSDSizeProvider interface for GCE
- Loading branch information
1 parent
5286b3f
commit 3ada471
Showing
10 changed files
with
110 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
cluster-autoscaler/cloudprovider/gce/localssdsize/local_ssd_size_provider.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package localssdsize | ||
|
||
// LocalSSDSizeProvider contains methods to calculate local ssd disk size for GCE based on some input parameters (e.g. machine type name) | ||
type LocalSSDSizeProvider interface { | ||
// Computes local ssd disk size in GiB based on machine type name | ||
SSDSizeInGiB(string) uint64 | ||
} | ||
|
||
// LocalSSDDiskSizeInGiB is the size of each local SSD in GiB | ||
// (cf. https://cloud.google.com/compute/docs/disks/local-ssd) | ||
const LocalSSDDiskSizeInGiB = uint64(375) | ||
|
||
// SimpleLocalSSDProvider implements LocalSSDSizeProvider | ||
// It always returns a constant size | ||
type SimpleLocalSSDProvider struct { | ||
ssdDiskSize uint64 | ||
} | ||
|
||
// NewSimpleLocalSSDProvider creates an instance of SimpleLocalSSDProvider with `LocalSSDDiskSizeInGiB` as the disk size and returns a pointer to it | ||
func NewSimpleLocalSSDProvider() LocalSSDSizeProvider { | ||
return &SimpleLocalSSDProvider{ | ||
ssdDiskSize: LocalSSDDiskSizeInGiB, | ||
} | ||
} | ||
|
||
// SSDSizeInGiB Returns a constant disk size in GiB | ||
func (lsp *SimpleLocalSSDProvider) SSDSizeInGiB(_ string) uint64 { | ||
return lsp.ssdDiskSize | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters