Skip to content

Commit

Permalink
Fuji api removal after sync (#2098)
Browse files Browse the repository at this point in the history
* do not remove fuji api node condition on node sync restart

* nit
  • Loading branch information
felipemadero authored Aug 29, 2024
1 parent d16832b commit f4628c7
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
14 changes: 12 additions & 2 deletions cmd/nodecmd/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,20 @@ func trackSubnet(
nodeResults.AddResult(host.NodeID, nil, err)
}

if err := ssh.RunSSHRenderAvagoAliasConfigFile(host, blockchainID.String(), subnetAliases); err != nil {
if err := ssh.RunSSHRenderAvagoAliasConfigFile(
host,
blockchainID.String(),
subnetAliases,
); err != nil {
nodeResults.AddResult(host.NodeID, nil, err)
}
if err := ssh.RunSSHRenderAvalancheNodeConfig(app, host, network, allSubnets); err != nil {
if err := ssh.RunSSHRenderAvalancheNodeConfig(
app,
host,
network,
allSubnets,
clusterConf.IsAPIHost(host.GetCloudID()),
); err != nil {
nodeResults.AddResult(host.NodeID, nil, err)
}
if err := ssh.RunSSHSyncSubnetData(app, host, network, subnetName); err != nil {
Expand Down
8 changes: 7 additions & 1 deletion cmd/nodecmd/update_subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,13 @@ func doUpdateSubnet(
if err := ssh.RunSSHStopNode(host); err != nil {
nodeResults.AddResult(host.NodeID, nil, err)
}
if err := ssh.RunSSHRenderAvalancheNodeConfig(app, host, network, allSubnets); err != nil {
if err := ssh.RunSSHRenderAvalancheNodeConfig(
app,
host,
network,
allSubnets,
clusterConf.IsAPIHost(host.GetCloudID()),
); err != nil {
nodeResults.AddResult(host.NodeID, nil, err)
}
if err := ssh.RunSSHSyncSubnetData(app, host, network, subnetName); err != nil {
Expand Down
11 changes: 8 additions & 3 deletions pkg/ssh/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,13 @@ func RunSSHRenderAvagoAliasConfigFile(
}

// RunSSHRenderAvalancheNodeConfig renders avalanche node config to a remote host via SSH.
func RunSSHRenderAvalancheNodeConfig(app *application.Avalanche, host *models.Host, network models.Network, trackSubnets []string) error {
func RunSSHRenderAvalancheNodeConfig(
app *application.Avalanche,
host *models.Host,
network models.Network,
trackSubnets []string,
isAPIHost bool,
) error {
// get subnet ids
subnetIDs, err := utils.MapWithError(trackSubnets, func(subnetName string) (string, error) {
sc, err := app.LoadSidecar(subnetName)
Expand All @@ -550,8 +556,7 @@ func RunSSHRenderAvalancheNodeConfig(app *application.Avalanche, host *models.Ho
if genesisFileExists(host) {
avagoConf.GenesisPath = filepath.Join(constants.DockerNodeConfigPath, constants.GenesisFileName)
}
// make sure that wiz works. TODO switch to RPC over SSH client to access 127.0.0.1 instead
if network.Kind == models.Local || network.Kind == models.Devnet {
if network.Kind == models.Local || network.Kind == models.Devnet || isAPIHost {
avagoConf.HTTPHost = "0.0.0.0"
}
remoteAvagoConf, err := getAvalancheGoConfigData(host)
Expand Down

0 comments on commit f4628c7

Please sign in to comment.