@intentius/chant-lexicon-k8s 0.101.0 → 0.102.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/dist/actions/apps.d.ts +4 -4
- package/dist/actions/apps.d.ts.map +1 -1
- package/dist/actions/core.d.ts +5 -5
- package/dist/actions/core.d.ts.map +1 -1
- package/dist/actions/networking.d.ts.map +1 -1
- package/dist/codegen/generate-typescript.d.ts +2 -2
- package/dist/codegen/generate-typescript.d.ts.map +1 -1
- package/dist/codegen/generate.d.ts.map +1 -1
- package/dist/codegen/naming.d.ts.map +1 -1
- package/dist/codegen/versions.d.ts.map +1 -1
- package/dist/components/capability-plugin.d.ts.map +1 -1
- package/dist/composites/catalog.d.ts.map +1 -1
- package/dist/composites/cockroachdb-cluster.d.ts +2 -2
- package/dist/composites/gke-otel-collector.d.ts.map +1 -1
- package/dist/composites/index.d.ts +1 -0
- package/dist/composites/index.d.ts.map +1 -1
- package/dist/composites/otel-collector-agent.d.ts +19 -1
- package/dist/composites/otel-collector-agent.d.ts.map +1 -1
- package/dist/composites/otel-collector-node.d.ts +88 -0
- package/dist/composites/otel-collector-node.d.ts.map +1 -0
- package/dist/composites/otel-collector-shape.d.ts.map +1 -1
- package/dist/composites/otel-collector.d.ts +9 -1
- package/dist/composites/otel-collector.d.ts.map +1 -1
- package/dist/composites/ray-cluster.d.ts +6 -6
- package/dist/composites/ray-job.d.ts +5 -5
- package/dist/composites/ray-service.d.ts +6 -6
- package/dist/crd/crd-sources.d.ts.map +1 -1
- package/dist/crd/loader.d.ts.map +1 -1
- package/dist/crd/oci-chart.d.ts +50 -0
- package/dist/crd/oci-chart.d.ts.map +1 -0
- package/dist/crd/types.d.ts +5 -0
- package/dist/crd/types.d.ts.map +1 -1
- package/dist/effect-receipt-row.d.ts.map +1 -1
- package/dist/generated/index.d.ts +752 -729
- package/dist/generated/index.d.ts.map +1 -1
- package/dist/import/embedded.d.ts +4 -2
- package/dist/import/embedded.d.ts.map +1 -1
- package/dist/import/generator.d.ts.map +1 -1
- package/dist/import/parser.d.ts.map +1 -1
- package/dist/import/testdata/embedded/fixtures.d.ts +6 -0
- package/dist/import/testdata/embedded/fixtures.d.ts.map +1 -1
- package/dist/integrity.json +6 -5
- package/dist/lint/audit-catalog.d.ts.map +1 -1
- package/dist/lint/post-synth/index.d.ts.map +1 -1
- package/dist/lint/post-synth/otel-placement-helpers.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8605.d.ts +23 -0
- package/dist/lint/post-synth/wk8605.d.ts.map +1 -0
- package/dist/manifest.json +1 -1
- package/dist/meta.json +156 -17
- package/dist/okf/index.md +4 -0
- package/dist/okf/rules/WK8605.md +11 -0
- package/dist/okf/types/APIGroup.md +3 -3
- package/dist/okf/types/APIGroupList.md +1 -1
- package/dist/okf/types/APIResourceList.md +1 -1
- package/dist/okf/types/APIService.md +1 -1
- package/dist/okf/types/APIServiceList.md +2 -2
- package/dist/okf/types/APIVersions.md +1 -1
- package/dist/okf/types/BatchJob.md +1 -1
- package/dist/okf/types/CSIDriver.md +1 -1
- package/dist/okf/types/CSIDriverList.md +2 -2
- package/dist/okf/types/CSINode.md +1 -1
- package/dist/okf/types/CSINodeList.md +2 -2
- package/dist/okf/types/CSIStorageCapacity.md +2 -2
- package/dist/okf/types/CSIStorageCapacityList.md +2 -2
- package/dist/okf/types/CertificateSigningRequest.md +1 -1
- package/dist/okf/types/CertificateSigningRequestList.md +2 -2
- package/dist/okf/types/ClusterRole.md +1 -1
- package/dist/okf/types/ClusterRoleBindingList.md +2 -2
- package/dist/okf/types/ClusterRoleList.md +2 -2
- package/dist/okf/types/ClusterTrustBundle.md +1 -1
- package/dist/okf/types/ClusterTrustBundleList.md +2 -2
- package/dist/okf/types/ComponentStatus.md +1 -1
- package/dist/okf/types/ComponentStatusList.md +2 -2
- package/dist/okf/types/ConfigMapList.md +2 -2
- package/dist/okf/types/ControllerRevisionList.md +2 -2
- package/dist/okf/types/CoreEventList.md +2 -2
- package/dist/okf/types/CronJob.md +1 -1
- package/dist/okf/types/CronJobList.md +2 -2
- package/dist/okf/types/CustomResourceDefinition.md +1 -1
- package/dist/okf/types/CustomResourceDefinitionList.md +2 -2
- package/dist/okf/types/DaemonSet.md +1 -1
- package/dist/okf/types/DaemonSetList.md +2 -2
- package/dist/okf/types/DeleteOptions.md +1 -1
- package/dist/okf/types/Deploy.md +1 -1
- package/dist/okf/types/DeploymentList.md +2 -2
- package/dist/okf/types/DeviceClass.md +1 -1
- package/dist/okf/types/DeviceClassList.md +2 -2
- package/dist/okf/types/DeviceTaintRule.md +1 -1
- package/dist/okf/types/DeviceTaintRuleList.md +2 -2
- package/dist/okf/types/EndpointSlice.md +2 -2
- package/dist/okf/types/EndpointSliceList.md +2 -2
- package/dist/okf/types/Endpoints.md +1 -1
- package/dist/okf/types/EndpointsList.md +2 -2
- package/dist/okf/types/Event.md +2 -2
- package/dist/okf/types/EventsEvent.md +2 -2
- package/dist/okf/types/EventsEventList.md +2 -2
- package/dist/okf/types/Eviction.md +1 -1
- package/dist/okf/types/FlowSchema.md +1 -1
- package/dist/okf/types/FlowSchemaList.md +2 -2
- package/dist/okf/types/GrafanaDashboard.md +14 -0
- package/dist/okf/types/GrafanaDatasource.md +14 -0
- package/dist/okf/types/GrafanaFolder.md +14 -0
- package/dist/okf/types/HorizontalPodAutoscaler.md +1 -1
- package/dist/okf/types/HorizontalPodAutoscalerList.md +2 -2
- package/dist/okf/types/IPAddress.md +1 -1
- package/dist/okf/types/IPAddressList.md +2 -2
- package/dist/okf/types/Ing.md +1 -1
- package/dist/okf/types/IngressClass.md +1 -1
- package/dist/okf/types/IngressClassList.md +2 -2
- package/dist/okf/types/IngressList.md +2 -2
- package/dist/okf/types/JobList.md +2 -2
- package/dist/okf/types/Lease.md +1 -1
- package/dist/okf/types/LeaseCandidate.md +1 -1
- package/dist/okf/types/LeaseCandidateList.md +2 -2
- package/dist/okf/types/LeaseList.md +2 -2
- package/dist/okf/types/LimitRange.md +1 -1
- package/dist/okf/types/LimitRangeList.md +2 -2
- package/dist/okf/types/LocalSubjectAccessReview.md +1 -1
- package/dist/okf/types/MutatingAdmissionPolicy.md +1 -1
- package/dist/okf/types/MutatingAdmissionPolicyBinding.md +1 -1
- package/dist/okf/types/MutatingAdmissionPolicyBindingList.md +2 -2
- package/dist/okf/types/MutatingAdmissionPolicyList.md +2 -2
- package/dist/okf/types/MutatingWebhookConfiguration.md +1 -1
- package/dist/okf/types/MutatingWebhookConfigurationList.md +2 -2
- package/dist/okf/types/Namespace.md +1 -1
- package/dist/okf/types/NamespaceList.md +2 -2
- package/dist/okf/types/NetPol.md +1 -1
- package/dist/okf/types/NetworkPolicyList.md +2 -2
- package/dist/okf/types/Node.md +1 -1
- package/dist/okf/types/NodeList.md +2 -2
- package/dist/okf/types/PersistentVolume.md +1 -1
- package/dist/okf/types/PersistentVolumeClaimList.md +2 -2
- package/dist/okf/types/PersistentVolumeList.md +2 -2
- package/dist/okf/types/PodCertificateRequest.md +1 -1
- package/dist/okf/types/PodCertificateRequestList.md +2 -2
- package/dist/okf/types/PodDisruptionBudgetList.md +2 -2
- package/dist/okf/types/PodList.md +2 -2
- package/dist/okf/types/PodTemplateList.md +2 -2
- package/dist/okf/types/PriorityClassList.md +2 -2
- package/dist/okf/types/PriorityLevelConfiguration.md +1 -1
- package/dist/okf/types/PriorityLevelConfigurationList.md +2 -2
- package/dist/okf/types/ReplicaSet.md +1 -1
- package/dist/okf/types/ReplicaSetList.md +2 -2
- package/dist/okf/types/ReplicationController.md +1 -1
- package/dist/okf/types/ReplicationControllerList.md +2 -2
- package/dist/okf/types/ResourceClaim.md +1 -1
- package/dist/okf/types/ResourceClaimList.md +2 -2
- package/dist/okf/types/ResourceClaimTemplate.md +1 -1
- package/dist/okf/types/ResourceClaimTemplateList.md +2 -2
- package/dist/okf/types/ResourceQuota.md +1 -1
- package/dist/okf/types/ResourceQuotaList.md +2 -2
- package/dist/okf/types/ResourceSlice.md +1 -1
- package/dist/okf/types/ResourceSliceList.md +2 -2
- package/dist/okf/types/RoleBindingList.md +2 -2
- package/dist/okf/types/RoleList.md +2 -2
- package/dist/okf/types/RuntimeClass.md +2 -2
- package/dist/okf/types/RuntimeClassList.md +2 -2
- package/dist/okf/types/Scale.md +1 -1
- package/dist/okf/types/SecretList.md +2 -2
- package/dist/okf/types/SelfSubjectAccessReview.md +1 -1
- package/dist/okf/types/SelfSubjectRulesReview.md +1 -1
- package/dist/okf/types/Service.md +1 -1
- package/dist/okf/types/ServiceAccountList.md +2 -2
- package/dist/okf/types/ServiceCIDR.md +1 -1
- package/dist/okf/types/ServiceCIDRList.md +2 -2
- package/dist/okf/types/ServiceList.md +2 -2
- package/dist/okf/types/StatefulSet.md +1 -1
- package/dist/okf/types/StatefulSetList.md +2 -2
- package/dist/okf/types/Status.md +2 -2
- package/dist/okf/types/StorageClass.md +1 -1
- package/dist/okf/types/StorageClassList.md +2 -2
- package/dist/okf/types/StorageVersionMigration.md +1 -1
- package/dist/okf/types/StorageVersionMigrationList.md +2 -2
- package/dist/okf/types/SubjectAccessReview.md +1 -1
- package/dist/okf/types/TokenRequest.md +1 -1
- package/dist/okf/types/TokenReview.md +1 -1
- package/dist/okf/types/ValidatingAdmissionPolicy.md +1 -1
- package/dist/okf/types/ValidatingAdmissionPolicyBinding.md +1 -1
- package/dist/okf/types/ValidatingAdmissionPolicyBindingList.md +2 -2
- package/dist/okf/types/ValidatingAdmissionPolicyList.md +2 -2
- package/dist/okf/types/ValidatingWebhookConfiguration.md +1 -1
- package/dist/okf/types/ValidatingWebhookConfigurationList.md +2 -2
- package/dist/okf/types/VolumeAttachment.md +1 -1
- package/dist/okf/types/VolumeAttachmentList.md +2 -2
- package/dist/okf/types/VolumeAttributesClassList.md +2 -2
- package/dist/op/activities/argo.d.ts.map +1 -1
- package/dist/op/activities/index.d.ts +3 -3
- package/dist/op/activities/index.d.ts.map +1 -1
- package/dist/op/activities/wait-for-ready.d.ts.map +1 -1
- package/dist/op/builders.d.ts.map +1 -1
- package/dist/rules/wk8605.ts +131 -0
- package/dist/skills/chant-k8s.md +1 -1
- package/dist/spec/parse.d.ts +27 -0
- package/dist/spec/parse.d.ts.map +1 -1
- package/dist/types/index.d.ts +5360 -972
- package/dist/variables.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/codegen/declarations.test.ts +118 -0
- package/src/codegen/generate-typescript.ts +69 -4
- package/src/codegen/generate.ts +15 -6
- package/src/composites/catalog.ts +6 -0
- package/src/composites/gke-otel-collector.ts +6 -1
- package/src/composites/index.ts +1 -0
- package/src/composites/otel-collector-agent.ts +39 -2
- package/src/composites/otel-collector-node.test.ts +174 -0
- package/src/composites/otel-collector-node.ts +213 -0
- package/src/composites/otel-collector.ts +15 -1
- package/src/crd/crd-sources.ts +26 -0
- package/src/crd/loader.test.ts +9 -1
- package/src/crd/loader.ts +26 -3
- package/src/crd/oci-chart.test.ts +149 -0
- package/src/crd/oci-chart.ts +178 -0
- package/src/crd/types.ts +5 -0
- package/src/generated/index.d.ts +5360 -972
- package/src/generated/index.ts +23 -0
- package/src/generated/lexicon-k8s.json +156 -17
- package/src/generated/operations.json +48 -0
- package/src/import/embedded-live.test.ts +46 -4
- package/src/import/embedded-roundtrip.test.ts +73 -7
- package/src/import/embedded-types.e2e.test.ts +3 -1
- package/src/import/embedded.test.ts +64 -0
- package/src/import/embedded.ts +31 -2
- package/src/import/generator.test.ts +19 -0
- package/src/import/generator.ts +20 -2
- package/src/import/testdata/embedded/README.md +4 -1
- package/src/import/testdata/embedded/alertmanager-configmap.yaml +91 -0
- package/src/import/testdata/embedded/fixtures.ts +18 -0
- package/src/import/testdata/embedded/grafana-operator-dashboard.yaml +363 -0
- package/src/import/testdata/embedded/grafana-v2-dashboard-configmap.yaml +851 -0
- package/src/lint/audit-catalog.ts +1 -0
- package/src/lint/post-synth/index.ts +2 -0
- package/src/lint/post-synth/post-synth.test.ts +3 -3
- package/src/lint/post-synth/wk8605.test.ts +141 -0
- package/src/lint/post-synth/wk8605.ts +131 -0
- package/src/skills/chant-k8s.md +1 -1
- package/src/spec/parse.test.ts +118 -0
- package/src/spec/parse.ts +250 -29
package/src/generated/index.ts
CHANGED
|
@@ -83,6 +83,9 @@ export const FluxReport = createResource("K8s::Flux::FluxReport", "k8s", {"name"
|
|
|
83
83
|
export const Gateway = createResource("K8s::Gateway::Gateway", "k8s", {"name":"name","namespace":"namespace","uid":"uid","status":"status"});
|
|
84
84
|
export const GatewayClass = createResource("K8s::Gateway::GatewayClass", "k8s", {"name":"name","namespace":"namespace","uid":"uid","status":"status"});
|
|
85
85
|
export const GitRepository = createResource("K8s::Flux::GitRepository", "k8s", {"name":"name","namespace":"namespace","uid":"uid","status":"status"});
|
|
86
|
+
export const GrafanaDashboard = createResource("K8s::Grafana::GrafanaDashboard", "k8s", {"name":"name","namespace":"namespace","uid":"uid","status":"status"});
|
|
87
|
+
export const GrafanaDatasource = createResource("K8s::Grafana::GrafanaDatasource", "k8s", {"name":"name","namespace":"namespace","uid":"uid","status":"status"});
|
|
88
|
+
export const GrafanaFolder = createResource("K8s::Grafana::GrafanaFolder", "k8s", {"name":"name","namespace":"namespace","uid":"uid","status":"status"});
|
|
86
89
|
export const GRPCRoute = createResource("K8s::Gateway::GRPCRoute", "k8s", {"name":"name","namespace":"namespace","uid":"uid","status":"status"});
|
|
87
90
|
export const HelmChartConfig = createResource("K8s::K3s::HelmChartConfig", "k8s", {"name":"name","namespace":"namespace","uid":"uid"});
|
|
88
91
|
export const HelmChartProxy = createResource("K8s::Addons::HelmChartProxy", "k8s", {"name":"name","namespace":"namespace","uid":"uid","status":"status"});
|
|
@@ -438,6 +441,26 @@ export const GitRepository_Ref = createProperty("K8s::Flux::GitRepository.ref",
|
|
|
438
441
|
export const GitRepository_SecretRef = createProperty("K8s::Flux::GitRepository.secretRef", "k8s");
|
|
439
442
|
export const GitRepository_Status = createProperty("K8s::Flux::GitRepository.status", "k8s");
|
|
440
443
|
export const GitRepository_Verify = createProperty("K8s::Flux::GitRepository.verify", "k8s");
|
|
444
|
+
export const GrafanaDashboard_ConfigMapRef = createProperty("K8s::Grafana::GrafanaDashboard.configMapRef", "k8s");
|
|
445
|
+
export const GrafanaDashboard_Datasource = createProperty("K8s::Grafana::GrafanaDashboard.datasources", "k8s");
|
|
446
|
+
export const GrafanaDashboard_Env = createProperty("K8s::Grafana::GrafanaDashboard.envs", "k8s");
|
|
447
|
+
export const GrafanaDashboard_EnvFrom = createProperty("K8s::Grafana::GrafanaDashboard.envFrom", "k8s");
|
|
448
|
+
export const GrafanaDashboard_GrafanaCom = createProperty("K8s::Grafana::GrafanaDashboard.grafanaCom", "k8s");
|
|
449
|
+
export const GrafanaDashboard_InstanceSelector = createProperty("K8s::Grafana::GrafanaDashboard.instanceSelector", "k8s");
|
|
450
|
+
export const GrafanaDashboard_JsonnetLib = createProperty("K8s::Grafana::GrafanaDashboard.jsonnetLib", "k8s");
|
|
451
|
+
export const GrafanaDashboard_Oci = createProperty("K8s::Grafana::GrafanaDashboard.oci", "k8s");
|
|
452
|
+
export const GrafanaDashboard_Plugin = createProperty("K8s::Grafana::GrafanaDashboard.plugins", "k8s");
|
|
453
|
+
export const GrafanaDashboard_PublicSharing = createProperty("K8s::Grafana::GrafanaDashboard.publicSharing", "k8s");
|
|
454
|
+
export const GrafanaDashboard_Status = createProperty("K8s::Grafana::GrafanaDashboard.status", "k8s");
|
|
455
|
+
export const GrafanaDashboard_UrlAuthorization = createProperty("K8s::Grafana::GrafanaDashboard.urlAuthorization", "k8s");
|
|
456
|
+
export const GrafanaDashboard_Variable = createProperty("K8s::Grafana::GrafanaDashboard.variables", "k8s");
|
|
457
|
+
export const GrafanaDatasource_Datasource = createProperty("K8s::Grafana::GrafanaDatasource.datasource", "k8s");
|
|
458
|
+
export const GrafanaDatasource_InstanceSelector = createProperty("K8s::Grafana::GrafanaDatasource.instanceSelector", "k8s");
|
|
459
|
+
export const GrafanaDatasource_Plugin = createProperty("K8s::Grafana::GrafanaDatasource.plugins", "k8s");
|
|
460
|
+
export const GrafanaDatasource_Status = createProperty("K8s::Grafana::GrafanaDatasource.status", "k8s");
|
|
461
|
+
export const GrafanaDatasource_ValuesFrom = createProperty("K8s::Grafana::GrafanaDatasource.valuesFrom", "k8s");
|
|
462
|
+
export const GrafanaFolder_InstanceSelector = createProperty("K8s::Grafana::GrafanaFolder.instanceSelector", "k8s");
|
|
463
|
+
export const GrafanaFolder_Status = createProperty("K8s::Grafana::GrafanaFolder.status", "k8s");
|
|
441
464
|
export const GRPCRoute_ParentRef = createProperty("K8s::Gateway::GRPCRoute.parentRefs", "k8s");
|
|
442
465
|
export const GRPCRoute_Rule = createProperty("K8s::Gateway::GRPCRoute.rules", "k8s");
|
|
443
466
|
export const GRPCRoute_Status = createProperty("K8s::Gateway::GRPCRoute.status", "k8s");
|
|
@@ -1142,6 +1142,11 @@
|
|
|
1142
1142
|
"apiVersion": "v1",
|
|
1143
1143
|
"gvkKind": "ConfigMapList"
|
|
1144
1144
|
},
|
|
1145
|
+
"ConfigMapRef": {
|
|
1146
|
+
"resourceType": "K8s::Grafana::GrafanaDashboard.configMapRef",
|
|
1147
|
+
"kind": "property",
|
|
1148
|
+
"lexicon": "k8s"
|
|
1149
|
+
},
|
|
1145
1150
|
"Configuration": {
|
|
1146
1151
|
"resourceType": "K8s::Cnpg::ObjectStore.configuration",
|
|
1147
1152
|
"kind": "property",
|
|
@@ -1555,16 +1560,6 @@
|
|
|
1555
1560
|
"apiVersion": "v1",
|
|
1556
1561
|
"gvkKind": "EndpointsList"
|
|
1557
1562
|
},
|
|
1558
|
-
"Env": {
|
|
1559
|
-
"resourceType": "K8s::Cnpg::Cluster.env",
|
|
1560
|
-
"kind": "property",
|
|
1561
|
-
"lexicon": "k8s"
|
|
1562
|
-
},
|
|
1563
|
-
"EnvFrom": {
|
|
1564
|
-
"resourceType": "K8s::Cnpg::Cluster.envFrom",
|
|
1565
|
-
"kind": "property",
|
|
1566
|
-
"lexicon": "k8s"
|
|
1567
|
-
},
|
|
1568
1563
|
"EnvFromSource": {
|
|
1569
1564
|
"resourceType": "K8s::Core::EnvFromSource",
|
|
1570
1565
|
"kind": "property",
|
|
@@ -1971,6 +1966,135 @@
|
|
|
1971
1966
|
"kind": "property",
|
|
1972
1967
|
"lexicon": "k8s"
|
|
1973
1968
|
},
|
|
1969
|
+
"GrafanaCom": {
|
|
1970
|
+
"resourceType": "K8s::Grafana::GrafanaDashboard.grafanaCom",
|
|
1971
|
+
"kind": "property",
|
|
1972
|
+
"lexicon": "k8s"
|
|
1973
|
+
},
|
|
1974
|
+
"GrafanaDashboard": {
|
|
1975
|
+
"resourceType": "K8s::Grafana::GrafanaDashboard",
|
|
1976
|
+
"kind": "resource",
|
|
1977
|
+
"lexicon": "k8s",
|
|
1978
|
+
"apiVersion": "grafana.integreatly.org/v1beta1",
|
|
1979
|
+
"gvkKind": "GrafanaDashboard",
|
|
1980
|
+
"specSchema": {"type":"object","fields":{"allowCrossNamespaceImport":{"type":"boolean"},"configMapRef":{"type":"object","fields":{"key":{"type":"string"},"name":{"type":"string"},"optional":{"type":"boolean"}},"required":["key"]},"contentCacheDuration":{"type":"string"},"datasources":{"type":"array","items":{"type":"object","fields":{"datasourceName":{"type":"string"},"inputName":{"type":"string"}},"required":["datasourceName","inputName"]}},"envFrom":{"type":"array","items":{"type":"object","fields":{"configMapKeyRef":{"type":"object","fields":{"key":{"type":"string"},"name":{"type":"string"},"optional":{"type":"boolean"}},"required":["key"]},"secretKeyRef":{"type":"object","fields":{"key":{"type":"string"},"name":{"type":"string"},"optional":{"type":"boolean"}},"required":["key"]}}}},"envs":{"type":"array","items":{"type":"object","fields":{"name":{"type":"string"},"value":{"type":"string"},"valueFrom":{"type":"object","fields":{"configMapKeyRef":{"type":"object","fields":{"key":{"type":"string"},"name":{"type":"string"},"optional":{"type":"boolean"}},"required":["key"]},"secretKeyRef":{"type":"object","fields":{"key":{"type":"string"},"name":{"type":"string"},"optional":{"type":"boolean"}},"required":["key"]}}}},"required":["name"]}},"folder":{"type":"string"},"folderRef":{"type":"string"},"folderUID":{"type":"string"},"grafanaCom":{"type":"object","fields":{"id":{"type":"integer"},"revision":{"type":"integer"}},"required":["id"]},"gzipJson":{"type":"string"},"instanceSelector":{"type":"object","fields":{"matchExpressions":{"type":"array","items":{"type":"object","fields":{"key":{"type":"string"},"operator":{"type":"string"},"values":{"type":"array","items":{"type":"string"}}},"required":["key","operator"]}},"matchLabels":{"type":"object","open":true}}},"json":{"type":"string"},"jsonnet":{"type":"string"},"jsonnetLib":{"type":"object","fields":{"fileName":{"type":"string"},"gzipJsonnetProject":{"type":"string"},"jPath":{"type":"array","items":{"type":"string"}}},"required":["fileName","gzipJsonnetProject"]},"oci":{"type":"object","fields":{"insecurePlainHTTP":{"type":"boolean"},"path":{"type":"string"},"pullSecretRef":{"type":"object","fields":{"name":{"type":"string"}}},"reference":{"type":"string"}},"required":["path","reference"]},"plugins":{"type":"array","items":{"type":"object","fields":{"name":{"type":"string"},"version":{"type":"string"}},"required":["name","version"]}},"publicSharing":{"type":"object","fields":{"accessToken":{"type":"string"},"annotationsEnabled":{"type":"boolean"},"enabled":{"type":"boolean"},"timeSelectionEnabled":{"type":"boolean"}}},"resyncPeriod":{"type":"string"},"suspend":{"type":"boolean"},"uid":{"type":"string"},"url":{"type":"string"},"urlAuthorization":{"type":"object","fields":{"basicAuth":{"type":"object","fields":{"password":{"type":"object","fields":{"key":{"type":"string"},"name":{"type":"string"},"optional":{"type":"boolean"}},"required":["key"]},"username":{"type":"object","fields":{"key":{"type":"string"},"name":{"type":"string"},"optional":{"type":"boolean"}},"required":["key"]}}}}},"variables":{"type":"array","items":{"type":"object","fields":{"name":{"type":"string"},"value":{"type":"string"}},"required":["name","value"]}}},"required":["instanceSelector"]}
|
|
1981
|
+
},
|
|
1982
|
+
"GrafanaDashboard_ConfigMapRef": {
|
|
1983
|
+
"resourceType": "K8s::Grafana::GrafanaDashboard.configMapRef",
|
|
1984
|
+
"kind": "property",
|
|
1985
|
+
"lexicon": "k8s"
|
|
1986
|
+
},
|
|
1987
|
+
"GrafanaDashboard_Datasource": {
|
|
1988
|
+
"resourceType": "K8s::Grafana::GrafanaDashboard.datasources",
|
|
1989
|
+
"kind": "property",
|
|
1990
|
+
"lexicon": "k8s"
|
|
1991
|
+
},
|
|
1992
|
+
"GrafanaDashboard_Env": {
|
|
1993
|
+
"resourceType": "K8s::Grafana::GrafanaDashboard.envs",
|
|
1994
|
+
"kind": "property",
|
|
1995
|
+
"lexicon": "k8s"
|
|
1996
|
+
},
|
|
1997
|
+
"GrafanaDashboard_EnvFrom": {
|
|
1998
|
+
"resourceType": "K8s::Grafana::GrafanaDashboard.envFrom",
|
|
1999
|
+
"kind": "property",
|
|
2000
|
+
"lexicon": "k8s"
|
|
2001
|
+
},
|
|
2002
|
+
"GrafanaDashboard_GrafanaCom": {
|
|
2003
|
+
"resourceType": "K8s::Grafana::GrafanaDashboard.grafanaCom",
|
|
2004
|
+
"kind": "property",
|
|
2005
|
+
"lexicon": "k8s"
|
|
2006
|
+
},
|
|
2007
|
+
"GrafanaDashboard_InstanceSelector": {
|
|
2008
|
+
"resourceType": "K8s::Grafana::GrafanaDashboard.instanceSelector",
|
|
2009
|
+
"kind": "property",
|
|
2010
|
+
"lexicon": "k8s"
|
|
2011
|
+
},
|
|
2012
|
+
"GrafanaDashboard_JsonnetLib": {
|
|
2013
|
+
"resourceType": "K8s::Grafana::GrafanaDashboard.jsonnetLib",
|
|
2014
|
+
"kind": "property",
|
|
2015
|
+
"lexicon": "k8s"
|
|
2016
|
+
},
|
|
2017
|
+
"GrafanaDashboard_Oci": {
|
|
2018
|
+
"resourceType": "K8s::Grafana::GrafanaDashboard.oci",
|
|
2019
|
+
"kind": "property",
|
|
2020
|
+
"lexicon": "k8s"
|
|
2021
|
+
},
|
|
2022
|
+
"GrafanaDashboard_Plugin": {
|
|
2023
|
+
"resourceType": "K8s::Grafana::GrafanaDashboard.plugins",
|
|
2024
|
+
"kind": "property",
|
|
2025
|
+
"lexicon": "k8s"
|
|
2026
|
+
},
|
|
2027
|
+
"GrafanaDashboard_PublicSharing": {
|
|
2028
|
+
"resourceType": "K8s::Grafana::GrafanaDashboard.publicSharing",
|
|
2029
|
+
"kind": "property",
|
|
2030
|
+
"lexicon": "k8s"
|
|
2031
|
+
},
|
|
2032
|
+
"GrafanaDashboard_Status": {
|
|
2033
|
+
"resourceType": "K8s::Grafana::GrafanaDashboard.status",
|
|
2034
|
+
"kind": "property",
|
|
2035
|
+
"lexicon": "k8s"
|
|
2036
|
+
},
|
|
2037
|
+
"GrafanaDashboard_UrlAuthorization": {
|
|
2038
|
+
"resourceType": "K8s::Grafana::GrafanaDashboard.urlAuthorization",
|
|
2039
|
+
"kind": "property",
|
|
2040
|
+
"lexicon": "k8s"
|
|
2041
|
+
},
|
|
2042
|
+
"GrafanaDashboard_Variable": {
|
|
2043
|
+
"resourceType": "K8s::Grafana::GrafanaDashboard.variables",
|
|
2044
|
+
"kind": "property",
|
|
2045
|
+
"lexicon": "k8s"
|
|
2046
|
+
},
|
|
2047
|
+
"GrafanaDatasource": {
|
|
2048
|
+
"resourceType": "K8s::Grafana::GrafanaDatasource",
|
|
2049
|
+
"kind": "resource",
|
|
2050
|
+
"lexicon": "k8s",
|
|
2051
|
+
"apiVersion": "grafana.integreatly.org/v1beta1",
|
|
2052
|
+
"gvkKind": "GrafanaDatasource",
|
|
2053
|
+
"specSchema": {"type":"object","fields":{"allowCrossNamespaceImport":{"type":"boolean"},"datasource":{"type":"object","fields":{"access":{"type":"string"},"basicAuth":{"type":"boolean"},"basicAuthUser":{"type":"string"},"database":{"type":"string"},"editable":{"type":"boolean"},"isDefault":{"type":"boolean"},"jsonData":{"type":"object","open":true},"name":{"type":"string"},"orgId":{"type":"integer"},"secureJsonData":{"type":"object","open":true},"type":{"type":"string"},"uid":{"type":"string"},"url":{"type":"string"},"user":{"type":"string"}}},"instanceSelector":{"type":"object","fields":{"matchExpressions":{"type":"array","items":{"type":"object","fields":{"key":{"type":"string"},"operator":{"type":"string"},"values":{"type":"array","items":{"type":"string"}}},"required":["key","operator"]}},"matchLabels":{"type":"object","open":true}}},"plugins":{"type":"array","items":{"type":"object","fields":{"name":{"type":"string"},"version":{"type":"string"}},"required":["name","version"]}},"resyncPeriod":{"type":"string"},"suspend":{"type":"boolean"},"uid":{"type":"string"},"valuesFrom":{"type":"array","items":{"type":"object","fields":{"targetPath":{"type":"string"},"valueFrom":{"type":"object","fields":{"configMapKeyRef":{"type":"object","fields":{"key":{"type":"string"},"name":{"type":"string"},"optional":{"type":"boolean"}},"required":["key"]},"secretKeyRef":{"type":"object","fields":{"key":{"type":"string"},"name":{"type":"string"},"optional":{"type":"boolean"}},"required":["key"]}}}},"required":["targetPath","valueFrom"]}}},"required":["datasource","instanceSelector"]}
|
|
2054
|
+
},
|
|
2055
|
+
"GrafanaDatasource_Datasource": {
|
|
2056
|
+
"resourceType": "K8s::Grafana::GrafanaDatasource.datasource",
|
|
2057
|
+
"kind": "property",
|
|
2058
|
+
"lexicon": "k8s"
|
|
2059
|
+
},
|
|
2060
|
+
"GrafanaDatasource_InstanceSelector": {
|
|
2061
|
+
"resourceType": "K8s::Grafana::GrafanaDatasource.instanceSelector",
|
|
2062
|
+
"kind": "property",
|
|
2063
|
+
"lexicon": "k8s"
|
|
2064
|
+
},
|
|
2065
|
+
"GrafanaDatasource_Plugin": {
|
|
2066
|
+
"resourceType": "K8s::Grafana::GrafanaDatasource.plugins",
|
|
2067
|
+
"kind": "property",
|
|
2068
|
+
"lexicon": "k8s"
|
|
2069
|
+
},
|
|
2070
|
+
"GrafanaDatasource_Status": {
|
|
2071
|
+
"resourceType": "K8s::Grafana::GrafanaDatasource.status",
|
|
2072
|
+
"kind": "property",
|
|
2073
|
+
"lexicon": "k8s"
|
|
2074
|
+
},
|
|
2075
|
+
"GrafanaDatasource_ValuesFrom": {
|
|
2076
|
+
"resourceType": "K8s::Grafana::GrafanaDatasource.valuesFrom",
|
|
2077
|
+
"kind": "property",
|
|
2078
|
+
"lexicon": "k8s"
|
|
2079
|
+
},
|
|
2080
|
+
"GrafanaFolder": {
|
|
2081
|
+
"resourceType": "K8s::Grafana::GrafanaFolder",
|
|
2082
|
+
"kind": "resource",
|
|
2083
|
+
"lexicon": "k8s",
|
|
2084
|
+
"apiVersion": "grafana.integreatly.org/v1beta1",
|
|
2085
|
+
"gvkKind": "GrafanaFolder",
|
|
2086
|
+
"specSchema": {"type":"object","fields":{"allowCrossNamespaceImport":{"type":"boolean"},"instanceSelector":{"type":"object","fields":{"matchExpressions":{"type":"array","items":{"type":"object","fields":{"key":{"type":"string"},"operator":{"type":"string"},"values":{"type":"array","items":{"type":"string"}}},"required":["key","operator"]}},"matchLabels":{"type":"object","open":true}}},"parentFolderRef":{"type":"string"},"parentFolderUID":{"type":"string"},"permissions":{"type":"string"},"resyncPeriod":{"type":"string"},"suspend":{"type":"boolean"},"title":{"type":"string"},"uid":{"type":"string"}},"required":["instanceSelector"]}
|
|
2087
|
+
},
|
|
2088
|
+
"GrafanaFolder_InstanceSelector": {
|
|
2089
|
+
"resourceType": "K8s::Grafana::GrafanaFolder.instanceSelector",
|
|
2090
|
+
"kind": "property",
|
|
2091
|
+
"lexicon": "k8s"
|
|
2092
|
+
},
|
|
2093
|
+
"GrafanaFolder_Status": {
|
|
2094
|
+
"resourceType": "K8s::Grafana::GrafanaFolder.status",
|
|
2095
|
+
"kind": "property",
|
|
2096
|
+
"lexicon": "k8s"
|
|
2097
|
+
},
|
|
1974
2098
|
"Group": {
|
|
1975
2099
|
"resourceType": "K8s::Monitoring::PrometheusRule.groups",
|
|
1976
2100
|
"kind": "property",
|
|
@@ -2761,6 +2885,11 @@
|
|
|
2761
2885
|
"apiVersion": "batch/v1",
|
|
2762
2886
|
"gvkKind": "JobList"
|
|
2763
2887
|
},
|
|
2888
|
+
"JsonnetLib": {
|
|
2889
|
+
"resourceType": "K8s::Grafana::GrafanaDashboard.jsonnetLib",
|
|
2890
|
+
"kind": "property",
|
|
2891
|
+
"lexicon": "k8s"
|
|
2892
|
+
},
|
|
2764
2893
|
"K3sHelmChart": {
|
|
2765
2894
|
"resourceType": "K8s::K3s::HelmChart",
|
|
2766
2895
|
"kind": "resource",
|
|
@@ -3532,6 +3661,11 @@
|
|
|
3532
3661
|
"kind": "property",
|
|
3533
3662
|
"lexicon": "k8s"
|
|
3534
3663
|
},
|
|
3664
|
+
"Oci": {
|
|
3665
|
+
"resourceType": "K8s::Grafana::GrafanaDashboard.oci",
|
|
3666
|
+
"kind": "property",
|
|
3667
|
+
"lexicon": "k8s"
|
|
3668
|
+
},
|
|
3535
3669
|
"OidcIdentityProviderConfig": {
|
|
3536
3670
|
"resourceType": "K8s::Controlplane::AWSManagedControlPlane.oidcIdentityProviderConfig",
|
|
3537
3671
|
"kind": "property",
|
|
@@ -3664,11 +3798,6 @@
|
|
|
3664
3798
|
"kind": "property",
|
|
3665
3799
|
"lexicon": "k8s"
|
|
3666
3800
|
},
|
|
3667
|
-
"Plugin": {
|
|
3668
|
-
"resourceType": "K8s::Cnpg::Cluster.plugins",
|
|
3669
|
-
"kind": "property",
|
|
3670
|
-
"lexicon": "k8s"
|
|
3671
|
-
},
|
|
3672
3801
|
"Pod": {
|
|
3673
3802
|
"resourceType": "K8s::Core::Pod",
|
|
3674
3803
|
"kind": "resource",
|
|
@@ -4030,6 +4159,11 @@
|
|
|
4030
4159
|
"kind": "property",
|
|
4031
4160
|
"lexicon": "k8s"
|
|
4032
4161
|
},
|
|
4162
|
+
"PublicSharing": {
|
|
4163
|
+
"resourceType": "K8s::Grafana::GrafanaDashboard.publicSharing",
|
|
4164
|
+
"kind": "property",
|
|
4165
|
+
"lexicon": "k8s"
|
|
4166
|
+
},
|
|
4033
4167
|
"Push": {
|
|
4034
4168
|
"resourceType": "K8s::Infisical::InfisicalPushSecret.push",
|
|
4035
4169
|
"kind": "property",
|
|
@@ -5253,6 +5387,11 @@
|
|
|
5253
5387
|
"kind": "property",
|
|
5254
5388
|
"lexicon": "k8s"
|
|
5255
5389
|
},
|
|
5390
|
+
"UrlAuthorization": {
|
|
5391
|
+
"resourceType": "K8s::Grafana::GrafanaDashboard.urlAuthorization",
|
|
5392
|
+
"kind": "property",
|
|
5393
|
+
"lexicon": "k8s"
|
|
5394
|
+
},
|
|
5256
5395
|
"User": {
|
|
5257
5396
|
"resourceType": "K8s::Iam::User",
|
|
5258
5397
|
"kind": "resource",
|
|
@@ -5323,8 +5462,8 @@
|
|
|
5323
5462
|
"apiVersion": "admissionregistration.k8s.io/v1",
|
|
5324
5463
|
"gvkKind": "ValidatingWebhookConfigurationList"
|
|
5325
5464
|
},
|
|
5326
|
-
"
|
|
5327
|
-
"resourceType": "K8s::
|
|
5465
|
+
"Variable": {
|
|
5466
|
+
"resourceType": "K8s::Grafana::GrafanaDashboard.variables",
|
|
5328
5467
|
"kind": "property",
|
|
5329
5468
|
"lexicon": "k8s"
|
|
5330
5469
|
},
|
|
@@ -1713,6 +1713,54 @@
|
|
|
1713
1713
|
"watch"
|
|
1714
1714
|
]
|
|
1715
1715
|
},
|
|
1716
|
+
"K8s::Grafana::GrafanaDashboard": {
|
|
1717
|
+
"entityType": "K8s::Grafana::GrafanaDashboard",
|
|
1718
|
+
"apiVersion": "grafana.integreatly.org/v1beta1",
|
|
1719
|
+
"kind": "GrafanaDashboard",
|
|
1720
|
+
"plural": "grafanadashboards",
|
|
1721
|
+
"scope": "Namespaced",
|
|
1722
|
+
"verbs": [
|
|
1723
|
+
"delete",
|
|
1724
|
+
"get",
|
|
1725
|
+
"list",
|
|
1726
|
+
"patch",
|
|
1727
|
+
"post",
|
|
1728
|
+
"put",
|
|
1729
|
+
"watch"
|
|
1730
|
+
]
|
|
1731
|
+
},
|
|
1732
|
+
"K8s::Grafana::GrafanaDatasource": {
|
|
1733
|
+
"entityType": "K8s::Grafana::GrafanaDatasource",
|
|
1734
|
+
"apiVersion": "grafana.integreatly.org/v1beta1",
|
|
1735
|
+
"kind": "GrafanaDatasource",
|
|
1736
|
+
"plural": "grafanadatasources",
|
|
1737
|
+
"scope": "Namespaced",
|
|
1738
|
+
"verbs": [
|
|
1739
|
+
"delete",
|
|
1740
|
+
"get",
|
|
1741
|
+
"list",
|
|
1742
|
+
"patch",
|
|
1743
|
+
"post",
|
|
1744
|
+
"put",
|
|
1745
|
+
"watch"
|
|
1746
|
+
]
|
|
1747
|
+
},
|
|
1748
|
+
"K8s::Grafana::GrafanaFolder": {
|
|
1749
|
+
"entityType": "K8s::Grafana::GrafanaFolder",
|
|
1750
|
+
"apiVersion": "grafana.integreatly.org/v1beta1",
|
|
1751
|
+
"kind": "GrafanaFolder",
|
|
1752
|
+
"plural": "grafanafolders",
|
|
1753
|
+
"scope": "Namespaced",
|
|
1754
|
+
"verbs": [
|
|
1755
|
+
"delete",
|
|
1756
|
+
"get",
|
|
1757
|
+
"list",
|
|
1758
|
+
"patch",
|
|
1759
|
+
"post",
|
|
1760
|
+
"put",
|
|
1761
|
+
"watch"
|
|
1762
|
+
]
|
|
1763
|
+
},
|
|
1716
1764
|
"K8s::Iam::Policy": {
|
|
1717
1765
|
"entityType": "K8s::Iam::Policy",
|
|
1718
1766
|
"apiVersion": "iam.services.k8s.aws/v1alpha1",
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Embedded content through `chant import --from <env>` (#2995): a ConfigMap
|
|
3
|
-
* holding a collector config
|
|
4
|
-
* (fake) cluster imports as the owning
|
|
5
|
-
* as `chant import <manifest>` does
|
|
3
|
+
* holding a collector config or an alertmanager.yml (#3031), or a
|
|
4
|
+
* PrometheusRule's groups, read from a (fake) cluster imports as the owning
|
|
5
|
+
* lexicon's typed declarations, exactly as `chant import <manifest>` does
|
|
6
|
+
* (embedded-roundtrip.test.ts). A v2 dashboard is kept as read, with the
|
|
7
|
+
* same warning.
|
|
6
8
|
*
|
|
7
9
|
* The cluster is `fakeCluster`: a real k8s client with the socket replaced.
|
|
8
10
|
* The objects are the round trip's fixtures with the fields a server adds.
|
|
@@ -22,7 +24,7 @@ import { k8sPlugin } from "../plugin";
|
|
|
22
24
|
import { k8sSerializer } from "../serializer";
|
|
23
25
|
import { exportResources } from "../export-resources";
|
|
24
26
|
import { fakeCluster, objectKey } from "../api/fake-cluster";
|
|
25
|
-
import { pkgDir, read, removeDir } from "./testdata/embedded/fixtures";
|
|
27
|
+
import { alertmanagerConfig, pkgDir, read, removeDir } from "./testdata/embedded/fixtures";
|
|
26
28
|
|
|
27
29
|
type Json = Record<string, unknown>;
|
|
28
30
|
|
|
@@ -128,6 +130,46 @@ describe("chant import --from: embedded content imported by its owner (#2995)",
|
|
|
128
130
|
}
|
|
129
131
|
});
|
|
130
132
|
|
|
133
|
+
test("a live alertmanager ConfigMap becomes typed prometheus declarations and builds back to the same config (#3031)", async () => {
|
|
134
|
+
const out = await importLive("alertmanager-configmap.yaml");
|
|
135
|
+
try {
|
|
136
|
+
expect(out.result.error).toBeUndefined();
|
|
137
|
+
expect(out.result.success).toBe(true);
|
|
138
|
+
expect(out.result.warnings.filter((w) => w.includes("kept as written"))).toEqual([]);
|
|
139
|
+
expect(out.result.generatedFiles).toContain("alertmanager/routes.ts");
|
|
140
|
+
expect(out.files["alertmanager/receivers.ts"]).toContain("new Receiver(");
|
|
141
|
+
const host = Object.entries(out.files).find(([p, text]) => !p.includes("/") && text.includes("alertmanagerYaml("));
|
|
142
|
+
expect(host, Object.keys(out.files).join(", ")).toBeDefined();
|
|
143
|
+
expect(host![1]).toContain('import { alertmanagerYaml } from "@intentius/chant-lexicon-prometheus";');
|
|
144
|
+
|
|
145
|
+
const result = await build(out.srcDir, [k8sSerializer, otelSerializer, prometheusSerializer]);
|
|
146
|
+
expect(result.errors).toEqual([]);
|
|
147
|
+
const rebuilt = (loadAll(primary(result.outputs.get("k8s"))) as Json[]).filter((d) => d);
|
|
148
|
+
const source = (loadAll(read("alertmanager-configmap.yaml")) as Json[]).filter((d) => d);
|
|
149
|
+
const before = (find(source, "ConfigMap", "alertmanager").data as Json)["alertmanager.yml"] as string;
|
|
150
|
+
const after = (find(rebuilt, "ConfigMap", "alertmanager").data as Json)["alertmanager.yml"] as string;
|
|
151
|
+
expect(alertmanagerConfig(after)).toEqual(alertmanagerConfig(before));
|
|
152
|
+
} finally {
|
|
153
|
+
removeDir(out.dir);
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
test("a live v2 dashboard ConfigMap is kept as read, with a warning saying why (#3031)", async () => {
|
|
158
|
+
const out = await importLive("grafana-v2-dashboard-configmap.yaml");
|
|
159
|
+
try {
|
|
160
|
+
expect(out.result.error).toBeUndefined();
|
|
161
|
+
expect(out.result.success).toBe(true);
|
|
162
|
+
const kept = out.result.warnings.filter((w) => w.includes("kept as written"));
|
|
163
|
+
expect(kept).toHaveLength(1);
|
|
164
|
+
expect(kept[0]).toContain('ConfigMap grafana-dashboard-checkout-v2 data["checkout.json"] is a Grafana dashboard, kept as written:');
|
|
165
|
+
expect(kept[0]).toContain("v2 dashboard");
|
|
166
|
+
expect(Object.keys(out.files).filter((p) => p.includes("/"))).toEqual([]);
|
|
167
|
+
expect(Object.values(out.files).join("\n")).not.toContain("dashboardJson");
|
|
168
|
+
} finally {
|
|
169
|
+
removeDir(out.dir);
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
|
|
131
173
|
test("the export keeps embedded content as read when no context is given", async () => {
|
|
132
174
|
const cluster = fakeCluster({ objects: liveObjects("otel-collector-daemonset.yaml") });
|
|
133
175
|
const ir = await exportResources({ environment: "test", selector: { type: "K8s::Core::ConfigMap" } }, cluster.connector);
|
|
@@ -7,14 +7,20 @@
|
|
|
7
7
|
* Fixtures (testdata/embedded/, provenance in its README.md): the
|
|
8
8
|
* opentelemetry-collector Helm chart's rendered daemonset-only example, the
|
|
9
9
|
* node-exporter PrometheusRule of kube-prometheus, a kube-prometheus
|
|
10
|
-
* dashboard ConfigMap with the Grafana sidecar label,
|
|
11
|
-
*
|
|
10
|
+
* dashboard ConfigMap with the Grafana sidecar label, the k8s build output
|
|
11
|
+
* of examples/agent-observability, the alertmanager Helm chart's ConfigMap
|
|
12
|
+
* holding Alertmanager's example config, and a ConfigMap holding a v2
|
|
13
|
+
* dashboard Grafana 13 exported (#3031), and a Grafana Operator
|
|
14
|
+
* GrafanaDashboard holding the kube-prometheus dashboard in spec.json (#3015).
|
|
12
15
|
*
|
|
13
16
|
* "The same" is per owner: a collector config equal as parsed YAML, rule
|
|
14
|
-
* groups equal as parsed YAML,
|
|
17
|
+
* groups equal as parsed YAML, an alertmanager.yml equal as the prometheus
|
|
18
|
+
* importer reads it (receivers and time intervals sorted by name, which the
|
|
19
|
+
* serializer does), a dashboard equal after the grafana lexicon's
|
|
15
20
|
* `normalizeDashboard` with its importer's edits applied (the grafana round
|
|
16
|
-
* trip's own measure). Content no lexicon claims
|
|
17
|
-
*
|
|
21
|
+
* trip's own measure). Content no lexicon claims, and a v2 dashboard, which
|
|
22
|
+
* grafana keeps as written, must come back as the same text.
|
|
23
|
+
* embedded-types.e2e.test.ts type-checks the generated source.
|
|
18
24
|
*/
|
|
19
25
|
|
|
20
26
|
import { describe, expect, test } from "vitest";
|
|
@@ -30,7 +36,7 @@ import { parseGrafana, type DashboardResourceMetadata } from "@intentius/chant-l
|
|
|
30
36
|
import { applyEdits } from "@intentius/chant-lexicon-grafana/import/edits";
|
|
31
37
|
import { normalizeDashboard } from "@intentius/chant-lexicon-grafana/import/normalize";
|
|
32
38
|
import { k8sSerializer } from "../serializer";
|
|
33
|
-
import { importManifest, read, removeDir, type Imported } from "./testdata/embedded/fixtures";
|
|
39
|
+
import { alertmanagerConfig, importManifest, read, removeDir, type Imported } from "./testdata/embedded/fixtures";
|
|
34
40
|
|
|
35
41
|
type Json = Record<string, unknown>;
|
|
36
42
|
|
|
@@ -160,10 +166,64 @@ describe("manifest -> TypeScript -> manifest, with embedded content imported by
|
|
|
160
166
|
expect(actual).toEqual(expected);
|
|
161
167
|
});
|
|
162
168
|
|
|
169
|
+
test("a Grafana Operator GrafanaDashboard's spec.json becomes a grafana Dashboard (#3015)", async () => {
|
|
170
|
+
const out = await roundTrip("grafana-operator-dashboard.yaml");
|
|
171
|
+
expect(out.buildErrors).toEqual([]);
|
|
172
|
+
|
|
173
|
+
const main = out.files["main.ts"];
|
|
174
|
+
expect(main).toContain('import { dashboardJson } from "@intentius/chant-lexicon-grafana";');
|
|
175
|
+
expect(main).toMatch(/json: dashboardJson\(\w+\)/);
|
|
176
|
+
expect(out.files["alertmanager-overview/dashboard.ts"]).toContain("new Dashboard(");
|
|
177
|
+
|
|
178
|
+
const before = find(out.input, "GrafanaDashboard", "alertmanager-overview");
|
|
179
|
+
const after = find(out.output, "GrafanaDashboard", "alertmanager-overview");
|
|
180
|
+
expect(after.metadata).toEqual(before.metadata);
|
|
181
|
+
const { json: beforeJson, ...beforeSpec } = before.spec as Json;
|
|
182
|
+
const { json: afterJson, ...afterSpec } = after.spec as Json;
|
|
183
|
+
expect(afterSpec).toEqual(beforeSpec);
|
|
184
|
+
const { expected, actual } = dashboards(beforeJson as string, afterJson as string);
|
|
185
|
+
expect(actual).toEqual(expected);
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
test("the alertmanager chart's ConfigMap becomes typed prometheus declarations through alertmanagerYaml (#3031)", async () => {
|
|
189
|
+
const out = await roundTrip("alertmanager-configmap.yaml");
|
|
190
|
+
expect(out.buildErrors).toEqual([]);
|
|
191
|
+
expect(out.result.warnings).toEqual([]);
|
|
192
|
+
|
|
193
|
+
const main = out.files["main.ts"];
|
|
194
|
+
expect(main).toContain('import { alertmanagerYaml } from "@intentius/chant-lexicon-prometheus";');
|
|
195
|
+
expect(main).toMatch(/"alertmanager\.yml": alertmanagerYaml\(\[\s+teamXMails,/);
|
|
196
|
+
expect(embeddedDirs(out.files)).toEqual(["alertmanager"]);
|
|
197
|
+
expect(out.files["alertmanager/receivers.ts"]).toContain("new Receiver(");
|
|
198
|
+
expect(out.files["alertmanager/routes.ts"]).toContain("new Route(");
|
|
199
|
+
expect(out.files["alertmanager/inhibit-rules.ts"]).toContain("new InhibitRule(");
|
|
200
|
+
expect(out.files["alertmanager/settings.ts"]).toContain("new AlertmanagerSettings(");
|
|
201
|
+
|
|
202
|
+
const before = find(out.input, "ConfigMap", "alertmanager");
|
|
203
|
+
const after = find(out.output, "ConfigMap", "alertmanager");
|
|
204
|
+
expect(after.metadata).toEqual(before.metadata);
|
|
205
|
+
const text = (after.data as Json)["alertmanager.yml"] as string;
|
|
206
|
+
expect(alertmanagerConfig(text)).toEqual(alertmanagerConfig((before.data as Json)["alertmanager.yml"] as string));
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
test("a v2 dashboard ConfigMap is kept as written, with a warning saying why (#3031)", async () => {
|
|
210
|
+
const out = await roundTrip("grafana-v2-dashboard-configmap.yaml");
|
|
211
|
+
expect(out.buildErrors).toEqual([]);
|
|
212
|
+
expect(out.result.warnings).toHaveLength(1);
|
|
213
|
+
expect(out.result.warnings[0]).toContain('ConfigMap grafana-dashboard-checkout-v2 data["checkout.json"] is a Grafana dashboard, kept as written:');
|
|
214
|
+
expect(out.result.warnings[0]).toContain("v2 dashboard");
|
|
215
|
+
expect(embeddedDirs(out.files)).toEqual([]);
|
|
216
|
+
expect(out.files["main.ts"]).not.toContain("dashboardJson");
|
|
217
|
+
|
|
218
|
+
const name = "grafana-dashboard-checkout-v2";
|
|
219
|
+
expect(find(out.output, "ConfigMap", name)).toEqual(find(out.input, "ConfigMap", name));
|
|
220
|
+
});
|
|
221
|
+
|
|
163
222
|
test("examples/agent-observability's k8s output: every ConfigMap value comes back, the owned ones typed", async () => {
|
|
164
223
|
const out = await roundTrip("agent-observability.yaml");
|
|
165
224
|
expect(out.buildErrors).toEqual([]);
|
|
166
225
|
expect(embeddedDirs(out.files)).toEqual([
|
|
226
|
+
"alertmanager-config",
|
|
167
227
|
"grafana-dashboard-genai-agents",
|
|
168
228
|
"grafana-dashboard-red-traces-span-metrics",
|
|
169
229
|
"grafana-dashboard-slo-support-agent-runs",
|
|
@@ -213,11 +273,17 @@ describe("manifest -> TypeScript -> manifest, with embedded content imported by
|
|
|
213
273
|
read("otel-collector-daemonset.yaml"),
|
|
214
274
|
read("node-exporter-prometheusrule.yaml"),
|
|
215
275
|
read("grafana-dashboard-configmap.yaml"),
|
|
276
|
+
read("alertmanager-configmap.yaml"),
|
|
216
277
|
].join("\n---\n");
|
|
217
278
|
const imported = await importManifest(yaml);
|
|
218
279
|
try {
|
|
219
280
|
const dirs = embeddedDirs(imported.files);
|
|
220
|
-
expect(dirs).toEqual([
|
|
281
|
+
expect(dirs).toEqual([
|
|
282
|
+
"alertmanager",
|
|
283
|
+
"example-opentelemetry-collector-agent",
|
|
284
|
+
"grafana-dashboard-alertmanager-overview",
|
|
285
|
+
"node-exporter-rules",
|
|
286
|
+
]);
|
|
221
287
|
for (const dir of dirs) {
|
|
222
288
|
const lint = await lintCommand({ path: join(imported.srcDir, dir), format: "stylish" });
|
|
223
289
|
if (lint.errorCount + lint.warningCount > 0) console.log(lint.output);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* What `chant import` generates for manifests with embedded content (#2962
|
|
2
|
+
* What `chant import` generates for manifests with embedded content (#2962,
|
|
3
|
+
* #3031)
|
|
3
4
|
* type-checks: the k8s module that references the owners' declarations, and
|
|
4
5
|
* the owners' modules. Compiling takes longer than the unit-test budget
|
|
5
6
|
* allows, so this runs with the e2e tests.
|
|
@@ -31,6 +32,7 @@ describe("the source generated for embedded content type-checks", () => {
|
|
|
31
32
|
"node-exporter-prometheusrule.yaml",
|
|
32
33
|
"grafana-dashboard-configmap.yaml",
|
|
33
34
|
"agent-observability.yaml",
|
|
35
|
+
"alertmanager-configmap.yaml",
|
|
34
36
|
])("%s", async (fixture) => {
|
|
35
37
|
const imported = await importManifest(read(fixture));
|
|
36
38
|
try {
|
|
@@ -107,6 +107,70 @@ describe("k8s import offers embedded content (#2962)", () => {
|
|
|
107
107
|
const [main] = new K8sGenerator().generate(ir);
|
|
108
108
|
expect(main.content).not.toContain("import { render");
|
|
109
109
|
});
|
|
110
|
+
|
|
111
|
+
test("a GrafanaDashboard's spec.json is offered as text, and replaced by the owner's reference (#3015)", () => {
|
|
112
|
+
const seen: EmbeddedContent[] = [];
|
|
113
|
+
const embedded = new EmbeddedImports([{ lexicon: "acme", importer: claimAll(seen) }]);
|
|
114
|
+
const ir = new K8sParser().parse(
|
|
115
|
+
`
|
|
116
|
+
apiVersion: grafana.integreatly.org/v1beta1
|
|
117
|
+
kind: GrafanaDashboard
|
|
118
|
+
metadata:
|
|
119
|
+
name: api
|
|
120
|
+
spec:
|
|
121
|
+
instanceSelector:
|
|
122
|
+
matchLabels:
|
|
123
|
+
dashboards: grafana
|
|
124
|
+
folderRef: grafana-folder-services
|
|
125
|
+
json: '{"title": "API", "panels": [], "schemaVersion": 41}'
|
|
126
|
+
---
|
|
127
|
+
apiVersion: grafana.integreatly.org/v1beta1
|
|
128
|
+
kind: GrafanaDashboard
|
|
129
|
+
metadata:
|
|
130
|
+
name: remote
|
|
131
|
+
spec:
|
|
132
|
+
instanceSelector: {}
|
|
133
|
+
url: https://grafana.com/api/dashboards/1860/revisions/37/download
|
|
134
|
+
`,
|
|
135
|
+
{ embedded },
|
|
136
|
+
);
|
|
137
|
+
expect(seen.map((c) => [c.location, c.directory, c.text, c.expectedOwner?.lexicon])).toEqual([
|
|
138
|
+
["GrafanaDashboard api spec.json", "api", '{"title": "API", "panels": [], "schemaVersion": 41}', "grafana"],
|
|
139
|
+
]);
|
|
140
|
+
const [main] = new K8sGenerator().generate(ir);
|
|
141
|
+
expect(main.content).toContain("json: render(thing),");
|
|
142
|
+
expect(main.content).toContain('folderRef: "grafana-folder-services",');
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
test("an alertmanager.yml and a v2 dashboard name their expected owners (#3031)", () => {
|
|
146
|
+
const embedded = new EmbeddedImports([]);
|
|
147
|
+
new K8sParser().parse(
|
|
148
|
+
`
|
|
149
|
+
apiVersion: v1
|
|
150
|
+
kind: ConfigMap
|
|
151
|
+
metadata:
|
|
152
|
+
name: alertmanager
|
|
153
|
+
data:
|
|
154
|
+
alertmanager.yml: |
|
|
155
|
+
route:
|
|
156
|
+
receiver: team
|
|
157
|
+
receivers:
|
|
158
|
+
- name: team
|
|
159
|
+
---
|
|
160
|
+
apiVersion: v1
|
|
161
|
+
kind: ConfigMap
|
|
162
|
+
metadata:
|
|
163
|
+
name: dashboards-v2
|
|
164
|
+
data:
|
|
165
|
+
checkout.json: '{"apiVersion": "dashboard.grafana.app/v2beta1", "kind": "Dashboard", "spec": {"elements": {}, "layout": {}}}'
|
|
166
|
+
`,
|
|
167
|
+
{ embedded },
|
|
168
|
+
);
|
|
169
|
+
expect(embedded.offered.map((c) => c.expectedOwner)).toEqual([
|
|
170
|
+
{ lexicon: "prometheus", what: "an Alertmanager config" },
|
|
171
|
+
{ lexicon: "grafana", what: "a Grafana dashboard" },
|
|
172
|
+
]);
|
|
173
|
+
});
|
|
110
174
|
});
|
|
111
175
|
|
|
112
176
|
describe("the k8s generator's imports", () => {
|