CRD update fails if last-applied-configuration annotation too long
See original GitHub issueDuring testing, I noticed another strange behavior, if I should put it another issue, let me know.
Looks like pulumi falsely states, that the prometheuses.monitoring.coreos.com
CRD was updated when enableReplaceCRD
is false, but actually, it wasn’t.
I tested this on minikube with kubernetes version v1.21.2
.
Steps to reproduce:
- Make sure you’re using an older pulumi-kubernetes version than
3.12.1
, I used3.7.2
. - Use the code from my first comment with
enableReplaceCRD: false
and deploy the chart version18.0.7
. It should be deployed fine and theprometheuses.monitoring.coreos.com
CRD should have a longkubectl.kubernetes.io/last-applied-configuration
annotation. - Save the CRD definition with
kubectl get crd/prometheuses.monitoring.coreos.com -o yaml
. - Update the chart to
23.3.2
and try to deploy, it should fail onprometheuses.monitoring.coreos.com
with the messagethe Kubernetes API server reported that "prometheuses.monitoring.coreos.com" failed to fully initialize or become live: CustomResourceDefinition.apiextensions.k8s.io "prometheuses.monitoring.coreos.com" is invalid: metadata.annotations: Too long: must have at most 262144 bytes
. - Update pulumi-kubernetes to
3.12.1
. - Try to deploy again, it will show, that all CRDs were updated.
- Save the CRD definition again and compare it with the previous version, it will be the same.
- Optionally check pulumi state with
pulumi stack export
, it will show thatprometheuses.monitoring.coreos.com
CRD resource has the newest version, both in theinputs
andoutputs
section. The easiest way to do this, just to check thecontroller-gen.kubebuilder.io/version
annotation, for the18.0.7
chart it will bev0.4.1
, for23.3.2
will showv0.6.2
. - Set
enableReplaceCRD: true
then runpulumi up
. - Run
pulumi refresh
, it will show, that~__inputs
changed onprometheuses.monitoring.coreos.com
. - Optionally check pulumi state again, now both
inputs
andoutputs
will show the older CRD definition from the18.0.7
chart. - Run
pulumi up
,prometheuses.monitoring.coreos.com
will show an update, but will fail with the error:the Kubernetes API server reported that "prometheuses.monitoring.coreos.com" failed to fully initialize or become live: CustomResourceDefinition.apiextensions.k8s.io "prometheuses.monitoring.coreos.com" is invalid: metadata.annotations: Too long: must have at most 262144 bytes
.
So with the latest pulumi-kubernetes version without enableReplaceCRD
, it says that every CRD updated, even prometheuses.monitoring.coreos.com
, but on the environment, it actually stays the same.
_Originally posted by @ncsibra in https://github.com/pulumi/pulumi-kubernetes/issues/1841#issuecomment-996760823_
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Kubectl Install CRD Failed — Annotations Too Long - Medium
The above error occurs when you try to install CRDs for the Prometheus Operator… ... the CRDs and create / update to target...
Read more >Fixing Argo CD “Too long must have at most 262144 bytes” error
When using kubectl apply to update resources (which Argo CD does) it tries to set a last-applied-configuration annotation that contains the ...
Read more >Fix for kubernetes crd annotation too long problem
Sometimes creating custom resource definitions (CRD) in kubernetes can be a bit challenging. Even with the help of helm charts there you may ......
Read more >Helm3 Kubernetes CRD error on new OpenShift cluster ...
Hi, I got some trouble installing NewRelic on a development Openshift cluster using the kubernetes Helm3 method: computer@p50:~/workspace$ ...
Read more >Extend the Kubernetes API with CustomResourceDefinitions
When you create a new CustomResourceDefinition (CRD), ... CronTab metadata: annotations: kubectl.kubernetes.io/last-applied-configuration: ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@lblackstone no unexpected changes now; thank you! 🎉
Appreciate your patience on this fix! I got pulled off onto another project for the last several months and am just getting back to it. I’ve updated the PR, and should have a release out in the next day or two.