Skip to content

Commit

Permalink
Adds generic kubectl command (#14)
Browse files Browse the repository at this point in the history
* adds generic kubectl command

* update name

* adds readme docs

* update desc

* update desc
  • Loading branch information
aweis89 authored Aug 12, 2022
1 parent 4e18334 commit ed41474
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,29 @@ Copy a file to the blue/green fog-ingest toolbox pod.
| `src` | `string` | source in action context |
| `dst` | `string` | destination in toolbox pod |

### kubectl-exec

Run commands that have access to the specified rancher cluster

```yaml
- name: Run kubectl diff to output diff
uses: mobilecoinofficial/[email protected]
with:
action: kubectl-exec
rancher_cluster: ${{ secrets.RANCHER_CLUSTER }}
rancher_url: ${{ secrets.RANCHER_URL }}
rancher_token: ${{ secrets.RANCHER_TOKEN }}
command: |
helm template . | k diff -f -
```

| with | type | description |
| --- | --- | --- |
| `command` | `string` | command to run on the toolbox pod |
| `rancher_cluster` | `string` | Target cluster name |
| `rancher_url` | `string` | Rancher Server URL |
| `rancher_token` | `string` | Rancher API Token |

### toolbox-exec

Run a command on the blue/green fog-ingest toolbox pod.
Expand Down
6 changes: 5 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,11 @@ then
echo ""
k exec -n "${INPUT_NAMESPACE}" "${toolbox}" -c toolbox -- /bin/bash -c "${INPUT_COMMAND}"
;;

kubectl-exec)
# setup kubeconfig and execute supplied command
rancher_get_kubeconfig
exec "$@"
;;
*)
error_exit "Command ${INPUT_ACTION} not recognized"
;;
Expand Down

0 comments on commit ed41474

Please sign in to comment.