PyratLabs / ansible-role-k3s

Ansible role for installing k3s as either a standalone server or HA cluster.
BSD 3-Clause "New" or "Revised" License
627 stars 135 forks source link

TASK pre_check_version does not handle or report k3s update API url outage well #192

Closed waxling closed 2 years ago

waxling commented 2 years ago

Summary

this issue has been surfaced through this outage https://github.com/k3s-io/k3s/issues/6052

During an outage of the URL https://update.k3s.io/v1-release/channels,

the task TASK [xanmanning.k3s : Get the latest release version from k3s.io] reports only:

TASK [xanmanning.k3s : Get the latest release version from k3s.io]
*************
fatal: [nodename]: FAILED! => {"censored": "the output has been hidden
due to the fact that 'no_log: true' was specified for this result",
"changed": false}

enabling no_log: false for the pre_check_version surfaces the real error:

TASK [xanmanning.k3s : Get the latest release version from k3s.io] *************
│ fatal: [nodename]: FAILED! => {"cf_cache_status": "DYNAMIC", "cf_ray": "REDACTED", "changed": false, "connection": "close", "content": "<html>\r\n<head><title>503 Service Temporarily
│ Unavailable</title></head>\r\n<body>\r\n<center><h1>503 Service Temporarily Unavailable</h1></center>\r\n<hr><center>openresty/1.15.8.1</center>\r\n</body>\r\n</html>\r\n", "content_type": "text/html", "date":
│ "Tue, 30 Aug 2022 09:58:59 GMT", "elapsed": 0, "expect_ct": "max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"", "msg": "Status code was 503 and not [200]: HTTP Error
│ 503: Service Unavailable", "nel": "{\"success_fraction\":0,\"report_to\":\"cf-nel\",\"max_age\":604800}", "redirected": false, "report_to":
│ "{\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=REDACTED\"}],\"group\":\"cf-nel\",\"max_age\":604800}",
│ "server": "cloudflare", "status": 503, "strict_transport_security": "max-age=15552000; includeSubDomains; preload", "transfer_encoding": "chunked", "url": "https://update.k3s.io/v1-release/channels",
│ "x_content_type_options": "nosniff"}

Providing the a specific k3s version works around the issue: k3s_release_version: v1.24.4+k3s1

Issue Type

Controller Environment and Configuration

I run this playbook wrapped up inside a terraform build so will have to work out how to get this if its relevant.

Steps to Reproduce

run a playbook that includes the role do no specify a version to install

Expected Result

I would expect some hint of why the update check fails :) e.g. update URL and http code would suffice

Actual Result

the task TASK [xanmanning.k3s : Get the latest release version from k3s.io] reports only:

TASK [xanmanning.k3s : Get the latest release version from k3s.io]
*************
fatal: [nodename]: FAILED! => {"censored": "the output has been hidden
due to the fact that 'no_log: true' was specified for this result",
"changed": false}