Skip to content

Update to fix valueFrom in kubevip args - #405

Merged
MonolithProjects merged 4 commits into
lablabs:mainfrom
rumblpak:kube-vip-valueFrom-bugfix
Jul 3, 2026
Merged

Update to fix valueFrom in kubevip args#405
MonolithProjects merged 4 commits into
lablabs:mainfrom
rumblpak:kube-vip-valueFrom-bugfix

Conversation

@rumblpak

Copy link
Copy Markdown
Contributor

Fixes:

  • whitespace generation that creates poorly formatted files.
  • valueFrom should not be quoted as it generates broken files.

Description

When generating the blob from the template, the resulting file is currently generated in a poorly formatted way. Additionally, valueFrom is quoted in multiple places which results in a file that cannot be installed into the cluster.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Small minor change not affecting the Ansible Role code (GitHub Actions Workflow, Documentation etc.)

How Has This Been Tested?

It isn't. I don't know how to test this without creating a new release. It should be easy to test by applying with any kubevip args.

Fixes:
  - whitespace generation that creates poorly formatted files. 
  - valueFrom should not be quoted as it generates broken files.
@rumblpak

Copy link
Copy Markdown
Contributor Author

Fixes #406

@MonolithProjects MonolithProjects self-assigned this Jul 2, 2026
@MonolithProjects MonolithProjects added the bug Something isn't working label Jul 2, 2026

@MonolithProjects MonolithProjects left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You are right about the issue. But your fix will end up as a single line in the output file. Better would be something like:

{% for item in rke2_kubevip_args %}
        - name: {{ item.param }}
{% if item.value is defined %}
          value: {{ item.value | string | to_json }}
{% endif %}
{% if item.valueFrom is defined %}
          valueFrom: {{ item.valueFrom | to_json }}
{% endif %}
{% endfor %}

Dropping the - from {%- if %} keeps the newline after name: intact, so value/valueFrom land on their own line instead of collapsing onto the name: line.

If you don't have a cluster to test, you can always use an Ansible template tester like for example https://ansible.sivel.net/test/

Update values to fix whitespace and formatting issues with jijna rendering
@rumblpak
rumblpak requested a review from MonolithProjects July 2, 2026 16:10
@rumblpak

rumblpak commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

@MonolithProjects I've done a bit of a refactor here to make the output all nice and prettified. I tested it with the template tester but will also rebuild my cluster using it once it's released. I don't know how to test my updates before that, if you can link me a doc on how to do that, I'm happy to.

@MonolithProjects MonolithProjects left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Last commit introduces multiple issues (you left trailing quotes on several lines and also reverting the #403 fix...). Please do not introduce additional changes in this PR. Lets keep it small and keep only the valueForm fix. You can open separate PR if you see additional problems.

@rumblpak

rumblpak commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

Sorry about that. Bad commit on my part.

@rumblpak
rumblpak requested a review from MonolithProjects July 3, 2026 12:05
@rumblpak

rumblpak commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

I ended up doing both. The final commit is what you've asked for, a small bugfix targeting only the reported issue. I also have a commit with the other changes that were from a missing save from when I was working too quickly. Sorry about that again. I can open a new PR with those changes, and as for why, we're generating yaml, not json, and to_json will produce incorrect results when not rendering strings but that can be a problem for another day, since those should always be strings.

@MonolithProjects MonolithProjects left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@MonolithProjects

Copy link
Copy Markdown
Collaborator

I ended up doing both. The final commit is what you've asked for, a small bugfix targeting only the reported issue. I also have a commit with the other changes that were from a missing save from when I was working too quickly. Sorry about that again. I can open a new PR with those changes, and as for why, we're generating yaml, not json, and to_json will produce incorrect results when not rendering strings but that can be a problem for another day, since those should always be strings.

Sure, you can open a new PR for those. Thanks for your contribution!

@MonolithProjects
MonolithProjects merged commit d96645c into lablabs:main Jul 3, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants