diff --git a/src/app/backend/deploy.go b/src/app/backend/deploy.go
index 343b7aa7b8e40d8e914d71ce43a00efa634cb5a2..cce77cbdafbf3ff6f1eaf4e53e6b3e2d1295af41 100644
--- a/src/app/backend/deploy.go
+++ b/src/app/backend/deploy.go
@@ -17,7 +17,8 @@ package main
import (
"log"
- api "k8s.io/kubernetes/pkg/api"
+ "k8s.io/kubernetes/pkg/api"
+ "k8s.io/kubernetes/pkg/api/resource"
client "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/util/intstr"
)
@@ -57,6 +58,12 @@ type AppDeploymentSpec struct {
// Target namespace of the application.
Namespace string `json:"namespace"`
+ // Optional memory requirement for the container.
+ MemoryRequirement *resource.Quantity `json:"memoryRequirement"`
+
+ // Optional CPU requirement for the container.
+ CpuRequirement *resource.Quantity `json:"cpuRequirement"`
+
// Labels that will be defined on Pods/RCs/Services
Labels []Label `json:"labels"`
@@ -88,7 +95,6 @@ type Label struct {
// Deploys an app based on the given configuration. The app is deployed using the given client.
// App deployment consists of a replication controller and an optional service. Both of them share
// common labels.
-// TODO(bryk): Write tests for this function.
func DeployApp(spec *AppDeploymentSpec, client client.Interface) error {
log.Printf("Deploying %s application into %s namespace", spec.Name, spec.Namespace)
@@ -109,16 +115,25 @@ func DeployApp(spec *AppDeploymentSpec, client client.Interface) error {
SecurityContext: &api.SecurityContext{
Privileged: &spec.RunAsPrivileged,
},
+ Resources: api.ResourceRequirements{
+ Requests: make(map[api.ResourceName]resource.Quantity),
+ },
}
if spec.ContainerCommand != nil {
containerSpec.Command = []string{*spec.ContainerCommand}
}
-
if spec.ContainerCommandArgs != nil {
containerSpec.Args = []string{*spec.ContainerCommandArgs}
}
+ if spec.CpuRequirement != nil {
+ containerSpec.Resources.Requests[api.ResourceCPU] = *spec.CpuRequirement
+ }
+ if spec.MemoryRequirement != nil {
+ containerSpec.Resources.Requests[api.ResourceMemory] = *spec.MemoryRequirement
+ }
+
podTemplate := &api.PodTemplateSpec{
ObjectMeta: objectMeta,
Spec: api.PodSpec{
diff --git a/src/app/externs/backendapi.js b/src/app/externs/backendapi.js
index 646325de2cdc0738203908bde2ccd564b04aec24..453d20ccc37cd394a47b88cfff11191b67f59d3c 100644
--- a/src/app/externs/backendapi.js
+++ b/src/app/externs/backendapi.js
@@ -53,6 +53,8 @@ backendApi.Label;
* labels: !Array,
* replicas: number,
* namespace: string,
+ * memoryRequirement: ?string,
+ * cpuRequirement: ?number,
* runAsPrivileged: boolean,
* }}
*/
diff --git a/src/app/frontend/deploy/deployfromsettings.html b/src/app/frontend/deploy/deployfromsettings.html
index 2075dd615b8454cce6d3f5976c90f8a044233d58..91c8584de436ec5e78e20b39b75b6e17d0cebe63 100644
--- a/src/app/frontend/deploy/deployfromsettings.html
+++ b/src/app/frontend/deploy/deployfromsettings.html
@@ -17,7 +17,8 @@ limitations under the License.
-
+
@@ -42,7 +43,8 @@ limitations under the License.
- Enter the URL of a public image on any registry, or a private image hosted on Docker Hub or Google Container Registry.
+ Enter the URL of a public image on any registry, or a private image hosted on Docker Hub or
+ Google Container Registry.
Learn more
@@ -50,7 +52,11 @@ limitations under the License.
-
+
+
+ Number of pods must be a positive integer.
+ Number of pods must be positive.
+
A Replica Set will be created to maintain the desired number of pods across your cluster.
@@ -59,27 +65,40 @@ limitations under the License.
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{protocol}}
-
-
-
+
+
+
+
+
+
+ Port must be an integer.
+ Port must be non-negative.
+
+
+
+
+
+
+ Target port must be an integer.
+ Target port must be non-negative.
+
+
+
+
+
+
+ {{protocol}}
+
+
+
+
- Ports are optional. If specified, a Service will be created mapping the Port (incoming) to a target Port seen by the container.
- The internal DNS name for this Service will be: {{ctrl.name}}.
+ Ports are optional. If specified, a Service will be created mapping the Port (incoming) to a
+ target Port seen by the container.
+
+ The internal DNS name for this Service will be: {{ctrl.name}}.
+ Learn more
@@ -93,17 +112,18 @@ limitations under the License.
-
+
- The description will be added as an annotation to the Replica Set and displayed in the application's details.
+ The description will be added as an annotation to the Replica Set and displayed in the
+ application's details.
-
Labels (optional)
+
Labels
Key
@@ -115,7 +135,8 @@ limitations under the License.
- The specified labels will be applied to the created Replica Set, Service (if any) and Pods. Common labels include release, environment, tier, partition and track.
+ The specified labels will be applied to the created Replica Set, Service (if any) and Pods.
+ Common labels include release, environment, tier, partition and track.
Learn more
@@ -138,15 +159,40 @@ limitations under the License.
+
+
+
+
+
+
+ CPU requirement must be a valid number.
+ CPU requirement must be positive.
+
+
+
+
+
+
+ Memory requirement must be a valid number.
+ Memory requirement must be positive.
+
+
+
+
+ You can specify minimum CPU and memory requirements for the container.
+ Learn more
+
+
+