Bug 1403758 - no option to add Hawkular under metrics section while adding Openshift provider through REST API
Summary: no option to add Hawkular under metrics section while adding Openshift provid...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: API
Version: 5.7.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: GA
: cfme-future
Assignee: Jillian Tullo
QA Contact: Dave Johnson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-12-12 10:37 UTC by Archit Sharma
Modified: 2017-12-01 18:26 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-05-03 13:23:51 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:


Attachments (Terms of Use)

Comment 2 Jillian Tullo 2017-04-24 18:34:30 UTC
Hi Archit,

Can you provide more details about what you would like to add to the provider in terms of Metrics? Are you trying to add a Hawkular endpoint to the provider?

Thanks!
- Jillian

Comment 3 Archit Sharma 2017-05-02 08:32:42 UTC
Hi Jillian,

Yes it's about trying to add a Hawkular endpoint through the API. In the version that I tested this with (and also CFME 5809), I couldn't spot the documentation on how-to add the same. Please see the description for the links.. I think one of 'em was a 4.2 beta which is 404 now, so I'm updating it with this [3]

Is there an API endpoint that I can utilize to automate this when I add a new OCP provider, while not using the UI ?

To explain further, I see this line in link [2] in description:
"ManageIQ::Providers::Openshift::ContainerManager
default, password, bearer
userid, password, auth_key"

And there's even an example of how to add RHVM provider, like here [5]. I see that in that example for RHVM, its mentioned how to add a metrics credential, but in OCP's case we have 3 keys in UI for metrics:

Let's say I select: 
Security Protocol: SSL without validation 
Hostname (or IPv4 or IPv6 address): test.10.20.30.40.node.metrics.xip.io
API Port: 443

And from that example, its difficult to infer how to add OCP as a provider, since it involves token system, unlike the traditional OSP / RHV providers which use passwords, IIRC.
 
I could use a workaround in rails console for now. Like running a rails console command over a ssh connection to modify these endpoint params; so to speak -> [5]

But shouldn't this be available in API itself?

refs:
[3] - https://access.redhat.com/documentation/en-us/red_hat_cloudforms/4.2/html/red_hat_cloudforms_rest_api/chap_specification
[4] - http://manageiq.org/docs/reference/latest/api/examples/create_provider_compound_credentials
[5] - https://gist.github.com/arcolife/511e2e5dc49f6c605ed341aeec8c7085
thanks,

Archit

Comment 4 Jillian Tullo 2017-05-02 19:57:01 UTC
Hi again Archit,

Thanks for the additional info! Good news is there is a way to add a Container Manager with Hawkular endpoint. To add the hawkular endpoint and their authentications, you need to specify "connection_configurations", which is an array of endpoint objects.

Here is an example of a full request:
{
  "type": "ManageIQ::Providers::Openshift::ContainerManager",
  "name": "sample containers provider with multiple endpoints",
  "connection_configurations": [
    {
      "endpoint": {
        "role": "default",
        "hostname": "sample_openshift_multi_end_point.provider.com",
        "port": "18443",
        "security_protocol": "ssl",
        "certificate_authority": "-----BEGIN CERTIFICATE-----"
      },
      "authentication": {
        "role": "bearer",
        "auth_key": "5bde4e8249db9db3d812da92"
      }
    },
    {
      "endpoint": {
        "role": "hawkular",
        "hostname": "sample_openshift_multi_end_point.provider.com",
        "port": "1443",
        "security_protocol": "something",
        "certificate_authority": "-----BEGIN CERTIFICATE-----"
      },
      "authentication": {
        "role": "hawkular",
        "auth_key": "dc011744cb54ceb3486a67f4e"
      }
    }
  ]
}

Some other information that may be helpful is taking a look at the specs: https://github.com/ManageIQ/manageiq/blob/master/spec/requests/api/providers_spec.rb#L511-L533

Please let me know if you have success utilizing this.

Comment 5 Archit Sharma 2017-05-03 13:20:56 UTC
Worked like a charm! :) thanks!

But I modified it a bit, for our setup didn't have auth on hawkular, and the security protocols were different:

{
  "type": "ManageIQ::Providers::Openshift::ContainerManager",
  "name": "sample containers provider with multiple endpoints",
  "connection_configurations": [
    {
      "endpoint": {
        "role": "default",
        "hostname": "10.16.30.50",
        "port": "8443",
        "security_protocol": "ssl-without-validation",
        "verify_ssl": "0"
      },
      "authentication": {
        "role": "bearer",
        "auth_key": "meh_meh"
      }
    },
    {
      "endpoint": {
        "role": "hawkular",
        "hostname": "test.10.16.30.100.node.metrics.xip.io",
        "port": "443",
        "security_protocol": "ssl-without-validation",
        "verify_ssl": "0"
      }
    }
  ]
}

Hope this auxiliary thread helps a random seeker w/ how-to's on OCP-MIQ.

cheers!


Note You need to log in before you can comment on or make changes to this bug.