cloudfoundry / cf-for-k8s

The open source deployment manifest for Cloud Foundry on Kubernetes
Apache License 2.0
300 stars 115 forks source link

feature request: Improve logging of errors caused by cf client < v7. #540

Closed paulczar closed 3 years ago

paulczar commented 3 years ago

When installing the 1.0.0 rc1 tag of cf-for-k8s I was getting errors about the v2 api not supporting staging. After discussion on the cf-for-k8s slack it turned out that I needed cf cli v7.x. It does actually state that in the pre-reqs, but having using a prev version of cf-for-k8s, I kind of glossed over the pre-reqs ( which is totally on me ).

However I think clearer logs from the CLI that say something like "This version of CF requires CF cli v7+" would really help here, the Staging through the v2 API is disabled response is not clear.

$ cf push test-node-app -p tests/smoke/assets/test-node-app
Pushing app test-node-app to org test-org / space test-space as admin...
Getting app info...
...
...
Waiting for API to complete processing files...
Staging app and tracing logs...
Staging through the v2 API is disabled
FAILED
cf-gitbot commented 3 years ago

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/175336375

The labels on this github issue will be updated when the story is started.

jamespollard8 commented 3 years ago

Oh yeah, I agree it'd be more clear to add something directly about the cf cli version. I've pinged capi here: https://cloudfoundry.slack.com/archives/C017LDM6KTQ/p1603130782193500

njbennett commented 3 years ago

Makes sense to me. @piyalibanerjee if you agree I can write the story up, it should be basically identical to https://www.pivotaltracker.com/story/show/175157530

njbennett commented 3 years ago

Oh, wait, no, I just read some more conversation. We're going to need to pull the CLI team in.

jamespollard8 commented 3 years ago

Ah, there's already some conversation going here:

in short, it sounds like updating the message is not trivial.

Here's some of the relevant conversation:

reidm 2 hours ago the v6 CF CLI is incompatible with the version of cf-for-k8s that you’re using. You’ll need to use a v7 CF CLI. cc #capi-k8s-release @interrupt (this error message may not be actionable for those who don’t know that v6 <-> v2 and v7 <-> v3 under the hood)

InterruptAPP 2 hours ago ^ @jwal @matt-royal

Paul Czarkowski 2 hours ago ahhhh ugh, the classic "6.x" is the one that shows up when you hit latest release in github ui

Paul Czarkowski 2 hours ago but yeah that error should really surface as a CLI version error

Paul Czarkowski 2 hours ago the cf-for-k8s docs do say v7 (v7+) in prereqs, so I should have seen this ... I guess last time I did a cf-for-k8s install the v6 cli worked fine so I didn't even look at that.

Paul Czarkowski 2 hours ago thanks for pointing me in the right direction :slightly_smiling_face: :slightly_smiling_face: 1

jwal 2 hours ago unfortunately i'm not sure if we can necessarily mention what CLI version we prefer in the HTTP response since the CLI is not our only client, thus the preference to rather mention which version of our API can be used (edited) :heavy_plus_sign: 1

timdowney 2 hours ago We're also broadcasting min CLI versions which show up as warnings when the CLI targets / logs in to an environment https://github.com/cloudfoundry/capi-k8s-release/blob/cf3114e15134bdc1a95708e6cc2840a90d9565d8/templates/ccng-config.lib.yml#L65-L66 None of it is super obvious, though

reidm 1 hour ago Maybe we could work w/ the CLI team to catch + surface this error more nicely (some examples of that here: https://github.com/cloudfoundry/cli/blob/master/api/cloudcontroller/ccv3/errors.go#L117-L182 – would be esp. nice if it had a unique error code/title that the CLI could use, rather than branching on the detail field) (edited) :+1: 2

timdowney 1 hour ago @Paul Czarkowski would you mind making a Github for this on https://github.com/cloudfoundry/cf-for-k8s ? You definitely won't be the first to run into it so that would help wrt visibility and we could coordinate on improving the experience there.

Thanks @paulczar for creating this issue - we appreciate it!

jamespollard8 commented 3 years ago

Closing this issue as "not us". It'd be great though if the CLI/CAPI folks are able to implement an enhancement here.

enkicoma commented 3 years ago

Case: trying to follow: https://github.com/cloudfoundry/cf-for-k8s/blob/develop/docs/getting-started-tutorial.md

and I installed v6 of cf because in the tutorial isn't specified which version should I install.

cf version
cf version 6.53.0+8e2b70a4a.2020-10-01

which gave me the same error...

Staging app and tracing logs...
Staging through the v2 API is disabled
FAILED

Resolution for my case: Uninstall the v6:

brew uninstall cloudfoundry/tap/cf-cli

and install the cf v7: brew install cloudfoundry/tap/cf-cli@7

the error is gone. Build successful

jamespollard8 commented 3 years ago

Case: trying to follow: https://github.com/cloudfoundry/cf-for-k8s/blob/develop/docs/getting-started-tutorial.md

Great callout - thanks. I made the documentation more clear here: https://github.com/cloudfoundry/cf-for-k8s/commit/ba45148a357c5f54616c06acef8a78b5d1c298b7