Added Traffic split annotations (#215)

* Added Traffic split annotations

* traffic split - blueGreen deployment

* traffic split - canary deployment

* Traffic split annotations - canary deployment

* updated Readme and action.yml

* Traffic split - canary deployment

* clean code

* Clean code

* Clean code

* Create annotation object

* Updated Readme and action.yml

* Spelling correction

Co-authored-by: Vidya Reddy <vidyareddy@microsoft.com>
This commit is contained in:
Vidya Reddy
2022-07-25 10:43:13 -07:00
committed by GitHub
parent 19d66d6bdb
commit 71e93a71d4
11 changed files with 78 additions and 30 deletions
+9 -4
View File
@@ -15,14 +15,15 @@ import {parseRouteStrategy, RouteStrategy} from '../types/routeStrategy'
export async function reject(
kubectl: Kubectl,
manifests: string[],
deploymentStrategy: DeploymentStrategy
deploymentStrategy: DeploymentStrategy,
annotations: {[key: string]: string} = {}
) {
switch (deploymentStrategy) {
case DeploymentStrategy.CANARY:
await rejectCanary(kubectl, manifests)
break
case DeploymentStrategy.BLUE_GREEN:
await rejectBlueGreen(kubectl, manifests)
await rejectBlueGreen(kubectl, manifests, annotations)
break
default:
throw 'Invalid delete deployment strategy'
@@ -54,7 +55,11 @@ async function rejectCanary(kubectl: Kubectl, manifests: string[]) {
core.endGroup()
}
async function rejectBlueGreen(kubectl: Kubectl, manifests: string[]) {
async function rejectBlueGreen(
kubectl: Kubectl,
manifests: string[],
annotations: {[key: string]: string} = {}
) {
core.startGroup('Rejecting deployment with blue green strategy')
const routeStrategy = parseRouteStrategy(
@@ -63,7 +68,7 @@ async function rejectBlueGreen(kubectl: Kubectl, manifests: string[]) {
if (routeStrategy == RouteStrategy.INGRESS) {
await rejectBlueGreenIngress(kubectl, manifests)
} else if (routeStrategy == RouteStrategy.SMI) {
await rejectBlueGreenSMI(kubectl, manifests)
await rejectBlueGreenSMI(kubectl, manifests, annotations)
} else {
await rejectBlueGreenService(kubectl, manifests)
}