Azure DevOps & CAEPE:   Streamlining Multicloud & Hybrid Kubernetes Application Deployments  (Part 2) 



In Part 1, we delved into the challenges associated with multicloud and hybrid Kubernetes deployments. These challenges encompass service issues, configuration complexities, networking challenges, data synchronization, and security concerns. Additionally, we explored the main features of Azure DevOps (ADO) for development, automation, and collaboration. We discussed how CAEPE enhances ADO by providing progressive delivery features, cross-platform support, and comprehensive testing capabilities. The integration of ADO and CAEPE facilitates a streamlined CI/CD process for multicloud and hybrid deployments. 
 
In this section, our focus shifts to the integration of CAEPE with ADO, emphasizing the setup of deployment environments in CAEPE and the testing of this integration.



Role of each tool 

 Azure Repos serves as the source control system, while Azure Pipelines functions as the build system. CAEPE takes charge of deploying and promoting releases between environments. The diagram below illustrates how these tools work together.



Azure DevOps Pre-requisites

Before proceeding, ensure that CAEPE and Azure DevOps are set up. CAEPE can be configured as a SaaS or deployed on your infrastructure. For guidance on setting up CAEPE, refer to this link. Additionally, acquire the sample Python code from Microsoft’s GitHub repository here



Part 1: CAEPE features for simplified deployment 

Confident Delivery 

Confident Delivery is a concept within CAEPE. It refers to pre and post-deployment testing that ensures your deployments are optimized when it comes to utilization and performance of your infrastructure. It provides diagnostics that enable you to evaluate variables such as uptime, backup and restore, infrastructure costs and elasticity. 

You specify which Confident Delivery features to enable when you set up a new deployment.

Pre-Flight Test

Before we discuss the integration, let’s look at how CAEPE simplifies managing deployments. 

Cluster Groups 

CAEPE allows the grouping of clusters, enabling a single deployment to multiple clusters with minimal effort, regardless of their locations

Deployment Strategies 

Within CAEPE, major deployment strategies can be employed and applied to a cluster group. 

Dry Run



Part 2: Setting up the integration between ADO & CAEPE 

Now, let’s examine the integration with ADO.  
 
A. Build

Utilize Azure Pipelines to build/test your application code and generate the required artifacts. In your repository, edit the azure-pipelines.yml and add the code below: 

name : Build, Test and Push 

trigger: 
- main 
pool: 
  vmImage: ubuntu-latest 

strategy: 
  matrix: 
    Python38: 
      python.version: '3.8' 
    Python39: 
      python.version: '3.9' 
    Python310: 
      python.version: '3.10' 

steps: 

- task: UsePythonVersion@0 
  displayName: Build and test code 
  inputs: 
    versionSpec: '$(python.version)' 
  displayName: 'Use Python $(python.version)' 

- script: | 
    python -m pip install --upgrade pip 
    pip install -r requirements.txt 
  displayName: 'Install dependencies' 

- script: | 
    pip install pytest pytest-azurepipelines 
    pytest 
  displayName: 'pytest' 

- task: Docker@2 
  displayName: Build and push image to container registry 
  inputs: 
    command: buildAndPush 
    repository: $(imageRepository) 
    dockerfile: $(dockerfilePath) 
    containerRegistry: $(dockerRegistryServiceConnection) 
    tags: | 
      $(tag) 

B. Release 

  1. Add the artifacts

  1. Create a deploy task with bash script and add the code below:

  1. Add the CAEPE trigger 
     
    Add the CAEPE trigger to your Azure Pipelines workflow to initiate deployments to Kubernetes clusters. ADO will trigger a CAEPE deployment to a selected environment after every build. Configure the action with necessary parameters like application name, version, and target environment. CAEPE provides various options, including CLI, API, or webhooks. I’ve given examples for all options below: 

CAEPE CLI

# Write your commands here 

set -x  

ls -lart ${AGENT_RELEASEDIRECTORY} 
ls -lart ${AGENT_RELEASEDIRECTORY}/_caepe-cli-linux-amd64 
chmod 755 ${AGENT_RELEASEDIRECTORY}/_caepe-cli-linux-amd64/caepe-cli-linux-amd64 

#-- Authenticate 

CAEPE_CLIENTID=$(CLIENTID) CAEPE_CLIENTSECRET=$(CLIENTSECRET) ${AGENT_RELEASEDIRECTORY}/_caepe-cli-linux-amd64/caepe-cli-linux-amd64 login --organization $(ORG) 

#-- Trigger Deployment 

${AGENT_RELEASEDIRECTORY}/_caepe-cli-linux-amd64/caepe-cli-linux-amd64 deployment rollout -d $(DEPNAME) --hostname $(HOST1) --organization $(ORG) --scheme https --debug 

CAEPE API

# Write your commands here 
set -x  

ls -lart ${AGENT_RELEASEDIRECTORY} 
ls -lart ${AGENT_RELEASEDIRECTORY}/_caepe-cli-linux-amd64 
chmod 755 ${AGENT_RELEASEDIRECTORY}/_caepe-cli-linux-amd64/caepe-cli-linux-amd64 

#-- Authenticate 
CAEPE_CLIENTID=$(CLIENTID) CAEPE_CLIENTSECRET=$(CLIENTSECRET) ${AGENT_RELEASEDIRECTORY}/_caepe-cli-linux-amd64/caepe-cli-linux-amd64 login --organization $(ORG) 

#-- Trigger Deployment 
curl -X POST https://www/v2/Deployments -H accept: application/json -H organization: myorg -H Content-Type: application/json -d {"name":"string","description":"string","namespace":"string","cluster":{"clusterName":"string","clusterId":"string"},"application":"string","deploymentType":"standard","postDeployActivities":[{"postDeployActivities":"smoketest"}],"release":{"branch":"string","message":"string"},"accessGroups":[{"name":"string","id":"string"}],"strategy":{"name":"string"},"arguments":[{"key":"string","value":"string","clusterOrGroup":"string"}]}

CAEPE WEBHOOK

# Write your commands here 
set -x  

ls -lart ${AGENT_RELEASEDIRECTORY} 
ls -lart ${AGENT_RELEASEDIRECTORY}/_caepe-cli-linux-amd64 
chmod 755 ${AGENT_RELEASEDIRECTORY}/_caepe-cli-linux-amd64/caepe-cli-linux-amd64 
 
#-- Authenticate 
CAEPE_CLIENTID=$(CLIENTID) CAEPE_CLIENTSECRET=$(CLIENTSECRET) ${AGENT_RELEASEDIRECTORY}/_caepe-cli-linux-amd64/caepe-cli-linux-amd64 login --organization $(ORG) 

#-- Trigger Deployment 
curl -H "Content-Type:application/json" -X POST --data "{\"foo\": \"bar\"}" https://hook.caepe.sh/serviceid/trigger/jobid 

C. Test

To ensure everything is in order, commit and push changes to trigger the Azure Pipelines workflow. Monitor the workflow execution in ADO and verify the successful deployment to different environments.



Conclusion: Streamline Your CI/CD Pipeline with CAEPE and ADO

By following the step-by-step guide provided in this article, seamlessly integrate CAEPE with ADO and leverage their combined capabilities for efficient Kubernetes deployments. This integration significantly streamlines your DevOps workflow and Kubernetes deployments. As a CD tool, CAEPE automates the deployment process, facilitating quicker and more dependable software releases

Check out these other resources:

Scroll to Top