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

Changes to include the resources limits and requests #155

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
10 changes: 10 additions & 0 deletions operator/charts/netchecks/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ data:
"repository":{{ .Values.probeConfig.image.repository | quote }},
"tag":{{ .Values.probeConfig.image.tag | default .Chart.AppVersion | quote }}
},
"resources": {
"limits": {
"cpu":{{ .Values.probeConfig.resources.limits.cpu | quote }},
"memory":{{ .Values.probeConfig.resources.limits.memory | quote }}
},
"requests": {
"cpu":{{ .Values.probeConfig.resources.requests.cpu | quote }},
"memory":{{ .Values.probeConfig.resources.requests.memory | quote }}
}
},
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"resources": {
"limits": {
"cpu":{{ .Values.probeConfig.resources.limits.cpu | quote }},
"memory":{{ .Values.probeConfig.resources.limits.memory | quote }}
},
"requests": {
"cpu":{{ .Values.probeConfig.resources.requests.cpu | quote }},
"memory":{{ .Values.probeConfig.resources.requests.memory | quote }}
}
},
"resources": {{ .Values.probeConfig.resources | toJson }}

"imagePullSecrets": {{ .Values.probeConfig.imagePullSecrets | toJson }},
"podAnnotations": {{ .Values.probeConfig.podAnnotations | toJson }}
}
Expand Down
2 changes: 2 additions & 0 deletions operator/netchecks_operator/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
V1Volume,
V1VolumeMount,
V1SecretVolumeSource,
V1ResourceRequirements,
)
from structlog import get_logger
from rich import print
Expand Down Expand Up @@ -693,6 +694,7 @@ def create_job_spec(
image_pull_policy=settings.probe.image.pullPolicy,
command=command,
volume_mounts=volume_mounts,
resources=client.V1ResourceRequirements(limits=settings.probe.resources["limits"],requests=settings.probe.resources["requests"]),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to work for the case where there are no resources defined.

Probably cleaner to create the V1ResourceRequirements instance above, then pass in to the V1Container

env=[
# V1EnvVar(name="NETCHECK_CONFIG", value="/netcheck/")
],
Expand Down