Fix NetworkAttachmentDefinition config to produce valid JSON#15
Closed
rut31337 wants to merge 1 commit into
Closed
Fix NetworkAttachmentDefinition config to produce valid JSON#15rut31337 wants to merge 1 commit into
rut31337 wants to merge 1 commit into
Conversation
The _config variable was defined as a YAML block scalar containing a Python dict literal (single quotes, unquoted integers). When piped through `to_json`, Jinja treated it as a string and JSON-encoded the string itself rather than converting a dict to JSON. The result was not valid JSON, causing the Multus admission webhook to reject it: admission webhook "multus-validating-config.k8s.io" denied the request: configuration string is not in JSON format Fix by defining _config as a proper YAML dict so `to_json` produces valid JSON output.
agonzalezrh
requested changes
Apr 10, 2026
Contributor
agonzalezrh
left a comment
There was a problem hiding this comment.
let's try first ansible 2.18
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.
Summary
Fix
create_network.yamlto produce valid JSON for the NetworkAttachmentDefinitionspec.configfield.Problem
The
_configvariable was defined as a YAML block scalar containing a Python dict literal:When piped through
| to_json, Jinja treats this as a string (not a dict) and JSON-encodes the string itself — wrapping it in quotes rather than converting key-value pairs to JSON. The Multus admission webhook rejects the result:Fix
Define
_configas a proper YAML dict soto_jsonserializes it correctly:Observed on
event1.apps.ocpv-infra02.wdc07.infra.demo.redhat.com— job 1139 (lb2759-agentic-aiops-aap-cnv)quay.io/agnosticd/ee-multicloud:chained-2026-04-01