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
+10 -4
View File
@@ -40,14 +40,15 @@ import {parseRouteStrategy, RouteStrategy} from '../types/routeStrategy'
export async function promote(
kubectl: Kubectl,
manifests: string[],
deploymentStrategy: DeploymentStrategy
deploymentStrategy: DeploymentStrategy,
annotations: {[key: string]: string} = {}
) {
switch (deploymentStrategy) {
case DeploymentStrategy.CANARY:
await promoteCanary(kubectl, manifests)
break
case DeploymentStrategy.BLUE_GREEN:
await promoteBlueGreen(kubectl, manifests)
await promoteBlueGreen(kubectl, manifests, annotations)
break
default:
throw Error('Invalid promote deployment strategy')
@@ -104,7 +105,11 @@ async function promoteCanary(kubectl: Kubectl, manifests: string[]) {
core.endGroup()
}
async function promoteBlueGreen(kubectl: Kubectl, manifests: string[]) {
async function promoteBlueGreen(
kubectl: Kubectl,
manifests: string[],
annotations: {[key: string]: string} = {}
) {
// update container images and pull secrets
const inputManifestFiles: string[] = updateManifestFiles(manifests)
const manifestObjects: BlueGreenManifests =
@@ -157,7 +162,8 @@ async function promoteBlueGreen(kubectl: Kubectl, manifests: string[]) {
await routeBlueGreenSMI(
kubectl,
NONE_LABEL_VALUE,
manifestObjects.serviceEntityList
manifestObjects.serviceEntityList,
annotations
)
await deleteWorkloadsWithLabel(
kubectl,