From 98b785195b8e3e5025edb750fc521ac57eeba5bf Mon Sep 17 00:00:00 2001 From: Dipankar Das <65275144+dipankardas011@users.noreply.github.com> Date: Sat, 1 Jun 2024 18:46:05 +0530 Subject: [PATCH] feat: added docs on how to use the ksctl application components Signed-off-by: Dipankar Das <65275144+dipankardas011@users.noreply.github.com> --- content/en/docs/Ksctl Operators/_index.md | 17 +++-- content/en/docs/Ksctl Operators/agent.md | 18 +++++ .../en/docs/Ksctl Operators/application.md | 68 +++++++++++++++++++ .../en/docs/Ksctl Operators/stateimporter.md | 21 ++++++ 4 files changed, 119 insertions(+), 5 deletions(-) create mode 100644 content/en/docs/Ksctl Operators/agent.md create mode 100644 content/en/docs/Ksctl Operators/application.md create mode 100644 content/en/docs/Ksctl Operators/stateimporter.md diff --git a/content/en/docs/Ksctl Operators/_index.md b/content/en/docs/Ksctl Operators/_index.md index d62fcf5..342d846 100644 --- a/content/en/docs/Ksctl Operators/_index.md +++ b/content/en/docs/Ksctl Operators/_index.md @@ -1,14 +1,21 @@ --- title: Ksctl Components description: Place of all the documentation for the Operators used specifically for k8s clusters -categories: [Examples, Placeholders] -tags: [test, docs] +tags: [docs] --- -Operators +## Components - ksctl agent - ksctl stateimporter - ksctl application controller - - +## Sequence diagram on how its deployed +```mermaid +flowchart TD +Base(Ksctl Infra and Bootstrap) -->|Cluster is created| KC(Ksctl controller) +KC -->|Creates| Storage{storageProvider=='local'} +Storage -->|Yes| KSI(Ksctl Storage Importer) +Storage -->|No| KA(Ksctl Agent) +KSI -->KA +KA -->|Health| D(Deploy other ksctl controllers) +``` diff --git a/content/en/docs/Ksctl Operators/agent.md b/content/en/docs/Ksctl Operators/agent.md new file mode 100644 index 0000000..9b9f0c5 --- /dev/null +++ b/content/en/docs/Ksctl Operators/agent.md @@ -0,0 +1,18 @@ +--- +title: Ksctl Agent +description: Documentation on ksctl agent +categories: [Examples, Placeholders] +tags: [docs] +--- + + +{{% pageinfo %}} +It is a ksctl's solution to infrastructure management and also kubernetes management. + +Especially inside the kubertes cluster +{{% /pageinfo %}} + + +It is a GRPC server running as a deployment. and a fleet of controllers will call it to perform certain operations. For instance, application installation via `stack.application.ksctl.com/v1alpha`, etc. + +It will be installed on all kubernetes cluster created via ksctl from >= v1.2.0 \ No newline at end of file diff --git a/content/en/docs/Ksctl Operators/application.md b/content/en/docs/Ksctl Operators/application.md new file mode 100644 index 0000000..02df347 --- /dev/null +++ b/content/en/docs/Ksctl Operators/application.md @@ -0,0 +1,68 @@ +--- +title: Ksctl Application Controller +description: Documentation on ksctl application controller +categories: [Examples, Placeholders] +tags: [docs] +--- + +{{% pageinfo %}} +It helps in deploying applications using crd to help manage with installaztion, upgrades, downgrades, uninstallaztion. from one version to another and provide a single place of truth where to look for which applications are installed +{{% /pageinfo %}} + +## Types + +### Stack + +For defining a hetrogenous components we came up with a stack which contains `M` number of components which are different applications with their versions + +{{% alert title="Info" color="info" %}} +this is current available on all clusters created by `ksctl@v1.2.0` +{{% /alert %}} + +{{% alert title="Note" color="info" %}} +It has a dependency on `ksctl agent` +{{% /alert %}} + +#### Example usage + +Lets deploy `argocd@v2.9.X`, `prometheus-stack@v55.X.Y` +```yaml +apiVersion: application.ksctl.com/v1alpha1 +kind: Stack +metadata: + name: monitoring-plus-gitops +spec: + components: + - appName: argocd + appType: app + version: v2.9.12 + + - appName: prometheus-stack + appType: app + version: "55.0.0" +``` + +You can see once its deployed it fetch and deploys them + +Lets try to upgrade them to their latest versions +```bash +kubeclt edit stack monitoring-plus-gitops +``` + +```yaml +apiVersion: application.ksctl.com/v1alpha1 +kind: Stack +metadata: + name: monitoring-plus-gitops +spec: + components: + - appName: argocd + appType: app + version: latest + + - appName: prometheus-stack + appType: app + version: latest +``` + +once edited it will uninstall the previous install and reinstalls the latest deployments diff --git a/content/en/docs/Ksctl Operators/stateimporter.md b/content/en/docs/Ksctl Operators/stateimporter.md new file mode 100644 index 0000000..5388156 --- /dev/null +++ b/content/en/docs/Ksctl Operators/stateimporter.md @@ -0,0 +1,21 @@ +--- +title: Ksctl State-Importer +description: Documentation on ksctl stateimporter +categories: [Examples, Placeholders] +tags: [docs] +--- + +{{% pageinfo %}} +It is a helper deployment to transfer state information from one storage option to another. +{{% /pageinfo %}} + +It is used to transfer data in `~/.ksctl` location (provided the cluster is created via `storageProvider: store-local`). + + +It utilizes the these 2 methods: +- `Export`: [StorageFactory Interface](https://github.com/ksctl/ksctl/blob/d3c2d74fe03ab1e8ad48d45290662c878196889b/pkg/types/typesStorage.go#L34) +- `Import`: [StorageFactory Interface](https://github.com/ksctl/ksctl/blob/d3c2d74fe03ab1e8ad48d45290662c878196889b/pkg/types/typesStorage.go#L37) + +so before the ksctl agent is deployed we first create this pod which in turn runs a http server having `storageProvider: store-kubernetes` and uses `storage.Import()` method + +once we get 200 OK responses from the http server we remove the pod and move to ksctl agent deployment so that it can use the state file present in configmaps, secrets