CI CD for Helm Using AWS CodePipeline¶
Let's update our git repository to implement CI/CD for helm.
Initialize the Chart¶
First, let's prepare helm template for our application:
This will create a folder called helm-chart in the repository.
Remove everything from templates/ folder and delete everything except Chart.yaml.
In the Chart.yaml change the name field to node-app or anything you prefer.
Add deployment.yaml and service.yml templates in the template/ directory.
Now, add values.yaml, values.dev.yaml, and values.prod.yaml.
Update Buildspec¶
Update the buidspec.yml to deploy using helm.
In the Build Project, add NAMESPACE and ENV environment variables.
At this point your git repository folder structure should look like the following:
|-- nodeapp
│ |-- helm-chart
| | |-- templates
| | | |-- deployment.yaml
| | | |-- service.yaml
│ |-- k8s-manifests
| | |-- 00-namespace.yml
| | |-- deployment.yml
| | |-- service.yml
│ |-- .dockerignore
│ |-- .gitignore
│ |-- Dockerfile
│ |-- buildspec-k8s-manifest.yml
│ |-- buildspec.yml
│ |-- package-lock.json
│ |-- package.json
│ |-- server.js
Note that we have renamed the previous buildspec.yml to buildspec-k8s-manifest.yml and the updated buildspec.yml to work with helm.
Push changes to github and verify the deployment.