This is a custom Kubernetes controller designed to run in the Scipian namespace. It watches for changes on incoming Custom Resources and launches Jobs to create/update/destroy infrastructure using Terraform.
It is built with Kubebuilder 2.0, with full documentation found here.
The Scipian Terraform Controller expects a few things to be set up in the cluster it will run in:
scipian
namespacescipian-aws-iam-creds
with AWS IAM secret accesss key and
access key ID as aws_access_key_id
and aws_secret_access_key
respectively.
These creds are for Scipian's S3 bucket where it will access Terraform State,
and should be for that AWS account. NOTE: These should be base64 encrypted.
In order to avoid new line characters in the base64 encrypted string, use the
following flags when encrypting: echo -n <aws_cred> | base64 -w 0
.config/manager/manager.yaml
in the ConfigMap section. NOTE: The DynamoDB
table should have the same name as the S3 bucket, but with -locking
appended
to it.make install
- installs Custom Resource Definitions (CRDs) into the clusterTo run the project locally for developing:
.envrc
file with SCIPIAN_STATE_BUCKET
and SCIPIAN_STATE_LOCKING
pointing to your desired s3 bucket and
DynamoDB table respectively.go get
make install
make run
(this will run against the cluster defined in $HOME/.kube/config
)To deploy the controller in a cluster:
make docker-build
make docker-push
make deploy
This project uses Ginkgo as a BDD testing framework. Make sure to have Ginkgo installed locally.