Skip to content

Type jinja-headed user data parts as text/jinja2 and reject blank cni config - #14945

Open
ravening wants to merge 1 commit into
apache:mainfrom
ravening:vibe/fix-14810-cni-jinja-mime-96810d
Open

ravening wants to merge 1 commit into
apache:mainfrom
ravening:vibe/fix-14810-cni-jinja-mime-96810d

Conversation

@ravening

@ravening ravening commented Dec 2, 2026

Copy link
Copy Markdown
Member

(#14810)

Description

  1. CloudInitUserDataProvider typed multipart parts by their # header only, so a ## template: jinja part (e.g. the CKS k8s-control-node.yml) was sent as text/cloud-config. cloud-init only renders jinja for text/jinja2 parts, so it parsed the raw template as YAML and dropped the whole control-node user data, leaving CKS clusters stuck in Starting. Parts whose first line is ## template: jinja are now typed text/jinja2. Added a unit test covering this.
  2. registerCniConfiguration with no cniconfig saved a null CNI config that later NPE'd in KubernetesClusterStartWorker; it now rejects blank cniconfig with InvalidParameterValueException.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

How Has This Been Tested?

Added testAppendJinjaCloudConfigWithShellScriptTypesJinjaPart to CloudInitUserDataProviderTest asserting the jinja-headed part is emitted as text/jinja2. Existing tests use non-jinja fixtures for content-type assertions and are unaffected. Unit tests run in PR CI (no JDK in the working environment).

Closes #14810

…config (apache#14810)

### Description

1. `CloudInitUserDataProvider` typed multipart parts by their `#` header only, so a `## template: jinja` part (e.g. the CKS `k8s-control-node.yml`) was sent as `text/cloud-config`. cloud-init only renders jinja for `text/jinja2` parts, so it parsed the raw template as YAML and dropped the whole control-node user data, leaving CKS clusters stuck in Starting. Parts whose first line is `## template: jinja` are now typed `text/jinja2`. Added a unit test covering this.
2. `registerCniConfiguration` with no `cniconfig` saved a null CNI config that later NPE'd in `KubernetesClusterStartWorker`; it now rejects blank `cniconfig` with `InvalidParameterValueException`.

### Types of changes

- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] New feature (non-breaking change which adds functionality)
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] Enhancement (improves an existing feature and functionality)
- [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
- [ ] Build/CI
- [ ] Test (unit or integration test code)

### Bug Severity

- [ ] BLOCKER
- [x] Critical
- [ ] Major
- [ ] Minor
- [ ] Trivial

### How Has This Been Tested?

Added `testAppendJinjaCloudConfigWithShellScriptTypesJinjaPart` to `CloudInitUserDataProviderTest` asserting the jinja-headed part is emitted as `text/jinja2`. Existing tests use non-jinja fixtures for content-type assertions and are unaffected. Unit tests run in PR CI (no JDK in the working environment).

Closes apache#14810

Co-authored-by: ravening <ravening@users.noreply.github.com>
@codecov

codecov Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 21.08%. Comparing base (8eaff97) to head (bae4d86).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
...cloudstack/userdata/CloudInitUserDataProvider.java 62.50% 1 Missing and 2 partials ⚠️
...in/java/com/cloud/server/ManagementServerImpl.java 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              main   #14945       +/-   ##
============================================
+ Coverage     3.86%   21.08%   +17.21%     
- Complexity       0    21289    +21289     
============================================
  Files          494     6058     +5564     
  Lines        42890   549901   +507011     
  Branches      8142    73540    +65398     
============================================
+ Hits          1657   115937   +114280     
- Misses       41001   420335   +379334     
- Partials       232    13629    +13397     
Flag Coverage Δ
uitests 3.86% <ø> (ø)
unittests 22.53% <50.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CKS cluster with a CNI configuration stays in Starting: jinja control-node part typed text/cloud-config

2 participants