Skip to content

crossplane-contrib/provider-http

Repository files navigation

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:

    crossplane xpkg install provider xpkg.upbound.io/crossplane-contrib/provider-http:v1.0.11
  2. Manually creating a Provider by applying the following YAML:

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

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.

About

Crossplane Provider designed to facilitate sending HTTP requests as resources.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages