From 7999cbbeb0bf5fb98024cf8591ed0a0d2bed8f77 Mon Sep 17 00:00:00 2001 From: Alastair Pitts Date: Wed, 10 Jul 2024 13:44:44 +1000 Subject: [PATCH 1/2] Support configuring script pod resource requirements (#225) --- .changeset/plenty-boats-share.md | 5 +++++ charts/kubernetes-agent/Chart.yaml | 2 +- charts/kubernetes-agent/README.md | 7 ++++--- .../templates/tentacle-deployment.yaml | 2 ++ .../pod-serviceaccount_test.yaml.snap | 2 +- .../tentacle-deployment_test.yaml.snap | 8 +++++--- .../__snapshot__/tentacle-pvc_test.yaml.snap | 2 +- .../tentacle-serviceaccount_test.yaml.snap | 2 +- ...tacle-deployment-container-env-vars_test.yaml | 16 ++++++++++++++++ charts/kubernetes-agent/values.yaml | 9 ++++++++- 10 files changed, 44 insertions(+), 11 deletions(-) create mode 100644 .changeset/plenty-boats-share.md 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 From c021a7a517d700379ab1d84a8ed566820c8d2726 Mon Sep 17 00:00:00 2001 From: Octopus Build Agent Date: Wed, 10 Jul 2024 13:52:35 +1000 Subject: [PATCH 2/2] Version Kubernetes Agent Chart (#226) Co-authored-by: github-actions[bot] Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .changeset/plenty-boats-share.md | 5 ----- charts/kubernetes-agent/CHANGELOG.md | 6 ++++++ charts/kubernetes-agent/Chart.yaml | 2 +- charts/kubernetes-agent/README.md | 4 ++-- charts/kubernetes-agent/package.json | 2 +- .../tests/__snapshot__/pod-serviceaccount_test.yaml.snap | 2 +- .../tests/__snapshot__/tentacle-deployment_test.yaml.snap | 6 +++--- .../tests/__snapshot__/tentacle-pvc_test.yaml.snap | 2 +- .../__snapshot__/tentacle-serviceaccount_test.yaml.snap | 2 +- 9 files changed, 16 insertions(+), 15 deletions(-) delete mode 100644 .changeset/plenty-boats-share.md diff --git a/.changeset/plenty-boats-share.md b/.changeset/plenty-boats-share.md deleted file mode 100644 index 22fd876c..00000000 --- a/.changeset/plenty-boats-share.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"kubernetes-agent": minor ---- - -Support configuring script pod resource requirements diff --git a/charts/kubernetes-agent/CHANGELOG.md b/charts/kubernetes-agent/CHANGELOG.md index 5106a179..4224985b 100644 --- a/charts/kubernetes-agent/CHANGELOG.md +++ b/charts/kubernetes-agent/CHANGELOG.md @@ -1,5 +1,11 @@ # kubernetes-agent +## 1.10.0 + +### Minor Changes + +- 7999cbb: Support configuring script pod resource requirements + ## 1.9.0 ### Minor Changes diff --git a/charts/kubernetes-agent/Chart.yaml b/charts/kubernetes-agent/Chart.yaml index 062ceb6c..6047a03c 100644 --- a/charts/kubernetes-agent/Chart.yaml +++ b/charts/kubernetes-agent/Chart.yaml @@ -9,6 +9,6 @@ maintainers: email: "support@octopus.com" url: "https://octopus.com" type: application -version: "1.9.0" +version: "1.10.0" # This version number should be the same as the agent.image.tag value as this is the primary application version appVersion: "8.1.1908" diff --git a/charts/kubernetes-agent/README.md b/charts/kubernetes-agent/README.md index 124d076d..e7b9b50f 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.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) +![Version: 1.10.0](https://img.shields.io/badge/Version-1.10.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 diff --git a/charts/kubernetes-agent/package.json b/charts/kubernetes-agent/package.json index e4e95111..0ee73ec2 100644 --- a/charts/kubernetes-agent/package.json +++ b/charts/kubernetes-agent/package.json @@ -1,6 +1,6 @@ { "name": "kubernetes-agent", - "version": "1.9.0", + "version": "1.10.0", "private": true, "description": "The Octopus Kubernetes Agent", "author": "Octopus Deploy Ptd Ltd", 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 dec07886..7d503bbc 100644 --- a/charts/kubernetes-agent/tests/__snapshot__/pod-serviceaccount_test.yaml.snap +++ b/charts/kubernetes-agent/tests/__snapshot__/pod-serviceaccount_test.yaml.snap @@ -9,6 +9,6 @@ should match snapshot: app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: octopus-agent app.kubernetes.io/version: 8.1.1908 - helm.sh/chart: kubernetes-agent-1.9.0 + helm.sh/chart: kubernetes-agent-1.10.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 45d62f6b..1020f1ff 100644 --- a/charts/kubernetes-agent/tests/__snapshot__/tentacle-deployment_test.yaml.snap +++ b/charts/kubernetes-agent/tests/__snapshot__/tentacle-deployment_test.yaml.snap @@ -8,7 +8,7 @@ should match snapshot: app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: octopus-agent app.kubernetes.io/version: 8.1.1908 - helm.sh/chart: kubernetes-agent-1.9.0 + helm.sh/chart: kubernetes-agent-1.10.0 name: octopus-agent-tentacle namespace: NAMESPACE spec: @@ -24,7 +24,7 @@ should match snapshot: app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: octopus-agent app.kubernetes.io/version: 8.1.1908 - helm.sh/chart: kubernetes-agent-1.9.0 + helm.sh/chart: kubernetes-agent-1.10.0 spec: affinity: nodeAffinity: @@ -75,7 +75,7 @@ should match snapshot: - name: OCTOPUS__K8STENTACLE__HELMRELEASENAME value: RELEASE-NAME - name: OCTOPUS__K8STENTACLE__HELMCHARTVERSION - value: 1.9.0 + value: 1.10.0 - name: OCTOPUS__K8STENTACLE__DISABLEAUTOPODCLEANUP value: "false" - name: OCTOPUS__K8STENTACLE__NFSWATCHDOGIMAGE 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 34a5c0b3..f5472a4e 100644 --- a/charts/kubernetes-agent/tests/__snapshot__/tentacle-pvc_test.yaml.snap +++ b/charts/kubernetes-agent/tests/__snapshot__/tentacle-pvc_test.yaml.snap @@ -8,7 +8,7 @@ should match snapshot when storageClassName is set: app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: octopus-agent app.kubernetes.io/version: 8.1.1908 - helm.sh/chart: kubernetes-agent-1.9.0 + helm.sh/chart: kubernetes-agent-1.10.0 name: octopus-agent-RELEASE-NAME-pvc spec: accessModes: 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 fc75287f..f3b97392 100644 --- a/charts/kubernetes-agent/tests/__snapshot__/tentacle-serviceaccount_test.yaml.snap +++ b/charts/kubernetes-agent/tests/__snapshot__/tentacle-serviceaccount_test.yaml.snap @@ -9,6 +9,6 @@ should match snapshot: app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: octopus-agent app.kubernetes.io/version: 8.1.1908 - helm.sh/chart: kubernetes-agent-1.9.0 + helm.sh/chart: kubernetes-agent-1.10.0 name: octopus-agent-tentacle namespace: NAMESPACE