MCPcopy Index your code
hub / github.com/crossplane-contrib/provider-http

github.com/crossplane-contrib/provider-http @v1.0.14

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.0.14 ↗ · + Follow
1,138 symbols 3,020 edges 150 files 740 documented · 65%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

provider-http

provider-http is a Crossplane Provider designed to facilitate sending HTTP requests as resources.

Installation

To install provider-http, you have two options:

  1. Using the Crossplane CLI in a Kubernetes cluster where Crossplane is installed:

console crossplane xpkg install provider xpkg.upbound.io/crossplane-contrib/provider-http:v1.0.13

  1. Manually creating a Provider by applying the following YAML:

yaml apiVersion: pkg.crossplane.io/v1 kind: Provider metadata: name: provider-http spec: package: 'xpkg.upbound.io/crossplane-contrib/provider-http:v1.0.13'

Supported Resources

provider-http supports resources in two scopes:

Cluster-scoped Resources (http.crossplane.io)

Namespaced Resources (http.m.crossplane.io)

  • DisposableRequest: Namespace-scoped version of the disposable HTTP request.
  • Request: Namespace-scoped version of the managed HTTP resource.
  • ProviderConfig: Namespace-scoped provider configuration.
  • ClusterProviderConfig: Cluster-scoped provider configuration for cross-namespace access.

When to use each:

  • Use cluster-scoped resources for shared infrastructure and when you have cluster-admin privileges
  • Use namespaced resources for tenant isolation, application-specific resources, and when working with namespace-level permissions

TLS Certificate Authentication

The provider supports TLS certificate-based authentication for secure API communication:

  • CA Certificates: Trust custom certificate authorities
  • Client Certificates: Mutual TLS (mTLS) authentication
  • Flexible Configuration: Set TLS at provider or resource level
  • Secret References: Load certificates from Kubernetes secrets

Quick Start

  1. Create certificate secrets:
# CA certificate
kubectl create secret generic ca-certs \
  --from-file=ca.crt=./ca-cert.pem \
  --namespace=crossplane-system

# Client certificate for mTLS
kubectl create secret tls client-certs \
  --cert=./client.crt \
  --key=./client.key \
  --namespace=crossplane-system
  1. Configure ProviderConfig:
apiVersion: http.crossplane.io/v1alpha1
kind: ProviderConfig
metadata:
  name: secure-http
spec:
  credentials:
    source: None
  tls:
    caCertSecretRef:
      name: ca-certs
      namespace: crossplane-system
      key: ca.crt
    clientCertSecretRef:
      name: client-certs
      namespace: crossplane-system
      key: tls.crt
    clientKeySecretRef:
      name: client-certs
      namespace: crossplane-system
      key: tls.key
  1. Use in requests:
apiVersion: http.crossplane.io/v1alpha2
kind: Request
metadata:
  name: secure-api-call
spec:
  providerConfigRef:
    name: secure-http
  forProvider:
    url: https://api.example.com/resource
    method: GET

See examples/provider/tls-config.yaml for more configuration options.

Usage

DisposableRequest

Create a DisposableRequest resource to initiate a single-use HTTP interaction:

apiVersion: http.crossplane.io/v1alpha2
kind: DisposableRequest
metadata:
  name: example-disposable-request
spec:
  # Add your DisposableRequest specification here

For more detailed examples and configuration options, refer to the examples directory.

Request

Manage a resource through HTTP requests with a Request resource:

apiVersion: http.crossplane.io/v1alpha2
kind: Request
metadata:
  name: example-request
spec:
  # Add your Request specification here

For more detailed examples and configuration options, refer to the examples directory.

Namespaced Resources

For namespace-scoped resources, use the http.m.crossplane.io API group:

apiVersion: http.m.crossplane.io/v1alpha2
kind: Request
metadata:
  name: example-namespaced-request
  namespace: my-namespace
spec:
  # Add your Request specification here
  providerConfigRef:
    name: my-namespaced-config

For namespaced examples and configuration options, refer to the namespaced examples directory.

Developing locally

Run controller against the cluster:

make run

Run tests

make test
make e2e

Troubleshooting

If you encounter any issues during installation or usage, refer to the troubleshooting guide for common problems and solutions.

Extension points exported contracts — how you extend this code

Client (Interface)
Client is the interface to interact with Http [7 implementers]
internal/clients/http/client.go
HTTPRequestSpec (Interface)
HTTPRequestSpec defines the common interface for accessing HTTP request configuration. This interface abstracts the diff [6 …
apis/interfaces/spec_accessors.go
RequestStatusHandler (Interface)
RequestStatusHandler is the interface to interact with status setting for Request resources [2 implementers]
internal/service/request/statushandler/status.go
SetRequestStatusFunc (FuncType)
SetRequestStatusFunc is a function that sets the status of a resource.
internal/utils/set_status.go
MockSendRequestFn (FuncType)
(no doc)
internal/controller/namespaced/disposablerequest/disposablerequest_test.go
HTTPResponse (Interface)
HTTPResponse represents the common interface for HTTP response data. [7 implementers]
apis/interfaces/spec_accessors.go
MockSendRequestFn (FuncType)
(no doc)
internal/service/disposablerequest/deployaction_test.go
MockSendRequestWithTLSFn (FuncType)
(no doc)
internal/controller/namespaced/disposablerequest/disposablerequest_test.go

Core symbols most depended-on inside this repo

NewServiceContext
called by 33
internal/service/context.go
GetStatusCode
called by 21
apis/interfaces/spec_accessors.go
NewRequestCRContext
called by 18
internal/service/crcontext.go
Spec
called by 15
internal/service/crcontext.go
buildTLSConfig
called by 15
internal/clients/http/client.go
NewDisposableRequestCRContext
called by 14
internal/service/crcontext.go
GetMethod
called by 10
apis/interfaces/spec_accessors.go
SetRequestResourceStatus
called by 9
internal/utils/set_status.go

Shape

Method 564
Function 358
Struct 171
Interface 24
FuncType 19
TypeAlias 2

Languages

Go100%

Modules by API surface

apis/interfaces/spec_accessors.go69 symbols
apis/namespaced/v1alpha2/zz_generated.deepcopy.go30 symbols
internal/controller/cluster/request/request_test.go29 symbols
apis/namespaced/request/v1alpha2/spec_accessors.go27 symbols
apis/cluster/request/v1alpha2/spec_accessors.go27 symbols
internal/controller/namespaced/disposablerequest/disposablerequest_test.go26 symbols
internal/controller/namespaced/request/request_test.go25 symbols
internal/controller/cluster/disposablerequest/disposablerequest_test.go24 symbols
apis/namespaced/request/v1alpha2/zz_generated.deepcopy.go22 symbols
apis/cluster/request/v1alpha2/zz_generated.deepcopy.go22 symbols
internal/clients/http/client_test.go21 symbols
apis/namespaced/disposablerequest/v1alpha2/spec_accessors.go21 symbols

For agents

$ claude mcp add provider-http \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page