provider-kubernetes

module
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 License: Apache-2.0

README

provider-kubernetes

provider-kubernetes is a Crossplane Provider that enables deployment and management of arbitrary Kubernetes objects on clusters typically provisioned by Crossplane:

  • A Provider resource type that only points to a credentials Secret.
  • An Object resource type that is to manage Kubernetes Objects.
  • A managed resource controller that reconciles Object typed resources and manages arbitrary Kubernetes Objects.

Install

If you would like to install provider-kubernetes without modifications, you may do so using the Crossplane CLI in a Kubernetes cluster where Crossplane is installed:

kubectl crossplane install provider crossplane/provider-kubernetes:main

You may also manually install provider-kubernetes by creating a Provider directly:

apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
  name: provider-kubernetes
spec:
  package: "crossplane/provider-kubernetes:main"

Developing locally

See the header of go.mod for the minimum supported version of Go.

Start a local development environment with Kind where crossplane is installed:

make
make local-dev

Run controller against the cluster:

make run

Since the controller is running outside the Kind cluster, you need to make api server accessible (on a separate terminal):

sudo kubectl proxy --port=8081
Testing in Local Cluster
  1. Prepare provider config for the local cluster:

  2. If provider kubernetes running in the cluster (e.g. provider installed with crossplane):

    SA=$(kubectl -n crossplane-system get sa -o name | grep provider-kubernetes | sed -e 's|serviceaccount\/|crossplane-system:|g')
    kubectl create clusterrolebinding provider-kubernetes-admin-binding --clusterrole cluster-admin --serviceaccount="${SA}"
    kubectl apply -f examples/provider/config-in-cluster.yaml
    
  3. If provider kubernetes running outside the cluster (e.g. running locally with make run)

    KUBECONFIG=$(kind get kubeconfig --name local-dev | sed -e 's|server:\s*.*$|server: http://localhost:8081|g')
    kubectl -n crossplane-system create secret generic cluster-config --from-literal=kubeconfig="${KUBECONFIG}" 
    kubectl apply -f examples/provider/config.yaml
    
  4. Now you can create Object resources with provider reference, see sample object.yaml.

    kubectl create -f examples/object/object.yaml
    
Cleanup
make local.down

Directories

Path Synopsis
Package apis contains Kubernetes API for the Template provider.
Package apis contains Kubernetes API for the Template provider.
object
Package object contains group Object API versions
Package object contains group Object API versions
object/v1alpha1
Package v1alpha1 contains the v1alpha1 group Object resources of the Kubernetes provider.
Package v1alpha1 contains the v1alpha1 group Object resources of the Kubernetes provider.
v1alpha1
Package v1alpha1 contains the core resources of the Kubernetes provider.
Package v1alpha1 contains the core resources of the Kubernetes provider.
cmd
internal
clients/gke
Package gke contains utilities for authenticating to GKE clusters.
Package gke contains utilities for authenticating to GKE clusters.

Jump to

Keyboard shortcuts

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