From b21a9e93ae09477545cc302014140c2c8b7c39ce Mon Sep 17 00:00:00 2001 From: dxin Date: Mon, 27 Oct 2025 16:54:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0ymal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SCM/build_image_lessie_sourcing_agents.groovy | 2 +- .../test/test_lessie_sourcing_agents.yaml | 95 ++++++++++++++++++- 2 files changed, 92 insertions(+), 5 deletions(-) diff --git a/SCM/build_image_lessie_sourcing_agents.groovy b/SCM/build_image_lessie_sourcing_agents.groovy index 4f4124c..6820689 100644 --- a/SCM/build_image_lessie_sourcing_agents.groovy +++ b/SCM/build_image_lessie_sourcing_agents.groovy @@ -4,7 +4,7 @@ pipeline { parameters { gitParameter( branchFilter: 'origin/(.*)', - defaultValue: 'feature/docker_1015', + defaultValue: 'dxin', name: 'Code_branch', type: 'PT_BRANCH', selectedValue: 'DEFAULT', diff --git a/k8s_yaml/test/test_lessie_sourcing_agents.yaml b/k8s_yaml/test/test_lessie_sourcing_agents.yaml index 365d50b..54c0af7 100644 --- a/k8s_yaml/test/test_lessie_sourcing_agents.yaml +++ b/k8s_yaml/test/test_lessie_sourcing_agents.yaml @@ -2,19 +2,106 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: lessie-sourcing-agents + name: test-lessie-agents-deployment namespace: test-lessie labels: - app: test_lessie-sourcing-agents + app: test-lessie-agents environment: test project: lessie spec: + replicas: 1 selector: matchLabels: labels: - app: test_lessie-sourcing-agents + app: test-lessie-agents environment: test project: lessie + strategy: + type: RollingUpdate # 滚动更新策略 + rollingUpdate: + maxSurge: 1 # 最大新增副本数 + maxUnavailable: 1 # 最大不可用副本数 + template: + metadata: + labels: + app: test-lessie-agents + environment: test + project: lessie + spec: + imagePullSecrets: + - name: dxin-image-repository # 镜像仓库凭证Secret + volumes: + - name: aws-credentials-volume # aws-credentials 卷文件 + configMap: + name: aws-credentials + - name: google-credentials-volume + configMap: + name: google-credentials + - name: lessie-logs-volume + hostPath: + path: /data/logs/lessie-agents/ + type: DirectoryOrCreate + containers: + - name: test-lessie-agents # 容器名称 + image: uswccr.ccs.tencentyun.com/lessietest/lessie-sourcing-agents:v21_dxin_f2c4c4b0_202510271638 # 容器镜像 + imagepullPolicy: IfNotPresent # 镜像拉取策略 ,有则不拉 + env: + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: APP_ENV_VALUE + value: "s1" + - name: APP_PORT + value: "8000" + - name: GUNICORN_WORKERS + value: "2" + - name: MAX_REQUESTS + value: "200" + - name: MAX_REQUESTS_JITTER + value: "50" + ports: + - containerPort: 8000 # 容器暴露的端口 + resources: + requests: + cpu: "1" # 容器请求分配1个CPU核心 + memory: "2Gi" # 容器请求分配2Gi内存 + limits: + cpu: "2" # 最多可以使用2个CPU核心 + memory: "8Gi" # 容器最多可以使用8Gi内存 + volumeMounts: + - name: aws-credentials-volume + mountPath: /root/.aws/ + - name: google-credentials-volume + mountPath: /root/.google/ + - name: lessie-logs-volume + mountPath: /data/webapps/lessie_sourcing_agents/logs/ + subPathExpr: lessie-agents-$(POD_NAME) + + +--- +# 创建 Service +# 集群内部(其他 Pod):http://test-lessie-agents-svc.test-lessie:8000 +# 集群外部(其他节点):http://:38000 +apiVersion: v1 +kind: Service +metadata: + name: test-lessie-agents-svc + namespace: test-lessie + labels: + app: test-lessie-agents + environment: test + project: lessie +spec: + type: NodePort + selector: # 必须匹配 Deployment 的 labels 才能关联 Pod + app: test-lessie-agents + environment: test + project: lessie + ports: + - name: http + port: 8000 # ClusterIP 内部端口 + targetPort: 8000 # 容器端口 + nodePort: 38000 # 节点对外端口 -template: