Skip to content

Commit

Permalink
Release v4.0.0 (#206)
Browse files Browse the repository at this point in the history
* bump version and add prometheus CRDs before installing zitadel and rest of prometheus

* don't default recurse directories for zitadel, and always retry on creating claims for zitadel api calls

* fix generic device plugin help text

* add defaults for home assistant bluetooth devices and for home assistant name

* add home assistant latitude, longitude, and elevation to default config

* preparing everything to create a home assistant owner user by default when init is enabled

* bump version to 3.8.0 as we have some new features

* add external url to the secret keys we create for home assistant

* populate external url for home assistant with https or http

* add default country to home assistant variables

* add a default currency

* add todo for checking debug logging and enabling it for argocd by default

* update docs for home assistant

* explain changes to home assistant

* update the docs for prometheus a bit

* fix link in docs for generic device plugin

* always set enabled to False if app is not present

* update version to 4.0.0 and update poetry.lock and add upgrade info to readme

---------

Co-authored-by: jessebot <[email protected]>
  • Loading branch information
cloudymax and jessebot authored Apr 8, 2024
1 parent bf63c11 commit 7e3dd32
Show file tree
Hide file tree
Showing 16 changed files with 736 additions and 254 deletions.
70 changes: 68 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</a>
</h2>
<p align="center">
A terminal based tool to install slimmer k8s distros on metal, with batteries included!
A terminal based tool to install slimmer k8s distros on metal, with batteries included!
</p>

<p align="center">
Expand Down Expand Up @@ -73,10 +73,76 @@ Checkout our [TUI docs](https://small-hack.github.io/smol-k8s-lab/tui/create_mod
After you've followed the installation instructions, if you're *new* to `smol-k8s-lab`, initialize a new config file:

```bash
# we'll walk you through any configuration needed before
# we'll walk you through any configuration needed before
# saving the config and deploying it for you
smol-k8s-lab
```
<details>
<summary><b>Upgrading config from v3.7.1 to v4.x</b></summary>

If you've installed smol-k8s-lab prior to `v4.0.0`, please backup your old configuration, and then remove the `~/.config/smol-k8s-lab/config.yaml` (or `$XDG_CONFIG_HOME/smol-k8s-lab/config.yaml`) file entirely, then run the following with either pip or pipx:

*if using pip*:
```yaml
# this upgrades smol-k8s-lab
pip3.11 install --upgrade smol-k8s-lab

# this initializes a new configuration
smol-k8s-lab
```

*or if using pipx*:
```yaml
# this upgrades smol-k8s-lab
pipx upgrade smol-k8s-lab

# this initializes a new configuration
smol-k8s-lab
```

The main breaking changes between `v3.7.1` and `v4.0.0` are that we now default enable metrics on most apps. Because of this, you need to have the Prometheus ServiceMonitor CRD installed ahead of time. Luckily, we now provide that as an app as well :) If you deleted your config and created a new one, it will already be there, but if you want to reuse your old config, you can add the app like this:

```yaml
apps:
prometheus_crds:
description: |
[link=https://prometheus.io/docs/introduction/overview/]Prometheus[/link] CRDs to start with.
You can optionally disable this if you don't want to deploy apps with metrics.
enabled: true
argo:
# secrets keys to make available to Argo CD ApplicationSets
secret_keys: {}
# git repo to install the Argo CD app from
repo: https://github.com/small-hack/argocd-apps
# path in the argo repo to point to. Trailing slash very important!
path: prometheus/crds/
# either the branch or tag to point at in the argo repo above
revision: main
# namespace to install the k8s app in
namespace: prometheus
# recurse directories in the provided git repo
directory_recursion: false
# source repos for Argo CD App Project (in addition to argo.repo)
project:
name: prometheus
source_repos:
- https://github.com/prometheus-community/helm-charts.git
destination:
# automatically includes the app's namespace and argocd's namespace
namespaces:
- kube-system
- prometheus
```
If using the default repos, please also disable directory directory_recursion for:
- your prometheus stack app
- zitadel
For all changes, please check out [PR #206](https://github.com/small-hack/smol-k8s-lab/pull/206).
</details>
<details>
<summary><b>Upgrading config from v2.2.4 to v3.x</b></summary>
Expand Down
112 changes: 56 additions & 56 deletions docs/assets/images/screenshots/help_text.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/k8s_apps/generic_device_plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ apps:
generic_device_plugin:
enabled: true
description: |
This installs the [link=https://github.com/squat/generic-device-plugin/tree/main]squat/generic-device-plugin[/link], which is recommended for exposing generic devices such as USB devices to your k8s pods. This can useful if you have an IoT coordinator device such as the conbee 2 that you are using with deconz or home assistant. You can read more about device plugins in the [Kubernetes docs](https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/).
This installs the [link=https://github.com/squat/generic-device-plugin/tree/main]squat/generic-device-plugin[/link], which is recommended for exposing generic devices such as USB devices to your k8s pods. This can useful if you have an IoT coordinator device such as the conbee 2 that you are using with deconz or home assistant. You can read more about device plugins in the [link=https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/]Kubernetes docs[/link]
argo:
secret_keys: {}
repo: https://github.com/small-hack/argocd-apps
Expand Down
109 changes: 88 additions & 21 deletions docs/k8s_apps/home_assistant.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,85 @@
[Home Assistant](https://www.home-assistant.io/) is an open source IoT management solution. We deploy a [small-hack maintained helm chart](https://github.com/small-hack/home-assistant-chart/) by default.
[Home Assistant](https://www.home-assistant.io/) is an open source IoT management solution. We deploy a [small-hack maintained helm chart](https://github.com/small-hack/home-assistant-chart/) by default, which allows us to:

- specify a default `configuration.yaml`
- create an initial user to disable public registration

<img src="../../assets/images/screenshots/home-assistant_screenshot.png" alt="screenshot of the home-assistant-app in Argo CD showing a tree featuring a configmap, pvc, service, service account, deployment, and ingress resource all called home-assistant.">

The main variable you need to worry about when setting up home assistant is your `hostname`.
*NOTE*: You'll need to enable the [Generic Device Plugin](/k8s_apps/generic-device-plugin.md) as a prereq in order to use USB devices with home assistant.

### Secret Keys

The main variables you need to worry about when setting up home assistant is your `hostname`.

You'll need the [Generic Device Plugin](/k8s_apps/generic-device-plugin.md) as a prereq in order to use USB devices with home assistant.
### Sensitive Initialization Values
Since we support the creation of an initial user for Home Assistant, you need to either fill in the password for that user via the TUI, or before you run `smol-k8s-lab`, you run the following to export `$HOME_ASSISTANT_PASSWORD` as an enviornment variable:

```bash
export HOME_ASSISTANT_PASSWORD="mysupersecretpassword"
```

## Example configs

### Using tolerations and node affinity

```yaml
apps:
home_assistant:
enabled: true
description: |
[link=https://home-assistant.io]Home Assistant[/link] is a home IOT management solution.
By default, we assume you want to use node affinity and tolerations to keep home assistant pods on certain nodes and keep other pods off said nodes. If you don't want to use either of these features but still want to use the small-hack/argocd-apps repo, first change the argo path to /home-assistant/ and then remove the 'toleration_' and 'affinity' secret_keys from the yaml file under apps.home_assistant.description.
[b]NOTE[/b]: If you want to pass in a USB device, you will need the generic device plugin (which is available as a default Argo CD app via smol-k8s-lab 💙)
This app takes one sensitive value, password for the initial owner user. You can also pass it in as an enviornment variable called $HOME_ASSISTANT_PASSWORD.
# Initialization of the app through smol-k8s-lab
init:
# enable the creation of an initial owner user
enabled: true
values:
# -- owner user's name
name: "admin"
# -- owner user's username
user_name: "admin"
# -- owner user's language, default is english
language: "en"
sensitive_values:
- PASSWORD
argo:
secret_keys:
hostname: "home-assistant.cooldomainfordogs.biz"
hostname: ""
# name of your home assistant area, users often just use "home"
name: "home"
# default alpha-2 country code, default is NL which is The Netherlands
country: "NL"
# currency code to use for calculating costs, defaults to EUR for euro
currency: "EUR"
# other option is "imperial"
unit_system: "metric"
# set to F for USA imperialist tempurature
temperature_unit: "C"
# tolerate taints
toleration_key: "iot"
toleration_operator: "Equal"
toleration_value: "true"
toleration_effect: "NoSchedule"
# make the node attractive
affinity_key: "iot"
affinity_value: "true"
# latitude of your personal coordinates
latitude: ""
# longitude of your personal coordinates
longitude: ""
# the elevation of your house?
elevation: ""
# you can delete these if you're not using tolerations/affinity
toleration_key: ""
toleration_operator: ""
toleration_value: ""
toleration_effect: ""
# these are for node affinity, delete if not in use
affinity_key: ""
affinity_value: ""
# these are for passing in a USB device such as the conbee II
# this is the path on the node
usb_device_path: "/dev/serial/by-id/usb-ITEAD_SONOFF_Zigbee_3.0_USB_Dongle_Plus_V2_20230509111242-if00"
# this is the path on the container
usb_device_path: ""
usb_device_mount_path: "/dev/ttyACM0"
# this is the generic device plugin device index
usb_device_index: "1"
# these are for passing in a bluetooth device
bluetooth_device_path: /run/dbus
bluetooth_device_mount_path: /run/dbus
bluetooth_device_index: '2'
repo: https://github.com/small-hack/argocd-apps
path: home-assistant/toleration_and_affinity/
revision: main
Expand All @@ -60,20 +102,45 @@ apps:
enabled: true
description: |
[link=https://home-assistant.io]Home Assistant[/link] is a home IOT management solution.
init:
enabled: true
values:
# -- owner user's name
name: "admin"
# -- owner user's username
user_name: "admin"
# -- owner user's language, default is english
language: "en"
sensitive_values:
- PASSWORD
argo:
secret_keys:
hostname: "home-assistant.cooldomainfordogs.biz"
hostname: ""
# name of your home assistant area, users often just use "home"
name: "home"
# default alpha-2 country code, default is NL which is The Netherlands
country: "NL"
# currency code to use for calculating costs, defaults to EUR for euro
currency: "EUR"
# other option is "imperial"
unit_system: "metric"
# set to F for USA imperialist tempurature
temperature_unit: "C"
# latitude of your personal coordinates
latitude: ""
# longitude of your personal coordinates
longitude: ""
# the elevation of your house?
elevation: ""
repo: https://github.com/small-hack/argocd-apps
path: home-assistant/
revision: main
namespace: home-assistant
directory_recursion: false
project:
name:
name: home-assistant
source_repos:
- http://small-hack.github.io/home-assistant-chart
- https://small-hack.github.io/home-assistant-chart
destination:
namespaces:
- argocd
Expand Down
90 changes: 90 additions & 0 deletions docs/k8s_apps/prometheus.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,93 @@ You can see an overview of the whole Prometheus Stack Argo CD Application at [sm
<a href="../../assets/images/screenshots/prometheus_screenshot.png">
<img src="../../assets/images/screenshots/prometheus_screenshot.png" alt="screenshot of the Argo CD web interface showing the prometheus app of apps which includes the following children: loki, prometheus-crd, prometheus-appset, prometheus-pushgateway-appset">
</a>

## Important note

We haven't generated new screenshots, but we've updated how we now deploy the Prometheus CRDs. They are now deployed separately, so that anything that relies on them that gets deployed earlier on, such as your identity provider, which you may want to secure the prometheus related frontends.

## Example configs

### Custom Resource Definitions (CRDs)

```yaml
apps:
prometheus_crds:
description: |
[link=https://prometheus.io/docs/introduction/overview/]Prometheus[/link] CRDs to start with.
You can optionally disable this if you don't want to deploy apps with metrics.
enabled: true
argo:
# secrets keys to make available to Argo CD ApplicationSets
secret_keys: {}
# git repo to install the Argo CD app from
repo: https://github.com/small-hack/argocd-apps
# path in the argo repo to point to. Trailing slash very important!
path: prometheus/crds/
# either the branch or tag to point at in the argo repo above
revision: main
# namespace to install the k8s app in
namespace: prometheus
# recurse directories in the provided git repo
directory_recursion: false
# source repos for Argo CD App Project (in addition to argo.repo)
project:
name: prometheus
source_repos:
- https://github.com/prometheus-community/helm-charts.git
destination:
# automatically includes the app's namespace and argocd's namespace
namespaces:
- kube-system
- prometheus
```
### kube-prometheus-stack
**NOTE**: You need to *also* enable the CRD app above for this to work!
```yaml
apps:
prometheus:
description: |
Full monitoring stack with [link=https://prometheus.io/docs/introduction/overview/]Prometheus[/link], grafana, loki, and alert manager.
smol-k8s-lab supports initialization by setting up your ingress hostnames.
enabled: false
argo:
# secrets keys to make available to Argo CD ApplicationSets
secret_keys:
# FQDN to use for Prometheus web interface
hostname: ""
# FQDN to use for grafana
grafana_hostname: ""
# FQDN to use for Alert Manager web interface
alert_manager_hostname: ""
# FQDN to use for the prometheus push gateway
push_gateway_hostname: ""
# git repo to install the Argo CD app from
repo: https://github.com/small-hack/argocd-apps
# path in the argo repo to point to. Trailing slash very important! This
# is an app of apps. Change to "monitoring/kube-prometheus-stack/" to
# only install kube-prometheus-stack (foregoing loki and push gateway)
path: prometheus/
# either the branch or tag to point at in the argo repo above
revision: main
# namespace to install the k8s app in
namespace: "prometheus"
# recurse directories in the provided git repo
directory_recursion: false
# source repos for Argo CD App Project (in addition to argo.repo)
project:
name: prometheus
source_repos:
- "registry-1.docker.io"
- "https://github.com/prometheus-community/helm-charts.git"
- "https://prometheus-community.github.io/helm-charts"
destination:
# automatically includes the app's namespace and argocd's namespace
namespaces:
- kube-system
```
Loading

0 comments on commit 7e3dd32

Please sign in to comment.