Skip to content

Conversation

@xmonader
Copy link
Contributor

Description

Describe the changes introduced by this PR and what does it affect

Changes

List of changes this PR includes

Related Issues

List of related issues

Checklist

  • Tests included
  • Build pass
  • Documentation
  • Code format and docstring

// deployer.WithSubstrateURL("wss://tfchain.dev.grid.tf/ws"),
// deployer.WithProxyURL("https://gridproxy.dev.grid.tf"),
// deployer.WithRelayURL("wss://relay.dev.grid.tf"),
deployer.WithSubstrateURL("wss://tfchain.dev.grid.tf/ws"),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember to remove after testing

ctx := context.Background()

cluster := Cluster{
Name: "jrk8s12",
Copy link
Contributor Author

@xmonader xmonader Jul 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

definitely not jerk xD

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i meant jarvis-kubernetes-# :D
chaned

gridNet string
mnemonic string
masterPubKey string
UserID string
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why part of the client while that can get passed as an argument?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just easier to set/get, used in multiple functions

},
}

func registerDeploymentActivities(engine *ewf.Engine) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make all strings constants to be used anywhere

if err != nil {
log.Error().Err(err).Str("user_id", userIDStr).Msg("Failed to parse user ID")
c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to parse user ID"})
var cluster kubedeployer.Cluster
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be the first check in function

TaskID: wf.UUID,
Status: string(wf.Status),
Message: "Node addition workflow started successfully",
CreatedAt: wf.CreatedAt,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why u are returning CreatedAt ?

c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to update deployment in database"})
wf, err := h.ewfEngine.NewWorkflow("remove_node")
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": "Failed to create workflow"})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's already an InternalServerError(c) function defined to be used.

"deployment_name": deploymentName,
"node_name": nodeName,
c.JSON(http.StatusOK, Response{
TaskID: wf.UUID,
Copy link
Contributor

@AlaaElattar AlaaElattar Jul 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its not a task id, it is a workflow id.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also there's endpoint for checking the workflow status by its id. u don't have to return status here

return fmt.Errorf("failed to assign node IPs for added cluster: %w", err)
}

for idx, node := range addedCluster.Nodes {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if smth failed in middle what will happen when workflow engine retries? will it start the loop from beginning ?


// === Workflow DB File ===
if err := bindStringFlag(rootCmd, "workflow_db_file", "", "Workflow database file path"); err != nil {
return fmt.Errorf("failed to bind workflow_db_file flag: %w", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

u deleted workflow_db_file from Configuration struct, u should delete it from here too.

}
engine.RegisterTemplate("remove_cluster", &deleteWFTemplate)

// addNodeWFTemplate := baseWFTemplate
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove commented code

var nodeToRemove *Node
var nodeIndex int
for i, node := range cluster.Nodes {
fmt.Println("full node name:", fullNodeName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why fmt ? the app already uses logger

log.Debug().Str("user_id", userIDStr).Str("deployment_name", deploymentName).Msg("Starting deployment deletion")

cluster, err := h.db.GetClusterByName(userIDStr, deploymentName)
// TODO: load it at startup instead
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the todo please

Copy link
Contributor

@Omarabdul3ziz Omarabdul3ziz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eh el3zma de

@xmonader xmonader merged commit 9be6159 into master_ewf Jul 21, 2025
2 checks passed
@xmonader xmonader deleted the master_ewf_deployer branch July 22, 2025 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants