canonical / k8s-snap

Canonical Kubernetes is an opinionated and CNCF conformant Kubernetes operated by Snaps and Charms, which come together to bring simplified operations and an enhanced security posture on any infrastructure.
GNU General Public License v3.0
20 stars 6 forks source link

Microcluster timeouts during `k8s bootstrap` and `k8s join-cluster` #520

Closed neoaggelos closed 4 days ago

neoaggelos commented 5 days ago

Summary

This is a pre-requisite for fixing how k8sd cleans up when a bootstrap or join cluster operation fails.

Merge after #518

Changes

Handle context cancellations during the bootstrap and join hooks. Without this change:

  1. microcluster always applies a 30-second timeout if the context has no deadline set, effectively ignoring the timeout passed by the client
  2. context deadline exceeded now cancels the bootstrap or join hook. Previously, this was using s.Context (from microcluster daemon), and therefore the hooks would keep running.