Uploaded image for project: 'Cost Management'
  1. Cost Management
  2. COST-1876

Token authentication for source creation through operator is broken

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2021Q3
    • None
    • Operators
    • None
    • False
    • False

      The token authentication to create sources via the operator was broken by a change in sources (more info here). Since token auth is the default for the operator - it will be broken out of the box for new customers unless they switch to using basic authentication. 

       

      When the operator attempts to create a source it results in the following: 

      {"meta":{"count":1,"limit":100,"offset":0},"links":{"first":"/api/sources/v1.0/application_types?filter%5Bname%5D=%2Finsights%2Fplatform%2Fcost-management\u0026offset=0","last":"/api/sources/v1.0/application_types?filter%5Bname%5D=%2Finsights%2Fplatform%2Fcost-management\u0026offset=0"},"data":[{"created_at":"2019-04-05T18:40:06Z","dependent_applications":[],"display_name":"Cost Management","id":"2","name":"/insights/platform/cost-management","supported_authentication_types":{"azure":["tenant_id_client_id_client_secret"],"amazon":["arn"],"google":["project_id_service_account_json"],"openshift":["token"]},"supported_source_types":["amazon","azure","google","openshift"],"updated_at":"2021-02-18T09:28:48Z"}]}	{"costmanagementmetricsconfig": "ProcessResponse"}
      2021-09-20T19:50:11.655Z	INFO	controllers.CostManagementMetricsConfig	cost Management application type is 2	{"costmanagementmetricsconfig": "SourceGetOrCreate"}
      2021-09-20T19:50:11.655Z	INFO	controllers.CostManagementMetricsConfig	request using token authentication	{"costmanagementmetricsconfig": "SetupRequest"}
      2021-09-20T19:50:11.655Z	INFO	controllers.CostManagementMetricsConfig	request:
      POST /api/sources/v1.0/sources HTTP/1.1
      Host: cloud.redhat.com
      Authorization: Bearer ************************************************************************************************************************************************************************************
      Content-Type: application/json
      User-Agent: cost-mgmt-operator/6f10d07e3af3ea4f073d4ffda9019d8855f52e7f cluster/a5549bbf-3827-45c1-9ddf-0d1ac6855b7c
      
      	{"costmanagementmetricsconfig": "SetupRequest"}
      2021-09-20T19:50:11.655Z	INFO	controllers.CostManagementMetricsConfig.jsonRequest	POST Request - /api/sources/v1.0/sources
      2021-09-20T19:50:11.747Z	INFO	controllers.CostManagementMetricsConfig.jsonRequest	HTTP Response Status: 400 Bad Request
      2021-09-20T19:50:11.747Z	INFO	controllers.CostManagementMetricsConfig.jsonRequest	request response	{"costmanagementmetricsconfig": "ProcessResponse", "method": "POST", "status": 400, "URL": "https://cloud.redhat.com/api/sources/v1.0/sources", "x-rh-insights-request-id": "cf397dca66274b56b53f9f697f0461e8"}
      2021-09-20T19:50:11.747Z	INFO	controllers.CostManagementMetricsConfig.jsonRequest	request response:
      HTTP/2.0 400 Bad Request
      Content-Length: 373
      Cache-Control: no-cache
      Content-Type: application/json; charset=utf-8
      Date: Mon, 20 Sep 2021 19:50:11 GMT
      Server: openresty
      Set-Cookie: b3e2e456866f84f3604b36899c8be8b3=04450c7c976570f3120b2723c9640bca; path=/; HttpOnly; Secure; SameSite=None
      Vary: Origin
      X-Content-Type-Options: nosniff
      X-Frame-Options: SAMEORIGIN
      X-Request-Id: a7b3ba2e-c0b5-41cd-b11e-d67f44b270d5
      X-Rh-Edge-Cache-Status: Miss from child, Miss from parent
      X-Rh-Edge-Reference-Id: 0.cfeb7068.1632167411.124b799b
      X-Rh-Edge-Request-Id: 124b799b
      X-Rh-Insights-Request-Id: cf397dca66274b56b53f9f697f0461e8
      X-Runtime: 0.035058
      
      {"errors":[{"status":"401","detail":"Error message: the server returns an error\nHTTP status code: 401\nResponse headers: {\"Server\"=\u003e\"gunicorn\", \"Date\"=\u003e\"Mon, 20 Sep 2021 19:50:11 GMT\", \"Connection\"=\u003e\"keep-alive\", \"Content-Type\"=\u003e\"text/html; charset=utf-8\", \"Content-Length\"=\u003e\"0\", \"Vary\"=\u003e\"Origin\"}\nResponse body: "}]}	{"costmanagementmetricsconfig": "ProcessResponse"}
      2021-09-20T19:50:11.747Z	INFO	controllers.CostManagementMetricsConfig	source get or create message	{"CostManagementMetricsConfig": "checkSource", "error": "Failed to process the response for creating the OpenShift source: status: 400 | error response: {\"errors\":[{\"status\":\"401\",\"detail\":\"Error message: the server returns an error\\nHTTP status code: 401\\nResponse headers: {\\\"Server\\\"=\\u003e\\\"gunicorn\\\", \\\"Date\\\"=\\u003e\\\"Mon, 20 Sep 2021 19:50:11 GMT\\\", \\\"Connection\\\"=\\u003e\\\"keep-alive\\\", \\\"Content-Type\\\"=\\u003e\\\"text/html; charset=utf-8\\\", \\\"Content-Length\\\"=\\u003e\\\"0\\\", \\\"Vary\\\"=\\u003e\\\"Origin\\\"}\\nResponse body: \"}]}."}
      

       

       

            abaiken Ashley Morgan (Inactive)
            abaiken Ashley Morgan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: