/ scripts / jsonnet / pitcrew.jsonnet
pitcrew.jsonnet
  1  local name = std.extVar('DRIVER_NAME_DASHED');
  2  local name_topic = std.extVar('DRIVER_NAME');
  3  
  4  {
  5    "apiVersion": "apps/v1",
  6    "kind": "Deployment",
  7    "metadata": {
  8      "name": "pitcrew-"+name,
  9      "labels": {
 10        "pitcrew.b4mad.racing/crewchiefname": name
 11      }
 12    },
 13    "spec": {
 14      "replicas": 1,
 15      "revisionHistoryLimit": 4,
 16      "selector": {
 17        "matchLabels": {
 18          "pitcrew.b4mad.racing/crewchiefname": name
 19        }
 20      },
 21      "strategy": {
 22        "type": "Recreate"
 23      },
 24      "template": {
 25        "metadata": {
 26          "labels": {
 27            "pitcrew.b4mad.racing/crewchiefname": name
 28          }
 29        },
 30        "spec": {
 31          "containers": [
 32            {
 33              "env": [
 34                {
 35                  "name": "CREWCHIEF_USERNAME",
 36                  "value": name_topic
 37                }
 38              ],
 39              "image": "quay.io/b4mad/pitcrew:latest",
 40              "name": "pitcrew",
 41              "resources": {
 42                "limits": {
 43                  "memory": "64Mi",
 44                  "cpu": "500m"
 45                }
 46              },
 47              "ports": [
 48                {
 49                  "name": "dash",
 50                  "containerPort": 8050,
 51                  "protocol": "TCP"
 52                }
 53              ]
 54            }
 55          ],
 56          "restartPolicy": "Always"
 57        }
 58      }
 59    }
 60  }
 61  {
 62    "apiVersion": "v1",
 63    "kind": "Service",
 64    "metadata": {
 65      "name": "pitcrew-"+name,
 66      "labels": {
 67        "pitcrew.b4mad.racing/crewchiefname": name
 68      }
 69    },
 70    "spec": {
 71      "ports": [
 72        {
 73          "protocol": "TCP",
 74          "port": 80,
 75          "targetPort": 8050
 76        }
 77      ],
 78      "type": "ClusterIP",
 79      "selector": {
 80        "pitcrew.b4mad.racing/crewchiefname": name
 81      }
 82    }
 83  }
 84  {
 85    "apiVersion": "route.openshift.io/v1",
 86    "kind": "Route",
 87    "metadata": {
 88      "labels": {
 89        "pitcrew.b4mad.racing/crewchiefname": name
 90      },
 91      "name": "pitcrew-"+name,
 92      "annotations": {
 93        "kubernetes.io/tls-acme": "true"
 94      }
 95    },
 96    "spec": {
 97      "host": "pitcrew.b4mad.racing",
 98      "path": "/"+name,
 99      "tls": {
100        "termination": "edge"
101      },
102      "to": {
103        "name": "pitcrew-"+name
104      }
105    }
106  }