|
@@ -766,26 +766,6 @@ class Service
|
|
|
return $this;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * @param $cpu_shares
|
|
|
- * @return $this
|
|
|
- */
|
|
|
- function cpu_shares($cpu_shares)
|
|
|
- {
|
|
|
- $this->config["cpu_shares"] = $cpu_shares;
|
|
|
- return $this;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * @param $cpu_quota
|
|
|
- * @return $this
|
|
|
- */
|
|
|
- function cpu_quota($cpu_quota)
|
|
|
- {
|
|
|
- $this->config["cpu_quota"] = $cpu_quota;
|
|
|
- return $this;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* @param $cpus
|
|
|
* @return $this
|
|
@@ -796,16 +776,6 @@ class Service
|
|
|
return $this;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * @param $cpuset
|
|
|
- * @return $this
|
|
|
- */
|
|
|
- function cpuset($cpuset)
|
|
|
- {
|
|
|
- $this->config["cpuset"] = $cpuset;
|
|
|
- return $this;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* @param $domainname
|
|
|
* @return $this
|
|
@@ -846,46 +816,6 @@ class Service
|
|
|
return $this;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * @param $mem_limit
|
|
|
- * @return $this
|
|
|
- */
|
|
|
- function mem_limit($mem_limit)
|
|
|
- {
|
|
|
- $this->config["mem_limit"] = $mem_limit;
|
|
|
- return $this;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * @param $memswap_limit
|
|
|
- * @return $this
|
|
|
- */
|
|
|
- function memswap_limit($memswap_limit)
|
|
|
- {
|
|
|
- $this->config["memswap_limit"] = $memswap_limit;
|
|
|
- return $this;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * @param $mem_swappiness
|
|
|
- * @return $this
|
|
|
- */
|
|
|
- function mem_swappiness($mem_swappiness)
|
|
|
- {
|
|
|
- $this->config["mem_swappiness"] = $mem_swappiness;
|
|
|
- return $this;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * @param $mem_reservation
|
|
|
- * @return $this
|
|
|
- */
|
|
|
- function mem_reservation($mem_reservation)
|
|
|
- {
|
|
|
- $this->config["mem_reservation"] = $mem_reservation;
|
|
|
- return $this;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* @param $oom_score_adj
|
|
|
* @return $this
|
|
@@ -966,6 +896,92 @@ class Service
|
|
|
return $this;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @param string $cpu Example 0.5 or 1 or 1.3
|
|
|
+ */
|
|
|
+ public function setLimitCPU($cpu)
|
|
|
+ {
|
|
|
+ if (!isset($this->config['deploy']) ||
|
|
|
+ !is_array($this->config['deploy'])) {
|
|
|
+ $this->config['deploy'] = array();
|
|
|
+ }
|
|
|
+ if (!isset($this->config['deploy']['resources']) ||
|
|
|
+ !is_array($this->config['deploy']['resources'])) {
|
|
|
+ $this->config['deploy']['resources'] = array();
|
|
|
+ }
|
|
|
+ if (!isset($this->config['deploy']['resources']['limits']) ||
|
|
|
+ !is_array($this->config['deploy']['resources']['limits'])) {
|
|
|
+ $this->config['deploy']['resources']['limits'] = array();
|
|
|
+ }
|
|
|
+ $this->config['deploy']['resources']['limits']["cpus"] = $cpu;
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param string $memory Example 10M or 1G
|
|
|
+ */
|
|
|
+ public function setLimitMemory($memory)
|
|
|
+ {
|
|
|
+ if (!isset($this->config['deploy']) ||
|
|
|
+ !is_array($this->config['deploy'])) {
|
|
|
+ $this->config['deploy'] = array();
|
|
|
+ }
|
|
|
+ if (!isset($this->config['deploy']['resources']) ||
|
|
|
+ !is_array($this->config['deploy']['resources'])) {
|
|
|
+ $this->config['deploy']['resources'] = array();
|
|
|
+ }
|
|
|
+ if (!isset($this->config['deploy']['resources']['limits']) ||
|
|
|
+ !is_array($this->config['deploy']['resources']['limits'])) {
|
|
|
+ $this->config['deploy']['resources']['limits'] = array();
|
|
|
+ }
|
|
|
+ $this->config['deploy']['resources']['limits']["memory"] = $memory;
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param string $cpu Example 0.5 or 1 or 1.3
|
|
|
+ */
|
|
|
+ public function setReservationCPU($cpu)
|
|
|
+ {
|
|
|
+ if (!isset($this->config['deploy']) ||
|
|
|
+ !is_array($this->config['deploy'])) {
|
|
|
+ $this->config['deploy'] = array();
|
|
|
+ }
|
|
|
+ if (!isset($this->config['deploy']['resources']) ||
|
|
|
+ !is_array($this->config['deploy']['resources'])) {
|
|
|
+ $this->config['deploy']['resources'] = array();
|
|
|
+ }
|
|
|
+ if (!isset($this->config['deploy']['resources']['reservations']) ||
|
|
|
+ !is_array($this->config['deploy']['resources']['reservations'])) {
|
|
|
+ $this->config['deploy']['resources']['reservations'] = array();
|
|
|
+ }
|
|
|
+ $this->config['deploy']['resources']['reservations']["cpus"] = $cpu;
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param string $memory Example 10M or 1G
|
|
|
+ */
|
|
|
+ public function setReservationMemory($memory)
|
|
|
+ {
|
|
|
+ if (!isset($this->config['deploy']) ||
|
|
|
+ !is_array($this->config['deploy'])) {
|
|
|
+ $this->config['deploy'] = array();
|
|
|
+ }
|
|
|
+ if (!isset($this->config['deploy']['resources']) ||
|
|
|
+ !is_array($this->config['deploy']['resources'])) {
|
|
|
+ $this->config['deploy']['resources'] = array();
|
|
|
+ }
|
|
|
+ if (!isset($this->config['deploy']['resources']['reservations']) ||
|
|
|
+ !is_array($this->config['deploy']['resources']['reservations'])) {
|
|
|
+ $this->config['deploy']['resources']['reservations'] = array();
|
|
|
+ }
|
|
|
+ $this->config['deploy']['resources']['reservations']["memory"] = $memory;
|
|
|
+// $this->config['deploy']['resources']['reservations'][] = "memory: $memory";
|
|
|
+// $this->config["volumes"][] = $from . ":" . $to;
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @return array
|
|
|
*/
|