HTTP Provider

HTTP TargetSource Discovery Provider

The HTTP provider discovers targets from an HTTP endpoint returning a JSON array of target definitions.

spec:
  provider:
    http:
      url: http://inventory-service:8080/targets

HTTP Spec Fields

FieldTypeRequiredDescription
urlstringYesURL pointing to the inventory server
acceptPushboolNoEnable webhook-based target updates. Defaults to false.
authorizationobjectNoCredentials used to access the HTTP endpoint. See Authorization section.
pollIntervaldurationNoPolling interval used to fetch targets from the endpoint. Defaults to 30s.
timeoutdurationNoTimeout for HTTP requests. Defaults to 10s.
tlsobjectNoClient TLS configuration for HTTPS endpoints. See TLS section.
paginationobjectNoPagination configuration for parsing responses from the HTTP endpoint. See Pagination section.
responseMappingobjectNoJSONPath mapping definitions. See Response Processing section.

Authorization

The HTTP provider supports authenticated requests to the inventory endpoint.

Exactly one authorization method can be configured.

Basic Authentication

Credentials can either be defined inline or referenced from a Secret.

spec:
  provider:
    http:
      url: https://inventory.example.com/targets
      authorization:
        basic:
          username: admin
          password: secret

Using a Secret reference:

spec:
  provider:
    http:
      url: https://inventory.example.com/targets
      authorization:
        basic:
          credentialsSecretRef:
            name: inventory-credentials
            key: username

Token Authentication

Static token authentication can be configured using either an inline token or a Secret reference.

spec:
  provider:
    http:
      url: https://inventory.example.com/targets
      authorization:
        token:
          scheme: Bearer
          token: eyJhbGciOi...

Using a Secret reference:

spec:
  provider:
    http:
      url: https://inventory.example.com/targets
      authorization:
        token:
          scheme: Bearer
          tokenSecretRef:
            name: inventory-token
            key: token

TLS

TLS settings can be configured for HTTPS endpoints.

spec:
  provider:
    http:
      url: https://inventory.example.com/targets
      tls:
        insecureSkipVerify: false

TLS Fields

FieldTypeRequiredDescription
insecureSkipVerifyboolNoSkip verification of the server certificate. Defaults to false.
caBundle[]byteNoBase64-encoded PEM CA bundle used to validate the server certificate.
caBundleSecretRefobjectNoReference to a Secret containing a PEM CA bundle.

caBundle and caBundleSecretRef are mutually exclusive.

Pagination

Pagination can be configured for APIs returning paginated responses.

spec:
  provider:
    http:
      url: https://inventory.example.com/devices
      pagination:
        itemsField: results
        nextField: next

Pagination Fields

FieldTypeRequiredDescription
itemsFieldstringNoTop-level JSON field containing the list of target objects.
nextFieldstringNoTop-level JSON field containing the next page reference or pagination token.

The nextField value may either contain:

  • A full URL for the next request
  • A pagination token appended as a query parameter to the original URL

Response Processing

The HTTP provider supports two methods for processing responses from the inventory endpoint:

  • Default Response Format: The endpoint returns a predefined JSON structure understood directly by the operator.
  • Response Mapping via JSONPath: Arbitrary JSON structures can be mapped to target fields using JSONPath expressions.

If responseMapping is configured, the custom mappings are used. Otherwise, the default response format is expected.

Default Response Format

If responseMapping is not configured, the endpoint must return a JSON array of objects with the following structure:

FieldTypeRequiredDescription
namestringYesName of the generated Target resource
addressstringYesDevice address (FQDN or IP address)
portint32NoPort used for gNMI connections. If omitted, spec.targetPort is used.
labelsmap[string]stringNoLabels added to the generated Target resource
targetProfilestringNoReference to a TargetProfile. If omitted, spec.targetProfile is used.

Example response:

[
  {
    "name": "spine1",
    "address": "spine1.local",
    "port": 57400,
    "labels": {
      "role": "spine"
    },
    "targetProfile": "spine-profile"
  },
  {
    "name": "leaf1",
    "address": "leaf1.local",
    "port": 57400,
    "labels": {
      "role": "leaf"
    }
  },
  {
    "name": "leaf2",
    "address": "leaf2.local",
    "port": 57400,
    "labels": {
      "role": "leaf"
    }
  }
]

Response Mapping via JSONPath

responseMapping allows extracting target fields from arbitrary JSON structures using JSONPath expressions.

spec:
  provider:
    http:
      url: https://inventory.example.com/devices
      responseMapping:
        name: "$.hostname"
        address: "$.management.ip"
        port: "$.gnmi.port"
        targetProfile: "$.profile"
        labels:
          role: "$.metadata.role"
          site: "$.metadata.site"

Response Mapping Fields

FieldTypeRequiredDescription
namestringYesJSONPath expression extracting the target name
addressstringYesJSONPath expression extracting the target IP address or hostname
portstringNoJSONPath expression extracting the gNMI port
targetProfilestringNoJSONPath expression extracting the TargetProfile
labelsmap[string]stringNoJSONPath expressions extracting target labels