cf-drain-cli icon indicating copy to clipboard operation
cf-drain-cli copied to clipboard

Setting UAA_ADDR env variable

Open ptecza opened this issue 5 years ago • 1 comments

Hello again,

I wonder why you set UAA_ADDR env variable by replacing api string in a hostname of the API:

$ cat ./internal/command/push_space_drain.go
[...]
        sharedEnvs := [][]string{
                {"SPACE_ID", space.Guid},
                {"DRAIN_NAME", opts.DrainName},
                {"DRAIN_URL", opts.DrainURL},
                {"DRAIN_TYPE", opts.DrainType},
                {"API_ADDR", api},
                {"UAA_ADDR", strings.Replace(api, "api", "uaa", 1)},
[...]

IMHO you can get it directly from AuthorizationEndpoint or UaaEndpoint keys stored in ~/.cf/config.json file.

By default the UUA binds to 2793 port, but the API uses 443 port, so cf drain-space command fails, because it's not able to reach the UAA port:

   2019-12-27T09:58:23.00+0000 [APP/PROC/WEB/0] OUT 2019/12/27 09:58:23 starting space drain...
   2019-12-27T09:58:23.00+0000 [APP/PROC/WEB/0] OUT ARGS: [/lifecycle/launch]
   2019-12-27T09:58:33.00+0000 [APP/PROC/WEB/0] OUT 2019/12/27 09:58:33 Failed to fetch tokens from UAA: Unable to make request: Post https://uaa.example.com/oauth/token: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
   2019-12-27T09:58:33.95+0000 [API/0] OUT Process has crashed with type: "web"
   2019-12-27T09:58:33.96+0000 [API/0] OUT App instance exited with guid fe22830f-90a9-4881-a240-c2dbcd45e270 payload: {"instance"=>"my-space-drain-bar-593961f8e0-0", "index"=>0, "cell_id"=>"", "reason"=>"Error", "exit_status"=>1, "exit_description"=>"Error", "crash_count"=>0, "crash_timestamp"=>23, "version"=>"fb724c9d-1558-4b6e-a460-41ded85174f4"}

Currently I have to workaround that issue in a following way:

$ cf set-env my-space-drain UAA_ADDR https://uaa.example.com:2793
$ cf restage my-space-drain

ptecza avatar Dec 31 '19 08:12 ptecza

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

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

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

cf-gitbot avatar Dec 31 '19 08:12 cf-gitbot