kubernetes: failed to create patch: failed to create two-way merge patch: unable to find api field in struct HorizontalPodAutoscalerSpec for the json field "behavior"

What happened:

Helm upgrade fails with the following error: UPGRADE FAILED Error: failed to create patch: failed to create two-way merge patch: unable to find api field in struct HorizontalPodAutoscalerSpec for the json field "behavior"

What you expected to happen:

Expected to have the upgrade uninterrupted, hpa configuration updated with the modified field to a different value. (periodSeconds)

How to reproduce it (as minimally and precisely as possible):

  1. create yaml for hpa apiVersion: autoscaling/v2beta2 kind: HorizontalPodAutoscaler
  2. regular setup at first min max replicas, cpu and memory targets for scaling.
  3. install
  4. add behavior spec
  5. upgrade
  6. update any field under behavior spec (in my case I updated periodSeconds from 120 to 100)
  7. upgrade - fails

Anything else we need to know?:

Applying the upgrade with the same hpa yaml (unmodified) doesnt make the upgrade fail Workaround is to delete autoscaling through GCP UI and then perform the upgrade.

Environment:

  • Kubernetes version (use kubectl version):
Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.4", GitCommit:"3cce4a82b44f032d0cd1a1790e6d2f
5a55d20aae", GitTreeState:"clean", BuildDate:"2021-08-13T15:45:10Z", GoVersion:"go1.16.6", Compiler:"gc", Platform:
"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"20+", GitVersion:"v1.20.8-gke.2101", GitCommit:"05fc1fdacb292655c77a
2058a32ecc6a82cd71b0", GitTreeState:"clean", BuildDate:"2021-08-18T23:13:48Z", GoVersion:"go1.15.13b5", Compiler:"g
c", Platform:"linux/amd64"}
  • Cloud provider or hardware configuration: GCP Kubernetes
  • Install tools: Helm
Client: &version.Version{SemVer:"v2.16.12", GitCommit:"47f0b88409e71fd9ca272abc7cd762a56a1c613e", GitTreeState:"cle
an"}
Server: &version.Version{SemVer:"v2.16.12", GitCommit:"47f0b88409e71fd9ca272abc7cd762a56a1c613e", GitTreeState:"cle
an"}

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 5
  • Comments: 26 (5 by maintainers)

Most upvoted comments

shut up robot 😃 😃 /reopen