diff --git a/templates/plumbing/argocd.yaml b/templates/plumbing/argocd.yaml index 8c272f8..6e471ba 100644 --- a/templates/plumbing/argocd.yaml +++ b/templates/plumbing/argocd.yaml @@ -27,32 +27,17 @@ spec: applicationInstanceLabelKey: argocd.argoproj.io/instance applicationSet: resources: - limits: - cpu: "2" - memory: 1Gi - requests: - cpu: 250m - memory: 512Mi +{{ toYaml $.Values.clusterGroup.argoCD.resources.applicationSet | indent 6 }} controller: processors: {} resources: - limits: - cpu: "4" - memory: 4Gi - requests: - cpu: 500m - memory: 2Gi +{{ toYaml $.Values.clusterGroup.argoCD.resources.controller | indent 6 }} sso: provider: dex dex: openShiftOAuth: true resources: - limits: - cpu: 500m - memory: 256Mi - requests: - cpu: 250m - memory: 128Mi +{{ toYaml $.Values.clusterGroup.argoCD.resources.dex | indent 8 }} initialSSHKnownHosts: {} rbac: {{- if $.Values.clusterGroup.argoCD.rbac }} @@ -88,12 +73,7 @@ spec: {{ toYaml $.Values.clusterGroup.argoCD.initContainers | indent 4 }} {{- end }} resources: - limits: - cpu: "1" - memory: 1Gi - requests: - cpu: 250m - memory: 256Mi +{{ toYaml $.Values.clusterGroup.argoCD.resources.repo | indent 6 }} volumeMounts: - mountPath: /etc/pki/tls/certs name: ca-bundles @@ -176,12 +156,7 @@ spec: ingress: enabled: false resources: - limits: - cpu: 500m - memory: 256Mi - requests: - cpu: 125m - memory: 128Mi +{{ toYaml $.Values.clusterGroup.argoCD.resources.server | indent 6 }} route: enabled: true tls: diff --git a/tests/argocd_resources_test.yaml b/tests/argocd_resources_test.yaml new file mode 100644 index 0000000..6906687 --- /dev/null +++ b/tests/argocd_resources_test.yaml @@ -0,0 +1,280 @@ +suite: Test argocd resource configuration +templates: + - templates/plumbing/argocd.yaml +release: + name: release-test +tests: + - it: should render default applicationSet resources + documentIndex: 0 + asserts: + - isSubset: + path: spec.applicationSet + content: + resources: + limits: + cpu: "2" + memory: 1Gi + requests: + cpu: 250m + memory: 512Mi + + - it: should render default controller resources + documentIndex: 0 + asserts: + - isSubset: + path: spec.controller + content: + resources: + limits: + cpu: "4" + memory: 4Gi + requests: + cpu: 500m + memory: 2Gi + + - it: should render default dex resources + documentIndex: 0 + asserts: + - isSubset: + path: spec.sso.dex + content: + resources: + limits: + cpu: 500m + memory: 256Mi + requests: + cpu: 250m + memory: 128Mi + + - it: should render default repo resources + documentIndex: 0 + asserts: + - isSubset: + path: spec.repo + content: + resources: + limits: + cpu: "1" + memory: 1Gi + requests: + cpu: 250m + memory: 256Mi + + - it: should render default server resources + documentIndex: 0 + asserts: + - isSubset: + path: spec.server + content: + resources: + limits: + cpu: 500m + memory: 256Mi + requests: + cpu: 125m + memory: 128Mi + + - it: should allow overriding controller resources + set: + clusterGroup: + argoCD: + resources: + controller: + limits: + cpu: "8" + memory: 16Gi + requests: + cpu: "2" + memory: 8Gi + documentIndex: 0 + asserts: + - isSubset: + path: spec.controller + content: + resources: + limits: + cpu: "8" + memory: 16Gi + requests: + cpu: "2" + memory: 8Gi + + - it: should allow overriding server resources + set: + clusterGroup: + argoCD: + resources: + server: + limits: + cpu: "1" + memory: 512Mi + requests: + cpu: 250m + memory: 256Mi + documentIndex: 0 + asserts: + - isSubset: + path: spec.server + content: + resources: + limits: + cpu: "1" + memory: 512Mi + requests: + cpu: 250m + memory: 256Mi + + - it: should allow overriding applicationSet resources + set: + clusterGroup: + argoCD: + resources: + applicationSet: + limits: + cpu: "4" + memory: 2Gi + requests: + cpu: 500m + memory: 1Gi + documentIndex: 0 + asserts: + - isSubset: + path: spec.applicationSet + content: + resources: + limits: + cpu: "4" + memory: 2Gi + requests: + cpu: 500m + memory: 1Gi + + - it: should allow overriding repo resources + set: + clusterGroup: + argoCD: + resources: + repo: + limits: + cpu: "2" + memory: 2Gi + requests: + cpu: 500m + memory: 512Mi + documentIndex: 0 + asserts: + - isSubset: + path: spec.repo + content: + resources: + limits: + cpu: "2" + memory: 2Gi + requests: + cpu: 500m + memory: 512Mi + + - it: should allow overriding dex resources + set: + clusterGroup: + argoCD: + resources: + dex: + limits: + cpu: "1" + memory: 512Mi + requests: + cpu: 500m + memory: 256Mi + documentIndex: 0 + asserts: + - isSubset: + path: spec.sso.dex + content: + resources: + limits: + cpu: "1" + memory: 512Mi + requests: + cpu: 500m + memory: 256Mi + + - it: should allow overriding multiple component resources at once + set: + clusterGroup: + argoCD: + resources: + controller: + limits: + cpu: "8" + memory: 16Gi + requests: + cpu: "2" + memory: 8Gi + server: + limits: + cpu: "1" + memory: 512Mi + requests: + cpu: 250m + memory: 256Mi + documentIndex: 0 + asserts: + - isSubset: + path: spec.controller + content: + resources: + limits: + cpu: "8" + memory: 16Gi + requests: + cpu: "2" + memory: 8Gi + - isSubset: + path: spec.server + content: + resources: + limits: + cpu: "1" + memory: 512Mi + requests: + cpu: 250m + memory: 256Mi + - isSubset: + path: spec.applicationSet + content: + resources: + limits: + cpu: "2" + memory: 1Gi + requests: + cpu: 250m + memory: 512Mi + - isSubset: + path: spec.repo + content: + resources: + limits: + cpu: "1" + memory: 1Gi + requests: + cpu: 250m + memory: 256Mi + - isSubset: + path: spec.sso.dex + content: + resources: + limits: + cpu: 500m + memory: 256Mi + requests: + cpu: 250m + memory: 128Mi + + - it: should not render argocd when singleArgoCD is true + set: + global: + singleArgoCD: true + asserts: + - hasDocuments: + count: 0 diff --git a/values.schema.json b/values.schema.json index 33386d5..c8202c5 100644 --- a/values.schema.json +++ b/values.schema.json @@ -747,6 +747,62 @@ "type": "object", "description": "Rbac customizes ArgoCD RBAC policies.", "additionalProperties": true + }, + "resources": { + "$ref": "#/definitions/ArgoCDResources" + } + } + }, + "ArgoCDResources": { + "type": "object", + "description": "Resource requests and limits for ArgoCD components.", + "additionalProperties": false, + "properties": { + "server": { + "$ref": "#/definitions/ResourceRequirements" + }, + "controller": { + "$ref": "#/definitions/ResourceRequirements" + }, + "applicationSet": { + "$ref": "#/definitions/ResourceRequirements" + }, + "repo": { + "$ref": "#/definitions/ResourceRequirements" + }, + "dex": { + "$ref": "#/definitions/ResourceRequirements" + } + } + }, + "ResourceRequirements": { + "type": "object", + "description": "Kubernetes resource requests and limits.", + "additionalProperties": false, + "properties": { + "limits": { + "type": "object", + "additionalProperties": true, + "properties": { + "cpu": { + "type": "string" + }, + "memory": { + "type": "string" + } + } + }, + "requests": { + "type": "object", + "additionalProperties": true, + "properties": { + "cpu": { + "type": "string" + }, + "memory": { + "type": "string" + } + } } } }, diff --git a/values.yaml b/values.yaml index c250da2..8d03001 100644 --- a/values.yaml +++ b/values.yaml @@ -45,6 +45,42 @@ clusterGroup: configManagementPlugins: [] # resource tracking can be set to annotation, label, or annotation+label resourceTrackingMethod: annotation + resources: + server: + limits: + cpu: 500m + memory: 256Mi + requests: + cpu: 125m + memory: 128Mi + controller: + limits: + cpu: "4" + memory: 4Gi + requests: + cpu: 500m + memory: 2Gi + applicationSet: + limits: + cpu: "2" + memory: 1Gi + requests: + cpu: 250m + memory: 512Mi + repo: + limits: + cpu: "1" + memory: 1Gi + requests: + cpu: 250m + memory: 256Mi + dex: + limits: + cpu: 500m + memory: 256Mi + requests: + cpu: 250m + memory: 128Mi resourceHealthChecks: # Adding health checks to argocd to prevent pvc resources # that aren't bound state from blocking deployments