Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support configuring script pod resource requirements #225

Merged
merged 8 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/plenty-boats-share.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"kubernetes-agent": minor
---

Support configuring script pod resource requirements
2 changes: 1 addition & 1 deletion charts/kubernetes-agent/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.1905-pull-977"
7 changes: 4 additions & 3 deletions charts/kubernetes-agent/README.md
Original file line number Diff line number Diff line change
@@ -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.1905-pull-977](https://img.shields.io/badge/AppVersion-8.1.1905--pull--977-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:** <https://octopus.com>
**Homepage:** <https://octopus.com>
**Documentation:** [https://octopus.com/docs/](https://octopus.com/docs/infrastructure/deployment-targets/kubernetes/kubernetes-agent)

## Maintainers
Expand All @@ -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.1905-pull-977"}` | 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 |
Expand Down Expand Up @@ -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 |
Expand Down
2 changes: 2 additions & 0 deletions charts/kubernetes-agent/templates/tentacle-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.1905-pull-977
helm.sh/chart: kubernetes-agent-1.9.0
name: octopus-agent-scripts
namespace: NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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.1905-pull-977
helm.sh/chart: kubernetes-agent-1.9.0
name: octopus-agent-tentacle
namespace: NAMESPACE
Expand All @@ -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.1905-pull-977
helm.sh/chart: kubernetes-agent-1.9.0
spec:
affinity:
Expand Down Expand Up @@ -90,9 +90,11 @@ should match snapshot:
value: "5"
- name: OCTOPUS__K8STENTACLE__ENABLEMETRICSCAPTURE
value: "true"
- name: OCTOPUS__K8STENTACLE__PODRESOURCEJSON
value: '{"requests":{"cpu":"20m","memory":"100Mi"}}'
- name: OCTOPUS__K8STENTACLE__PERSISTENTVOLUMESIZE
value: 10Gi
image: octopusdeploy/kubernetes-agent-tentacle:8.1.1890
image: octopusdeploy/kubernetes-agent-tentacle:8.1.1905-pull-977
imagePullPolicy: IfNotPresent
name: octopus-agent-tentacle
resources:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.1905-pull-977
helm.sh/chart: kubernetes-agent-1.9.0
name: octopus-agent-RELEASE-NAME-pvc
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.1905-pull-977
helm.sh/chart: kubernetes-agent-1.9.0
name: octopus-agent-tentacle
namespace: NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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"}}'
9 changes: 8 additions & 1 deletion charts/kubernetes-agent/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ agent:
image:
repository: octopusdeploy/kubernetes-agent-tentacle
pullPolicy: IfNotPresent
tag: "8.1.1890"
tag: "8.1.1905-pull-977"

serviceAccount:
# -- The name of the service account for the agent pod
Expand Down Expand Up @@ -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
Expand Down
Loading