-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit cd820f6
Showing
5 changed files
with
136 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Adapted from https://github.com/koslib/helm-eks-action to authenticate using eksctl. | ||
|
||
FROM alpine:3.13 | ||
|
||
ARG KUBECTL_VERSION="1.21.2" | ||
|
||
RUN apk add py-pip curl wget ca-certificates git bash jq gcc alpine-sdk | ||
RUN pip install 'awscli==1.22.26' | ||
RUN curl -L -o /usr/bin/kubectl https://amazon-eks.s3.us-west-2.amazonaws.com/1.21.2/2021-07-05/bin/linux/amd64/kubectl | ||
RUN chmod +x /usr/bin/kubectl | ||
|
||
RUN curl -o /usr/bin/aws-iam-authenticator https://amazon-eks.s3.us-west-2.amazonaws.com/1.21.2/2021-07-05/bin/linux/amd64/aws-iam-authenticator | ||
RUN chmod +x /usr/bin/aws-iam-authenticator | ||
|
||
RUN wget https://get.helm.sh/helm-v3.8.0-linux-amd64.tar.gz -O - | tar -xzO linux-amd64/helm > /usr/local/bin/helm | ||
RUN chmod +x /usr/local/bin/helm | ||
|
||
RUN wget "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" -O - | tar -xz -C /usr/local/bin | ||
|
||
COPY entrypoint.sh /entrypoint.sh | ||
ENTRYPOINT ["/entrypoint.sh"]: |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 Richard Wu | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# eksctl-helm-action | ||
|
||
Github Action to authenticate with eksctl and use helm/kubectl. | ||
|
||
Huge credits to [helm-eks-action](https://github.com/koslib/helm-eks-action) (this is basically a fork with a few additional lines) | ||
but authenticating using `eksctl` instead of passing through `KUBE_CONFIG_DATA`. | ||
|
||
## Example | ||
|
||
Secrets required: `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` | ||
|
||
Inputs: | ||
|
||
- `eks_cluster`: name of the EKS cluster (NAME in `eksctl get cluster`) | ||
- `plugins`: comma-separated list of helm plugins (their URLs) | ||
- `command`: the command(s) you want to run (which can be `kubectl`/`helm`) | ||
|
||
```yaml | ||
name: deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: us-east-1 | ||
|
||
- name: helm deploy | ||
uses: tensor-hq/eksctl-helm-action@master | ||
with: | ||
eks_cluster: my-prod-cluster | ||
plugins: "https://github.com/jkroepke/helm-secrets" # optional | ||
command: |- | ||
helm upgrade <release name> --install --wait <chart> -f <path to values.yaml> | ||
kubectl get pods | ||
``` |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: "Helm on EKS (with eksctl)" | ||
description: "Authenticates on EKS clusters using eksctl and executes Helm commands. Can also be used with kubectl commands." | ||
branding: | ||
icon: 'anchor' | ||
color: 'blue' | ||
inputs: | ||
command: | ||
description: "Your command (kubectl or helm)" | ||
required: true | ||
plugins: | ||
description: "Comma-separated URLs for the Helm Plugins you need installed" | ||
required: false | ||
eks_cluster: | ||
description: "Name of your EKS cluster (i.e., from `eksctl get cluster`)" | ||
required: true | ||
outputs: | ||
result: | ||
description: "Output returned by your Helm or kubectl command" | ||
runs: | ||
using: "docker" | ||
image: "Dockerfile" | ||
args: | ||
- ${{ inputs.command }} |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
export KUBECONFIG="${PWD}/kubeconfig" | ||
eksctl utils write-kubeconfig --cluster $INPUT_EKS_CLUSTER --kubeconfig $KUBECONFIG | ||
chmod 600 $KUBECONFIG | ||
|
||
if [[ -n "${INPUT_PLUGINS// /}" ]] | ||
then | ||
plugins=$(echo $INPUT_PLUGINS | tr ",") | ||
|
||
for plugin in $plugins | ||
do | ||
echo "installing helm plugin: [$plugin]" | ||
helm plugin install $plugin | ||
done | ||
fi | ||
|
||
echo "running entrypoint command(s)" | ||
|
||
response=$(sh -c "$INPUT_COMMAND") | ||
|
||
echo "::set-output name=response::$response" |