| local kube = import '../../../kube/hscloud.libsonnet'; |
| { |
| local annoyatron = self, |
| local cfg = self.cfg, |
| cfg:: { |
| image: "derq3k/card10-annoyatron:latest", |
| domain: "annoyatron-prod.q3k.org", |
| }, |
| |
| deploy: kube.Deployment("annoyatron") { |
| metadata+: { |
| namespace: "q3k", |
| }, |
| spec+: { |
| template+: { |
| spec+: { |
| containers_: { |
| annoyatron: kube.Container("annoyatron") { |
| image: cfg.image, |
| env_: { |
| TOKEN: { |
| secretKeyRef: { name: "annoyatron-token", key: "token" }, |
| }, |
| }, |
| command: [ |
| "/app/annoyatron", |
| "-token=$(TOKEN)", |
| ], |
| ports_: { |
| client: { containerPort: 8080 }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| svc: kube.Service("annoyatron") { |
| metadata+: { |
| namespace: "q3k", |
| }, |
| target_pod:: annoyatron.deploy.spec.template, |
| spec+: { |
| ports: [ |
| { name: "client", port: 8080, targetPort: 8080, protocol: "TCP" }, |
| ], |
| }, |
| }, |
| ingress: kube.SimpleIngress("annoyatron") { |
| metadata+: { |
| namespace: "q3k", |
| }, |
| hosts:: [cfg.domain], |
| target_service:: annoyatron.svc, |
| }, |
| } |