initial commit

This commit is contained in:
Jon Brookes 2025-07-13 13:06:27 +01:00
parent 479c448076
commit 73ff8b5254
8 changed files with 338 additions and 17 deletions

View file

@ -0,0 +1,54 @@
---
title: Configuration
description: infctl configuration
---
`infctl` uses `json` files for configuration.
It is designed around the idea of pipelines where each pipeline performs a series of steps.
A short, 2 step pipeline configuration can look like :
```json
[
{
"name": "ensure inf namespace exists",
"function": "k8sNamespaceExists",
"params": ["infctl"],
"retryCount": 0,
"shouldAbort": true
},
{
"name": "run inf redis secret",
"function": "RunScriptCommand",
"params": ["./scripts/create_php_configmap_ctl.sh"],
"retryCount": 0,
"shouldAbort": true
}
]
```
Each Object is a task.
Object task records are executed in a `[]` list and in sequence.
Each task has a `name` to be displayed in logs.
Each task calls a `Function` that is registered within `infctl` and that accepts `params` string, which are any parameters to be passed to that function, script or executable. The simplest example being `RunScriptCommand` which accepts the path to a script or executable as its `params`. This can be anything but can be as simple as :
```bash
echo "hello world"
exit 0
```
So `infctl` is unlimited as to what it can use in its pipeline files to achieve any kind of automation.
If a task fails ( the script or program that is run returns a non zero value ) it may be re-tried up to `retryCount` times.
If a task fails the pipeline will stop running unless `shouldAbort` is set to false, in which case, the pipeline will continue to run with the next step item in the list.

View file

@ -0,0 +1,14 @@
---
title: Introduction
description: introducing infctl and its guiding principles
---
Kubernetes is complicated, so geting started can be a pain.
There are many tools out there to create a development Kubernetes environment.
`infctl` is just another such tool, however it is designed with simplicity in mind, yet with a view to it being extended into production and beyond.

View file

@ -0,0 +1,25 @@
---
title: Minimal Viable Kubernetes
description: introducing minimal viable Kubernetes and its guiding principles
---
Kubernetes is complicated but additional to this it is designed with cloud compute in mind.
Thus, self hosting options can be limiting.
Out of the box, Kubernetes 'expects' for there to be key ingredient of infrastructure to be present, for example, ingress, storage, load balancers. So if these fundamentals are not present, they need to be supplied in a form that Kubernetes can consume them.
Adding all these pre-requisites can be a challenge and even learning about Kubernetes, let alone setting up a development or 'lab' environment can quickly become messy. Knowing what to create in 'dev' as opposed to 'prod` may introduce unpredictable configuration, even technical debt.
Production environments can also become complex, difficult to manage, even over engineered which may add to technical debt.
Out of these scenarios, Minimal Viable Kubernetes (MVK) is a design pattern attempting to solve these issues.
MVK is there for a minimal setup to get a viable implementation of Kubernetes up and running initially for test and development but also for production use in an entirely self hosted environment, outside of any managed Kubernetes or cloud platform that is proprietary in its design and provisioning.
This increases portability, reduces the likelihood of 'vendor lock in'. It can reduce costs, provided that its users are or become more familiar with Kubernetes and its day to day operational and management requirements - spoiler alert, we think everyone should know more about this so as not to become totally reliant on others to do this for them - and above all, can increase control over our own digital sovereignty.

View file

@ -0,0 +1,15 @@
---
title: Quick Start Guide
description: A guide to setting up MVK quickly.
---
Install `infctl` command line tool with a single command
```bash
curl -L https://codeberg.org/headshed/infctl-cli/raw/branch/chore/code-refactor/install.sh | bash
```
Alternatively, go to [Releases](https://codeberg.org/headshed/infctl-cli/releases) to find a current version for your Operating System, download it and place a copy in your `PATH`.

View file

@ -1,23 +1,25 @@
--- ---
title: Welcome to Starlight title: Welcome to Minimal Viable Kubernetes
description: Get started building your docs site with Starlight. description: Get started building your docs site with Starlight.
template: splash template: splash
hero: hero:
tagline: Congrats on setting up a new Starlight project! tagline: Tools and patterns to deliver self hosted, minimal, viable k8s!
image: image:
file: ../../assets/houston.webp file: ../../assets/houston.webp
actions: actions:
- text: Example Guide - text: MVK Guide
link: /guides/example/ link: /guides/intro/
icon: right-arrow icon: right-arrow
- text: Read the Starlight docs - text: infctl and mvk source
link: https://starlight.astro.build link: https://codeberg.org/headshed/infctl-cli
icon: external icon: external
variant: minimal variant: minimal
--- ---
import { Card, CardGrid } from '@astrojs/starlight/components'; import { Card, CardGrid } from '@astrojs/starlight/components';
{/*
## Next steps ## Next steps
<CardGrid stagger> <CardGrid stagger>
@ -34,3 +36,5 @@ import { Card, CardGrid } from '@astrojs/starlight/components';
Learn more in [the Starlight Docs](https://starlight.astro.build/). Learn more in [the Starlight Docs](https://starlight.astro.build/).
</Card> </Card>
</CardGrid> </CardGrid>
*/}

View file

@ -0,0 +1,84 @@
---
title: API Reference
description: Reference for infctl commands and functions.
---
## Installation
Install `infctl` command line tool:
```bash
curl -L https://codeberg.org/headshed/infctl-cli/raw/branch/chore/code-refactor/install.sh | bash
```
Or download from [Releases](https://codeberg.org/headshed/infctl-cli/releases) and place in your `PATH`.
## Usage
`infctl` uses JSON files for configuration and is designed around pipelines that perform a series of steps.
## Functions
### `k8sNamespaceExists`
Ensures a Kubernetes namespace exists.
**Parameters:**
- `namespace` (string) - Name of the namespace
**Example:**
```json
{
"name": "ensure inf namespace exists",
"function": "k8sNamespaceExists",
"params": ["infctl"],
"retryCount": 0,
"shouldAbort": true
}
```
### `RunScriptCommand`
Executes a shell command, script, or executable.
**Parameters:**
- `command` (string) - Command, script path, or executable to run
**Examples:**
```json
{
"name": "run setup script",
"function": "RunScriptCommand",
"params": ["./scripts/create_php_configmap_ctl.sh"],
"retryCount": 0,
"shouldAbort": true
}
```
```json
{
"name": "say hello",
"function": "RunScriptCommand",
"params": ["echo 'hello world'"],
"retryCount": 0,
"shouldAbort": true
}
```
## Task Properties
### Required
- `name` - Human-readable description displayed in logs
- `function` - Name of function registered within infctl
- `params` - Array of string parameters passed to the function
### Optional
- `retryCount` - Number of times to retry if task fails (default: 0)
- `shouldAbort` - Whether to stop pipeline if task fails (default: true)
## Execution Behavior
- Tasks execute in sequence
- Task fails if script/command returns non-zero exit code
- Failed tasks retry up to `retryCount` times
- If `shouldAbort` is `true` and task fails, pipeline stops
- If `shouldAbort` is `false`, pipeline continues to next task
- Unlimited flexibility through `RunScriptCommand` for any automation

View file

@ -0,0 +1,136 @@
---
title: Configuration Schema
description: JSON schema reference for infctl pipeline configurations.
---
## Pipeline Structure
A pipeline is a JSON array of task objects. Each task represents a single operation to be executed in sequence.
```json
[
{
"name": "ensure inf namespace exists",
"function": "k8sNamespaceExists",
"params": ["infctl"],
"retryCount": 0,
"shouldAbort": true
},
{
"name": "run inf redis secret",
"function": "RunScriptCommand",
"params": ["./scripts/create_php_configmap_ctl.sh"],
"retryCount": 0,
"shouldAbort": true
}
]
```
## Task Object Schema
### Required Properties
#### `name`
- **Type:** `string`
- **Description:** Human-readable description displayed in logs
- **Example:** `"ensure inf namespace exists"`
#### `function`
- **Type:** `string`
- **Description:** Name of the function registered within infctl
- **Known Functions:** `k8sNamespaceExists`, `RunScriptCommand`
- **Example:** `"RunScriptCommand"`
#### `params`
- **Type:** `array`
- **Description:** Array of string parameters passed to the function
- **Example:** `["./scripts/create_php_configmap_ctl.sh"]`
### Optional Properties
#### `retryCount`
- **Type:** `number`
- **Default:** `0`
- **Description:** Number of times to retry the task if it fails (script returns non-zero)
- **Example:** `3`
#### `shouldAbort`
- **Type:** `boolean`
- **Default:** `true`
- **Description:** Whether to stop the pipeline if this task fails. If `false`, pipeline continues to next task
- **Example:** `true`
## Known Functions
Based on the documented examples:
#### `k8sNamespaceExists`
- **Parameters:** `[namespace: string]`
- **Description:** Ensures a Kubernetes namespace exists
#### `RunScriptCommand`
- **Parameters:** `[command: string]`
- **Description:** Executes a shell command, script, or executable
- **Notes:** Can be any command, script path, or executable. Task fails if command returns non-zero exit code
## Example Configurations
### Basic Two-Step Pipeline
```json
[
{
"name": "ensure inf namespace exists",
"function": "k8sNamespaceExists",
"params": ["infctl"],
"retryCount": 0,
"shouldAbort": true
},
{
"name": "run inf redis secret",
"function": "RunScriptCommand",
"params": ["./scripts/create_php_configmap_ctl.sh"],
"retryCount": 0,
"shouldAbort": true
}
]
```
### Simple Script Execution
```json
[
{
"name": "say hello",
"function": "RunScriptCommand",
"params": ["echo 'hello world'"],
"retryCount": 0,
"shouldAbort": true
}
]
```
### Continue on Failure
```json
[
{
"name": "optional cleanup",
"function": "RunScriptCommand",
"params": ["rm -f /tmp/tempfile"],
"retryCount": 0,
"shouldAbort": false
},
{
"name": "main deployment",
"function": "RunScriptCommand",
"params": ["./deploy.sh"],
"retryCount": 2,
"shouldAbort": true
}
]
```
## Execution Rules
1. **Tasks execute in sequence** - Each task in the array runs one after another
2. **Failure handling** - If a task fails (returns non-zero), it may be retried up to `retryCount` times
3. **Pipeline stopping** - If `shouldAbort` is `true` and task fails, pipeline stops. If `false`, pipeline continues
4. **Unlimited flexibility** - `RunScriptCommand` can execute any script, command, or executable for complete automation flexibility

View file

@ -1,11 +0,0 @@
---
title: Example Reference
description: A reference page in my new Starlight docs site.
---
Reference pages are ideal for outlining how things work in terse and clear terms.
Less concerned with telling a story or addressing a specific use case, they should give a comprehensive outline of what you're documenting.
## Further reading
- Read [about reference](https://diataxis.fr/reference/) in the Diátaxis framework