Skip to content

Commit

Permalink
wait for storage rollout to be ready
Browse files Browse the repository at this point in the history
  • Loading branch information
balchua committed Feb 25, 2023
1 parent 1f8e371 commit 3281ec1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
7 changes: 7 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ function enableAddon(addon, isStrict) {
else {
executeCommand(false, 'sudo microk8s enable ' + addon);
waitForStorageToBeReady(isStrict, addon);
waitForRegistryPvClaim(isStrict, addon);
}
waitForReadyState(isStrict);
}
Expand Down Expand Up @@ -138,4 +139,10 @@ function waitForStorageToBeReady(isSilent, addon) {
executeCommand(isSilent, "sudo microk8s kubectl rollout status deployment/hostpath-provisioner -n kube-system --timeout=90s");
}
}
function waitForRegistryPvClaim(isSilent, addon) {
if (addon === "registry") {
sh.echo('Waiting for registry volume to be bound');
executeCommand(isSilent, "sudo microk8s kubectl wait --for=jsonpath='{.status.phase}'=Bound pvc/registry-claim -n container-registry --timeout=90s");
}
}
run();
9 changes: 8 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ function enableAddon(addon: string, isStrict: boolean) {
} else {
executeCommand(false, 'sudo microk8s enable ' + addon)
waitForStorageToBeReady(isStrict, addon)
waitForRegistryPvClaim(isStrict, addon)
}
waitForReadyState(isStrict)
}
Expand Down Expand Up @@ -119,7 +120,13 @@ function waitForStorageToBeReady(isSilent: boolean, addon: string) {
sh.echo('Waiting for hostpath-storage to be ready ');
executeCommand(isSilent, "sudo microk8s kubectl rollout status deployment/hostpath-provisioner -n kube-system --timeout=90s")
}

}

function waitForRegistryPvClaim(isSilent: boolean, addon: string) {
if (addon === "registry") {
sh.echo('Waiting for registry volume to be bound');
executeCommand(isSilent, "sudo microk8s kubectl wait --for=jsonpath='{.status.phase}'=Bound pvc/registry-claim -n container-registry --timeout=90s")
}
}

run();

0 comments on commit 3281ec1

Please sign in to comment.