Skip to content

Commit

Permalink
Set kube config data in step container
Browse files Browse the repository at this point in the history
  • Loading branch information
koslib committed Oct 16, 2022
1 parent de2d99c commit b929abd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# For contributors: in case someone would like to contribute a change in the base docker image,
# please open a PR for the `dockerhub/Dockerfile` in the same project.

FROM koslib/ga-helm-eks:2.1
FROM koslib/ga-helm-eks:2.2
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,14 @@ It is very much possible that an update came out and I did not update the action

# Accessing your cluster

This action does not require any kube-config data set as a secret to connect to the repo. Instead, by authenticating with your AWS account, it automatically generates a kube-config file for your cluster which is then used to execute any `helm` commands.
It is required to set the `KUBE_CONFIG_DATA` env/secret in order to access your cluster. I recommend you do it dynamically using a step like that:

```
- name: kubeconfing
run: |
aws eks update-kubeconfig --name ${{ env.CLUSTER_NAME }} --region ${{ env.AWS_REGION }}
echo "KUBE_CONFIG_DATA=$(cat ~/.kube/config | base64)" >> $GITHUB_ENV
```

However if you find this configuration option complicated, you can still supply `KUBE_CONFIG_DATA` as a repository secret, however this is not endorsed by this repository.

Expand Down
4 changes: 4 additions & 0 deletions dockerhub/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

set -e

echo ${KUBE_CONFIG_DATA} | base64 -d > kubeconfig
export KUBECONFIG="${PWD}/kubeconfig"
chmod 600 ${PWD}/kubeconfig

if [[ -n "${INPUT_PLUGINS// /}" ]]
then
plugins=$(echo $INPUT_PLUGINS | tr ",")
Expand Down

0 comments on commit b929abd

Please sign in to comment.