diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b926777..97714b1 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -14,5 +14,5 @@ "forwardPorts": [ 1313 ], - "postStartCommand": "hugo server" + "postStartCommand": "hugo server --bind 0.0.0.0" } diff --git a/.gitignore b/.gitignore index e7e3002..3b13a74 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,7 @@ .hugo_build.lock public + +# for npm devcontainer cli +package-lock.json +package.json + diff --git a/README.md b/README.md index 689b0a9..7e55b7a 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,15 @@ To get a locally running documentation editing and presentation environment, fol 5. start the `devcontainer` (in VSC it's `F1 + Reopen in Devcontainer`) 6. when the container is up & running just open your browser with `http://localhost:1313/` +If you want to run the devcontainer without VS Code, you can use npn to run it inside a docker container: + +1. install Node.js (>= Version 14), npm and the docker engine +2. install the devcontainer cli: `npm install -g @devcontainers/cli` +3. change into the folder of this repo +4. start the devcontainer by running: `devcontainer up --workspace-folder .` +5. find out the IP address of the devconatiner by using `docker ps` and `docker inspect ` +6. when the container is up & running just open your browser with `http://:1313/` + ### Editing #### Documentation language diff --git a/content/en/docs/tools/Backstage/_index.md b/content/en/docs/tools/Backstage/_index.md index 8f451a5..df22096 100644 --- a/content/en/docs/tools/Backstage/_index.md +++ b/content/en/docs/tools/Backstage/_index.md @@ -1,6 +1,6 @@ +++ title = "Backstage" -weight = 4 +weight = 2 [params] author = 'evgenii.dominov@telekom.de' date = '2024-09-36' diff --git a/content/en/docs/tools/CNOE-competitors/_index.md b/content/en/docs/tools/CNOE-competitors/_index.md index 4c9a789..2f8772e 100644 --- a/content/en/docs/tools/CNOE-competitors/_index.md +++ b/content/en/docs/tools/CNOE-competitors/_index.md @@ -1,6 +1,6 @@ +++ title = "Analysis of the CNOE competitors" -weight = 4 +weight = 1 +++ ## Kratix diff --git a/content/en/docs/tools/idpbuilder/_index.md b/content/en/docs/tools/idpbuilder/_index.md new file mode 100644 index 0000000..e302c08 --- /dev/null +++ b/content/en/docs/tools/idpbuilder/_index.md @@ -0,0 +1,6 @@ ++++ +title = "idpbuilder" +weight = 3 ++++ + +Here you will find information about idpbuilder installation and usage \ No newline at end of file diff --git a/content/en/docs/tools/idpbuilder/installation/_index.md b/content/en/docs/tools/idpbuilder/installation/_index.md new file mode 100644 index 0000000..332ff68 --- /dev/null +++ b/content/en/docs/tools/idpbuilder/installation/_index.md @@ -0,0 +1,285 @@ ++++ +title = "Installation of idpbuilder" +weight = 1 ++++ + +## Local installation with KIND Kubernetes + +The idpbuilder uses KIND as Kubernetes cluster. It is suggested to use a virtual machine for the installation. MMS Linux clients are unable to execute KIND natively on the local machine because of network problems. Pods for example can't connect to the internet. + +Windows and Mac users already utilize a virtual machine for the Linux environment. + +### Prerequisites + +- Docker +- Go +- kubectl + +### Build process + +To build idpbuilder the source code can be downloaded and compiled: + +``` +git clone https://github.com/cnoe-io/idpbuilder.git +cd idpbuilder +go build +``` + +The idpbuilder binary will be created in the current directory. + +### Start idpbuilder + +To start the idpbuilder binary execute the following command: + +``` +./idpbuilder create --use-path-routing --log-level debug --package-dir https://github.com/cnoe-io/stacks//ref-implementation +``` + +### Logging into ArgoCD + +At the end of the idpbuilder execution a link is shown to of the installed ArgoCD. The credentianls for access can be obtained by executing: + +``` +./idpbuilder get secrets +``` + +### Logging into KIND + +A Kubernetes config is created in the default location `$HOME/.kube/config`. A management of the Kubernetes config is recommended to not unintentionally delete acces to other clusters like the OSC. + +To show all running KIND nodes execute: + +``` +kubectl get nodes -o wide +``` + +To see all running pods: + +``` +kubectl get pods -o wide +``` + +### Delete the idpbuilder KIND cluster + +The cluster can be deleted by executing: + +``` +idpbuilder delete cluster +``` + +## Remote installation into a bare metal Kubernetes instance + +CNOE provides two implementations of an IDP: + +- Amazon AWS implementation +- KIND implementation + +Both are not useable to run on bare metal or an OSC instance. The Amazon implementation is complex and make suse of Terraform which is currently not supported by either base metal or OSC. Therefore the KIND implementation is used and customized to support the idpbuilder installation. The idpbuilder is doing some magic which needs to be replicated. + +Several prerequisites have to be provided to support the idpbuilder on bare metal or the OSC: + +- Kubernetes dependencies +- Network dependencies +- Changes to the idpbuilder + +### Prerequisites + +Talos Linux is choosen for an bare metal Kubernetes instance. + +- talosctl +- Go +- Docker +- kubectl +- kustomize +- helm +- nginx + +As soon as the idpbuilder works correctly on bare metal, the next step is to apply it to an OSC instance. + +#### Add *.cnoe.localtest.me to hosts file + +Append this lines to `/etc/hosts` + +``` +127.0.0.1 gitea.cnoe.localtest.me +127.0.0.1 cnoe.localtest.me +``` + +#### Install nginx and configure it + +Install nginx by executing: + +``` +sudo apt install nginx +``` + +Replace `/etc/nginx/sites-enabled/default` with the following content: + +``` +server { + listen 8443 ssl default_server; + listen [::]:8443 ssl default_server; + + include snippets/snakeoil.conf; + + location / { + proxy_pass http://10.5.0.20:80; + proxy_http_version 1.1; + proxy_cache_bypass $http_upgrade; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Proto $scheme; + } +} +``` + +Start nginx by executing: + +``` +sudo systemctl enable nginx +sudo systemctl restart nginx +``` + +#### VS Code launch settings for idpbuilder + +First build idpbuilder from source code: + +``` +git clone https://github.com/cnoe-io/idpbuilder.git +cd idpbuilder +go build +``` + +The idpbuilder binary will be created in the current directory. + +Then open the folder in VS Code: + +``` +code . +cd .. +``` + +Create a new launch setting. Add the `"args"` parameter to the launch setting: + +``` +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Launch Package", + "type": "go", + "request": "launch", + "mode": "auto", + "program": "${fileDirname}", + "args": ["create", "--use-path-routing", "--package", "https://github.com/cnoe-io/stacks//ref-implementation"] + } + ] +} +``` + +#### Create the Talos bare metal Kubernetes instance + +Talos by default will create docker containers, similar to KIND. Create the cluster by executing: + +``` +talosctl cluster create +``` + +#### Install local path privisioning (storage) + +``` +cd localpathprovisioning +kustomize build | kubectl apply -f - +cd .. +``` + +#### Install an external load balancer + +``` +kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.14.8/config/manifests/metallb-native.yaml +sleep 50 +kubectl -n metallb-system apply -f pool-1.yml +kubectl -n metallb-system apply -f l2advertisement.yml +``` + +#### Install an ingress controller which uses the external load balancer + +``` +helm upgrade --install ingress-nginx ingress-nginx \ + --repo https://kubernetes.github.io/ingress-nginx \ + --namespace ingress-nginx --create-namespace +sleep 30 +``` + +### Execute idpbuilder + +#### Modify the idpbuilder source code + +Edit the function `Run` in `pkg/build/build.go` and comment out the creation of the KIND cluster: + +``` + /*setupLog.Info("Creating kind cluster") + if err := b.ReconcileKindCluster(ctx, recreateCluster); err != nil { + return err + }*/ +``` + +Compile the idpbuilder + +``` +go build +``` + +#### Start idpbuilder + +Then, in VS Code, switch to main.go in the root directory of the idpbuilder and start debugging. + +#### Logging into ArgoCD + +At the end of the idpbuilder execution a link is shown to of the installed ArgoCD. The credentianls for access can be obtained by executing: + +``` +./idpbuilder get secrets +``` + +#### Logging into Talos cluster + +A Kubernetes config is created in the default location `$HOME/.kube/config`. A management of the Kubernetes config is recommended to not unintentionally delete acces to other clusters like the OSC. + +To show all running Talos nodes execute: + +``` +kubectl get nodes -o wide +``` + +To see all running pods: + +``` +kubectl get pods -o wide +``` + +#### Delete the idpbuilder Talos cluster + +The cluster can be deleted by executing: + +``` +talosctl cluster destroy +``` + +### TODO's for running idpbuilder on bare metal or OSC + +Required: + +- Add *.cnoe.localtest.me to the Talos cluster DNS, pointing to the host device IP address, which runs nginx. + +- Create a SSL certificate with `cnoe.localtest.me` as common name. Edit the nginx config to load this certificate. Configure idpbuilder to distribute this certificate instead of the one idpbuilder distributed by idefault. + +Optimizations: + +- Implement an idpbuilder uninstall. This is specially important when working on the OSC instance. + +- Remove or configure gitea.cnoe.localtest.me, it seems not to work even in the idpbuilder local installation with KIND. + +- Improvements to the idpbuilder to support Kubernetes instances other then KIND. This can either be done by parametrization or by utilizing Terraform / OpenTOFU or Crossplane.