Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
2.4 kB · 100 lines
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100local utils = import "milky-way/lib/utils.libsonnet";local images = import "milky-way/lib/images.libsonnet";{ new( name="http-echo", image=images["http-echo"].fullyQualifiedImageReferenceTagged, port=5678, ):: { local this = self,
deployment: { apiVersion: "apps/v1", kind: "Deployment", metadata: { namespace: "test-k8s", name: name, }, spec: { replicas: 2, selector: { matchLabels: { app: name, }, }, template: { metadata: { labels: {} + this.deployment.spec.selector.matchLabels, }, spec: { tolerations: [ { key: "ephemeral", operator: "Exists", effect: "NoSchedule", }, ], containers: [{ name: name, image: image, args: [ "-listen=:%s" % port, ], ports: [{ name: "main-http", containerPort: port, }], }], }, }, }, }, service: { apiVersion: "v1", kind: "Service", metadata: { namespace: "test-k8s", name: name, }, spec: { selector: {} + this.deployment.spec.template.metadata.labels, ports: [{ port: 80, targetPort: utils.assertEqualAndReturn(this.deployment.spec.template.spec.containers[0].ports[0].name, "main-http"), }], type: "ClusterIP", }, }, ingress: { apiVersion: "networking.k8s.io/v1", kind: "Ingress", metadata: { name: name, namespace: "test-k8s", }, spec: { ingressClassName: "traefik", rules: [ { http: { paths: [ { path: "/", pathType: "Prefix", backend: { service: { name: this.service.metadata.name, port:{ number: utils.assertEqualAndReturn(this.service.spec.ports[0].port, 80), }, }, }, }, ], }, }, ], }, }, },}