Deployment Strategy (#4) (#6)

This commit is contained in:
Deepak Sattiraju
2019-11-18 21:07:19 +05:30
committed by GitHub
parent 8d56cba217
commit be01c3f321
38 changed files with 4360 additions and 255 deletions
+26
View File
@@ -0,0 +1,26 @@
'use strict';
import * as core from '@actions/core';
import * as canaryDeploymentHelper from '../utilities/strategy-helpers/canary-deployment-helper';
import * as SMICanaryDeploymentHelper from '../utilities/strategy-helpers/smi-canary-deployment-helper';
import { Kubectl } from '../kubectl-object-model';
import * as utils from '../utilities/manifest-utilities';
import * as TaskInputParameters from '../input-parameters';
export async function reject(ignoreSslErrors?: boolean) {
const kubectl = new Kubectl(await utils.getKubectl(), TaskInputParameters.namespace, ignoreSslErrors);
if (!canaryDeploymentHelper.isCanaryDeploymentStrategy()) {
core.debug('Strategy is not canary deployment. Invalid request.');
throw ('InvalidRejectActionDeploymentStrategy');
}
let includeServices = false;
if (canaryDeploymentHelper.isSMICanaryStrategy()) {
core.debug('Reject deployment with SMI canary strategy');
includeServices = true;
SMICanaryDeploymentHelper.redirectTrafficToStableDeployment(kubectl, TaskInputParameters.manifests);
}
core.debug('Deployment strategy selected is Canary. Deleting baseline and canary workloads.');
canaryDeploymentHelper.deleteCanaryDeployment(kubectl, TaskInputParameters.manifests, includeServices);
}