cri: make swapping disabled with memory limit
OCI runtime spec defines memory.swap as 'limit of memory+Swap usage' so setting them to equal should disable the swap. Also, this change should make containerd behaviour same as other runtimes e.g 'cri-dockerd/dockershim' and won't be impacted when user turn on 'NodeSwap' (https://github.com/kubernetes/enhancements/issues/2400) feature. Signed-off-by: Qasim Sarfraz <qasimsarfraz@microsoft.com>
This commit is contained in:
		@@ -70,7 +70,10 @@ func TestUpdateOCILinuxResource(t *testing.T) {
 | 
			
		||||
				Process: &runtimespec.Process{OOMScoreAdj: oomscoreadj},
 | 
			
		||||
				Linux: &runtimespec.Linux{
 | 
			
		||||
					Resources: &runtimespec.LinuxResources{
 | 
			
		||||
						Memory: &runtimespec.LinuxMemory{Limit: proto.Int64(54321)},
 | 
			
		||||
						Memory: &runtimespec.LinuxMemory{
 | 
			
		||||
							Limit: proto.Int64(54321),
 | 
			
		||||
							Swap:  proto.Int64(54321),
 | 
			
		||||
						},
 | 
			
		||||
						CPU: &runtimespec.LinuxCPU{
 | 
			
		||||
							Shares: proto.Uint64(4444),
 | 
			
		||||
							Quota:  proto.Int64(5555),
 | 
			
		||||
@@ -113,7 +116,10 @@ func TestUpdateOCILinuxResource(t *testing.T) {
 | 
			
		||||
				Process: &runtimespec.Process{OOMScoreAdj: oomscoreadj},
 | 
			
		||||
				Linux: &runtimespec.Linux{
 | 
			
		||||
					Resources: &runtimespec.LinuxResources{
 | 
			
		||||
						Memory: &runtimespec.LinuxMemory{Limit: proto.Int64(54321)},
 | 
			
		||||
						Memory: &runtimespec.LinuxMemory{
 | 
			
		||||
							Limit: proto.Int64(54321),
 | 
			
		||||
							Swap:  proto.Int64(54321),
 | 
			
		||||
						},
 | 
			
		||||
						CPU: &runtimespec.LinuxCPU{
 | 
			
		||||
							Shares: proto.Uint64(4444),
 | 
			
		||||
							Quota:  proto.Int64(5555),
 | 
			
		||||
@@ -151,7 +157,10 @@ func TestUpdateOCILinuxResource(t *testing.T) {
 | 
			
		||||
				Process: &runtimespec.Process{OOMScoreAdj: oomscoreadj},
 | 
			
		||||
				Linux: &runtimespec.Linux{
 | 
			
		||||
					Resources: &runtimespec.LinuxResources{
 | 
			
		||||
						Memory: &runtimespec.LinuxMemory{Limit: proto.Int64(54321)},
 | 
			
		||||
						Memory: &runtimespec.LinuxMemory{
 | 
			
		||||
							Limit: proto.Int64(54321),
 | 
			
		||||
							Swap:  proto.Int64(54321),
 | 
			
		||||
						},
 | 
			
		||||
						CPU: &runtimespec.LinuxCPU{
 | 
			
		||||
							Shares: proto.Uint64(4444),
 | 
			
		||||
							Quota:  proto.Int64(5555),
 | 
			
		||||
@@ -197,7 +206,10 @@ func TestUpdateOCILinuxResource(t *testing.T) {
 | 
			
		||||
				Process: &runtimespec.Process{OOMScoreAdj: oomscoreadj},
 | 
			
		||||
				Linux: &runtimespec.Linux{
 | 
			
		||||
					Resources: &runtimespec.LinuxResources{
 | 
			
		||||
						Memory: &runtimespec.LinuxMemory{Limit: proto.Int64(54321)},
 | 
			
		||||
						Memory: &runtimespec.LinuxMemory{
 | 
			
		||||
							Limit: proto.Int64(54321),
 | 
			
		||||
							Swap:  proto.Int64(54321),
 | 
			
		||||
						},
 | 
			
		||||
						CPU: &runtimespec.LinuxCPU{
 | 
			
		||||
							Shares: proto.Uint64(4444),
 | 
			
		||||
							Quota:  proto.Int64(5555),
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user