Skip to content

Latest commit

 

History

History
118 lines (82 loc) · 3.37 KB

README.md

File metadata and controls

118 lines (82 loc) · 3.37 KB

kindev

Crossplane development environment using kind (Kubernetes-in-Docker).

Requirements

  • kubectl
  • helm v3
  • go (or alternatively kind)
  • docker

Getting started

Short version:

make vshnpostgresql

This will

  1. Install a local Kubernetes cluster with kubernetes-in-docker (kind)
  2. Install Crossplane Helm chart
  3. Install Secrets Generator Helm chart (for providing random passwords)
  4. Install StackGres Operator
  5. Install Prometheus Operator and a Prometheus instance with AlertManager

To uninstall the cluster:

make clean

Access resources on the kind cluster

The kind cluster features an ingress controller, that listens on :8088.

Currently following apps are configured to use the ingress:

For minio access from the localhost just use this alias:

mc alias set localnip http://minio.127.0.0.1.nip.io:8088 minioadmin minioadmin

Minio console access: http://minio-gui.127.0.0.1.nip.io:8088

Vcluster

To toggle the vcluster support please use -e vcluster=true. Any make target that has support for the vcluster will then automatically use the vcluster.

There are also some helper targets for the vcluster:

  • vcluster-clean: will remove the vluster. Helpful if Crossplane broke completely
  • vcluster-in-cluster-kubeconfig: generates a kubeconfig that can be used from within the main cluster. E.g. when deploying the controller or sli-exporter so it can connect to the control plane.
  • vcluster-local-cluster-kubeconfig: same as the above, but will point to the vcluster proxy endpoint. Useful for debugging purpose.

How to use it in make

If you need to install something in the control cluster in make, you can do it like this:

.PHONY: app-setup
app-setup:
  $(vcluster_bin) connect controlplane --namespace vcluster
  $install what you need
  $(vcluster_bin) disconnect

Access vcluster

If you need access to the vcluster from outside make (for example, when applying the AppCat component or other things). Export the kind config and then:

kubectl config get-contexts
# get the vcluster context
# it's the one starting with vcluster_*
kubectl config use-context vcluster_*...

Integration into other projects

kindev is intended to be used by Crossplane providers as a developement and test environment. It can be tied into other projects via a git submodule.

Run inside the git repository of your project:

git submodule add https://github.com/vshn/kindev.git

It is built to work in CI/CD environments. This is an example GitHub workflow to show kindev usage in your project.

name: Demo

on:
  push:
    branches:
      - master

env:
  KIND_CMD: kind # kind is pre-installed in GitHub runners
  KUBECONFIG: 'kindev/.kind/kind-kubeconfig-v1.23.0'

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          submodules: true # required for submodules

      - name: Crossplane setup
        working-directory: kindev
        run: make crossplane-setup

      - name: Your test
        run: kubectl ...