Skip to content

Commit d1573cf

Browse files
authored
feat: allow for setting resource limits to principal and agent (#2177)
* feat: allow for setting resource limits to principal and agent Signed-off-by: Christopher Coco <ccoco@redhat.com> * fix: address coderabbit feedback Signed-off-by: Christopher Coco <ccoco@redhat.com> * test: add unit tests for limits on principal and agent Signed-off-by: Christopher Coco <ccoco@redhat.com> --------- Signed-off-by: Christopher Coco <ccoco@redhat.com>
1 parent 64c4c8b commit d1573cf

12 files changed

Lines changed: 600 additions & 3 deletions

File tree

api/v1beta1/argocd_types.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,6 +1320,10 @@ type PrincipalSpec struct {
13201320
// Namespace is the configuration for the Principal component namespace.
13211321
Namespace *PrincipalNamespaceSpec `json:"namespace,omitempty"`
13221322

1323+
// Resources defines the Compute Resources required by the container for the Argo CD Agent principal component.
1324+
//+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Resource Requirements",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:Controller","urn:alm:descriptor:com.tectonic.ui:resourceRequirements"}
1325+
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
1326+
13231327
// ResourceProxy defines the Resource Proxy options for the Principal component.
13241328
ResourceProxy *PrincipalResourceProxySpec `json:"resourceProxy,omitempty"`
13251329

@@ -1454,6 +1458,10 @@ type AgentSpec struct {
14541458
// Redis defines the Redis options for the Agent component.
14551459
Redis *AgentRedisSpec `json:"redis,omitempty"`
14561460

1461+
// Resources defines the Compute Resources required by the container for the Argo CD Agent agent component.
1462+
//+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Resource Requirements",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:Controller","urn:alm:descriptor:com.tectonic.ui:resourceRequirements"}
1463+
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
1464+
14571465
// TLS defines the TLS options for the Agent component.
14581466
TLS *AgentTLSSpec `json:"tls,omitempty"`
14591467

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundle/manifests/argocd-operator.clusterserviceversion.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,6 +1084,20 @@ spec:
10841084
- urn:alm:descriptor:com.tectonic.ui:fieldGroup:Prometheus
10851085
- urn:alm:descriptor:com.tectonic.ui:fieldGroup:Server
10861086
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
1087+
- description: Resources defines the Compute Resources required by the container
1088+
for the Argo CD Agent agent component.
1089+
displayName: Resource Requirements
1090+
path: argoCDAgent.agent.resources
1091+
x-descriptors:
1092+
- urn:alm:descriptor:com.tectonic.ui:fieldGroup:Controller
1093+
- urn:alm:descriptor:com.tectonic.ui:resourceRequirements
1094+
- description: Resources defines the Compute Resources required by the container
1095+
for the Argo CD Agent principal component.
1096+
displayName: Resource Requirements
1097+
path: argoCDAgent.principal.resources
1098+
x-descriptors:
1099+
- urn:alm:descriptor:com.tectonic.ui:fieldGroup:Controller
1100+
- urn:alm:descriptor:com.tectonic.ui:resourceRequirements
10871101
- description: 'ClusterDomain is the cluster domain suffix used for constructing
10881102
service FQDNs. Defaults to "cluster.local". The full FQDN will be: <service>.<namespace>.svc.<clusterDomain>
10891103
This is useful for clusters that use a different DNS suffix (e.g., "CLUSTER_ID.cluster.local",

bundle/manifests/argoproj.io_argocds.yaml

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11626,6 +11626,66 @@ spec:
1162611626
server to be used by the PrincAgentipal component.
1162711627
type: string
1162811628
type: object
11629+
resources:
11630+
description: Resources defines the Compute Resources required
11631+
by the container for the Argo CD Agent agent component.
11632+
properties:
11633+
claims:
11634+
description: |-
11635+
Claims lists the names of resources, defined in spec.resourceClaims,
11636+
that are used by this container.
11637+
11638+
This field depends on the
11639+
DynamicResourceAllocation feature gate.
11640+
11641+
This field is immutable. It can only be set for containers.
11642+
items:
11643+
description: ResourceClaim references one entry in PodSpec.ResourceClaims.
11644+
properties:
11645+
name:
11646+
description: |-
11647+
Name must match the name of one entry in pod.spec.resourceClaims of
11648+
the Pod where this field is used. It makes that resource available
11649+
inside a container.
11650+
type: string
11651+
request:
11652+
description: |-
11653+
Request is the name chosen for a request in the referenced claim.
11654+
If empty, everything from the claim is made available, otherwise
11655+
only the result of this request.
11656+
type: string
11657+
required:
11658+
- name
11659+
type: object
11660+
type: array
11661+
x-kubernetes-list-map-keys:
11662+
- name
11663+
x-kubernetes-list-type: map
11664+
limits:
11665+
additionalProperties:
11666+
anyOf:
11667+
- type: integer
11668+
- type: string
11669+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
11670+
x-kubernetes-int-or-string: true
11671+
description: |-
11672+
Limits describes the maximum amount of compute resources allowed.
11673+
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
11674+
type: object
11675+
requests:
11676+
additionalProperties:
11677+
anyOf:
11678+
- type: integer
11679+
- type: string
11680+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
11681+
x-kubernetes-int-or-string: true
11682+
description: |-
11683+
Requests describes the minimum amount of compute resources required.
11684+
If Requests is omitted for a container, it defaults to Limits if that is explicitly specified,
11685+
otherwise to an implementation-defined value. Requests cannot exceed Limits.
11686+
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
11687+
type: object
11688+
type: object
1162911689
tls:
1163011690
description: TLS defines the TLS options for the Agent component.
1163111691
properties:
@@ -11896,6 +11956,66 @@ spec:
1189611956
the TLS certificate and key for the resource proxy.
1189711957
type: string
1189811958
type: object
11959+
resources:
11960+
description: Resources defines the Compute Resources required
11961+
by the container for the Argo CD Agent principal component.
11962+
properties:
11963+
claims:
11964+
description: |-
11965+
Claims lists the names of resources, defined in spec.resourceClaims,
11966+
that are used by this container.
11967+
11968+
This field depends on the
11969+
DynamicResourceAllocation feature gate.
11970+
11971+
This field is immutable. It can only be set for containers.
11972+
items:
11973+
description: ResourceClaim references one entry in PodSpec.ResourceClaims.
11974+
properties:
11975+
name:
11976+
description: |-
11977+
Name must match the name of one entry in pod.spec.resourceClaims of
11978+
the Pod where this field is used. It makes that resource available
11979+
inside a container.
11980+
type: string
11981+
request:
11982+
description: |-
11983+
Request is the name chosen for a request in the referenced claim.
11984+
If empty, everything from the claim is made available, otherwise
11985+
only the result of this request.
11986+
type: string
11987+
required:
11988+
- name
11989+
type: object
11990+
type: array
11991+
x-kubernetes-list-map-keys:
11992+
- name
11993+
x-kubernetes-list-type: map
11994+
limits:
11995+
additionalProperties:
11996+
anyOf:
11997+
- type: integer
11998+
- type: string
11999+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
12000+
x-kubernetes-int-or-string: true
12001+
description: |-
12002+
Limits describes the maximum amount of compute resources allowed.
12003+
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
12004+
type: object
12005+
requests:
12006+
additionalProperties:
12007+
anyOf:
12008+
- type: integer
12009+
- type: string
12010+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
12011+
x-kubernetes-int-or-string: true
12012+
description: |-
12013+
Requests describes the minimum amount of compute resources required.
12014+
If Requests is omitted for a container, it defaults to Limits if that is explicitly specified,
12015+
otherwise to an implementation-defined value. Requests cannot exceed Limits.
12016+
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
12017+
type: object
12018+
type: object
1189912019
server:
1190012020
description: Server defines the server options for the Principal
1190112021
component.

config/crd/bases/argoproj.io_argocds.yaml

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11615,6 +11615,66 @@ spec:
1161511615
server to be used by the PrincAgentipal component.
1161611616
type: string
1161711617
type: object
11618+
resources:
11619+
description: Resources defines the Compute Resources required
11620+
by the container for the Argo CD Agent agent component.
11621+
properties:
11622+
claims:
11623+
description: |-
11624+
Claims lists the names of resources, defined in spec.resourceClaims,
11625+
that are used by this container.
11626+
11627+
This field depends on the
11628+
DynamicResourceAllocation feature gate.
11629+
11630+
This field is immutable. It can only be set for containers.
11631+
items:
11632+
description: ResourceClaim references one entry in PodSpec.ResourceClaims.
11633+
properties:
11634+
name:
11635+
description: |-
11636+
Name must match the name of one entry in pod.spec.resourceClaims of
11637+
the Pod where this field is used. It makes that resource available
11638+
inside a container.
11639+
type: string
11640+
request:
11641+
description: |-
11642+
Request is the name chosen for a request in the referenced claim.
11643+
If empty, everything from the claim is made available, otherwise
11644+
only the result of this request.
11645+
type: string
11646+
required:
11647+
- name
11648+
type: object
11649+
type: array
11650+
x-kubernetes-list-map-keys:
11651+
- name
11652+
x-kubernetes-list-type: map
11653+
limits:
11654+
additionalProperties:
11655+
anyOf:
11656+
- type: integer
11657+
- type: string
11658+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
11659+
x-kubernetes-int-or-string: true
11660+
description: |-
11661+
Limits describes the maximum amount of compute resources allowed.
11662+
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
11663+
type: object
11664+
requests:
11665+
additionalProperties:
11666+
anyOf:
11667+
- type: integer
11668+
- type: string
11669+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
11670+
x-kubernetes-int-or-string: true
11671+
description: |-
11672+
Requests describes the minimum amount of compute resources required.
11673+
If Requests is omitted for a container, it defaults to Limits if that is explicitly specified,
11674+
otherwise to an implementation-defined value. Requests cannot exceed Limits.
11675+
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
11676+
type: object
11677+
type: object
1161811678
tls:
1161911679
description: TLS defines the TLS options for the Agent component.
1162011680
properties:
@@ -11885,6 +11945,66 @@ spec:
1188511945
the TLS certificate and key for the resource proxy.
1188611946
type: string
1188711947
type: object
11948+
resources:
11949+
description: Resources defines the Compute Resources required
11950+
by the container for the Argo CD Agent principal component.
11951+
properties:
11952+
claims:
11953+
description: |-
11954+
Claims lists the names of resources, defined in spec.resourceClaims,
11955+
that are used by this container.
11956+
11957+
This field depends on the
11958+
DynamicResourceAllocation feature gate.
11959+
11960+
This field is immutable. It can only be set for containers.
11961+
items:
11962+
description: ResourceClaim references one entry in PodSpec.ResourceClaims.
11963+
properties:
11964+
name:
11965+
description: |-
11966+
Name must match the name of one entry in pod.spec.resourceClaims of
11967+
the Pod where this field is used. It makes that resource available
11968+
inside a container.
11969+
type: string
11970+
request:
11971+
description: |-
11972+
Request is the name chosen for a request in the referenced claim.
11973+
If empty, everything from the claim is made available, otherwise
11974+
only the result of this request.
11975+
type: string
11976+
required:
11977+
- name
11978+
type: object
11979+
type: array
11980+
x-kubernetes-list-map-keys:
11981+
- name
11982+
x-kubernetes-list-type: map
11983+
limits:
11984+
additionalProperties:
11985+
anyOf:
11986+
- type: integer
11987+
- type: string
11988+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
11989+
x-kubernetes-int-or-string: true
11990+
description: |-
11991+
Limits describes the maximum amount of compute resources allowed.
11992+
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
11993+
type: object
11994+
requests:
11995+
additionalProperties:
11996+
anyOf:
11997+
- type: integer
11998+
- type: string
11999+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
12000+
x-kubernetes-int-or-string: true
12001+
description: |-
12002+
Requests describes the minimum amount of compute resources required.
12003+
If Requests is omitted for a container, it defaults to Limits if that is explicitly specified,
12004+
otherwise to an implementation-defined value. Requests cannot exceed Limits.
12005+
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
12006+
type: object
12007+
type: object
1188812008
server:
1188912009
description: Server defines the server options for the Principal
1189012010
component.

0 commit comments

Comments
 (0)