Skip to content

Fix for aws scaling issue#11

Open
treddy08 wants to merge 8 commits into
agnosticd:mainfrom
treddy08:main
Open

Fix for aws scaling issue#11
treddy08 wants to merge 8 commits into
agnosticd:mainfrom
treddy08:main

Conversation

@treddy08
Copy link
Copy Markdown

No description provided.

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 |.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant