docs: 校准API部署观测计划
This commit is contained in:
parent
e8fecebae8
commit
cde9638227
@ -191,9 +191,9 @@ Add this block after the existing workstream closeout self-tests and before the
|
|||||||
"--container",
|
"--container",
|
||||||
"api",
|
"api",
|
||||||
"--health-url",
|
"--health-url",
|
||||||
"http://127.0.0.1:30085/health/runtime",
|
"http://127.0.0.1:48085/health/runtime",
|
||||||
"--smoke",
|
"--smoke",
|
||||||
"curl -fsS --max-time 8 http://127.0.0.1:30085/health/runtime",
|
"curl -fsS --max-time 8 http://127.0.0.1:48085/health/runtime",
|
||||||
]);
|
]);
|
||||||
if (
|
if (
|
||||||
deployObservationInput.project !== "api" ||
|
deployObservationInput.project !== "api" ||
|
||||||
@ -205,9 +205,9 @@ Add this block after the existing workstream closeout self-tests and before the
|
|||||||
deployObservationInput.deployment !== "kt-template-online-api" ||
|
deployObservationInput.deployment !== "kt-template-online-api" ||
|
||||||
deployObservationInput.container !== "api" ||
|
deployObservationInput.container !== "api" ||
|
||||||
deployObservationInput.healthUrl !==
|
deployObservationInput.healthUrl !==
|
||||||
"http://127.0.0.1:30085/health/runtime" ||
|
"http://127.0.0.1:48085/health/runtime" ||
|
||||||
deployObservationInput.smoke !==
|
deployObservationInput.smoke !==
|
||||||
"curl -fsS --max-time 8 http://127.0.0.1:30085/health/runtime" ||
|
"curl -fsS --max-time 8 http://127.0.0.1:48085/health/runtime" ||
|
||||||
deployObservationInput.execute !== false
|
deployObservationInput.execute !== false
|
||||||
) {
|
) {
|
||||||
throw new Error("deploy observation CLI parser self-check failed");
|
throw new Error("deploy observation CLI parser self-check failed");
|
||||||
@ -315,12 +315,12 @@ Add this block after the existing workstream closeout self-tests and before the
|
|||||||
const deployObservationDryRun = await buildDeployObservation({
|
const deployObservationDryRun = await buildDeployObservation({
|
||||||
deployment: "kt-template-online-api",
|
deployment: "kt-template-online-api",
|
||||||
execute: false,
|
execute: false,
|
||||||
healthUrl: "http://127.0.0.1:30085/health/runtime",
|
healthUrl: "http://127.0.0.1:48085/health/runtime",
|
||||||
imageTag: "abc1234",
|
imageTag: "abc1234",
|
||||||
jobName: "kt-template-online-api",
|
jobName: "kt-template-online-api",
|
||||||
namespace: "kt-prod",
|
namespace: "kt-prod",
|
||||||
project: "api",
|
project: "api",
|
||||||
smoke: "curl -fsS --max-time 8 http://127.0.0.1:30085/health/runtime",
|
smoke: "curl -fsS --max-time 8 http://127.0.0.1:48085/health/runtime",
|
||||||
});
|
});
|
||||||
const deployObservationCommandText = JSON.stringify(
|
const deployObservationCommandText = JSON.stringify(
|
||||||
deployObservationDryRun.commands,
|
deployObservationDryRun.commands,
|
||||||
@ -429,6 +429,8 @@ export interface DeployObservationJenkinsEvidence {
|
|||||||
|
|
||||||
export interface DeployObservationDeploymentEvidence {
|
export interface DeployObservationDeploymentEvidence {
|
||||||
container: string;
|
container: string;
|
||||||
|
containerFound: boolean;
|
||||||
|
desiredReplicas: number | null;
|
||||||
generation: number | null;
|
generation: number | null;
|
||||||
image: string | null;
|
image: string | null;
|
||||||
namespace: string;
|
namespace: string;
|
||||||
@ -438,6 +440,7 @@ export interface DeployObservationDeploymentEvidence {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface DeployObservationPodEvidence {
|
export interface DeployObservationPodEvidence {
|
||||||
|
containerFound: boolean;
|
||||||
image: string | null;
|
image: string | null;
|
||||||
name: string | null;
|
name: string | null;
|
||||||
phase: string | null;
|
phase: string | null;
|
||||||
@ -574,10 +577,10 @@ function normalizeInput(input: DeployObservationInput = {}): NormalizedInput {
|
|||||||
expectedCommit: input.expectedCommit?.trim() || undefined,
|
expectedCommit: input.expectedCommit?.trim() || undefined,
|
||||||
healthUrl:
|
healthUrl:
|
||||||
input.healthUrl?.trim() ||
|
input.healthUrl?.trim() ||
|
||||||
'http://127.0.0.1:30085/health/runtime',
|
'http://127.0.0.1:48085/health/runtime',
|
||||||
imageTag: input.imageTag?.trim() || undefined,
|
imageTag: input.imageTag?.trim() || undefined,
|
||||||
jenkinsHome: input.jenkinsHome?.trim() || '/vol1/docker/jenkins_home',
|
jenkinsHome: input.jenkinsHome?.trim() || '/vol1/docker/jenkins/jenkins_home',
|
||||||
jobName: input.jobName?.trim() || 'kt-template-online-api',
|
jobName: input.jobName?.trim() || 'KT-Template/KT-Template-API/main',
|
||||||
kubeconfigPath:
|
kubeconfigPath:
|
||||||
input.kubeconfigPath?.trim() ||
|
input.kubeconfigPath?.trim() ||
|
||||||
'/vol1/docker/kt-k8s/kubeconfig/kt-nas.jenkins.yaml',
|
'/vol1/docker/kt-k8s/kubeconfig/kt-nas.jenkins.yaml',
|
||||||
@ -885,9 +888,10 @@ export function normalizeDeployObservationEvidence({
|
|||||||
'deployment-ready-replicas',
|
'deployment-ready-replicas',
|
||||||
deployment.updatedReplicas !== null &&
|
deployment.updatedReplicas !== null &&
|
||||||
deployment.readyReplicas !== null &&
|
deployment.readyReplicas !== null &&
|
||||||
deployment.updatedReplicas > 0 &&
|
deployment.desiredReplicas !== null &&
|
||||||
deployment.readyReplicas >= deployment.updatedReplicas,
|
deployment.updatedReplicas >= deployment.desiredReplicas &&
|
||||||
`Deployment updated=${deployment.updatedReplicas} ready=${deployment.readyReplicas}`,
|
deployment.readyReplicas >= deployment.desiredReplicas,
|
||||||
|
`Deployment desired=${deployment.desiredReplicas} updated=${deployment.updatedReplicas} ready=${deployment.readyReplicas}`,
|
||||||
),
|
),
|
||||||
buildAssertion(
|
buildAssertion(
|
||||||
'pod-running-for-image',
|
'pod-running-for-image',
|
||||||
@ -1099,10 +1103,10 @@ Add this registration after `kt_remote_health_check`:
|
|||||||
deployment: z.string().default('kt-template-online-api'),
|
deployment: z.string().default('kt-template-online-api'),
|
||||||
execute: z.boolean().default(false),
|
execute: z.boolean().default(false),
|
||||||
expectedCommit: z.string().optional(),
|
expectedCommit: z.string().optional(),
|
||||||
healthUrl: z.string().default('http://127.0.0.1:30085/health/runtime'),
|
healthUrl: z.string().default('http://127.0.0.1:48085/health/runtime'),
|
||||||
imageTag: z.string().optional(),
|
imageTag: z.string().optional(),
|
||||||
jenkinsHome: z.string().default('/vol1/docker/jenkins_home'),
|
jenkinsHome: z.string().default('/vol1/docker/jenkins/jenkins_home'),
|
||||||
jobName: z.string().default('kt-template-online-api'),
|
jobName: z.string().default('KT-Template/KT-Template-API/main'),
|
||||||
kubeconfigPath: z
|
kubeconfigPath: z
|
||||||
.string()
|
.string()
|
||||||
.default('/vol1/docker/kt-k8s/kubeconfig/kt-nas.jenkins.yaml'),
|
.default('/vol1/docker/kt-k8s/kubeconfig/kt-nas.jenkins.yaml'),
|
||||||
@ -1242,7 +1246,7 @@ Add this row in the script table:
|
|||||||
Add this guidance near the remote health check note:
|
Add this guidance near the remote health check note:
|
||||||
|
|
||||||
```markdown
|
```markdown
|
||||||
- API 推送触发 Jenkins/K8s 后先运行 `pnpm run deploy-observation -- --project api --job kt-template-online-api --namespace kt-prod --deployment kt-template-online-api --container api --health-url http://127.0.0.1:30085/health/runtime --smoke "curl -fsS --max-time 8 http://127.0.0.1:30085/health/runtime"` 查看 dry-run 命令;确认需要线上只读观测时再加 `--execute`。Deployment/Pod 成功只算发布证据,功能完成还必须看 smoke 输出。
|
- API 推送触发 Jenkins/K8s 后先运行 `pnpm run deploy-observation -- --project api --job KT-Template/KT-Template-API/main --namespace kt-prod --deployment kt-template-online-api --container api --health-url http://127.0.0.1:48085/health/runtime --smoke "curl -fsS --max-time 8 http://127.0.0.1:48085/health/runtime"` 查看 dry-run 命令;确认需要线上只读观测时再加 `--execute`。Deployment/Pod 成功只算发布证据,功能完成还必须看 smoke 输出。
|
||||||
```
|
```
|
||||||
|
|
||||||
- [ ] **Step 6: Run self-test**
|
- [ ] **Step 6: Run self-test**
|
||||||
@ -1322,7 +1326,7 @@ Both commands pass.
|
|||||||
Run:
|
Run:
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
pnpm --dir D:\MyFiles\KT\mcp\ktWorkflow run deploy-observation -- --project api --job kt-template-online-api --namespace kt-prod --deployment kt-template-online-api --container api --health-url http://127.0.0.1:30085/health/runtime --smoke "curl -fsS --max-time 8 http://127.0.0.1:30085/health/runtime"
|
pnpm --dir D:\MyFiles\KT\mcp\ktWorkflow run deploy-observation -- --project api --job KT-Template/KT-Template-API/main --namespace kt-prod --deployment kt-template-online-api --container api --health-url http://127.0.0.1:48085/health/runtime --smoke "curl -fsS --max-time 8 http://127.0.0.1:48085/health/runtime"
|
||||||
```
|
```
|
||||||
|
|
||||||
Expected:
|
Expected:
|
||||||
@ -1338,7 +1342,7 @@ No artifact is written.
|
|||||||
Run only after confirming NAS SSH is expected to be reachable:
|
Run only after confirming NAS SSH is expected to be reachable:
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
pnpm --dir D:\MyFiles\KT\mcp\ktWorkflow run deploy-observation -- --execute --project api --job kt-template-online-api --namespace kt-prod --deployment kt-template-online-api --container api --health-url http://127.0.0.1:30085/health/runtime --smoke "curl -fsS --max-time 8 http://127.0.0.1:30085/health/runtime"
|
pnpm --dir D:\MyFiles\KT\mcp\ktWorkflow run deploy-observation -- --execute --project api --job KT-Template/KT-Template-API/main --namespace kt-prod --deployment kt-template-online-api --container api --health-url http://127.0.0.1:48085/health/runtime --smoke "curl -fsS --max-time 8 http://127.0.0.1:48085/health/runtime"
|
||||||
```
|
```
|
||||||
|
|
||||||
Expected:
|
Expected:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user