generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 213
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
Showing
4 changed files
with
127 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,33 @@ | ||
name: Test Setup GitHub Actions | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- action.yaml | ||
- .github/workflows/test-action.yaml | ||
|
||
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
sparse-checkout: | | ||
action.yaml | ||
- name: Set up kwokctl | ||
uses: . # kubernetes-sigs/kwok@main | ||
with: | ||
command: kwokctl | ||
- name: Test kwokctl | ||
shell: bash | ||
run: | | ||
kwokctl --version | ||
kwokctl create cluster | ||
kubectl version | ||
kwokctl delete cluster |
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,50 @@ | ||
name: Setup kwok | ||
|
||
description: This action runs kwok | ||
|
||
inputs: | ||
command: | ||
required: true | ||
description: Command to install | ||
kwok-version: | ||
required: false | ||
description: Specific version of command to install, defaults to latest release | ||
repository: | ||
required: false | ||
description: Repository is kwok's repository, will use release from this repository, defaults same as use in this step | ||
args: | ||
required: false | ||
description: The arguments to pass to the command; if passed, after the command is installed, it will run with the arguments | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Install and start kwok | ||
shell: bash | ||
env: | ||
KWOK_REPO: ${{ inputs.repository || github.repository }} | ||
KWOK_VERSION: ${{ inputs.kwok-version }} | ||
run: | | ||
if [[ ! -f /usr/local/bin/${{ inputs.command }}-${KWOK_VERSION} ]]; then | ||
if [[ -z "${KWOK_VERSION}" ]]; then | ||
echo "Fetching latest version..." | ||
KWOK_VERSION="$(curl "https://api.github.com/repos/${KWOK_REPO}/releases/latest" | jq -r '.tag_name')" | ||
echo "Latest version is ${KWOK_VERSION}" | ||
fi | ||
echo "Installing ${{ inputs.command }} ${KWOK_VERSION}..." | ||
wget -O ${{ inputs.command }}-${KWOK_VERSION} "https://github.com/${KWOK_REPO}/releases/download/${KWOK_VERSION}/${{ inputs.command }}-$(go env GOOS)-$(go env GOARCH)" | ||
chmod +x ${{ inputs.command }}-${KWOK_VERSION} | ||
sudo mv ${{ inputs.command }}-${KWOK_VERSION} /usr/local/bin/ | ||
sudo ln -sf /usr/local/bin/${{ inputs.command }}-${KWOK_VERSION} /usr/local/bin/${{ inputs.command }} | ||
if ! ${{ inputs.command }} --version; then | ||
echo "Failed to run ${{ inputs.command }} --version" | ||
exit 1 | ||
fi | ||
fi | ||
if [[ -n "${{ inputs.args }}" ]]; then | ||
echo "Running ${{ inputs.command }} ${{ inputs.args }}" | ||
if ! ${{ inputs.command }} ${{ inputs.args }}; then | ||
echo "Failed to run ${{ inputs.command }} ${{ inputs.args }}" | ||
exit 1 | ||
fi | ||
echo "Done!" | ||
fi |
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
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,40 @@ | ||
--- | ||
title: Github Action | ||
--- | ||
|
||
# Github Action | ||
|
||
{{< hint "info" >}} | ||
|
||
This document walks through the steps to use in the Github Action. | ||
|
||
{{< /hint >}} | ||
|
||
## Usage | ||
|
||
``` yaml | ||
- uses: kubernetes-sigs/kwok@main | ||
with: | ||
# Required: The command to install ('kwok' or 'kwokctl') | ||
command: '' | ||
# Optional: Specific version of command to install, defaults to latest release | ||
kwok-version: '' | ||
``` | ||
### Create Cluster | ||
``` yaml | ||
- name: Set up kwokctl | ||
uses: kubernetes-sigs/kwok@main | ||
with: | ||
command: kwokctl | ||
- run: kwokctl create cluster | ||
env: | ||
KWOK_KUBE_VERSION: v1.28.0 | ||
``` | ||
## Next steps | ||
Now, you can use `kwok` to [manage nodes and pods] in the Kubernetes cluster. | ||
|
||
[manage nodes and pods]: {{< relref "/docs/user/kwok-manage-nodes-and-pods" >}} |