Skip to content

Commit

Permalink
Adding upgrade cluster action (#26)
Browse files Browse the repository at this point in the history
* Adding upgrade cluster action
---------

Co-authored-by: jdewinne <[email protected]>
  • Loading branch information
jdewinne and jdewinne authored Sep 8, 2023
1 parent e2a5865 commit beaf6dd
Show file tree
Hide file tree
Showing 49 changed files with 47,879 additions and 78 deletions.
17 changes: 14 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
.PHONY: package-all
package-all: package-archive-channel package-archive-customer package-create-cluster package-create-customer \
package-create-release package-helm-install package-kots-install package-promote-release \
package-remove-cluster package-get-customer-instances package-report-compatibility-result
package-remove-cluster package-get-customer-instances package-report-compatibility-result \
package-upgrade-cluster

.PHONY: package-archive-channel
package-archive-channel:
Expand Down Expand Up @@ -58,10 +59,16 @@ package-report-compatibility-result:
rm -rf ./report-compatibility-result/build ./report-compatibility-result/dist ./report-compatibility-result/node_modules
cd ./report-compatibility-result && npm install && npm run build && npm run package

.PHONY: package-upgrade-cluster
package-upgrade-cluster:
rm -rf ./upgrade-cluster/build ./upgrade-cluster/dist ./upgrade-cluster/node_modules
cd ./upgrade-cluster && npm install && npm run build && npm run package

.PHONY: readme-all
readme-all: pip-install readme-archive-channel readme-archive-customer readme-create-cluster readme-create-customer \
readme-create-release readme-helm-install readme-kots-install readme-promote-release \
readme-remove-cluster readme-prepare-cluster readme-get-customer-instances readme-report-compatibility-result
readme-remove-cluster readme-prepare-cluster readme-get-customer-instances readme-report-compatibility-result \
readme-upgrade-cluster

.PHONE: pip-install
pip-install:
Expand Down Expand Up @@ -113,4 +120,8 @@ readme-get-customer-instances: pip-install

.PHONY: readme-report-compatibility-result
readme-report-compatibility-result: pip-install
python3 docs/generate-readme/action-to-mermaid.py ./report-compatibility-result/action.yml > ./report-compatibility-result/README.md
python3 docs/generate-readme/action-to-mermaid.py ./report-compatibility-result/action.yml > ./report-compatibility-result/README.md

.PHONY: readme-upgrade-cluster
readme-upgrade-cluster: pip-install
python3 docs/generate-readme/action-to-mermaid.py ./upgrade-cluster/action.yml > ./upgrade-cluster/README.md
18 changes: 16 additions & 2 deletions archive-channel/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30432,7 +30432,7 @@ async function findChannelDetailsInOutput(channels, { slug, name }) {
"use strict";

Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getClusterVersions = exports.removeCluster = exports.getKubeconfig = exports.pollForStatus = exports.createCluster = exports.ClusterVersion = exports.Cluster = void 0;
exports.getClusterVersions = exports.upgradeCluster = exports.removeCluster = exports.getKubeconfig = exports.pollForStatus = exports.createCluster = exports.ClusterVersion = exports.Cluster = void 0;
class Cluster {
}
exports.Cluster = Cluster;
Expand Down Expand Up @@ -30516,6 +30516,19 @@ async function removeCluster(vendorPortalApi, clusterId) {
}
}
exports.removeCluster = removeCluster;
async function upgradeCluster(vendorPortalApi, clusterId, k8sVersion) {
const http = await vendorPortalApi.client();
const reqBody = {
"kubernetes_version": k8sVersion,
};
const uri = `${vendorPortalApi.endpoint}/cluster/${clusterId}/upgrade`;
const res = await http.post(uri, JSON.stringify(reqBody));
if (res.message.statusCode != 200) {
throw new Error(`Failed to upgrade cluster: Server responded with ${res.message.statusCode}`);
}
return getClusterDetails(vendorPortalApi, clusterId);
}
exports.upgradeCluster = upgradeCluster;
async function getClusterVersions(vendorPortalApi) {
const http = await vendorPortalApi.client();
const uri = `${vendorPortalApi.endpoint}/cluster/versions`;
Expand Down Expand Up @@ -30703,7 +30716,7 @@ exports.getUsedKubernetesDistributions = getUsedKubernetesDistributions;
"use strict";

Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.reportCompatibilityResult = exports.promoteRelease = exports.createReleaseFromChart = exports.createRelease = exports.getUsedKubernetesDistributions = exports.createCustomer = exports.archiveCustomer = exports.KubernetesDistribution = exports.getClusterVersions = exports.removeCluster = exports.getKubeconfig = exports.pollForStatus = exports.createCluster = exports.ClusterVersion = exports.archiveChannel = exports.getChannelDetails = exports.createChannel = exports.Channel = exports.getApplicationDetails = exports.VendorPortalApi = void 0;
exports.reportCompatibilityResult = exports.promoteRelease = exports.createReleaseFromChart = exports.createRelease = exports.getUsedKubernetesDistributions = exports.createCustomer = exports.archiveCustomer = exports.KubernetesDistribution = exports.getClusterVersions = exports.upgradeCluster = exports.removeCluster = exports.getKubeconfig = exports.pollForStatus = exports.createCluster = exports.ClusterVersion = exports.archiveChannel = exports.getChannelDetails = exports.createChannel = exports.Channel = exports.getApplicationDetails = exports.VendorPortalApi = void 0;
var configuration_1 = __nccwpck_require__(4995);
Object.defineProperty(exports, "VendorPortalApi", ({ enumerable: true, get: function () { return configuration_1.VendorPortalApi; } }));
var applications_1 = __nccwpck_require__(3770);
Expand All @@ -30719,6 +30732,7 @@ Object.defineProperty(exports, "createCluster", ({ enumerable: true, get: functi
Object.defineProperty(exports, "pollForStatus", ({ enumerable: true, get: function () { return clusters_1.pollForStatus; } }));
Object.defineProperty(exports, "getKubeconfig", ({ enumerable: true, get: function () { return clusters_1.getKubeconfig; } }));
Object.defineProperty(exports, "removeCluster", ({ enumerable: true, get: function () { return clusters_1.removeCluster; } }));
Object.defineProperty(exports, "upgradeCluster", ({ enumerable: true, get: function () { return clusters_1.upgradeCluster; } }));
Object.defineProperty(exports, "getClusterVersions", ({ enumerable: true, get: function () { return clusters_1.getClusterVersions; } }));
var customers_1 = __nccwpck_require__(8958);
Object.defineProperty(exports, "KubernetesDistribution", ({ enumerable: true, get: function () { return customers_1.KubernetesDistribution; } }));
Expand Down
2 changes: 1 addition & 1 deletion archive-channel/dist/index.js.map

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions archive-channel/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion archive-channel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"dependencies": {
"@actions/core": "^1.10.0",
"esbuild-jest": "^0.5.0",
"replicated-lib": "^0.0.1-beta.1",
"replicated-lib": "^0.0.1-beta.2",
"ts-node": "^10.9.1"
},
"devDependencies": {
Expand Down
18 changes: 16 additions & 2 deletions archive-customer/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30431,7 +30431,7 @@ async function findChannelDetailsInOutput(channels, { slug, name }) {
"use strict";

Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getClusterVersions = exports.removeCluster = exports.getKubeconfig = exports.pollForStatus = exports.createCluster = exports.ClusterVersion = exports.Cluster = void 0;
exports.getClusterVersions = exports.upgradeCluster = exports.removeCluster = exports.getKubeconfig = exports.pollForStatus = exports.createCluster = exports.ClusterVersion = exports.Cluster = void 0;
class Cluster {
}
exports.Cluster = Cluster;
Expand Down Expand Up @@ -30515,6 +30515,19 @@ async function removeCluster(vendorPortalApi, clusterId) {
}
}
exports.removeCluster = removeCluster;
async function upgradeCluster(vendorPortalApi, clusterId, k8sVersion) {
const http = await vendorPortalApi.client();
const reqBody = {
"kubernetes_version": k8sVersion,
};
const uri = `${vendorPortalApi.endpoint}/cluster/${clusterId}/upgrade`;
const res = await http.post(uri, JSON.stringify(reqBody));
if (res.message.statusCode != 200) {
throw new Error(`Failed to upgrade cluster: Server responded with ${res.message.statusCode}`);
}
return getClusterDetails(vendorPortalApi, clusterId);
}
exports.upgradeCluster = upgradeCluster;
async function getClusterVersions(vendorPortalApi) {
const http = await vendorPortalApi.client();
const uri = `${vendorPortalApi.endpoint}/cluster/versions`;
Expand Down Expand Up @@ -30702,7 +30715,7 @@ exports.getUsedKubernetesDistributions = getUsedKubernetesDistributions;
"use strict";

Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.reportCompatibilityResult = exports.promoteRelease = exports.createReleaseFromChart = exports.createRelease = exports.getUsedKubernetesDistributions = exports.createCustomer = exports.archiveCustomer = exports.KubernetesDistribution = exports.getClusterVersions = exports.removeCluster = exports.getKubeconfig = exports.pollForStatus = exports.createCluster = exports.ClusterVersion = exports.archiveChannel = exports.getChannelDetails = exports.createChannel = exports.Channel = exports.getApplicationDetails = exports.VendorPortalApi = void 0;
exports.reportCompatibilityResult = exports.promoteRelease = exports.createReleaseFromChart = exports.createRelease = exports.getUsedKubernetesDistributions = exports.createCustomer = exports.archiveCustomer = exports.KubernetesDistribution = exports.getClusterVersions = exports.upgradeCluster = exports.removeCluster = exports.getKubeconfig = exports.pollForStatus = exports.createCluster = exports.ClusterVersion = exports.archiveChannel = exports.getChannelDetails = exports.createChannel = exports.Channel = exports.getApplicationDetails = exports.VendorPortalApi = void 0;
var configuration_1 = __nccwpck_require__(4995);
Object.defineProperty(exports, "VendorPortalApi", ({ enumerable: true, get: function () { return configuration_1.VendorPortalApi; } }));
var applications_1 = __nccwpck_require__(3770);
Expand All @@ -30718,6 +30731,7 @@ Object.defineProperty(exports, "createCluster", ({ enumerable: true, get: functi
Object.defineProperty(exports, "pollForStatus", ({ enumerable: true, get: function () { return clusters_1.pollForStatus; } }));
Object.defineProperty(exports, "getKubeconfig", ({ enumerable: true, get: function () { return clusters_1.getKubeconfig; } }));
Object.defineProperty(exports, "removeCluster", ({ enumerable: true, get: function () { return clusters_1.removeCluster; } }));
Object.defineProperty(exports, "upgradeCluster", ({ enumerable: true, get: function () { return clusters_1.upgradeCluster; } }));
Object.defineProperty(exports, "getClusterVersions", ({ enumerable: true, get: function () { return clusters_1.getClusterVersions; } }));
var customers_1 = __nccwpck_require__(8958);
Object.defineProperty(exports, "KubernetesDistribution", ({ enumerable: true, get: function () { return customers_1.KubernetesDistribution; } }));
Expand Down
2 changes: 1 addition & 1 deletion archive-customer/dist/index.js.map

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions archive-customer/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion archive-customer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"dependencies": {
"@actions/core": "^1.10.0",
"esbuild-jest": "^0.5.0",
"replicated-lib": "^0.0.1-beta.1",
"replicated-lib": "^0.0.1-beta.2",
"ts-node": "^10.9.1"
},
"devDependencies": {
Expand Down
18 changes: 16 additions & 2 deletions create-cluster/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30484,7 +30484,7 @@ async function findChannelDetailsInOutput(channels, { slug, name }) {
"use strict";

Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getClusterVersions = exports.removeCluster = exports.getKubeconfig = exports.pollForStatus = exports.createCluster = exports.ClusterVersion = exports.Cluster = void 0;
exports.getClusterVersions = exports.upgradeCluster = exports.removeCluster = exports.getKubeconfig = exports.pollForStatus = exports.createCluster = exports.ClusterVersion = exports.Cluster = void 0;
class Cluster {
}
exports.Cluster = Cluster;
Expand Down Expand Up @@ -30568,6 +30568,19 @@ async function removeCluster(vendorPortalApi, clusterId) {
}
}
exports.removeCluster = removeCluster;
async function upgradeCluster(vendorPortalApi, clusterId, k8sVersion) {
const http = await vendorPortalApi.client();
const reqBody = {
"kubernetes_version": k8sVersion,
};
const uri = `${vendorPortalApi.endpoint}/cluster/${clusterId}/upgrade`;
const res = await http.post(uri, JSON.stringify(reqBody));
if (res.message.statusCode != 200) {
throw new Error(`Failed to upgrade cluster: Server responded with ${res.message.statusCode}`);
}
return getClusterDetails(vendorPortalApi, clusterId);
}
exports.upgradeCluster = upgradeCluster;
async function getClusterVersions(vendorPortalApi) {
const http = await vendorPortalApi.client();
const uri = `${vendorPortalApi.endpoint}/cluster/versions`;
Expand Down Expand Up @@ -30755,7 +30768,7 @@ exports.getUsedKubernetesDistributions = getUsedKubernetesDistributions;
"use strict";

Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.reportCompatibilityResult = exports.promoteRelease = exports.createReleaseFromChart = exports.createRelease = exports.getUsedKubernetesDistributions = exports.createCustomer = exports.archiveCustomer = exports.KubernetesDistribution = exports.getClusterVersions = exports.removeCluster = exports.getKubeconfig = exports.pollForStatus = exports.createCluster = exports.ClusterVersion = exports.archiveChannel = exports.getChannelDetails = exports.createChannel = exports.Channel = exports.getApplicationDetails = exports.VendorPortalApi = void 0;
exports.reportCompatibilityResult = exports.promoteRelease = exports.createReleaseFromChart = exports.createRelease = exports.getUsedKubernetesDistributions = exports.createCustomer = exports.archiveCustomer = exports.KubernetesDistribution = exports.getClusterVersions = exports.upgradeCluster = exports.removeCluster = exports.getKubeconfig = exports.pollForStatus = exports.createCluster = exports.ClusterVersion = exports.archiveChannel = exports.getChannelDetails = exports.createChannel = exports.Channel = exports.getApplicationDetails = exports.VendorPortalApi = void 0;
var configuration_1 = __nccwpck_require__(4995);
Object.defineProperty(exports, "VendorPortalApi", ({ enumerable: true, get: function () { return configuration_1.VendorPortalApi; } }));
var applications_1 = __nccwpck_require__(3770);
Expand All @@ -30771,6 +30784,7 @@ Object.defineProperty(exports, "createCluster", ({ enumerable: true, get: functi
Object.defineProperty(exports, "pollForStatus", ({ enumerable: true, get: function () { return clusters_1.pollForStatus; } }));
Object.defineProperty(exports, "getKubeconfig", ({ enumerable: true, get: function () { return clusters_1.getKubeconfig; } }));
Object.defineProperty(exports, "removeCluster", ({ enumerable: true, get: function () { return clusters_1.removeCluster; } }));
Object.defineProperty(exports, "upgradeCluster", ({ enumerable: true, get: function () { return clusters_1.upgradeCluster; } }));
Object.defineProperty(exports, "getClusterVersions", ({ enumerable: true, get: function () { return clusters_1.getClusterVersions; } }));
var customers_1 = __nccwpck_require__(8958);
Object.defineProperty(exports, "KubernetesDistribution", ({ enumerable: true, get: function () { return customers_1.KubernetesDistribution; } }));
Expand Down
2 changes: 1 addition & 1 deletion create-cluster/dist/index.js.map

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions create-cluster/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion create-cluster/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"dependencies": {
"@actions/core": "^1.10.0",
"esbuild-jest": "^0.5.0",
"replicated-lib": "^0.0.1-beta.1",
"replicated-lib": "^0.0.1-beta.2",
"ts-node": "^10.9.1"
},
"devDependencies": {
Expand Down
Loading

0 comments on commit beaf6dd

Please sign in to comment.