Skip to content

Commit 8652ff1

Browse files
yyyangwcremeywang
authored andcommitted
增加“helm charts部署方式下的节点池扩容功能”及文档说明
1 parent f5d8d18 commit 8652ff1

4 files changed

Lines changed: 163 additions & 56 deletions

File tree

helm-charts/tca/README.md

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -302,13 +302,51 @@ Helm will deploy `mariadb` by default. Reference: [bitnami/mariadb](https://gith
302302
| `tca.scmproxy.image.tag` | TCA scmproxy image tag | `latest` |
303303
| `tca.scmproxy.privateScmUrl` | TCA scmproxy private scm url | `""` |
304304
305-
306305
### TCA Client Configuration parameters
307-
| Name | Description | Value |
308-
| -------------------------------------------- | ------------------------------------------------------------------------ | ------------------------- |
309-
| `tca.client.image.repository` | TCA client image repository | `tencenttca/tca-client` |
310-
| `tca.client.image.repository` | TCA client image tag | `latest` |
311-
| `tca.client.enabeld` | Enabled starting TCA client with helm | `true` |
306+
#### Default node pool configuration
307+
| Name | Description | Value |
308+
|------------------------------------------------|----------------------------------------------| ------------------------ |
309+
| `tca.client.image.repository` | TCA client image repository | `tencenttca/tca-client` |
310+
| `tca.client.image.tag` | TCA client image tag | `latest` |
311+
| `tca.client.enabeld` | Enabled starting TCA client with helm | `true` |
312+
| `tca.client.replicas` | The number of nodes in the default node pool | `1` |
313+
| `tca.client.tag` | Tag of the extra node pool | `Codedog_Linux` |
314+
| `tca.client.resources.limits.cpu` | The upper limit of cpu usage | `2000m` |
315+
| `tca.client.resources.limits.memory` | The upper limit of memory usage | `4Gi` |
316+
| `tca.client.resources.requests.cpu` | Required cpu resources | `1000m` |
317+
| `tca.client.resources.requests.memory` | Required memory resources | `2Gi` |
318+
319+
#### Client Node pool expansion operations guide
320+
You can configure node resources on the client.
321+
If you do not manually configure node resources, the default node pool is used.
322+
If the node pool resources are insufficient, expand the capacity of the node pool at any time. For details, refer to 'Procedure for expanding a node pool'.
323+
324+
#### TCA client node pool expansion config
325+
| Name | Description |
326+
|--------------------------------------------------------------|---------------------------------------|
327+
| `extraNodePools.nodepool` | Name of the extended node pool |
328+
| `extraNodePools.nodepool.tag` | Tag of the extra node pool |
329+
| `extraNodePools.nodepool.enabled` | Enabled extending node pool with helm |
330+
| `extraNodePools.nodepool.replicas` | The number of nodes in the extra node pool |
331+
| `extraNodePools.nodepool.resources.limits.cpu` | The upper limit of cpu usage |
332+
| `extraNodePools.nodepool.resources.limits.memory` | The upper limit of memory usage |
333+
| `extraNodePools.nodepool.resources.requests.cpu` | Required cpu resources |
334+
| `extraNodePools.nodepool.resources.requests.memory` | Required memory resources |
335+
336+
#### Procedure for expanding a node pool
337+
1、Initially, deploy the project exclusively utilizing the default node pool.
338+
339+
2、To expand the node pool, navigate to "Background Management > Node Management > Label Management" and add label information.
340+
341+
3、Update the extra node pool configuration in the project file by navigating to "CodeAnalysis/helm-charts/tca/values.yaml" .
342+
343+
4、To add configuration information for extra node pools, refer to the "TCA client node pool expansion config" section under "extraNodePools" in the client section of the TCA.
344+
345+
5、Please note that the "extraNodePools.nodepool" tag can be customized to match the user's requirements for the node pool name. This tag should be the same as the tag name added in Step 2.
346+
347+
6、To enable the current node pool, modify the "enabled" value to "true".
348+
349+
7、Update project deployment.
312350
313351
### TCA Gateway Configuration parameters
314352
| Name | Description | Value |

helm-charts/tca/templates/client/deployment.yaml renamed to helm-charts/tca/templates/client/deployment-default.yaml

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- if .Values.tca.client.enabled }}
12
apiVersion: apps/v1
23
kind: StatefulSet
34
metadata:
@@ -10,6 +11,7 @@ metadata:
1011
name: {{ template "tca.fullname" . }}-client
1112
spec:
1213
serviceName: ""
14+
replicas: {{ .Values.tca.client.replicas }}
1315
selector:
1416
matchLabels:
1517
k8s-app: {{ template "tca.fullname" . }}-client
@@ -42,7 +44,7 @@ spec:
4244
image: "{{ .Values.tca.client.image.repository }}:{{ .Values.tca.client.image.tag }}"
4345
imagePullPolicy: {{ .Values.global.imagePullPolicy }}
4446
command: ["python3"]
45-
args: ["codepuppy.py", "start", "-t", "$(CODEDOG_TOKEN)", "--create-from", "docker", "--tag", "CodeDog_Linux"]
47+
args: ["codepuppy.py", "start", "-t", "$(CODEDOG_TOKEN)", "--create-from", "docker", "--tag", "{{ .Values.tca.client.tag }}"]
4648
envFrom:
4749
- configMapRef:
4850
name: client-env
@@ -56,7 +58,7 @@ spec:
5658
exec:
5759
command:
5860
- sleep
59-
- '20'
61+
- '20'
6062
resources:
6163
{{ toYaml .Values.tca.client.resources | indent 12 }}
6264
volumeMounts:
@@ -71,40 +73,4 @@ spec:
7173
path: config.ini
7274
name: {{ template "tca.fullname" . }}-client-config
7375
name: client-config-conf
74-
---
75-
{{- if .Values.tca.client.autoscaling.enabled }}
76-
apiVersion: autoscaling/v2beta2
77-
kind: HorizontalPodAutoscaler
78-
metadata:
79-
name: {{ template "tca.fullname" . }}-client
80-
labels:
81-
k8s-app: {{ template "tca.fullname" . }}-client
82-
app: {{ template "tca.name" . }}
83-
chart: {{ template "tca.chart" . }}
84-
release: {{ .Release.Name }}
85-
heritage: {{ .Release.Service }}
86-
spec:
87-
scaleTargetRef:
88-
apiVersion: apps/v1
89-
kind: StatefulSet
90-
name: {{ template "tca.fullname" . }}-client
91-
minReplicas: {{ .Values.tca.client.autoscaling.minReplicas }}
92-
maxReplicas: {{ .Values.tca.client.autoscaling.maxReplicas }}
93-
metrics:
94-
{{- if .Values.tca.client.autoscaling.targetMemory }}
95-
- type: Resource
96-
resource:
97-
name: memory
98-
target:
99-
type: Utilization
100-
averageUtilization: {{ .Values.tca.client.autoscaling.targetMemory }}
101-
{{- end }}
102-
{{- if .Values.tca.client.autoscaling.targetCPU }}
103-
- type: Resource
104-
resource:
105-
name: cpu
106-
target:
107-
type: Utilization
108-
averageUtilization: {{ .Values.tca.client.autoscaling.targetCPU }}
109-
{{- end }}
11076
{{- end }}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{{ $myChartName := .Release.Name }}
2+
{{ $myChartService := .Release.Service }}
3+
{{ $Values := .Values}}
4+
{{ $BasePath := $.Template.BasePath}}
5+
{{ $Image := .Values.tca.client.image }}
6+
7+
{{- range $key, $value := .Values.tca.client.extraNodePools }}
8+
{{- if $value.enabled }}
9+
---
10+
apiVersion: apps/v1
11+
kind: StatefulSet
12+
metadata:
13+
labels:
14+
k8s-app: {{ template "tca.fullname" $ }}-client-{{ $key }}
15+
app: {{ template "tca.name" $ }}
16+
chart: {{ template "tca.chart" $ }}
17+
release: {{ $myChartName }}
18+
heritage: {{ $myChartService }}
19+
name: {{ template "tca.fullname" $ }}-client-{{ $key }}
20+
spec:
21+
serviceName: ""
22+
replicas: {{ $value.replicas }}
23+
selector:
24+
matchLabels:
25+
k8s-app: {{ template "tca.fullname" $ }}-client-{{ $key }}
26+
release: {{ $myChartName }}
27+
template:
28+
metadata:
29+
labels:
30+
k8s-app: {{ template "tca.fullname" $ }}-client-{{ $key }}
31+
release: {{ $myChartName }}
32+
spec:
33+
shareProcessNamespace: true
34+
{{- with $Values.global.imagePullSecrets }}
35+
imagePullSecrets:
36+
{{- toYaml . | nindent 8 }}
37+
{{- end }}
38+
{{- if $Values.tca.podAntiAffinity.enable }}
39+
affinity:
40+
podAntiAffinity:
41+
preferredDuringSchedulingIgnoredDuringExecution:
42+
- weight: 1
43+
podAffinityTerm:
44+
topologyKey: "{{ .Values.tca.podAntiAffinity.topologyKey }}"
45+
labelSelector:
46+
matchLabels:
47+
k8s-app: {{ template "tca.fullname" $ }}-client-{{ $key }}
48+
release: {{ $myChartName }}
49+
{{- end }}
50+
containers:
51+
- name: {{ template "tca.fullname" $ }}-client-{{ $key }}
52+
image: "{{ $Image.repository }}:{{ $Image.tag }}"
53+
imagePullPolicy: {{ $Values.global.imagePullPolicy }}
54+
command: ["python3"]
55+
args: ["codepuppy.py", "start", "-t", "$(CODEDOG_TOKEN)", "--create-from", "docker", "--tag", "{{ $value.tag }}"]
56+
envFrom:
57+
- configMapRef:
58+
name: client-env
59+
env:
60+
- name: _HASH_ENV_
61+
value: {{ include (print $BasePath "/client/configmap-env.yaml") $ | sha256sum }}
62+
- name: _HASH_CONFIG_
63+
value: {{ include (print $BasePath "/client/configmap-conf.yaml") $ | sha256sum }}
64+
lifecycle:
65+
preStop:
66+
exec:
67+
command:
68+
- sleep
69+
- '20'
70+
resources:
71+
{{ toYaml $value.resources | indent 12 }}
72+
volumeMounts:
73+
- mountPath: /workspace/client/config.ini
74+
subPath: config.ini
75+
name: client-config-conf
76+
volumes:
77+
- configMap:
78+
items:
79+
- key: config.ini
80+
mode: 420
81+
path: config.ini
82+
name: {{ template "tca.fullname" $ }}-client-config
83+
name: client-config-conf
84+
85+
{{- end }}
86+
{{- end }}

helm-charts/tca/values.yaml

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -632,27 +632,44 @@ tca:
632632
## TCA client: TCA client analysing code
633633
##
634634
client:
635+
## @param tca.client.enabled Enable default TCA client starting
636+
## @param tca.client.replicas Indicates the number of nodes in the default node pool
637+
## @param tca.client.tag Tag of the default node pool
638+
## @param tca.client.resources Cpu and memory resource configuration of the default node pool
639+
##
635640
image:
636641
repository: tencenttca/tca-client
637642
tag: latest
638-
## @param tca.client.enabled Enable TCA client starting
639-
##
640643
enabled: true
644+
replicas: 1
645+
tag: Codedog_Linux
641646
resources:
642647
limits:
643-
cpu: "4000m"
644-
memory: "8Gi"
648+
cpu: "2000m"
649+
memory: "4Gi"
645650
requests:
646651
cpu: "1000m"
647652
memory: "2Gi"
648-
## TCA client auto scaling config
649-
##
650-
autoscaling:
651-
enabled: true
652-
minReplicas: 2
653-
maxReplicas: 4
654-
targetCPU: ""
655-
targetMemory: ""
653+
654+
## TCA client node pool expansion config
655+
## @param tca.client.extraNodePools.nodepool Name of the extended node pool
656+
## @param tca.client.extraNodePools.{nodePoolName}.tag Tag of the extra node pool
657+
## @param tca.client.extraNodePools.{nodePoolName}.enabled Enable extra TCA client starting
658+
## @param tca.client.extraNodePools.{nodePoolName}.replicas Indicates the number of nodes in the extra node pool
659+
## @param tca.client.extraNodePools.{nodePoolName}.resources Cpu and memory resource configuration of the extra node pool
660+
##
661+
extraNodePools:
662+
nodepool:
663+
tag: NodePoolTag
664+
enabled: false
665+
replicas: 2
666+
resources:
667+
limits:
668+
cpu: "2000m"
669+
memory: "4Gi"
670+
requests:
671+
cpu: "1000m"
672+
memory: "2Gi"
656673

657674
## TCA gateway: TCA gateway for all servers
658675
##

0 commit comments

Comments
 (0)