Skip to content

Commit e397333

Browse files
authored
Merge pull request #46 from patrickdk77/main
Add arch support to entrypoint
2 parents 5ed2677 + a477915 commit e397333

3 files changed

Lines changed: 35 additions & 27 deletions

File tree

Dockerfile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ FROM amazon/aws-cli:latest
22
ARG TARGETARCH
33
ARG JQ_VERSION=1.6
44
ARG IAM_VERSION=0.6.12
5+
ENV TARGETARCH=${TARGETARCH}
56

67
# Install system packages and jq first
78
RUN dnf update -y && \
@@ -11,10 +12,13 @@ RUN dnf update -y && \
1112
chmod +x /usr/bin/jq
1213

1314
# Install kubectl and aws-iam-authenticator
14-
RUN curl -sL -o /usr/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/${TARGETARCH}/kubectl && \
15-
curl -sL -o /usr/bin/aws-iam-authenticator https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v${IAM_VERSION}/aws-iam-authenticator_${IAM_VERSION}_linux_${TARGETARCH} && \
16-
chmod +x /usr/bin/aws-iam-authenticator && \
17-
chmod +x /usr/bin/kubectl
15+
RUN export KUBECTL_VERSION=$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt) && \
16+
curl -sL -o /usr/bin/kubectl-${KUBECTL_VERSION} https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/${TARGETARCH}/kubectl && \
17+
curl -sL -o /usr/bin/aws-iam-authenticator-${IAM_VERSION} https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v${IAM_VERSION}/aws-iam-authenticator_${IAM_VERSION}_linux_${TARGETARCH} && \
18+
chmod +x /usr/bin/aws-iam-authenticator-${IAM_VERSION} && \
19+
chmod +x /usr/bin/kubectl-${KUBECTL_VERSION} && \
20+
ln -s /usr/bin/aws-iam-authenticator-${IAM_VERSION} /usr/bin/aws-iam-authenticator && \
21+
ln -s /usr/bin/kubectl-${KUBECTL_VERSION} /usr/bin/kubectl
1822

1923
# Add checksum verification for security
2024
RUN echo "Checking versions of installed tools:" && \

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
uses: aws-actions/amazon-ecr-login@v1
3939

4040
- name: Deploy to EKS cluster
41-
uses: kodermax/kubectl-aws-eks@main
41+
uses: kodermax/kubectl-aws-eks@1
4242
env:
4343
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
4444
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
@@ -48,7 +48,7 @@ jobs:
4848
args: set image deployment/$ECR_REPOSITORY $ECR_REPOSITORY=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
4949

5050
- name: Verify deployment
51-
uses: kodermax/kubectl-aws-eks@main
51+
uses: kodermax/kubectl-aws-eks@1
5252
env:
5353
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
5454
with:
@@ -87,7 +87,7 @@ By default, this action uses the latest stable version of kubectl. To use a spec
8787

8888
```yaml
8989
- name: Deploy to EKS cluster
90-
uses: kodermax/kubectl-aws-eks@main
90+
uses: kodermax/kubectl-aws-eks@1
9191
env:
9292
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
9393
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
@@ -104,7 +104,7 @@ By default, this action uses the latest version of aws-iam-authenticator. To use
104104

105105
```yaml
106106
- name: Deploy to EKS cluster
107-
uses: kodermax/kubectl-aws-eks@main
107+
uses: kodermax/kubectl-aws-eks@1
108108
env:
109109
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
110110
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
@@ -160,7 +160,7 @@ You can run any kubectl command by passing it as the `args` parameter:
160160

161161
```yaml
162162
- name: Get pod information
163-
uses: kodermax/kubectl-aws-eks@main
163+
uses: kodermax/kubectl-aws-eks@1
164164
env:
165165
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
166166
with:
@@ -171,7 +171,7 @@ You can run any kubectl command by passing it as the `args` parameter:
171171

172172
```yaml
173173
- name: Apply Kubernetes manifests
174-
uses: kodermax/kubectl-aws-eks@main
174+
uses: kodermax/kubectl-aws-eks@1
175175
env:
176176
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
177177
with:

entrypoint.sh

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,29 @@ if [ ! -s /tmp/config ]; then
1818
exit 1
1919
fi
2020

21-
if [ -z ${KUBECTL_VERSION+x} ] ; then
22-
echo "Using kubectl version: $(kubectl version --client 2>&1)"
23-
else
24-
echo "Pulling kubectl for version $KUBECTL_VERSION"
25-
rm -f /usr/bin/kubectl
26-
curl -sL -o /usr/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/"$KUBECTL_VERSION"/bin/linux/amd64/kubectl && \
27-
chmod +x /usr/bin/kubectl
28-
echo "Using kubectl version: $(kubectl version --client --short 2>&1)"
21+
if [ ! -z "${KUBECTL_VERSION}" ]; then
22+
if [ ! -e /usr/bin/kubectl-${KUBECTL_VERSION} ]; then
23+
echo "Pulling kubectl for version $KUBECTL_VERSION"
24+
curl -sL -o /usr/bin/kubectl-${KUBECTL_VERSION} https://storage.googleapis.com/kubernetes-release/release/"$KUBECTL_VERSION"/bin/linux/$TARGETARCH/kubectl && \
25+
chmod +x /usr/bin/kubectl-${KUBECTL_VERSION} && \
26+
ln -f -s /usr/bin/kubectl-${KUBECTL_VERSION} /usr/bin/kubectl
27+
else
28+
ln -f -s /usr/bin/kubectl-${KUBECTL_VERSION} /usr/bin/kubectl
29+
fi
2930
fi
30-
31-
if [ -z ${IAM_VERSION+x} ] ; then
32-
echo "Using aws-iam-authenticator version: $(aws-iam-authenticator version 2>&1)"
33-
else
34-
echo "Pulling aws-iam-authenticator for version $IAM_VERSION"
35-
rm -f /usr/bin/aws-iam-authenticator
36-
curl -sL -o /usr/bin/aws-iam-authenticator https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v"$IAM_VERSION"/aws-iam-authenticator_"$IAM_VERSION"_linux_amd64 && \
37-
chmod +x /usr/bin/aws-iam-authenticator
38-
echo "Using aws-iam-authenticator version: $(aws-iam-authenticator version 2>&1)"
31+
echo "Using kubectl version: $(kubectl version --client 2>&1)"
32+
33+
if [ ! -z "${IAM_VERSION}" ]; then
34+
if [ ! -e /usr/bin/aws-iam-authenticator-${IAM_VERSION} ]; then
35+
echo "Pulling aws-iam-authenticator for version $IAM_VERSION"
36+
curl -sL -o /usr/bin/aws-iam-authenticator-${IAM_VERSION} https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v"$IAM_VERSION"/aws-iam-authenticator_"$IAM_VERSION"_linux_$TARGETARCH && \
37+
chmod +x /usr/bin/aws-iam-authenticator-${IAM_VERSION} && \
38+
ln -f -s /usr/bin/aws-iam-authenticator-${IAM_VERSION} /usr/bin/aws-iam-authenticator
39+
else
40+
ln -f -s /usr/bin/aws-iam-authenticator-${IAM_VERSION} /usr/bin/aws-iam-authenticator
41+
fi
3942
fi
43+
echo "Using aws-iam-authenticator version: $(aws-iam-authenticator version 2>&1)"
4044

4145
# Check if tools were successfully installed
4246
if ! command -v kubectl >/dev/null 2>&1; then

0 commit comments

Comments
 (0)