-
Notifications
You must be signed in to change notification settings - Fork 96
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
Handle overprovisioned flag based on CPU values #1358
Conversation
7f68e81
to
6d78e70
Compare
2f6f9eb
to
2b3df38
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain the original issue a bit more? Either in the commit message or as a comment somewhere. I don't think I fully understand why this is a fix?
charts/redpanda/chart_test.go
Outdated
@@ -238,6 +239,9 @@ func extractRedpandaConfigsFromConfigMap(manifests []byte) (*configmapRepresenta | |||
} | |||
result.redpanda = string(jsonR) | |||
|
|||
rex := regexp.MustCompile("\"overprovisioned\":(true|false)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: This is kinda hidden right now and using regex to change up JSON always feels a bit sketchy. What about moving this up to line 205 and making it something like:
// If this path is deeper, use the `unstructured` package from k8s to access it
// Explain the old bug here. Now that it's considered fixed, we'll ignore this diff by pushing the correct value into the old conf
oldConf.redpanda["overprovisioned"] = newConf.redpanda["overprovisioned"]
Placing this right before the assertion will help group up all the logic that we start to accumulate like this.
You could also compute a JSON diff and remove the overprovisioned
field from it in a similar way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about moving this up to line 205
If this path is deeper, use the
unstructured
package from k8s to access it
I can not use on manifests as ---
(YAML delimiter) is unrecognized by the unstructured unmarshall function.
Received unexpected error:
invalid character '-' in numeric literal
Placing this right before the assertion will help group up all the logic that we start to accumulate like this.
I agree.
You could also compute a JSON diff and remove the overprovisioned field from it in a similar way.
Which JSON diff function/library?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can not use on manifests as --- (YAML delimiter) is unrecognized by the unstructured unmarshall function.
Wouldn't that be a non issue around line 205 as you won't be working with manifests (multi-document YAMLs) but with the parsed out configmap values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newConf.redpanda
holds a raw redpanda config not K8S ConfigMap. When I'm unmarshall raw redpanda config I get the error:
Received unexpected error:
Object 'Kind' is missing in ...
//} | ||
// | ||
//return *rr.CPU.Overprovisioned | ||
if int(rr.RedpandaCoresInMillis()) < 1000 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a really interesting issue from @StephanDollberg on what the correct way to set this is. Curious if he (currently) has any suggestions on what we should be doing here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure I understand the full PR but this change only seems to be concerned with setups where we have less than one 1 core/1000 millicpus assigned to Redpanda?
In that case using overprovisioned unconditionally is the right thing to do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's exactly what it is, I just didn't understand at the time 😓
Thank you for confirming! I was going to seek further guidance on the --overprovisioned
flag but we'll do that at a later time.
Overprovisioned till Redpanda chart version 5.8.8 should be set to `true` when Statefulset CPU request value is bellow 1000 mili cores. Function `redpanda-smp`, that should overwrite `overprovisioned` flag, was not called before setting `overprovisioned` flag. Reference redpanda-smp template - https://github.com/redpanda-data/helm-charts/blob/5f287d45a3bda2763896840e505fb3de82b968b6/charts/redpanda/templates/_helpers.tpl#L187 redpanda-smp template invocation - https://github.com/redpanda-data/helm-charts/blob/5f287d45a3bda2763896840e505fb3de82b968b6/charts/redpanda/templates/_configmap.tpl#L610 overprovisioned flag - https://github.com/redpanda-data/helm-charts/blob/5f287d45a3bda2763896840e505fb3de82b968b6/charts/redpanda/templates/_configmap.tpl#L607
2b3df38
to
e89b886
Compare
Overprovisioned till Redpanda chart version 5.8.8 should be
set to
true
when Statefulset CPU request value is bellow 1000 mili cores.Function
redpanda-smp
, that should overwriteoverprovisioned
flag,was not called before setting
overprovisioned
flag.Reference
redpanda-smp template -
helm-charts/charts/redpanda/templates/_helpers.tpl
Line 187 in 5f287d4
redpanda-smp template invocation -
helm-charts/charts/redpanda/templates/_configmap.tpl
Line 610 in 5f287d4
overprovisioned flag -
helm-charts/charts/redpanda/templates/_configmap.tpl
Line 607 in 5f287d4