From e1f7190b54f3e9725fea7ed4c89f36466b6f5bbd Mon Sep 17 00:00:00 2001 From: rut31337 Date: Fri, 10 Apr 2026 15:20:30 -0500 Subject: [PATCH] Fix NetworkAttachmentDefinition config to produce valid JSON 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. --- roles/resources/tasks/create_network.yaml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/roles/resources/tasks/create_network.yaml b/roles/resources/tasks/create_network.yaml index 7e738aa..b3bc12b 100644 --- a/roles/resources/tasks/create_network.yaml +++ b/roles/resources/tasks/create_network.yaml @@ -1,11 +1,13 @@ --- - name: Create network {{ _network.name }} vars: - _config: >- - {'cniVersion':'0.3.1','type':'ovn-k8s-cni-overlay','topology':'layer2', - 'name': '{{ _network.name }}{{ guid }}', - 'netAttachDefName': '{{ openshift_cnv_namespace }}/{{ _network.name }}{{ guid }}', - 'mtu': {{ _network.mtu | default(1500) }}} + _config: + cniVersion: "0.3.1" + type: ovn-k8s-cni-overlay + topology: layer2 + name: "{{ _network.name }}{{ guid }}" + netAttachDefName: "{{ openshift_cnv_namespace }}/{{ _network.name }}{{ guid }}" + mtu: "{{ _network.mtu | default(1500) }}" kubernetes.core.k8s: definition: apiVersion: k8s.cni.cncf.io/v1