Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Config: Make preset config aware of cpu/memory
Preset property is bound with cpu/memory/bundle and have default values for it but our `set` function doesn't have map around those settings and a user can do following without any error message. ``` $ crc config set preset microshift $ crc config set cpus 2 $ crc config set preset openshift ``` and when user try to perform `crc start` then error message shown. With this PR we are making the set function bit self aware of the preset and it's bound properties (cpu/memory) and make sure if those property doesn't validated for the preset then unset those so default values going to take over. with this PR following now works as expected. ``` $ curl -X POST -d '{"properties":{"preset": "microshift"}}' --unix-socket ~/.crc/crc-http.sock http:/c/api/config {"Properties":["preset"]} $ curl -X POST -d '{"properties":{"cpus": "3"}}' --unix-socket ~/.crc/crc-http.sock http:/c/api/config {"Properties":["cpus"]} $ curl -X POST -d '{"properties":{"preset": "openshift"}}' --unix-socket ~/.crc/crc-http.sock http:/c/api/config {"Properties":["preset"]} $ curl -X GET --unix-socket ~/.crc/crc-http.sock http:/c/api/config | jq . % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 894 100 894 0 0 56924 0 --:--:-- --:--:-- --:--:-- 59600 { "Configs": { "bundle": "/Users/prkumar/.crc/cache/crc_vfkit_4.12.13_arm64.crcbundle", "consent-telemetry": "no", "cpus": 4, "disable-update-check": true, "disk-size": 31, "enable-cluster-monitoring": false, "enable-experimental-features": false, "enable-shared-dirs": true, "host-network-access": false, "http-proxy": "", "https-proxy": "", "ingress-http-port": 80, "ingress-https-port": 443, "kubeadmin-password": "", "memory": 9216, [...] ```
- Loading branch information