Skip to content

Commit 2fb8632

Browse files
committed
feat: default resources for Operator and Integration Pods
Closes #5601
1 parent 39bfbb7 commit 2fb8632

19 files changed

+190
-93
lines changed

docs/modules/ROOT/pages/installation/advanced/resources.adoc

+25-9
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,41 @@ The option accept a value in the following format `Key[=Value]:Effect[:Seconds]`
3434
While installing the Camel K operator, you can also specify the resources requests and limits to assign to the operator `Pod` with `--operator-resources` option. The option will expect the configuration as required by https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/[Kubernetes Resource Management].
3535

3636
```
37-
kamel install --operator-resources requests.cpu=256m --operator-resources limits.cpu=500m --operator-resources limits.memory=512Mi ...
37+
kamel install --operator-resources limits.cpu=8 --operator-resources limits.memory=32Gi ...
3838
```
3939

4040
The value expected by the option are in the form `requestType.requestResource=value` where `requestType` must be either `requests` or `limits`, `requestResource` must be either `cpu` or `memory` and `value` expressed in the numeric value as expected by the resource. You can specify more than one `operator-resources`.
4141

4242
NOTE: if you specify a limit, but does not specify a request, Kubernetes automatically assigns a request that matches the limit.
4343

44-
=== Suggested configuration
44+
=== Default Operator Pod configuration
4545

46-
The main contributor to compute resources consumption is likely to be the Maven builds that are performed in the operator `Pod` (assuming you use the default build strategy). So the resource requirements should be defined accordingly. The following requirements are sensible defaults that should work in most cases:
46+
The main Camel K Operator Pod contributor resources consumption is likely to be the number of parallel builds that are performed in the operator `Pod`. So the resource requirements should be defined accordingly. The following requirements are sensible defaults that should work in most cases:
4747

4848
```
4949
resources:
50-
limits:
51-
cpu: "1"
52-
memory: 1Gi
5350
requests:
54-
cpu: 500m
55-
memory: 512Mi
51+
memory: "4Gi"
52+
cpu: "1"
53+
limits:
54+
memory: "16Gi"
55+
cpu: "4"
5656
```
5757

58-
Note that if you plan to perform **native builds**, then the memory requirements must be increased significantly. Also, the CPU requirements are rather "soft", in the sense that it won't break the operator, but it'll perform slower in general.
58+
Note that if you plan to perform **native builds**, then the memory requirements may be increased significantly. Also, the CPU requirements are rather "soft", in the sense that it won't break the operator, but it'll perform slower in general.
59+
60+
=== Default Integration Pod configuration
61+
62+
The resource set on the container here is highly dependant on what your application is doing. You can control this behavior by setting opportunely the resources on the Integration via container trait.
63+
64+
Be aware that the default are actually the following:
65+
66+
```
67+
resources:
68+
requests:
69+
memory: "256Mi"
70+
cpu: "125m"
71+
limits:
72+
memory: "1Gi"
73+
cpu: "500m"
74+
```

docs/modules/ROOT/partials/apis/camel-k-crds.adoc

+4-4
Original file line numberDiff line numberDiff line change
@@ -6473,28 +6473,28 @@ string
64736473
|
64746474
64756475
6476-
The minimum amount of CPU required.
6476+
The minimum amount of CPU required (default 125 millicores).
64776477
64786478
|`requestMemory` +
64796479
string
64806480
|
64816481
64826482
6483-
The minimum amount of memory required.
6483+
The minimum amount of memory required (default 128 Mi).
64846484
64856485
|`limitCPU` +
64866486
string
64876487
|
64886488
64896489
6490-
The maximum amount of CPU required.
6490+
The maximum amount of CPU to be provided (default 500 millicores).
64916491
64926492
|`limitMemory` +
64936493
string
64946494
|
64956495
64966496
6497-
The maximum amount of memory required.
6497+
The maximum amount of memory to be provided (default 512 Mi).
64986498
64996499
|`expose` +
65006500
bool

docs/modules/traits/pages/container.adoc

+4-4
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,19 @@ The following configuration options are available:
3737

3838
| container.request-cpu
3939
| string
40-
| The minimum amount of CPU required.
40+
| The minimum amount of CPU required (default 125 millicores).
4141

4242
| container.request-memory
4343
| string
44-
| The minimum amount of memory required.
44+
| The minimum amount of memory required (default 128 Mi).
4545

4646
| container.limit-cpu
4747
| string
48-
| The maximum amount of CPU required.
48+
| The maximum amount of CPU to be provided (default 500 millicores).
4949

5050
| container.limit-memory
5151
| string
52-
| The maximum amount of memory required.
52+
| The maximum amount of memory to be provided (default 512 Mi).
5353

5454
| container.expose
5555
| bool

e2e/advanced/integration_profile_test.go

+2-14
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func TestIntegrationProfile(t *testing.T) {
4848
integrationProfile.SetOperatorID(operatorID)
4949
integrationProfile.Spec.Traits.Container = &traitv1.ContainerTrait{
5050
Name: "ck-integration-global",
51-
LimitCPU: "0.2",
51+
LimitCPU: "0.3",
5252
}
5353

5454
g.Expect(CreateIntegrationProfile(t, ctx, &integrationProfile)).To(Succeed())
@@ -58,7 +58,7 @@ func TestIntegrationProfile(t *testing.T) {
5858
integrationProfile := v1.NewIntegrationProfile(ns1, "ipr-local")
5959
integrationProfile.SetOperatorID(operatorID)
6060
integrationProfile.Spec.Traits.Container = &traitv1.ContainerTrait{
61-
LimitCPU: "0.1",
61+
LimitCPU: "0.2",
6262
}
6363
g.Expect(CreateIntegrationProfile(t, ctx, &integrationProfile)).To(Succeed())
6464
g.Eventually(SelectedIntegrationProfilePhase(t, ctx, ns1, "ipr-local"), TestTimeoutMedium).Should(Equal(v1.IntegrationProfilePhaseReady))
@@ -106,18 +106,6 @@ func TestIntegrationProfile(t *testing.T) {
106106
g.Expect(Kamel(t, ctx, "delete", "limited", "-n", ns1).Execute()).To(Succeed())
107107
})
108108

109-
t.Run("Run integration without integration profile", func(t *testing.T) {
110-
g.Expect(KamelRunWithID(t, ctx, operatorID, ns1, "--name", "normal", "files/yaml.yaml").Execute()).To(Succeed())
111-
g.Eventually(IntegrationPod(t, ctx, ns1, "normal"), TestTimeoutShort).Should(Not(BeNil()))
112-
g.Eventually(IntegrationPodHas(t, ctx, ns1, "normal", func(pod *corev1.Pod) bool {
113-
if len(pod.Spec.Containers) != 1 {
114-
return false
115-
}
116-
cpuLimits := pod.Spec.Containers[0].Resources.Limits.Cpu()
117-
return cpuLimits == nil || cpuLimits.IsZero()
118-
}), TestTimeoutShort).Should(BeTrue())
119-
})
120-
121109
// Clean up
122110
g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns1).Execute()).To(Succeed())
123111
})

e2e/advanced/local_platform_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func TestLocalPlatform(t *testing.T) {
6565
pl.SetOperatorID(operatorID)
6666

6767
pl.Spec.Traits.Container = &traitv1.ContainerTrait{
68-
LimitCPU: "0.1",
68+
LimitCPU: "0.2",
6969
}
7070
})).To(Succeed())
7171

helm/camel-k/crds/crd-integration-platform.yaml

+16-8
Original file line numberDiff line numberDiff line change
@@ -734,10 +734,12 @@ spec:
734734
- IfNotPresent
735735
type: string
736736
limitCPU:
737-
description: The maximum amount of CPU required.
737+
description: The maximum amount of CPU to be provided (default
738+
500 millicores).
738739
type: string
739740
limitMemory:
740-
description: The maximum amount of memory required.
741+
description: The maximum amount of memory to be provided (default
742+
512 Mi).
741743
type: string
742744
name:
743745
description: The main container name. It's named `integration`
@@ -753,10 +755,12 @@ spec:
753755
the `expose` parameter is true.
754756
type: string
755757
requestCPU:
756-
description: The minimum amount of CPU required.
758+
description: The minimum amount of CPU required (default 125
759+
millicores).
757760
type: string
758761
requestMemory:
759-
description: The minimum amount of memory required.
762+
description: The minimum amount of memory required (default
763+
128 Mi).
760764
type: string
761765
runAsNonRoot:
762766
description: Security Context RunAsNonRoot configuration (default
@@ -2766,10 +2770,12 @@ spec:
27662770
- IfNotPresent
27672771
type: string
27682772
limitCPU:
2769-
description: The maximum amount of CPU required.
2773+
description: The maximum amount of CPU to be provided (default
2774+
500 millicores).
27702775
type: string
27712776
limitMemory:
2772-
description: The maximum amount of memory required.
2777+
description: The maximum amount of memory to be provided (default
2778+
512 Mi).
27732779
type: string
27742780
name:
27752781
description: The main container name. It's named `integration`
@@ -2785,10 +2791,12 @@ spec:
27852791
the `expose` parameter is true.
27862792
type: string
27872793
requestCPU:
2788-
description: The minimum amount of CPU required.
2794+
description: The minimum amount of CPU required (default 125
2795+
millicores).
27892796
type: string
27902797
requestMemory:
2791-
description: The minimum amount of memory required.
2798+
description: The minimum amount of memory required (default
2799+
128 Mi).
27922800
type: string
27932801
runAsNonRoot:
27942802
description: Security Context RunAsNonRoot configuration (default

helm/camel-k/crds/crd-integration-profile.yaml

+16-8
Original file line numberDiff line numberDiff line change
@@ -611,10 +611,12 @@ spec:
611611
- IfNotPresent
612612
type: string
613613
limitCPU:
614-
description: The maximum amount of CPU required.
614+
description: The maximum amount of CPU to be provided (default
615+
500 millicores).
615616
type: string
616617
limitMemory:
617-
description: The maximum amount of memory required.
618+
description: The maximum amount of memory to be provided (default
619+
512 Mi).
618620
type: string
619621
name:
620622
description: The main container name. It's named `integration`
@@ -630,10 +632,12 @@ spec:
630632
the `expose` parameter is true.
631633
type: string
632634
requestCPU:
633-
description: The minimum amount of CPU required.
635+
description: The minimum amount of CPU required (default 125
636+
millicores).
634637
type: string
635638
requestMemory:
636-
description: The minimum amount of memory required.
639+
description: The minimum amount of memory required (default
640+
128 Mi).
637641
type: string
638642
runAsNonRoot:
639643
description: Security Context RunAsNonRoot configuration (default
@@ -2526,10 +2530,12 @@ spec:
25262530
- IfNotPresent
25272531
type: string
25282532
limitCPU:
2529-
description: The maximum amount of CPU required.
2533+
description: The maximum amount of CPU to be provided (default
2534+
500 millicores).
25302535
type: string
25312536
limitMemory:
2532-
description: The maximum amount of memory required.
2537+
description: The maximum amount of memory to be provided (default
2538+
512 Mi).
25332539
type: string
25342540
name:
25352541
description: The main container name. It's named `integration`
@@ -2545,10 +2551,12 @@ spec:
25452551
the `expose` parameter is true.
25462552
type: string
25472553
requestCPU:
2548-
description: The minimum amount of CPU required.
2554+
description: The minimum amount of CPU required (default 125
2555+
millicores).
25492556
type: string
25502557
requestMemory:
2551-
description: The minimum amount of memory required.
2558+
description: The minimum amount of memory required (default
2559+
128 Mi).
25522560
type: string
25532561
runAsNonRoot:
25542562
description: Security Context RunAsNonRoot configuration (default

helm/camel-k/crds/crd-integration.yaml

+8-4
Original file line numberDiff line numberDiff line change
@@ -6675,10 +6675,12 @@ spec:
66756675
- IfNotPresent
66766676
type: string
66776677
limitCPU:
6678-
description: The maximum amount of CPU required.
6678+
description: The maximum amount of CPU to be provided (default
6679+
500 millicores).
66796680
type: string
66806681
limitMemory:
6681-
description: The maximum amount of memory required.
6682+
description: The maximum amount of memory to be provided (default
6683+
512 Mi).
66826684
type: string
66836685
name:
66846686
description: The main container name. It's named `integration`
@@ -6694,10 +6696,12 @@ spec:
66946696
the `expose` parameter is true.
66956697
type: string
66966698
requestCPU:
6697-
description: The minimum amount of CPU required.
6699+
description: The minimum amount of CPU required (default 125
6700+
millicores).
66986701
type: string
66996702
requestMemory:
6700-
description: The minimum amount of memory required.
6703+
description: The minimum amount of memory required (default
6704+
128 Mi).
67016705
type: string
67026706
runAsNonRoot:
67036707
description: Security Context RunAsNonRoot configuration (default

helm/camel-k/crds/crd-kamelet-binding.yaml

+8-4
Original file line numberDiff line numberDiff line change
@@ -6957,10 +6957,12 @@ spec:
69576957
- IfNotPresent
69586958
type: string
69596959
limitCPU:
6960-
description: The maximum amount of CPU required.
6960+
description: The maximum amount of CPU to be provided
6961+
(default 500 millicores).
69616962
type: string
69626963
limitMemory:
6963-
description: The maximum amount of memory required.
6964+
description: The maximum amount of memory to be provided
6965+
(default 512 Mi).
69646966
type: string
69656967
name:
69666968
description: The main container name. It's named `integration`
@@ -6976,10 +6978,12 @@ spec:
69766978
only when the `expose` parameter is true.
69776979
type: string
69786980
requestCPU:
6979-
description: The minimum amount of CPU required.
6981+
description: The minimum amount of CPU required (default
6982+
125 millicores).
69806983
type: string
69816984
requestMemory:
6982-
description: The minimum amount of memory required.
6985+
description: The minimum amount of memory required (default
6986+
128 Mi).
69836987
type: string
69846988
runAsNonRoot:
69856989
description: Security Context RunAsNonRoot configuration

helm/camel-k/crds/crd-pipe.yaml

+8-4
Original file line numberDiff line numberDiff line change
@@ -6955,10 +6955,12 @@ spec:
69556955
- IfNotPresent
69566956
type: string
69576957
limitCPU:
6958-
description: The maximum amount of CPU required.
6958+
description: The maximum amount of CPU to be provided
6959+
(default 500 millicores).
69596960
type: string
69606961
limitMemory:
6961-
description: The maximum amount of memory required.
6962+
description: The maximum amount of memory to be provided
6963+
(default 512 Mi).
69626964
type: string
69636965
name:
69646966
description: The main container name. It's named `integration`
@@ -6974,10 +6976,12 @@ spec:
69746976
only when the `expose` parameter is true.
69756977
type: string
69766978
requestCPU:
6977-
description: The minimum amount of CPU required.
6979+
description: The minimum amount of CPU required (default
6980+
125 millicores).
69786981
type: string
69796982
requestMemory:
6980-
description: The minimum amount of memory required.
6983+
description: The minimum amount of memory required (default
6984+
128 Mi).
69816985
type: string
69826986
runAsNonRoot:
69836987
description: Security Context RunAsNonRoot configuration

pkg/apis/camel/v1/trait/container.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ type ContainerTrait struct {
2828
PlatformBaseTrait `property:",squash" json:",inline"`
2929
// To automatically enable the trait
3030
Auto *bool `property:"auto" json:"auto,omitempty"`
31-
// The minimum amount of CPU required.
31+
// The minimum amount of CPU required (default 125 millicores).
3232
RequestCPU string `property:"request-cpu" json:"requestCPU,omitempty"`
33-
// The minimum amount of memory required.
33+
// The minimum amount of memory required (default 128 Mi).
3434
RequestMemory string `property:"request-memory" json:"requestMemory,omitempty"`
35-
// The maximum amount of CPU required.
35+
// The maximum amount of CPU to be provided (default 500 millicores).
3636
LimitCPU string `property:"limit-cpu" json:"limitCPU,omitempty"`
37-
// The maximum amount of memory required.
37+
// The maximum amount of memory to be provided (default 512 Mi).
3838
LimitMemory string `property:"limit-memory" json:"limitMemory,omitempty"`
3939
// Can be used to enable/disable exposure via kubernetes Service.
4040
Expose *bool `property:"expose" json:"expose,omitempty"`

0 commit comments

Comments
 (0)