From ed8b28fc7ec48085df8c3a888edaf52ed3246917 Mon Sep 17 00:00:00 2001 From: brandoconnor Date: Thu, 7 Jun 2018 03:05:31 -0700 Subject: [PATCH 1/2] fixing up CI and git hooks --- .pre-commit-config.yaml | 2 - .travis.yml | 2 +- local.tf | 260 ++++++++++++++++++++-------------------- version | 2 +- 4 files changed, 132 insertions(+), 134 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 16cbedc..1064dd4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,13 +3,11 @@ repos: - repo: git://github.com/antonbabenko/pre-commit-terraform rev: v1.7.1 - sha: 091f8b15d7b458e5a0aca642483deb2205e7db02 hooks: - id: terraform_fmt # - id: terraform_docs - repo: git://github.com/pre-commit/pre-commit-hooks rev: v1.2.3 - sha: 92e1570c282e3c69a1f8b5b8dd8d286fe27cfaa7 hooks: - id: check-merge-conflict - id: trailing-whitespace diff --git a/.travis.yml b/.travis.yml index e6636c6..f863099 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,7 +26,7 @@ script: - echo 'script' - terraform init - terraform fmt -check=true -- terraform validate -var "region=${AWS_REGION}" -var "vpc_id=vpc-123456" -var "subnets=['subnet-12345a']" -var "workers_ami_id=ami-123456" -var "cluster_ingress_cidrs=[]" -var "cluster_name=test_cluster" +- terraform validate -var "region=${AWS_REGION}" -var "vpc_id=vpc-123456" -var "subnets=[\"subnet-12345a\"]" -var "workers_ami_id=ami-123456" -var "cluster_ingress_cidrs=[]" -var "cluster_name=test_cluster" - docker run --rm -v $(pwd):/app/ --workdir=/app/ -t wata727/tflint --error-with-issues - cd examples/eks_test_fixture - terraform init diff --git a/local.tf b/local.tf index 6ccde7e..efe605c 100644 --- a/local.tf +++ b/local.tf @@ -1,130 +1,130 @@ -locals { - # Mapping from the node type that we selected and the max number of pods that it can run - # Taken from https://amazon-eks.s3-us-west-2.amazonaws.com/1.10.3/2018-06-05/amazon-eks-nodegroup.yaml - max_pod_per_node = { - c4.large = 29 - c4.xlarge = 58 - c4.2xlarge = 58 - c4.4xlarge = 234 - c4.8xlarge = 234 - c5.large = 29 - c5.xlarge = 58 - c5.2xlarge = 58 - c5.4xlarge = 234 - c5.9xlarge = 234 - c5.18xlarge = 737 - i3.large = 29 - i3.xlarge = 58 - i3.2xlarge = 58 - i3.4xlarge = 234 - i3.8xlarge = 234 - i3.16xlarge = 737 - m3.medium = 12 - m3.large = 29 - m3.xlarge = 58 - m3.2xlarge = 118 - m4.large = 20 - m4.xlarge = 58 - m4.2xlarge = 58 - m4.4xlarge = 234 - m4.10xlarge = 234 - m5.large = 29 - m5.xlarge = 58 - m5.2xlarge = 58 - m5.4xlarge = 234 - m5.12xlarge = 234 - m5.24xlarge = 737 - p2.xlarge = 58 - p2.8xlarge = 234 - p2.16xlarge = 234 - p3.2xlarge = 58 - p3.8xlarge = 234 - p3.16xlarge = 234 - r3.xlarge = 58 - r3.2xlarge = 58 - r3.4xlarge = 234 - r3.8xlarge = 234 - r4.large = 29 - r4.xlarge = 58 - r4.2xlarge = 58 - r4.4xlarge = 234 - r4.8xlarge = 234 - r4.16xlarge = 737 - t2.small = 8 - t2.medium = 17 - t2.large = 35 - t2.xlarge = 44 - t2.2xlarge = 44 - x1.16xlarge = 234 - x1.32xlarge = 234 - } - - asg_tags = ["${null_resource.tags_as_list_of_maps.*.triggers}"] - - # More information: https://amazon-eks.s3-us-west-2.amazonaws.com/1.10.3/2018-06-05/amazon-eks-nodegroup.yaml - workers_userdata = < $CA_CERTIFICATE_FILE_PATH -INTERNAL_IP=$(curl -s http://169.254.169.254/latest/meta-data/local-ipv4) -sed -i s,MASTER_ENDPOINT,${aws_eks_cluster.this.endpoint},g /var/lib/kubelet/kubeconfig -sed -i s,CLUSTER_NAME,${var.cluster_name},g /var/lib/kubelet/kubeconfig -sed -i s,REGION,${data.aws_region.current.name},g /etc/systemd/system/kubelet.service -sed -i s,MAX_PODS,${lookup(local.max_pod_per_node, var.workers_instance_type)},g /etc/systemd/system/kubelet.service -sed -i s,MASTER_ENDPOINT,${aws_eks_cluster.this.endpoint},g /etc/systemd/system/kubelet.service -sed -i s,INTERNAL_IP,$INTERNAL_IP,g /etc/systemd/system/kubelet.service -DNS_CLUSTER_IP=10.100.0.10 -if [[ $INTERNAL_IP == 10.* ]] ; then DNS_CLUSTER_IP=172.20.0.10; fi -sed -i s,DNS_CLUSTER_IP,$DNS_CLUSTER_IP,g /etc/systemd/system/kubelet.service -sed -i s,CERTIFICATE_AUTHORITY_FILE,$CA_CERTIFICATE_FILE_PATH,g /var/lib/kubelet/kubeconfig -sed -i s,CLIENT_CA_FILE,$CA_CERTIFICATE_FILE_PATH,g /etc/systemd/system/kubelet.service -systemctl daemon-reload -systemctl restart kubelet kube-proxy -USERDATA - - config_map_aws_auth = < $CA_CERTIFICATE_FILE_PATH +INTERNAL_IP=$(curl -s http://169.254.169.254/latest/meta-data/local-ipv4) +sed -i s,MASTER_ENDPOINT,${aws_eks_cluster.this.endpoint},g /var/lib/kubelet/kubeconfig +sed -i s,CLUSTER_NAME,${var.cluster_name},g /var/lib/kubelet/kubeconfig +sed -i s,REGION,${data.aws_region.current.name},g /etc/systemd/system/kubelet.service +sed -i s,MAX_PODS,${lookup(local.max_pod_per_node, var.workers_instance_type)},g /etc/systemd/system/kubelet.service +sed -i s,MASTER_ENDPOINT,${aws_eks_cluster.this.endpoint},g /etc/systemd/system/kubelet.service +sed -i s,INTERNAL_IP,$INTERNAL_IP,g /etc/systemd/system/kubelet.service +DNS_CLUSTER_IP=10.100.0.10 +if [[ $INTERNAL_IP == 10.* ]] ; then DNS_CLUSTER_IP=172.20.0.10; fi +sed -i s,DNS_CLUSTER_IP,$DNS_CLUSTER_IP,g /etc/systemd/system/kubelet.service +sed -i s,CERTIFICATE_AUTHORITY_FILE,$CA_CERTIFICATE_FILE_PATH,g /var/lib/kubelet/kubeconfig +sed -i s,CLIENT_CA_FILE,$CA_CERTIFICATE_FILE_PATH,g /etc/systemd/system/kubelet.service +systemctl daemon-reload +systemctl restart kubelet kube-proxy +USERDATA + + config_map_aws_auth = < Date: Thu, 7 Jun 2018 03:09:11 -0700 Subject: [PATCH 2/2] PR template now referencing this module --- .github/PULL_REQUEST_TEMPLATE.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 30dbfd8..427fd7d 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -6,8 +6,8 @@ Please explain the changes you made here and link to any relevant issues. ### Checklist -* [ ] `terraform fmt` and `terraform validate` both work from the root and `examples/alb_test_fixture` directories (look in CI for an example) -* [ ] Tests for the changes have been added and passing (for bug fixes/features) -* [ ] Test results are pasted in this PR (in lieu of CI) -* [ ] Docs have been added/updated (for bug fixes/features) -* [ ] Any breaking changes are noted in the description above +- [ ] `terraform fmt` and `terraform validate` both work from the root and `examples/eks_test_fixture` directories (look in CI for an example) +- [ ] Tests for the changes have been added and passing (for bug fixes/features) +- [ ] Test results are pasted in this PR (in lieu of CI) +- [ ] Docs have been added/updated (for bug fixes/features) +- [ ] Any breaking changes are noted in the description above