modify proxy tunnel with NEW IP etc, update local config to match
This commit is contained in:
parent
f5e01ba3c2
commit
288b39c2e7
@ -88,22 +88,22 @@ func AWSMoveInstance(config state.Config) (state.Config) {
|
|||||||
}
|
}
|
||||||
fmt.Printf("instance is ready:\t\t%s (took %s)\n", newInstanceID, time.Since(t).Round(100*time.Millisecond).String())
|
fmt.Printf("instance is ready:\t\t%s (took %s)\n", newInstanceID, time.Since(t).Round(100*time.Millisecond).String())
|
||||||
|
|
||||||
|
// update local config to match new instance
|
||||||
|
config = AWSUpdateService(config, region, serviceUUID, newInstanceID)
|
||||||
|
|
||||||
// Reconfigure Proxy to new instance
|
// Reconfigure Proxy to new instance
|
||||||
t = time.Now()
|
t = time.Now()
|
||||||
m := pcsdk.NewCommandModify(instance.ServicePort, instance.ServiceIP, serviceUUID)
|
m := pcsdk.NewCommandModify(config.MTD.Services[serviceUUID].ServicePort, config.MTD.Services[serviceUUID].ServiceIP, serviceUUID)
|
||||||
err = m.Execute(netip.AddrPortFrom(instance.EntryIP, config.MTD.ManagementPort))
|
err = m.Execute(netip.AddrPortFrom(config.MTD.Services[serviceUUID].EntryIP, config.MTD.ManagementPort))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("error executing modify command: %s\n", err)
|
fmt.Printf("error executing modify command: %s\n", err)
|
||||||
return config
|
return config
|
||||||
}
|
}
|
||||||
fmt.Printf("Proxy modified. (took %s)\n", time.Since(t).Round(100*time.Millisecond).String())
|
fmt.Printf("Proxy modified. (took %s)\n", time.Since(t).Round(100*time.Millisecond).String())
|
||||||
|
|
||||||
|
// take care of old instance, deregister image and delete snapshot
|
||||||
AWSUpdateService(config, region, serviceUUID, newInstanceID)
|
|
||||||
|
|
||||||
cleanupAWS(svc, config, instanceID, imageName)
|
cleanupAWS(svc, config, instanceID, imageName)
|
||||||
|
|
||||||
|
|
||||||
return config
|
return config
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +129,10 @@ func AWSUpdateService(config state.Config, region string, service state.CustomUU
|
|||||||
}
|
}
|
||||||
cloudid := GetCloudID(formattedinstance)
|
cloudid := GetCloudID(formattedinstance)
|
||||||
serviceip := netip.MustParseAddr(publicAddr)
|
serviceip := netip.MustParseAddr(publicAddr)
|
||||||
config.MTD.Services[service] = state.Service{CloudID: cloudid, ServiceIP: serviceip}
|
s := config.MTD.Services[service]
|
||||||
|
s.CloudID = cloudid
|
||||||
|
s.ServiceIP = serviceip
|
||||||
|
config.MTD.Services[service] = s
|
||||||
return config
|
return config
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user