forked from bitnami-labs/sealed-secrets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
controller-norbac.jsonnet
58 lines (52 loc) · 1.71 KB
/
controller-norbac.jsonnet
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Minimal required deployment for a functional controller.
local kube = import "kube.libsonnet";
local trim = function(str) (
if std.startsWith(str, " ") || std.startsWith(str, "\n") then
trim(std.substr(str, 1, std.length(str) - 1))
else if std.endsWith(str, " ") || std.endsWith(str, "\n") then
trim(std.substr(str, 0, std.length(str) - 1))
else
str
);
local namespace = "kube-system";
local controllerImage = std.extVar("CONTROLLER_IMAGE");
// This is a bit odd: Downgrade to apps/v1beta1 so we can continue
// to support k8s v1.6.
// TODO: re-evaluate sealed-secrets support timeline and/or
// kube.libsonnet versioned API support.
local v1beta1_Deployment(name) = kube.Deployment(name) {
assert std.assertEqual(super.apiVersion, "apps/v1beta2"),
apiVersion: "apps/v1beta1",
};
{
namespace:: {metadata+: {namespace: namespace}},
service: kube.Service("sealed-secrets-controller") + $.namespace {
target_pod: $.controller.spec.template,
},
controller: v1beta1_Deployment("sealed-secrets-controller") + $.namespace {
spec+: {
template+: {
spec+: {
containers_+: {
controller: kube.Container("sealed-secrets-controller") {
image: controllerImage,
command: ["controller"],
readinessProbe: {
httpGet: {path: "/healthz", port: "http"},
},
livenessProbe: self.readinessProbe,
ports_+: {
http: {containerPort: 8080},
},
securityContext+: {
readOnlyRootFilesystem: true,
runAsNonRoot: true,
runAsUser: 1001,
},
},
},
},
},
},
},
}