Skip to content

Commit

Permalink
Allow project names; clean up docs; reduce logging unless debug is en…
Browse files Browse the repository at this point in the history
…abled (#187)

* update docs link in help text

* update docs link in help text - fix typo

* update all the docs to reflect new argo.project.name field, and clean some minor notes

* update the default config to use project names

* bump version and update argocd_util to check for project name and default to name of app if not available

* fix spacing

* add github URL to the docs

* fix some notes in docs

* allow the option to not do a sync of bitwarden everytime we get an item

* set additional zitadel and secret info to not log unless debug is enabled

* change user response to be a debug option

* fix project creation issue and ensure argocd always makes it in

* fix matrix banner spacing and emoji

* add little blurb for home assistant if it's installed

* add new help screenshot

* add project name to the tui for each app in the apps screen
  • Loading branch information
jessebot authored Mar 24, 2024
1 parent 5822233 commit e7e1f1f
Show file tree
Hide file tree
Showing 41 changed files with 502 additions and 153 deletions.
152 changes: 76 additions & 76 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.
8 changes: 4 additions & 4 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<h1 align="center">
🧸 Smol K8s Lab </h1>
🧸 Smol K8s Lab <a href="https://github.com/jessebot/smol-k8s-lab/releases"><img src="https://img.shields.io/github/v/release/jessebot/smol-k8s-lab?style=plastic&labelColor=484848&color=3CA324&logo=GitHub&logoColor=white"></a></h1>

`smol-k8s-lab` <a href="https://github.com/jessebot/smol-k8s-lab/releases"><img src="https://img.shields.io/github/v/release/jessebot/smol-k8s-lab?style=plastic&labelColor=484848&color=3CA324&logo=GitHub&logoColor=white"></a> leverages Argo CD and slim k8s distributions like K3s to create production-like environments via a declarative workflow. Batteries and 🦑 included.
`smol-k8s-lab` leverages Argo CD and slim k8s distributions like K3s to create production-like environments via a declarative workflow. Batteries and 🦑 included.

## About

`smol-k8s-lab`'s declarative workflow enables rapid iteration in production-like environments with minimal costs for failure. This makes it ideal for proof-of-concepts, prototyping, and benchmarking Kubernetes applications and distributions! 💙
`smol-k8s-lab`'s declarative workflow, CLI, and TUI enable rapid iteration in production-like environments with minimal costs for failure. This makes it ideal for proof-of-concepts, prototyping, and benchmarking Kubernetes applications and distributions! 💙

By default, `smol-k8s-lab` deploys [Argo CD] + [Argo CD Appset Secret Plugin] which enables Argo CD to securely manage your lab via files in open-source Git repos. Additionally, a customized dark-theme is provided for Argo CD's incredibly useful web-interface.
By default, `smol-k8s-lab` deploys [Argo CD] + [Argo CD Appset Secret Plugin] which enables Argo CD to securely manage your lab via files in open-source Git repos. We can optionally make heavy use of Bitwarden. Additionally, a customized dark-theme is provided for Argo CD's incredibly useful web-interface.

Consider viewing my very long walk through if you like video walk-throughs:

Expand Down
4 changes: 4 additions & 0 deletions docs/k8s_apps/argocd.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ apps:
To disable Appset Secret Plugin, please set directory recursion to false.
Learn more: [link=https://github.com/small-hack/appset-secret-plugin]https://github.com/small-hack/appset-secret-plugin[/link]
init:
enabled: true
argo:
# secrets keys to make available to Argo CD ApplicationSets
secret_keys:
Expand All @@ -58,6 +60,8 @@ apps:
directory_recursion: true
# source repos for Argo CD argo-cd Project (in addition to argo_cd.argo.repo)
project:
# you can change this project name :)
name: argo-cd
source_repos:
- https://argoproj.github.io/argo-helm
- https://small-hack.github.io/appset-secret-plugin
Expand Down
1 change: 1 addition & 0 deletions docs/k8s_apps/bitwarden_eso_provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ apps:
secret_keys: {}
# source repos for Argo CD App Project (in addition to app.argo.repo)
project:
name: external-secrets-operator
source_repos:
- https://charts.external-secrets.io
# you can remove this one if you're not using bitwarden to store your k8s secrets
Expand Down
2 changes: 2 additions & 0 deletions docs/k8s_apps/cert_manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ apps:
directory_recursion: false
# source repos for cert-manager CD App Project (in addition to argo.repo)
project:
name: cert-manager
source_repos:
- https://charts.jetstack.io
destination:
Expand Down Expand Up @@ -130,6 +131,7 @@ apps:
directory_recursion: false
# source repos for cert-manager CD App Project (in addition to argo.repo)
project:
name: cert-manager
source_repos:
- https://charts.jetstack.io
destination:
Expand Down
1 change: 1 addition & 0 deletions docs/k8s_apps/cnpg_operator.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ apps:
directory_recursion: false
# source repos for Argo CD App Project (in addition to argo.repo)
project:
name: cnpg-operator
source_repos:
- https://github.com/small-hack/argocd-apps
- https://cloudnative-pg.github.io/charts
Expand Down
4 changes: 2 additions & 2 deletions docs/k8s_apps/experimental/cilium.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ apps:
# 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: "alpha/cilium/"
path: "demo/cilium/"
# either the branch or tag to point at in the argo repo above
ref: "main"
# namespace to install the k8s app in
namespace: "cilium"
# source repos for Argo CD cilium Project
project:
name: cilium
source_repos:
- "https://helm.cilium.io/"
destination:
namespaces:
- argocd
- cilium
```
3 changes: 2 additions & 1 deletion docs/k8s_apps/experimental/infisical.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ apps:
# 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: "infisical/"
path: "demo/infisical/"
# either the branch or tag to point at in the argo repo above
ref: "main"
# namespace to install the k8s app in
namespace: "infisical"
# source repos for Argo CD App Project (in addition to app.argo.repo)
project:
name: infisical
source_repos:
- "registry-1.docker.io"
- "https://dl.cloudsmith.io/public/infisical/helm-charts/helm/charts/"
Expand Down
35 changes: 34 additions & 1 deletion docs/k8s_apps/experimental/kepler.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,37 @@

This app is still in alpha state as we learn more about how best to configure it. In the meantime, to our knowledge you can start playing with it after installing it alongside [cilium](/k8s_apps/cilium.md).

You can also check out our [Kepler Argo CD Application](https://github.com/small-hack/argocd-apps/tree/main/alpha/kepler).
You can also check out our [Kepler Argo CD Application](https://github.com/small-hack/argocd-apps/tree/main/demo/kepler).

## Example Configuration

```yaml
apps:
kepler:
description: |
[link=https://github.com/sustainable-computing-io/kepler]Kepler[/link] (Kubernetes Efficient Power Level Exporter) uses eBPF to probe energy-related system stats and exports them as Prometheus metrics.
enabled: false
# Initialization of the app through smol-k8s-lab
init:
enabled: false
argo:
# secret keys to provide for the argocd secret plugin app, none by default
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: demo/kepler/
# either the branch or tag to point at in the argo repo above
revision: main
# namespace to install the k8s app in
namespace: kepler
# recurse directories in the provided git repo
directory_recursion: false
# source repos for Argo CD App Project (in addition to argo.repo)
project:
source_repos:
- https://sustainable-computing-io.github.io/kepler-helm-chart
destination:
# automatically includes the app's namespace and argocd's namespace
namespaces: []
```
13 changes: 7 additions & 6 deletions docs/k8s_apps/experimental/minio.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[MinIO](https://min.io/) is a high-performance, S3 compatible object store. It is built for large scale AI/ML, data lake and database workloads. It is software-defined and runs on any cloud or on-premises infrastructure. MinIO is dual-licensed under open source GNU AGPL v3 and a commercial enterprise license. We at `smol-k8s-lab` use only the AGPLv3 stuff :)

We currently consider MinIO to be in an alpha state, but to launch it, you just need to provide a `hostname`.
We currently consider MinIO to be in a demo state, but to launch it, you'll need to decide between the operator/tenant helm charts, or the vanilla helm chart.

Check out our [MinIO Argo CD Application](https://github.com/small-hack/argocd-apps/tree/main/alpha/minio).
Check out our [MinIO Argo CD Applications](https://github.com/small-hack/argocd-apps/tree/main/minio).

## Example config
## Example config for vanilla helm chart

```yaml
apps:
minio:
enabled: false
enabled: true
description: |
MinIO®️ is a high-performance, S3 compatible object store.
Expand All @@ -19,17 +19,18 @@ apps:
argo:
# secrets keys to make available to ArgoCD ApplicationSets
secret_keys:
hostname: "objectstore.dogpics.biz"
admin_console_hostname: "objectstore.dogpics.biz"
# 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: "alpha/minio/"
path: "minio/vanilla/"
# either the branch or tag to point at in the argo repo above
ref: "main"
# namespace to install the k8s app in
namespace: "minio"
# source repos for Argo CD App Project (in addition to argo.repo)
project:
name: minio
source_repos:
- https://github.com/small-hack/argocd-apps
destination:
Expand Down
3 changes: 2 additions & 1 deletion docs/k8s_apps/experimental/postgres_operator.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
We are experimenting with the Zalando PostgeSQL Operator to create postgresql clusters and manage backups to S3. Our main interest here is that they support major version backups. Our main concern is the mutual TLS support.

In the PostgeSQL Operator Backups for S3 are done to local s3 endpoints consistently and to a configurable remote endpoint.
In the PostgeSQL Operator, backups for S3 are done to local s3 endpoints consistently and to a configurable remote endpoint. You can see more in our [Zalando Postgres Operator Argo CD Application](https://github.com/small-hack/argocd-apps/tree/main/postgres/operators/zalando).

## Example yaml config

Expand Down Expand Up @@ -47,6 +47,7 @@ apps:
directory_recursion: false
# source repos for Argo CD App Project (in addition to argo.repo)
project:
name: postgres-operator
source_repos:
- https://opensource.zalando.com/postgres-operator/charts/postgres-operator
- https://opensource.zalando.com/postgres-operator/charts/postgres-operator-ui
Expand Down
1 change: 1 addition & 0 deletions docs/k8s_apps/external-secrets-operator.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ apps:
secret_keys: {}
# source repos for Argo CD App Project (in addition to app.argo.repo)
project:
name: external-secrets-operator
source_repos:
- https://charts.external-secrets.io
# you can remove this one if you're not using bitwarden to store your k8s secrets
Expand Down
1 change: 1 addition & 0 deletions docs/k8s_apps/generic_device_plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ apps:
namespace: kube-system
directory_recursion: false
project:
name: generic-device-plugin
source_repos:
- https://github.com/squat/generic-device-plugin
destination:
Expand Down
2 changes: 2 additions & 0 deletions docs/k8s_apps/home_assistant.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ apps:
namespace: home-assistant
directory_recursion: false
project:
name: home-assistant
source_repos:
- https://small-hack.github.io/home-assistant-chart
destination:
Expand All @@ -70,6 +71,7 @@ apps:
namespace: home-assistant
directory_recursion: false
project:
name:
source_repos:
- http://small-hack.github.io/home-assistant-chart
destination:
Expand Down
3 changes: 2 additions & 1 deletion docs/k8s_apps/k8tz.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ apps:
# 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: "alpha/k8tz/"
path: "k8tz/"
# either the branch or tag to point at in the argo repo above
ref: "main"
# namespace to install the k8s app in
namespace: "k8tz"
# source repos for Argo CD App Project (in addition to app.argo.repo)
project:
name: k8tz
source_repos:
- "https://k8tz.github.io/k8tz/"
destination:
Expand Down
1 change: 1 addition & 0 deletions docs/k8s_apps/k8up.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ apps:
namespace: "k8up"
# source repos for Argo CD App Project (in addition to app.argo.repo)
project:
name: k8up
source_repos:
- "https://k8up-io.github.io/k8up"
- "https://github.com/k8up-io/k8up.git"
Expand Down
3 changes: 2 additions & 1 deletion docs/k8s_apps/keycloak.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ apps:
# 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: "alpha/keycloak/"
path: "demo/keycloak/"
# either the branch or tag to point at in the argo repo above
ref: "main"
# namespace to install the k8s app in
namespace: "keycloak"
# source repos for Argo CD App Project (in addition to argo.repo)
project:
name: keycloak
source_repos:
- "registry-1.docker.io"
destination:
Expand Down
1 change: 1 addition & 0 deletions docs/k8s_apps/mastodon.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ apps:
directory_recursion: false
# source repos for Argo CD App Project (in addition to argo.repo)
project:
name: mastodon
# depending on if you use seaweedfs or minio, you can remove the other source repo
source_repos:
- registry-1.docker.io
Expand Down
1 change: 1 addition & 0 deletions docs/k8s_apps/matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ apps:
directory_recursion: false
# source repos for Argo CD App Project (in addition to argo.repo)
project:
name: matrix
source_repos:
- https://small-hack.github.io/cloudnative-pg-cluster-chart
- https://small-hack.github.io/matrix-chart
Expand Down
1 change: 1 addition & 0 deletions docs/k8s_apps/metallb.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ apps:
namespace: metallb-system
# source repos for Argo CD metallb Project (in addition to metallb.argo.repo)
project:
name: metallb
source_repos:
- https://github.com/metallb/metallb.git
destination:
Expand Down
1 change: 1 addition & 0 deletions docs/k8s_apps/nextcloud.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ apps:
directory_recursion: false
# source repos for Argo CD App Project (in addition to argo.repo)
project:
name: nextcloud
source_repos:
- registry-1.docker.io
- https://nextcloud.github.io/helm
Expand Down
1 change: 1 addition & 0 deletions docs/k8s_apps/seaweedfs.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ apps:
directory_recursion: true
# source repos for Argo CD App Project (in addition to argo.repo)
project:
name: seaweedfs
source_repos:
- https://seaweedfs.github.io/seaweedfs/helm
- https://seaweedfs.github.io/seaweedfs-csi-driver/helm
Expand Down
1 change: 1 addition & 0 deletions docs/k8s_apps/vouch.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ apps:
directory_recursion: false
# source repos for Argo CD App Project (in addition to argo.repo)
project:
name: vouch
source_repos:
- https://jessebot.github.io/vouch-helm-chart
destination:
Expand Down
1 change: 1 addition & 0 deletions docs/k8s_apps/zitadel.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ apps:
directory_recursion: false
# source repos for Argo CD App Project (in addition to argo.repo)
project:
name: zitadel
source_repos:
- https://charts.zitadel.com
- https://zitadel.github.io/zitadel-charts
Expand Down
5 changes: 3 additions & 2 deletions mkdocs.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
site_name: smol-k8s-lab
site_url: https://smol-k8s.com
site_name: smol-k8s-lab docs
site_url: https://small-hack.github.io/smol-k8s-lab
repo_url: https://github.com/small-hack/smol-k8s-lab
plugins:
- mkdocs-video
theme:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "smol_k8s_lab"
version = "3.2.2"
version = "3.3.0"
description = "CLI and TUI to quickly install slimmer Kubernetes distros and then manage apps declaratively using Argo CD"
authors = ["Jesse Hitch <jessebot@linux.com>",
"Max Roby <emax@cloudydev.net>"]
Expand Down
10 changes: 9 additions & 1 deletion smol_k8s_lab/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ def process_log_config(log_dict: dict = {"level": "warn", "file": ""}):
for handler in logging.root.handlers[:]:
logging.root.removeHandler(handler)

kubernetes = logging.getLogger("kubernetes")
kubernetes.level = "WARNING"

# this uses the opts dictionary as parameters to logging.basicConfig()
logging.basicConfig(**opts)

Expand Down Expand Up @@ -334,9 +337,14 @@ def main(config: str = "",

matrix_hostname = SECRETS.get('matrix_hostname', "")
if matrix_hostname:
final_msg += ("\n🗣️ Matrix, for your chat:\n"
final_msg += ("\n💬 Matrix, for your chat:\n"
f"[blue][link]https://{matrix_hostname}[/][/]\n")

home_assistant_hostname = SECRETS.get('home_assistant_hostname', "")
if home_assistant_hostname:
final_msg += ("\n🏠 Home Assistant, for managing your IoT needs:\n"
f"[blue][link]https://{home_assistant_hostname}[/][/]\n")

CONSOLE.print(Panel(final_msg,
title='[green]◝(ᵔᵕᵔ)◜ Success!',
subtitle='♥ [cyan]Have a nice day[/] ♥',
Expand Down
7 changes: 4 additions & 3 deletions smol_k8s_lab/bitwarden/bw_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,16 @@ def generate(self, special_characters: bool = False) -> str:
log.debug('New password generated.')
return password

def get_item(self, item_name: str) -> list:
def get_item(self, item_name: str, sync_first: bool = True) -> list:
"""
Get Item and return False if it does not exist else return the item ID
Required Args:
- item_name: str of name of item
"""
# always sync the vault before checking anything
self.sync()
# always sync vault before checking anything, unless otherwise stated
if sync_first:
self.sync()

# go get the actual item
response = json.loads(
Expand Down
Loading

0 comments on commit e7e1f1f

Please sign in to comment.