bhouse-nexthop opened a new issue, #14597:
URL: https://github.com/apache/cloudstack/issues/14597

   ### problem
   
   Three of the scripts CKS copies to cluster nodes 
(`plugins/integrations/kubernetes-service/src/main/resources/script/`) 
mishandle their fallback downloads and options.
   
   1. **`deploy-csi-driver` never fetches `manifest.yaml`.** When the node has 
no CSI manifests from the binaries ISO, the script downloads them itself. Its 
loop downloads the first URL (`snapshot-crds.yaml`), then applies both files 
and exits, so `manifest.yaml` was never downloaded and `kubectl apply -f 
/opt/csi/manifest.yaml` fails. The `snapshot-crds.yaml` left behind then makes 
every later run take the "files already present" branch, which fails the same 
way. So enabling the CSI driver on a cluster whose ISO doesn't carry the CSI 
manifests always fails.
   
   2. **HTTP errors are saved and applied as manifests.** `deploy-csi-driver`, 
`deploy-provider` and `autoscale-kube-cluster` call `curl -sSL` without `-f`, 
so a 404 or other HTTP error is written to the manifest file and applied. The 
bad file stays under `/opt` and later runs apply it again without 
re-downloading. The `if [ $? -ne 0 ]` checks after `curl` can't report a failed 
download either: the scripts run under `#!/bin/bash -e`, so a failing `curl` 
ends the script before the check.
   
   3. **`autoscale-kube-cluster --disable` is rejected.** The option is 
declared as `-d | --enable)`, so `--disable` gives "ERROR: no such option 
--disable" (`-d` works). Run with neither `-e` nor `-d`, the unquoted `[ 
$ENABLE == "true" ]` fails with "unary operator expected" and the script falls 
through to deleting the autoscaler deployment. Disabling also fails when no 
autoscaler deployment exists (e.g. after a failed enable), because `kubectl 
delete` returns NotFound under `bash -e`.
   
   ### versions
   
   4.22 branch and `main` (the scripts are the same on both).
   
   ### The steps to reproduce the bug
   
   1. On a CKS control node whose binaries ISO did not provide 
`/opt/csi/*.yaml`, run `sudo /opt/bin/deploy-csi-driver` (this is what 
CloudStack runs when the CSI driver is enabled for the cluster).
   2. It fails with `error: the path "/opt/csi/manifest.yaml" does not exist`; 
only `/opt/csi/snapshot-crds.yaml` exists afterwards, and re-running fails the 
same way.
   3. `sudo /opt/bin/autoscale-kube-cluster --disable` prints `ERROR: no such 
option --disable`.
   
   ### What to do about it?
   
   - Download every CSI file before applying, then apply them as the ISO path 
does; only treat the files as present when both are.
   - Use `curl -f` inside the `if`, and download to a temporary file that is 
moved into place only once complete, so a failed download leaves nothing behind.
   - Accept `--disable`, quote the test, refuse to run with neither `-e` nor 
`-d`, and delete with `--ignore-not-found`.
   


-- 
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]

  • [I] CKS: deploy-csi-driver ne... bhouse-nexthop (via GitHub) via commits

Reply via email to