services/allocator/allocatord: Add --server-version

This new flag is passed to the template expansion as "Version".

Change-Id: Id15e2f386b371c6bf36f66cabcfbf828d9174c6b
diff --git a/services/allocator/allocatord/doc.go b/services/allocator/allocatord/doc.go
index 75b5d46..f1b6c71 100644
--- a/services/allocator/allocatord/doc.go
+++ b/services/allocator/allocatord/doc.go
@@ -63,6 +63,9 @@
  -server-name-root=
    Namespace root for allocated servers to use when publishing in the Vanadium
    namespace.  If not set, the namespace root of the allocator server is used.
+ -server-version=
+   The version of the allocated servers. This value is used in the deployment
+   template expansion.
  -static-assets-prefix=
    Host serving the web assets.
  -vkube=vkube
diff --git a/services/allocator/allocatord/main.go b/services/allocator/allocatord/main.go
index 7a07041..d68d40c 100644
--- a/services/allocator/allocatord/main.go
+++ b/services/allocator/allocatord/main.go
@@ -29,6 +29,7 @@
 	nameFlag                string
 	serverNameFlag          string
 	serverNameRootFlag      string
+	serverVersionFlag       string
 	deploymentTemplateFlag  string
 	globalAdminsFlag        string
 	maxInstancesFlag        int
@@ -63,6 +64,7 @@
 const (
 	serverNameFlagName     = "server-name"
 	serverNameRootFlagName = "server-name-root"
+	serverVersionFlagName  = "server-version"
 	oauthCredsFileFlagName = "oauth-client-creds-file"
 	gcloudFlagName         = "gcloud"
 	kubectlFlagName        = "kubectl"
@@ -73,6 +75,7 @@
 	cmdRoot.Flags.StringVar(&nameFlag, "name", "", "Name to publish for this service.")
 	cmdRoot.Flags.StringVar(&serverNameFlag, serverNameFlagName, "", "Name of the servers to allocate. This name is part of the published names in the Vanadium namespace and the names of the Deployments in Kubernetes.")
 	cmdRoot.Flags.StringVar(&serverNameRootFlag, serverNameRootFlagName, "", "Namespace root for allocated servers to use when publishing in the Vanadium namespace.  If not set, the namespace root of the allocator server is used.")
+	cmdRoot.Flags.StringVar(&serverVersionFlag, serverVersionFlagName, "", "The version of the allocated servers. This value is used in the deployment template expansion.")
 	cmdRoot.Flags.StringVar(&deploymentTemplateFlag, "deployment-template", "", "The template for the deployment of the servers to allocate.")
 	cmdRoot.Flags.StringVar(&globalAdminsFlag, "global-admins", "", "A comma-separated list of blessing patterns that have access to all the server instances.")
 	cmdRoot.Flags.IntVar(&maxInstancesFlag, "max-instances", 10, "The maximum total number of server instances to create.")
diff --git a/services/allocator/allocatord/service.go b/services/allocator/allocatord/service.go
index b922a4e..bec63ba 100644
--- a/services/allocator/allocatord/service.go
+++ b/services/allocator/allocatord/service.go
@@ -221,12 +221,14 @@
 		MountName   string
 		Name        string
 		OwnerHash   string
+		Version     string
 	}{
 		AccessList:  acl,
 		CreatorInfo: creatorInfo,
 		MountName:   mountName,
 		Name:        deploymentName,
 		OwnerHash:   emailHash(email),
+		Version:     serverVersionFlag,
 	}
 
 	f, err := ioutil.TempFile("", "allocator-deployment-")