Code Monkey home page Code Monkey logo

idpbuilder's Introduction

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 --build-name localdev

You can also define the kubernetes version to image and which corresponds to the kind pre-built image. ./idpbuilder create --kube-version 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 --extra-ports 22:32222

It is also possible to use your own kind config file ./idpbuilder create --build-name local --kind-config ./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: --build-name

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

Use

GUI

GUIs for core packages are available at the following addresses:

Architecture

idpbuilder is made of two phases: CLI and Kubernetes controllers.

idpbuilder.png

CLI

When the idpbuilder binary is executed, it starts with the CLI phase.

  1. This is the phase where command flags are parsed and translated into relevant Go structs' fields. Most notably the LocalBuild struct.
  2. Create a Kind cluster, then update the kubeconfig file.
  3. Once the kind cluster is started and relevant fields are populated, Kubernetes controllers are started:
  • LocalbuildReconciler responsible for bootstrapping the cluster with absolute necessary packages. Creates Custom Resources (CRs) and installs embedded manifests.
  • RepositoryReconciler responsible for creating and managing Gitea repository and repository contents.
  • CustomPackageReconciler responsible for managing custom packages.
  1. They are all managed by a single Kubernetes controller manager.
  2. Once controllers are started, CRs corresponding to these controllers are created. For example for Backstage, it creates a GitRepository CR and ArgoCD Application.
  3. CLI then waits for these CRs to be ready.

Controllers

During this phase, controllers act on CRs created by the CLI phase. Resources such as Gitea repositories and ArgoCD applications are created.

LocalbuildReconciler

LocalbuildReconciler bootstraps the cluster using embedded manifests. Embedded manifests are yaml files that are baked into the binary at compile time.

  1. Install core packages. They are essential services that are needed for the user experiences we want to enable:
  • Gitea. This is the in-cluster Git server that hosts Git repositories.
  • Ingress-nginx. This is necessary to expose services inside the cluster to the users.
  • ArgoCD. This is used as the packaging mechanism. Its primary purpose is to deploy manifests from gitea repositories.
  1. Once they are installed, it creates GitRepository CRs for core packages. This CR represents the git repository on the Gitea server.
  2. Create ArgoCD applications for the apps. Point them to the Gitea repositories. From here on, ArgoCD manages the core packages.

Once core packages are installed, it creates the other embedded applications: Backstage and Crossplane.

  1. Create GitRepository CRs for the apps.
  2. Create ArgoCD applications for the apps. Point them to the Gitea repositories.

RepositoryReconciler

RepositoryReconciler creates Gitea repositories. The content of the repositories can either be sourced from Embedded file system or local file system.

CustomPackageReconciler

CustomPackageReconciler parses the specified ArgoCD application files. If they specify repository URL with the scheme cnoe://, it creates GitRepository CR with source specified as local, then creates ArgoCD application with the repository URL replaced.

For example, if an ArgoCD application is specified as the following.

apiVersion: argoproj.io/v1alpha1
kind: Application
spec:
  source:
    repoURL: cnoe://busybox

Then, the actual object created is this.

apiVersion: argoproj.io/v1alpha1
kind: Application
spec:
  source:
    repoURL: http://my-gitea-http.gitea.svc.cluster.local:3000/giteaAdmin/idpbuilder-localdev-my-app-busybox.git

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>

Extending the IDP builder

We are actively working to include more patterns and examples of extending idpbuilder to get started easily.

idpbuilder's People

Contributors

nabuskey avatar greghaynes avatar jessesanford avatar cmoulliard avatar nimakaviani avatar blakeromano avatar webstradev avatar luebken avatar kahilof avatar hodgiwabi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.