Add kind selfhost example #4
Workflow file for this run
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
name: main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: [push, pull_request] | |
jobs: | |
kind: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: "Checkout repository" | |
uses: actions/checkout@v4 | |
with: | |
path: ${{ github.workspace }}/src/github.com/${{ github.repository }} | |
- name: "Install kind" | |
run: | | |
[ $(uname -m) = x86_64 ] && curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.26.0/kind-linux-amd64 | |
# For ARM64 | |
[ $(uname -m) = aarch64 ] && curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.26.0/kind-linux-arm64 | |
chmod +x ./kind | |
sudo mv ./kind /usr/local/bin/kind | |
- name: "Setup k8s cluster" | |
run: | | |
cat <<EOF | kind create cluster --wait=3m --config=- | |
kind: Cluster | |
apiVersion: kind.x-k8s.io/v1alpha4 | |
nodes: | |
- role: control-plane | |
extraPortMappings: | |
- containerPort: 80 | |
hostPort: 80 | |
protocol: TCP | |
- containerPort: 443 | |
hostPort: 443 | |
protocol: TCP | |
EOF | |
- name: "Print cluster details" | |
run: | | |
kubectl cluster-info | |
kubectl version | |
kubectl get pods -n kube-system | |
echo "current-context:" $(kubectl config current-context) | |
echo "environment-kubeconfig:" ${KUBECONFIG} | |
- name: "Install nginx ingress controller" | |
run: | | |
kubectl apply -f https://kind.sigs.k8s.io/examples/ingress/deploy-ingress-nginx.yaml | |
kubectl wait --namespace ingress-nginx \ | |
--for=condition=ready pod \ | |
--selector=app.kubernetes.io/component=controller \ | |
--timeout=90s | |
- name: "Huly deploy" | |
working-directory: ${{ github.workspace }}/src/github.com/${{ github.repository }}/kube | |
run: | | |
kubectl apply -R -f . | |
kubectl wait --for=condition=Ready deployment/front --timeout 120s | |
kubectl wait --for=condition=Ready deployment/account --timeout 120s | |
kubectl wait --for=condition=Ready deployment/mongodb --timeout 120s | |
- name: "Check login" | |
run: | | |
token=$(curl -s -H 'Content-Type: application/json' \ | |
-d '{"method":"createAccount","params":["user3","1234","user","1"]}' \ | |
-X POST \ | |
http://account.huly.example/ | jq -r '.result.token') | |
curl http://account.huly.example/ \ | |
-X POST \ | |
-d '{"method":"getUserWorkspaces","params":[]}' \ | |
-H 'Content-Type: application/json' \ | |
-H 'Accept: */*' \ | |
-H "Authorization: Bearer $token" | |
- name: Cleanup resources | |
if: ${{ success() || failure() || cancelled() }} | |
run: kind delete cluster |