istio / istio

Connect, secure, control, and observe services.
https://istio.io
Apache License 2.0
35.34k stars 7.63k forks source link

istioctl doesn't correctly patch CPU requests/limits #50990

Open iouri-s opened 1 month ago

iouri-s commented 1 month ago

Is this the right place to submit this?

Bug Description

./ClusterInit/istioctl-1.20.3-linux-amd64/istioctl upgrade --set values.global.proxy.resources.limits.cpu=200 Run the command with the --force flag if you want to ignore the validation error and proceed. Error: generate config: json: cannot unmarshal number into Go value of type string

Then I add quotes - same result: ./ClusterInit/istioctl-1.20.3-linux-amd64/istioctl upgrade --set values.global.proxy.resources.limits.cpu="200"

Run the command with the --force flag if you want to ignore the validation error and proceed. Error: generate config: json: cannot unmarshal number into Go value of type string

Then I add escaped quotes - it looks good at first:

./ClusterInit/istioctl-1.20.3-linux-amd64/istioctl upgrade --set values.global.proxy.resources.limits.cpu=\"200\"

WARNING: Istio is being upgraded from 1.20.0 to 1.20.3. Running this command will overwrite it; use revisions to upgrade alongside the existing version. Before upgrading, you may wish to use 'istioctl x precheck' to check for upgrade warnings. This will install the Istio 1.20.3 "default" profile (with components: Istio core, Istiod, and Ingress gateways) into the cluster. Proceed? (y/N) y ✔ Istio core installed ✔ Istiod installed ✔ Ingress gateways installed ✔ Installation complete Made this installation the default for injection and validation.

Now - let's check what it created - cpu is double-escaped. This is not going to work! kubectl get configmap -n istio-system istio-sidecar-injector -o yaml

...

          "resources": {
            "limits": {
              "cpu": "\"200\"",
              "memory": "1024Mi"
            },

Version

$ istioctl version && kubectl version
client version: 1.17.1
control plane version: 1.20.3
data plane version: 1.20-dev (12 proxies), 1.20.3 (1 proxies)
+ kubectl version
Client Version: v1.28.3
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.27.9

Additional Information

No response

hzxuzhonghu commented 1 month ago

@istio/wg-environments-maintainers

hanxiaop commented 1 month ago

There should be dup issues about this marshaling error, but I cannot find now. I'd prefer to include the unit, which should work without any fixes.