Skip to content
This repository has been archived by the owner on May 29, 2018. It is now read-only.

Latest commit

 

History

History
36 lines (22 loc) · 1.96 KB

README.md

File metadata and controls

36 lines (22 loc) · 1.96 KB

cloud-platforms-test-env creation

Intro

This repo has been created to initiate an environment (namespace) creation in the MoJ Kubernetes cluster 'cloud-platforms-test.k8s.integration.dsd.io'. It also contains files required to create a pipeline in AWS utilising CodePipeline and CodeBuild.

The aws resources and pipeline can be created with the terraform templates included. Kubernetes namespaces and resources are defined in the namespaces directory in this repo.

Buildspec

The buildspec.yml file contains the codebuild build specification that will create the resources defined in the namespaces/ directory. These will be the commands executed by the pipeline every time it runs.

Namespaces

The namespaces/ directory contains sub directorys named after each of the desired namespaces you want to create. Placed inside are the kubernetes resource files you want to create in the kubernetes format. Those will be created automatically after a push is made to the repos master branch by the aws codepipeline.

Terraform

The terraform/ directory contains Terraform resources to create the AWS pipeline for kubernetes namespace and resource creation. To create the pipeline, or make changes:

$ cd terraform
$ terraform init
$ terraform apply

The configuration changes, like repo, branch or project name can be done from the terraform/variables.tf file

Kube config kubecfg.yaml file

You must place the cluster's kubecfg.yaml file in the s3 bucket keystore s3://non-production-cluster-keystore/kubecfg.yaml. That is the way the codepipeline connects to the cluster to perform operations.

Build alarms: Success/failure slackbot

The build-alarms/ directory contains all you need to setup a slackbot to notify users on the success/failure of their namespace creation.

This creates a Cloudwatch rule to monitor everything Codebuild writes to Cloudwatch. When this rule is matched a Lambda is triggered, sending an alert to a specified slack channel.