mirror of
https://github.com/Azure/k8s-deploy.git
synced 2026-06-29 00:09:28 +08:00
Add timeout to the rollout status (#425)
* Added timeout to the rollout status and tests for it * Fixed integration test errors * Fix for blue green integration test * Probable fix for integration errors * No jobs run error fixed * Changed timeout to file level constant * Added parsing logic for timeout * Made tests more concise * implemented timeout validation check in an extracted utils mod * Changed function name to parseDuration * Removed timeout parameter from getResource --------- Co-authored-by: David Gamero <david340804@gmail.com> Co-authored-by: Suneha Bose <123775811+bosesuneha@users.noreply.github.com>
This commit is contained in:
@@ -25,7 +25,8 @@ import {getBufferTime} from '../../inputUtils'
|
||||
export async function routeBlueGreenForDeploy(
|
||||
kubectl: Kubectl,
|
||||
inputManifestFiles: string[],
|
||||
routeStrategy: RouteStrategy
|
||||
routeStrategy: RouteStrategy,
|
||||
timeout?: string
|
||||
): Promise<BlueGreenDeployment> {
|
||||
// sleep for buffer time
|
||||
const bufferTime: number = getBufferTime()
|
||||
@@ -47,19 +48,22 @@ export async function routeBlueGreenForDeploy(
|
||||
return await routeBlueGreenIngress(
|
||||
kubectl,
|
||||
manifestObjects.serviceNameMap,
|
||||
manifestObjects.ingressEntityList
|
||||
manifestObjects.ingressEntityList,
|
||||
timeout
|
||||
)
|
||||
} else if (routeStrategy == RouteStrategy.SMI) {
|
||||
return await routeBlueGreenSMI(
|
||||
kubectl,
|
||||
GREEN_LABEL_VALUE,
|
||||
manifestObjects.serviceEntityList
|
||||
manifestObjects.serviceEntityList,
|
||||
timeout
|
||||
)
|
||||
} else {
|
||||
return await routeBlueGreenService(
|
||||
kubectl,
|
||||
GREEN_LABEL_VALUE,
|
||||
manifestObjects.serviceEntityList
|
||||
manifestObjects.serviceEntityList,
|
||||
timeout
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -67,7 +71,8 @@ export async function routeBlueGreenForDeploy(
|
||||
export async function routeBlueGreenIngress(
|
||||
kubectl: Kubectl,
|
||||
serviceNameMap: Map<string, string>,
|
||||
ingressEntityList: any[]
|
||||
ingressEntityList: any[],
|
||||
timeout?: string
|
||||
): Promise<BlueGreenDeployment> {
|
||||
// const newObjectsList = []
|
||||
const newObjectsList: K8sObject[] = ingressEntityList.map((obj) => {
|
||||
@@ -84,7 +89,7 @@ export async function routeBlueGreenIngress(
|
||||
}
|
||||
})
|
||||
|
||||
const deployResult = await deployObjects(kubectl, newObjectsList)
|
||||
const deployResult = await deployObjects(kubectl, newObjectsList, timeout)
|
||||
|
||||
return {deployResult, objects: newObjectsList}
|
||||
}
|
||||
@@ -92,26 +97,28 @@ export async function routeBlueGreenIngress(
|
||||
export async function routeBlueGreenIngressUnchanged(
|
||||
kubectl: Kubectl,
|
||||
serviceNameMap: Map<string, string>,
|
||||
ingressEntityList: any[]
|
||||
ingressEntityList: any[],
|
||||
timeout?: string
|
||||
): Promise<BlueGreenDeployment> {
|
||||
const objects = ingressEntityList.filter((ingress) =>
|
||||
isIngressRouted(ingress, serviceNameMap)
|
||||
)
|
||||
|
||||
const deployResult = await deployObjects(kubectl, objects)
|
||||
const deployResult = await deployObjects(kubectl, objects, timeout)
|
||||
return {deployResult, objects}
|
||||
}
|
||||
|
||||
export async function routeBlueGreenService(
|
||||
kubectl: Kubectl,
|
||||
nextLabel: string,
|
||||
serviceEntityList: any[]
|
||||
serviceEntityList: any[],
|
||||
timeout?: string
|
||||
): Promise<BlueGreenDeployment> {
|
||||
const objects = serviceEntityList.map((serviceObject) =>
|
||||
getUpdatedBlueGreenService(serviceObject, nextLabel)
|
||||
)
|
||||
|
||||
const deployResult = await deployObjects(kubectl, objects)
|
||||
const deployResult = await deployObjects(kubectl, objects, timeout)
|
||||
|
||||
return {deployResult, objects}
|
||||
}
|
||||
@@ -119,7 +126,8 @@ export async function routeBlueGreenService(
|
||||
export async function routeBlueGreenSMI(
|
||||
kubectl: Kubectl,
|
||||
nextLabel: string,
|
||||
serviceEntityList: any[]
|
||||
serviceEntityList: any[],
|
||||
timeout?: string
|
||||
): Promise<BlueGreenDeployment> {
|
||||
// let tsObjects: TrafficSplitObject[] = []
|
||||
|
||||
@@ -128,14 +136,15 @@ export async function routeBlueGreenSMI(
|
||||
const tsObject: TrafficSplitObject = await createTrafficSplitObject(
|
||||
kubectl,
|
||||
serviceObject.metadata.name,
|
||||
nextLabel
|
||||
nextLabel,
|
||||
timeout
|
||||
)
|
||||
|
||||
return tsObject
|
||||
})
|
||||
)
|
||||
|
||||
const deployResult = await deployObjects(kubectl, tsObjects)
|
||||
const deployResult = await deployObjects(kubectl, tsObjects, timeout)
|
||||
|
||||
return {deployResult, objects: tsObjects}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user