aboutsummaryrefslogtreecommitdiff
path: root/deploy/environments/production/main.jsonnet
blob: 175fbab6bbfcff5fe5a1a04c0d04092341a9b0d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
local k = import 'ksonnet-util/kausal.libsonnet';
local util = import 'util/main.libsonnet';

function(tag, namespace, envSlug=null, projectPathSlug=null)
  (util.inlineSpec('https://control.kube.cat:6443', namespace, envSlug, projectPathSlug))
  + {
    _config:: self.data._config,
    catinator:: self.data.catinator,
    data: (import 'catinator.libsonnet') + {
      _config+:: {
        catinator+: {
          image+: {
            tag: tag,
          },
          config: importstr '../../../config.toml',
        },
      },
      catinator+: {
        local egress = util.cilium.egressNatPolicy,
        local statefulset = k.apps.v1.statefulSet,
        local container = k.core.v1.container,

        statefulset+:
          statefulset.spec.template.spec.withInitContainers([
            container.new('waitForEgress', 'docker.io/busybox:latest')
            + container.withCommand(['/bin/sleep', '30']),
          ]),

        egress:
          egress.new('catinator')
          + egress.withEgressSourceIP('178.63.224.13')
          + egress.withDestinationCIDRs(['0.0.0.0/0'])
          + egress.withPodSelector(
            egress.podSelector.withMatchLabels({
              'io.kubernetes.pod.namespace': namespace,
            })
          ),
      },
    },
  }