mirror of
https://github.com/Azure/k8s-deploy.git
synced 2026-06-21 10:39:26 +08:00
Blue/Green Refactor (#229)
* fresh new branch * Added coverage to gitignore Signed-off-by: Jaiveer Katariya <jaiveerkatariya@Jaiveers-MBP.lan> * reverted package-lock.json Signed-off-by: Jaiveer Katariya <jaiveerkatariya@Jaiveers-MBP.lan> Co-authored-by: Jaiveer Katariya <jaiveerkatariya@Jaiveers-MBP.lan>
This commit is contained in:
+5
-18
@@ -6,7 +6,6 @@ import {
|
||||
getResources,
|
||||
updateManifestFiles
|
||||
} from '../utilities/manifestUpdateUtils'
|
||||
import {routeBlueGreen} from '../strategyHelpers/blueGreen/blueGreenHelper'
|
||||
import {
|
||||
annotateAndLabelResources,
|
||||
checkManifestStability,
|
||||
@@ -14,17 +13,15 @@ import {
|
||||
} from '../strategyHelpers/deploymentHelper'
|
||||
import {DeploymentStrategy} from '../types/deploymentStrategy'
|
||||
import {parseTrafficSplitMethod} from '../types/trafficSplitMethod'
|
||||
import {parseRouteStrategy} from '../types/routeStrategy'
|
||||
|
||||
export async function deploy(
|
||||
kubectl: Kubectl,
|
||||
manifestFilePaths: string[],
|
||||
deploymentStrategy: DeploymentStrategy,
|
||||
annotations: {[key: string]: string} = {}
|
||||
deploymentStrategy: DeploymentStrategy
|
||||
) {
|
||||
// update manifests
|
||||
const inputManifestFiles: string[] = updateManifestFiles(manifestFilePaths)
|
||||
core.debug('Input manifest files: ' + inputManifestFiles)
|
||||
core.debug(`Input manifest files: ${inputManifestFiles}`)
|
||||
|
||||
// deploy manifests
|
||||
core.startGroup('Deploying manifests')
|
||||
@@ -35,11 +32,10 @@ export async function deploy(
|
||||
inputManifestFiles,
|
||||
deploymentStrategy,
|
||||
kubectl,
|
||||
trafficSplitMethod,
|
||||
annotations
|
||||
trafficSplitMethod
|
||||
)
|
||||
core.debug(`Deployed manifest files: ${deployedManifestFiles}`)
|
||||
core.endGroup()
|
||||
core.debug('Deployed manifest files: ' + deployedManifestFiles)
|
||||
|
||||
// check manifest stability
|
||||
core.startGroup('Checking manifest stability')
|
||||
@@ -52,15 +48,6 @@ export async function deploy(
|
||||
await checkManifestStability(kubectl, resourceTypes)
|
||||
core.endGroup()
|
||||
|
||||
if (deploymentStrategy == DeploymentStrategy.BLUE_GREEN) {
|
||||
core.startGroup('Routing blue green')
|
||||
const routeStrategy = parseRouteStrategy(
|
||||
core.getInput('route-method', {required: true})
|
||||
)
|
||||
await routeBlueGreen(kubectl, inputManifestFiles, routeStrategy)
|
||||
core.endGroup()
|
||||
}
|
||||
|
||||
// print ingresses
|
||||
core.startGroup('Printing ingresses')
|
||||
const ingressResources: Resource[] = getResources(deployedManifestFiles, [
|
||||
@@ -80,7 +67,7 @@ export async function deploy(
|
||||
try {
|
||||
allPods = JSON.parse((await kubectl.getAllPods()).stdout)
|
||||
} catch (e) {
|
||||
core.debug('Unable to parse pods: ' + e)
|
||||
core.debug(`Unable to parse pods: ${e}`)
|
||||
}
|
||||
await annotateAndLabelResources(
|
||||
deployedManifestFiles,
|
||||
|
||||
Reference in New Issue
Block a user