diff --git a/.changeset/plenty-boats-share.md b/.changeset/plenty-boats-share.md new file mode 100644 index 00000000..22fd876c --- /dev/null +++ b/.changeset/plenty-boats-share.md @@ -0,0 +1,5 @@ +--- +"kubernetes-agent": minor +--- + +Support configuring script pod resource requirements diff --git a/charts/kubernetes-agent/Chart.yaml b/charts/kubernetes-agent/Chart.yaml index b5e9f2b1..062ceb6c 100644 --- a/charts/kubernetes-agent/Chart.yaml +++ b/charts/kubernetes-agent/Chart.yaml @@ -11,4 +11,4 @@ maintainers: type: application version: "1.9.0" # This version number should be the same as the agent.image.tag value as this is the primary application version -appVersion: "8.1.1890" +appVersion: "8.1.1908" diff --git a/charts/kubernetes-agent/README.md b/charts/kubernetes-agent/README.md index 8832955b..124d076d 100644 --- a/charts/kubernetes-agent/README.md +++ b/charts/kubernetes-agent/README.md @@ -1,10 +1,10 @@ # kubernetes-agent -![Version: 1.9.0](https://img.shields.io/badge/Version-1.9.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 8.1.1890](https://img.shields.io/badge/AppVersion-8.1.1890-informational?style=flat-square) ![Octopus Deploy Version: 2024.2.6580+](https://img.shields.io/badge/Octopus_Deploy-2024.2.6580%2B-2F93E0?style=flat-square&logo=octopusdeploy&logoColor=%232F93E0&logoSize=auto) +![Version: 1.9.0](https://img.shields.io/badge/Version-1.9.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 8.1.1908](https://img.shields.io/badge/AppVersion-8.1.1908-informational?style=flat-square) ![Octopus Deploy Version: 2024.2.6580+](https://img.shields.io/badge/Octopus_Deploy-2024.2.6580%2B-2F93E0?style=flat-square&logo=octopusdeploy&logoColor=%232F93E0&logoSize=auto) A Helm chart for the Octopus Kubernetes Agent -**Homepage:** +**Homepage:** **Documentation:** [https://octopus.com/docs/](https://octopus.com/docs/infrastructure/deployment-targets/kubernetes/kubernetes-agent) ## Maintainers @@ -29,7 +29,7 @@ A Helm chart for the Octopus Kubernetes Agent | agent.debug.disableAutoPodCleanup | bool | `false` | Disables automatic pod cleanup | | agent.defaultNamespace | string | `""` | The default Kubernetes namespace for deployments | | agent.enableMetricsCapture | bool | `true` | True if events should be scraped and added to the metrics config map | -| agent.image | object | `{"pullPolicy":"IfNotPresent","repository":"octopusdeploy/kubernetes-agent-tentacle","tag":"8.1.1890"}` | The repository, pullPolicy & tag to use for the agent image | +| agent.image | object | `{"pullPolicy":"IfNotPresent","repository":"octopusdeploy/kubernetes-agent-tentacle","tag":"8.1.1908"}` | The repository, pullPolicy & tag to use for the agent image | | agent.logLevel | string | `"Info"` | The log level of the agent. Logs are written to the pod logs as well as to file | | agent.machinePolicyName | string | `""` | The machine policy to register the agent with | | agent.metadata | object | `{"annotations":{},"labels":{}}` | Additional metadata to add to the agent pod & container | @@ -71,6 +71,7 @@ A Helm chart for the Octopus Kubernetes Agent | Key | Type | Default | Description | |-----|------|---------|-------------| | scriptPods.disruptionBudgetEnabled | bool | `true` | If true, the script pods will be created with a disruption budget to prevent them from being evicted | +| scriptPods.resources | object | `{"requests":{"cpu":"25m","memory":"100Mi"}}` | The resource limits and requests assigned to script pod containers | | scriptPods.serviceAccount.annotations | object | `{}` | Annotations to add to the service account | | scriptPods.serviceAccount.clusterRole | object | `[{"apiGroups":["*"],"resources":["*"],"verbs":["*"]},{"nonResourceURLs":["*"],"verbs":["*"]}]` | if defined, overrides the default ClusterRole rules | | scriptPods.serviceAccount.name | string | `""` | The name of the service account used for executing script pods | diff --git a/charts/kubernetes-agent/templates/tentacle-deployment.yaml b/charts/kubernetes-agent/templates/tentacle-deployment.yaml index c4d5aed1..dfc7e394 100644 --- a/charts/kubernetes-agent/templates/tentacle-deployment.yaml +++ b/charts/kubernetes-agent/templates/tentacle-deployment.yaml @@ -98,6 +98,8 @@ spec: - name: "OCTOPUS__K8STENTACLE__PODIMAGEPULLSECRETNAMES" value: {{ join "," .Values.imagePullSecrets | quote}} {{- end }} + - name: "OCTOPUS__K8STENTACLE__PODRESOURCEJSON" + value: {{ .Values.scriptPods.resources | toJson | quote }} {{- if .Values.agent.serverApiKey }} - name: "ServerApiKey" valueFrom: diff --git a/charts/kubernetes-agent/tests/__snapshot__/pod-serviceaccount_test.yaml.snap b/charts/kubernetes-agent/tests/__snapshot__/pod-serviceaccount_test.yaml.snap index 4febadcb..dec07886 100644 --- a/charts/kubernetes-agent/tests/__snapshot__/pod-serviceaccount_test.yaml.snap +++ b/charts/kubernetes-agent/tests/__snapshot__/pod-serviceaccount_test.yaml.snap @@ -8,7 +8,7 @@ should match snapshot: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: octopus-agent - app.kubernetes.io/version: 8.1.1890 + app.kubernetes.io/version: 8.1.1908 helm.sh/chart: kubernetes-agent-1.9.0 name: octopus-agent-scripts namespace: NAMESPACE diff --git a/charts/kubernetes-agent/tests/__snapshot__/tentacle-deployment_test.yaml.snap b/charts/kubernetes-agent/tests/__snapshot__/tentacle-deployment_test.yaml.snap index eb206ed2..45d62f6b 100644 --- a/charts/kubernetes-agent/tests/__snapshot__/tentacle-deployment_test.yaml.snap +++ b/charts/kubernetes-agent/tests/__snapshot__/tentacle-deployment_test.yaml.snap @@ -7,7 +7,7 @@ should match snapshot: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: octopus-agent - app.kubernetes.io/version: 8.1.1890 + app.kubernetes.io/version: 8.1.1908 helm.sh/chart: kubernetes-agent-1.9.0 name: octopus-agent-tentacle namespace: NAMESPACE @@ -23,7 +23,7 @@ should match snapshot: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: octopus-agent - app.kubernetes.io/version: 8.1.1890 + app.kubernetes.io/version: 8.1.1908 helm.sh/chart: kubernetes-agent-1.9.0 spec: affinity: @@ -90,9 +90,11 @@ should match snapshot: value: "5" - name: OCTOPUS__K8STENTACLE__ENABLEMETRICSCAPTURE value: "true" + - name: OCTOPUS__K8STENTACLE__PODRESOURCEJSON + value: '{"requests":{"cpu":"25m","memory":"100Mi"}}' - name: OCTOPUS__K8STENTACLE__PERSISTENTVOLUMESIZE value: 10Gi - image: octopusdeploy/kubernetes-agent-tentacle:8.1.1890 + image: octopusdeploy/kubernetes-agent-tentacle:8.1.1908 imagePullPolicy: IfNotPresent name: octopus-agent-tentacle resources: diff --git a/charts/kubernetes-agent/tests/__snapshot__/tentacle-pvc_test.yaml.snap b/charts/kubernetes-agent/tests/__snapshot__/tentacle-pvc_test.yaml.snap index 516565a4..34a5c0b3 100644 --- a/charts/kubernetes-agent/tests/__snapshot__/tentacle-pvc_test.yaml.snap +++ b/charts/kubernetes-agent/tests/__snapshot__/tentacle-pvc_test.yaml.snap @@ -7,7 +7,7 @@ should match snapshot when storageClassName is set: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: octopus-agent - app.kubernetes.io/version: 8.1.1890 + app.kubernetes.io/version: 8.1.1908 helm.sh/chart: kubernetes-agent-1.9.0 name: octopus-agent-RELEASE-NAME-pvc spec: diff --git a/charts/kubernetes-agent/tests/__snapshot__/tentacle-serviceaccount_test.yaml.snap b/charts/kubernetes-agent/tests/__snapshot__/tentacle-serviceaccount_test.yaml.snap index 559e31a6..fc75287f 100644 --- a/charts/kubernetes-agent/tests/__snapshot__/tentacle-serviceaccount_test.yaml.snap +++ b/charts/kubernetes-agent/tests/__snapshot__/tentacle-serviceaccount_test.yaml.snap @@ -8,7 +8,7 @@ should match snapshot: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: octopus-agent - app.kubernetes.io/version: 8.1.1890 + app.kubernetes.io/version: 8.1.1908 helm.sh/chart: kubernetes-agent-1.9.0 name: octopus-agent-tentacle namespace: NAMESPACE diff --git a/charts/kubernetes-agent/tests/tentacle-deployment-container-env-vars_test.yaml b/charts/kubernetes-agent/tests/tentacle-deployment-container-env-vars_test.yaml index 575b531f..b721a77a 100644 --- a/charts/kubernetes-agent/tests/tentacle-deployment-container-env-vars_test.yaml +++ b/charts/kubernetes-agent/tests/tentacle-deployment-container-env-vars_test.yaml @@ -222,3 +222,19 @@ tests: - equal: path: spec.template.spec.containers[0].env[?(@.name == 'OCTOPUS__K8STENTACLE__PODIMAGEPULLSECRETNAMES')].value value: "secret-1,secret-2" + + +- it: "Sets resource json if script pods resources changed" + set: + scriptPods: + resources: + limits: + cpu: "100m" + memory: "1Gi" + requests: + cpu: "10m" + memory: "50Mi" + asserts: + - equal: + path: spec.template.spec.containers[0].env[?(@.name == 'OCTOPUS__K8STENTACLE__PODRESOURCEJSON')].value + value: '{"limits":{"cpu":"100m","memory":"1Gi"},"requests":{"cpu":"10m","memory":"50Mi"}}' \ No newline at end of file diff --git a/charts/kubernetes-agent/values.yaml b/charts/kubernetes-agent/values.yaml index 46ba68a2..df795fc3 100644 --- a/charts/kubernetes-agent/values.yaml +++ b/charts/kubernetes-agent/values.yaml @@ -88,7 +88,7 @@ agent: image: repository: octopusdeploy/kubernetes-agent-tentacle pullPolicy: IfNotPresent - tag: "8.1.1890" + tag: "8.1.1908" serviceAccount: # -- The name of the service account for the agent pod @@ -123,6 +123,13 @@ scriptPods: # @section -- Script pod values disruptionBudgetEnabled: true + # -- The resource limits and requests assigned to script pod containers + # @section -- Script pod values + resources: + requests: + memory: "100Mi" + cpu: "25m" + serviceAccount: # -- The name of the service account used for executing script pods # @section -- Script pod values