<commit_before>package io.vamp.container_driver.kubernetes

import akka.actor.ActorLogging
import io.vamp.common.http.RestClient

import scala.concurrent.Future

trait KubernetesDaemonSet extends KubernetesArtifact {
  this: KubernetesContainerDriver with ActorLogging ⇒

  private lazy val url = s"$apiUrl/apis/extensions/v1beta1/namespaces/default/daemonsets"

  protected def createDaemonSet(ds: DaemonSet, labels: Map[String, String] = Map()): Future[Any] = {
    val request =
      s"""
         |{
         |  "apiVersion": "extensions/v1beta1",
         |  "kind": "DaemonSet",
         |  "metadata": {
         |    "name": "${ds.name}",
         |    ${labels2json(labels)}
         |  },
         |  "spec": {
         |    "template": {
         |      "metadata": {
         |        "labels": {
         |          "vamp": "${ds.name}"
         |        }
         |      },
         |      "spec": {
         |        "containers": [{
         |          "image": "${ds.docker.image}",
         |          "name": "${ds.name}",
         |          "ports": [${ds.docker.portMappings.map(pm ⇒ s"""{"containerPort": ${pm.containerPort}, "name": "p${pm.containerPort}"}""").mkString(", ")}],
         |          "command": [${ds.command.map(str ⇒ s""""$str"""").mkString(", ")}],
         |          "resources": {
         |            "request": {
         |              "cpu": ${ds.cpu},
         |              "mem": ${ds.mem}
         |            }
         |          }<commit_msg>fixing resources for kubernetes daemon sets<commit_after>package io.vamp.container_driver.kubernetes

import akka.actor.ActorLogging
import io.vamp.common.http.RestClient

import scala.concurrent.Future

trait KubernetesDaemonSet extends KubernetesArtifact {
  this: KubernetesContainerDriver with ActorLogging ⇒

  private lazy val url = s"$apiUrl/apis/extensions/v1beta1/namespaces/default/daemonsets"

  protected def createDaemonSet(ds: DaemonSet, labels: Map[String, String] = Map()): Future[Any] = {
    val request =
      s"""
         |{
         |  "apiVersion": "extensions/v1beta1",
         |  "kind": "DaemonSet",
         |  "metadata": {
         |    "name": "${ds.name}",
         |    ${labels2json(labels)}
         |  },
         |  "spec": {
         |    "template": {
         |      "metadata": {
         |        "labels": {
         |          "vamp": "${ds.name}"
         |        }
         |      },
         |      "spec": {
         |        "containers": [{
         |          "image": "${ds.docker.image}",
         |          "name": "${ds.name}",
         |          "ports": [${ds.docker.portMappings.map(pm ⇒ s"""{"containerPort": ${pm.containerPort}, "name": "p${pm.containerPort}"}""").mkString(", ")}],
         |          "command": [${ds.command.map(str ⇒ s""""$str"""").mkString(", ")}],
         |          "resources": {
         |            "requests": {
         |              "cpu": ${ds.cpu},
         |              "memory": ${ds.mem}
         |            }
         |          }
{'fraction_non_alphanumeric': 0.175, 'fraction_numerical': 0.003289473684210526, 'mean_word_length': 1.6628721541155866, 'pattern_counts': {'":': 42, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4942776', 'n_tokens_mistral': 931, 'n_tokens_neox': 923, 'n_words': 147}