Skip to content

Fix parsing of extravars with multiple fields#57

Merged
k8s-ci-robot merged 1 commit intokubernetes-sigs:mainfrom
kishen-v:allow-multi-extravars
Jan 30, 2026
Merged

Fix parsing of extravars with multiple fields#57
k8s-ci-robot merged 1 commit intokubernetes-sigs:mainfrom
kishen-v:allow-multi-extravars

Conversation

@kishen-v
Copy link
Copy Markdown
Contributor

@kishen-v kishen-v commented Nov 5, 2025

The current design doesn't parse the complete set of key:value pairs passed to the --extra-vars flag. The implemented approach accepts the vars as a string and performs operations to allow them to be parsed separately.

With the fix, the args are parsed as expected.
--extra-vars=prepull_images:'["registry.k8s.io/pause:3.9","registry.k8s.io/pause:3.10"]'

TASK [runtime : Pre-pull sandbox-images in the test environment.] **************
changed: [135.90.109.228] => (item=registry.k8s.io/pause:3.9)
changed: [135.90.109.227] => (item=registry.k8s.io/pause:3.9)
changed: [135.90.109.228] => (item=registry.k8s.io/pause:3.10)
changed: [135.90.109.227] => (item=registry.k8s.io/pause:3.10)

/hold - Until the PR is approved, as changes need to be done in a few job definitions.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 5, 2025
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 5, 2025
@kishen-v
Copy link
Copy Markdown
Contributor Author

kishen-v commented Nov 5, 2025

/cc @Karthik-K-N for the golang bits.
/cc @Rajalakshmi-Girish for the Ansible changes.

Thanks in advance!

@kishen-v kishen-v force-pushed the allow-multi-extravars branch from d1ae2c4 to 16c8315 Compare November 6, 2025 03:47
Copy link
Copy Markdown
Contributor

@Rajalakshmi-Girish Rajalakshmi-Girish left a comment

Choose a reason for hiding this comment

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

@kishen-v What job definitions do you think needs modifications after this?
This search output https://github.com/search?q=repo%3Appc64le-cloud%2Ftest-infra%20extra-vars&type=code is only showing instances where we only variable is passed with --extra-vars flag.

tasks:
- set_fact:
prepull_images: "{{ prepull_images + ['registry.k8s.io/pause:3.10'] }}"
prepull_images: "{{ (prepull_images | from_json if prepull_images is string else prepull_images) + ['registry.k8s.io/pause:3.10'] }}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why is this change part of the extravars modification? I might be missing something here. :|

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@kishen-v kishen-v changed the title Fix parsing of extravars with multiple fields [WIP]Fix parsing of extravars with multiple fields Nov 10, 2025
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 10, 2025
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 22, 2025
@kishen-v kishen-v force-pushed the allow-multi-extravars branch from 16c8315 to 86cc214 Compare January 5, 2026 05:49
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 5, 2026
@kishen-v kishen-v force-pushed the allow-multi-extravars branch from 86cc214 to d469ed0 Compare January 5, 2026 05:54
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 5, 2026
@kishen-v
Copy link
Copy Markdown
Contributor Author

kishen-v commented Jan 5, 2026

Passing image names causes fragmentation on the complete string due to an additional ":" present in the image name.
https://github.com/urfave/sflags/blob/b88b11ddd16a25e6e8897f0dbb074de4750c1647/values_generated.go#L652-L669.

for eg:
--extra-vars=prepull_images:'["registry.k8s.io/pause:3.9"]'
Would pass in : ["registry.k8s.io/pause only..

Will continue to explore more on this.

@kishen-v
Copy link
Copy Markdown
Contributor Author

kishen-v commented Jan 8, 2026

Awaiting a new release with the fix - urfave/sflags#45
Will revisit once when available.

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jan 28, 2026
- name: Pre-pull sandbox-images in the test environment.
shell: crictl pull {{ item }}
with_items: "{{ prepull_images }}"
with_items: "{{ (prepull_images | from_yaml if prepull_images is string else prepull_images) }}"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

A bug was exposed as the string was passed as is, this converts the string to a list and allows operations to be done on it.

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 28, 2026
@kishen-v kishen-v force-pushed the allow-multi-extravars branch from 04a20af to fca0aa5 Compare January 28, 2026 13:57
@kishen-v kishen-v force-pushed the allow-multi-extravars branch from fca0aa5 to a7d39cc Compare January 28, 2026 13:59
Comment thread kubetest2-tf/go.mod
github.com/apenella/go-ansible/v2 v2.1.1
github.com/hashicorp/terraform-exec v0.22.0
github.com/octago/sflags v0.3.1
github.com/urfave/sflags v0.4.2-0.20260106141539-680a267d4b97
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Mitigating the module rename:

[root@kubetest2-tf1 kubetest2-tf]# go get github.com/octago/sflags@v0.4.2-0.20260106141539-680a267d4b97
go: github.com/octago/sflags@v0.4.2-0.20260106141539-680a267d4b97 requires github.com/octago/sflags@v0.4.2-0.20260106141539-680a267d4b97: parsing go.mod:
	module declares its path as: github.com/urfave/sflags
	        but was required as: github.com/octago/sflags
[root@kubetest2-tf1 kubetest2-tf]# go get github.com/urfave/sflags@v0.4.2-0.20260106141539-680a267d4b97
go: added github.com/urfave/sflags v0.4.2-0.20260106141539-680a267d4b97

@kishen-v kishen-v changed the title [WIP]Fix parsing of extravars with multiple fields Fix parsing of extravars with multiple fields Jan 28, 2026
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 28, 2026
@kishen-v
Copy link
Copy Markdown
Contributor Author

/test pull-provider-ibmcloud-test-infra-kubernetes

@kishen-v
Copy link
Copy Markdown
Contributor Author

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 28, 2026
@kishen-v
Copy link
Copy Markdown
Contributor Author

Follow up: fixing this would allow the the pause-image to be pre-pulled and improve the startup latency. - https://github.com/ppc64le-cloud/test-infra/blob/17aba9aab308e3fa0552574ea895e06f8e79a845/config/jobs/periodic/kubernetes/perf-tests/perf-tests-kubernetes-periodics.yaml#L77

@kishen-v
Copy link
Copy Markdown
Contributor Author

/test pull-provider-ibmcloud-test-infra-kubernetes

- hosts: all
tasks:
- set_fact:
prepull_images: "{{ prepull_images + ['registry.k8s.io/pause:3.10'] }}"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

where are we appending this additional image after this block removal?

Copy link
Copy Markdown
Contributor Author

@kishen-v kishen-v Jan 29, 2026

Choose a reason for hiding this comment

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

Hi @mkumatag, this image seems to have been added inadvertently. There are no references to this particular version of pause throughout the deployment flow. The only reference I am seeing is 3.10.1 which is used as the sandbox image by the CRI.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The idea is to pull the proxy image beforehand, if it is done somewhere then it is good.

Copy link
Copy Markdown
Contributor Author

@kishen-v kishen-v Jan 30, 2026

Choose a reason for hiding this comment

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

Agreed, @mkumatag.
The sandbox image will be pulled. With this change, we can now pass in the extra-var something along the lines of --extra-vars=prepull_images:'["registry.k8s.io/pause:3.9","registry.k8s.io/pause:3.10"]' wherever needed, this leaves the code free from any pinned versions..

Copy link
Copy Markdown
Member

@mkumatag mkumatag left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 30, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kishen-v, mkumatag

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 30, 2026
@k8s-ci-robot k8s-ci-robot merged commit f4ba9f9 into kubernetes-sigs:main Jan 30, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants