bhouse-nexthop commented on PR #14408:
URL: https://github.com/apache/cloudstack/pull/14408#issuecomment-7089279640
Tested this on a KVM lab with a private registry set. The control node came
up with no SSH key and no Kubernetes: cloud-init dropped the whole cloud-config.
**Cause:** cloud-init renders the template with `trim_blocks`. That removes
the newline after a block tag but keeps the spaces before it. So the two spaces
in front of `{% if %}` get prepended to the next line, putting `- path:
/opt/bin/setup-containerd` at indent 4, and the YAML no longer parses.
The indent was already there on main, but the block never rendered
(`registry is defined` was never true), so it didn't matter. With this PR the
block renders for the first time.
**Fix:** put both tags at column 0 in `k8s-control-node.yml`:
```yaml
{% if "{{ registry.enabled }}" == "true" %}
- path: /opt/bin/setup-containerd
...
{% endif %}
```
With that change the registry cluster came up fine. A unit test that renders
the template the way cloud-init does (trim_blocks) and parses the result as
YAML would catch this.
Smaller things in the same code path. They're older than this PR, so they
may be better as follow-ups:
| Issue | Effect |
|---|---|
| Registry password / user values are rendered through jinja | `{%`, `{{` or
`{#` in a password breaks the config |
| Credentials go into `sed` and shell unescaped | `/`, `&`, `'` etc. in a
password break `setup-containerd` |
| `registryUrl.split("://")[1]` | A URL without a scheme throws
`ArrayIndexOutOfBoundsException` |
--
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]