-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* initial work on launch config * fix yaml * fix group creation * create microk8s config file * checkout the micrk8s-config.yaml file * make sure the .kube dir is created * create new test actions * rename job name and description * wait for registry pod to be ready * wait for ingress to be ready * test * add 3 mins before checking the addons again * add timeout before checking the addons * ready for release * add more notes * change to master
- Loading branch information
Showing
16 changed files
with
686 additions
and
272 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,49 @@ | ||
name: Test Microk8s | ||
on: [push] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
name: A job to install MicroK8s | ||
steps: | ||
- uses: balchua/microk8s-actions@master | ||
with: | ||
channel: "1.26/stable" | ||
addons: '["rbac", "dns", "hostpath-storage", "registry"]' | ||
|
||
- name: Check User | ||
run: | | ||
id | ||
sg microk8s -c 'microk8s status' | ||
- name: Check push to local registry | ||
run: | | ||
docker pull busybox:1 | ||
echo $REGISTRY_IP | ||
docker tag busybox:1 localhost:32000/my-repo/busybox:1 | ||
docker push localhost:32000/my-repo/busybox:1 | ||
curl http://localhost:32000/v2/_catalog | ||
- name: Test MicroK8s | ||
id: microk8s | ||
run: | | ||
set -ex | ||
kubectl get no | ||
kubectl get pods -A -o wide | ||
sleep 120 # Give it sometime before we start checking for pod readiness. | ||
# wait for storage pod to be ready | ||
kubectl -n kube-system wait --for=condition=ready pod -l k8s-app=hostpath-provisioner --timeout=60s | ||
storage_ready=$? | ||
if [ $storage_ready -ne 0 ]; then | ||
echo "Error storage not ready." | ||
exit $storage_ready | ||
fi | ||
- name: Test MicroK8s commands | ||
id: microk8s-commands | ||
run: | | ||
set -ex | ||
echo "Executing microk8s status using sg command." | ||
sg microk8s -c 'microk8s status' | ||
echo "Executing microk8s status using sudo command." | ||
sudo microk8s status |
This file was deleted.
Oops, something went wrong.
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,75 @@ | ||
name: Test Launch Configuration Microk8s | ||
on: [push] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
name: A job to install MicroK8s with launch configurations | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
sparse-checkout: | | ||
microk8s-config.yaml | ||
sparse-checkout-cone-mode: false | ||
|
||
- name: build-image-and-create-microk8s-config | ||
run: | | ||
mkdir -p $HOME/sideload | ||
docker pull alpine:edge | ||
docker save alpine:edge > $HOME/sideload/alpine-edge.tar | ||
- uses: balchua/microk8s-actions@master | ||
with: | ||
channel: "1.28/stable" | ||
launch-configuration: "$GITHUB_WORKSPACE/microk8s-config.yaml" | ||
sideload-images-path: "$HOME/sideload/" | ||
|
||
- name: Check Side loaded images | ||
run: | | ||
sudo microk8s ctr images ls | grep alpine:edge | ||
- name: Check enabled addons | ||
run: | | ||
echo "wait for a few seconds" | ||
sleep 120 | ||
sudo microk8s kubectl wait pods --for=jsonpath='{.status.phase}'=Running -l name=nginx-ingress-microk8s -n ingress --timeout=300s | ||
sudo microk8s status --wait-ready | ||
sudo microk8s status --addon dns --wait-ready | grep enabled | ||
sudo microk8s status --addon ingress --wait-ready | grep enabled | ||
sudo microk8s status --addon rbac --wait-ready | grep enabled | ||
sudo microk8s status --addon hostpath-storage --wait-ready | grep enabled | ||
sudo microk8s status --addon registry --wait-ready | grep enabled | ||
- name: Check push to local registry | ||
run: | | ||
sudo microk8s kubectl wait --for=jsonpath='{.status.phase}'=Bound pvc/registry-claim -n container-registry --timeout=90s | ||
sudo microk8s kubectl wait pods --for=jsonpath='{.status.phase}'=Running -l app=registry -n container-registry --timeout=90s | ||
docker pull busybox:1 | ||
docker tag busybox:1 localhost:32000/my-repo/busybox:1 | ||
docker push localhost:32000/my-repo/busybox:1 | ||
curl http://localhost:32000/v2/_catalog | ||
- name: Test MicroK8s | ||
id: microk8s | ||
run: | | ||
set -ex | ||
kubectl get no | ||
kubectl get pods -A -o wide | ||
sleep 120 # Give it sometime before we start checking for pod readiness. | ||
# wait for storage pod to be ready | ||
kubectl -n kube-system wait --for=condition=ready pod -l k8s-app=hostpath-provisioner --timeout=60s | ||
storage_ready=$? | ||
if [ $storage_ready -ne 0 ]; then | ||
echo "Error storage not ready." | ||
exit $storage_ready | ||
fi | ||
- name: Test MicroK8s commands | ||
id: microk8s-commands | ||
run: | | ||
set -ex | ||
echo "Executing microk8s status using sg command." | ||
sg microk8s -c 'microk8s status' | ||
echo "Executing microk8s status using sudo command." | ||
sudo microk8s status |
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 |
---|---|---|
@@ -1,20 +1,27 @@ | ||
name: 'MicroK8s Action' | ||
description: 'Run a MicroK8s Kubernetes cluster in your GitHub Action' | ||
name: "MicroK8s Action" | ||
description: "Run a MicroK8s Kubernetes cluster in your GitHub Action" | ||
author: "balchua" | ||
inputs: | ||
channel: # MicroK8s channel | ||
description: 'The MicroK8s Channel to use. More information here https://microk8s.io/docs/setting-snap-channel' | ||
channel: # MicroK8s channel | ||
description: "The MicroK8s Channel to use. More information here https://microk8s.io/docs/setting-snap-channel" | ||
required: true | ||
default: 'latest/stable' | ||
default: "latest/stable" | ||
devMode: | ||
description: "Enable devmode, this is only applicable to strict confinement" | ||
required: false | ||
default: "false" | ||
addons: | ||
description: "A JSON array of addons to enable" | ||
description: "A JSON array of addons to enable" | ||
required: false | ||
default: "[]" | ||
|
||
launch-configuration: | ||
description: "Fully qualified path where the custom MicroK8s launch configuration is located" | ||
required: false | ||
default: "" | ||
sideload-images-path: | ||
description: "Fully qualified path where the container image tarballs is located" | ||
required: false | ||
default: "" | ||
runs: | ||
using: 'node16' | ||
main: 'lib/index.js' | ||
using: "node16" | ||
main: "lib/index.js" |
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,44 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Addon = void 0; | ||
const util = __importStar(require("./util")); | ||
const status = __importStar(require("./status")); | ||
const sh = __importStar(require("shelljs")); | ||
class Addon { | ||
constructor(addon) { | ||
this.addon = addon; | ||
} | ||
enable() { | ||
sh.echo('Start enabling ' + this.addon); | ||
status.waitForReadyState(); | ||
if (this.addon === "kubeflow") { | ||
sh.echo('kubeflow is no longer supported as a addon'); | ||
} | ||
else { | ||
util.executeCommand(false, 'sudo microk8s enable ' + this.addon); | ||
status.silentWaitForStorageToBeReady(this.addon); | ||
status.silentwaitForRegistryPvClaim(this.addon); | ||
} | ||
status.waitForReadyState(); | ||
} | ||
} | ||
exports.Addon = Addon; |
Oops, something went wrong.