kustodian 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +346 -0
- package/dist/cli/bin.d.ts +3 -0
- package/dist/cli/bin.d.ts.map +1 -0
- package/dist/cli/bin.js +67 -0
- package/dist/cli/bin.js.map +1 -0
- package/dist/cli/command.d.ts +57 -0
- package/dist/cli/command.d.ts.map +1 -0
- package/dist/cli/command.js +26 -0
- package/dist/cli/command.js.map +1 -0
- package/dist/cli/commands/apply.d.ts +8 -0
- package/dist/cli/commands/apply.d.ts.map +1 -0
- package/dist/cli/commands/apply.js +802 -0
- package/dist/cli/commands/apply.js.map +1 -0
- package/dist/cli/commands/init.d.ts +5 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +403 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/sources.d.ts +5 -0
- package/dist/cli/commands/sources.d.ts.map +1 -0
- package/dist/cli/commands/sources.js +377 -0
- package/dist/cli/commands/sources.js.map +1 -0
- package/dist/cli/commands/update.d.ts +5 -0
- package/dist/cli/commands/update.d.ts.map +1 -0
- package/dist/cli/commands/update.js +314 -0
- package/dist/cli/commands/update.js.map +1 -0
- package/dist/cli/commands/validate.d.ts +5 -0
- package/dist/cli/commands/validate.d.ts.map +1 -0
- package/dist/cli/commands/validate.js +126 -0
- package/dist/cli/commands/validate.js.map +1 -0
- package/dist/cli/container.d.ts +48 -0
- package/dist/cli/container.d.ts.map +1 -0
- package/dist/cli/container.js +49 -0
- package/dist/cli/container.js.map +1 -0
- package/dist/cli/index.d.ts +8 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +9 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/middleware.d.ts +118 -0
- package/dist/cli/middleware.d.ts.map +1 -0
- package/dist/cli/middleware.js +280 -0
- package/dist/cli/middleware.js.map +1 -0
- package/dist/cli/runner.d.ts +34 -0
- package/dist/cli/runner.d.ts.map +1 -0
- package/dist/cli/runner.js +156 -0
- package/dist/cli/runner.js.map +1 -0
- package/dist/cli/utils/defaults.d.ts +23 -0
- package/dist/cli/utils/defaults.d.ts.map +1 -0
- package/dist/cli/utils/defaults.js +43 -0
- package/dist/cli/utils/defaults.js.map +1 -0
- package/dist/core/error.d.ts +117 -0
- package/dist/core/error.d.ts.map +1 -0
- package/dist/core/error.js +210 -0
- package/dist/core/error.js.map +1 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +6 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/logger.d.ts +31 -0
- package/dist/core/logger.d.ts.map +1 -0
- package/dist/core/logger.js +78 -0
- package/dist/core/logger.js.map +1 -0
- package/dist/core/path.d.ts +57 -0
- package/dist/core/path.d.ts.map +1 -0
- package/dist/core/path.js +154 -0
- package/dist/core/path.js.map +1 -0
- package/dist/core/result.d.ts +80 -0
- package/dist/core/result.d.ts.map +1 -0
- package/dist/core/result.js +150 -0
- package/dist/core/result.js.map +1 -0
- package/dist/core/types.d.ts +80 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +5 -0
- package/dist/core/types.js.map +1 -0
- package/dist/generator/external-substitutions.d.ts +21 -0
- package/dist/generator/external-substitutions.d.ts.map +1 -0
- package/dist/generator/external-substitutions.js +49 -0
- package/dist/generator/external-substitutions.js.map +1 -0
- package/dist/generator/flux.d.ts +61 -0
- package/dist/generator/flux.d.ts.map +1 -0
- package/dist/generator/flux.js +294 -0
- package/dist/generator/flux.js.map +1 -0
- package/dist/generator/generator.d.ts +77 -0
- package/dist/generator/generator.d.ts.map +1 -0
- package/dist/generator/generator.js +183 -0
- package/dist/generator/generator.js.map +1 -0
- package/dist/generator/index.d.ts +9 -0
- package/dist/generator/index.d.ts.map +1 -0
- package/dist/generator/index.js +9 -0
- package/dist/generator/index.js.map +1 -0
- package/dist/generator/kustomization-resolution.d.ts +40 -0
- package/dist/generator/kustomization-resolution.d.ts.map +1 -0
- package/dist/generator/kustomization-resolution.js +59 -0
- package/dist/generator/kustomization-resolution.js.map +1 -0
- package/dist/generator/namespace.d.ts +74 -0
- package/dist/generator/namespace.d.ts.map +1 -0
- package/dist/generator/namespace.js +109 -0
- package/dist/generator/namespace.js.map +1 -0
- package/dist/generator/output.d.ts +56 -0
- package/dist/generator/output.d.ts.map +1 -0
- package/dist/generator/output.js +171 -0
- package/dist/generator/output.js.map +1 -0
- package/dist/generator/preservation.d.ts +45 -0
- package/dist/generator/preservation.d.ts.map +1 -0
- package/dist/generator/preservation.js +71 -0
- package/dist/generator/preservation.js.map +1 -0
- package/dist/generator/substitution.d.ts +79 -0
- package/dist/generator/substitution.d.ts.map +1 -0
- package/dist/generator/substitution.js +210 -0
- package/dist/generator/substitution.js.map +1 -0
- package/dist/generator/types.d.ts +162 -0
- package/dist/generator/types.d.ts.map +1 -0
- package/dist/generator/types.js +2 -0
- package/dist/generator/types.js.map +1 -0
- package/dist/generator/validation/cycle-detection.d.ts +25 -0
- package/dist/generator/validation/cycle-detection.d.ts.map +1 -0
- package/dist/generator/validation/cycle-detection.js +101 -0
- package/dist/generator/validation/cycle-detection.js.map +1 -0
- package/dist/generator/validation/enablement.d.ts +24 -0
- package/dist/generator/validation/enablement.d.ts.map +1 -0
- package/dist/generator/validation/enablement.js +69 -0
- package/dist/generator/validation/enablement.js.map +1 -0
- package/dist/generator/validation/graph.d.ts +29 -0
- package/dist/generator/validation/graph.d.ts.map +1 -0
- package/dist/generator/validation/graph.js +106 -0
- package/dist/generator/validation/graph.js.map +1 -0
- package/dist/generator/validation/index.d.ts +38 -0
- package/dist/generator/validation/index.d.ts.map +1 -0
- package/dist/generator/validation/index.js +64 -0
- package/dist/generator/validation/index.js.map +1 -0
- package/dist/generator/validation/reference.d.ts +45 -0
- package/dist/generator/validation/reference.d.ts.map +1 -0
- package/dist/generator/validation/reference.js +143 -0
- package/dist/generator/validation/reference.js.map +1 -0
- package/dist/generator/validation/requirements.d.ts +25 -0
- package/dist/generator/validation/requirements.d.ts.map +1 -0
- package/dist/generator/validation/requirements.js +64 -0
- package/dist/generator/validation/requirements.js.map +1 -0
- package/dist/generator/validation/types.d.ts +116 -0
- package/dist/generator/validation/types.d.ts.map +1 -0
- package/dist/generator/validation/types.js +13 -0
- package/dist/generator/validation/types.js.map +1 -0
- package/dist/k8s/exec.d.ts +20 -0
- package/dist/k8s/exec.d.ts.map +1 -0
- package/dist/k8s/exec.js +47 -0
- package/dist/k8s/exec.js.map +1 -0
- package/dist/k8s/flux.d.ts +57 -0
- package/dist/k8s/flux.d.ts.map +1 -0
- package/dist/k8s/flux.js +202 -0
- package/dist/k8s/flux.js.map +1 -0
- package/dist/k8s/index.d.ts +6 -0
- package/dist/k8s/index.d.ts.map +1 -0
- package/dist/k8s/index.js +6 -0
- package/dist/k8s/index.js.map +1 -0
- package/dist/k8s/kubeconfig.d.ts +45 -0
- package/dist/k8s/kubeconfig.d.ts.map +1 -0
- package/dist/k8s/kubeconfig.js +152 -0
- package/dist/k8s/kubeconfig.js.map +1 -0
- package/dist/k8s/kubectl.d.ts +68 -0
- package/dist/k8s/kubectl.d.ts.map +1 -0
- package/dist/k8s/kubectl.js +187 -0
- package/dist/k8s/kubectl.js.map +1 -0
- package/dist/k8s/types.d.ts +65 -0
- package/dist/k8s/types.d.ts.map +1 -0
- package/dist/k8s/types.js +2 -0
- package/dist/k8s/types.js.map +1 -0
- package/dist/loader/file.d.ts +39 -0
- package/dist/loader/file.d.ts.map +1 -0
- package/dist/loader/file.js +121 -0
- package/dist/loader/file.js.map +1 -0
- package/dist/loader/index.d.ts +5 -0
- package/dist/loader/index.d.ts.map +1 -0
- package/dist/loader/index.js +5 -0
- package/dist/loader/index.js.map +1 -0
- package/dist/loader/profile.d.ts +23 -0
- package/dist/loader/profile.d.ts.map +1 -0
- package/dist/loader/profile.js +84 -0
- package/dist/loader/profile.js.map +1 -0
- package/dist/loader/project.d.ts +76 -0
- package/dist/loader/project.d.ts.map +1 -0
- package/dist/loader/project.js +279 -0
- package/dist/loader/project.js.map +1 -0
- package/dist/loader/yaml.d.ts +15 -0
- package/dist/loader/yaml.d.ts.map +1 -0
- package/dist/loader/yaml.js +44 -0
- package/dist/loader/yaml.js.map +1 -0
- package/dist/nodes/index.d.ts +5 -0
- package/dist/nodes/index.d.ts.map +1 -0
- package/dist/nodes/index.js +5 -0
- package/dist/nodes/index.js.map +1 -0
- package/dist/nodes/kubectl-labeler.d.ts +7 -0
- package/dist/nodes/kubectl-labeler.d.ts.map +1 -0
- package/dist/nodes/kubectl-labeler.js +89 -0
- package/dist/nodes/kubectl-labeler.js.map +1 -0
- package/dist/nodes/labeler.d.ts +74 -0
- package/dist/nodes/labeler.d.ts.map +1 -0
- package/dist/nodes/labeler.js +118 -0
- package/dist/nodes/labeler.js.map +1 -0
- package/dist/nodes/profile.d.ts +58 -0
- package/dist/nodes/profile.d.ts.map +1 -0
- package/dist/nodes/profile.js +128 -0
- package/dist/nodes/profile.js.map +1 -0
- package/dist/nodes/types.d.ts +84 -0
- package/dist/nodes/types.d.ts.map +1 -0
- package/dist/nodes/types.js +77 -0
- package/dist/nodes/types.js.map +1 -0
- package/dist/plugins/generators.d.ts +49 -0
- package/dist/plugins/generators.d.ts.map +1 -0
- package/dist/plugins/generators.js +7 -0
- package/dist/plugins/generators.js.map +1 -0
- package/dist/plugins/hooks.d.ts +120 -0
- package/dist/plugins/hooks.d.ts.map +1 -0
- package/dist/plugins/hooks.js +41 -0
- package/dist/plugins/hooks.js.map +1 -0
- package/dist/plugins/index.d.ts +8 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +15 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/loader.d.ts +40 -0
- package/dist/plugins/loader.d.ts.map +1 -0
- package/dist/plugins/loader.js +236 -0
- package/dist/plugins/loader.js.map +1 -0
- package/dist/plugins/object-types.d.ts +71 -0
- package/dist/plugins/object-types.d.ts.map +1 -0
- package/dist/plugins/object-types.js +65 -0
- package/dist/plugins/object-types.js.map +1 -0
- package/dist/plugins/registry.d.ts +87 -0
- package/dist/plugins/registry.d.ts.map +1 -0
- package/dist/plugins/registry.js +158 -0
- package/dist/plugins/registry.js.map +1 -0
- package/dist/plugins/substitution-providers.d.ts +48 -0
- package/dist/plugins/substitution-providers.d.ts.map +1 -0
- package/dist/plugins/substitution-providers.js +2 -0
- package/dist/plugins/substitution-providers.js.map +1 -0
- package/dist/plugins/types.d.ts +288 -0
- package/dist/plugins/types.d.ts.map +1 -0
- package/dist/plugins/types.js +25 -0
- package/dist/plugins/types.js.map +1 -0
- package/dist/registry/auth.d.ts +14 -0
- package/dist/registry/auth.d.ts.map +1 -0
- package/dist/registry/auth.js +40 -0
- package/dist/registry/auth.js.map +1 -0
- package/dist/registry/client.d.ts +24 -0
- package/dist/registry/client.d.ts.map +1 -0
- package/dist/registry/client.js +85 -0
- package/dist/registry/client.js.map +1 -0
- package/dist/registry/dockerhub.d.ts +6 -0
- package/dist/registry/dockerhub.d.ts.map +1 -0
- package/dist/registry/dockerhub.js +91 -0
- package/dist/registry/dockerhub.js.map +1 -0
- package/dist/registry/ghcr.d.ts +6 -0
- package/dist/registry/ghcr.d.ts.map +1 -0
- package/dist/registry/ghcr.js +95 -0
- package/dist/registry/ghcr.js.map +1 -0
- package/dist/registry/helm.d.ts +11 -0
- package/dist/registry/helm.d.ts.map +1 -0
- package/dist/registry/helm.js +124 -0
- package/dist/registry/helm.js.map +1 -0
- package/dist/registry/index.d.ts +8 -0
- package/dist/registry/index.d.ts.map +1 -0
- package/dist/registry/index.js +12 -0
- package/dist/registry/index.js.map +1 -0
- package/dist/registry/types.d.ts +55 -0
- package/dist/registry/types.d.ts.map +1 -0
- package/dist/registry/types.js +2 -0
- package/dist/registry/types.js.map +1 -0
- package/dist/registry/version.d.ts +22 -0
- package/dist/registry/version.d.ts.map +1 -0
- package/dist/registry/version.js +62 -0
- package/dist/registry/version.js.map +1 -0
- package/dist/schema/cluster.d.ts +2890 -0
- package/dist/schema/cluster.d.ts.map +1 -0
- package/dist/schema/cluster.js +231 -0
- package/dist/schema/cluster.js.map +1 -0
- package/dist/schema/common.d.ts +1059 -0
- package/dist/schema/common.d.ts.map +1 -0
- package/dist/schema/common.js +340 -0
- package/dist/schema/common.js.map +1 -0
- package/dist/schema/index.d.ts +8 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +8 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/node-list.d.ts +361 -0
- package/dist/schema/node-list.d.ts.map +1 -0
- package/dist/schema/node-list.js +104 -0
- package/dist/schema/node-list.js.map +1 -0
- package/dist/schema/profile.d.ts +166 -0
- package/dist/schema/profile.d.ts.map +1 -0
- package/dist/schema/profile.js +61 -0
- package/dist/schema/profile.js.map +1 -0
- package/dist/schema/project.d.ts +168 -0
- package/dist/schema/project.d.ts.map +1 -0
- package/dist/schema/project.js +40 -0
- package/dist/schema/project.js.map +1 -0
- package/dist/schema/sources.d.ts +338 -0
- package/dist/schema/sources.d.ts.map +1 -0
- package/dist/schema/sources.js +111 -0
- package/dist/schema/sources.js.map +1 -0
- package/dist/schema/template.d.ts +2711 -0
- package/dist/schema/template.d.ts.map +1 -0
- package/dist/schema/template.js +97 -0
- package/dist/schema/template.js.map +1 -0
- package/dist/sources/cache/index.d.ts +9 -0
- package/dist/sources/cache/index.d.ts.map +1 -0
- package/dist/sources/cache/index.js +278 -0
- package/dist/sources/cache/index.js.map +1 -0
- package/dist/sources/cache/metadata.d.ts +36 -0
- package/dist/sources/cache/metadata.d.ts.map +1 -0
- package/dist/sources/cache/metadata.js +21 -0
- package/dist/sources/cache/metadata.js.map +1 -0
- package/dist/sources/cache/ttl.d.ts +20 -0
- package/dist/sources/cache/ttl.d.ts.map +1 -0
- package/dist/sources/cache/ttl.js +53 -0
- package/dist/sources/cache/ttl.js.map +1 -0
- package/dist/sources/fetchers/git.d.ts +6 -0
- package/dist/sources/fetchers/git.d.ts.map +1 -0
- package/dist/sources/fetchers/git.js +165 -0
- package/dist/sources/fetchers/git.js.map +1 -0
- package/dist/sources/fetchers/http.d.ts +6 -0
- package/dist/sources/fetchers/http.d.ts.map +1 -0
- package/dist/sources/fetchers/http.js +159 -0
- package/dist/sources/fetchers/http.js.map +1 -0
- package/dist/sources/fetchers/index.d.ts +11 -0
- package/dist/sources/fetchers/index.d.ts.map +1 -0
- package/dist/sources/fetchers/index.js +24 -0
- package/dist/sources/fetchers/index.js.map +1 -0
- package/dist/sources/fetchers/oci.d.ts +6 -0
- package/dist/sources/fetchers/oci.d.ts.map +1 -0
- package/dist/sources/fetchers/oci.js +156 -0
- package/dist/sources/fetchers/oci.js.map +1 -0
- package/dist/sources/fetchers/types.d.ts +25 -0
- package/dist/sources/fetchers/types.d.ts.map +1 -0
- package/dist/sources/fetchers/types.js +2 -0
- package/dist/sources/fetchers/types.js.map +1 -0
- package/dist/sources/index.d.ts +6 -0
- package/dist/sources/index.d.ts.map +1 -0
- package/dist/sources/index.js +10 -0
- package/dist/sources/index.js.map +1 -0
- package/dist/sources/loader.d.ts +34 -0
- package/dist/sources/loader.d.ts.map +1 -0
- package/dist/sources/loader.js +89 -0
- package/dist/sources/loader.js.map +1 -0
- package/dist/sources/resolver.d.ts +17 -0
- package/dist/sources/resolver.d.ts.map +1 -0
- package/dist/sources/resolver.js +125 -0
- package/dist/sources/resolver.js.map +1 -0
- package/dist/sources/types.d.ts +151 -0
- package/dist/sources/types.d.ts.map +1 -0
- package/dist/sources/types.js +2 -0
- package/dist/sources/types.js.map +1 -0
- package/package.json +101 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Luca Silverentand
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
# Kustodian
|
|
2
|
+
|
|
3
|
+
A GitOps templating framework for Kubernetes with Flux CD. Define templates in YAML, bootstrap clusters, and extend with plugins.
|
|
4
|
+
|
|
5
|
+
## What is Kustodian?
|
|
6
|
+
|
|
7
|
+
Kustodian is a framework for managing Kubernetes cluster configurations using a declarative, YAML-based approach. It generates [Flux CD](https://fluxcd.io/) Kustomizations from simple template definitions, making it easy to:
|
|
8
|
+
|
|
9
|
+
- **Define reusable templates** for Kubernetes applications
|
|
10
|
+
- **Bootstrap clusters** with k0s, Talos, or other providers
|
|
11
|
+
- **Manage nodes** with declarative labeling and configuration
|
|
12
|
+
- **Manage multiple clusters** with shared or unique configurations
|
|
13
|
+
- **Extend functionality** through a plugin system
|
|
14
|
+
- **Keep everything in YAML** - no TypeScript or code required
|
|
15
|
+
|
|
16
|
+
## Why Kustodian?
|
|
17
|
+
|
|
18
|
+
Managing Kubernetes configurations at scale is hard. You end up with:
|
|
19
|
+
|
|
20
|
+
- Duplicated YAML across clusters
|
|
21
|
+
- Complex Kustomize overlays that are hard to reason about
|
|
22
|
+
- Manual cluster provisioning with ad-hoc scripts
|
|
23
|
+
- Inconsistent node labeling across environments
|
|
24
|
+
- Custom scripts to generate configurations
|
|
25
|
+
- No standard way to handle secrets, auth providers, or monitoring
|
|
26
|
+
|
|
27
|
+
Kustodian solves this by providing:
|
|
28
|
+
|
|
29
|
+
| Problem | Kustodian Solution |
|
|
30
|
+
|---------|-------------------|
|
|
31
|
+
| Duplicated configs | Reusable templates with substitutions |
|
|
32
|
+
| Complex overlays | Simple YAML template definitions |
|
|
33
|
+
| Manual provisioning | Declarative cluster bootstrap with k0s/Talos |
|
|
34
|
+
| Inconsistent nodes | YAML-based node definitions with auto-labeling |
|
|
35
|
+
| Custom scripts | Standardized generation engine |
|
|
36
|
+
| No extensibility | Plugin system for secrets, auth, etc. |
|
|
37
|
+
|
|
38
|
+
## Quick Example
|
|
39
|
+
|
|
40
|
+
### Define a Template
|
|
41
|
+
|
|
42
|
+
```yaml
|
|
43
|
+
# templates/nginx/template.yaml
|
|
44
|
+
apiVersion: kustodian.io/v1
|
|
45
|
+
kind: Template
|
|
46
|
+
metadata:
|
|
47
|
+
name: nginx
|
|
48
|
+
spec:
|
|
49
|
+
kustomizations:
|
|
50
|
+
- name: deployment
|
|
51
|
+
path: ./deployment
|
|
52
|
+
namespace:
|
|
53
|
+
default: nginx
|
|
54
|
+
substitutions:
|
|
55
|
+
- name: replicas
|
|
56
|
+
default: "2"
|
|
57
|
+
- name: image_tag
|
|
58
|
+
default: "latest"
|
|
59
|
+
health_checks:
|
|
60
|
+
- kind: Deployment
|
|
61
|
+
name: nginx
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Configure a Cluster
|
|
65
|
+
|
|
66
|
+
```yaml
|
|
67
|
+
# clusters/production/cluster.yaml
|
|
68
|
+
apiVersion: kustodian.io/v1
|
|
69
|
+
kind: Cluster
|
|
70
|
+
metadata:
|
|
71
|
+
name: production
|
|
72
|
+
spec:
|
|
73
|
+
domain: example.com
|
|
74
|
+
|
|
75
|
+
git:
|
|
76
|
+
owner: myorg
|
|
77
|
+
repository: infrastructure
|
|
78
|
+
branch: main
|
|
79
|
+
path: clusters/production
|
|
80
|
+
|
|
81
|
+
templates:
|
|
82
|
+
- name: nginx
|
|
83
|
+
enabled: true
|
|
84
|
+
values:
|
|
85
|
+
replicas: "5"
|
|
86
|
+
image_tag: "1.25"
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Define Nodes
|
|
90
|
+
|
|
91
|
+
```yaml
|
|
92
|
+
# clusters/production/nodes.yaml
|
|
93
|
+
apiVersion: kustodian.io/v1
|
|
94
|
+
kind: NodeList
|
|
95
|
+
metadata:
|
|
96
|
+
cluster: production
|
|
97
|
+
spec:
|
|
98
|
+
label_prefix: myorg.io
|
|
99
|
+
ssh:
|
|
100
|
+
user: admin
|
|
101
|
+
key_path: ~/.ssh/cluster_key
|
|
102
|
+
nodes:
|
|
103
|
+
- name: node-1
|
|
104
|
+
role: controller+worker
|
|
105
|
+
address: 10.0.0.11
|
|
106
|
+
labels:
|
|
107
|
+
metallb: true
|
|
108
|
+
storage: nvme
|
|
109
|
+
|
|
110
|
+
- name: node-2
|
|
111
|
+
role: worker
|
|
112
|
+
address: 10.0.0.12
|
|
113
|
+
labels:
|
|
114
|
+
gpu: nvidia
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Apply Configuration
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
# Apply full cluster configuration (bootstrap + Flux + templates)
|
|
121
|
+
kustodian apply --cluster production
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
This bootstraps the cluster, installs Flux CD, and deploys your templates.
|
|
125
|
+
|
|
126
|
+
## Core Concepts
|
|
127
|
+
|
|
128
|
+
### Templates
|
|
129
|
+
|
|
130
|
+
Templates define reusable Kubernetes configurations. Each template contains one or more **kustomizations** - units of deployment that map to Flux Kustomization resources.
|
|
131
|
+
|
|
132
|
+
```yaml
|
|
133
|
+
apiVersion: kustodian.io/v1
|
|
134
|
+
kind: Template
|
|
135
|
+
metadata:
|
|
136
|
+
name: my-app
|
|
137
|
+
spec:
|
|
138
|
+
kustomizations:
|
|
139
|
+
- name: operator # Deployed first
|
|
140
|
+
path: ./operator
|
|
141
|
+
namespace:
|
|
142
|
+
default: my-app
|
|
143
|
+
|
|
144
|
+
- name: instance # Deployed after operator
|
|
145
|
+
path: ./instance
|
|
146
|
+
depends_on:
|
|
147
|
+
- operator
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Clusters
|
|
151
|
+
|
|
152
|
+
Clusters define where and how templates are deployed. Each cluster specifies which templates to enable and what values to use.
|
|
153
|
+
|
|
154
|
+
```yaml
|
|
155
|
+
apiVersion: kustodian.io/v1
|
|
156
|
+
kind: Cluster
|
|
157
|
+
metadata:
|
|
158
|
+
name: staging
|
|
159
|
+
spec:
|
|
160
|
+
domain: staging.example.com
|
|
161
|
+
templates:
|
|
162
|
+
- name: my-app
|
|
163
|
+
enabled: true
|
|
164
|
+
values:
|
|
165
|
+
replicas: "1"
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Nodes
|
|
169
|
+
|
|
170
|
+
Nodes define the physical or virtual machines in your cluster. Kustodian manages node configuration, labeling, and can bootstrap entire clusters.
|
|
171
|
+
|
|
172
|
+
```yaml
|
|
173
|
+
apiVersion: kustodian.io/v1
|
|
174
|
+
kind: NodeList
|
|
175
|
+
metadata:
|
|
176
|
+
cluster: staging
|
|
177
|
+
spec:
|
|
178
|
+
label_prefix: myorg.io # Labels will be myorg.io/metallb, etc.
|
|
179
|
+
ssh:
|
|
180
|
+
user: admin
|
|
181
|
+
key_path: ~/.ssh/cluster_key
|
|
182
|
+
nodes:
|
|
183
|
+
- name: control-1
|
|
184
|
+
role: controller+worker # Runs control plane + workloads
|
|
185
|
+
address: 10.0.0.10
|
|
186
|
+
labels:
|
|
187
|
+
metallb: true # Applied as myorg.io/metallb=true
|
|
188
|
+
- name: worker-1
|
|
189
|
+
role: worker
|
|
190
|
+
address: 10.0.0.11
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
**Node Roles:**
|
|
194
|
+
|
|
195
|
+
| Role | Description |
|
|
196
|
+
|------|-------------|
|
|
197
|
+
| `controller` | Control plane only (no workloads) |
|
|
198
|
+
| `worker` | Worker node only |
|
|
199
|
+
| `controller+worker` | Combined control plane and worker |
|
|
200
|
+
|
|
201
|
+
### Cluster Provisioning
|
|
202
|
+
|
|
203
|
+
Kustodian can provision Kubernetes clusters using pluggable providers. The default provider is [k0s](https://k0sproject.io/). Cluster provisioning is part of the `apply` command.
|
|
204
|
+
|
|
205
|
+
The provisioning process:
|
|
206
|
+
|
|
207
|
+
1. **Validate** - Check node definitions and SSH connectivity
|
|
208
|
+
2. **Install** - Provision Kubernetes via k0s/Talos/RKE2
|
|
209
|
+
3. **Configure** - Merge kubeconfig into `~/.kube/config`
|
|
210
|
+
4. **Wait** - Wait for all nodes to reach Ready state
|
|
211
|
+
5. **Label** - Apply configured node labels
|
|
212
|
+
|
|
213
|
+
### Plugins
|
|
214
|
+
|
|
215
|
+
Plugins extend Kustodian's functionality. They can:
|
|
216
|
+
|
|
217
|
+
- **Generate resources** - Create additional Kubernetes resources (e.g., Authentik SSO blueprints)
|
|
218
|
+
- **Provide secrets** - Integrate with secret managers (e.g., Doppler, 1Password)
|
|
219
|
+
- **Validate configs** - Add custom validation rules
|
|
220
|
+
- **Transform resources** - Modify resources before output
|
|
221
|
+
|
|
222
|
+
```yaml
|
|
223
|
+
# Using plugins in a cluster
|
|
224
|
+
spec:
|
|
225
|
+
plugins:
|
|
226
|
+
- name: authentik-blueprints
|
|
227
|
+
- name: doppler-secrets
|
|
228
|
+
config:
|
|
229
|
+
project: my-project
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## Packages
|
|
233
|
+
|
|
234
|
+
Kustodian is built as a collection of packages:
|
|
235
|
+
|
|
236
|
+
| Package | Description |
|
|
237
|
+
|---------|-------------|
|
|
238
|
+
| `@kustodian/core` | Core utilities, error handling, Result type |
|
|
239
|
+
| `@kustodian/schema` | JSON Schema definitions for YAML validation |
|
|
240
|
+
| `@kustodian/loader` | YAML file loading and validation |
|
|
241
|
+
| `@kustodian/cli` | CLI framework with DI and middleware |
|
|
242
|
+
| `@kustodian/nodes` | Node definitions, roles, and labeling |
|
|
243
|
+
| `@kustodian/bootstrap` | Cluster bootstrap orchestration |
|
|
244
|
+
| `@kustodian/plugins` | Plugin system infrastructure |
|
|
245
|
+
| `@kustodian/generator` | Template processing and Flux generation |
|
|
246
|
+
|
|
247
|
+
### Official Plugins
|
|
248
|
+
|
|
249
|
+
| Plugin | Description |
|
|
250
|
+
|--------|-------------|
|
|
251
|
+
| `@kustodian/plugin-k0s` | k0s cluster provisioning (built-in) |
|
|
252
|
+
| `@kustodian/plugin-authentik` | Generate Authentik SSO blueprints |
|
|
253
|
+
| `@kustodian/plugin-doppler` | Doppler secret management |
|
|
254
|
+
| `@kustodian/plugin-1password` | 1Password secret management |
|
|
255
|
+
|
|
256
|
+
## Installation
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
# Install the CLI
|
|
260
|
+
bun install -g @kustodian/cli
|
|
261
|
+
|
|
262
|
+
# Or use with bunx
|
|
263
|
+
bunx @kustodian/cli generate --cluster production
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
## Usage
|
|
267
|
+
|
|
268
|
+
### Initialize a New Project
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
kustodian init my-infrastructure
|
|
272
|
+
cd my-infrastructure
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
This creates:
|
|
276
|
+
|
|
277
|
+
```
|
|
278
|
+
my-infrastructure/
|
|
279
|
+
├── templates/
|
|
280
|
+
│ └── example/
|
|
281
|
+
│ ├── template.yaml
|
|
282
|
+
│ └── deployment/
|
|
283
|
+
│ └── kustomization.yaml
|
|
284
|
+
├── clusters/
|
|
285
|
+
│ └── local/
|
|
286
|
+
│ ├── cluster.yaml
|
|
287
|
+
│ └── nodes.yaml
|
|
288
|
+
└── kustodian.yaml
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### Validate Configurations
|
|
292
|
+
|
|
293
|
+
```bash
|
|
294
|
+
# Validate all templates and clusters
|
|
295
|
+
kustodian validate
|
|
296
|
+
|
|
297
|
+
# Validate a specific cluster
|
|
298
|
+
kustodian validate --cluster production
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### Apply Full Configuration
|
|
302
|
+
|
|
303
|
+
```bash
|
|
304
|
+
# Apply complete cluster setup (bootstrap + Flux + templates)
|
|
305
|
+
kustodian apply --cluster production
|
|
306
|
+
|
|
307
|
+
# Use a different provider
|
|
308
|
+
kustodian apply --cluster production --provider talos
|
|
309
|
+
|
|
310
|
+
# Preview without making changes
|
|
311
|
+
kustodian apply --cluster production --dry-run
|
|
312
|
+
|
|
313
|
+
# Skip specific phases
|
|
314
|
+
kustodian apply --cluster production --skip-bootstrap
|
|
315
|
+
kustodian apply --cluster production --skip-flux
|
|
316
|
+
kustodian apply --cluster production --skip-templates
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
## Documentation
|
|
320
|
+
|
|
321
|
+
- [Getting Started Guide](https://kustodian.io/guide/getting-started)
|
|
322
|
+
- [Template Reference](https://kustodian.io/templates/overview)
|
|
323
|
+
- [Plugin Development](https://kustodian.io/plugins/creating-plugins)
|
|
324
|
+
- [API Reference](https://kustodian.io/api/)
|
|
325
|
+
|
|
326
|
+
## Contributing
|
|
327
|
+
|
|
328
|
+
We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for details on:
|
|
329
|
+
|
|
330
|
+
- Development setup
|
|
331
|
+
- Code style (follows [OneZero Handbook](https://handbook.onezero.company))
|
|
332
|
+
- Pull request process
|
|
333
|
+
- Testing requirements (80% coverage minimum)
|
|
334
|
+
|
|
335
|
+
## License
|
|
336
|
+
|
|
337
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
338
|
+
|
|
339
|
+
## Acknowledgments
|
|
340
|
+
|
|
341
|
+
Kustodian builds on the excellent work of:
|
|
342
|
+
|
|
343
|
+
- [Flux CD](https://fluxcd.io/) - GitOps toolkit for Kubernetes
|
|
344
|
+
- [Kustomize](https://kustomize.io/) - Kubernetes configuration management
|
|
345
|
+
- [k0s](https://k0sproject.io/) - Zero friction Kubernetes
|
|
346
|
+
- [k0sctl](https://github.com/k0sproject/k0sctl) - k0s cluster management tool
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../../src/cli/bin.ts"],"names":[],"mappings":""}
|
package/dist/cli/bin.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { dirname, join } from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { apply_command } from './commands/apply.js';
|
|
6
|
+
import { init_command } from './commands/init.js';
|
|
7
|
+
import { sources_command } from './commands/sources.js';
|
|
8
|
+
import { update_command } from './commands/update.js';
|
|
9
|
+
import { validate_command } from './commands/validate.js';
|
|
10
|
+
import { create_container } from './container.js';
|
|
11
|
+
import { create_cli } from './runner.js';
|
|
12
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
13
|
+
const pkg = JSON.parse(readFileSync(join(__dirname, '../../package.json'), 'utf-8'));
|
|
14
|
+
const VERSION = pkg.version;
|
|
15
|
+
async function main() {
|
|
16
|
+
const args = process.argv.slice(2);
|
|
17
|
+
// Handle --version
|
|
18
|
+
if (args.includes('--version') || args.includes('-v')) {
|
|
19
|
+
console.log(`kustodian v${VERSION}`);
|
|
20
|
+
process.exit(0);
|
|
21
|
+
}
|
|
22
|
+
// Handle --help or no args
|
|
23
|
+
if (args.length === 0 || args.includes('--help') || args.includes('-h')) {
|
|
24
|
+
console.log(`kustodian v${VERSION}`);
|
|
25
|
+
console.log('A GitOps templating framework for Kubernetes with Flux CD\n');
|
|
26
|
+
console.log('Usage: kustodian <command> [options]\n');
|
|
27
|
+
console.log('Commands:');
|
|
28
|
+
console.log(' init <name> Initialize a new Kustodian project');
|
|
29
|
+
console.log(' validate Validate cluster and template configurations');
|
|
30
|
+
console.log(' apply Apply full cluster configuration (generates, pushes OCI, deploys)');
|
|
31
|
+
console.log(' update Check and update image version substitutions');
|
|
32
|
+
console.log(' sources Manage template sources (fetch, list, cache)\n');
|
|
33
|
+
console.log('Options:');
|
|
34
|
+
console.log(' --help, -h Show help');
|
|
35
|
+
console.log(' --version, -v Show version\n');
|
|
36
|
+
console.log('Examples:');
|
|
37
|
+
console.log(' kustodian init my-project');
|
|
38
|
+
console.log(' kustodian validate');
|
|
39
|
+
console.log(' kustodian apply --cluster production');
|
|
40
|
+
process.exit(0);
|
|
41
|
+
}
|
|
42
|
+
// Create CLI
|
|
43
|
+
const cli = create_cli({
|
|
44
|
+
name: 'kustodian',
|
|
45
|
+
version: VERSION,
|
|
46
|
+
description: 'A GitOps templating framework for Kubernetes with Flux CD',
|
|
47
|
+
});
|
|
48
|
+
// Register commands
|
|
49
|
+
cli.command(init_command);
|
|
50
|
+
cli.command(validate_command);
|
|
51
|
+
cli.command(apply_command);
|
|
52
|
+
cli.command(update_command);
|
|
53
|
+
cli.command(sources_command);
|
|
54
|
+
// Create container
|
|
55
|
+
const container = create_container();
|
|
56
|
+
// Run CLI
|
|
57
|
+
const result = await cli.run(args, container);
|
|
58
|
+
if (!result.success) {
|
|
59
|
+
console.error(`\nError: ${result.error.message}`);
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
main().catch((error) => {
|
|
64
|
+
console.error('Unexpected error:', error);
|
|
65
|
+
process.exit(1);
|
|
66
|
+
});
|
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,OAAO,CAAC,YAAY,CAAC,CAAC;IAC1B,GAAG,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC9B,GAAG,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IAC3B,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAC5B,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAE7B,mBAAmB;IACnB,MAAM,SAAS,GAAG,gBAAgB,EAAE,CAAC;IAErC,UAAU;IACV,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAE9C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,YAAY,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAClD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;IAC1C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { KustodianErrorType } from '../core/index.js';
|
|
2
|
+
import { type ResultType } from '../core/index.js';
|
|
3
|
+
import type { ContainerType } from './container.js';
|
|
4
|
+
import type { ContextType, MiddlewareType } from './middleware.js';
|
|
5
|
+
/**
|
|
6
|
+
* Option definition for a command.
|
|
7
|
+
*/
|
|
8
|
+
export interface OptionType {
|
|
9
|
+
name: string;
|
|
10
|
+
short?: string;
|
|
11
|
+
description: string;
|
|
12
|
+
required?: boolean;
|
|
13
|
+
default_value?: unknown;
|
|
14
|
+
type?: 'string' | 'boolean' | 'number';
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Argument definition for a command.
|
|
18
|
+
*/
|
|
19
|
+
export interface ArgumentType {
|
|
20
|
+
name: string;
|
|
21
|
+
description: string;
|
|
22
|
+
required?: boolean;
|
|
23
|
+
variadic?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Command handler function.
|
|
27
|
+
*/
|
|
28
|
+
export type HandlerType = (ctx: ContextType, container: ContainerType) => Promise<ResultType<void, KustodianErrorType>>;
|
|
29
|
+
/**
|
|
30
|
+
* Command definition.
|
|
31
|
+
*/
|
|
32
|
+
export interface CommandType {
|
|
33
|
+
name: string;
|
|
34
|
+
description: string;
|
|
35
|
+
options?: OptionType[];
|
|
36
|
+
arguments?: ArgumentType[];
|
|
37
|
+
subcommands?: CommandType[];
|
|
38
|
+
middleware?: MiddlewareType[];
|
|
39
|
+
handler?: HandlerType;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Creates a command definition.
|
|
43
|
+
*/
|
|
44
|
+
export declare function define_command(config: CommandType): CommandType;
|
|
45
|
+
/**
|
|
46
|
+
* Creates a no-op handler that returns success.
|
|
47
|
+
*/
|
|
48
|
+
export declare function noop_handler(): HandlerType;
|
|
49
|
+
/**
|
|
50
|
+
* Finds a subcommand by name.
|
|
51
|
+
*/
|
|
52
|
+
export declare function find_subcommand(command: CommandType, name: string): CommandType | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Gets the full command path (e.g., "nodes label").
|
|
55
|
+
*/
|
|
56
|
+
export declare function get_command_path(commands: CommandType[]): string;
|
|
57
|
+
//# sourceMappingURL=command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/cli/command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,KAAK,UAAU,EAAW,MAAM,kBAAkB,CAAC;AAE5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB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ED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,MAAM,CAEhE"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { success } from '../core/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a command definition.
|
|
4
|
+
*/
|
|
5
|
+
export function define_command(config) {
|
|
6
|
+
return config;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Creates a no-op handler that returns success.
|
|
10
|
+
*/
|
|
11
|
+
export function noop_handler() {
|
|
12
|
+
return async () => success(undefined);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Finds a subcommand by name.
|
|
16
|
+
*/
|
|
17
|
+
export function find_subcommand(command, name) {
|
|
18
|
+
return command.subcommands?.find((sub) => sub.name === name);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Gets the full command path (e.g., "nodes label").
|
|
22
|
+
*/
|
|
23
|
+
export function get_command_path(commands) {
|
|
24
|
+
return commands.map((c) => c.name).join(' ');
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../src/cli/command.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAgD5D;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,MAAmB;IAChD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY;IAC1B,OAAO,KAAK,IAAI,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AACxC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,OAAoB,EAAE,IAAY;IAChE,OAAO,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAC/D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAuB;IACtD,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/apply.ts"],"names":[],"mappings":"AAeA;;;;;GAKG;AACH,eAAO,MAAM,aAAa,qCAofxB,CAAC"}
|