-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from terraform-aws-modules/fix/git_hooks_and_ci
fixing up CI and git hooks
- Loading branch information
Showing
5 changed files
with
137 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 = <<USERDATA | ||
#!/bin/bash -xe | ||
CA_CERTIFICATE_DIRECTORY=/etc/kubernetes/pki | ||
CA_CERTIFICATE_FILE_PATH=$CA_CERTIFICATE_DIRECTORY/ca.crt | ||
mkdir -p $CA_CERTIFICATE_DIRECTORY | ||
echo "${aws_eks_cluster.this.certificate_authority.0.data}" | base64 -d > $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 = <<CONFIGMAPAWSAUTH | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: aws-auth | ||
namespace: kube-system | ||
data: | ||
mapRoles: | | ||
- rolearn: ${aws_iam_role.workers.arn} | ||
username: system:node:{{EC2PrivateDNSName}} | ||
groups: | ||
- system:bootstrappers | ||
- system:nodes | ||
CONFIGMAPAWSAUTH | ||
|
||
kubeconfig = <<KUBECONFIG | ||
apiVersion: v1 | ||
clusters: | ||
- cluster: | ||
server: ${aws_eks_cluster.this.endpoint} | ||
certificate-authority-data: ${aws_eks_cluster.this.certificate_authority.0.data} | ||
name: kubernetes | ||
contexts: | ||
- context: | ||
cluster: kubernetes | ||
user: aws | ||
name: aws | ||
current-context: aws | ||
kind: Config | ||
preferences: {} | ||
users: | ||
- name: aws | ||
user: | ||
exec: | ||
apiVersion: client.authentication.k8s.io/v1alpha1 | ||
command: heptio-authenticator-aws | ||
args: | ||
- "token" | ||
- "-i" | ||
- "${var.cluster_name}" | ||
KUBECONFIG | ||
} | ||
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 = <<USERDATA | ||
#!/bin/bash -xe | ||
CA_CERTIFICATE_DIRECTORY=/etc/kubernetes/pki | ||
CA_CERTIFICATE_FILE_PATH=$CA_CERTIFICATE_DIRECTORY/ca.crt | ||
mkdir -p $CA_CERTIFICATE_DIRECTORY | ||
echo "${aws_eks_cluster.this.certificate_authority.0.data}" | base64 -d > $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 = <<CONFIGMAPAWSAUTH | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: aws-auth | ||
namespace: kube-system | ||
data: | ||
mapRoles: | | ||
- rolearn: ${aws_iam_role.workers.arn} | ||
username: system:node:{{EC2PrivateDNSName}} | ||
groups: | ||
- system:bootstrappers | ||
- system:nodes | ||
CONFIGMAPAWSAUTH | ||
|
||
kubeconfig = <<KUBECONFIG | ||
apiVersion: v1 | ||
clusters: | ||
- cluster: | ||
server: ${aws_eks_cluster.this.endpoint} | ||
certificate-authority-data: ${aws_eks_cluster.this.certificate_authority.0.data} | ||
name: kubernetes | ||
contexts: | ||
- context: | ||
cluster: kubernetes | ||
user: aws | ||
name: aws | ||
current-context: aws | ||
kind: Config | ||
preferences: {} | ||
users: | ||
- name: aws | ||
user: | ||
exec: | ||
apiVersion: client.authentication.k8s.io/v1alpha1 | ||
command: heptio-authenticator-aws | ||
args: | ||
- "token" | ||
- "-i" | ||
- "${var.cluster_name}" | ||
KUBECONFIG | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v0.1.0 | ||
v0.1.1 |