Infra-Lab cli devlog #1
I've started a migration of a bunch of makefiles to a binary to ease the process of local infra management Here is the repo https://github.com/infra-lab-xyz/infra-lab-cli
I've started a migration of a bunch of makefiles to a binary to ease the process of local infra management Here is the repo https://github.com/infra-lab-xyz/infra-lab-cli
Well, I still need to figure out how to work with k8s networks, with proxy protocol, and how to run services in k8s with knowledge about which IP made a request.
This all requires the possibility to run and recreate local infra. That's why I decided to migrate Makefiles from https://github.com/yura-shutkin/k8s-lab to an application that I can run from any directory, and I would like to have completion for some parameters.
Here is the new repo https://github.com/infra-lab-xyz/infra-lab-cli
In short, it is a wrapper over other tools: podman, minikube, kind, webhook, helm, with more to come.
I'm adding some extra logic I've never had in Makefile: autocomplete supported k8s versions in minikube, for example.
2 issues are closed:
I've added podman machine management, well, without create and delete, but start, stop, restart, and configure are implemented.
I've added kind and minikube commands to manage local clusters
I've added the possibility to use config and override default values with config file, env variable or a flag in the command.
Previously, to modify the config, add a new parameter or remove an existing one, I needed to touch at least 3 places:
Now I need to update just one place, the config itself.
type ILCConfig struct {
Version string `mapstructure:"version" default:"1.0"`
Apps apps `mapstructure:"apps" `
ProjectsDir string `mapstructure:"projects_dir" default:"~/.infra-lab"`
}
type apps struct {
Docker dockerConfig `mapstructure:"docker" `
Helm helm `mapstructure:"helm" `
Kind kind `mapstructure:"kind" `
Minikube minikube `mapstructure:"minikube" `
Podman podman `mapstructure:"podman" `
Skopeo skopeo `mapstructure:"skopeo" `
Webhook webhook `mapstructure:"webhook" `
}
type skopeo struct {
Binary string `mapstructure:"binary" default:"skopeo"`
}
Part of config structure
Also, I like being able to set Grafana configs via env vars. So here I can do too.
This variable ILC__APPS__MINIKUBE__KUBE_VERSION
can override the default value of the Kubernetes version to use in the minikube cluster.
I'm working on Helm. I have no issues with HTTP helm repos, but with OCI. OCI is supported by Helm, yet you cannot add the OCI repo. And to deploy, you need to provide the whole address, which is a bit too much.
So why not save OCI repos to a file and query when necessary the list to allow helm upgrade --instal <repo_name>/<chart_name>...
command
Another thing is the config itself. The config file is not created yet, and the project dir as well.