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:
benjamin
2025-07-09 13:22:21 -04:00
committed by GitHub
parent e207ec429b
commit ac0b58c9a5
28 changed files with 1677 additions and 209 deletions
@@ -28,7 +28,8 @@ export const MAX_VAL = 100
export async function setupSMI(
kubectl: Kubectl,
serviceEntityList: any[]
serviceEntityList: any[],
timeout?: string
): Promise<BlueGreenDeployment> {
const newObjectsList = []
const trafficObjectList = []
@@ -49,7 +50,8 @@ export async function setupSMI(
const tsObject = await createTrafficSplitObject(
kubectl,
svc.metadata.name,
NONE_LABEL_VALUE
NONE_LABEL_VALUE,
timeout
)
tsObjects.push(tsObject as TrafficSplitObject)
}
@@ -59,7 +61,8 @@ export async function setupSMI(
// create services
const smiDeploymentResult: DeployResult = await deployObjects(
kubectl,
objectsToDeploy
objectsToDeploy,
timeout
)
return {
@@ -73,7 +76,8 @@ let trafficSplitAPIVersion = ''
export async function createTrafficSplitObject(
kubectl: Kubectl,
name: string,
nextLabel: string
nextLabel: string,
timeout?: string
): Promise<TrafficSplitObject> {
// cache traffic split api version
if (!trafficSplitAPIVersion)
@@ -112,6 +116,13 @@ export async function createTrafficSplitObject(
}
}
const deleteList: K8sDeleteObject[] = [
{
name: trafficSplitObject.metadata.name,
kind: trafficSplitObject.kind
}
]
await deleteObjects(kubectl, deleteList, timeout)
return trafficSplitObject
}
@@ -173,7 +184,8 @@ export async function validateTrafficSplitsState(
export async function cleanupSMI(
kubectl: Kubectl,
serviceEntityList: any[]
serviceEntityList: any[],
timeout?: string
): Promise<K8sDeleteObject[]> {
const deleteList: K8sDeleteObject[] = []
@@ -189,7 +201,7 @@ export async function cleanupSMI(
})
// delete all objects
await deleteObjects(kubectl, deleteList)
await deleteObjects(kubectl, deleteList, timeout)
return deleteList
}