gardener / gardener

Homogeneous Kubernetes clusters at scale on any infrastructure using hosted control planes.
https://gardener.cloud
Apache License 2.0
2.87k stars 473 forks source link

Error patching ControllerDeployment #10267

Open dimityrmirchev opened 1 month ago

dimityrmirchev commented 1 month ago

How to categorize this issue?

/area control-plane /kind bug

What happened: kubectl apply -f for ControllerDeployment fails.

What you expected to happen: The apply command to succeed.

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

Get the spec for ControllerDeployment from https://github.com/gardener/gardener-extension-provider-aws/blob/83233144f83d88221aaa4a3a724b160ae2a39d4d/example/controller-registration.yaml

apiVersion: core.gardener.cloud/v1
kind: ControllerDeployment
metadata:
  name: provider-aws
helm:
  rawChart: ...
  values:
    image:
      tag: v1.57.0-dev
k apply -f depl.yaml
controllerdeployment.core.gardener.cloud/provider-aws created

Change .helm.values.image.tag to "v1.57.0-dev-1".

k apply -f depl.yaml
warning: error calculating patch from openapi v3 spec: unable to find api field "image"
Error from server: error when applying patch:
{"helm":{"values":{"image":{"tag":"v1.57.0-dev-1"}}},"metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"core.gardener.cloud/v1\",\"helm\":{\"rawChart\":\"...\",\"values\":{\"image\":{\"tag\":\"v1.57.0-dev-1\"}}},\"kind\":\"ControllerDeployment\",\"metadata\":{\"annotations\":{},\"name\":\"provider-aws\"}}\n"}}}
to:
Resource: "core.gardener.cloud/v1, Resource=controllerdeployments", GroupVersionKind: "core.gardener.cloud/v1, Kind=ControllerDeployment"
Name: "provider-aws", Namespace: ""
for: "depl.yaml": error when patching "depl.yaml": unable to find api field in struct JSON for the json field "image

This log is also observed from the gardener-apiserver container.

Anything else we need to know?:

Environment:

rfranzke commented 4 weeks ago

cc @timebertt @maboehm

maboehm commented 3 weeks ago

I was able to reproduce it, but I probably won't have time to fix / investigate until the end of next week. Seems like some APIServer does not like to patch *apiextensionsv1.JSON