in src/go/cmd/cachewarmer/cachewarmer-manager/main.go [34:147]
func initializeApplicationVariables(ctx context.Context) *cachewarmer.WarmPathManager {
var enableDebugging = flag.Bool("enableDebugging", false, "enable debug logging")
var bootstrapMountAddress = flag.String("bootstrapMountAddress", "", "the mount address that hosts the worker bootstrap script")
var bootstrapExportPath = flag.String("bootstrapExportPath", "", "the export path that hosts the worker bootstrap script")
var bootstrapScriptPath = flag.String("bootstrapScriptPath", "", "the path to the worker bootstrap script")
var workerCount = flag.Int64("workerCount", 12, "the worker count to warm the cache")
var storageAccountResourceGroup = flag.String("storageAccountResourceGroup", "", "the storage account resource group")
var storageAccount = flag.String("storageAccountName", "", "the storage account name to host the queue")
var queueNamePrefix = flag.String("queueNamePrefix", "", "the queue name to be used for organizing the work. The queues will be created automatically")
var vmssUserName = flag.String("vmssUserName", "", "the username for the vmss vms")
var vmssPassword = flag.String("vmssPassword", "", "(optional) the password for the vmss vms, this is unused if the public key is specified")
var vmssSshPublicKey = flag.String("vmssSshPublicKey", "", "(optional) the ssh public key for the vmss vms, this will be used by default, however if this is blank, the password will be used")
var vmssSubnetName = flag.String("vmssSubnetName", "", "(optional) the subnet to use for the VMSS, if not specified use the same subnet as the controller")
flag.Parse()
if *enableDebugging {
log.EnableDebugging()
}
if len(*bootstrapMountAddress) == 0 {
fmt.Fprintf(os.Stderr, "ERROR: bootstrapMountAddress is not specified\n")
usage()
os.Exit(1)
}
if len(*bootstrapExportPath) == 0 {
fmt.Fprintf(os.Stderr, "ERROR: bootstrapExportPath is not specified\n")
usage()
os.Exit(1)
}
if len(*bootstrapScriptPath) == 0 {
fmt.Fprintf(os.Stderr, "ERROR: bootstrapScriptPath is not specified\n")
usage()
os.Exit(1)
}
if len(*storageAccountResourceGroup) == 0 {
fmt.Fprintf(os.Stderr, "ERROR: storageAccountResourceGroup is not specified\n")
usage()
os.Exit(1)
}
if len(*storageAccount) == 0 {
fmt.Fprintf(os.Stderr, "ERROR: storageAccount is not specified\n")
usage()
os.Exit(1)
}
if len(*queueNamePrefix) == 0 {
fmt.Fprintf(os.Stderr, "ERROR: queueNamePrefix is not specified\n")
usage()
os.Exit(1)
}
if isValid, errorMessage := azure.ValidateQueueName(*queueNamePrefix); isValid == false {
fmt.Fprintf(os.Stderr, "ERROR: queueNamePrefix is not valid: %s\n", errorMessage)
usage()
os.Exit(1)
}
if len(*vmssUserName) == 0 {
fmt.Fprintf(os.Stderr, "ERROR: userName for the VMSS is not specified\n")
usage()
os.Exit(1)
}
if len(*vmssPassword) == 0 && len(*vmssSshPublicKey) == 0 {
fmt.Fprintf(os.Stderr, "ERROR: either password or sshPublicKey must be specified\n")
usage()
os.Exit(1)
}
azureClients, err := cachewarmer.InitializeAzureClients()
if err != nil {
fmt.Fprintf(os.Stderr, "ERROR: unable to initialize Azure Clients: %s", err)
os.Exit(1)
}
primaryKey, err := cachewarmer.GetPrimaryStorageKey(ctx, *storageAccountResourceGroup, *storageAccount)
if err != nil {
fmt.Fprintf(os.Stderr, "ERROR: unable to get storage account key: %s", err)
os.Exit(1)
}
cacheWarmerQueues, err := cachewarmer.InitializeCacheWarmerQueues(
ctx,
*storageAccount,
primaryKey,
*queueNamePrefix)
if err != nil {
fmt.Fprintf(os.Stderr, "ERROR: error initializing queue %v\n", err)
os.Exit(1)
}
return cachewarmer.InitializeWarmPathManager(
azureClients,
*workerCount,
cacheWarmerQueues,
*bootstrapMountAddress,
*bootstrapExportPath,
*bootstrapScriptPath,
*vmssUserName,
*vmssPassword,
*vmssSshPublicKey,
*vmssSubnetName,
*storageAccount,
primaryKey,
*queueNamePrefix,
)
}