mirror of
https://github.com/Azure/k8s-deploy.git
synced 2026-04-02 18:36:30 +08:00
* Make annotating resources optional * Clarify descriptions * Update README * Refactor retrieving pods * Remove annotating resources check in deploy.ts * Add resource annotation integration test * Move resource annotation integration test to seperate file * Lint code * Remove temporary debugging statements * Fix integration test name * Fix test * Abstracting out repeated logic between verifyDeployment and verifyService * Fix formattin * Fix reference * Fix test * Refactor test * Update ubuntu version to latest on canary SMI test * Update ubuntu version to latest on canary SMI test * Make annotating resources optional Signed-off-by: Bram de Hart <bram.dehart@nsgo.nl> * Clarify descriptions Signed-off-by: Bram de Hart <bram.dehart@nsgo.nl> * Update README Signed-off-by: Bram de Hart <bram.dehart@nsgo.nl> * Refactor retrieving pods Signed-off-by: Bram de Hart <bram.dehart@nsgo.nl> * Remove annotating resources check in deploy.ts Signed-off-by: Bram de Hart <bram.dehart@nsgo.nl> * Add resource annotation integration test Signed-off-by: Bram de Hart <bram.dehart@nsgo.nl> * Move resource annotation integration test to seperate file Signed-off-by: Bram de Hart <bram.dehart@nsgo.nl> * Lint code Signed-off-by: Bram de Hart <bram.dehart@nsgo.nl> * Remove temporary debugging statements Signed-off-by: Bram de Hart <bram.dehart@nsgo.nl> * Fix integration test name Signed-off-by: Bram de Hart <bram.dehart@nsgo.nl> * Fix test Signed-off-by: Bram de Hart <bram.dehart@nsgo.nl> * Abstracting out repeated logic between verifyDeployment and verifyService Signed-off-by: Bram de Hart <bram.dehart@nsgo.nl> * Fix formattin Signed-off-by: Bram de Hart <bram.dehart@nsgo.nl> * Fix reference Signed-off-by: Bram de Hart <bram.dehart@nsgo.nl> * Fix test Signed-off-by: Bram de Hart <bram.dehart@nsgo.nl> * Refactor test Signed-off-by: Bram de Hart <bram.dehart@nsgo.nl> * Update ubuntu version to latest on canary SMI test Signed-off-by: Bram de Hart <bram.dehart@nsgo.nl> --------- Signed-off-by: Bram de Hart <bram.dehart@nsgo.nl>
75 lines
2.3 KiB
TypeScript
75 lines
2.3 KiB
TypeScript
import * as core from '@actions/core'
|
|
import * as models from '../types/kubernetesTypes'
|
|
import * as KubernetesConstants from '../types/kubernetesTypes'
|
|
import {Kubectl, Resource} from '../types/kubectl'
|
|
import {
|
|
getResources,
|
|
updateManifestFiles
|
|
} from '../utilities/manifestUpdateUtils'
|
|
import {
|
|
annotateAndLabelResources,
|
|
checkManifestStability,
|
|
deployManifests
|
|
} from '../strategyHelpers/deploymentHelper'
|
|
import {DeploymentStrategy} from '../types/deploymentStrategy'
|
|
import {parseTrafficSplitMethod} from '../types/trafficSplitMethod'
|
|
|
|
export async function deploy(
|
|
kubectl: Kubectl,
|
|
manifestFilePaths: string[],
|
|
deploymentStrategy: DeploymentStrategy
|
|
) {
|
|
// update manifests
|
|
const inputManifestFiles: string[] = updateManifestFiles(manifestFilePaths)
|
|
core.debug(`Input manifest files: ${inputManifestFiles}`)
|
|
|
|
// deploy manifests
|
|
core.startGroup('Deploying manifests')
|
|
const trafficSplitMethod = parseTrafficSplitMethod(
|
|
core.getInput('traffic-split-method', {required: true})
|
|
)
|
|
const deployedManifestFiles = await deployManifests(
|
|
inputManifestFiles,
|
|
deploymentStrategy,
|
|
kubectl,
|
|
trafficSplitMethod
|
|
)
|
|
core.debug(`Deployed manifest files: ${deployedManifestFiles}`)
|
|
core.endGroup()
|
|
|
|
// check manifest stability
|
|
core.startGroup('Checking manifest stability')
|
|
const resourceTypes: Resource[] = getResources(
|
|
deployedManifestFiles,
|
|
models.DEPLOYMENT_TYPES.concat([
|
|
KubernetesConstants.DiscoveryAndLoadBalancerResource.SERVICE
|
|
])
|
|
)
|
|
await checkManifestStability(kubectl, resourceTypes)
|
|
core.endGroup()
|
|
|
|
// print ingresses
|
|
core.startGroup('Printing ingresses')
|
|
const ingressResources: Resource[] = getResources(deployedManifestFiles, [
|
|
KubernetesConstants.DiscoveryAndLoadBalancerResource.INGRESS
|
|
])
|
|
for (const ingressResource of ingressResources) {
|
|
await kubectl.getResource(
|
|
KubernetesConstants.DiscoveryAndLoadBalancerResource.INGRESS,
|
|
ingressResource.name,
|
|
false,
|
|
ingressResource.namespace
|
|
)
|
|
}
|
|
core.endGroup()
|
|
|
|
// annotate resources
|
|
core.startGroup('Annotating resources')
|
|
await annotateAndLabelResources(
|
|
deployedManifestFiles,
|
|
kubectl,
|
|
resourceTypes
|
|
)
|
|
core.endGroup()
|
|
}
|