/idpbuilder

Spin up a complete internal developer platform with only Docker required as a dependency.

Primary LanguageGoApache License 2.0Apache-2.0

Table of Contents

IDP Builder

Internal development platform binary launcher.

WORK IN PROGRESS: This tool is in a pre-release stage and is under active development.

About

Spin up a complete internal developer platform using industry standard technologies like Kubernetes, Argo, and backstage with only Docker required as a dependency.

This can be useful in several ways:

  • Create a single binary which can demonstrate an IDP reference implementation.
  • Use within CI to perform integration testing.
  • Use as a local development environment for IDP engineers.

Quickstart:

Build

make

Run

./idpbuilder create --buildName localdev

You can also define the kubernetes version to image and which corresponds to the kind pre-built image. ./idpbuilder create --kubeVersion v1.27.3

If it is needed to expose some extra Ports between the docker container and the kubernetes host, they can be declared as such ./idpbuilder create --extraPorts 22:32222

It is also possible to use your own kind config file ./idpbuilder create --buildName local --kindConfig ./my-kind.yaml

NOTE: Be sure to include in your kind config the section containerdConfigPatches where the registry hostname includes the name specified with the parameter: --buildname

containerdConfigPatches:
- |-
  [plugins."io.containerd.grpc.v1.cri".registry.mirrors."localhost:5001"]
    endpoint = ["http://idpbuilder-<localBuildName>-registry:5000"]

Use

Kubernetes: kubectl get pods

Argo: https://argocd.cnoe.localtest.me:8443/

Backstage: https://backstage.cnoe.localtest.me:8443/

Developer notes

If you want to contribute and extend the existing project, make sure that you have installed go (>= 1.20) and cloned this project. Next, you can build it make or launch the main.go within your IDE or locally ./idpbuilder.

You can override the kind configuration generated by the idpbuilder. For that purpose, look to the console to grab the config and save it in a file:

########################### Our kind config ############################
# Kind kubernetes release images https://github.com/kubernetes-sigs/kind/releases
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
...
#########################   config end    ############################

Next, import it ./idpbuilder create --kindConfig <path to the config file>

Architecture

The IDP builder binary is primarily composed of a wrapper around a Kubebuilder based operator and associated type called localbuild. See: api/v1alpha1/localbuild_types.go and pkg/controllers/localbuild/controller.go

However it starts out by creating a Kind cluster to register the CRD and controller for localbuild and to host the resources created by it which in turn create the basis for our IDP. You can see the steps taken to install the dependencies and stand up the localbuild controller in the CLI codebase here: pkg/build/build.go

Kind Cluster

The Kind cluster is created using the Kind library and only requires Docker be installed on the host. See: ReconcileKindCluster

Localbuild

Localbuild's reconciler steps through a number of subreconcilers to create all of the IDP components. See: Subreconcilers

The subreconcilers currently include:

GitServer

Gitserver is essentially a fileserver for the Argo apps that are packaged within this IDP builder. As you might expect, it serves the files used by the ArgoCD apps using the git protocol. You can see the container image that contains these files get built here in the GitServer Reconciler

Embedded Argo Apps

The embedded Argo apps are created by the Localbuild reconciler See: Argo Apps Then they are picked up by the ArgoCD operator which in turn connects to the GitServer to perform their gitops deployment.

The resources served by the GitServer are contained within this binary here: pkg/apps/srv

They include:

As you can imagine each of these apps are are deployed by ArgoCD to the Kind cluster created by CLI. The Argo apps can be inspected with kubectl in the argocd namespace and the resources they create can be seen in their corresponding namespaces (backstage and crossplane)

Diagram

Excalidraw diagram here:

Extending the IDP builder

In the future we hope to allow for a pluggable interface to allow for extending the IDP builder with additional argo apps. For now you simply need to add additional apps in the Embedded Apps and also add the resources they will deploy in the srv folder: pkg/apps/srv