-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Particle is a project designed to aid in the development and testing kubernetes manifests. The world of kubernetes is gigantic, and it continues to grow bigger. When we talk about creating clusters, linting and deploying kubernetes manifests and testing them, here's a lot of ways to the almost the same things. There's a huge variety of tools, data formats and testers. Particle aims to act as glue for all this. So it doesn't matter how you create your cluster, deploy it or test it, you will always follow the same steps.
It provides a consistent set of steps to execute when testing kubernetes manifests. Those steps would be:
- Lint your manifests
- Create a kubernetes cluster
- Deploy your manifests
- Verify that what's deployed on the cluster is in your desired state
- Destroy the cluster
It encourages an approach that results in consistently developed manifests, that are well-written, easily understood, maintained and reproduced..
As you may identified by now if you're an Ansible user, Particle is heavily inspired on Molecule, which provides de same as mentioned but for Ansible.
As said before, Particle is just glue. So by it's own, it doesn't do much. It will need at least a way to manage a cluster (a driver) and a way to deploy kubernetes manifests on it (a provisioner). The default choices are kind as a driver and helm as a provisioner, but there's more integrations. In the future we may integrate the drivers and the provisioners in the Particle binary, but at the moment it uses them as commands, so you'll need to have them installed and in your path.
There's a relatively limited way of creating kubernetes clusters for local development (kind, minikube, k3s, ...) and for deploying manifests in kubernetes (helm, kubectl, kustomize, ...) but there's a lot of tools to lint and verify the state of a cluster. Some of them are even complementary. For that reason, the linting and verifying is totally configurable. In Particle's configuration file, theese sections will be read as scripts, so you can use whatever you want, in the order you want and in the way you want.
Because of that, Particle's documentation will specially concentrate in document how to use as many verifiers and linters as possible, and how to integrate Particle in your CI.
For more detailed instructions see the user guide.
You'll first want to install the dependencies, helm
and kind
:
# Kind
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.11.1/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
# Helm
curl -fsSL -o /tmp/get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 /tmp/get_helm.sh
./tmp/get_helm.sh
# Particle
# You need curl and jq (https://stedolan.github.io/jq/)
latest=$(curl -s https://api.github.com/repos/little-angry-clouds/particle/releases/latest | jq -r ".assets[].browser_download_url" | grep linux_amd64)
# It will return a list of combination of binaries from different architectures and OS, choose the one you want and download it
curl $latest -L -o particle.tar.gz
tar xzf particle.tar.gz
sudo mv particle /usr/local/bin
From here, you can begin with the magic. Since we're using helm as a provisioner, we will create helm chart:
$ particle init chart example
• Begin initialization
• Initialization finished
This command will basically execute helm create
and add a directory for the Particle configuration:
❯ tree example-chart
example-chart
├── charts
├── Chart.yaml
├── particle
│ └── default
│ └── particle.yml
├── templates
│ ├── deployment.yaml
│ ├── _helpers.tpl
│ ├── hpa.yaml
│ ├── ingress.yaml
│ ├── NOTES.txt
│ ├── serviceaccount.yaml
│ ├── service.yaml
│ └── tests
│ └── test-connection.yaml
└── values.yaml
If you have an idea or you want to implement somtehing from the roadmap, open an issue and we can talk about it! I recommend to first open an issue just to avoid tipping our toes, because I might be implementing the same thing.
This section is not yet done, so to get an idea, you might visit the existent components: