Skip to content

Commit ebbf50c

Browse files
config: add air-gapped templating and flavor
1 parent 107962a commit ebbf50c

15 files changed

+225
-2
lines changed

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,17 @@ Assuming you already have everything needed to install the apps, this is what yo
127127

128128
```bash
129129
export CK8S_ENVIRONMENT_NAME=my-ck8s-cluster
130-
export CK8S_FLAVOR=[dev|prod] # defaults to dev
130+
export CK8S_FLAVOR=[dev|prod|air-gapped] # defaults to dev
131131

132132
#
133133
# If 'none', no infra provider tailored configuration will be performed!
134134
#
135135
export CK8S_CLOUD_PROVIDER=[exoscale|safespring|citycloud|elastx|aws|baremetal|none]
136136
```
137137

138+
> [!NOTE]
139+
> The `air-gapped` flavor has a lot of the same settings as the `prod` flavor but with some additional variables that you need to configure yourself (these are set to `set-me`).
140+
138141
1. Then set the path to where the ck8s configuration should be stored and the PGP fingerprint of the key(s) to use for encryption:
139142

140143
```bash

bin/common.bash

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ ck8s_cloud_providers=(
2222
ck8s_flavors=(
2323
"dev"
2424
"prod"
25+
"air-gapped"
2526
)
2627

2728
CK8S_AUTO_APPROVE=${CK8S_AUTO_APPROVE:-"false"}

config/config/common-config.yaml

+36
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,11 @@ falco:
118118
enabled: false
119119
version: 2.0.0
120120

121+
artifact:
122+
install:
123+
# set to false in an air-gapped environment, unless artifacts are self-hosted
124+
enabled: true
125+
121126
# Setting tty to "true" will immediately display Falco logs by flushing them as they are emitted
122127
tty: true
123128

@@ -134,6 +139,14 @@ falco:
134139
# Can be skipped if eBPF JIT is enabled from outside the container
135140
hostNetwork: false
136141

142+
module:
143+
# override the URL used for downloading driver modules, e.g. to use a self hosted file server in an air-gapped environment
144+
repoURL: ""
145+
146+
# use custom indexes for falcoctl downloads
147+
# ref: https://github.com/falcosecurity/charts/blob/falco-3.8.3/charts/falco/values.yaml#L390-L395
148+
customIndexes: []
149+
137150
## additional falco rules
138151
## ref: https://falco.org/docs/rules/
139152
customRules: {}
@@ -853,6 +866,29 @@ trivy:
853866
interval: 5m
854867
tolerations: []
855868
affinity: {}
869+
870+
# configurations for an offline / air-gapped environment
871+
# ref: https://github.com/aquasecurity/trivy-operator/tree/main/deploy/helm#values
872+
scanner:
873+
offlineScanEnabled: false
874+
dbRegistry: ""
875+
dbRepository: ""
876+
dbRepositoryInsecure: false
877+
javaDbRegistry: ""
878+
javaDbRepository: ""
879+
# if authorization is required for pulling from registry, create a pull
880+
# secret in the monitoring namespace and configure the secret name
881+
imagePullSecret:
882+
name: ""
883+
registry:
884+
mirror: {}
885+
# "docker.io": registry.example.org:5000
886+
# "gcr.io": registry.example.org:5000
887+
# "ghcr.io": registry.example.org:5000
888+
# "index.docker.io": registry.example.org:5000
889+
# "quay.io": registry.example.org:5000
890+
# "registry.k8s.io": registry.example.org:5000
891+
856892
kured:
857893
enabled: false
858894
# See options at https://github.com/weaveworks/kured/blob/1.9.1/charts/kured/values.yaml#L24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
global:
2+
issuer: set-me
3+
4+
prometheus:
5+
storage:
6+
size: 15Gi
7+
retention:
8+
size: 12GiB
9+
10+
falco:
11+
artifact:
12+
install:
13+
enabled: false
14+
15+
trivy:
16+
scanner:
17+
offlineScanEnabled: true
18+
dbRegistry: set-me
19+
dbRepository: set-me
20+
dbRepositoryInsecure: false # set to true if the private registry is not configured with HTTPS
21+
javaDbRegistry: set-me
22+
javaDbRepository: set-me
23+
24+
# add registries that should be mirrored to private registry
25+
registry:
26+
mirror:
27+
"docker.io": set-me
28+
"gcr.io": set-me
29+
"ghcr.io": set-me
30+
"index.docker.io": set-me
31+
"quay.io": set-me
32+
"registry.k8s.io": set-me
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
dex:
2+
enableStaticLogin: false
3+
4+
alerts:
5+
alertTo: set-me
6+
customReceivers:
7+
- set-me
8+
9+
prometheus:
10+
retention:
11+
age: 7d
12+
13+
opensearch:
14+
sso:
15+
enabled: true
16+
plugins:
17+
installExternalObjectStoragePlugin: false
18+
additionalPlugins:
19+
- set-me
20+
masterNode:
21+
javaOpts: -Xms1024m -Xmx1024m
22+
resources:
23+
requests:
24+
memory: 2Gi
25+
cpu: 100m
26+
limits:
27+
memory: 3Gi
28+
dataNode:
29+
storageSize: 130Gi
30+
javaOpts: -Xms2048m -Xmx2048m
31+
resources:
32+
requests:
33+
memory: 4Gi
34+
limits:
35+
memory: 5Gi
36+
clientNode:
37+
javaOpts: -Xms1024m -Xmx1024m
38+
resources:
39+
requests:
40+
memory: 2Gi
41+
limits:
42+
memory: 2.5Gi
43+
ism:
44+
rolloverSizeGB: 5
45+
rolloverAgeDays: 1
46+
curator:
47+
retention:
48+
- pattern: other-*
49+
sizeGB: 5
50+
ageDays: 10
51+
- pattern: kubeaudit-*
52+
sizeGB: 50
53+
ageDays: 30
54+
- pattern: kubernetes-*
55+
sizeGB: 50
56+
ageDays: 30
57+
- pattern: authlog-*
58+
sizeGB: 5
59+
ageDays: 30
60+
- pattern: security-auditlog-*
61+
sizeGB: 1
62+
ageDays: 14
63+
resources:
64+
requests:
65+
cpu: 10m
66+
memory: 32Mi
67+
snapshot:
68+
min: 300 # 12 / day * 30 days = 360, subtract some to account for failures
69+
max: 500
70+
ageSeconds: 2592000 # 30 days
71+
backupSchedule: 30 */2 * * * # 30 min past every 2nd hour to avoid collision with retention
72+
73+
harbor:
74+
database:
75+
internal:
76+
persistentVolumeClaim:
77+
size: 5Gi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
user:
2+
namespaces:
3+
- set-me
4+
- production
5+
- staging

config/config/sc-config.yaml

+11
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,15 @@ opensearch:
718718
defaultTemplates: true
719719
additionalTemplates: {}
720720

721+
plugins:
722+
# in an air-gapped environment where the nodes are not connected to the Internet, set
723+
# following variable to false to prevent downloading external object storage plugin
724+
installExternalObjectStoragePlugin: true
725+
726+
# in an air-gapped environment this can be used to install plugins from known sources
727+
additionalPlugins: []
728+
# - server.local:8080/repository-s3-2.8.0.zip
729+
721730
# Index state management
722731
ism:
723732
rolloverSizeGB: 1
@@ -1034,6 +1043,8 @@ alerts:
10341043
# {{ end }}
10351044
opsGenie:
10361045
apiUrl: https://api.eu.opsgenie.com
1046+
# Configure custom alert receivers
1047+
customReceivers: []
10371048

10381049
externalTrafficPolicy:
10391050
# Whitelisting requires externalTrafficPolicy.local to be true

helmfile.d/values/falco/falco-common.yaml.gotmpl

+11-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ falco:
2424
{{end}}
2525
- /etc/falco/falco_rules.local.yaml
2626
- /etc/falco/rules.d
27+
2728
tty: {{ .Values.falco.tty }}
2829

2930
{{- if eq .Values.falco.driver.kind "module" }}
@@ -52,6 +53,11 @@ driver:
5253
runAsUser: 0
5354
privileged: true
5455
allowPrivilegeEscalation: true
56+
{{- with .Values.falco.driver.module.repoURL }}
57+
env:
58+
- name: DRIVERS_REPO
59+
value: {{ . }}
60+
{{- end }}
5561

5662
resources: {{- toYaml .Values.falco.resources | nindent 2 }}
5763
nodeSelector: {{- toYaml .Values.falco.nodeSelector | nindent 2 }}
@@ -61,7 +67,7 @@ tolerations: {{- toYaml .Values.falco.tolerations | nindent 2 }}
6167
falcoctl:
6268
artifact:
6369
install:
64-
enabled: true
70+
enabled: {{ .Values.falco.artifact.install.enabled }}
6571
follow:
6672
enabled: false
6773
config:
@@ -77,6 +83,10 @@ falcoctl:
7783
{{- if eq .Values.falco.rulesFiles.sandbox.enabled true }}
7884
- falco-sandbox-rules:{{.Values.falco.rulesFiles.sandbox.version}}
7985
{{end}}
86+
{{- with .Values.falco.customIndexes }}
87+
indexes:
88+
{{- toYaml . | nindent 6 }}
89+
{{- end }}
8090
customRules:
8191
{{- if .Values.falco.customRules }}
8292
{{ toYaml .Values.falco.customRules | nindent 2}}

helmfile.d/values/kube-prometheus-stack-sc.yaml.gotmpl

+3
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ alertmanager:
151151
source: {{ .Values.grafana.user.subdomain }}.{{ .Values.global.opsDomain }}
152152
priority: {{`'{{ if eq .GroupLabels.severity "critical"}}P1{{else if eq .GroupLabels.severity "warning"}}P2{{else if eq .GroupLabels.severity "medium"}}P3{{else if eq .GroupLabels.severity "low"}}P4{{else}}P5{{end}}'`}}
153153
{{ end }}
154+
{{- with .Values.alerts.customReceivers }}
155+
{{- toYaml . | nindent 4 }}
156+
{{- end }}
154157

155158
alertmanagerSpec:
156159
replicas: {{ .Values.prometheus.alertmanagerSpec.replicas }}

helmfile.d/values/opensearch/common.yaml.gotmpl

+5
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,14 @@ keystore:
166166
plugins:
167167
enabled: true
168168
installList:
169+
{{- if .Values.opensearch.plugins.installExternalObjectStoragePlugin }}
169170
{{- if (eq .Values.objectStorage.type "s3") }}
170171
- repository-s3
171172
{{- else if (eq .Values.objectStorage.type "gcs") }}
172173
- repository-gcs
173174
{{- end }}
175+
{{- end }}
176+
{{- with .Values.opensearch.plugins.additionalPlugins }}
177+
{{- toYaml . | nindent 4 }}
178+
{{- end }}
174179
{{- end}}

helmfile.d/values/prometheus-blackbox-exporter-sc.yaml.gotmpl

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ pspEnabled: false
44

55
config:
66
modules:
7+
http_2xx:
8+
http:
9+
tls_config:
10+
insecure_skip_verify: {{ not .Values.global.verifyTls }}
711
http_400:
812
prober: http
913
timeout: 5s

helmfile.d/values/prometheus-blackbox-exporter-wc.yaml.gotmpl

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ pspEnabled: false
44

55
config:
66
modules:
7+
http_2xx:
8+
http:
9+
tls_config:
10+
insecure_skip_verify: {{ not .Values.global.verifyTls }}
711
http_400:
812
prober: http
913
timeout: 5s

helmfile.d/values/trivy/trivy-operator.yaml.gotmpl

+28
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,30 @@ targetNamespaces: ""
99
# mode, i.e. when the targetNamespaces values is a blank string.
1010
excludeNamespaces: {{ .Values.trivy.excludeNamespaces }}
1111

12+
trivy:
13+
offlineScan: {{ .Values.trivy.scanner.offlineScanEnabled }}
14+
15+
{{- with .Values.trivy.scanner.dbRegistry }}
16+
dbRegistry: {{ . | quote }}
17+
{{- end }}
18+
{{- with .Values.trivy.scanner.dbRepository }}
19+
dbRepository: {{ . | quote }}
20+
{{- end }}
21+
dbRepositoryInsecure: {{ .Values.trivy.scanner.dbRepositoryInsecure }}
22+
23+
{{- with .Values.trivy.scanner.javaDbRegistry }}
24+
javaDbRegistry: {{ . | quote }}
25+
{{- end }}
26+
{{- with .Values.trivy.scanner.javaDbRepository }}
27+
javaDbRepository: {{ . | quote }}
28+
{{- end }}
29+
30+
{{- with .Values.trivy.scanner.registry }}
31+
registry:
32+
mirror:
33+
{{ toYaml .mirror | nindent 6 }}
34+
{{- end }}
35+
1236
operator:
1337

1438
replicas: 1
@@ -39,6 +63,10 @@ operator:
3963
# scanJobTimeout the length of time to wait before giving up on a scan job
4064
scanJobTimeout: {{ .Values.trivy.scanJobs.timeout }}
4165

66+
{{- with .Values.trivy.scanner.imagePullSecret.name }}
67+
privateRegistryScanSecretsNames: {"monitoring": {{ . }}}
68+
{{- end }}
69+
4270
tolerations: {{- toYaml .Values.trivy.tolerations | nindent 2 }}
4371

4472
affinity: {{- toYaml .Values.trivy.affinity | nindent 2 }}

tests/unit/bin/init.bats.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,10 @@ tests:
101101
tests:
102102
- target: dev
103103
- target: prod
104+
- target: air-gapped
104105

105106
- function: test_init_idempotent # cloud flavor
106107
tests:
107108
- target: dev
108109
- target: prod
110+
- target: air-gapped

tests/unit/validate.bats.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ tests:
5757
tests:
5858
- target: dev
5959
- target: prod
60+
- target: air-gapped
6061

6162
- function: validate_template # cloud flavor
6263
tests:
6364
- target: dev
6465
- target: prod
66+
- target: air-gapped

0 commit comments

Comments
 (0)