File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11FROM rancher/cli:v2.0.4
22
33# install dependencies
4- RUN apk add --no-cache curl
4+ RUN apk update \
5+ && apk add --no-cache \
6+ ca-certificates \
7+ curl
58
69# install kubectl
710RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.12.0/bin/linux/amd64/kubectl \
8- && chmod +x ./kubectl \
911 && mv ./kubectl /usr/local/bin/kubectl
1012
11- # add rancher-redeploy script
12- COPY bin/rancher-redeploy /usr/local/bin/
13- RUN chmod +x /usr/local/bin/rancher-redeploy
13+ # add helper scripts
14+ COPY bin/ /usr/local/bin/
15+
16+ # # make all binaries executable
17+ RUN chmod +x /usr/local/bin/*
1418
1519# reset entrypoint
1620ENTRYPOINT []
Original file line number Diff line number Diff line change @@ -10,11 +10,11 @@ This docker image enables simple deployments to Rancher.
1010It is a small alpine image with [ Rancher CLI] ( https://rancher.com/docs/rancher/v2.x/en/cli/ ) ` rancher `
1111and [ Kubernetes CLI] ( https://kubernetes.io/docs/tasks/tools/install-kubectl/ ) ` kubectl ` installed.
1212
13- It also comes with a custom ` rancher-redeploy ` command (see usage section).
13+ It also comes with a custom ` rancher-redeploy ` and ` rancher-exec ` command helper (see usage section).
1414
1515## Usage
1616
17- ### Simple Redeploy via GitLab CI
17+ ### Simple Redeploy via GitLab CI and ` rancher-redeploy ` helper
1818
1919To use this image via GitLab CI add the following to the ` .gitlab-ci.yml ` :
2020
@@ -36,6 +36,12 @@ Don't forget to provide `$RANCHER_TOKEN` via GitLab CI/CD variable.
3636This will trigger a redeploy of the given Kubernetes deployment by updating a label
3737and pull the newest image if configured correctly.
3838
39+ # ## Execute Command via `rancher-exec` helper
40+
41+ You can also execute commands in pods of your deployment via `rancher-exec $K8S_NAMESPACE $K8S_DEPLOYMENT 'ls'`.
42+ This will execute the given command in the first pod of your deployment.
43+ Currently this is only tested with single container pods.
44+
3945# # Changelog
4046
4147Check [releases](https://github.com/sourceboat/rancher-deploy/releases) for all notable changes.
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ POD=$( rancher kubectl get pod -l workload.user.cattle.io/workloadselector=deployment-$1 -$2 -n $1 -o jsonpath=" {.items[0].metadata.name}" )
3+ echo " INFO: executing '$3 ' in pod '$POD '\n"
4+ rancher kubectl exec $POD -n $1 $3
You can’t perform that action at this time.
0 commit comments