bhouse-nexthop opened a new pull request, #14811:
URL: https://github.com/apache/cloudstack/pull/14811
### Description
Fixes #14810
A CKS cluster with a CNI configuration gets multipart user data. The control
node's part starts with `## template: jinja` but was typed `text/cloud-config`,
so cloud-init parsed it as plain YAML, failed on `{% if ... %}` and dropped the
whole CKS cloud-config. The cluster stayed in Starting.
| change | why |
|---|---|
| Type a cloud-config or shell part as `text/jinja2` when line 1 is `##
template: jinja` and line 2 is its header | cloud-init only renders jinja for
`text/jinja2` parts (`text/cloud-config` is used as-is), then picks the handler
from the rendered header. Same handler as single-part jinja user data. |
| Keep `text/jinja2` parts separate when appending | a render error in one
part must not drop another |
| `registerCniConfiguration`: `cniconfig` required (API + UI), blank content
rejected | a config saved without content made cluster create fail with an NPE |
| Cluster start reports a missing or empty CNI configuration | clear error
instead of an NPE for configs already saved |
Not changed:
- parts without the jinja header
- non-multipart appends (same-format cloud-config or shell user data is
still concatenated)
- parts inside user-supplied MIME user data
### 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)
### Feature/Enhancement Scale or Bug Severity
#### Bug Severity
- [ ] BLOCKER
- [ ] Critical
- [x] Major
- [ ] Minor
- [ ] Trivial
### How Has This Been Tested?
- `CloudInitUserDataProviderTest`: jinja part typed `text/jinja2`, plain
part still `text/cloud-config`, jinja `#include` not retyped, jinja parts not
merged, header detection edge cases.
- `ManagementServerImplTest`: blank and whitespace-only `cniconfig` rejected.
- Checked against cloud-init 22.4.2 and main:
`UserDataProcessor._process_msg` only sniffs `text/plain` /
`text/x-not-multipart` / `text/x-shellscript` parts; `JinjaTemplatePartHandler`
handles `text/jinja2` and dispatches the rendered output to the cloud-config or
shell handler.
- Generated user data for a CKS control node + shell CNI config now has
`Content-Type: text/jinja2` for the CKS part.
#### How did you try to break this feature and the system with this change?
- Plain cloud-config + shell (non-CKS VMs): output unchanged.
- `## template: jinja2`, an indented header, a blank line or `##` comment
before the header: not retyped, since cloud-init would not route them.
- Jinja `#include` / boothook: not retyped (no jinja sub-handler for them).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]