@intentius/chant-lexicon-k8s 0.42.1 → 0.44.2
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/dist/api/classify.d.ts.map +1 -1
- package/dist/api/connect.d.ts.map +1 -1
- package/dist/codegen/docs.d.ts.map +1 -1
- package/dist/components/argo-app.d.ts +104 -0
- package/dist/components/argo-app.d.ts.map +1 -0
- package/dist/components/builders.d.ts +8 -0
- package/dist/components/builders.d.ts.map +1 -1
- package/dist/components/capability-plugin.d.ts +1 -0
- package/dist/components/capability-plugin.d.ts.map +1 -1
- package/dist/components/flux-reconcile.d.ts +84 -0
- package/dist/components/flux-reconcile.d.ts.map +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/kustomize-apply.d.ts +29 -7
- package/dist/components/kustomize-apply.d.ts.map +1 -1
- package/dist/composites/flux-app.d.ts +132 -0
- package/dist/composites/flux-app.d.ts.map +1 -0
- package/dist/composites/index.d.ts +2 -0
- package/dist/composites/index.d.ts.map +1 -1
- package/dist/config-schema.d.ts +3 -0
- package/dist/config-schema.d.ts.map +1 -1
- package/dist/config.d.ts +32 -5
- package/dist/config.d.ts.map +1 -1
- package/dist/crd/crd-sources.d.ts.map +1 -1
- package/dist/crd/parser.d.ts.map +1 -1
- package/dist/describe-resources.d.ts +10 -8
- package/dist/describe-resources.d.ts.map +1 -1
- package/dist/generated/index.d.ts +15 -4
- package/dist/generated/index.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/integrity.json +10 -6
- package/dist/kube/connect.d.ts +5 -4
- package/dist/kube/connect.d.ts.map +1 -1
- package/dist/kube/get.d.ts +4 -4
- package/dist/kustomize/render.d.ts +15 -0
- package/dist/kustomize/render.d.ts.map +1 -0
- package/dist/kustomize/rendered-entity.d.ts +39 -0
- package/dist/kustomize/rendered-entity.d.ts.map +1 -0
- package/dist/kustomize/root.d.ts +19 -0
- package/dist/kustomize/root.d.ts.map +1 -0
- package/dist/lint/audit-catalog.d.ts.map +1 -1
- package/dist/lint/post-synth/argo-helpers.d.ts +2 -0
- package/dist/lint/post-synth/argo-helpers.d.ts.map +1 -1
- package/dist/lint/post-synth/flux002.d.ts +14 -0
- package/dist/lint/post-synth/flux002.d.ts.map +1 -0
- package/dist/lint/post-synth/flux003.d.ts +17 -0
- package/dist/lint/post-synth/flux003.d.ts.map +1 -0
- package/dist/lint/post-synth/index.d.ts.map +1 -1
- package/dist/lint/rules/flux-source-ref-pin.d.ts +16 -0
- package/dist/lint/rules/flux-source-ref-pin.d.ts.map +1 -0
- package/dist/manifest.json +1 -1
- package/dist/meta.json +92 -16
- package/dist/okf/index.md +7 -1
- package/dist/okf/rules/FLUX001.md +17 -0
- package/dist/okf/rules/FLUX002.md +19 -0
- package/dist/okf/rules/FLUX003.md +15 -0
- package/dist/okf/types/Addon.md +14 -0
- package/dist/okf/types/Bucket.md +4 -0
- package/dist/okf/types/{HelmChart.md → FluxHelmChart.md} +2 -2
- package/dist/okf/types/GitRepository.md +5 -0
- package/dist/okf/types/HelmChartConfig.md +14 -0
- package/dist/okf/types/K3sHelmChart.md +14 -0
- package/dist/okf/types/Kustomization.md +6 -0
- package/dist/okf/types/Namespace.md +1 -0
- package/dist/okf/types/Node.md +1 -0
- package/dist/okf/types/OCIRepository.md +4 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/rules/argo-helpers.ts +2 -0
- package/dist/rules/flux-source-ref-pin.ts +52 -0
- package/dist/rules/flux002.ts +77 -0
- package/dist/rules/flux003.ts +75 -0
- package/dist/serializer.d.ts.map +1 -1
- package/dist/skills/chant-k8s-flux.md +162 -0
- package/dist/types/index.d.ts +41 -3
- package/dist/validate.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/api/classify.test.ts +37 -0
- package/src/api/classify.ts +11 -1
- package/src/api/connect.ts +10 -0
- package/src/codegen/docs.ts +11 -0
- package/src/components/argo-app.test.ts +137 -0
- package/src/components/argo-app.ts +163 -0
- package/src/components/builders.ts +8 -0
- package/src/components/capability-plugin.ts +11 -1
- package/src/components/flux-reconcile.test.ts +145 -0
- package/src/components/flux-reconcile.ts +159 -0
- package/src/components/index.ts +13 -0
- package/src/components/kustomize-apply.ts +12 -41
- package/src/composites/composites.test.ts +122 -0
- package/src/composites/flux-app.ts +274 -0
- package/src/composites/index.ts +9 -0
- package/src/config-augmentation.test.ts +72 -0
- package/src/config-schema.ts +5 -0
- package/src/config.ts +33 -5
- package/src/crd/crd-sources.ts +37 -0
- package/src/crd/parser.ts +6 -0
- package/src/describe-resources.test.ts +290 -6
- package/src/describe-resources.ts +235 -127
- package/src/generated/index.d.ts +41 -3
- package/src/generated/index.ts +15 -4
- package/src/generated/lexicon-k8s.json +92 -16
- package/src/generated/operations.json +48 -0
- package/src/index.ts +4 -0
- package/src/kube/connect.ts +5 -4
- package/src/kube/get.ts +4 -4
- package/src/kustomize/render.ts +84 -0
- package/src/kustomize/rendered-entity.ts +72 -0
- package/src/kustomize/root.test.ts +268 -0
- package/src/kustomize/root.ts +109 -0
- package/src/lint/audit-catalog.ts +2 -0
- package/src/lint/post-synth/argo-helpers.ts +2 -0
- package/src/lint/post-synth/flux002.ts +77 -0
- package/src/lint/post-synth/flux003.ts +75 -0
- package/src/lint/post-synth/index.ts +4 -0
- package/src/lint/post-synth/post-synth.test.ts +132 -0
- package/src/lint/rules/flux-source-ref-pin.ts +52 -0
- package/src/lint/rules/rules.test.ts +51 -0
- package/src/plugin.test.ts +2 -0
- package/src/plugin.ts +47 -0
- package/src/serializer.ts +34 -4
- package/src/skills/chant-k8s-flux.md +162 -0
- package/src/testdata/kustomize-root/base/deployment.yaml +17 -0
- package/src/testdata/kustomize-root/base/kustomization.yaml +3 -0
- package/src/testdata/kustomize-root/base/service.yaml +9 -0
- package/src/testdata/kustomize-root/overlays/prod/kustomization.yaml +6 -0
- package/src/validate.ts +4 -0
package/dist/meta.json
CHANGED
|
@@ -51,6 +51,13 @@
|
|
|
51
51
|
"kind": "property",
|
|
52
52
|
"lexicon": "k8s"
|
|
53
53
|
},
|
|
54
|
+
"Addon": {
|
|
55
|
+
"resourceType": "K8s::K3s::Addon",
|
|
56
|
+
"kind": "resource",
|
|
57
|
+
"lexicon": "k8s",
|
|
58
|
+
"apiVersion": "k3s.cattle.io/v1",
|
|
59
|
+
"gvkKind": "Addon"
|
|
60
|
+
},
|
|
54
61
|
"Address": {
|
|
55
62
|
"resourceType": "K8s::Gateway::Gateway.addresses",
|
|
56
63
|
"kind": "property",
|
|
@@ -229,6 +236,11 @@
|
|
|
229
236
|
"kind": "property",
|
|
230
237
|
"lexicon": "k8s"
|
|
231
238
|
},
|
|
239
|
+
"AuthSecret": {
|
|
240
|
+
"resourceType": "K8s::K3s::HelmChart.authSecret",
|
|
241
|
+
"kind": "property",
|
|
242
|
+
"lexicon": "k8s"
|
|
243
|
+
},
|
|
232
244
|
"AutoscalerOptions": {
|
|
233
245
|
"resourceType": "K8s::Ray::RayCluster.autoscalerOptions",
|
|
234
246
|
"kind": "property",
|
|
@@ -1066,6 +1078,11 @@
|
|
|
1066
1078
|
"kind": "property",
|
|
1067
1079
|
"lexicon": "k8s"
|
|
1068
1080
|
},
|
|
1081
|
+
"DockerRegistrySecret": {
|
|
1082
|
+
"resourceType": "K8s::K3s::HelmChart.dockerRegistrySecret",
|
|
1083
|
+
"kind": "property",
|
|
1084
|
+
"lexicon": "k8s"
|
|
1085
|
+
},
|
|
1069
1086
|
"DriftDetection": {
|
|
1070
1087
|
"resourceType": "K8s::Flux::HelmRelease.driftDetection",
|
|
1071
1088
|
"kind": "property",
|
|
@@ -1241,6 +1258,28 @@
|
|
|
1241
1258
|
"apiVersion": "flowcontrol.apiserver.k8s.io/v1",
|
|
1242
1259
|
"gvkKind": "FlowSchemaList"
|
|
1243
1260
|
},
|
|
1261
|
+
"FluxHelmChart": {
|
|
1262
|
+
"resourceType": "K8s::Flux::HelmChart",
|
|
1263
|
+
"kind": "resource",
|
|
1264
|
+
"lexicon": "k8s",
|
|
1265
|
+
"apiVersion": "source.toolkit.fluxcd.io/v1",
|
|
1266
|
+
"gvkKind": "HelmChart"
|
|
1267
|
+
},
|
|
1268
|
+
"FluxHelmChart_SourceRef": {
|
|
1269
|
+
"resourceType": "K8s::Flux::HelmChart.sourceRef",
|
|
1270
|
+
"kind": "property",
|
|
1271
|
+
"lexicon": "k8s"
|
|
1272
|
+
},
|
|
1273
|
+
"FluxHelmChart_Status": {
|
|
1274
|
+
"resourceType": "K8s::Flux::HelmChart.status",
|
|
1275
|
+
"kind": "property",
|
|
1276
|
+
"lexicon": "k8s"
|
|
1277
|
+
},
|
|
1278
|
+
"FluxHelmChart_Verify": {
|
|
1279
|
+
"resourceType": "K8s::Flux::HelmChart.verify",
|
|
1280
|
+
"kind": "property",
|
|
1281
|
+
"lexicon": "k8s"
|
|
1282
|
+
},
|
|
1244
1283
|
"FluxInstance": {
|
|
1245
1284
|
"resourceType": "K8s::Flux::FluxInstance",
|
|
1246
1285
|
"kind": "resource",
|
|
@@ -1527,25 +1566,15 @@
|
|
|
1527
1566
|
"kind": "property",
|
|
1528
1567
|
"lexicon": "k8s"
|
|
1529
1568
|
},
|
|
1530
|
-
"
|
|
1531
|
-
"resourceType": "K8s::
|
|
1569
|
+
"HelmChartConfig": {
|
|
1570
|
+
"resourceType": "K8s::K3s::HelmChartConfig",
|
|
1532
1571
|
"kind": "resource",
|
|
1533
1572
|
"lexicon": "k8s",
|
|
1534
|
-
"apiVersion": "
|
|
1535
|
-
"gvkKind": "
|
|
1573
|
+
"apiVersion": "helm.cattle.io/v1",
|
|
1574
|
+
"gvkKind": "HelmChartConfig"
|
|
1536
1575
|
},
|
|
1537
|
-
"
|
|
1538
|
-
"resourceType": "K8s::
|
|
1539
|
-
"kind": "property",
|
|
1540
|
-
"lexicon": "k8s"
|
|
1541
|
-
},
|
|
1542
|
-
"HelmChart_Status": {
|
|
1543
|
-
"resourceType": "K8s::Flux::HelmChart.status",
|
|
1544
|
-
"kind": "property",
|
|
1545
|
-
"lexicon": "k8s"
|
|
1546
|
-
},
|
|
1547
|
-
"HelmChart_Verify": {
|
|
1548
|
-
"resourceType": "K8s::Flux::HelmChart.verify",
|
|
1576
|
+
"HelmChartConfig_ValuesSecret": {
|
|
1577
|
+
"resourceType": "K8s::K3s::HelmChartConfig.valuesSecrets",
|
|
1549
1578
|
"kind": "property",
|
|
1550
1579
|
"lexicon": "k8s"
|
|
1551
1580
|
},
|
|
@@ -2145,6 +2174,48 @@
|
|
|
2145
2174
|
"apiVersion": "batch/v1",
|
|
2146
2175
|
"gvkKind": "JobList"
|
|
2147
2176
|
},
|
|
2177
|
+
"K3sHelmChart": {
|
|
2178
|
+
"resourceType": "K8s::K3s::HelmChart",
|
|
2179
|
+
"kind": "resource",
|
|
2180
|
+
"lexicon": "k8s",
|
|
2181
|
+
"apiVersion": "helm.cattle.io/v1",
|
|
2182
|
+
"gvkKind": "HelmChart"
|
|
2183
|
+
},
|
|
2184
|
+
"K3sHelmChart_AuthSecret": {
|
|
2185
|
+
"resourceType": "K8s::K3s::HelmChart.authSecret",
|
|
2186
|
+
"kind": "property",
|
|
2187
|
+
"lexicon": "k8s"
|
|
2188
|
+
},
|
|
2189
|
+
"K3sHelmChart_DockerRegistrySecret": {
|
|
2190
|
+
"resourceType": "K8s::K3s::HelmChart.dockerRegistrySecret",
|
|
2191
|
+
"kind": "property",
|
|
2192
|
+
"lexicon": "k8s"
|
|
2193
|
+
},
|
|
2194
|
+
"K3sHelmChart_PodSecurityContext": {
|
|
2195
|
+
"resourceType": "K8s::K3s::HelmChart.podSecurityContext",
|
|
2196
|
+
"kind": "property",
|
|
2197
|
+
"lexicon": "k8s"
|
|
2198
|
+
},
|
|
2199
|
+
"K3sHelmChart_RepoCAConfigMap": {
|
|
2200
|
+
"resourceType": "K8s::K3s::HelmChart.repoCAConfigMap",
|
|
2201
|
+
"kind": "property",
|
|
2202
|
+
"lexicon": "k8s"
|
|
2203
|
+
},
|
|
2204
|
+
"K3sHelmChart_SecurityContext": {
|
|
2205
|
+
"resourceType": "K8s::K3s::HelmChart.securityContext",
|
|
2206
|
+
"kind": "property",
|
|
2207
|
+
"lexicon": "k8s"
|
|
2208
|
+
},
|
|
2209
|
+
"K3sHelmChart_Status": {
|
|
2210
|
+
"resourceType": "K8s::K3s::HelmChart.status",
|
|
2211
|
+
"kind": "property",
|
|
2212
|
+
"lexicon": "k8s"
|
|
2213
|
+
},
|
|
2214
|
+
"K3sHelmChart_ValuesSecret": {
|
|
2215
|
+
"resourceType": "K8s::K3s::HelmChart.valuesSecrets",
|
|
2216
|
+
"kind": "property",
|
|
2217
|
+
"lexicon": "k8s"
|
|
2218
|
+
},
|
|
2148
2219
|
"KeyToPath": {
|
|
2149
2220
|
"resourceType": "K8s::Core::KeyToPath",
|
|
2150
2221
|
"kind": "property",
|
|
@@ -3416,6 +3487,11 @@
|
|
|
3416
3487
|
"kind": "property",
|
|
3417
3488
|
"lexicon": "k8s"
|
|
3418
3489
|
},
|
|
3490
|
+
"RepoCAConfigMap": {
|
|
3491
|
+
"resourceType": "K8s::K3s::HelmChart.repoCAConfigMap",
|
|
3492
|
+
"kind": "property",
|
|
3493
|
+
"lexicon": "k8s"
|
|
3494
|
+
},
|
|
3419
3495
|
"Resource": {
|
|
3420
3496
|
"resourceType": "K8s::Flux::Receiver.resources",
|
|
3421
3497
|
"kind": "property",
|
package/dist/okf/index.md
CHANGED
|
@@ -4,6 +4,7 @@ okf_version: '0.2'
|
|
|
4
4
|
|
|
5
5
|
# Resource types
|
|
6
6
|
|
|
7
|
+
* [Addon](/types/Addon.md) - K8s::K3s::Addon
|
|
7
8
|
* [Alert](/types/Alert.md) - K8s::Flux::Alert
|
|
8
9
|
* [APIGroup](/types/APIGroup.md) - K8s::Core::APIGroup
|
|
9
10
|
* [APIGroupList](/types/APIGroupList.md) - K8s::Core::APIGroupList
|
|
@@ -68,13 +69,14 @@ okf_version: '0.2'
|
|
|
68
69
|
* [Eviction](/types/Eviction.md) - K8s::Policy::Eviction
|
|
69
70
|
* [FlowSchema](/types/FlowSchema.md) - K8s::Flowcontrol::FlowSchema
|
|
70
71
|
* [FlowSchemaList](/types/FlowSchemaList.md) - K8s::Flowcontrol::FlowSchemaList
|
|
72
|
+
* [FluxHelmChart](/types/FluxHelmChart.md) - K8s::Flux::HelmChart
|
|
71
73
|
* [FluxInstance](/types/FluxInstance.md) - K8s::Flux::FluxInstance
|
|
72
74
|
* [FluxReport](/types/FluxReport.md) - K8s::Flux::FluxReport
|
|
73
75
|
* [Gateway](/types/Gateway.md) - K8s::Gateway::Gateway
|
|
74
76
|
* [GatewayClass](/types/GatewayClass.md) - K8s::Gateway::GatewayClass
|
|
75
77
|
* [GitRepository](/types/GitRepository.md) - K8s::Flux::GitRepository
|
|
76
78
|
* [GRPCRoute](/types/GRPCRoute.md) - K8s::Gateway::GRPCRoute
|
|
77
|
-
* [
|
|
79
|
+
* [HelmChartConfig](/types/HelmChartConfig.md) - K8s::K3s::HelmChartConfig
|
|
78
80
|
* [HelmRelease](/types/HelmRelease.md) - K8s::Flux::HelmRelease
|
|
79
81
|
* [HelmRepository](/types/HelmRepository.md) - K8s::Flux::HelmRepository
|
|
80
82
|
* [HorizontalPodAutoscaler](/types/HorizontalPodAutoscaler.md) - K8s::Autoscaling::HorizontalPodAutoscaler
|
|
@@ -97,6 +99,7 @@ okf_version: '0.2'
|
|
|
97
99
|
* [IPAddressList](/types/IPAddressList.md) - K8s::Networking::IPAddressList
|
|
98
100
|
* [Issuer](/types/Issuer.md) - K8s::CertManager::Issuer
|
|
99
101
|
* [JobList](/types/JobList.md) - K8s::Batch::JobList
|
|
102
|
+
* [K3sHelmChart](/types/K3sHelmChart.md) - K8s::K3s::HelmChart
|
|
100
103
|
* [Kustomization](/types/Kustomization.md) - K8s::Flux::Kustomization
|
|
101
104
|
* [Lease](/types/Lease.md) - K8s::Coordination::Lease
|
|
102
105
|
* [LeaseCandidate](/types/LeaseCandidate.md) - K8s::Coordination::LeaseCandidate
|
|
@@ -219,6 +222,9 @@ okf_version: '0.2'
|
|
|
219
222
|
* [ARGO003](/rules/ARGO003.md) - Application.spec.destination must reference a registered cluster or the in-cluster target
|
|
220
223
|
* [ARGO004](/rules/ARGO004.md) - ApplicationSet template must scope to a single AppProject
|
|
221
224
|
* [ARGO005](/rules/ARGO005.md) - Application source.path should resolve to an existing directory under the build root
|
|
225
|
+
* [FLUX001](/rules/FLUX001.md) - GitRepository must pin spec.ref
|
|
226
|
+
* [FLUX002](/rules/FLUX002.md) - Kustomization.spec.sourceRef must reference a declared source (or the bootstrap flux-system repo)
|
|
227
|
+
* [FLUX003](/rules/FLUX003.md) - Kustomization.spec.dependsOn entries should name Kustomizations declared in the build
|
|
222
228
|
* [WK8001](/rules/WK8001.md) - Hardcoded Namespace
|
|
223
229
|
* [WK8002](/rules/WK8002.md) - Latest Image Tag
|
|
224
230
|
* [WK8003](/rules/WK8003.md) - Missing Resource Limits
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: lint-rule
|
|
3
|
+
title: FLUX001
|
|
4
|
+
description: GitRepository must pin spec.ref
|
|
5
|
+
id: FLUX001
|
|
6
|
+
severity: warning
|
|
7
|
+
category: correctness
|
|
8
|
+
lexicon: k8s
|
|
9
|
+
docs: https://intentius.io/chant/lexicons/k8s/rules/
|
|
10
|
+
---
|
|
11
|
+
GitRepository must pin spec.ref
|
|
12
|
+
|
|
13
|
+
## Applies to
|
|
14
|
+
|
|
15
|
+
- [GitRepository](/types/GitRepository.md)
|
|
16
|
+
- [Kustomization](/types/Kustomization.md)
|
|
17
|
+
- [Node](/types/Node.md)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: post-synth-check
|
|
3
|
+
title: FLUX002
|
|
4
|
+
description: Kustomization.spec.sourceRef must reference a declared source (or the bootstrap flux-system repo)
|
|
5
|
+
id: FLUX002
|
|
6
|
+
severity: error
|
|
7
|
+
category: post-synth
|
|
8
|
+
lexicon: k8s
|
|
9
|
+
docs: https://intentius.io/chant/lexicons/k8s/rules/
|
|
10
|
+
---
|
|
11
|
+
Kustomization.spec.sourceRef must reference a declared source (or the bootstrap flux-system repo)
|
|
12
|
+
|
|
13
|
+
## Applies to
|
|
14
|
+
|
|
15
|
+
- [Bucket](/types/Bucket.md)
|
|
16
|
+
- [GitRepository](/types/GitRepository.md)
|
|
17
|
+
- [Kustomization](/types/Kustomization.md)
|
|
18
|
+
- [Namespace](/types/Namespace.md)
|
|
19
|
+
- [OCIRepository](/types/OCIRepository.md)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: post-synth-check
|
|
3
|
+
title: FLUX003
|
|
4
|
+
description: Kustomization.spec.dependsOn entries should name Kustomizations declared in the build
|
|
5
|
+
id: FLUX003
|
|
6
|
+
severity: error
|
|
7
|
+
category: post-synth
|
|
8
|
+
lexicon: k8s
|
|
9
|
+
docs: https://intentius.io/chant/lexicons/k8s/rules/
|
|
10
|
+
---
|
|
11
|
+
Kustomization.spec.dependsOn entries should name Kustomizations declared in the build
|
|
12
|
+
|
|
13
|
+
## Applies to
|
|
14
|
+
|
|
15
|
+
- [Kustomization](/types/Kustomization.md)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: resource-type
|
|
3
|
+
title: Addon
|
|
4
|
+
description: k8s resource type K8s::K3s::Addon
|
|
5
|
+
name: Addon
|
|
6
|
+
lexicon: k8s
|
|
7
|
+
resource_type: K8s::K3s::Addon
|
|
8
|
+
---
|
|
9
|
+
`K8s::K3s::Addon`, a resource type of the k8s lexicon.
|
|
10
|
+
|
|
11
|
+
## Properties
|
|
12
|
+
|
|
13
|
+
- `metadata` (`ObjectMeta`, optional): Standard object's metadata.
|
|
14
|
+
- `spec` (`Record<string, unknown>`, optional): Spec provides information about the on-disk manifest backing this resource.
|
package/dist/okf/types/Bucket.md
CHANGED
|
@@ -12,3 +12,7 @@ resource_type: K8s::Flux::Bucket
|
|
|
12
12
|
|
|
13
13
|
- `metadata` (`ObjectMeta`, optional): Standard object's metadata.
|
|
14
14
|
- `spec` (`Record<string, unknown>`, optional): BucketSpec specifies the required configuration to produce an Artifact for an object storage bucket.
|
|
15
|
+
|
|
16
|
+
## Governed by
|
|
17
|
+
|
|
18
|
+
- [FLUX002](/rules/FLUX002.md): Kustomization.spec.sourceRef must reference a declared source (or the bootstrap flux-system repo)
|
|
@@ -12,3 +12,8 @@ resource_type: K8s::Flux::GitRepository
|
|
|
12
12
|
|
|
13
13
|
- `metadata` (`ObjectMeta`, optional): Standard object's metadata.
|
|
14
14
|
- `spec` (`Record<string, unknown>`, optional): GitRepositorySpec specifies the required configuration to produce an Artifact for a Git repository.
|
|
15
|
+
|
|
16
|
+
## Governed by
|
|
17
|
+
|
|
18
|
+
- [FLUX001](/rules/FLUX001.md): GitRepository must pin spec.ref
|
|
19
|
+
- [FLUX002](/rules/FLUX002.md): Kustomization.spec.sourceRef must reference a declared source (or the bootstrap flux-system repo)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: resource-type
|
|
3
|
+
title: HelmChartConfig
|
|
4
|
+
description: k8s resource type K8s::K3s::HelmChartConfig
|
|
5
|
+
name: HelmChartConfig
|
|
6
|
+
lexicon: k8s
|
|
7
|
+
resource_type: K8s::K3s::HelmChartConfig
|
|
8
|
+
---
|
|
9
|
+
`K8s::K3s::HelmChartConfig`, a resource type of the k8s lexicon.
|
|
10
|
+
|
|
11
|
+
## Properties
|
|
12
|
+
|
|
13
|
+
- `metadata` (`ObjectMeta`, optional): Standard object's metadata.
|
|
14
|
+
- `spec` (`Record<string, unknown>`, optional): HelmChartConfigSpec represents additional user-configurable details of an installed and configured Helm chart release. These fields are merged with or override the corresponding fields on the related HelmChart resource.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: resource-type
|
|
3
|
+
title: K3sHelmChart
|
|
4
|
+
description: k8s resource type K8s::K3s::HelmChart
|
|
5
|
+
name: K3sHelmChart
|
|
6
|
+
lexicon: k8s
|
|
7
|
+
resource_type: K8s::K3s::HelmChart
|
|
8
|
+
---
|
|
9
|
+
`K8s::K3s::HelmChart`, a resource type of the k8s lexicon.
|
|
10
|
+
|
|
11
|
+
## Properties
|
|
12
|
+
|
|
13
|
+
- `metadata` (`ObjectMeta`, optional): Standard object's metadata.
|
|
14
|
+
- `spec` (`Record<string, unknown>`, optional): HelmChartSpec represents the user-configurable details for installation and upgrade of a Helm chart release.
|
|
@@ -12,3 +12,9 @@ resource_type: K8s::Flux::Kustomization
|
|
|
12
12
|
|
|
13
13
|
- `metadata` (`ObjectMeta`, optional): Standard object's metadata.
|
|
14
14
|
- `spec` (`Record<string, unknown>`, optional): KustomizationSpec defines the configuration to calculate the desired state from a Source using Kustomize.
|
|
15
|
+
|
|
16
|
+
## Governed by
|
|
17
|
+
|
|
18
|
+
- [FLUX001](/rules/FLUX001.md): GitRepository must pin spec.ref
|
|
19
|
+
- [FLUX002](/rules/FLUX002.md): Kustomization.spec.sourceRef must reference a declared source (or the bootstrap flux-system repo)
|
|
20
|
+
- [FLUX003](/rules/FLUX003.md): Kustomization.spec.dependsOn entries should name Kustomizations declared in the build
|
package/dist/okf/types/Node.md
CHANGED
|
@@ -16,6 +16,7 @@ resource_type: K8s::Core::Node
|
|
|
16
16
|
## Governed by
|
|
17
17
|
|
|
18
18
|
- [ARGO001](/rules/ARGO001.md): Production Application must not enable automated prune
|
|
19
|
+
- [FLUX001](/rules/FLUX001.md): GitRepository must pin spec.ref
|
|
19
20
|
- [WK8001](/rules/WK8001.md): Hardcoded Namespace
|
|
20
21
|
- [WK8002](/rules/WK8002.md): Latest Image Tag
|
|
21
22
|
- [WK8003](/rules/WK8003.md): Missing Resource Limits
|
|
@@ -12,3 +12,7 @@ resource_type: K8s::Flux::OCIRepository
|
|
|
12
12
|
|
|
13
13
|
- `metadata` (`ObjectMeta`, optional): Standard object's metadata.
|
|
14
14
|
- `spec` (`Record<string, unknown>`, optional): OCIRepositorySpec defines the desired state of OCIRepository
|
|
15
|
+
|
|
16
|
+
## Governed by
|
|
17
|
+
|
|
18
|
+
- [FLUX002](/rules/FLUX002.md): Kustomization.spec.sourceRef must reference a declared source (or the bootstrap flux-system repo)
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAqC,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAqC,MAAM,0BAA0B,CAAC;AA2BjG,eAAO,MAAM,SAAS,EAAE,aAqqBvB,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shared helpers for the Argo post-synth checks (ARGO002, ARGO003, ARGO005).
|
|
3
|
+
* The generic manifest collectors (`allManifests`, `manifestsOfKind`) are
|
|
4
|
+
* shared by the Flux checks (FLUX002, FLUX003) too.
|
|
3
5
|
*
|
|
4
6
|
* Excluded from check auto-discovery by the "helper" filename filter.
|
|
5
7
|
*/
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { LintRule, LintDiagnostic, LintContext } from "@intentius/chant/lint/rule";
|
|
2
|
+
import { findResourceLiterals, getNestedObject, getNestedString, getProp, lineCol } from "./argo-ast";
|
|
3
|
+
import * as ts from "typescript";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* FLUX001: GitRepository must pin spec.ref
|
|
7
|
+
*
|
|
8
|
+
* A Flux `GitRepository` with no `spec.ref` falls back to the `master` branch,
|
|
9
|
+
* which on most repos no longer exists — the source stalls with a checkout
|
|
10
|
+
* error, and every Kustomization downstream of it stalls too. Real estates pin
|
|
11
|
+
* a branch (or tag) on every source; `FluxGitSource` always emits one. Flag
|
|
12
|
+
* hand-written `GitRepository` literals whose spec carries a `url` but no
|
|
13
|
+
* `ref`.
|
|
14
|
+
*
|
|
15
|
+
* Bad: new GitRepository({ spec: { url: "https://github.com/acme/infra" } })
|
|
16
|
+
* Good: new GitRepository({ spec: { url: "https://github.com/acme/infra", ref: { branch: "main" } } })
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
export const fluxSourceRefPinRule: LintRule = {
|
|
20
|
+
id: "FLUX001",
|
|
21
|
+
severity: "warning",
|
|
22
|
+
category: "correctness",
|
|
23
|
+
description:
|
|
24
|
+
"Flux GitRepository must pin spec.ref (branch, tag, semver, or commit) — the unset default is the master branch",
|
|
25
|
+
|
|
26
|
+
check(context: LintContext): LintDiagnostic[] {
|
|
27
|
+
const { sourceFile } = context;
|
|
28
|
+
const diagnostics: LintDiagnostic[] = [];
|
|
29
|
+
|
|
30
|
+
for (const { literal } of findResourceLiterals(sourceFile, new Set(["GitRepository"]))) {
|
|
31
|
+
const spec = getNestedObject(literal, ["spec"]);
|
|
32
|
+
// No spec object literal to inspect — leave it to other tooling.
|
|
33
|
+
if (!spec) continue;
|
|
34
|
+
if (getProp(spec, "ref") !== undefined) continue;
|
|
35
|
+
|
|
36
|
+
const anchor: ts.Node = spec;
|
|
37
|
+
const { line, column } = lineCol(sourceFile, anchor);
|
|
38
|
+
const name = getNestedString(literal, ["metadata", "name"]) ?? "(unnamed)";
|
|
39
|
+
|
|
40
|
+
diagnostics.push({
|
|
41
|
+
file: sourceFile.fileName,
|
|
42
|
+
line,
|
|
43
|
+
column,
|
|
44
|
+
ruleId: "FLUX001",
|
|
45
|
+
severity: "warning",
|
|
46
|
+
message: `GitRepository "${name}" has no spec.ref — Flux falls back to the master branch. Pin a branch, tag, semver range, or commit.`,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return diagnostics;
|
|
51
|
+
},
|
|
52
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FLUX002: Kustomization.spec.sourceRef must reference a declared source
|
|
3
|
+
*
|
|
4
|
+
* A Flux `Kustomization` names its source in `spec.sourceRef` — a
|
|
5
|
+
* `GitRepository`, `OCIRepository`, or `Bucket` the source-controller fetches.
|
|
6
|
+
* If the referenced source isn't declared in the build, the
|
|
7
|
+
* kustomize-controller waits on an artifact that never arrives and the
|
|
8
|
+
* Kustomization stalls. The bootstrap-created `flux-system` GitRepository
|
|
9
|
+
* always exists on a bootstrapped cluster, so a reference to it is never
|
|
10
|
+
* flagged — the Flux analogue of ARGO002's built-in `default` project.
|
|
11
|
+
*/
|
|
12
|
+
import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
|
|
13
|
+
import { allManifests, manifestsOfKind } from "./argo-helpers";
|
|
14
|
+
|
|
15
|
+
/** Source kinds the kustomize-controller can reconcile from. */
|
|
16
|
+
const SOURCE_KINDS = ["GitRepository", "OCIRepository", "Bucket"] as const;
|
|
17
|
+
|
|
18
|
+
/** The GitRepository `flux bootstrap` creates alongside the controllers. */
|
|
19
|
+
const BOOTSTRAP_SOURCE_NAME = "flux-system";
|
|
20
|
+
|
|
21
|
+
export const flux002: PostSynthCheck = {
|
|
22
|
+
id: "FLUX002",
|
|
23
|
+
description: "Kustomization.spec.sourceRef must reference a declared source (or the bootstrap flux-system repo)",
|
|
24
|
+
|
|
25
|
+
check(ctx: PostSynthContext): PostSynthDiagnostic[] {
|
|
26
|
+
const diagnostics: PostSynthDiagnostic[] = [];
|
|
27
|
+
const manifests = allManifests(ctx);
|
|
28
|
+
|
|
29
|
+
// Declared sources, keyed "Kind/name". Namespace is deliberately ignored:
|
|
30
|
+
// an unset sourceRef.namespace resolves in the Kustomization's own, and
|
|
31
|
+
// the common estate keeps everything in flux-system anyway.
|
|
32
|
+
const declaredSources = new Set<string>();
|
|
33
|
+
for (const kind of SOURCE_KINDS) {
|
|
34
|
+
for (const source of manifestsOfKind(manifests, kind)) {
|
|
35
|
+
const name = source.metadata?.name;
|
|
36
|
+
if (typeof name === "string") declaredSources.add(`${kind}/${name}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
for (const kustomization of manifestsOfKind(manifests, "Kustomization")) {
|
|
41
|
+
// Flux and kustomize.config.k8s.io share the kind name; only the Flux CR
|
|
42
|
+
// carries a sourceRef-bearing spec.
|
|
43
|
+
const apiVersion = kustomization.apiVersion;
|
|
44
|
+
if (typeof apiVersion === "string" && !apiVersion.startsWith("kustomize.toolkit.fluxcd.io/")) continue;
|
|
45
|
+
|
|
46
|
+
const name = kustomization.metadata?.name ?? "Kustomization";
|
|
47
|
+
const sourceRef = kustomization.spec?.sourceRef as
|
|
48
|
+
| { kind?: unknown; name?: unknown }
|
|
49
|
+
| undefined;
|
|
50
|
+
|
|
51
|
+
if (!sourceRef || typeof sourceRef.name !== "string" || sourceRef.name === "") {
|
|
52
|
+
diagnostics.push({
|
|
53
|
+
checkId: "FLUX002",
|
|
54
|
+
severity: "error",
|
|
55
|
+
message: `Kustomization "${name}" has no spec.sourceRef.name — the kustomize-controller cannot resolve a source.`,
|
|
56
|
+
entity: name,
|
|
57
|
+
lexicon: "k8s",
|
|
58
|
+
});
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const kind = typeof sourceRef.kind === "string" && sourceRef.kind !== "" ? sourceRef.kind : "GitRepository";
|
|
63
|
+
if (kind === "GitRepository" && sourceRef.name === BOOTSTRAP_SOURCE_NAME) continue;
|
|
64
|
+
if (declaredSources.has(`${kind}/${sourceRef.name}`)) continue;
|
|
65
|
+
|
|
66
|
+
diagnostics.push({
|
|
67
|
+
checkId: "FLUX002",
|
|
68
|
+
severity: "error",
|
|
69
|
+
message: `Kustomization "${name}" references ${kind} "${sourceRef.name}", which is not declared. Declare the source (e.g. FluxGitSource) or point sourceRef at the bootstrap flux-system repo.`,
|
|
70
|
+
entity: name,
|
|
71
|
+
lexicon: "k8s",
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return diagnostics;
|
|
76
|
+
},
|
|
77
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FLUX003: Kustomization.spec.dependsOn entries should name declared Kustomizations
|
|
3
|
+
*
|
|
4
|
+
* `dependsOn` is Flux's reconcile-ordering edge: the Kustomization stays
|
|
5
|
+
* pending until every named Kustomization is ready. The names are plain
|
|
6
|
+
* strings with no referential integrity — a typo, or an entry left behind
|
|
7
|
+
* after a rename, stalls the app silently. This check joins each entry
|
|
8
|
+
* against the Kustomizations the build actually declares.
|
|
9
|
+
*
|
|
10
|
+
* It is a warning, not an error: estates legitimately split infra and apps
|
|
11
|
+
* across repos, so a dependency (say `cert-manager`) may be declared by a
|
|
12
|
+
* build this one never sees. A self-referencing entry is flagged too — Flux
|
|
13
|
+
* can never satisfy it.
|
|
14
|
+
*/
|
|
15
|
+
import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
|
|
16
|
+
import { allManifests, manifestsOfKind } from "./argo-helpers";
|
|
17
|
+
import type { K8sManifest } from "./k8s-helpers";
|
|
18
|
+
|
|
19
|
+
/** Flux Kustomizations only — the kustomize.config.k8s.io kind shares the name. */
|
|
20
|
+
function fluxKustomizations(manifests: K8sManifest[]): K8sManifest[] {
|
|
21
|
+
return manifestsOfKind(manifests, "Kustomization").filter((m) => {
|
|
22
|
+
const apiVersion = m.apiVersion;
|
|
23
|
+
return typeof apiVersion !== "string" || apiVersion.startsWith("kustomize.toolkit.fluxcd.io/");
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const flux003: PostSynthCheck = {
|
|
28
|
+
id: "FLUX003",
|
|
29
|
+
description: "Kustomization.spec.dependsOn entries should name Kustomizations declared in the build",
|
|
30
|
+
|
|
31
|
+
check(ctx: PostSynthContext): PostSynthDiagnostic[] {
|
|
32
|
+
const diagnostics: PostSynthDiagnostic[] = [];
|
|
33
|
+
const kustomizations = fluxKustomizations(allManifests(ctx));
|
|
34
|
+
|
|
35
|
+
const declared = new Set(
|
|
36
|
+
kustomizations
|
|
37
|
+
.map((k) => k.metadata?.name)
|
|
38
|
+
.filter((n): n is string => typeof n === "string"),
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
for (const kustomization of kustomizations) {
|
|
42
|
+
const name = kustomization.metadata?.name ?? "Kustomization";
|
|
43
|
+
const dependsOn = kustomization.spec?.dependsOn;
|
|
44
|
+
if (!Array.isArray(dependsOn)) continue;
|
|
45
|
+
|
|
46
|
+
for (const entry of dependsOn) {
|
|
47
|
+
const depName = (entry as { name?: unknown } | null)?.name;
|
|
48
|
+
if (typeof depName !== "string" || depName === "") continue;
|
|
49
|
+
|
|
50
|
+
if (depName === name) {
|
|
51
|
+
diagnostics.push({
|
|
52
|
+
checkId: "FLUX003",
|
|
53
|
+
severity: "warning",
|
|
54
|
+
message: `Kustomization "${name}" depends on itself — Flux can never satisfy the edge and the app will not reconcile.`,
|
|
55
|
+
entity: name,
|
|
56
|
+
lexicon: "k8s",
|
|
57
|
+
});
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (declared.has(depName)) continue;
|
|
62
|
+
|
|
63
|
+
diagnostics.push({
|
|
64
|
+
checkId: "FLUX003",
|
|
65
|
+
severity: "warning",
|
|
66
|
+
message: `Kustomization "${name}" depends on Kustomization "${depName}", which nothing in the build declares — reconciliation stalls until it exists. Fix the name, or ignore if it is declared in another repo.`,
|
|
67
|
+
entity: name,
|
|
68
|
+
lexicon: "k8s",
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return diagnostics;
|
|
74
|
+
},
|
|
75
|
+
};
|
package/dist/serializer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../src/serializer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAsC,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../src/serializer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAsC,MAAM,6BAA6B,CAAC;AA8MlG;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,UA2K3B,CAAC"}
|