Skip to content

Commit c0af5fd

Browse files
Update from template
Template version: main (7e46fac)
1 parent f38a53f commit c0af5fd

File tree

13 files changed

+246
-10
lines changed

13 files changed

+246
-10
lines changed

.cruft.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"name": "icap-virusscan",
88
"slug": "icap-virusscan",
99
"parameter_key": "icap_virusscan",
10-
"test_cases": "defaults with_squid_proxy",
10+
"test_cases": "defaults with_squid_proxy monitoring",
1111
"add_lib": "n",
1212
"add_pp": "n",
1313
"add_golden": "y",

.github/workflows/test.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
instance:
3535
- defaults
3636
- with_squid_proxy
37+
- monitoring
3738
defaults:
3839
run:
3940
working-directory: ${{ env.COMPONENT_NAME }}
@@ -50,6 +51,7 @@ jobs:
5051
instance:
5152
- defaults
5253
- with_squid_proxy
54+
- monitoring
5355
defaults:
5456
run:
5557
working-directory: ${{ env.COMPONENT_NAME }}

Makefile.vars.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ KUBENT_IMAGE ?= ghcr.io/doitintl/kube-no-trouble:latest
5050
KUBENT_DOCKER ?= $(DOCKER_CMD) $(DOCKER_ARGS) $(root_volume) --entrypoint=/app/kubent $(KUBENT_IMAGE)
5151

5252
instance ?= defaults
53-
test_instances = tests/defaults.yml tests/with_squid_proxy.yml
53+
test_instances = tests/defaults.yml tests/with_squid_proxy.yml tests/monitoring.yml

class/defaults.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ parameters:
1515

1616
monitoring:
1717
enabled: false
18-
prometheusrules:
18+
prometheusruleGroup:
1919
- name: monitoring
20-
syn_team:
2120
rules:
2221
- alert: KubernetesReplicasetReplicasMismatch
2322
annotations:
@@ -26,13 +25,17 @@ parameters:
2625
description: >-
2726
"ReplicaSet {{ $labels.namespace }}/{{ $labels.replicaset }} replicas mismatch\n
2827
VALUE = {{ $value }}\n LABELS = {{ $labels }}"
29-
expr: kube_replicaset_spec_replicas{namespace=~"${_instance}"} > kube_replicaset_status_ready_replicas{namespace=~"${_instance}"}
28+
expr: >
29+
kube_replicaset_spec_replicas{namespace=~"${_instance}"} >
30+
kube_replicaset_status_ready_replicas{namespace=~"${_instance}"}
3031
for: 2m
3132
keep_firing_for: 10m
3233
labels:
3334
severity: warning
3435
- alert: ContainerOOMKilled
35-
expr: (kube_pod_container_status_restarts_total{namespace="${_instance}"} - kube_pod_container_status_restarts_total{namespace="${_instance}"} offset 10m >= 1) and ignoring (reason) min_over_time(kube_pod_container_status_last_terminated_reason{reason="OOMKilled",namespace="${_instance}"}[10m]) == 1
36+
expr: > (kube_pod_container_status_restarts_total{namespace="${_instance}"} -
37+
kube_pod_container_status_restarts_total{namespace="${_instance}"} offset 10m >= 1)
38+
and ignoring (reason) min_over_time(kube_pod_container_status_last_terminated_reason{reason="OOMKilled",namespace="${_instance}"}[10m]) == 1
3639
for: 2m
3740
labels:
3841
severity: warning

component/main.jsonnet

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
// main template for icap-virusscan
22
local kap = import 'lib/kapitan.libjsonnet';
33
local kube = import 'lib/kube.libjsonnet';
4-
local inv = kap.inventory();
4+
local prometheus = import 'lib/prometheus.libsonnet';
5+
local com = import 'lib/commodore.libjsonnet';
56
local sanitizedContainerLib = import 'lib/sanitizedContainer.libsonnet';
7+
local inv = kap.inventory();
68
local sanitizedContainer = sanitizedContainerLib.sanitizedContainer;
79

810
// The hiera parameters for the component
@@ -187,9 +189,11 @@ local prometheusRule = {
187189
labels: selectorLabels,
188190
},
189191
spec: {
190-
groups: {
191-
parameters.monitoring.prometheusrules
192-
}
192+
groups: if std.objectHas( params.monitoring, 'syn_team')
193+
then
194+
[params.monitoring.prometheusruleGroup[0] + {labels: {syn_team: params.monitoring.syn_team}}]
195+
else
196+
params.monitoring.prometheusruleGroup
193197
}
194198
};
195199

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
spec:
2+
syncPolicy:
3+
syncOptions:
4+
- ServerSideApply=true
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
annotations: {}
5+
labels:
6+
name: monitoring
7+
openshift.io/cluster-monitoring: 'true'
8+
name: monitoring
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
labels:
5+
app: clamav-icap
6+
instance: monitoring
7+
name: clamav-icap
8+
namespace: monitoring
9+
spec:
10+
replicas: 2
11+
selector:
12+
matchLabels:
13+
app: clamav-icap
14+
instance: monitoring
15+
strategy:
16+
rollingUpdate:
17+
maxSurge: 1
18+
maxUnavailable: 0
19+
template:
20+
metadata:
21+
labels:
22+
app: clamav-icap
23+
instance: monitoring
24+
spec:
25+
affinity:
26+
podAntiAffinity:
27+
preferredDuringSchedulingIgnoredDuringExecution:
28+
- podAffinityTerm:
29+
labelSelector:
30+
matchLabels:
31+
app: clamav-icap
32+
instance: monitoring
33+
topologyKey: kubernetes.io/hostname
34+
weight: 1
35+
containers:
36+
- env: []
37+
image: ghcr.io/vshn/clamav:20260420_095651
38+
livenessProbe:
39+
failureThreshold: 3
40+
periodSeconds: 5
41+
tcpSocket:
42+
port: 3310
43+
timeoutSeconds: 5
44+
name: clamav
45+
ports:
46+
- containerPort: 3310
47+
name: clamav
48+
readinessProbe:
49+
failureThreshold: 1
50+
initialDelaySeconds: 0
51+
periodSeconds: 5
52+
successThreshold: 1
53+
tcpSocket:
54+
port: 3310
55+
timeoutSeconds: 3
56+
resources:
57+
limits:
58+
cpu: 2000m
59+
memory: 3072Mi
60+
requests:
61+
cpu: 120m
62+
memory: 1280Mi
63+
startupProbe:
64+
failureThreshold: 3
65+
initialDelaySeconds: 0
66+
periodSeconds: 5
67+
tcpSocket:
68+
port: 3310
69+
timeoutSeconds: 5
70+
- env:
71+
- name: CLAMD_IP
72+
value: 127.0.0.1
73+
- name: CLAMD_MAXSIZE
74+
value: 50m
75+
image: ghcr.io/vshn/c-icap:20260420_095301
76+
livenessProbe:
77+
failureThreshold: 3
78+
periodSeconds: 5
79+
tcpSocket:
80+
port: 1344
81+
timeoutSeconds: 5
82+
name: c-icap
83+
ports:
84+
- containerPort: 1344
85+
name: icap
86+
readinessProbe:
87+
failureThreshold: 1
88+
initialDelaySeconds: 0
89+
periodSeconds: 5
90+
successThreshold: 1
91+
tcpSocket:
92+
port: 1344
93+
timeoutSeconds: 3
94+
resources:
95+
limits:
96+
cpu: 500m
97+
memory: 500Mi
98+
requests:
99+
cpu: 120m
100+
memory: 200Mi
101+
startupProbe:
102+
failureThreshold: 3
103+
initialDelaySeconds: 0
104+
periodSeconds: 5
105+
tcpSocket:
106+
port: 1344
107+
timeoutSeconds: 5
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: policy/v1
2+
kind: PodDisruptionBudget
3+
metadata:
4+
labels:
5+
app: clamav-icap
6+
instance: monitoring
7+
name: clamav-icap
8+
namespace: monitoring
9+
spec:
10+
minAvailable: 1
11+
selector:
12+
matchLabels:
13+
app: clamav-icap
14+
instance: monitoring
15+
unhealthyPodEvictionPolicy: IfHealthyBudget
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
labels:
5+
app: clamav-icap
6+
instance: monitoring
7+
name: icap
8+
namespace: monitoring
9+
spec:
10+
ports:
11+
- name: icap
12+
port: 80
13+
protocol: TCP
14+
targetPort: icap
15+
selector:
16+
app: clamav-icap
17+
instance: monitoring
18+
type: ClusterIP

0 commit comments

Comments
 (0)