From bf94e878ec30d368ad93094016370ff0542478f0 Mon Sep 17 00:00:00 2001 From: frezes Date: Mon, 6 May 2024 16:06:22 +0800 Subject: [PATCH] add crd-ref-docs and crd docs --- Makefile | 55 +- RELEASE.md | 12 +- docs/monitoring/api.md | 1756 ++++++++++++++++++++++++++++---------- tools/docgen/config.yaml | 12 + tools/docgen/docgen.go | 253 ------ 5 files changed, 1360 insertions(+), 728 deletions(-) create mode 100644 tools/docgen/config.yaml delete mode 100644 tools/docgen/docgen.go diff --git a/Makefile b/Makefile index be1fa0e3..0fc1f77f 100644 --- a/Makefile +++ b/Makefile @@ -75,23 +75,17 @@ all: build manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects. $(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases -# stripped-down-crds is a version of the whizard CRDs with all -# description fields being removed. It is meant as a workaround for the issue -# that `kubectl apply -f ...` might fail with the full version of the CRDs -# because of too long annotations field. -# See https://github.com/prometheus-operator/prometheus-operator/issues/4355 -stripped-down-crds: manifests - cd config/crd/bases && \ - for f in *.yaml; do \ - echo "---" > ../../../charts/whizard/crds/$$f; \ - gojsontoyaml -yamltojson < $$f | jq 'walk(if type == "object" then with_entries(if .value|type=="object" then . else select(.key | test("description") | not) end) else . end)' | gojsontoyaml >> ../../../charts/whizard/crds/$$f; \ - done && \ - cp -rf ../../../charts/whizard/crds ../../../charts/whizard-crds/; - - generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." +clientset: + ./hack/generate_client.sh $(GV) + +bundle: manifests kustomize + cd config/manager && $(KUSTOMIZE) edit set image controller=$(CONTROLLER_MANAGER_IMG) + cd config/default && $(KUSTOMIZE) edit set namespace kubesphere-monitoring-system + $(KUSTOMIZE) build config/default > config/bundle.yaml + fmt: ## Run go fmt against code. go fmt ./... @@ -159,6 +153,10 @@ KUSTOMIZE = $(shell pwd)/bin/kustomize kustomize: ## Download kustomize locally if necessary. $(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v3@v3.8.7) +CRD-REF-DOCS =$(shell pwd)/bin/crd-ref-docs +crd-ref-docs: ## Download crd-ref-docs locally if necessary. + $(call go-get-tool,$(CRD-REF-DOCS),github.com/elastic/crd-ref-docs@v0.0.12) + # go-get-tool will 'go get' any package $2 and install it to $1. PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST)))) define go-get-tool @@ -173,18 +171,27 @@ rm -rf $$TMP_DIR ;\ } endef -clientset: - ./hack/generate_client.sh $(GV) -bundle: manifests kustomize - cd config/manager && $(KUSTOMIZE) edit set image controller=$(CONTROLLER_MANAGER_IMG) - cd config/default && $(KUSTOMIZE) edit set namespace kubesphere-monitoring-system - $(KUSTOMIZE) build config/default > config/bundle.yaml +docgen: crd-ref-docs + $(CRD-REF-DOCS) \ + --source-path=./pkg/api/monitoring/v1alpha1 \ + --config=./tools/docgen/config.yaml \ + --output-path=./docs/monitoring/api.md \ + --renderer=markdown -MONITORING_TYPE_GOES=$(shell find pkg/api/monitoring -name *_types.go | tr '\n' ' ') -docs/monitoring/api.md: tools/docgen/docgen.go $(TYPE_GOES) - go run github.com/kubesphere/whizard/tools/docgen $(MONITORING_TYPE_GOES) > docs/monitoring/api.md +# stripped-down-crds is a version of the whizard CRDs with all +# description fields being removed. It is meant as a workaround for the issue +# that `kubectl apply -f ...` might fail with the full version of the CRDs +# because of too long annotations field. +# See https://github.com/prometheus-operator/prometheus-operator/issues/4355 +stripped-down-crds: manifests + cd config/crd/bases && \ + for f in *.yaml; do \ + echo "---" > ../../../charts/whizard/crds/$$f; \ + gojsontoyaml -yamltojson < $$f | jq 'walk(if type == "object" then with_entries(if .value|type=="object" then . else select(.key | test("description") | not) end) else . end)' | gojsontoyaml >> ../../../charts/whizard/crds/$$f; \ + done && \ + cp -rf ../../../charts/whizard/crds ../../../charts/whizard-crds/; -update-helm-appVersion: ## Update appVersion in helm chart. +cut-new-version: stripped-down-crds ## Update appVersion in helm chart. $(shell sed -i '' -e 's/appVersion:.*/appVersion: "'$(VERSION)'"/g' charts/whizard/Chart.yaml) \ No newline at end of file diff --git a/RELEASE.md b/RELEASE.md index 530ef0c0..e085c102 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -62,7 +62,7 @@ From now on, all work happens on the `release-.` branch. Bump the version in the `VERSION` file in the root of the repository. -Then `make update-helm-appVersion` to update the helm appVersion information. +Then `make cut-new-version` to update the helm appVersion information. Images will be automatically built and pushed whenever code changes or a tag is created. If users want to build images manually, use the following command: @@ -84,13 +84,13 @@ tag="$(< VERSION)" git tag -a "${tag}" -m "${tag}" git push origin "${tag}" ``` + Commit all the changes. Finally, create a new release: -- Go to https://github.com/WhizardTelemetry/whizard/releases/new. -- Associate the new release with the previously pushed tag. -- Add release notes based on `CHANGELOG.md`. - +* Go to https://github.com/WhizardTelemetry/whizard/releases/new. +* Associate the new release with the previously pushed tag. +* Add release notes based on `CHANGELOG.md`. -For patch releases, cherry-pick the commits from the release branch into the master branch. \ No newline at end of file +For patch releases, cherry-pick the commits from the release branch into the master branch. diff --git a/docs/monitoring/api.md b/docs/monitoring/api.md index e876f571..679f815b 100644 --- a/docs/monitoring/api.md +++ b/docs/monitoring/api.md @@ -1,629 +1,1495 @@ +# API Reference + +## Packages +- [monitoring.whizard.io/v1alpha1](#monitoringwhizardiov1alpha1) + + +## monitoring.whizard.io/v1alpha1 + +Package v1alpha1 contains API Schema definitions for the monitoring v1alpha1 API group + +Package v1alpha1 contains API Schema definitions for the monitoring v1alpha1 API group + +### Resource Types +- [Compactor](#compactor) +- [Gateway](#gateway) +- [Ingester](#ingester) +- [Query](#query) +- [QueryFrontend](#queryfrontend) +- [Router](#router) +- [Ruler](#ruler) +- [Service](#service) +- [Storage](#storage) +- [Store](#store) +- [Tenant](#tenant) + + + +#### AutoScaler + + + + + + + +_Appears in:_ +- [StoreSpec](#storespec) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `minReplicas` _integer_ | minReplicas is the lower limit for the number of replicas to which the autoscaler
can scale down. It defaults to 1 pod. minReplicas is allowed to be 0 if the
alpha feature gate HPAScaleToZero is enabled and at least one Object or External
metric is configured. Scaling is active as long as at least one metric value is
available. | | | +| `maxReplicas` _integer_ | maxReplicas is the upper limit for the number of replicas to which the autoscaler can scale up.
It cannot be less that minReplicas. | | | +| `metrics` _[MetricSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#metricspec-v2beta2-autoscaling) array_ | metrics contains the specifications for which to use to calculate the
desired replica count (the maximum replica count across all metrics will
be used). The desired replica count is calculated multiplying the
ratio between the target value and the current value by the current
number of pods. Ergo, metrics used must decrease as the pod count is
increased, and vice-versa. See the individual metric source types for
more information about how each type of metric must respond.
If not set, the default metric will be set to 80% average CPU utilization. | | | +| `behavior` _[HorizontalPodAutoscalerBehavior](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#horizontalpodautoscalerbehavior-v2beta2-autoscaling)_ | behavior configures the scaling behavior of the target
in both Up and Down directions (scaleUp and scaleDown fields respectively).
If not set, the default HPAScalingRules for scale up and scale down are used. | | | + + +#### BasicAuth + + + +BasicAuth allow an endpoint to authenticate over basic authentication + + + +_Appears in:_ +- [HTTPClientConfig](#httpclientconfig) +- [RemoteQuerySpec](#remotequeryspec) +- [RemoteWriteSpec](#remotewritespec) +- [WebConfig](#webconfig) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `username` _[SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#secretkeyselector-v1-core)_ | The secret in the service monitor namespace that contains the username
for authentication. | | | +| `password` _[SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#secretkeyselector-v1-core)_ | The secret in the service monitor namespace that contains the password
for authentication. | | | + + +#### BlockGC + + + + + + + +_Appears in:_ +- [BlockManager](#blockmanager) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `enable` _boolean_ | | | | +| `resources` _[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#resourcerequirements-v1-core)_ | Define resources requests and limits for main container. | | | +| `image` _string_ | Image is the component image with tag/version. | | | +| `imagePullPolicy` _[PullPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#pullpolicy-v1-core)_ | Image pull policy.
One of Always, Never, IfNotPresent.
Defaults to Always if :latest tag is specified, or IfNotPresent otherwise.
Cannot be updated. | | | +| `gcInterval` _[Duration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#duration-v1-meta)_ | | | Pattern: `^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$`
| +| `cleanupTimeout` _[Duration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#duration-v1-meta)_ | | | Pattern: `^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$`
| +| `defaultTenantId` _string_ | Default tenant ID to use when none is provided via a header. | | | +| `tenantLabelName` _string_ | Label name through which the tenant will be announced. | | | + + +#### BlockManager + + + + + + + +_Appears in:_ +- [StorageSpec](#storagespec) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `enable` _boolean_ | | | | +| `containers` _[RawExtension](#rawextension)_ | Containers allows injecting additional containers or modifying operator generated containers.
Containers described here modify an operator generated
container if they share the same name and modifications are done via a
strategic merge patch. | | | +| `podMetadata` _[EmbeddedObjectMetadata](#embeddedobjectmetadata)_ | PodMetadata configures labels and annotations which are propagated to the pods.

* "kubectl.kubernetes.io/default-container" annotation, set to main pod. | | | +| `secrets` _string array_ | Secrets is a list of Secrets in the same namespace as the component
object, which shall be mounted into the Prometheus Pods.
Each Secret is added to the StatefulSet/Deployment definition as a volume named `secret-`.
The Secrets are mounted into /etc/whizard/secrets/ in the default container. | | | +| `configMaps` _string array_ | ConfigMaps is a list of ConfigMaps in the same namespace as the component
object, which shall be mounted into the default Pods.
Each ConfigMap is added to the StatefulSet/Deployment definition as a volume named `configmap-`.
The ConfigMaps are mounted into /etc/whizard/configmaps/ in the default container. | | | +| `affinity` _[Affinity](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#affinity-v1-core)_ | If specified, the pod's scheduling constraints. | | | +| `nodeSelector` _object (keys:string, values:string)_ | Define which Nodes the Pods are scheduled on. | | | +| `tolerations` _[Toleration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#toleration-v1-core) array_ | If specified, the pod's tolerations. | | | +| `resources` _[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#resourcerequirements-v1-core)_ | Define resources requests and limits for main container. | | | +| `securityContext` _[PodSecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#podsecuritycontext-v1-core)_ | SecurityContext holds pod-level security attributes and common container settings.
This defaults to the default PodSecurityContext. | | | +| `replicas` _integer_ | Number of replicas for a component. | | | +| `image` _string_ | Image is the component image with tag/version. | | | +| `imagePullPolicy` _[PullPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#pullpolicy-v1-core)_ | Image pull policy.
One of Always, Never, IfNotPresent.
Defaults to Always if :latest tag is specified, or IfNotPresent otherwise.
Cannot be updated. | | | +| `imagePullSecrets` _[LocalObjectReference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#localobjectreference-v1-core) array_ | An optional list of references to secrets in the same namespace
to use for pulling images from registries | | | +| `logLevel` _string_ | Log filtering level. Possible options: error, warn, info, debug. | | | +| `logFormat` _string_ | Log format to use. Possible options: logfmt or json. | | | +| `flags` _string array_ | Flags is the flags of component. | | | +| `serviceAccountName` _string_ | ServiceAccountName is the name of the ServiceAccount to use to run bucket Pods. | | | +| `nodePort` _integer_ | NodePort is the port used to expose the bucket service.
If this is a valid node port, the gateway service type will be set to NodePort accordingly. | | | +| `blockSyncInterval` _[Duration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#duration-v1-meta)_ | Interval to sync block metadata from object storage | | Pattern: `^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$`
| +| `gc` _[BlockGC](#blockgc)_ | | | | + + +#### CacheProvider + +_Underlying type:_ _string_ + + + + + +_Appears in:_ +- [ResponseCacheProviderConfig](#responsecacheproviderconfig) + + + +#### CommonSpec + + + + + + + +_Appears in:_ +- [BlockManager](#blockmanager) +- [CompactorSpec](#compactorspec) +- [CompactorTemplateSpec](#compactortemplatespec) +- [GatewaySpec](#gatewayspec) +- [IngesterSpec](#ingesterspec) +- [IngesterTemplateSpec](#ingestertemplatespec) +- [QueryFrontendSpec](#queryfrontendspec) +- [QuerySpec](#queryspec) +- [RouterSpec](#routerspec) +- [RulerSpec](#rulerspec) +- [RulerTemplateSpec](#rulertemplatespec) +- [StoreSpec](#storespec) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `containers` _[RawExtension](#rawextension)_ | Containers allows injecting additional containers or modifying operator generated containers.
Containers described here modify an operator generated
container if they share the same name and modifications are done via a
strategic merge patch. | | | +| `podMetadata` _[EmbeddedObjectMetadata](#embeddedobjectmetadata)_ | PodMetadata configures labels and annotations which are propagated to the pods.

* "kubectl.kubernetes.io/default-container" annotation, set to main pod. | | | +| `secrets` _string array_ | Secrets is a list of Secrets in the same namespace as the component
object, which shall be mounted into the Prometheus Pods.
Each Secret is added to the StatefulSet/Deployment definition as a volume named `secret-`.
The Secrets are mounted into /etc/whizard/secrets/ in the default container. | | | +| `configMaps` _string array_ | ConfigMaps is a list of ConfigMaps in the same namespace as the component
object, which shall be mounted into the default Pods.
Each ConfigMap is added to the StatefulSet/Deployment definition as a volume named `configmap-`.
The ConfigMaps are mounted into /etc/whizard/configmaps/ in the default container. | | | +| `affinity` _[Affinity](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#affinity-v1-core)_ | If specified, the pod's scheduling constraints. | | | +| `nodeSelector` _object (keys:string, values:string)_ | Define which Nodes the Pods are scheduled on. | | | +| `tolerations` _[Toleration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#toleration-v1-core) array_ | If specified, the pod's tolerations. | | | +| `resources` _[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#resourcerequirements-v1-core)_ | Define resources requests and limits for main container. | | | +| `securityContext` _[PodSecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#podsecuritycontext-v1-core)_ | SecurityContext holds pod-level security attributes and common container settings.
This defaults to the default PodSecurityContext. | | | +| `replicas` _integer_ | Number of replicas for a component. | | | +| `image` _string_ | Image is the component image with tag/version. | | | +| `imagePullPolicy` _[PullPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#pullpolicy-v1-core)_ | Image pull policy.
One of Always, Never, IfNotPresent.
Defaults to Always if :latest tag is specified, or IfNotPresent otherwise.
Cannot be updated. | | | +| `imagePullSecrets` _[LocalObjectReference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#localobjectreference-v1-core) array_ | An optional list of references to secrets in the same namespace
to use for pulling images from registries | | | +| `logLevel` _string_ | Log filtering level. Possible options: error, warn, info, debug. | | | +| `logFormat` _string_ | Log format to use. Possible options: logfmt or json. | | | +| `flags` _string array_ | Flags is the flags of component. | | | + + +#### Compactor -# API Docs - -This Document documents the types introduced by the whizard to be consumed by users. - -> Note this document is generated from code comments. When contributing a change to this document please do so by changing the code comments. - -## Table of Contents -* [AutoScaler](#autoscaler) -* [Compactor](#compactor) -* [CompactorList](#compactorlist) -* [CompactorSpec](#compactorspec) -* [EnvoySpec](#envoyspec) -* [Gateway](#gateway) -* [InMemoryIndexCacheConfig](#inmemoryindexcacheconfig) -* [InMemoryResponseCacheConfig](#inmemoryresponsecacheconfig) -* [IndexCacheConfig](#indexcacheconfig) -* [Ingester](#ingester) -* [IngesterList](#ingesterlist) -* [IngesterSpec](#ingesterspec) -* [KubernetesVolume](#kubernetesvolume) -* [ObjectReference](#objectreference) -* [Query](#query) -* [QueryFrontend](#queryfrontend) -* [QueryStores](#querystores) -* [ResponseCacheProviderConfig](#responsecacheproviderconfig) -* [Retention](#retention) -* [Router](#router) -* [Ruler](#ruler) -* [RulerList](#rulerlist) -* [RulerSpec](#rulerspec) -* [Service](#service) -* [ServiceList](#servicelist) -* [ServiceSpec](#servicespec) -* [Store](#store) -* [StoreList](#storelist) -* [StoreSpec](#storespec) -* [S3](#s3) -* [S3HTTPConfig](#s3httpconfig) -* [S3SSEConfig](#s3sseconfig) -* [S3TraceConfig](#s3traceconfig) -* [Storage](#storage) -* [StorageList](#storagelist) -* [StorageSpec](#storagespec) -* [TLSConfig](#tlsconfig) -* [Tenant](#tenant) -* [TenantList](#tenantlist) -* [TenantSpec](#tenantspec) -* [TenantStatus](#tenantstatus) - -## AutoScaler - - - -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| minReplicas | minReplicas is the lower limit for the number of replicas to which the autoscaler can scale down. It defaults to 1 pod. minReplicas is allowed to be 0 if the alpha feature gate HPAScaleToZero is enabled and at least one Object or External metric is configured. Scaling is active as long as at least one metric value is available. | *int32 | false | -| maxReplicas | maxReplicas is the upper limit for the number of replicas to which the autoscaler can scale up. It cannot be less that minReplicas. | int32 | true | -| metrics | metrics contains the specifications for which to use to calculate the desired replica count (the maximum replica count across all metrics will be used). The desired replica count is calculated multiplying the ratio between the target value and the current value by the current number of pods. Ergo, metrics used must decrease as the pod count is increased, and vice-versa. See the individual metric source types for more information about how each type of metric must respond. If not set, the default metric will be set to 80% average CPU utilization. | []v2beta2.MetricSpec | false | -| behavior | behavior configures the scaling behavior of the target in both Up and Down directions (scaleUp and scaleDown fields respectively). If not set, the default HPAScalingRules for scale up and scale down are used. | *v2beta2.HorizontalPodAutoscalerBehavior | false | - -[Back to TOC](#table-of-contents) - -## Compactor Compactor is the Schema for the Compactor API -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| metadata | | [metav1.ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#objectmeta-v1-meta) | false | -| spec | | [CompactorSpec](#compactorspec) | false | -| status | | [CompactorStatus](#compactorstatus) | false | -[Back to TOC](#table-of-contents) -## CompactorList -CompactorList contains a list of Compactor -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| metadata | | [metav1.ListMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#listmeta-v1-meta) | false | -| items | | [][Compactor](#compactor) | true | +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `apiVersion` _string_ | `monitoring.whizard.io/v1alpha1` | | | +| `kind` _string_ | `Compactor` | | | +| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | | +| `spec` _[CompactorSpec](#compactorspec)_ | | | | +| `status` _[CompactorStatus](#compactorstatus)_ | | | | + + +#### CompactorSpec + + + + + + + +_Appears in:_ +- [Compactor](#compactor) +- [CompactorTemplateSpec](#compactortemplatespec) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `containers` _[RawExtension](#rawextension)_ | Containers allows injecting additional containers or modifying operator generated containers.
Containers described here modify an operator generated
container if they share the same name and modifications are done via a
strategic merge patch. | | | +| `podMetadata` _[EmbeddedObjectMetadata](#embeddedobjectmetadata)_ | PodMetadata configures labels and annotations which are propagated to the pods.

* "kubectl.kubernetes.io/default-container" annotation, set to main pod. | | | +| `secrets` _string array_ | Secrets is a list of Secrets in the same namespace as the component
object, which shall be mounted into the Prometheus Pods.
Each Secret is added to the StatefulSet/Deployment definition as a volume named `secret-`.
The Secrets are mounted into /etc/whizard/secrets/ in the default container. | | | +| `configMaps` _string array_ | ConfigMaps is a list of ConfigMaps in the same namespace as the component
object, which shall be mounted into the default Pods.
Each ConfigMap is added to the StatefulSet/Deployment definition as a volume named `configmap-`.
The ConfigMaps are mounted into /etc/whizard/configmaps/ in the default container. | | | +| `affinity` _[Affinity](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#affinity-v1-core)_ | If specified, the pod's scheduling constraints. | | | +| `nodeSelector` _object (keys:string, values:string)_ | Define which Nodes the Pods are scheduled on. | | | +| `tolerations` _[Toleration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#toleration-v1-core) array_ | If specified, the pod's tolerations. | | | +| `resources` _[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#resourcerequirements-v1-core)_ | Define resources requests and limits for main container. | | | +| `securityContext` _[PodSecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#podsecuritycontext-v1-core)_ | SecurityContext holds pod-level security attributes and common container settings.
This defaults to the default PodSecurityContext. | | | +| `replicas` _integer_ | Number of replicas for a component. | | | +| `image` _string_ | Image is the component image with tag/version. | | | +| `imagePullPolicy` _[PullPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#pullpolicy-v1-core)_ | Image pull policy.
One of Always, Never, IfNotPresent.
Defaults to Always if :latest tag is specified, or IfNotPresent otherwise.
Cannot be updated. | | | +| `imagePullSecrets` _[LocalObjectReference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#localobjectreference-v1-core) array_ | An optional list of references to secrets in the same namespace
to use for pulling images from registries | | | +| `logLevel` _string_ | Log filtering level. Possible options: error, warn, info, debug. | | | +| `logFormat` _string_ | Log format to use. Possible options: logfmt or json. | | | +| `flags` _string array_ | Flags is the flags of component. | | | +| `disableDownsampling` _boolean_ | DisableDownsampling specifies whether to disable downsampling | | | +| `retention` _[Retention](#retention)_ | Retention configs how long to retain samples | | | +| `dataVolume` _[KubernetesVolume](#kubernetesvolume)_ | DataVolume specifies how volume shall be used | | | +| `tenants` _string array_ | Tenants if not empty indicates current config is for hard tenants; otherwise, it is for soft tenants. | | | + + +#### CompactorStatus + + + +CompactorStatus defines the observed state of Compactor + + + +_Appears in:_ +- [Compactor](#compactor) + + + +#### CompactorTemplateSpec + + + + + + + +_Appears in:_ +- [ServiceSpec](#servicespec) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `containers` _[RawExtension](#rawextension)_ | Containers allows injecting additional containers or modifying operator generated containers.
Containers described here modify an operator generated
container if they share the same name and modifications are done via a
strategic merge patch. | | | +| `podMetadata` _[EmbeddedObjectMetadata](#embeddedobjectmetadata)_ | PodMetadata configures labels and annotations which are propagated to the pods.

* "kubectl.kubernetes.io/default-container" annotation, set to main pod. | | | +| `secrets` _string array_ | Secrets is a list of Secrets in the same namespace as the component
object, which shall be mounted into the Prometheus Pods.
Each Secret is added to the StatefulSet/Deployment definition as a volume named `secret-`.
The Secrets are mounted into /etc/whizard/secrets/ in the default container. | | | +| `configMaps` _string array_ | ConfigMaps is a list of ConfigMaps in the same namespace as the component
object, which shall be mounted into the default Pods.
Each ConfigMap is added to the StatefulSet/Deployment definition as a volume named `configmap-`.
The ConfigMaps are mounted into /etc/whizard/configmaps/ in the default container. | | | +| `affinity` _[Affinity](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#affinity-v1-core)_ | If specified, the pod's scheduling constraints. | | | +| `nodeSelector` _object (keys:string, values:string)_ | Define which Nodes the Pods are scheduled on. | | | +| `tolerations` _[Toleration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#toleration-v1-core) array_ | If specified, the pod's tolerations. | | | +| `resources` _[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#resourcerequirements-v1-core)_ | Define resources requests and limits for main container. | | | +| `securityContext` _[PodSecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#podsecuritycontext-v1-core)_ | SecurityContext holds pod-level security attributes and common container settings.
This defaults to the default PodSecurityContext. | | | +| `replicas` _integer_ | Number of replicas for a component. | | | +| `image` _string_ | Image is the component image with tag/version. | | | +| `imagePullPolicy` _[PullPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#pullpolicy-v1-core)_ | Image pull policy.
One of Always, Never, IfNotPresent.
Defaults to Always if :latest tag is specified, or IfNotPresent otherwise.
Cannot be updated. | | | +| `imagePullSecrets` _[LocalObjectReference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#localobjectreference-v1-core) array_ | An optional list of references to secrets in the same namespace
to use for pulling images from registries | | | +| `logLevel` _string_ | Log filtering level. Possible options: error, warn, info, debug. | | | +| `logFormat` _string_ | Log format to use. Possible options: logfmt or json. | | | +| `flags` _string array_ | Flags is the flags of component. | | | +| `disableDownsampling` _boolean_ | DisableDownsampling specifies whether to disable downsampling | | | +| `retention` _[Retention](#retention)_ | Retention configs how long to retain samples | | | +| `dataVolume` _[KubernetesVolume](#kubernetesvolume)_ | DataVolume specifies how volume shall be used | | | +| `tenants` _string array_ | Tenants if not empty indicates current config is for hard tenants; otherwise, it is for soft tenants. | | | +| `defaultTenantsPerCompactor` _integer_ | DefaultTenantsPerIngester Whizard default tenant count per ingester.
Default: 10 | 10 | | + + +#### Duration + +_Underlying type:_ _string_ + +Duration is a valid time unit +Supported units: y, w, d, h, m, s, ms Examples: `30s`, `1m`, `1h20m15s` + +_Validation:_ +- Pattern: `^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$` + +_Appears in:_ +- [IngesterTemplateSpec](#ingestertemplatespec) +- [RemoteWriteSpec](#remotewritespec) +- [Retention](#retention) +- [RulerSpec](#rulerspec) +- [RulerTemplateSpec](#rulertemplatespec) + + + +#### EmbeddedObjectMetadata + + + +EmbeddedObjectMetadata contains a subset of the fields included in k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta +Only fields which are relevant to embedded resources are included. + + + +_Appears in:_ +- [BlockManager](#blockmanager) +- [CommonSpec](#commonspec) +- [CompactorSpec](#compactorspec) +- [CompactorTemplateSpec](#compactortemplatespec) +- [GatewaySpec](#gatewayspec) +- [IngesterSpec](#ingesterspec) +- [IngesterTemplateSpec](#ingestertemplatespec) +- [QueryFrontendSpec](#queryfrontendspec) +- [QuerySpec](#queryspec) +- [RouterSpec](#routerspec) +- [RulerSpec](#rulerspec) +- [RulerTemplateSpec](#rulertemplatespec) +- [StoreSpec](#storespec) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `name` _string_ | Name must be unique within a namespace. Is required when creating resources, although
some resources may allow a client to request the generation of an appropriate name
automatically. Name is primarily intended for creation idempotence and configuration
definition.
Cannot be updated.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names | | | +| `labels` _object (keys:string, values:string)_ | Map of string keys and values that can be used to organize and categorize
(scope and select) objects. May match selectors of replication controllers
and services.
More info: http://kubernetes.io/docs/user-guide/labels | | | +| `annotations` _object (keys:string, values:string)_ | Annotations is an unstructured key value map stored with a resource that may be
set by external tools to store and retrieve arbitrary metadata. They are not
queryable and should be preserved when modifying objects.
More info: http://kubernetes.io/docs/user-guide/annotations | | | + + +#### Gateway + + + +Gateway is the Schema for the monitoring gateway API + + -[Back to TOC](#table-of-contents) -## CompactorSpec +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `apiVersion` _string_ | `monitoring.whizard.io/v1alpha1` | | | +| `kind` _string_ | `Gateway` | | | +| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | | +| `spec` _[GatewaySpec](#gatewayspec)_ | | | | +| `status` _[GatewayStatus](#gatewaystatus)_ | | | | -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| affinity | If specified, the pod's scheduling constraints. | *corev1.Affinity | false | -| nodeSelector | Define which Nodes the Pods are scheduled on. | map[string]string | false | -| tolerations | If specified, the pod's tolerations. | []corev1.Toleration | false | -| resources | Define resources requests and limits for main container. | [corev1.ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#resourcerequirements-v1-core) | false | -| replicas | Number of replicas for a component | *int32 | false | -| image | Image is the image with tag/version | string | false | -| imagePullPolicy | Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated. | [corev1.PullPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#container-v1-core) | false | -| logLevel | Log filtering level. Possible options: error, warn, info, debug | string | false | -| logFormat | Log format to use. Possible options: logfmt or json | string | false | -| downsamplingDisable | DownsamplingDisable specifies whether to disable downsampling | *bool | false | -| retention | Retention configs how long to retain samples | *[Retention](#retention) | false | -| storage | | *[ObjectReference](#objectreference) | false | -| flags | Flags is the flags of compactor. | []string | false | -| dataVolume | DataVolume specifies how volume shall be used | *[KubernetesVolume](#kubernetesvolume) | false | -| tenants | Tenants if not empty indicates current config is for hard tenants; otherwise, it is for soft tenants. | []string | false | +#### GatewaySpec -[Back to TOC](#table-of-contents) -## EnvoySpec -EnvoySpec defines the desired state of envoy proxy sidecar which delegates requests to the secure stores -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| image | Image is the envoy image with tag/version | string | false | -| resources | Define resources requests and limits for envoy container. | [corev1.ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#resourcerequirements-v1-core) | false | -[Back to TOC](#table-of-contents) -## Gateway +_Appears in:_ +- [Gateway](#gateway) +- [ServiceSpec](#servicespec) +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `containers` _[RawExtension](#rawextension)_ | Containers allows injecting additional containers or modifying operator generated containers.
Containers described here modify an operator generated
container if they share the same name and modifications are done via a
strategic merge patch. | | | +| `podMetadata` _[EmbeddedObjectMetadata](#embeddedobjectmetadata)_ | PodMetadata configures labels and annotations which are propagated to the pods.

* "kubectl.kubernetes.io/default-container" annotation, set to main pod. | | | +| `secrets` _string array_ | Secrets is a list of Secrets in the same namespace as the component
object, which shall be mounted into the Prometheus Pods.
Each Secret is added to the StatefulSet/Deployment definition as a volume named `secret-`.
The Secrets are mounted into /etc/whizard/secrets/ in the default container. | | | +| `configMaps` _string array_ | ConfigMaps is a list of ConfigMaps in the same namespace as the component
object, which shall be mounted into the default Pods.
Each ConfigMap is added to the StatefulSet/Deployment definition as a volume named `configmap-`.
The ConfigMaps are mounted into /etc/whizard/configmaps/ in the default container. | | | +| `affinity` _[Affinity](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#affinity-v1-core)_ | If specified, the pod's scheduling constraints. | | | +| `nodeSelector` _object (keys:string, values:string)_ | Define which Nodes the Pods are scheduled on. | | | +| `tolerations` _[Toleration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#toleration-v1-core) array_ | If specified, the pod's tolerations. | | | +| `resources` _[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#resourcerequirements-v1-core)_ | Define resources requests and limits for main container. | | | +| `securityContext` _[PodSecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#podsecuritycontext-v1-core)_ | SecurityContext holds pod-level security attributes and common container settings.
This defaults to the default PodSecurityContext. | | | +| `replicas` _integer_ | Number of replicas for a component. | | | +| `image` _string_ | Image is the component image with tag/version. | | | +| `imagePullPolicy` _[PullPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#pullpolicy-v1-core)_ | Image pull policy.
One of Always, Never, IfNotPresent.
Defaults to Always if :latest tag is specified, or IfNotPresent otherwise.
Cannot be updated. | | | +| `imagePullSecrets` _[LocalObjectReference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#localobjectreference-v1-core) array_ | An optional list of references to secrets in the same namespace
to use for pulling images from registries | | | +| `logLevel` _string_ | Log filtering level. Possible options: error, warn, info, debug. | | | +| `logFormat` _string_ | Log format to use. Possible options: logfmt or json. | | | +| `flags` _string array_ | Flags is the flags of component. | | | +| `webConfig` _[WebConfig](#webconfig)_ | | | | +| `debug` _boolean_ | If debug mode is on, gateway will proxy Query UI | | | +| `enabledTenantsAdmission` _boolean_ | Deny unknown tenant data remote-write and query if enabled | | | +| `nodePort` _integer_ | NodePort is the port used to expose the gateway service.
If this is a valid node port, the gateway service type will be set to NodePort accordingly. | | | -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| affinity | If specified, the pod's scheduling constraints. | *corev1.Affinity | false | -| nodeSelector | Define which Nodes the Pods are scheduled on. | map[string]string | false | -| tolerations | If specified, the pod's tolerations. | []corev1.Toleration | false | -| resources | Define resources requests and limits for main container. | [corev1.ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#resourcerequirements-v1-core) | false | -| replicas | Number of replicas for a component | *int32 | false | -| image | Image is the gateway image with tag/version. | string | false | -| logLevel | Log filtering level. Possible options: error, warn, info, debug. | string | false | -| logFormat | Log format to use. Possible options: logfmt or json. | string | false | -| serverCertificate | Secret name for HTTP Server certificate (Kubernetes TLS secret type) | string | false | -| clientCaCertificate | Secret name for HTTP Client CA certificate (Kubernetes TLS secret type) | string | false | -[Back to TOC](#table-of-contents) +#### GatewayStatus -## InMemoryIndexCacheConfig +GatewayStatus defines the observed state of Gateway -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| maxSize | MaxSize represents overall maximum number of bytes cache can contain. | string | true | -[Back to TOC](#table-of-contents) -## InMemoryResponseCacheConfig +_Appears in:_ +- [Gateway](#gateway) + + + +#### HTTPClientConfig + + + +HTTPClientConfig configures an HTTP client. + + + +_Appears in:_ +- [RemoteQuerySpec](#remotequeryspec) +- [RemoteWriteSpec](#remotewritespec) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `basicAuth` _[BasicAuth](#basicauth)_ | The HTTP basic authentication credentials for the targets. | | | +| `bearerToken` _string_ | The bearer token for the targets. | | | + + +#### HTTPServerConfig + + + + + + + +_Appears in:_ +- [WebConfig](#webconfig) + + + +#### HTTPServerTLSConfig + + + + + + + +_Appears in:_ +- [WebConfig](#webconfig) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `keySecret` _[SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#secretkeyselector-v1-core)_ | Secret containing the TLS key for the server. | | | +| `certSecret` _[SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#secretkeyselector-v1-core)_ | Contains the TLS certificate for the server. | | | +| `clientCASecret` _[SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#secretkeyselector-v1-core)_ | Contains the CA certificate for client certificate authentication to the server. | | | + + +#### InMemoryIndexCacheConfig + + + + + + + +_Appears in:_ +- [IndexCacheConfig](#indexcacheconfig) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `maxSize` _string_ | MaxSize represents overall maximum number of bytes cache can contain. | | | + + +#### InMemoryResponseCacheConfig + + InMemoryResponseCacheConfig holds the configs for the in-memory cache provider. -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| maxSize | MaxSize represents overall maximum number of bytes cache can contain. | string | true | -| maxSizeItems | MaxSizeItems represents the maximum number of entries in the cache. | int | true | -| validity | Validity represents the expiry duration for the cache. | time.Duration | true | -[Back to TOC](#table-of-contents) -## IndexCacheConfig +_Appears in:_ +- [ResponseCacheProviderConfig](#responsecacheproviderconfig) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `maxSize` _string_ | MaxSize represents overall maximum number of bytes cache can contain. | | | +| `maxSizeItems` _integer_ | MaxSizeItems represents the maximum number of entries in the cache. | | | +| `validity` _[Duration](#duration)_ | Validity represents the expiry duration for the cache. | | Pattern: `^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$`
| + + +#### IndexCacheConfig + + IndexCacheConfig specifies the index cache config. -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| inMemory | | *[InMemoryIndexCacheConfig](#inmemoryindexcacheconfig) | false | -[Back to TOC](#table-of-contents) -## Ingester +_Appears in:_ +- [StoreSpec](#storespec) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `inMemory` _[InMemoryIndexCacheConfig](#inmemoryindexcacheconfig)_ | | | | + + +#### Ingester + + Ingester is the Schema for the Ingester API -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| metadata | | [metav1.ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#objectmeta-v1-meta) | false | -| spec | | [IngesterSpec](#ingesterspec) | false | -| status | | [IngesterStatus](#ingesterstatus) | false | -[Back to TOC](#table-of-contents) -## IngesterList -IngesterList contains a list of Ingester -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| metadata | | [metav1.ListMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#listmeta-v1-meta) | false | -| items | | [][Ingester](#ingester) | true | +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `apiVersion` _string_ | `monitoring.whizard.io/v1alpha1` | | | +| `kind` _string_ | `Ingester` | | | +| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | | +| `spec` _[IngesterSpec](#ingesterspec)_ | | | | +| `status` _[IngesterStatus](#ingesterstatus)_ | | | | + + +#### IngesterSpec -[Back to TOC](#table-of-contents) -## IngesterSpec IngesterSpec defines the desired state of a Ingester -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| tenants | Tenants if not empty indicates current config is for hard tenants; otherwise, it is for soft tenants. | []string | false | -| affinity | If specified, the pod's scheduling constraints. | *corev1.Affinity | false | -| nodeSelector | Define which Nodes the Pods are scheduled on. | map[string]string | false | -| tolerations | If specified, the pod's tolerations. | []corev1.Toleration | false | -| resources | Define resources requests and limits for main container. | [corev1.ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#resourcerequirements-v1-core) | false | -| replicas | Number of replicas for a component. | *int32 | false | -| image | Image is the image with tag/version | string | false | -| logLevel | Log filtering level. Possible options: error, warn, info, debug | string | false | -| logFormat | Log format to use. Possible options: logfmt or json | string | false | -| localTsdbRetention | LocalTsdbRetention configs how long to retain raw samples on local storage. | string | false | -| flags | Flags is the flags of ingester. | []string | false | -| storage | If specified, the object key of Storage for long term storage. | *[ObjectReference](#objectreference) | false | -| dataVolume | DataVolume specifies how volume shall be used | *[KubernetesVolume](#kubernetesvolume) | false | - -[Back to TOC](#table-of-contents) - -## KubernetesVolume + + +_Appears in:_ +- [Ingester](#ingester) +- [IngesterTemplateSpec](#ingestertemplatespec) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `containers` _[RawExtension](#rawextension)_ | Containers allows injecting additional containers or modifying operator generated containers.
Containers described here modify an operator generated
container if they share the same name and modifications are done via a
strategic merge patch. | | | +| `podMetadata` _[EmbeddedObjectMetadata](#embeddedobjectmetadata)_ | PodMetadata configures labels and annotations which are propagated to the pods.

* "kubectl.kubernetes.io/default-container" annotation, set to main pod. | | | +| `secrets` _string array_ | Secrets is a list of Secrets in the same namespace as the component
object, which shall be mounted into the Prometheus Pods.
Each Secret is added to the StatefulSet/Deployment definition as a volume named `secret-`.
The Secrets are mounted into /etc/whizard/secrets/ in the default container. | | | +| `configMaps` _string array_ | ConfigMaps is a list of ConfigMaps in the same namespace as the component
object, which shall be mounted into the default Pods.
Each ConfigMap is added to the StatefulSet/Deployment definition as a volume named `configmap-`.
The ConfigMaps are mounted into /etc/whizard/configmaps/ in the default container. | | | +| `affinity` _[Affinity](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#affinity-v1-core)_ | If specified, the pod's scheduling constraints. | | | +| `nodeSelector` _object (keys:string, values:string)_ | Define which Nodes the Pods are scheduled on. | | | +| `tolerations` _[Toleration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#toleration-v1-core) array_ | If specified, the pod's tolerations. | | | +| `resources` _[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#resourcerequirements-v1-core)_ | Define resources requests and limits for main container. | | | +| `securityContext` _[PodSecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#podsecuritycontext-v1-core)_ | SecurityContext holds pod-level security attributes and common container settings.
This defaults to the default PodSecurityContext. | | | +| `replicas` _integer_ | Number of replicas for a component. | | | +| `image` _string_ | Image is the component image with tag/version. | | | +| `imagePullPolicy` _[PullPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#pullpolicy-v1-core)_ | Image pull policy.
One of Always, Never, IfNotPresent.
Defaults to Always if :latest tag is specified, or IfNotPresent otherwise.
Cannot be updated. | | | +| `imagePullSecrets` _[LocalObjectReference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#localobjectreference-v1-core) array_ | An optional list of references to secrets in the same namespace
to use for pulling images from registries | | | +| `logLevel` _string_ | Log filtering level. Possible options: error, warn, info, debug. | | | +| `logFormat` _string_ | Log format to use. Possible options: logfmt or json. | | | +| `flags` _string array_ | Flags is the flags of component. | | | +| `ingesterTsdbCleanup` _[SidecarSpec](#sidecarspec)_ | | | | +| `tenants` _string array_ | Tenants if not empty indicates current config is for hard tenants; otherwise, it is for soft tenants. | | | +| `localTsdbRetention` _string_ | LocalTsdbRetention configs how long to retain raw samples on local storage. | | | +| `dataVolume` _[KubernetesVolume](#kubernetesvolume)_ | DataVolume specifies how volume shall be used | | | + + +#### IngesterStatus + + + +IngesterStatus defines the observed state of Ingester + + + +_Appears in:_ +- [Ingester](#ingester) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `tenants` _[IngesterTenantStatus](#ingestertenantstatus) array_ | Tenants contain all tenants that have been configured for this Ingester object,
except those Tenant objects that have been deleted. | | | + + +#### IngesterTemplateSpec + + + + + + + +_Appears in:_ +- [ServiceSpec](#servicespec) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `containers` _[RawExtension](#rawextension)_ | Containers allows injecting additional containers or modifying operator generated containers.
Containers described here modify an operator generated
container if they share the same name and modifications are done via a
strategic merge patch. | | | +| `podMetadata` _[EmbeddedObjectMetadata](#embeddedobjectmetadata)_ | PodMetadata configures labels and annotations which are propagated to the pods.

* "kubectl.kubernetes.io/default-container" annotation, set to main pod. | | | +| `secrets` _string array_ | Secrets is a list of Secrets in the same namespace as the component
object, which shall be mounted into the Prometheus Pods.
Each Secret is added to the StatefulSet/Deployment definition as a volume named `secret-`.
The Secrets are mounted into /etc/whizard/secrets/ in the default container. | | | +| `configMaps` _string array_ | ConfigMaps is a list of ConfigMaps in the same namespace as the component
object, which shall be mounted into the default Pods.
Each ConfigMap is added to the StatefulSet/Deployment definition as a volume named `configmap-`.
The ConfigMaps are mounted into /etc/whizard/configmaps/ in the default container. | | | +| `affinity` _[Affinity](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#affinity-v1-core)_ | If specified, the pod's scheduling constraints. | | | +| `nodeSelector` _object (keys:string, values:string)_ | Define which Nodes the Pods are scheduled on. | | | +| `tolerations` _[Toleration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#toleration-v1-core) array_ | If specified, the pod's tolerations. | | | +| `resources` _[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#resourcerequirements-v1-core)_ | Define resources requests and limits for main container. | | | +| `securityContext` _[PodSecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#podsecuritycontext-v1-core)_ | SecurityContext holds pod-level security attributes and common container settings.
This defaults to the default PodSecurityContext. | | | +| `replicas` _integer_ | Number of replicas for a component. | | | +| `image` _string_ | Image is the component image with tag/version. | | | +| `imagePullPolicy` _[PullPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#pullpolicy-v1-core)_ | Image pull policy.
One of Always, Never, IfNotPresent.
Defaults to Always if :latest tag is specified, or IfNotPresent otherwise.
Cannot be updated. | | | +| `imagePullSecrets` _[LocalObjectReference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#localobjectreference-v1-core) array_ | An optional list of references to secrets in the same namespace
to use for pulling images from registries | | | +| `logLevel` _string_ | Log filtering level. Possible options: error, warn, info, debug. | | | +| `logFormat` _string_ | Log format to use. Possible options: logfmt or json. | | | +| `flags` _string array_ | Flags is the flags of component. | | | +| `ingesterTsdbCleanup` _[SidecarSpec](#sidecarspec)_ | | | | +| `tenants` _string array_ | Tenants if not empty indicates current config is for hard tenants; otherwise, it is for soft tenants. | | | +| `localTsdbRetention` _string_ | LocalTsdbRetention configs how long to retain raw samples on local storage. | | | +| `dataVolume` _[KubernetesVolume](#kubernetesvolume)_ | DataVolume specifies how volume shall be used | | | +| `defaultTenantsPerIngester` _integer_ | DefaultTenantsPerIngester Whizard default tenant count per ingester.

Default: 3 | 3 | | +| `defaultIngesterRetentionPeriod` _[Duration](#duration)_ | DefaultIngesterRetentionPeriod Whizard default ingester retention period when it has no tenant.

Default: "3h" | 3h | Pattern: `^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$`
| +| `disableTsdbCleanup` _boolean_ | DisableTSDBCleanup Disable the TSDB cleanup of ingester.
The cleanup will delete the blocks that belong to deleted tenants in the data directory of ingester TSDB.

Default: true | true | | + + +#### IngesterTenantStatus + + + + + + + +_Appears in:_ +- [IngesterStatus](#ingesterstatus) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `name` _string_ | | | | +| `obsolete` _boolean_ | true represents that the tenant has been moved to other ingester but may left tsdb data in this ingester. | | | + + +#### KubernetesVolume + + KubernetesVolume defines the configured volume for a instance. -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| emptyDir | | *corev1.EmptyDirVolumeSource | false | -| pvc | | *corev1.PersistentVolumeClaim | false | -[Back to TOC](#table-of-contents) -## ObjectReference +_Appears in:_ +- [CompactorSpec](#compactorspec) +- [CompactorTemplateSpec](#compactortemplatespec) +- [IngesterSpec](#ingesterspec) +- [IngesterTemplateSpec](#ingestertemplatespec) +- [RulerSpec](#rulerspec) +- [RulerTemplateSpec](#rulertemplatespec) +- [StoreSpec](#storespec) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `emptyDir` _[EmptyDirVolumeSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#emptydirvolumesource-v1-core)_ | | | | +| `persistentVolumeClaim` _[PersistentVolumeClaim](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#persistentvolumeclaim-v1-core)_ | | | | +| `persistentVolumeClaimRetentionPolicy` _[StatefulSetPersistentVolumeClaimRetentionPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#statefulsetpersistentvolumeclaimretentionpolicy-v1-apps)_ | persistentVolumeClaimRetentionPolicy describes the lifecycle of persistent
volume claims created from persistentVolumeClaim.
This requires the kubernetes version >= 1.23 and its StatefulSetAutoDeletePVC feature gate to be enabled. | | | + + +#### ObjectReference + + + + + + + +_Appears in:_ +- [ServiceSpec](#servicespec) +- [TenantStatus](#tenantstatus) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `namespace` _string_ | | | | +| `name` _string_ | | | | + + +#### Query + + + +Query is the Schema for the monitoring query API + + + + + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `apiVersion` _string_ | `monitoring.whizard.io/v1alpha1` | | | +| `kind` _string_ | `Query` | | | +| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | | +| `spec` _[QuerySpec](#queryspec)_ | | | | +| `status` _[QueryStatus](#querystatus)_ | | | | + + +#### QueryFrontend + + + +QueryFrontend is the Schema for the monitoring queryfrontend API -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| namespace | | string | false | -| name | | string | false | -[Back to TOC](#table-of-contents) -## Query +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `apiVersion` _string_ | `monitoring.whizard.io/v1alpha1` | | | +| `kind` _string_ | `QueryFrontend` | | | +| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | | +| `spec` _[QueryFrontendSpec](#queryfrontendspec)_ | | | | +| `status` _[QueryFrontendStatus](#queryfrontendstatus)_ | | | | +#### QueryFrontendSpec -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| affinity | If specified, the pod's scheduling constraints. | *corev1.Affinity | false | -| nodeSelector | Define which Nodes the Pods are scheduled on. | map[string]string | false | -| tolerations | If specified, the pod's tolerations. | []corev1.Toleration | false | -| resources | Define resources requests and limits for main container. | [corev1.ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#resourcerequirements-v1-core) | false | -| replicas | Number of replicas for a component | *int32 | false | -| image | Image is the image with tag/version | string | false | -| logLevel | Log filtering level. Possible options: error, warn, info, debug | string | false | -| logFormat | Log format to use. Possible options: logfmt or json | string | false | -| stores | Additional StoreApi servers from which Query component queries from | [][QueryStores](#querystores) | false | -| selectorLabels | Selector labels that will be exposed in info endpoint. | map[string]string | false | -| replicaLabelNames | Labels to treat as a replica indicator along which data is deduplicated. | []string | false | -| flags | Flags is the flags of query. | []string | false | -| envoy | Envoy is used to config sidecar which proxies requests requiring auth to the secure stores | [EnvoySpec](#envoyspec) | false | -[Back to TOC](#table-of-contents) -## QueryFrontend -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| affinity | If specified, the pod's scheduling constraints. | *corev1.Affinity | false | -| nodeSelector | Define which Nodes the Pods are scheduled on. | map[string]string | false | -| tolerations | If specified, the pod's tolerations. | []corev1.Toleration | false | -| resources | Define resources requests and limits for main container. | [corev1.ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#resourcerequirements-v1-core) | false | -| replicas | Number of replicas for a component | *int32 | false | -| image | Image is the image with tag/version | string | false | -| logLevel | Log filtering level. Possible options: error, warn, info, debug | string | false | -| logFormat | Log format to use. Possible options: logfmt or json | string | false | -| flags | Flags is the flags of query frontend. | []string | false | -| cacheConfig | CacheProviderConfig ... | *[ResponseCacheProviderConfig](#responsecacheproviderconfig) | false | -[Back to TOC](#table-of-contents) +_Appears in:_ +- [QueryFrontend](#queryfrontend) +- [ServiceSpec](#servicespec) -## QueryStores +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `containers` _[RawExtension](#rawextension)_ | Containers allows injecting additional containers or modifying operator generated containers.
Containers described here modify an operator generated
container if they share the same name and modifications are done via a
strategic merge patch. | | | +| `podMetadata` _[EmbeddedObjectMetadata](#embeddedobjectmetadata)_ | PodMetadata configures labels and annotations which are propagated to the pods.

* "kubectl.kubernetes.io/default-container" annotation, set to main pod. | | | +| `secrets` _string array_ | Secrets is a list of Secrets in the same namespace as the component
object, which shall be mounted into the Prometheus Pods.
Each Secret is added to the StatefulSet/Deployment definition as a volume named `secret-`.
The Secrets are mounted into /etc/whizard/secrets/ in the default container. | | | +| `configMaps` _string array_ | ConfigMaps is a list of ConfigMaps in the same namespace as the component
object, which shall be mounted into the default Pods.
Each ConfigMap is added to the StatefulSet/Deployment definition as a volume named `configmap-`.
The ConfigMaps are mounted into /etc/whizard/configmaps/ in the default container. | | | +| `affinity` _[Affinity](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#affinity-v1-core)_ | If specified, the pod's scheduling constraints. | | | +| `nodeSelector` _object (keys:string, values:string)_ | Define which Nodes the Pods are scheduled on. | | | +| `tolerations` _[Toleration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#toleration-v1-core) array_ | If specified, the pod's tolerations. | | | +| `resources` _[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#resourcerequirements-v1-core)_ | Define resources requests and limits for main container. | | | +| `securityContext` _[PodSecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#podsecuritycontext-v1-core)_ | SecurityContext holds pod-level security attributes and common container settings.
This defaults to the default PodSecurityContext. | | | +| `replicas` _integer_ | Number of replicas for a component. | | | +| `image` _string_ | Image is the component image with tag/version. | | | +| `imagePullPolicy` _[PullPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#pullpolicy-v1-core)_ | Image pull policy.
One of Always, Never, IfNotPresent.
Defaults to Always if :latest tag is specified, or IfNotPresent otherwise.
Cannot be updated. | | | +| `imagePullSecrets` _[LocalObjectReference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#localobjectreference-v1-core) array_ | An optional list of references to secrets in the same namespace
to use for pulling images from registries | | | +| `logLevel` _string_ | Log filtering level. Possible options: error, warn, info, debug. | | | +| `logFormat` _string_ | Log format to use. Possible options: logfmt or json. | | | +| `flags` _string array_ | Flags is the flags of component. | | | +| `webConfig` _[WebConfig](#webconfig)_ | | | | +| `cacheConfig` _[ResponseCacheProviderConfig](#responsecacheproviderconfig)_ | CacheProviderConfig ... | | | +#### QueryFrontendStatus -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| addresses | Address is the addresses of StoreApi server, which may be prefixed with 'dns+' or 'dnssrv+' to detect StoreAPI servers through respective DNS lookups. | []string | false | -| caSecret | Secret containing the CA cert to use for StoreApi connections | *corev1.SecretKeySelector | false | -[Back to TOC](#table-of-contents) -## ResponseCacheProviderConfig +QueryFrontendStatus defines the observed state of QueryFrontend -ResponseCacheProviderConfig is the initial ResponseCacheProviderConfig struct holder before parsing it into a specific cache provider. Based on the config type the config is then parsed into a specific cache provider. -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| type | | CacheProvider | true | -| inMemory | | *[InMemoryResponseCacheConfig](#inmemoryresponsecacheconfig) | false | -[Back to TOC](#table-of-contents) +_Appears in:_ +- [QueryFrontend](#queryfrontend) + + + +#### QuerySpec + + + + + + + +_Appears in:_ +- [Query](#query) +- [ServiceSpec](#servicespec) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `containers` _[RawExtension](#rawextension)_ | Containers allows injecting additional containers or modifying operator generated containers.
Containers described here modify an operator generated
container if they share the same name and modifications are done via a
strategic merge patch. | | | +| `podMetadata` _[EmbeddedObjectMetadata](#embeddedobjectmetadata)_ | PodMetadata configures labels and annotations which are propagated to the pods.

* "kubectl.kubernetes.io/default-container" annotation, set to main pod. | | | +| `secrets` _string array_ | Secrets is a list of Secrets in the same namespace as the component
object, which shall be mounted into the Prometheus Pods.
Each Secret is added to the StatefulSet/Deployment definition as a volume named `secret-`.
The Secrets are mounted into /etc/whizard/secrets/ in the default container. | | | +| `configMaps` _string array_ | ConfigMaps is a list of ConfigMaps in the same namespace as the component
object, which shall be mounted into the default Pods.
Each ConfigMap is added to the StatefulSet/Deployment definition as a volume named `configmap-`.
The ConfigMaps are mounted into /etc/whizard/configmaps/ in the default container. | | | +| `affinity` _[Affinity](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#affinity-v1-core)_ | If specified, the pod's scheduling constraints. | | | +| `nodeSelector` _object (keys:string, values:string)_ | Define which Nodes the Pods are scheduled on. | | | +| `tolerations` _[Toleration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#toleration-v1-core) array_ | If specified, the pod's tolerations. | | | +| `resources` _[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#resourcerequirements-v1-core)_ | Define resources requests and limits for main container. | | | +| `securityContext` _[PodSecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#podsecuritycontext-v1-core)_ | SecurityContext holds pod-level security attributes and common container settings.
This defaults to the default PodSecurityContext. | | | +| `replicas` _integer_ | Number of replicas for a component. | | | +| `image` _string_ | Image is the component image with tag/version. | | | +| `imagePullPolicy` _[PullPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#pullpolicy-v1-core)_ | Image pull policy.
One of Always, Never, IfNotPresent.
Defaults to Always if :latest tag is specified, or IfNotPresent otherwise.
Cannot be updated. | | | +| `imagePullSecrets` _[LocalObjectReference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#localobjectreference-v1-core) array_ | An optional list of references to secrets in the same namespace
to use for pulling images from registries | | | +| `logLevel` _string_ | Log filtering level. Possible options: error, warn, info, debug. | | | +| `logFormat` _string_ | Log format to use. Possible options: logfmt or json. | | | +| `flags` _string array_ | Flags is the flags of component. | | | +| `webConfig` _[WebConfig](#webconfig)_ | | | | +| `promqlEngine` _string_ | | | | +| `stores` _[QueryStores](#querystores) array_ | Additional StoreApi servers from which Query component queries from | | | +| `selectorLabels` _object (keys:string, values:string)_ | Selector labels that will be exposed in info endpoint. | | | +| `replicaLabelNames` _string array_ | Labels to treat as a replica indicator along which data is deduplicated. | | | +| `envoy` _[SidecarSpec](#sidecarspec)_ | Envoy is used to config sidecar which proxies requests requiring auth to the secure stores | | | + + +#### QueryStatus + + + +QueryStatus defines the observed state of Query + + + +_Appears in:_ +- [Query](#query) + + + +#### QueryStores + + + + + + + +_Appears in:_ +- [QuerySpec](#queryspec) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `addresses` _string array_ | Address is the addresses of StoreApi server, which may be prefixed with 'dns+' or 'dnssrv+' to detect StoreAPI servers through respective DNS lookups. | | | +| `caSecret` _[SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#secretkeyselector-v1-core)_ | Secret containing the CA cert to use for StoreApi connections | | | + + +#### RemoteQuerySpec + + + +RemoteQuerySpec defines the configuration to query from remote service +which should have prometheus-compatible Query APIs. + + + +_Appears in:_ +- [ServiceSpec](#servicespec) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `name` _string_ | | | | +| `url` _string_ | | | | +| `basicAuth` _[BasicAuth](#basicauth)_ | The HTTP basic authentication credentials for the targets. | | | +| `bearerToken` _string_ | The bearer token for the targets. | | | + + +#### RemoteWriteSpec + + + +RemoteWriteSpec defines the remote write configuration. + + + +_Appears in:_ +- [ServiceSpec](#servicespec) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `name` _string_ | | | | +| `url` _string_ | | | | +| `headers` _object (keys:string, values:string)_ | Custom HTTP headers to be sent along with each remote write request. | | | +| `remoteTimeout` _[Duration](#duration)_ | Timeout for requests to the remote write endpoint. | | Pattern: `^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$`
| +| `basicAuth` _[BasicAuth](#basicauth)_ | The HTTP basic authentication credentials for the targets. | | | +| `bearerToken` _string_ | The bearer token for the targets. | | | + + +#### ResponseCacheProviderConfig + + + +ResponseCacheProviderConfig is the initial ResponseCacheProviderConfig struct holder before parsing it into a specific cache provider. +Based on the config type the config is then parsed into a specific cache provider. + + + +_Appears in:_ +- [QueryFrontendSpec](#queryfrontendspec) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `type` _[CacheProvider](#cacheprovider)_ | | | | +| `inMemory` _[InMemoryResponseCacheConfig](#inmemoryresponsecacheconfig)_ | | | | + + +#### Retention + -## Retention Retention defines the config for retaining samples -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| retentionRaw | RetentionRaw specifies how long to retain raw samples in bucket | Duration | false | -| retention5m | Retention5m specifies how long to retain samples of 5m resolution in bucket | Duration | false | -| retention1h | Retention1h specifies how long to retain samples of 1h resolution in bucket | Duration | false | -[Back to TOC](#table-of-contents) -## Router +_Appears in:_ +- [CompactorSpec](#compactorspec) +- [CompactorTemplateSpec](#compactortemplatespec) +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `retentionRaw` _[Duration](#duration)_ | RetentionRaw specifies how long to retain raw samples in bucket | | Pattern: `^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$`
| +| `retention5m` _[Duration](#duration)_ | Retention5m specifies how long to retain samples of 5m resolution in bucket | | Pattern: `^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$`
| +| `retention1h` _[Duration](#duration)_ | Retention1h specifies how long to retain samples of 1h resolution in bucket | | Pattern: `^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$`
| -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| affinity | If specified, the pod's scheduling constraints. | *corev1.Affinity | false | -| nodeSelector | Define which Nodes the Pods are scheduled on. | map[string]string | false | -| tolerations | If specified, the pod's tolerations. | []corev1.Toleration | false | -| resources | Define resources requests and limits for main container. | [corev1.ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#resourcerequirements-v1-core) | false | -| replicas | Number of replicas for a component. | *int32 | false | -| image | Image is the image with tag/version | string | false | -| logLevel | Log filtering level. Possible options: error, warn, info, debug | string | false | -| logFormat | Log format to use. Possible options: logfmt or json | string | false | -| replicationFactor | How many times to replicate incoming write requests | *uint64 | false | -| flags | Flags is the flags of router. | []string | false | +#### Router + + + +Router is the Schema for the monitoring router API + + + + + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `apiVersion` _string_ | `monitoring.whizard.io/v1alpha1` | | | +| `kind` _string_ | `Router` | | | +| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | | +| `spec` _[RouterSpec](#routerspec)_ | | | | +| `status` _[RouterStatus](#routerstatus)_ | | | | + + +#### RouterSpec + + + + + + + +_Appears in:_ +- [Router](#router) +- [ServiceSpec](#servicespec) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `containers` _[RawExtension](#rawextension)_ | Containers allows injecting additional containers or modifying operator generated containers.
Containers described here modify an operator generated
container if they share the same name and modifications are done via a
strategic merge patch. | | | +| `podMetadata` _[EmbeddedObjectMetadata](#embeddedobjectmetadata)_ | PodMetadata configures labels and annotations which are propagated to the pods.

* "kubectl.kubernetes.io/default-container" annotation, set to main pod. | | | +| `secrets` _string array_ | Secrets is a list of Secrets in the same namespace as the component
object, which shall be mounted into the Prometheus Pods.
Each Secret is added to the StatefulSet/Deployment definition as a volume named `secret-`.
The Secrets are mounted into /etc/whizard/secrets/ in the default container. | | | +| `configMaps` _string array_ | ConfigMaps is a list of ConfigMaps in the same namespace as the component
object, which shall be mounted into the default Pods.
Each ConfigMap is added to the StatefulSet/Deployment definition as a volume named `configmap-`.
The ConfigMaps are mounted into /etc/whizard/configmaps/ in the default container. | | | +| `affinity` _[Affinity](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#affinity-v1-core)_ | If specified, the pod's scheduling constraints. | | | +| `nodeSelector` _object (keys:string, values:string)_ | Define which Nodes the Pods are scheduled on. | | | +| `tolerations` _[Toleration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#toleration-v1-core) array_ | If specified, the pod's tolerations. | | | +| `resources` _[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#resourcerequirements-v1-core)_ | Define resources requests and limits for main container. | | | +| `securityContext` _[PodSecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#podsecuritycontext-v1-core)_ | SecurityContext holds pod-level security attributes and common container settings.
This defaults to the default PodSecurityContext. | | | +| `replicas` _integer_ | Number of replicas for a component. | | | +| `image` _string_ | Image is the component image with tag/version. | | | +| `imagePullPolicy` _[PullPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#pullpolicy-v1-core)_ | Image pull policy.
One of Always, Never, IfNotPresent.
Defaults to Always if :latest tag is specified, or IfNotPresent otherwise.
Cannot be updated. | | | +| `imagePullSecrets` _[LocalObjectReference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#localobjectreference-v1-core) array_ | An optional list of references to secrets in the same namespace
to use for pulling images from registries | | | +| `logLevel` _string_ | Log filtering level. Possible options: error, warn, info, debug. | | | +| `logFormat` _string_ | Log format to use. Possible options: logfmt or json. | | | +| `flags` _string array_ | Flags is the flags of component. | | | +| `webConfig` _[WebConfig](#webconfig)_ | | | | +| `replicationFactor` _integer_ | How many times to replicate incoming write requests | | | + + +#### RouterStatus + + + +RouterStatus defines the observed state of Query + + + +_Appears in:_ +- [Router](#router) + + + +#### Ruler -[Back to TOC](#table-of-contents) -## Ruler Ruler is the Schema for the Ruler API -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| metadata | | [metav1.ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#objectmeta-v1-meta) | false | -| spec | | [RulerSpec](#rulerspec) | false | -| status | | [RulerStatus](#rulerstatus) | false | -[Back to TOC](#table-of-contents) -## RulerList -RulerList contains a list of Ruler -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| metadata | | [metav1.ListMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#listmeta-v1-meta) | false | -| items | | [][Ruler](#ruler) | true | +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `apiVersion` _string_ | `monitoring.whizard.io/v1alpha1` | | | +| `kind` _string_ | `Ruler` | | | +| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | | +| `spec` _[RulerSpec](#rulerspec)_ | | | | +| `status` _[RulerStatus](#rulerstatus)_ | | | | + + +#### RulerSpec -[Back to TOC](#table-of-contents) -## RulerSpec RulerSpec defines the desired state of a Ruler -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| affinity | If specified, the pod's scheduling constraints. | *corev1.Affinity | false | -| nodeSelector | Define which Nodes the Pods are scheduled on. | map[string]string | false | -| tolerations | If specified, the pod's tolerations. | []corev1.Toleration | false | -| resources | Define resources requests and limits for main container. | [corev1.ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#resourcerequirements-v1-core) | false | -| replicas | Number of replicas for a component. | *int32 | false | -| image | Image is the image with tag/version | string | false | -| logLevel | Log filtering level. Possible options: error, warn, info, debug | string | false | -| logFormat | Log format to use. Possible options: logfmt or json | string | false | -| ruleSelector | A label selector to select which PrometheusRules to mount for alerting and recording. | *[metav1.LabelSelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#labelselector-v1-meta) | false | -| ruleNamespaceSelector | Namespaces to be selected for PrometheusRules discovery. If unspecified, only the same namespace as the Ruler object is in is used. | *[metav1.LabelSelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#labelselector-v1-meta) | false | -| shards | Number of shards to take the hash of fully qualified name of the rule group in order to split rules. Each shard of rules will be bound to one separate statefulset. Default: `1` | *int32 | false | -| tenant | Tenant if not empty indicates which tenant's data is evaluated for the selected rules; otherwise, it is for all tenants. | string | false | -| labels | Labels configure the external label pairs to Ruler. A default replica label `ruler_replica` will be always added as a label with the value of the pod's name and it will be dropped in the alerts. | map[string]string | false | -| alertDropLabels | AlertDropLabels configure the label names which should be dropped in Ruler alerts. The replica label `ruler_replica` will always be dropped in alerts. | []string | false | -| alertmanagersConfig | Define configuration for connecting to alertmanager. Maps to the `alertmanagers.config` arg. | *corev1.SecretKeySelector | false | -| evaluationInterval | Interval between consecutive evaluations. Default: `30s` | Duration | false | -| flags | Flags is the flags of ruler. | []string | false | -| dataVolume | DataVolume specifies how volume shall be used | *[KubernetesVolume](#kubernetesvolume) | false | - -[Back to TOC](#table-of-contents) - -## Service -Service is the Schema for the monitoring service API -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| metadata | | [metav1.ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#objectmeta-v1-meta) | false | -| spec | | [ServiceSpec](#servicespec) | false | -| status | | [ServiceStatus](#servicestatus) | false | +_Appears in:_ +- [Ruler](#ruler) +- [RulerTemplateSpec](#rulertemplatespec) -[Back to TOC](#table-of-contents) +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `containers` _[RawExtension](#rawextension)_ | Containers allows injecting additional containers or modifying operator generated containers.
Containers described here modify an operator generated
container if they share the same name and modifications are done via a
strategic merge patch. | | | +| `podMetadata` _[EmbeddedObjectMetadata](#embeddedobjectmetadata)_ | PodMetadata configures labels and annotations which are propagated to the pods.

* "kubectl.kubernetes.io/default-container" annotation, set to main pod. | | | +| `secrets` _string array_ | Secrets is a list of Secrets in the same namespace as the component
object, which shall be mounted into the Prometheus Pods.
Each Secret is added to the StatefulSet/Deployment definition as a volume named `secret-`.
The Secrets are mounted into /etc/whizard/secrets/ in the default container. | | | +| `configMaps` _string array_ | ConfigMaps is a list of ConfigMaps in the same namespace as the component
object, which shall be mounted into the default Pods.
Each ConfigMap is added to the StatefulSet/Deployment definition as a volume named `configmap-`.
The ConfigMaps are mounted into /etc/whizard/configmaps/ in the default container. | | | +| `affinity` _[Affinity](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#affinity-v1-core)_ | If specified, the pod's scheduling constraints. | | | +| `nodeSelector` _object (keys:string, values:string)_ | Define which Nodes the Pods are scheduled on. | | | +| `tolerations` _[Toleration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#toleration-v1-core) array_ | If specified, the pod's tolerations. | | | +| `resources` _[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#resourcerequirements-v1-core)_ | Define resources requests and limits for main container. | | | +| `securityContext` _[PodSecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#podsecuritycontext-v1-core)_ | SecurityContext holds pod-level security attributes and common container settings.
This defaults to the default PodSecurityContext. | | | +| `replicas` _integer_ | Number of replicas for a component. | | | +| `image` _string_ | Image is the component image with tag/version. | | | +| `imagePullPolicy` _[PullPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#pullpolicy-v1-core)_ | Image pull policy.
One of Always, Never, IfNotPresent.
Defaults to Always if :latest tag is specified, or IfNotPresent otherwise.
Cannot be updated. | | | +| `imagePullSecrets` _[LocalObjectReference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#localobjectreference-v1-core) array_ | An optional list of references to secrets in the same namespace
to use for pulling images from registries | | | +| `logLevel` _string_ | Log filtering level. Possible options: error, warn, info, debug. | | | +| `logFormat` _string_ | Log format to use. Possible options: logfmt or json. | | | +| `flags` _string array_ | Flags is the flags of component. | | | +| `rulerQueryProxy` _[SidecarSpec](#sidecarspec)_ | | | | +| `rulerWriteProxy` _[SidecarSpec](#sidecarspec)_ | | | | +| `prometheusConfigReloader` _[SidecarSpec](#sidecarspec)_ | | | | +| `ruleSelectors` _[LabelSelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#labelselector-v1-meta) array_ | Label selectors to select which PrometheusRules to mount for alerting and recording.
The result of multiple selectors are ORed. | | | +| `ruleNamespaceSelector` _[LabelSelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#labelselector-v1-meta)_ | Namespaces to be selected for PrometheusRules discovery. If unspecified, only
the same namespace as the Ruler object is in is used. | | | +| `shards` _integer_ | Number of shards to take the hash of fully qualified name of the rule group in order to split rules.
Each shard of rules will be bound to one separate statefulset.
Default: 1 | 1 | | +| `tenant` _string_ | Tenant if not empty indicates which tenant's data is evaluated for the selected rules;
otherwise, it is for all tenants. | | | +| `queryConfig` _[SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#secretkeyselector-v1-core)_ | | | | +| `remoteWriteConfig` _[SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#secretkeyselector-v1-core)_ | | | | +| `labels` _object (keys:string, values:string)_ | Labels configure the external label pairs to Ruler. A default replica label
`ruler_replica` will be always added as a label with the value of the pod's name and it will be dropped in the alerts. | | | +| `alertDropLabels` _string array_ | AlertDropLabels configure the label names which should be dropped in Ruler alerts.
The replica label `ruler_replica` will always be dropped in alerts. | | | +| `alertmanagersUrl` _string array_ | Define URLs to send alerts to Alertmanager.
Note: this field will be ignored if AlertmanagersConfig is specified.
Maps to the `alertmanagers.url` arg. | | | +| `alertmanagersConfig` _[SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#secretkeyselector-v1-core)_ | Define configuration for connecting to alertmanager. Maps to the `alertmanagers.config` arg. | | | +| `evaluationInterval` _[Duration](#duration)_ | Interval between consecutive evaluations.

Default: "1m" | 1m | Pattern: `^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$`
| +| `dataVolume` _[KubernetesVolume](#kubernetesvolume)_ | DataVolume specifies how volume shall be used | | | -## ServiceList -ServiceList contains a list of Service +#### RulerStatus -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| metadata | | [metav1.ListMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#listmeta-v1-meta) | false | -| items | | [][Service](#service) | true | -[Back to TOC](#table-of-contents) -## ServiceSpec +RulerStatus defines the observed state of Ruler -ServiceSpec defines the desired state of a Service -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| tenantHeader | HTTP header to determine tenant for remote write requests. | string | false | -| defaultTenantId | Default tenant ID to use when none is provided via a header. | string | false | -| tenantLabelName | Label name through which the tenant will be announced. | string | false | -| storage | | *[ObjectReference](#objectreference) | false | -| gateway | Gateway to proxy and auth requests to Query and Router. | *[Gateway](#gateway) | false | -| query | Query component querys from the backends such as Ingester and Store by automated discovery. | *[Query](#query) | false | -| router | Receive Router component routes to the backends such as Ingester by automated discovery. | *[Router](#router) | false | -| queryFrontend | QueryFrontend component implements a service deployed in front of queriers to improve query parallelization and caching. | *[QueryFrontend](#queryfrontend) | false | -[Back to TOC](#table-of-contents) +_Appears in:_ +- [Ruler](#ruler) -## Store -Store is the Schema for the Store API -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| metadata | | [metav1.ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#objectmeta-v1-meta) | false | -| spec | | [StoreSpec](#storespec) | false | -| status | | [StoreStatus](#storestatus) | false | +#### RulerTemplateSpec -[Back to TOC](#table-of-contents) -## StoreList -StoreList contains a list of Store -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| metadata | | [metav1.ListMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#listmeta-v1-meta) | false | -| items | | [][Store](#store) | true | -[Back to TOC](#table-of-contents) -## StoreSpec +_Appears in:_ +- [ServiceSpec](#servicespec) +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `containers` _[RawExtension](#rawextension)_ | Containers allows injecting additional containers or modifying operator generated containers.
Containers described here modify an operator generated
container if they share the same name and modifications are done via a
strategic merge patch. | | | +| `podMetadata` _[EmbeddedObjectMetadata](#embeddedobjectmetadata)_ | PodMetadata configures labels and annotations which are propagated to the pods.

* "kubectl.kubernetes.io/default-container" annotation, set to main pod. | | | +| `secrets` _string array_ | Secrets is a list of Secrets in the same namespace as the component
object, which shall be mounted into the Prometheus Pods.
Each Secret is added to the StatefulSet/Deployment definition as a volume named `secret-`.
The Secrets are mounted into /etc/whizard/secrets/ in the default container. | | | +| `configMaps` _string array_ | ConfigMaps is a list of ConfigMaps in the same namespace as the component
object, which shall be mounted into the default Pods.
Each ConfigMap is added to the StatefulSet/Deployment definition as a volume named `configmap-`.
The ConfigMaps are mounted into /etc/whizard/configmaps/ in the default container. | | | +| `affinity` _[Affinity](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#affinity-v1-core)_ | If specified, the pod's scheduling constraints. | | | +| `nodeSelector` _object (keys:string, values:string)_ | Define which Nodes the Pods are scheduled on. | | | +| `tolerations` _[Toleration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#toleration-v1-core) array_ | If specified, the pod's tolerations. | | | +| `resources` _[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#resourcerequirements-v1-core)_ | Define resources requests and limits for main container. | | | +| `securityContext` _[PodSecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#podsecuritycontext-v1-core)_ | SecurityContext holds pod-level security attributes and common container settings.
This defaults to the default PodSecurityContext. | | | +| `replicas` _integer_ | Number of replicas for a component. | | | +| `image` _string_ | Image is the component image with tag/version. | | | +| `imagePullPolicy` _[PullPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#pullpolicy-v1-core)_ | Image pull policy.
One of Always, Never, IfNotPresent.
Defaults to Always if :latest tag is specified, or IfNotPresent otherwise.
Cannot be updated. | | | +| `imagePullSecrets` _[LocalObjectReference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#localobjectreference-v1-core) array_ | An optional list of references to secrets in the same namespace
to use for pulling images from registries | | | +| `logLevel` _string_ | Log filtering level. Possible options: error, warn, info, debug. | | | +| `logFormat` _string_ | Log format to use. Possible options: logfmt or json. | | | +| `flags` _string array_ | Flags is the flags of component. | | | +| `rulerQueryProxy` _[SidecarSpec](#sidecarspec)_ | | | | +| `rulerWriteProxy` _[SidecarSpec](#sidecarspec)_ | | | | +| `prometheusConfigReloader` _[SidecarSpec](#sidecarspec)_ | | | | +| `ruleSelectors` _[LabelSelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#labelselector-v1-meta) array_ | Label selectors to select which PrometheusRules to mount for alerting and recording.
The result of multiple selectors are ORed. | | | +| `ruleNamespaceSelector` _[LabelSelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#labelselector-v1-meta)_ | Namespaces to be selected for PrometheusRules discovery. If unspecified, only
the same namespace as the Ruler object is in is used. | | | +| `shards` _integer_ | Number of shards to take the hash of fully qualified name of the rule group in order to split rules.
Each shard of rules will be bound to one separate statefulset.
Default: 1 | 1 | | +| `tenant` _string_ | Tenant if not empty indicates which tenant's data is evaluated for the selected rules;
otherwise, it is for all tenants. | | | +| `queryConfig` _[SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#secretkeyselector-v1-core)_ | | | | +| `remoteWriteConfig` _[SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#secretkeyselector-v1-core)_ | | | | +| `labels` _object (keys:string, values:string)_ | Labels configure the external label pairs to Ruler. A default replica label
`ruler_replica` will be always added as a label with the value of the pod's name and it will be dropped in the alerts. | | | +| `alertDropLabels` _string array_ | AlertDropLabels configure the label names which should be dropped in Ruler alerts.
The replica label `ruler_replica` will always be dropped in alerts. | | | +| `alertmanagersUrl` _string array_ | Define URLs to send alerts to Alertmanager.
Note: this field will be ignored if AlertmanagersConfig is specified.
Maps to the `alertmanagers.url` arg. | | | +| `alertmanagersConfig` _[SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#secretkeyselector-v1-core)_ | Define configuration for connecting to alertmanager. Maps to the `alertmanagers.config` arg. | | | +| `evaluationInterval` _[Duration](#duration)_ | Interval between consecutive evaluations.

Default: "1m" | 1m | Pattern: `^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$`
| +| `dataVolume` _[KubernetesVolume](#kubernetesvolume)_ | DataVolume specifies how volume shall be used | | | +| `disableAlertingRulesAutoSelection` _boolean_ | DisableAlertingRulesAutoSelection disable auto select alerting rules in tenant ruler

Default: true | true | | -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| affinity | If specified, the pod's scheduling constraints. | *corev1.Affinity | false | -| nodeSelector | Define which Nodes the Pods are scheduled on. | map[string]string | false | -| tolerations | If specified, the pod's tolerations. | []corev1.Toleration | false | -| resources | Define resources requests and limits for main container. | [corev1.ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#resourcerequirements-v1-core) | false | -| replicas | Number of replicas for a component | *int32 | false | -| image | Image is the image with tag/version | string | false | -| imagePullPolicy | Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated. | [corev1.PullPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#container-v1-core) | false | -| logLevel | Log filtering level. Possible options: error, warn, info, debug | string | false | -| logFormat | Log format to use. Possible options: logfmt or json | string | false | -| storage | | *[ObjectReference](#objectreference) | false | -| minTime | MinTime specifies start of time range limit to serve | string | false | -| maxTime | MaxTime specifies end of time range limit to serve | string | false | -| indexCacheConfig | IndexCacheConfig contains index cache configuration. | *[IndexCacheConfig](#indexcacheconfig) | false | -| flags | Flags is the flag of store. | []string | false | -| dataVolume | DataVolume specifies how volume shall be used | *[KubernetesVolume](#kubernetesvolume) | false | -| scaler | | *[AutoScaler](#autoscaler) | false | -[Back to TOC](#table-of-contents) +#### S3 + -## S3 Config stores the configuration for s3 bucket. -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| bucket | | string | true | -| endpoint | | string | true | -| region | | string | false | -| awsSdkAuth | | bool | false | -| accessKey | | *corev1.SecretKeySelector | true | -| insecure | | bool | false | -| signatureVersion2 | | bool | false | -| secretKey | | *corev1.SecretKeySelector | true | -| putUserMetadata | | map[string]string | false | -| httpConfig | | [S3HTTPConfig](#s3httpconfig) | false | -| trace | | [S3TraceConfig](#s3traceconfig) | false | -| listObjectsVersion | | string | false | -| partSize | PartSize used for multipart upload. Only used if uploaded object size is known and larger than configured PartSize. NOTE we need to make sure this number does not produce more parts than 10 000. | uint64 | false | -| sseConfig | | [S3SSEConfig](#s3sseconfig) | false | -| stsEndpoint | | string | false | - -[Back to TOC](#table-of-contents) - -## S3HTTPConfig + + +_Appears in:_ +- [StorageSpec](#storagespec) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `bucket` _string_ | | | | +| `endpoint` _string_ | | | | +| `region` _string_ | | | | +| `awsSdkAuth` _boolean_ | | | | +| `accessKey` _[SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#secretkeyselector-v1-core)_ | | | | +| `insecure` _boolean_ | | | | +| `signatureVersion2` _boolean_ | | | | +| `secretKey` _[SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#secretkeyselector-v1-core)_ | | | | +| `putUserMetadata` _object (keys:string, values:string)_ | | | | +| `httpConfig` _[S3HTTPConfig](#s3httpconfig)_ | | | | +| `trace` _[S3TraceConfig](#s3traceconfig)_ | | | | +| `listObjectsVersion` _string_ | | | | +| `partSize` _integer_ | PartSize used for multipart upload. Only used if uploaded object size is known and larger than configured PartSize.
NOTE we need to make sure this number does not produce more parts than 10 000. | | | +| `sseConfig` _[S3SSEConfig](#s3sseconfig)_ | | | | +| `stsEndpoint` _string_ | | | | + + +#### S3HTTPConfig + + S3HTTPConfig stores the http.Transport configuration for the s3 minio client. -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| idleConnTimeout | | model.Duration | false | -| responseHeaderTimeout | | model.Duration | false | -| insecureSkipVerify | | bool | false | -| tlsHandshakeTimeout | | model.Duration | false | -| expectContinueTimeout | | model.Duration | false | -| maxIdleConns | | int | false | -| maxIdleConnsPerHost | | int | false | -| maxConnsPerHost | | int | false | -| tlsConfig | | [TLSConfig](#tlsconfig) | false | -[Back to TOC](#table-of-contents) -## S3SSEConfig +_Appears in:_ +- [S3](#s3) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `idleConnTimeout` _[Duration](#duration)_ | | | Pattern: `^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$`
| +| `responseHeaderTimeout` _[Duration](#duration)_ | | | Pattern: `^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$`
| +| `insecureSkipVerify` _boolean_ | | | | +| `tlsHandshakeTimeout` _[Duration](#duration)_ | | | Pattern: `^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$`
| +| `expectContinueTimeout` _[Duration](#duration)_ | | | Pattern: `^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$`
| +| `maxIdleConns` _integer_ | | | | +| `maxIdleConnsPerHost` _integer_ | | | | +| `maxConnsPerHost` _integer_ | | | | +| `tlsConfig` _[TLSConfig](#tlsconfig)_ | | | | + + +#### S3SSEConfig -S3SSEConfig deals with the configuration of SSE for Minio. The following options are valid: kmsencryptioncontext == https://docs.aws.amazon.com/kms/latest/developerguide/services-s3.html#s3-encryption-context -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| type | | string | false | -| kmsKeyId | | string | false | -| kmsEncryptionContext | | map[string]string | false | -| encryptionKey | | string | false | -[Back to TOC](#table-of-contents) +S3SSEConfig deals with the configuration of SSE for Minio. The following options are valid: +kmsencryptioncontext == https://docs.aws.amazon.com/kms/latest/developerguide/services-s3.html#s3-encryption-context -## S3TraceConfig +_Appears in:_ +- [S3](#s3) -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| enable | | bool | false | +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `type` _string_ | | | | +| `kmsKeyId` _string_ | | | | +| `kmsEncryptionContext` _object (keys:string, values:string)_ | | | | +| `encryptionKey` _string_ | | | | -[Back to TOC](#table-of-contents) -## Storage +#### S3TraceConfig -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| metadata | | [metav1.ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#objectmeta-v1-meta) | false | -| spec | | [StorageSpec](#storagespec) | false | -| status | | [StorageStatus](#storagestatus) | false | -[Back to TOC](#table-of-contents) -## StorageList +_Appears in:_ +- [S3](#s3) -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| metadata | | [metav1.ListMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#listmeta-v1-meta) | false | -| items | | [][Storage](#storage) | true | +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `enable` _boolean_ | | | | -[Back to TOC](#table-of-contents) -## StorageSpec +#### Service -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| S3 | | *[S3](#s3) | false | +Service is the Schema for the monitoring service API + + + + + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `apiVersion` _string_ | `monitoring.whizard.io/v1alpha1` | | | +| `kind` _string_ | `Service` | | | +| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | | +| `spec` _[ServiceSpec](#servicespec)_ | | | | +| `status` _[ServiceStatus](#servicestatus)_ | | | | + + +#### ServiceSpec + + + +ServiceSpec defines the desired state of a Service + + + +_Appears in:_ +- [Service](#service) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `tenantHeader` _string_ | HTTP header to determine tenant for remote write requests. | | | +| `defaultTenantId` _string_ | Default tenant ID to use when none is provided via a header. | | | +| `tenantLabelName` _string_ | Label name through which the tenant will be announced. | | | +| `storage` _[ObjectReference](#objectreference)_ | | | | +| `remoteWrites` _[RemoteWriteSpec](#remotewritespec) array_ | RemoteWrites is the list of remote write configurations.
If it is configured, its targets will receive write requests from the Gateway and the Ruler. | | | +| `remoteQuery` _[RemoteQuerySpec](#remotequeryspec)_ | RemoteQuery is the remote query configuration and the remote target should have prometheus-compatible Query APIs.
If not configured, the Gateway will proxy all read requests through the QueryFrontend to the Query,
If configured, the Gateway will proxy metrics read requests through the QueryFrontend to the remote target,
but proxy rules read requests directly to the Query. | | | +| `gatewayTemplateSpec` _[GatewaySpec](#gatewayspec)_ | | | | +| `queryFrontendTemplateSpec` _[QueryFrontendSpec](#queryfrontendspec)_ | | | | +| `queryTemplateSpec` _[QuerySpec](#queryspec)_ | | | | +| `rulerTemplateSpec` _[RulerTemplateSpec](#rulertemplatespec)_ | | | | +| `routerTemplateSpec` _[RouterSpec](#routerspec)_ | | | | +| `ingesterTemplateSpec` _[IngesterTemplateSpec](#ingestertemplatespec)_ | | | | +| `storeTemplateSpec` _[StoreSpec](#storespec)_ | | | | +| `compactorTemplateSpec` _[CompactorTemplateSpec](#compactortemplatespec)_ | | | | + + +#### ServiceStatus + + + +ServiceStatus defines the observed state of Service + + + +_Appears in:_ +- [Service](#service) + + + +#### SidecarSpec + + + + + + + +_Appears in:_ +- [IngesterSpec](#ingesterspec) +- [IngesterTemplateSpec](#ingestertemplatespec) +- [QuerySpec](#queryspec) +- [RulerSpec](#rulerspec) +- [RulerTemplateSpec](#rulertemplatespec) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `image` _string_ | Image is the envoy image with tag/version | | | +| `resources` _[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#resourcerequirements-v1-core)_ | Define resources requests and limits for sidecar container. | | | + + +#### Storage + + + + + + + + + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `apiVersion` _string_ | `monitoring.whizard.io/v1alpha1` | | | +| `kind` _string_ | `Storage` | | | +| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | | +| `spec` _[StorageSpec](#storagespec)_ | | | | +| `status` _[StorageStatus](#storagestatus)_ | | | | + + +#### StorageSpec + + + + + + + +_Appears in:_ +- [Storage](#storage) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `blockManager` _[BlockManager](#blockmanager)_ | | | | +| `S3` _[S3](#s3)_ | | | | + + +#### StorageStatus + + + + + + + +_Appears in:_ +- [Storage](#storage) + + + +#### Store + + + +Store is the Schema for the Store API + + + + + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `apiVersion` _string_ | `monitoring.whizard.io/v1alpha1` | | | +| `kind` _string_ | `Store` | | | +| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | | +| `spec` _[StoreSpec](#storespec)_ | | | | +| `status` _[StoreStatus](#storestatus)_ | | | | + + +#### StoreSpec + + + + + + + +_Appears in:_ +- [ServiceSpec](#servicespec) +- [Store](#store) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `containers` _[RawExtension](#rawextension)_ | Containers allows injecting additional containers or modifying operator generated containers.
Containers described here modify an operator generated
container if they share the same name and modifications are done via a
strategic merge patch. | | | +| `podMetadata` _[EmbeddedObjectMetadata](#embeddedobjectmetadata)_ | PodMetadata configures labels and annotations which are propagated to the pods.

* "kubectl.kubernetes.io/default-container" annotation, set to main pod. | | | +| `secrets` _string array_ | Secrets is a list of Secrets in the same namespace as the component
object, which shall be mounted into the Prometheus Pods.
Each Secret is added to the StatefulSet/Deployment definition as a volume named `secret-`.
The Secrets are mounted into /etc/whizard/secrets/ in the default container. | | | +| `configMaps` _string array_ | ConfigMaps is a list of ConfigMaps in the same namespace as the component
object, which shall be mounted into the default Pods.
Each ConfigMap is added to the StatefulSet/Deployment definition as a volume named `configmap-`.
The ConfigMaps are mounted into /etc/whizard/configmaps/ in the default container. | | | +| `affinity` _[Affinity](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#affinity-v1-core)_ | If specified, the pod's scheduling constraints. | | | +| `nodeSelector` _object (keys:string, values:string)_ | Define which Nodes the Pods are scheduled on. | | | +| `tolerations` _[Toleration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#toleration-v1-core) array_ | If specified, the pod's tolerations. | | | +| `resources` _[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#resourcerequirements-v1-core)_ | Define resources requests and limits for main container. | | | +| `securityContext` _[PodSecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#podsecuritycontext-v1-core)_ | SecurityContext holds pod-level security attributes and common container settings.
This defaults to the default PodSecurityContext. | | | +| `replicas` _integer_ | Number of replicas for a component. | | | +| `image` _string_ | Image is the component image with tag/version. | | | +| `imagePullPolicy` _[PullPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#pullpolicy-v1-core)_ | Image pull policy.
One of Always, Never, IfNotPresent.
Defaults to Always if :latest tag is specified, or IfNotPresent otherwise.
Cannot be updated. | | | +| `imagePullSecrets` _[LocalObjectReference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#localobjectreference-v1-core) array_ | An optional list of references to secrets in the same namespace
to use for pulling images from registries | | | +| `logLevel` _string_ | Log filtering level. Possible options: error, warn, info, debug. | | | +| `logFormat` _string_ | Log format to use. Possible options: logfmt or json. | | | +| `flags` _string array_ | Flags is the flags of component. | | | +| `minTime` _string_ | MinTime specifies start of time range limit to serve | | | +| `maxTime` _string_ | MaxTime specifies end of time range limit to serve | | | +| `timeRanges` _[TimeRange](#timerange) array_ | TimeRanges is a list of TimeRange to partition Store.
If specified, the MinTime and MaxTime will be ignored. | | | +| `indexCacheConfig` _[IndexCacheConfig](#indexcacheconfig)_ | IndexCacheConfig contains index cache configuration. | | | +| `dataVolume` _[KubernetesVolume](#kubernetesvolume)_ | DataVolume specifies how volume shall be used | | | +| `scaler` _[AutoScaler](#autoscaler)_ | | | | + + +#### StoreStatus + + + +StoreStatus defines the observed state of Store + + + +_Appears in:_ +- [Store](#store) + + + +#### TLSConfig -[Back to TOC](#table-of-contents) -## TLSConfig TLSConfig configures the options for TLS connections. -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| ca | The secret that including the CA cert. | *corev1.SecretKeySelector | false | -| cert | The secret that including the client cert. | *corev1.SecretKeySelector | false | -| key | The secret that including the client key. | *corev1.SecretKeySelector | false | -| serverName | Used to verify the hostname for the targets. | string | false | -| insecureSkipVerify | Disable target certificate validation. | bool | false | -[Back to TOC](#table-of-contents) -## Tenant +_Appears in:_ +- [S3HTTPConfig](#s3httpconfig) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `ca` _[SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#secretkeyselector-v1-core)_ | The secret that including the CA cert. | | | +| `cert` _[SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#secretkeyselector-v1-core)_ | The secret that including the client cert. | | | +| `key` _[SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#secretkeyselector-v1-core)_ | The secret that including the client key. | | | +| `serverName` _string_ | Used to verify the hostname for the targets. | | | +| `insecureSkipVerify` _boolean_ | Disable target certificate validation. | | | + + +#### Tenant + + Tenant is the Schema for the monitoring Tenant API -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| metadata | | [metav1.ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#objectmeta-v1-meta) | false | -| spec | | [TenantSpec](#tenantspec) | false | -| status | | [TenantStatus](#tenantstatus) | false | -[Back to TOC](#table-of-contents) -## TenantList +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `apiVersion` _string_ | `monitoring.whizard.io/v1alpha1` | | | +| `kind` _string_ | `Tenant` | | | +| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | | +| `spec` _[TenantSpec](#tenantspec)_ | | | | +| `status` _[TenantStatus](#tenantstatus)_ | | | | + + +#### TenantSpec + + + + + + + +_Appears in:_ +- [Tenant](#tenant) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `tenant` _string_ | | | | + + +#### TenantStatus + + + + + + + +_Appears in:_ +- [Tenant](#tenant) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `ruler` _[ObjectReference](#objectreference)_ | | | | +| `compactor` _[ObjectReference](#objectreference)_ | | | | +| `ingester` _[ObjectReference](#objectreference)_ | | | | + + +#### TimeRange + + + + + + + +_Appears in:_ +- [StoreSpec](#storespec) -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| metadata | | [metav1.ListMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#listmeta-v1-meta) | false | -| items | | [][Tenant](#tenant) | true | +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `minTime` _string_ | MinTime specifies start of time range limit to serve | | | +| `maxTime` _string_ | MaxTime specifies end of time range limit to serve | | | -[Back to TOC](#table-of-contents) -## TenantSpec +#### WebConfig -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| tenant | | string | false | -| storage | | *[ObjectReference](#objectreference) | false | +WebConfig defines the configuration for the HTTP server. +More info: https://prometheus.io/docs/prometheus/latest/configuration/https/ -[Back to TOC](#table-of-contents) -## TenantStatus +_Appears in:_ +- [GatewaySpec](#gatewayspec) +- [QueryFrontendSpec](#queryfrontendspec) +- [QuerySpec](#queryspec) +- [RouterSpec](#routerspec) +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `httpServerTLSConfig` _[HTTPServerTLSConfig](#httpservertlsconfig)_ | | | | +| `httpServerConfig` _[HTTPServerConfig](#httpserverconfig)_ | | | | +| `basicAuthUsers` _[BasicAuth](#basicauth) array_ | | | | -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| ruler | | *[ObjectReference](#objectreference) | false | -| compactor | | *[ObjectReference](#objectreference) | false | -| ingester | | *[ObjectReference](#objectreference) | false | -[Back to TOC](#table-of-contents) diff --git a/tools/docgen/config.yaml b/tools/docgen/config.yaml new file mode 100644 index 00000000..2f7cf1a4 --- /dev/null +++ b/tools/docgen/config.yaml @@ -0,0 +1,12 @@ +processor: + ignoreTypes: + - "(Compactor|Gateway|Ingester|Query|QueryFrontend|Router|Ruler|Service|Storage|Store|Tenant)List$" + ignoreFields: + - "TypeMeta$" + +render: + kubernetesVersion: 1.26 + knownTypes: + - name: SecretObjectReference + package: sigs.k8s.io/gateway-api/apis/v1beta1 + link: https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1beta1.SecretObjectReference \ No newline at end of file diff --git a/tools/docgen/docgen.go b/tools/docgen/docgen.go deleted file mode 100644 index 2df51dfa..00000000 --- a/tools/docgen/docgen.go +++ /dev/null @@ -1,253 +0,0 @@ -package main - -import ( - "bytes" - "fmt" - "go/ast" - "go/doc" - "go/parser" - "go/token" - "os" - "reflect" - "sort" - "strings" -) - -const ( - firstParagraph = ` - -# API Docs - -This Document documents the types introduced by the whizard to be consumed by users. - -> Note this document is generated from code comments. When contributing a change to this document please do so by changing the code comments.` -) - -var ( - links = map[string]string{ - "metav1.ObjectMeta": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#objectmeta-v1-meta", - "metav1.ListMeta": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#listmeta-v1-meta", - "metav1.LabelSelector": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#labelselector-v1-meta", - "corev1.ResourceRequirements": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#resourcerequirements-v1-core", - "corev1.PullPolicy": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#container-v1-core", - } - - selfLinks = map[string]string{} -) - -func toSectionLink(name string) string { - name = strings.ToLower(name) - name = strings.Replace(name, " ", "-", -1) - return name -} - -func printTOC(types []KubeTypes) { - fmt.Printf("\n## Table of Contents\n") - for _, t := range types { - strukt := t[0] - if len(t) > 1 { - fmt.Printf("* [%s](#%s)\n", strukt.Name, toSectionLink(strukt.Name)) - } - } -} - -func printAPIDocs(paths []string) { - sort.Strings(paths) - fmt.Println(firstParagraph) - - types := ParseDocumentationFrom(paths) - for _, t := range types { - strukt := t[0] - selfLinks[strukt.Name] = "#" + strings.ToLower(strukt.Name) - } - - // we need to parse once more to now add the self links - types = ParseDocumentationFrom(paths) - - printTOC(types) - - for _, t := range types { - strukt := t[0] - if len(t) > 1 { - fmt.Printf("\n## %s\n\n%s\n\n", strukt.Name, strukt.Doc) - - fmt.Println("| Field | Description | Scheme | Required |") - fmt.Println("| ----- | ----------- | ------ | -------- |") - fields := t[1:] - for _, f := range fields { - fmt.Println("|", f.Name, "|", f.Doc, "|", f.Type, "|", f.Mandatory, "|") - } - fmt.Println("") - fmt.Println("[Back to TOC](#table-of-contents)") - } - } -} - -// Pair of strings. We keed the name of fields and the doc -type Pair struct { - Name, Doc, Type string - Mandatory bool -} - -// KubeTypes is an array to represent all available types in a parsed file. [0] is for the type itself -type KubeTypes []Pair - -// ParseDocumentationFrom gets all types' documentation and returns them as an -// array. Each type is again represented as an array (we have to use arrays as we -// need to be sure for the order of the fields). This function returns fields and -// struct definitions that have no documentation as {name, ""}. -func ParseDocumentationFrom(srcs []string) []KubeTypes { - var docForTypes []KubeTypes - - for _, src := range srcs { - pkg := astFrom(src) - for _, kubType := range pkg.Types { - if structType, ok := kubType.Decl.Specs[0].(*ast.TypeSpec).Type.(*ast.StructType); ok { - var ks KubeTypes - ks = append(ks, Pair{kubType.Name, fmtRawDoc(kubType.Doc), "", false}) - - for _, field := range structType.Fields.List { - typeString := fieldType(field.Type) - fieldMandatory := fieldRequired(field) - if n := fieldName(field); n != "-" { - fieldDoc := fmtRawDoc(field.Doc.Text()) - ks = append(ks, Pair{n, fieldDoc, typeString, fieldMandatory}) - } - } - docForTypes = append(docForTypes, ks) - } - } - } - - return docForTypes -} - -func astFrom(filePath string) *doc.Package { - fset := token.NewFileSet() - m := make(map[string]*ast.File) - - f, err := parser.ParseFile(fset, filePath, nil, parser.ParseComments) - if err != nil { - fmt.Println(err) - return nil - } - - m[filePath] = f - apkg, _ := ast.NewPackage(fset, m, nil, nil) - - return doc.New(apkg, "", 0) -} - -func fmtRawDoc(rawDoc string) string { - var buffer bytes.Buffer - delPrevChar := func() { - if buffer.Len() > 0 { - buffer.Truncate(buffer.Len() - 1) // Delete the last " " or "\n" - } - } - - // Ignore all lines after --- - rawDoc = strings.Split(rawDoc, "---")[0] - - for _, line := range strings.Split(rawDoc, "\n") { - line = strings.TrimRight(line, " ") - leading := strings.TrimLeft(line, " ") - switch { - case len(line) == 0: // Keep paragraphs - delPrevChar() - buffer.WriteString("\n\n") - case strings.HasPrefix(leading, "TODO"): // Ignore one line TODOs - case strings.HasPrefix(leading, "+"): // Ignore instructions to go2idl - default: - if strings.HasPrefix(line, " ") || strings.HasPrefix(line, "\t") { - delPrevChar() - line = "\n" + line + "\n" // Replace it with newline. This is useful when we have a line with: "Example:\n\tJSON-someting..." - } else { - line += " " - } - buffer.WriteString(line) - } - } - - postDoc := strings.TrimRight(buffer.String(), "\n") - postDoc = strings.Replace(postDoc, "\\\"", "\"", -1) // replace user's \" to " - //postDoc = strings.Replace(postDoc, "\"", "\\\"", -1) // Escape " - postDoc = strings.Replace(postDoc, "\n", "\\n", -1) - postDoc = strings.Replace(postDoc, "\t", "\\t", -1) - postDoc = strings.Replace(postDoc, "|", "\\|", -1) - - return postDoc -} - -func toLink(typeName string) string { - selfLink, hasSelfLink := selfLinks[typeName] - if hasSelfLink { - return wrapInLink(typeName, selfLink) - } - - link, hasLink := links[typeName] - if hasLink { - return wrapInLink(typeName, link) - } - - return typeName -} - -func wrapInLink(text, link string) string { - return fmt.Sprintf("[%s](%s)", text, link) -} - -// fieldName returns the name of the field as it should appear in JSON format -// "-" indicates that this field is not part of the JSON representation -func fieldName(field *ast.Field) string { - jsonTag := "" - if field.Tag != nil { - jsonTag = reflect.StructTag(field.Tag.Value[1 : len(field.Tag.Value)-1]).Get("json") // Delete first and last quotation - if strings.Contains(jsonTag, "inline") { - return "-" - } - } - - jsonTag = strings.Split(jsonTag, ",")[0] // This can return "-" - if jsonTag == "" { - if field.Names != nil { - return field.Names[0].Name - } - return field.Type.(*ast.Ident).Name - } - return jsonTag -} - -// fieldRequired returns whether a field is a required field. -func fieldRequired(field *ast.Field) bool { - jsonTag := "" - if field.Tag != nil { - jsonTag = reflect.StructTag(field.Tag.Value[1 : len(field.Tag.Value)-1]).Get("json") // Delete first and last quotation - return !strings.Contains(jsonTag, "omitempty") - } - - return false -} - -func fieldType(typ ast.Expr) string { - switch t := typ.(type) { - case *ast.Ident: - return toLink(t.Name) - case *ast.StarExpr: - return "*" + toLink(fieldType(t.X)) - case *ast.SelectorExpr: - pkg := t.X.(*ast.Ident) - return toLink(pkg.Name + "." + t.Sel.Name) - case *ast.ArrayType: - return "[]" + toLink(fieldType(t.Elt)) - case *ast.MapType: - mapType := t - return "map[" + toLink(fieldType(mapType.Key)) + "]" + toLink(fieldType(mapType.Value)) - default: - return "" - } -} - -func main() { - printAPIDocs(os.Args[1:]) -}