mirror of https://github.com/kubernetes/kops.git
Merge pull request #14282 from hakman/hetzner_decrease_ig
Delete the oldest servers when over the desired count for Hetzner
This commit is contained in:
commit
51d609c572
|
|
@ -88,12 +88,18 @@ func (v *ServerGroup) Find(c *fi.Context) (*ServerGroup, error) {
|
|||
actual.Count = len(servers)
|
||||
|
||||
// Find servers that need to be updated
|
||||
for _, server := range servers {
|
||||
for i, server := range servers {
|
||||
// Ignore servers that are already labeled as needing update
|
||||
if _, ok := server.Labels[hetzner.TagKubernetesInstanceNeedsUpdate]; ok {
|
||||
continue
|
||||
}
|
||||
|
||||
// Check if server index is higher than desired count
|
||||
if i >= v.Count {
|
||||
actual.NeedUpdate = append(actual.NeedUpdate, server.Name)
|
||||
continue
|
||||
}
|
||||
|
||||
// Check if server matches the expected group template
|
||||
if server.Labels[hetzner.TagKubernetesInstanceUserData] != userDataHash {
|
||||
actual.NeedUpdate = append(actual.NeedUpdate, server.Name)
|
||||
|
|
|
|||
Loading…
Reference in New Issue