fix(deploy) : roll out web replicas without surge capacity
This commit is contained in:
@@ -170,6 +170,10 @@ jobs:
|
|||||||
kubectl --kubeconfig "$KUBECONFIG" --namespace "$DEPLOY_NAMESPACE" patch configmap buzz-sheet-config \
|
kubectl --kubeconfig "$KUBECONFIG" --namespace "$DEPLOY_NAMESPACE" patch configmap buzz-sheet-config \
|
||||||
--type=merge \
|
--type=merge \
|
||||||
--patch "{\"data\":{\"NEXT_DEPLOYMENT_ID\":\"$REVISION\",\"BASE_URL\":\"$BASE_URL\"}}"
|
--patch "{\"data\":{\"NEXT_DEPLOYMENT_ID\":\"$REVISION\",\"BASE_URL\":\"$BASE_URL\"}}"
|
||||||
|
# Replace one web replica at a time without reserving CPU for a surge pod.
|
||||||
|
kubectl --kubeconfig "$KUBECONFIG" --namespace "$DEPLOY_NAMESPACE" patch deployment buzz-sheet \
|
||||||
|
--type=merge \
|
||||||
|
--patch '{"spec":{"strategy":{"type":"RollingUpdate","rollingUpdate":{"maxSurge":0,"maxUnavailable":1}}}}'
|
||||||
kubectl --kubeconfig "$KUBECONFIG" --namespace "$DEPLOY_NAMESPACE" set image \
|
kubectl --kubeconfig "$KUBECONFIG" --namespace "$DEPLOY_NAMESPACE" set image \
|
||||||
deployment/buzz-sheet \
|
deployment/buzz-sheet \
|
||||||
app="$REGISTRY_IMAGE:$REVISION"
|
app="$REGISTRY_IMAGE:$REVISION"
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ spec:
|
|||||||
strategy:
|
strategy:
|
||||||
type: RollingUpdate
|
type: RollingUpdate
|
||||||
rollingUpdate:
|
rollingUpdate:
|
||||||
maxSurge: 1
|
maxSurge: 0
|
||||||
maxUnavailable: 0
|
maxUnavailable: 1
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app.kubernetes.io/name: buzz-sheet
|
app.kubernetes.io/name: buzz-sheet
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ describe("production deployment contract", () => {
|
|||||||
const deployment = await repositoryFile("k8s/base/deployment.yaml");
|
const deployment = await repositoryFile("k8s/base/deployment.yaml");
|
||||||
|
|
||||||
expect(deployment).toContain("replicas: 2");
|
expect(deployment).toContain("replicas: 2");
|
||||||
expect(deployment).toContain("maxSurge: 1");
|
expect(deployment).toContain("maxSurge: 0");
|
||||||
expect(deployment).toContain("maxUnavailable: 0");
|
expect(deployment).toContain("maxUnavailable: 1");
|
||||||
expect(deployment.match(/path: \/api\/healthz\n/gu)).toHaveLength(3);
|
expect(deployment.match(/path: \/api\/healthz\n/gu)).toHaveLength(3);
|
||||||
expect(deployment).toContain("kubernetes.io/arch: arm64");
|
expect(deployment).toContain("kubernetes.io/arch: arm64");
|
||||||
expect(deployment).toMatch(
|
expect(deployment).toMatch(
|
||||||
@@ -144,6 +144,10 @@ describe("production deployment contract", () => {
|
|||||||
);
|
);
|
||||||
expect(workflow).toContain("migrate-$REVISION");
|
expect(workflow).toContain("migrate-$REVISION");
|
||||||
expect(workflow).toContain("deployment/buzz-sheet-discord-worker");
|
expect(workflow).toContain("deployment/buzz-sheet-discord-worker");
|
||||||
|
expect(workflow).toContain('"maxSurge":0,"maxUnavailable":1');
|
||||||
|
const patchRolloutStrategy = workflow.indexOf("patch deployment buzz-sheet");
|
||||||
|
expect(patchRolloutStrategy).toBeGreaterThan(-1);
|
||||||
|
expect(patchRolloutStrategy).toBeLessThan(workflow.indexOf("set image"));
|
||||||
const deleteMigrationJob = workflow.indexOf(
|
const deleteMigrationJob = workflow.indexOf(
|
||||||
'delete job buzz-sheet-migrate --ignore-not-found',
|
'delete job buzz-sheet-migrate --ignore-not-found',
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user