Skip to content

Commit 221f3d4

Browse files
authored
Merge pull request #1470 from mapellidario/20240424_crabhelm
crabserver - improve deployment with helm charts
2 parents 51d74e6 + 8cf744a commit 221f3d4

File tree

7 files changed

+63
-179
lines changed

7 files changed

+63
-179
lines changed

helm/crabserver/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
## Deploy CRAB
2+
3+
At the moment CRAB team is transitioning to using helm. However, we do noy like
4+
to use helm for deployment. See this
5+
[comment](https://github.com/dmwm/CRABServer/issues/7843#issuecomment-2025085120)
6+
for some context.
7+
8+
We like to use helm for templating, using the helm charts to generate the
9+
manifest file, then applying it with `kubectl apply`.
10+
11+
We therefore ask cmsweb operators to deploy crab with the following procedure:
12+
13+
Generate the manifest with
14+
15+
```bash
16+
# testbed
17+
helm template crabserver . -f values.yaml -f values-testbed.yaml > ../../kubernetes/cmsweb/services/crabserver.yaml
18+
19+
# prod
20+
helm template crabserver . -f values.yaml -f values-prod.yaml > ../../kubernetes/cmsweb/services/crabserver.yaml
21+
```
22+
23+
Then to deploy it with the usual `deploy-srv.sh` script
24+
25+
```bash
26+
# testbed
27+
./scripts/deploy-srv.sh crabserver v3.231006 preprod
28+
29+
# prod
30+
./scripts/deploy-srv.sh crabserver v3.231006 prod
31+
```
32+
33+
Changes to `../../kubernetes/cmsweb/services/crabserver.yaml` should not be committed.

helm/crabserver/templates/deployment.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ metadata:
88
namespace: crab
99
spec:
1010
{{- if not .Values.autoscaling.enabled }}
11-
{{- if or (eq (toString $environment) "prod") (eq (toString $environment) "preprod") }}
11+
{{- if (eq (toString $environment) "prod") }}
1212
replicas: {{ .Values.replicaCount.prod }}
13+
{{- else if (eq (toString $environment) "preprod")}}
14+
replicas: {{ .Values.replicaCount.preprod }}
1315
{{- else }}
1416
replicas: {{ .Values.replicaCount.test }}
1517
{{- end }}

helm/crabserver/values-prod.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
environment: "prod"
2+
3+
image:
4+
tag: "v3.240508"
5+

helm/crabserver/values-test11.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
environment: "test"
2+
3+
image:
4+
tag: "v3.240325"
5+
6+
livenessProbeTest:
7+
failureThreshold: 3
8+
initialDelaySeconds: 120
9+
periodSeconds: 600
10+
timeoutSeconds: 60
11+
12+
readinessProbeTest:
13+
periodSeconds: 600
14+
timeoutSeconds: 60

helm/crabserver/values-test2.yaml

Lines changed: 2 additions & 177 deletions
Original file line numberDiff line numberDiff line change
@@ -1,179 +1,4 @@
1-
# Default values for crabserver.
2-
# This is a YAML-formatted file.
3-
# Declare variables to be passed into your templates.
4-
5-
replicaCount:
6-
prod: 8
7-
test: 1
1+
environment: "test"
82

93
image:
10-
path: registry.cern.ch/cmsweb/crabserver
11-
pullPolicy: Always
12-
# Overrides the image tag whose default is the chart appVersion.
13-
tag: "v3.240219"
14-
command:
15-
- /bin/bash
16-
- /opt/setup-certs-and-run/setup-certs-and-run.sh
17-
env:
18-
- name: CRABSERVER_LOGSTDOUT
19-
value: "t"
20-
21-
environment:
22-
23-
imagePullSecrets: []
24-
nameOverride: ""
25-
fullnameOverride: ""
26-
27-
serviceAccount:
28-
# Specifies whether a service account should be created
29-
create: false
30-
# Annotations to add to the service account
31-
annotations: {}
32-
# The name of the service account to use.
33-
# If not set and create is true, a name is generated using the fullname template
34-
name: ""
35-
36-
podAnnotations:
37-
prometheus.io/scrape: 'true'
38-
prometheus.io/port: "18270"
39-
40-
podSecurityContext:
41-
runAsUser: 1000
42-
runAsGroup: 1000
43-
fsGroup: 2000
44-
45-
imageFilebeatSecurityContext:
46-
allowPrivilegeEscalation: false
47-
48-
securityContext:
49-
privileged: true
50-
51-
serviceMon:
52-
name: crabserver-mon
53-
port: 18720
54-
protocol: TCP
55-
56-
ingress:
57-
enabled: false
58-
annotations: {}
59-
# kubernetes.io/ingress.class: nginx
60-
# kubernetes.io/tls-acme: "true"
61-
62-
resources:
63-
limits:
64-
cpu: 1500m
65-
memory: 3Gi
66-
requests:
67-
cpu: 200m
68-
memory: 256Mi
69-
70-
71-
deamonset:
72-
name: filebeat
73-
path: docker.elastic.co/beats/filebeat:8.5.1
74-
policy: IfNotPresent
75-
args:
76-
- bash
77-
- -c
78-
- filebeat -c /etc/filebeat.yml --path.data /data/filebeat/${MY_NODE_NAME}/data -e
79-
env:
80-
- name: MY_NODE_NAME
81-
valueFrom:
82-
fieldRef:
83-
fieldPath: spec.nodeName
84-
- name: NODE_NAME
85-
valueFrom:
86-
fieldRef:
87-
fieldPath: spec.nodeName
88-
- name: MY_NAMESPACE
89-
valueFrom:
90-
fieldRef:
91-
apiVersion: v1
92-
fieldPath: metadata.namespace
93-
resources:
94-
requests:
95-
memory: "128Mi"
96-
cpu: "200m"
97-
limits:
98-
cpu: "1"
99-
memory: "1Gi"
100-
101-
102-
livenessProbe:
103-
exec:
104-
command:
105-
- /bin/sh
106-
- -c
107-
- |
108-
cmsweb-ping --url=http://localhost:8270/crabserver/prod/info --authz=/etc/hmac/hmac -verbose 0 | egrep "^[2-4]"
109-
failureThreshold: 3
110-
initialDelaySeconds: 120
111-
periodSeconds: 60
112-
timeoutSeconds: 60
113-
114-
readinessProbe:
115-
exec:
116-
command:
117-
- /bin/sh
118-
- -c
119-
- |
120-
cmsweb-ping --url=http://localhost:8270/crabserver/prod/info --authz=/etc/hmac/hmac -verbose 0 | egrep "^[2-4]"
121-
periodSeconds: 60
122-
timeoutSeconds: 60
123-
124-
livenessProbePreProd:
125-
exec:
126-
command:
127-
- /bin/sh
128-
- -c
129-
- |
130-
cmsweb-ping --url=http://localhost:8270/crabserver/preprod/info --authz=/etc/hmac/hmac -verbose 0 | egrep "^[2-4]"
131-
failureThreshold: 3
132-
initialDelaySeconds: 120
133-
periodSeconds: 60
134-
timeoutSeconds: 60
135-
136-
readinessProbePreProd:
137-
exec:
138-
command:
139-
- /bin/sh
140-
- -c
141-
- |
142-
cmsweb-ping --url=http://localhost:8270/crabserver/preprod/info --authz=/etc/hmac/hmac -verbose 0 | egrep "^[2-4]"
143-
periodSeconds: 60
144-
timeoutSeconds: 60
145-
146-
livenessProbeTest:
147-
exec:
148-
command:
149-
- /bin/sh
150-
- -c
151-
- |
152-
cmsweb-ping --url=http://localhost:8270/crabserver/dev/info --authz=/etc/hmac/hmac -verbose 0 | egrep "^[2-4]"
153-
failureThreshold: 3
154-
initialDelaySeconds: 120
155-
periodSeconds: 60
156-
timeoutSeconds: 60
157-
158-
readinessProbeTest:
159-
exec:
160-
command:
161-
- /bin/sh
162-
- -c
163-
- |
164-
cmsweb-ping --url=http://localhost:8270/crabserver/dev/info --authz=/etc/hmac/hmac -verbose 0 | egrep "^[2-4]"
165-
periodSeconds: 60
166-
timeoutSeconds: 60
167-
168-
autoscaling:
169-
enabled: false
170-
minReplicas: 1
171-
maxReplicas: 100
172-
targetCPUUtilizationPercentage: 80
173-
# targetMemoryUtilizationPercentage: 80
174-
175-
nodeSelector: {}
176-
177-
tolerations: []
178-
179-
affinity: {}
4+
tag: "v3.240325"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
environment: "preprod"
2+
3+
image:
4+
tag: "v3.240508"

helm/crabserver/values.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
# Declare variables to be passed into your templates.
44

55
replicaCount:
6-
prod: 8
6+
prod: 15
7+
preprod: 1
78
test: 1
89

910
image:

0 commit comments

Comments
 (0)