This project aims to provide a streamlined solution for creating and deploying a basic Kubernetes cluster using CloudFormation. By utilizing a linting process, this program aims to catch errors and issues in CloudFormation templates before they lead to costly problems during deployment.
Problem statement
The primary problem addressed by this program is the tendency for CloudFormation templates to throw various errors that may not be caught by traditional linters. This can lead to issues arising during deployment, even after a significant amount of resources have been deployed. The linter checks that resources are deployed in the correct order, verifies syntax and ensures that no errors occur during deployment.
Link to Github repo containing program
File Structure
The file structure of this program includes the following:
The amazon-eks-controlpane-template.yaml file, which serves as the CloudFormation EKS Cluster Template. This program is designed to work with any type of CloudFormation template, however.
The .pre-commit-config.yaml file, is used for running unit tests on the template before uploading the stack to AWS or including it in a CI/CD pipeline.
The requirements.txt file, which lists the necessary dependencies for running the program. It is recommended that Python 3.9 is installed on the device where the program is run.
How to run the program
To run the program, the user should first ensure that Python 3.9 is installed. The amazon-eks-controlpane-template.yaml file should be replaced with the desired CloudFormation template, and the file name should also be updated in the .pre-commit-config.yaml file. Then, from the project folder in the terminal, the command <pre-commit run --all-files> can be run to initiate the linting process.
The tests run on the templates include Trim Trailing White Space, End for File Space, CFN-Lint, and CFN-Nag.
Future Improvements
For future improvements, this program could be extended to include the use of Cloud Radar for performing Python unit tests that simulate the launch of resources and verify their accuracy. Additionally, a more robust error-handling system could be implemented to provide more detailed information about any issues that are caught during the linting process.