mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	eviction message now includes resource that was exhausted
This commit is contained in:
		@@ -17,6 +17,7 @@ limitations under the License.
 | 
				
			|||||||
package eviction
 | 
					package eviction
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
 | 
						"fmt"
 | 
				
			||||||
	"sort"
 | 
						"sort"
 | 
				
			||||||
	"sync"
 | 
						"sync"
 | 
				
			||||||
	"time"
 | 
						"time"
 | 
				
			||||||
@@ -113,7 +114,7 @@ func (m *managerImpl) Admit(attrs *lifecycle.PodAdmitAttributes) lifecycle.PodAd
 | 
				
			|||||||
	return lifecycle.PodAdmitResult{
 | 
						return lifecycle.PodAdmitResult{
 | 
				
			||||||
		Admit:   false,
 | 
							Admit:   false,
 | 
				
			||||||
		Reason:  reason,
 | 
							Reason:  reason,
 | 
				
			||||||
		Message: message,
 | 
							Message: fmt.Sprintf(message, m.nodeConditions),
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -254,11 +255,11 @@ func (m *managerImpl) synchronize(diskInfoProvider DiskInfoProvider, podFunc Act
 | 
				
			|||||||
		pod := activePods[i]
 | 
							pod := activePods[i]
 | 
				
			||||||
		status := api.PodStatus{
 | 
							status := api.PodStatus{
 | 
				
			||||||
			Phase:   api.PodFailed,
 | 
								Phase:   api.PodFailed,
 | 
				
			||||||
			Message: message,
 | 
								Message: fmt.Sprintf(message, resourceToReclaim),
 | 
				
			||||||
			Reason:  reason,
 | 
								Reason:  reason,
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		// record that we are evicting the pod
 | 
							// record that we are evicting the pod
 | 
				
			||||||
		m.recorder.Eventf(pod, api.EventTypeWarning, reason, message)
 | 
							m.recorder.Eventf(pod, api.EventTypeWarning, reason, fmt.Sprintf(message, resourceToReclaim))
 | 
				
			||||||
		gracePeriodOverride := int64(0)
 | 
							gracePeriodOverride := int64(0)
 | 
				
			||||||
		if softEviction {
 | 
							if softEviction {
 | 
				
			||||||
			gracePeriodOverride = m.config.MaxPodGracePeriodSeconds
 | 
								gracePeriodOverride = m.config.MaxPodGracePeriodSeconds
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -38,7 +38,7 @@ const (
 | 
				
			|||||||
	// the reason reported back in status.
 | 
						// the reason reported back in status.
 | 
				
			||||||
	reason = "Evicted"
 | 
						reason = "Evicted"
 | 
				
			||||||
	// the message associated with the reason.
 | 
						// the message associated with the reason.
 | 
				
			||||||
	message = "The node was low on compute resources."
 | 
						message = "The node was low on resource: %v."
 | 
				
			||||||
	// disk, in bytes.  internal to this module, used to account for local disk usage.
 | 
						// disk, in bytes.  internal to this module, used to account for local disk usage.
 | 
				
			||||||
	resourceDisk api.ResourceName = "disk"
 | 
						resourceDisk api.ResourceName = "disk"
 | 
				
			||||||
	// inodes, number. internal to this module, used to account for local disk inode consumption.
 | 
						// inodes, number. internal to this module, used to account for local disk inode consumption.
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user