Fix for aws scaling issue#11
Open
treddy08 wants to merge 8 commits into
Open
Conversation
Changed replica_distribution to return a proper list instead of string representation by adding | to_json | from_json filter. This ensures replicas values are passed as integers to the Kubernetes API instead of strings, fixing the 422 Invalid error when scaling MachineSets.
Use combine filter to merge integer replicas value into definition. The combine filter operates on Python dicts, allowing us to pass item.1 | int as an actual integer instead of a YAML string. This fixes the 422 error where replicas was being sent as string instead of int64 to the Kubernetes API.
Simplified to just:
definition:
spec: "{{ {'replicas': item.1 | int} }}"
Building the dict in Jinja ensures replicas is an integer type,
fixing the 422 error without needing combine filter or vars.
Changed to:
spec: "{{ {'replicas': item.1} | to_json | from_json }}"
The to_json | from_json roundtrip ensures replicas is parsed as
an integer, not a string, fixing the 422 type validation error.
Build spec from JSON literal:
spec_json: '{"replicas": {{ item.1 }}}'
spec: "{{ spec_json | from_json }}"
JSON parsing guarantees replicas is an integer, not a string,
fixing the Kubernetes API 422 validation error.
Changed to:
spec: |
{{ {"replicas": item.1} | to_json | from_json }}
Cleaner formatting using pipe literal.
Simplified to:
spec: |
{{ {"replicas": item.1} }}
The dict literal already has correct integer type, no need for
to_json | from_json conversion.
Changed back to >- (folded scalar) for consistency with original. The key fix is adding | to_json | from_json, not changing >- to |.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.