-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added SMI canary deployment strategy to KubernetesManifest task (#11218)
- Loading branch information
Showing
15 changed files
with
563 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,26 @@ | ||
'use strict'; | ||
import * as tl from 'azure-pipelines-task-lib/task'; | ||
import * as canaryDeploymentHelper from '../utils/CanaryDeploymentHelper'; | ||
import * as SMICanaryDeploymentHelper from '../utils/SMICanaryDeploymentHelper'; | ||
import { Kubectl } from 'kubernetes-common-v2/kubectl-object-model'; | ||
import * as utils from '../utils/utilities'; | ||
import * as TaskInputParameters from '../models/TaskInputParameters'; | ||
|
||
export async function reject(ignoreSslErrors?: boolean) { | ||
const kubectl = new Kubectl(await utils.getKubectl(), TaskInputParameters.namespace, ignoreSslErrors); | ||
|
||
if (canaryDeploymentHelper.isCanaryDeploymentStrategy()) { | ||
tl.debug('Deployment strategy selected is Canary. Deleting baseline and canary workloads.'); | ||
canaryDeploymentHelper.deleteCanaryDeployment(kubectl, TaskInputParameters.manifests); | ||
} else { | ||
if (!canaryDeploymentHelper.isCanaryDeploymentStrategy()) { | ||
tl.debug('Strategy is not canary deployment. Invalid request.'); | ||
throw (tl.loc('InvalidRejectActionDeploymentStrategy')); | ||
} | ||
|
||
let includeServices = false; | ||
if (canaryDeploymentHelper.isSMICanaryStrategy()) { | ||
tl.debug('Reject deployment with SMI canary strategy'); | ||
includeServices = true; | ||
SMICanaryDeploymentHelper.redirectTrafficToStableDeployment(kubectl, TaskInputParameters.manifests); | ||
} | ||
|
||
tl.debug('Deployment strategy selected is Canary. Deleting baseline and canary workloads.'); | ||
canaryDeploymentHelper.deleteCanaryDeployment(kubectl, TaskInputParameters.manifests, includeServices); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.