-
Notifications
You must be signed in to change notification settings - Fork 34
Fix empty proxy configuration breaking CAPI validation #844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Fixes vexxhost#790 When HTTP/HTTPS proxy is not configured, empty strings returned by generate_systemd_proxy_config() and generate_apt_proxy_config() were being base64-encoded and causing YAML parsing errors in Cluster API. The issue occurs because: 1. utils.generate_systemd_proxy_config() returns "" when no proxy is set 2. utils.generate_apt_proxy_config() returns "" when no proxy is set 3. These empty strings get base64-encoded in resources.py 4. When CAPI decodes them, empty values break cloud-init YAML parsing 5. Cluster creation fails with validation errors The fix: - Use "or '#'" fallback in resources.py when encoding proxy configs - When proxy functions return "", the fallback "#" is used instead - "#" is a comment character in both systemd and apt config files - Base64-encoding "#" is safe and doesn't break YAML parsing - Clusters with actual proxy configs continue to work normally Changes: - magnum_cluster_api/resources.py: Add "or '#'" fallback to proxy config encoding - magnum_cluster_api/tests/unit/test_resources.py: Add comprehensive unit tests Test coverage includes: 1. Clusters without proxy configuration (fallback to "#") 2. Clusters with proxy configuration (actual config encoded) 3. Critical test ensuring empty strings are never encoded This is a minimal, safe fix that: - Prevents cluster creation failures - Has no impact on existing proxy-enabled clusters - Uses a harmless comment character as fallback - Is compatible with all configuration file formats Related issue: vexxhost#790 Signed-off-by: Guillaume Harvey <[email protected]>
|
Just hit this one as well. We fixed it locally by changing the |
|
Thanks! It should also spot if kubernetes change the way around with the unit test to prevent it to come back. |
|
Our CI today runs with no proxy and it works just fine as well as other deployments, so I'm curious what is the root cause that is making this necessary? Perhaps some more context here would be needed, the PR seems to imply that any deployment of a cluster without a proxy doesn't work today which isn't really valid? |
|
What OS is your CI installed with? Every install I have done on Ubuntu 24.04 is getting this error. On our side we deploy with kolla-ansible, then we install kubectl and add our kubeconfig from the k8s-magnum-capi. The only way to make it work was to use this trick in the files. I do not have much more context than that. |
|
Can you share the cluster template and cluster values from magnum? |
|
We are also struggling with empty proxy files. Openstack version 2025.01 and Magnum_cluster_api v.033.0 When we build a cluster, Magnum reports that it has been successfully created and is healthy. Cluster access via the API also works, but no rolling-updates are possible via Magnum. Clusterapi says that the cluster is not available. Cluster Infos: clusterctl describe shows that the cluster is unavailable and says that the files may not be empty: After we have imported the changes from the pull request, everything is fine again. In both cases, we used the same template and the same values. Cluster infos: Clusterctl describe: Cluster template: |
|
@jaszil what version of cluster api are you running if you dont mind me asking? |
|
@mnaser v1.11.2 |
|
I'm having the same issues. It would be great if this could be fixed soon. |
Fixes #790
When HTTP/HTTPS proxy is not configured, empty strings returned by generate_systemd_proxy_config() and generate_apt_proxy_config() were being base64-encoded and causing YAML parsing errors in Cluster API.
The issue occurs because:
The fix:
Changes:
Test coverage includes:
This is a minimal, safe fix that:
Related issue: #790