Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log the kind config file generated by our IDP builder #63

Merged
merged 3 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 37 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
Table of Contents
=================

* [IDP Builder](#idp-builder)
* [About](#about)
* [Quickstart](#quickstart)
* [Build](#build)
* [Run](#run)
* [Use](#use)
* [Developer notes](#developer-notes)
* [Architecture](#architecture)
* [Kind cluster](#kind-cluster)
* [Localbuild](#localbuild)
* [Gitserver](#gitserver)
* [Embedded Argo Apps](#embedded-argo-apps)
* [Diagram](#diagram)
* [Extending the IDP builder](#extending-the-idpbuilder)

# IDP Builder

Internal development platform binary launcher.
Expand Down Expand Up @@ -31,6 +49,25 @@ 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:
```text
########################### 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](https://kubebuilder.io) based operator and associated type called localbuild. See: [api/v1alpha1/localbuild_types.go](https://github.com/cnoe-io/idpbuilder/blob/4b0f8ecdd7266083373da51d5add1bca73e05a33/api/v1alpha1/localbuild_types.go#L28-L66) and [pkg/controllers/localbuild/controller.go](https://github.com/cnoe-io/idpbuilder/blob/4b0f8ecdd7266083373da51d5add1bca73e05a33/pkg/controllers/localbuild/controller.go#L54-L84)
Expand Down Expand Up @@ -73,7 +110,5 @@ As you can imagine each of these apps are are deployed by ArgoCD to the Kind clu

[Excalidraw diagram here:](https://excalidraw.com/#json=MNOQf_OeLtKYe_Y80Bt2l,AP-ftLAwZoDWjp2yudnMKA)



## 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](https://github.com/cnoe-io/idpbuilder/blob/4b0f8ecdd7266083373da51d5add1bca73e05a33/pkg/apps/resources.go#L20-L32) and also add the resources they will deploy in the `srv` folder: [pkg/apps/srv](https://github.com/cnoe-io/idpbuilder/blob/4b0f8ecdd7266083373da51d5add1bca73e05a33/pkg/apps/srv/)
4 changes: 4 additions & 0 deletions pkg/kind/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ func (c *Cluster) Reconcile(ctx context.Context, recreate bool) error {
return err
}

fmt.Print("########################### Our kind config ############################\n")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any objections to using a logger? I know it uses fmt here and other places, but I feel like it's nicer to consolidate logging stuff to one way. We currently use mix of fmt and logger and we should consolidate to one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with you. concerning this point, I commented this ticket #15 to propose a better way to log.
We will fix that in a separate PR

fmt.Printf("%s", rawConfig)
fmt.Print("\n######################### config end ############################\n")

fmt.Printf("Creating kind cluster %s\n", c.name)
if err = c.provider.Create(
c.name,
Expand Down
1 change: 0 additions & 1 deletion pkg/kind/resources/kind.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# two node (one workers) cluster config
# Kind kubernetes release images https://github.com/kubernetes-sigs/kind/releases
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
Expand Down