Skip to content
This repository was archived by the owner on Apr 27, 2020. It is now read-only.

Commit ee88690

Browse files
anneschuthsuperbrothers
authored andcommitted
Adds supports for AWS EKS (#35)
* Supports AWS EKS * Adds myself to contributors * Fixes doubles quotes * Explicitly mention aws_eks_cluster_name in error message * Use multi-stage builds
1 parent 32d555c commit ee88690

File tree

4 files changed

+32
-0
lines changed

4 files changed

+32
-0
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ Kazuki Suda
55
Etourneau Gwenn
66
Tanner Bruce
77
Takuhiro Yoshida
8+
Anne Schuth

Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
FROM golang:1.10
2+
3+
RUN set -x && \
4+
go get -u -v github.com/kubernetes-sigs/aws-iam-authenticator/cmd/aws-iam-authenticator
5+
16
FROM ubuntu:16.04
27

38
MAINTAINER Kazuki Suda <ksuda@zlab.co.jp>
@@ -14,5 +19,7 @@ RUN set -x && \
1419
kubectl version --client && \
1520
rm -rf /var/lib/apt/lists/*
1621

22+
COPY --from=0 /go/bin/aws-iam-authenticator /usr/local/bin/
23+
1724
RUN mkdir -p /opt/resource
1825
COPY assets/* /opt/resource/

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
A Concourse resource for controlling the Kubernetes cluster.
66

7+
*This resource supports AWS EKS.*
8+
79
## Versions
810

911
The version of this resource corresponds to the version of kubectl. We recommend using different version depending on the kubernetes version of the cluster.
@@ -43,6 +45,8 @@ The version of this resource corresponds to the version of kubectl. We recommend
4345
-----END CERTIFICATE-----
4446
```
4547
- `insecure_skip_tls_verify`: *Optional.* If true, the API server's certificate will not be checked for validity. This will make your HTTPS connections insecure. Defaults to `false`.
48+
- `use_aws_iam_authenticator`: *Optional.* If true, the aws_iam_authenticator, required for connecting with EKS, is used. Requires `aws_eks_cluster_name`. Defaults to `false`.
49+
- `aws_eks_cluster_name`: *Optional.* the AWS EKS cluster name, required when `use_aws_iam_authenticator` is true.
4650

4751
## Behavior
4852

assets/common.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,26 @@ setup_kubectl() {
7979
exe kubectl config set-context "$CONTEXT_NAME" --user="$AUTH_NAME" --cluster="$CLUSTER_NAME"
8080

8181
exe kubectl config use-context "$CONTEXT_NAME"
82+
83+
# Optional. Use the AWS EKS authenticator
84+
local use_aws_iam_authenticator
85+
use_aws_iam_authenticator="$(jq -r '.source.use_aws_iam_authenticator // ""' < "$payload")"
86+
local aws_eks_cluster_name
87+
aws_eks_cluster_name="$(jq -r '.source.aws_eks_cluster_name // ""' < "$payload")"
88+
if [[ "$use_aws_iam_authenticator" == "true" ]]; then
89+
if [ -z "$aws_eks_cluster_name" ]; then
90+
echoerr 'You must specify aws_eks_cluster_name when using aws_iam_authenticator.'
91+
exit 1
92+
fi
93+
echo " exec:
94+
apiVersion: client.authentication.k8s.io/v1alpha1
95+
args:
96+
- token
97+
- -i
98+
- ${aws_eks_cluster_name}
99+
command: aws-iam-authenticator
100+
env: null" >> "$KUBECONFIG"
101+
fi
82102
fi
83103

84104
# Optional. The namespace scope. Defaults to default if doesn't specify in kubeconfig.

0 commit comments

Comments
 (0)