provider-dummy

module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2023 License: Apache-2.0

README

Example Dummy Provider

provider-dummy is a minimal Crossplane Provider that is meant to be used as an experimentation bed while developing Crossplane providers. It includes a simple server implementation to be used as its external API.

server-dummy exposes a single /robots endpoint to interact with robots. It stores the data in memory and does not persist it. See example curl commands to run by running go run cmd/server/main.go.

Local Setup

# This will build two images: provider-dummy and server-dummy.
make build
kind create cluster --wait 5m
# This will deploy server-dummy and port-forward its service to localhost:8080.
# And start the provider-dummy controller locally to connect to the server.
make dev
# Create your first Robot!
kubectl apply -f examples/iam/robots.yaml
kubectl get robots

Usage

There are two ways you can use this provider:

  • Deploying the provider to a Crossplane control plane in no-op mode and then deploying the controller and server to a different cluster that may or may not be publicly accessible.
  • Deploying the provider to a Crossplane-installed cluster and running the server in the same cluster or a publicly accessible cluster.
No-Op Mode

In cases where the provider needs to make API calls to endpoints that are not available to your control plane, you can deploy the provider in no-op mode and deploy its controller separately to a cluster that can reach the external API.

For every versioned release of the provider, there is a corresponding no-op package published with -noop suffix. For example, you can install the no-op variant of v0.2.0 by using v0.2.0-noop image tag.

See this end to end guide for more details.

Local Mode

In this setup, both the fully operational provider and the server are deployed to the same Crossplane-installed cluster.

You can install the provider in your cluster by running the following command:

cat <<EOF | kubectl apply -f -
apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
  name: provider-dummy
spec:
    package: xpkg.upbound.io/upbound/provider-dummy:v0.2.0
EOF

Deploy the server:

kubectl apply -f cluster/server-deployment.yaml

Configure the provider to talk to the server:

kubectl apply -f examples/providerconfig/incluster.yaml

Directories

Path Synopsis
Package apis contains Kubernetes API for the Dummy provider.
Package apis contains Kubernetes API for the Dummy provider.
iam
Package iam contains group iam API versions
Package iam contains group iam API versions
iam/v1alpha1
Package v1alpha1 contains the v1alpha1 group Sample resources of the Dummy provider.
Package v1alpha1 contains the v1alpha1 group Sample resources of the Dummy provider.
v1alpha1
Package v1alpha1 contains the core resources of the Dummy provider.
Package v1alpha1 contains the core resources of the Dummy provider.
cmd
provider command
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL