This is the pattern we use in IA C# 2.8.1:
static async Task<int> Main(string[] args)
{
try
{
Console.WriteLine($"Service starting at {DateTime.Now}");
var cancelTokenSource = new CancellationTokenSource();
AppDomain.CurrentDomain.ProcessExit += (s, e) =>
{
Console.WriteLine("Exiting");
cancelTokenSource.Cancel();
};
await Task.Delay(-1, cancelTokenSource.Token);
return 0;
}
catch (TaskCanceledException)
{
// Don't care as this is thrown by Task.Delay()
Console.WriteLine("Process exit via TaskCanceledException
(SIGTERM)");
return 0;
}
catch (Exception e)
{
Console.WriteLine($"Unhandled exception: {e}");
Console.WriteLine($"Stack trace: {e.StackTrace}");
return -1;
}
}
On Sat, Jan 16, 2021 at 7:22 PM Vishwas Bm <[email protected]> wrote:
> Hi Alexandr,
>
> Thanks for the response.
>
> It is with native persistence being enabled. Will there be any
> difference, with and without persistence ?
> The docker image and the statefulset is created based on the below ignite
> documentation:
>
> https://github.com/apache/ignite/blob/master/docker/apache-ignite/Dockerfile
>
> https://apacheignite.readme.io/docs/stateful-deployment#statefulset-deployment
>
> The docker image is based on ignite-2.9.0 release and we had put debug
> statements in onDisconnected method call but we do not see any
> of those prints in the case of "kubectl delete pod"
>
> Also what is the code in ignite which handles KILL SIG ?
>
>
> *Thanks & Regards,*
>
> *Vishwas *
>
>
> On Fri, Jan 15, 2021 at 8:10 PM Alexandr Shapkin <[email protected]>
> wrote:
>
>> Hi,
>>
>>
>>
>> Thanks for the ticket. I’ll check that.
>>
>>
>>
>> What configuration do you use, is it a persistent cluster or in-memory
>> one?
>>
>> Do you use an official Ignite image or a custom assembly?
>>
>>
>>
>> 'kubectl delete pod' should work fine here and forward KILL SIG to a
>> running node internally.
>>
>> Well, at least starting from 2.9 version.
>>
>>
>>
>>
>>
>> *From: *vbm <[email protected]>
>> *Sent: *Wednesday, January 13, 2021 11:32 AM
>> *To: *[email protected]
>> *Subject: *Ignite best practice for restarting k8s pod
>>
>>
>>
>> Hi,
>>
>>
>>
>> I had raised this ticket:
>>
>> https://issues.apache.org/jira/browse/IGNITE-13974
>>
>>
>>
>>
>>
>> Currently I do not see any cleanup functions getting called when we do a
>>
>> 'kubectl delete pod'.
>>
>>
>>
>> May I know, what is the best practice for restarting k8s ignite pod ?
>>
>> How do we handle scenario when we need to scale down Ignite pods ? I think
>>
>> internally when we do kubectl scale down it calls kubectl delete pod.
>>
>>
>>
>>
>>
>> Regards,
>>
>> Vishwas
>>
>>
>>
>>
>>
>>
>>
>> --
>>
>> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>>
>>
>>
>
--
<http://www.trimble.com/>
Raymond Wilson
Solution Architect, Civil Construction Software Systems (CCSS)
11 Birmingham Drive | Christchurch, New Zealand
[email protected]
<https://worksos.trimble.com/?utm_source=Trimble&utm_medium=emailsign&utm_campaign=Launch>