Skip to content

Commit

Permalink
remove limits
Browse files Browse the repository at this point in the history
  • Loading branch information
OliverMKing committed Oct 27, 2023
1 parent 3d27487 commit 5adce59
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 36 deletions.
20 changes: 14 additions & 6 deletions pkg/manifests/fixtures/nginx/full.json
Original file line number Diff line number Diff line change
Expand Up @@ -554,10 +554,6 @@
}
],
"resources": {
"limits": {
"cpu": "1500m",
"memory": "512Mi"
},
"requests": {
"cpu": "500m",
"memory": "127Mi"
Expand Down Expand Up @@ -633,7 +629,19 @@
"operator": "Exists"
}
],
"priorityClassName": "system-node-critical"
"priorityClassName": "system-node-critical",
"topologySpreadConstraints": [
{
"maxSkew": 1,
"topologyKey": "kubernetes.io/hostname",
"whenUnsatisfiable": "ScheduleAnyway",
"labelSelector": {
"matchLabels": {
"app": "nginx"
}
}
}
]
}
},
"strategy": {},
Expand Down Expand Up @@ -732,7 +740,7 @@
},
"minReplicas": 2,
"maxReplicas": 100,
"targetCPUUtilizationPercentage": 90
"targetCPUUtilizationPercentage": 80
},
"status": {
"currentReplicas": 0,
Expand Down
20 changes: 14 additions & 6 deletions pkg/manifests/fixtures/nginx/internal.json
Original file line number Diff line number Diff line change
Expand Up @@ -554,10 +554,6 @@
}
],
"resources": {
"limits": {
"cpu": "1500m",
"memory": "512Mi"
},
"requests": {
"cpu": "500m",
"memory": "127Mi"
Expand Down Expand Up @@ -633,7 +629,19 @@
"operator": "Exists"
}
],
"priorityClassName": "system-node-critical"
"priorityClassName": "system-node-critical",
"topologySpreadConstraints": [
{
"maxSkew": 1,
"topologyKey": "kubernetes.io/hostname",
"whenUnsatisfiable": "ScheduleAnyway",
"labelSelector": {
"matchLabels": {
"app": "nginx"
}
}
}
]
}
},
"strategy": {},
Expand Down Expand Up @@ -732,7 +740,7 @@
},
"minReplicas": 2,
"maxReplicas": 100,
"targetCPUUtilizationPercentage": 90
"targetCPUUtilizationPercentage": 80
},
"status": {
"currentReplicas": 0,
Expand Down
20 changes: 14 additions & 6 deletions pkg/manifests/fixtures/nginx/kube-system.json
Original file line number Diff line number Diff line change
Expand Up @@ -476,10 +476,6 @@
}
],
"resources": {
"limits": {
"cpu": "1500m",
"memory": "512Mi"
},
"requests": {
"cpu": "500m",
"memory": "127Mi"
Expand Down Expand Up @@ -555,7 +551,19 @@
"operator": "Exists"
}
],
"priorityClassName": "system-node-critical"
"priorityClassName": "system-node-critical",
"topologySpreadConstraints": [
{
"maxSkew": 1,
"topologyKey": "kubernetes.io/hostname",
"whenUnsatisfiable": "ScheduleAnyway",
"labelSelector": {
"matchLabels": {
"app": "nginx"
}
}
}
]
}
},
"strategy": {},
Expand Down Expand Up @@ -630,7 +638,7 @@
},
"minReplicas": 2,
"maxReplicas": 100,
"targetCPUUtilizationPercentage": 90
"targetCPUUtilizationPercentage": 80
},
"status": {
"currentReplicas": 0,
Expand Down
20 changes: 14 additions & 6 deletions pkg/manifests/fixtures/nginx/no-ownership.json
Original file line number Diff line number Diff line change
Expand Up @@ -490,10 +490,6 @@
}
],
"resources": {
"limits": {
"cpu": "1500m",
"memory": "512Mi"
},
"requests": {
"cpu": "500m",
"memory": "127Mi"
Expand Down Expand Up @@ -569,7 +565,19 @@
"operator": "Exists"
}
],
"priorityClassName": "system-node-critical"
"priorityClassName": "system-node-critical",
"topologySpreadConstraints": [
{
"maxSkew": 1,
"topologyKey": "kubernetes.io/hostname",
"whenUnsatisfiable": "ScheduleAnyway",
"labelSelector": {
"matchLabels": {
"app": "nginx"
}
}
}
]
}
},
"strategy": {},
Expand Down Expand Up @@ -644,7 +652,7 @@
},
"minReplicas": 2,
"maxReplicas": 100,
"targetCPUUtilizationPercentage": 90
"targetCPUUtilizationPercentage": 80
},
"status": {
"currentReplicas": 0,
Expand Down
20 changes: 14 additions & 6 deletions pkg/manifests/fixtures/nginx/optional-features-disabled.json
Original file line number Diff line number Diff line change
Expand Up @@ -489,10 +489,6 @@
}
],
"resources": {
"limits": {
"cpu": "1500m",
"memory": "512Mi"
},
"requests": {
"cpu": "500m",
"memory": "127Mi"
Expand Down Expand Up @@ -568,7 +564,19 @@
"operator": "Exists"
}
],
"priorityClassName": "system-node-critical"
"priorityClassName": "system-node-critical",
"topologySpreadConstraints": [
{
"maxSkew": 1,
"topologyKey": "kubernetes.io/hostname",
"whenUnsatisfiable": "ScheduleAnyway",
"labelSelector": {
"matchLabels": {
"app": "nginx"
}
}
}
]
}
},
"strategy": {},
Expand Down Expand Up @@ -643,7 +651,7 @@
},
"minReplicas": 2,
"maxReplicas": 100,
"targetCPUUtilizationPercentage": 90
"targetCPUUtilizationPercentage": 80
},
"status": {
"currentReplicas": 0,
Expand Down
18 changes: 12 additions & 6 deletions pkg/manifests/nginx.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,8 @@ func newNginxIngressControllerDeployment(conf *config.Config, ingressConfig *Ngi
podAnnotations[k] = v
}

selector := &metav1.LabelSelector{MatchLabels: ingressConfig.PodLabels()}

return &appsv1.Deployment{
TypeMeta: metav1.TypeMeta{
Kind: "Deployment",
Expand All @@ -405,13 +407,21 @@ func newNginxIngressControllerDeployment(conf *config.Config, ingressConfig *Ngi
},
Spec: appsv1.DeploymentSpec{
RevisionHistoryLimit: util.Int32Ptr(2),
Selector: &metav1.LabelSelector{MatchLabels: ingressConfig.PodLabels()},
Selector: selector,
Template: corev1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Labels: ingressControllerPodLabels,
Annotations: podAnnotations,
},
Spec: *WithPreferSystemNodes(&corev1.PodSpec{
TopologySpreadConstraints: []corev1.TopologySpreadConstraint{
{
MaxSkew: 1,
TopologyKey: "kubernetes.io/hostname", // spread across nodes
WhenUnsatisfiable: corev1.ScheduleAnyway,
LabelSelector: selector,
},
},
ServiceAccountName: ingressConfig.ResourceName,
Containers: []corev1.Container{*withPodRefEnvVars(withTypicalReadinessProbe(10254, &corev1.Container{
Name: "controller",
Expand Down Expand Up @@ -446,10 +456,6 @@ func newNginxIngressControllerDeployment(conf *config.Config, ingressConfig *Ngi
corev1.ResourceCPU: resource.MustParse("500m"),
corev1.ResourceMemory: resource.MustParse("127Mi"),
},
Limits: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("1500m"),
corev1.ResourceMemory: resource.MustParse("512Mi"),
},
},
}))},
}),
Expand Down Expand Up @@ -517,7 +523,7 @@ func newNginxIngressControllerHPA(conf *config.Config, ingressConfig *NginxIngre
},
MinReplicas: util.Int32Ptr(2),
MaxReplicas: 100,
TargetCPUUtilizationPercentage: util.Int32Ptr(90),
TargetCPUUtilizationPercentage: util.Int32Ptr(80),
},
}
}

0 comments on commit 5adce59

Please sign in to comment.