Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit fa5f7ea
Author: Jeromy Cannon <jeromy@swirldslabs.com>
Date:   Thu Jan 25 15:02:17 2024 +0000

    Empty-Commit

    Signed-off-by: Jeromy Cannon <jeromy@swirldslabs.com>

commit 8ca8fa0
Author: Jeromy Cannon <jeromy@swirldslabs.com>
Date:   Thu Jan 25 07:31:51 2024 +0000

    Squashed commit of the following:

    commit 9446ce7
    Author: Jeromy Cannon <jeromy@swirldslabs.com>
    Date:   Wed Jan 24 21:16:43 2024 +0000

        added test

        Signed-off-by: Jeromy Cannon <jeromy@swirldslabs.com>

    commit d12877c
    Author: Jeromy Cannon <jeromy@swirldslabs.com>
    Date:   Wed Jan 24 19:58:14 2024 +0000

        working version

        Signed-off-by: Jeromy Cannon <jeromy@swirldslabs.com>

    commit 0933869
    Merge: e9555a2 1772906
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Thu Jan 25 08:05:01 2024 +1100

        Merge branch 'main' into 605-kubernetes-javascript-client

    commit e9555a2
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Thu Jan 25 08:00:20 2024 +1100

        fix: allow namespace to be created during chart install

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit 1772906
    Author: Jeromy Cannon <jeromy@swirldslabs.com>
    Date:   Wed Jan 24 17:25:22 2024 +0000

        chore: switch back to acme-cluster-issuer from repo now that changes have be… (#691)

        Signed-off-by: Jeromy Cannon <jeromy@swirldslabs.com>

    commit f1191e4
    Author: Jeromy Cannon <jeromy@swirldslabs.com>
    Date:   Wed Jan 24 16:28:21 2024 +0000

        chore: feedback from PR review for hedera-explorer chart changes (#690)

        Signed-off-by: Jeromy Cannon <jeromy@swirldslabs.com>

    commit 6956df2
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Wed Jan 24 19:54:20 2024 +1100

        rename test setup script

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit 1c8ee25
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Wed Jan 24 18:30:13 2024 +1100

        fix test

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit a911703
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Wed Jan 24 18:25:46 2024 +1100

        fix: rename Kubectl2 to K8

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit acd277f
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Wed Jan 24 18:17:34 2024 +1100

        fix: relay command

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit 5ba143c
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Wed Jan 24 18:16:52 2024 +1100

        fix: waitForPod

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit 1194025
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Wed Jan 24 17:54:46 2024 +1100

        fix: remove kubectl usage

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit 7387dff
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Wed Jan 24 17:53:36 2024 +1100

        fix: add clone method for Kubectl2

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit af5e7a4
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Wed Jan 24 14:30:37 2024 +1100

        fix: do not poll after copyToPod or copyFromPod

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit 5a9b96c
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Wed Jan 24 13:04:01 2024 +1100

        fix: make waitForPod non-blocking

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit 468b0b0
    Merge: 644c0e0 f3b3028
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Wed Jan 24 12:59:53 2024 +1100

        Merge branch 'main' into 605-kubernetes-javascript-client

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

        # Conflicts:
        #	fullstack-network-manager/package-lock.json
        #	fullstack-network-manager/package.json

    commit 644c0e0
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Tue Jan 23 16:03:28 2024 +1100

        add setup script for e2e test

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit 505ab8d
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Tue Jan 23 15:36:18 2024 +1100

        fix: check for pod readiness individually to show more info to the user

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit 2b3f9a3
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Tue Jan 23 15:02:11 2024 +1100

        fix: e2e tests

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit f3b3028
    Author: Jeromy Cannon <jeromy@swirldslabs.com>
    Date:   Tue Jan 23 02:56:21 2024 +0000

        feat: use Acme Lets Encrypt cluster issuer for TLS in Hedera Explorer (#677)

        Signed-off-by: Jeromy Cannon <jeromy@swirldslabs.com>

    commit e44e5b2
    Author: Jeromy Cannon <jeromy@swirldslabs.com>
    Date:   Mon Jan 22 13:23:21 2024 +0000

        feat: switch from envoy gateway to services/ingress (#672)

        Signed-off-by: Jeromy Cannon <jeromy@swirldslabs.com>

    commit 1a5981b
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Mon Jan 22 16:54:43 2024 +1100

        fix: e2e tests and CI pipelline

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit 90b0f4d
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Mon Jan 22 15:54:08 2024 +1100

        fix: check for namespace

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit 12c94ab
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Mon Jan 22 15:45:44 2024 +1100

        fix node setup

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit 214daba
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Mon Jan 22 15:12:31 2024 +1100

        fix: use default namespace for cluster setup

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit b663d57
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Mon Jan 22 14:56:55 2024 +1100

        fix: get pod IP and copy files checks

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit ec8dd5c
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Mon Jan 22 14:56:43 2024 +1100

        fix: split platform code copy and extract into separate steps for better tracking

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit 6a4226c
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Mon Jan 22 11:29:17 2024 +1100

        fix: do not require kind and cluster creation functionalities

        User is expected to bring their own kubernetes cluster

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit 75f3c63
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Fri Jan 19 14:51:41 2024 +1100

        test: fix tests for missing kubect2

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit 26dc63c
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Fri Jan 19 14:49:49 2024 +1100

        fix: use Kubect2 for node commands

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit 1415260
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Fri Jan 19 12:37:38 2024 +1100

        fix: replace old kubectl with kubectl2 in chart command

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit f24f9d3
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Thu Jan 18 13:51:51 2024 +1100

        remove unused import

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit 82a80f4
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Wed Jan 17 16:20:53 2024 +1100

        feat: implement wait for pod and add check for copy methods

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit 841bc53
    Author: JeffreyDallas <39912573+JeffreyDallas@users.noreply.github.com>
    Date:   Wed Jan 17 10:18:46 2024 -0600

        chore: remove unnecessary gralde.properties (#667)

        Signed-off-by: Jeffrey Tang <jeffrey@swirldslabs.com>

    commit 02fdaa8
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Wed Jan 17 16:19:05 2024 +1100

        fix: remove unnecessary polling from exec call and cache configManager for cli args

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit d51cdfa
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Wed Jan 17 15:54:54 2024 +1100

        fix: refactor config manager to contain the config

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit 2eddad2
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Tue Jan 16 14:32:46 2024 +1100

        feat: implement port forward and polling utility function

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit fc26a01
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Tue Jan 16 09:30:05 2024 +1100

        fix: use exec status to exit from polling and code cleanup

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit 7e03a6e
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Mon Jan 15 18:44:52 2024 +1100

        remove incorrect docs

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit aad0af9
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Mon Jan 15 18:41:27 2024 +1100

        add timeout arg

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit 33913a9
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Mon Jan 15 18:36:43 2024 +1100

        fix: rewrite async function of a promise with polling

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit cade2bc
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Mon Jan 15 16:10:31 2024 +1100

        fix: remove unused args

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit 66a4817
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Mon Jan 15 16:09:32 2024 +1100

        feat: implement hasDir and hasFile

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit f90450c
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Mon Jan 15 16:00:48 2024 +1100

        cleanup

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit df76d00
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Mon Jan 15 15:36:45 2024 +1100

        feat: implement copy file to container

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit bfd72cf
    Author: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
    Date:   Mon Jan 15 12:14:22 2024 +1100

        feat: implement Kubectl class using kubernetes javascript client

        Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>

    commit c1a7651
    Author: swirlds-automation <swirlds-eng-automation@swirlds.com>
    Date:   Fri Jan 12 16:07:22 2024 +0000

        chore(release): 0.17.0 [skip ci]

        ## [0.17.0](v0.16.0...v0.17.0) (2024-01-12)

        ### Features

        * version bump ([46d58f2](46d58f2))

        ### Bug Fixes

        * allow using an existing cluster and do not require kind ([#643](#643)) ([6b53618](6b53618))
        * make delete cluster ([#656](#656)) ([ba7426f](ba7426f))

    commit 46d58f2
    Author: Jeromy Cannon <jeromy@swirldslabs.com>
    Date:   Fri Jan 12 15:37:52 2024 +0000

        feat: version bump

        Signed-off-by: Jeromy Cannon <jeromy@swirldslabs.com>

    commit 35d0250
    Author: Jeromy Cannon <jeromy@swirldslabs.com>
    Date:   Fri Jan 12 14:50:02 2024 +0000

        chore: remove axios and follow-redirect, and upgrade @hashgraph/sdk to 2.40.0 (#661)

        Signed-off-by: Jeromy Cannon <jeromy@swirldslabs.com>

    Signed-off-by: Jeromy Cannon <jeromy@swirldslabs.com>

Signed-off-by: Jeromy Cannon <jeromy@swirldslabs.com>
  • Loading branch information
jeromy-cannon committed Jan 25, 2024
1 parent b2250cb commit 5980f63
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 3 deletions.
27 changes: 25 additions & 2 deletions fullstack-network-manager/src/commands/chart.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,10 @@ export class ChartCommand extends BaseCommand {
task: async (ctx, task) => {
self.configManager.load(argv)
const namespace = self.configManager.getFlag(flags.namespace)
const deletePvcs = self.configManager.getFlag(flags.deletePvcs)
ctx.config = {
namespace: await prompts.promptNamespaceArg(task, namespace)
namespace: await prompts.promptNamespaceArg(task, namespace),
deletePvcs: await prompts.promptDeletePvcs(task, deletePvcs)
}
}
},
Expand All @@ -186,6 +188,24 @@ export class ChartCommand extends BaseCommand {
task: async (ctx, _) => {
await self.chartManager.uninstall(ctx.config.namespace, constants.CHART_FST_DEPLOYMENT_NAME)
}
},
{
title: 'Get PVCs for namespace',
task: async (ctx, _) => {
if(ctx.config.deletePvcs === true) {
ctx.config.pvcs = await self.k8.listPvcsByNamespace(ctx.config.namespace)
}
}
},
{
title: 'Delete PVCs for namespace',
task: async (ctx, _) => {
if (ctx.config.pvcs) {
for (const pvc of ctx.config.pvcs) {
await self.k8.deletePvc(pvc, ctx.config.namespace)
}
}
}
}
], {
concurrent: false,
Expand Down Expand Up @@ -286,7 +306,10 @@ export class ChartCommand extends BaseCommand {
.command({
command: 'uninstall',
desc: 'Uninstall network deployment chart',
builder: y => flags.setCommandFlags(y, flags.namespace),
builder: y => flags.setCommandFlags(y,
flags.namespace,
flags.deletePvcs
),
handler: argv => {
chartCmd.logger.debug("==== Running 'chart uninstall' ===")
chartCmd.logger.debug(argv)
Expand Down
12 changes: 11 additions & 1 deletion fullstack-network-manager/src/commands/flags.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,15 @@ export const enableHederaExplorerTls = {
}
}

export const deletePvcs = {
name: 'delete-pvcs',
definition: {
describe: 'Delete the persistent volume claims, defaults to false',
default: false,
type: 'boolean'
}
}

export const allFlags = [
devMode,
clusterName,
Expand Down Expand Up @@ -328,5 +337,6 @@ export const allFlags = [
tlsClusterIssuerName,
tlsClusterIssuerNamespace,
enableHederaExplorerTls,
selfSignedClusterIssuer
selfSignedClusterIssuer,
deletePvcs
]
16 changes: 16 additions & 0 deletions fullstack-network-manager/src/commands/prompts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -494,3 +494,19 @@ export async function promptReplicaCount (task, input) {
throw new FullstackTestingError(`input failed: ${flags.replicaCount.name}`, e)
}
}

export async function promptDeletePvcs (task, input) {
try {
if (input === undefined) {
input = await task.prompt(ListrEnquirerPromptAdapter).run({
type: 'toggle',
default: flags.deletePvcs.definition.default,
message: 'Would you like to delete persistent volume claims upon uninstall?'
})
}

return input
} catch (e) {
throw new FullstackTestingError(`input failed: ${flags.deletePvcs.name}`, e)
}
}
33 changes: 33 additions & 0 deletions fullstack-network-manager/src/core/k8.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,39 @@ export class K8 {
})
}

/**
* Get a list of persistent volume claim names for the given namespace
* @param namespace the namespace of the persistent volume claims to return
* @returns {Promise<*[]>} list of persistent volume claims
*/
async listPvcsByNamespace (namespace) {
const pvcs = []
const resp = await this.kubeClient.listNamespacedPersistentVolumeClaim (
namespace
)

for (const item of resp.body.items) {
pvcs.push(item.metadata.name)
}

return pvcs
}

/**
* Delete a persistent volume claim
* @param name the name of the persistent volume claim to delete
* @param namespace the namespace of the persistent volume claim to delete
* @returns {Promise<boolean>} true if the persistent volume claim was deleted
*/
async deletePvc (name, namespace) {
const resp = await this.kubeClient.deleteNamespacedPersistentVolumeClaim (
name,
namespace
)

return resp.response.statusCode === 200.0
}

_getNamespace () {
const ns = this.configManager.getFlag(flags.namespace)
if (!ns) throw new MissingArgumentError('namespace is not set')
Expand Down
5 changes: 5 additions & 0 deletions fullstack-network-manager/test/e2e/core/k8_e2e.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,9 @@ describe('K8', () => {

fs.rmdirSync(tmpDir, { recursive: true })
})

it('should be able to get two persistent volume claims', async () => {
const pvcs = await k8.listPvcsByNamespace(k8._getNamespace())
expect(pvcs).toHaveLength(2)
})
})

0 comments on commit 5980f63

Please sign in to comment.