Skip to content

Commit cdf91e4

Browse files
committed
add filler files to GCR container deployments
1 parent 3ac8d6d commit cdf91e4

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

experiments/tests/gcr/hellopy.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"DesiredServiceTimes": [
1717
"0ms"
1818
],
19-
"FunctionImageSizeMB": 24
19+
"FunctionImageSizeMB": 60
2020
},
2121
{
2222
"Title": "parallelism2",
@@ -31,7 +31,7 @@
3131
"DesiredServiceTimes": [
3232
"0ms"
3333
],
34-
"FunctionImageSizeMB": 48,
34+
"FunctionImageSizeMB": 100,
3535
"Parallelism": 2
3636
}
3737
]

src/setup/deployment/packaging/container.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ var privateRepoURI string = ""
3636
var loggedIn bool = false
3737

3838
// SetupContainerImageDeployment will package the function using container images and push to registry
39-
func SetupContainerImageDeployment(function string, provider string) string {
39+
func SetupContainerImageDeployment(function string, provider string, compressedImageSizeMebibyte float64) string {
4040
functionDir := fmt.Sprintf("setup/deployment/raw-code/serverless/%s/%s", provider, function)
4141
switch provider {
4242
case "aws":
@@ -61,7 +61,7 @@ func SetupContainerImageDeployment(function string, provider string) string {
6161
log.Fatalf("Provider %s does not support container image deployment.", provider)
6262
}
6363

64-
taggedImage := fmt.Sprintf("%s_stellar:latest", function)
64+
taggedImage := fmt.Sprintf("%s_%v_stellar:latest", function, compressedImageSizeMebibyte)
6565
imageName := fmt.Sprintf("%s/%s", privateRepoURI, taggedImage)
6666
if builtImages[function] {
6767
log.Infof("Container image for function %q is already built. Skipping...", function)

src/setup/run.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,14 @@ func ProvisionFunctionsGCR(config *Configuration, serverlessDirPath string) {
231231
for index, subExperiment := range config.SubExperiments {
232232
switch subExperiment.PackageType {
233233
case "Container":
234-
imageLink := packaging.SetupContainerImageDeployment(subExperiment.Function, config.Provider)
234+
// size of compressed images of GCR functions on Docker Hub are experimentally found to be approximately 21.84 MiB
235+
currentSizeInBytes := util.MebibyteToBytes(21.84)
236+
targetSizeInBytes := util.MebibyteToBytes(subExperiment.FunctionImageSizeMB)
237+
fillerFileSize := packaging.CalculateFillerFileSizeInBytes(currentSizeInBytes, targetSizeInBytes)
238+
fillerFilePath := filepath.Join(serverlessDirPath, subExperiment.Function, "filler.file")
239+
packaging.GenerateFillerFile(subExperiment.ID, fillerFilePath, fillerFileSize)
240+
241+
imageLink := packaging.SetupContainerImageDeployment(subExperiment.Function, config.Provider, subExperiment.FunctionImageSizeMB)
235242
randomTag := util.GenerateRandLowercaseLetters(5)
236243
slsConfig.DeployGCRContainerService(&config.SubExperiments[index], index, randomTag, imageLink, serverlessDirPath, slsConfig.Provider.Region)
237244
default:

0 commit comments

Comments
 (0)