argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
17.81k stars 5.44k forks source link

Improve `the server could not find the requested resource` message #8017

Open jsoref opened 2 years ago

jsoref commented 2 years ago

Summary

the server could not find the requested resource is not particularly helpful.

It'd be nicer if it listed the resource it couldn't find, in this case, that was the CRD (ClusterIssuer.cert-manager.io/v1alpha2)

Motivation

If a user has some static resources https://raw.githubusercontent.com/cert-manager/website/af4632143ef001f4a4fa2c946504c462b760dc7b/content/en/docs/tutorials/acme/example/production-issuer.yaml ``` --- apiVersion: cert-manager.io/v1alpha2 kind: ClusterIssuer metadata: name: letsencrypt-staging spec: acme: server: https://acme-staging-v02.api.letsencrypt.org/directory email: root@example.com privateKeySecretRef: name: letsencrypt-staging solvers: - http01: ingress: class: nginx --- apiVersion: cert-manager.io/v1alpha2 kind: ClusterIssuer metadata: name: letsencrypt-prod spec: acme: server: https://acme-v02.api.letsencrypt.org/directory email: root@example.com privateKeySecretRef: name: letsencrypt-prod solvers: - http01: ingress: class: nginx ```
And they have an argocd helm managed system from https://cert-manager.io/v1.5-docs/installation/helm/: ```yaml name: cert-manager apiVersion: v2 appVersion: "1.0" description: Cert Manager version: 1.5.2 dependencies: - name: cert-manager version: 1.5.2 repository: https://charts.jetstack.io ```
And they upgrade to 1.6.1 https://cert-manager.io/v1.6-docs/installation/helm/ (sorta, imagine their instructions were correct). Here's the after upgrade (which triggers the user unhelpful error message): ``` name: cert-manager apiVersion: v2 appVersion: "1.0" description: Cert Manager version: 1.6.1 dependencies: - name: cert-manager version: 1.6.1 repository: https://charts.jetstack.io ```

They get a not particularly helpful error message:

image

the server could not find the requested resource

Proposal

Have the error message report the fully qualified name and version of the CRD that couldn't be found.

govind-bt commented 2 years ago

@jsoref Just following up to see if there is any fix for the above error? or how to we fix it?

jsoref commented 2 years ago

@govind-bt: there are two things floating around:

  1. Your object is unhappy
  2. The message from argocd is unhelpful

This issue is about the latter. The fix for it involves finding the code path that generates the error and adding handling w/ a better error message.

Theoretically, you're in a good place to do 2 since you have a 1.

I'm not actively working on this problem and was hoping someone else would.