Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makes juju and microk8s classic confinement optional #57

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ inputs:
description: "snap channel for juju bundle, installed via snap"
required: false
default: "latest/stable"
juju-classic-confinement:
description: "Install juju with classic confinement"
required: false
default: "true"
lxd-channel:
description: "snap channel for lxd regardless of provider, installed via snap"
required: false
Expand All @@ -60,6 +64,10 @@ inputs:
description: "microk8s addons to enable"
required: false
default: "storage dns rbac"
microk8s-classic-confinement:
description: "Install microk8s with classic confinement"
required: false
default: "true"
runs:
using: "node16"
main: "dist/bootstrap/index.js"
Expand Down
10 changes: 6 additions & 4 deletions dist/bootstrap/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5579,8 +5579,10 @@ function run() {
const juju_channel = core.getInput("juju-channel");
const juju_bundle_channel = core.getInput("juju-bundle-channel");
const juju_crashdump_channel = core.getInput("juju-crashdump-channel");
const juju_classic_confinement = core.getInput("juju-classic-confinement") == "true" ? "--classic" : "";
const lxd_channel = core.getInput("lxd-channel");
const microk8s_group = get_microk8s_group();
const microk8s_classic_confinement = core.getInput("microk8s-classic-confinement") == "true" ? "--classic" : "";
let bootstrap_constraints = core.getInput("bootstrap-constraints");
const microk8s_addons = core.getInput("microk8s-addons");
let group = "";
Expand Down Expand Up @@ -5613,7 +5615,7 @@ function run() {
yield exec.exec("sudo --preserve-env=http_proxy,https_proxy,no_proxy pip3 install tox");
core.endGroup();
core.startGroup("Install Juju");
yield snap(`install juju --classic --channel=${juju_channel}`);
yield snap(`install juju ${juju_classic_confinement} --channel=${juju_channel}`);
core.endGroup();
core.startGroup("Install tools");
yield snap("install jq");
Expand Down Expand Up @@ -5642,10 +5644,10 @@ function run() {
else if (provider === "microk8s") {
core.startGroup("Install microk8s");
if ([null, ""].includes(channel) == false) {
yield snap(`install microk8s --classic --channel=${channel}`);
yield snap(`install microk8s ${microk8s_classic_confinement} --channel=${channel}`);
}
else {
yield snap("install microk8s --classic");
yield snap(`install microk8s ${microk8s_classic_confinement}`);
}
core.endGroup();
core.startGroup("Initialize microk8s");
Expand Down Expand Up @@ -5829,4 +5831,4 @@ module.exports = require("util");;
/******/ // Load entry module and return exports
/******/ return __nccwpck_require__(1098);
/******/ })()
;
;
16 changes: 9 additions & 7 deletions src/bootstrap/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,10 @@ async function run() {
const juju_channel = core.getInput("juju-channel");
const juju_bundle_channel = core.getInput("juju-bundle-channel");
const juju_crashdump_channel = core.getInput("juju-crashdump-channel")
const juju_classic_confinement = core.getInput("juju-classic-confinement") == "true" ? "--classic" : "";
const lxd_channel = core.getInput("lxd-channel");
const microk8s_group = get_microk8s_group();
const microk8s_classic_confinement = core.getInput("microk8s-classic-confinement") == "true" ? "--classic" : "";
let bootstrap_constraints = core.getInput("bootstrap-constraints");
const microk8s_addons = core.getInput("microk8s-addons")
let group = "";
Expand Down Expand Up @@ -181,7 +183,7 @@ async function run() {
await exec.exec("sudo --preserve-env=http_proxy,https_proxy,no_proxy pip3 install tox");
core.endGroup();
core.startGroup("Install Juju");
await snap(`install juju --classic --channel=${juju_channel}`);
await snap(`install juju ${juju_classic_confinement} --channel=${juju_channel}`);
core.endGroup();
core.startGroup("Install tools");
await snap("install jq");
Expand All @@ -204,21 +206,21 @@ async function run() {
await exec.exec("mkdir", ["-p", juju_dir]);
let bootstrap_command = `juju bootstrap --debug --verbose ${provider} ${bootstrap_options}`
if (provider === "lxd") {
if ([null, ""].includes(channel) == false){
if ([null, ""].includes(channel) == false) {
await snap(`refresh lxd --channel=${channel}`);
}
}
group = "lxd";
} else if (provider === "microk8s") {
core.startGroup("Install microk8s");
if ([null, ""].includes(channel) == false){
await snap(`install microk8s --classic --channel=${channel}`);
if ([null, ""].includes(channel) == false) {
await snap(`install microk8s ${microk8s_classic_confinement} --channel=${channel}`);
} else {
await snap("install microk8s --classic");
await snap(`install microk8s ${microk8s_classic_confinement}`);
}
core.endGroup();
core.startGroup("Initialize microk8s");
await exec.exec('bash', ['-c', `sudo usermod -a -G ${microk8s_group} $USER`]);
if(!await microk8s_init(microk8s_addons)) {
if (!await microk8s_init(microk8s_addons)) {
return;
}
group = microk8s_group;
Expand Down