-
Notifications
You must be signed in to change notification settings - Fork 527
fix: enforce Azure CNI config via jq instead of sed #4060
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4060 +/- ##
==========================================
+ Coverage 73.23% 73.25% +0.02%
==========================================
Files 135 135
Lines 20640 20542 -98
==========================================
- Hits 15115 15048 -67
+ Misses 4549 4521 -28
+ Partials 976 973 -3
Continue to review full report at Codecov.
|
if [[ "${IPV6_DUALSTACK_ENABLED}" == "true" ]]; then | ||
echo $(cat "$CNI_CONFIG_DIR/10-azure.conflist" | jq '.plugins[0].ipv6Mode="ipv6nat"') > "$CNI_CONFIG_DIR/10-azure.conflist" | ||
fi | ||
{{- if IsIPv6DualStackFeatureEnabled}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saving cloud-init payload here
004898d
to
52c5cee
Compare
fi | ||
if [[ "${NETWORK_MODE}" == "bridge" ]]; then | ||
sed -i 's#"mode":"transparent"#"mode":"bridge"#g' $CNI_CONFIG_DIR/10-azure.conflist | ||
jq '.plugins[0].mode="bridge"' "$CNI_CONFIG_DIR/10-azure.conflist" > $tmpDir/tmp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every time you replace a sed with a jq a @jchauncey gets his wings
@@ -14,6 +14,8 @@ | |||
"properties": { | |||
"orchestratorProfile": { | |||
"kubernetesConfig": { | |||
"networkPlugin": "azure", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes ensure we still have test coverage for Azure CNI + bridge mode now that Azure CNI 1.2.0 has merged with transparent mode enabled by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: aramase, jackfrancis The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Reason for Change:
This PR reduces the bash complexity of the jq usage inside the Azure CNI setup foo so that the Azure CNI configuration is always a multi-line file to accommodate all the pre-existing (known-working) sed foo.
A future workstream would be to replace the sed foo with jq foo.
Before:
In other words, the resultant JSON is a string with no newlines (which the sed commands aren't able to interpret).
After:
This PR also rationalizes the ipv6 dual stack implementation and configuration, which requires bridge mode in order to work.
Issue Fixed:
Credit Where Due:
Does this change contain code from or inspired by another project?
If "Yes," did you notify that project's maintainers and provide attribution?
Requirements:
Notes: