Skip to content

Commit

Permalink
Rancher capi demo (#2)
Browse files Browse the repository at this point in the history
* Add Rancher Turtles integration instructions

* Reference Tumbleweed

* Wrap up

* Document Elemental API
  • Loading branch information
anmazzotti authored Sep 28, 2023
1 parent c5850ad commit cbb2f06
Show file tree
Hide file tree
Showing 23 changed files with 4,168 additions and 740 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ docker-build: test ## Build docker image with the manager.
docker-build-agent: test build-agent ## Build docker image with the manager.
mkdir -p demo/bin
cp bin/agent demo/bin/agent
$(CONTAINER_TOOL) build -t agent:latest --no-cache --progress=plain ./demo
$(CONTAINER_TOOL) build -t agent:latest --no-cache ./demo

.PHONY: docker-push
docker-push: ## Push docker image with the manager.
Expand Down
41 changes: 39 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,39 @@
# cluster-api-provider-elemental
The Elemental CAPI infrastructure provider
# Elemental CAPI Infrastructure Provider

This infrastructure provider brings the Elemental stack into the [Kubernete's Cluster API](cluster-api.sigs.k8s.io/).

Elemental is a software stack enabling centralized, full cloud-native OS management with Kubernetes.
For more information about the current features, please read the [official documentation](https://elemental.docs.rancher.com/).

## State of the project

This project is an early prototype.
It will eventually support all the features of the current [elemental-operator](https://github.com/rancher/elemental-operator).
However, backward compatibility is not guaranteed at the moment.

## Overview

![capi overview](doc/images/capi-overview.png)

## Managed Bare Metal hosts

Elemental consists of two main components that can be installed on any host machine:

- [elemental-agent](cmd/agent/README.md) communicates with the Elemental API for OS inventory management and CAPI bootstrapping.
- [elemental-toolkit](https://github.com/rancher/elemental-toolkit) builds, ship and maintain cloud-init driven Linux derivatives.

![elemental host anatomy](doc/images/elemental-host-anatomy.png)

## Elemental API

The Elemental API is a RESTful HTTP API than enables inventory management and CAPI bootstrapping capabilities.
The specifications are published in [OpenAPI format](elemental-openapi.yaml).
You can use it with any OpenAPI compliant tool, for example the online [Swagger Editor](https://editor.swagger.io/).

This API is consumed by the `elemental-agent` and is meant for **Internal** use only.

## Rancher Integration

[Rancher Turtles](https://docs.rancher-turtles.com/) is an extension to Rancher that brings increased integration with Cluster API.

For more information on how to deploy an Elemental CAPI cluster and import it into Rancher, please read the related [documentation](doc/RANCHER.md).
40 changes: 40 additions & 0 deletions cmd/agent/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Elemental CAPI Agent

## Usage

```bash
elemental-agent
```

## Config

By default the agent will look for a configuration in: `/oem/elemental/agent/config.yaml`

```yaml
registration:
# This is the ElementalRegistration URI.
uri: https://my.elemental.api.endpoint/elemental/v1/namespaces/default/registrations/my-registration
# The CA certificate to trust, if any
caCert: |
-----BEGIN CERTIFICATE-----
MIIBvjCCAWOgAwIBAgIBADAKBggqhkjOPQQDAjBGMRwwGgYDVQQKExNkeW5hbWlj
bGlzdGVuZXItb3JnMSYwJAYDVQQDDB1keW5hbWljbGlzdGVuZXItY2FAMTY5NTMw
MjQ0MjAeFw0yMzA5MjExMzIwNDJaFw0zMzA5MTgxMzIwNDJaMEYxHDAaBgNVBAoT
E2R5bmFtaWNsaXN0ZW5lci1vcmcxJjAkBgNVBAMMHWR5bmFtaWNsaXN0ZW5lci1j
YUAxNjk1MzAyNDQyMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE7BzWmM5CljI0
T5qH13xC4ukIkuaU6sn35B39AWIryvNpzB3Dx1Y0QUnFnktEMwln084OvZ1anO7Z
zNi7DO4M7KNCMEAwDgYDVR0PAQH/BAQDAgKkMA8GA1UdEwEB/wQFMAMBAf8wHQYD
VR0OBBYEFISgAh7vrCcMxKZKEikNpWbj20mKMAoGCCqGSM49BAMCA0kAMEYCIQD1
WhfJrSPzvfWPO73w0MFMBRXZ74Tc24SN6QPBin5LaAIhAM9hidFQ71SZQnPY3Y1I
JZPkAoVeIOoFDgXvl9MkHBuk
-----END CERTIFICATE-----
agent:
# Enable agent debug logs
debug: false
# The period used by the agent to sync with the Elemental API
reconciliation: 1m
# Skip TLS verification when communicating with the Elemental API
insecureSkipTLSVerify: false
# Use the system's cert pool for TLS verification
useSystemCertPool: false
```
2 changes: 1 addition & 1 deletion cmd/agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (

"github.com/rancher-sandbox/cluster-api-provider-elemental/internal/agent"
"github.com/rancher-sandbox/cluster-api-provider-elemental/internal/agent/client"
"github.com/rancher-sandbox/cluster-api-provider-elemental/internal/agent/hostname"
log "github.com/rancher-sandbox/cluster-api-provider-elemental/internal/agent/log"
"github.com/rancher-sandbox/cluster-api-provider-elemental/internal/agent/utils"
"github.com/rancher-sandbox/cluster-api-provider-elemental/internal/api"
"github.com/rancher-sandbox/cluster-api-provider-elemental/internal/hostname"
"github.com/rancher-sandbox/cluster-api-provider-elemental/internal/version"
"github.com/spf13/cobra"
"github.com/spf13/viper"
Expand Down
8 changes: 3 additions & 5 deletions demo/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ FROM opensuse/tumbleweed:latest
RUN zypper install -y systemd
RUN zypper install -y fuse-overlayfs
RUN zypper install -y patterns-kubernetes-kubeadm
# Add missing kubeadm dependencies
RUN zypper install -y iproute2 iptables conntrack-tools

## FIXME: Using cri-o until the kubeadm pattern is fixed
RUN systemctl disable containerd
RUN zypper install -y cri-o
COPY crio-docker-storage.conf /etc/crio/crio.conf.d/99-storage.conf
RUN systemctl enable crio
RUN systemctl enable containerd

COPY bin/agent /agent
COPY agent-config.yaml /oem/elemental/agent/config.yaml
Expand Down
4 changes: 2 additions & 2 deletions demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@
1. Start a couple of containers and wait for `kubeadm` to initialize successfully:
```bash
docker run -d --privileged -h host-1 --name host-1 -ti --tmpfs /run -v /sys/fs/cgroup:/sys/fs/cgroup:rw --cgroupns=host --network=kind docker.io/library/agent:latest
docker run -d --privileged -h host-1 --name host-1 -ti --tmpfs /run --tmpfs /var/lib/containerd -v /sys/fs/cgroup:/sys/fs/cgroup:rw --cgroupns=host --network=kind docker.io/library/agent:latest
docker exec -it host-1 /agent
docker run -d --privileged -h host-2 --name host-2 -ti --tmpfs /run -v /sys/fs/cgroup:/sys/fs/cgroup:rw --cgroupns=host --network=kind docker.io/library/agent:latest
docker run -d --privileged -h host-2 --name host-2 -ti --tmpfs /run --tmpfs /var/lib/containerd -v /sys/fs/cgroup:/sys/fs/cgroup:rw --cgroupns=host --network=kind docker.io/library/agent:latest
docker exec -it host-2 /agent
```
Expand Down
187 changes: 0 additions & 187 deletions demo/cluster.yaml

This file was deleted.

3 changes: 0 additions & 3 deletions demo/crio-docker-storage.conf

This file was deleted.

Loading

0 comments on commit cbb2f06

Please sign in to comment.