diff --git a/production/helm/loki/test/integration/distributed-advanced/log-generator.yaml b/production/helm/loki/test/integration/distributed-advanced/log-generator.yaml new file mode 100644 index 0000000000..eec80e4500 --- /dev/null +++ b/production/helm/loki/test/integration/distributed-advanced/log-generator.yaml @@ -0,0 +1,49 @@ +--- +apiVersion: source.toolkit.fluxcd.io/v1 +kind: HelmRepository +metadata: + name: grafana + namespace: default +spec: + interval: 1m + url: https://grafana.github.io/helm-charts +--- +apiVersion: helm.toolkit.fluxcd.io/v2 +kind: HelmRelease +metadata: + name: log-generator + namespace: default +spec: + interval: 1m + chart: + spec: + chart: alloy + sourceRef: + kind: HelmRepository + name: grafana + namespace: default + interval: 1m + values: + controller: + type: deployment + alloy: + configMap: + content: | + logging { + level = "debug" + write_to = [loki.relabel.default.receiver] + } + + loki.relabel "default" { + rule { + target_label = "source" + replacement = "log-generator" + } + forward_to = [loki.write.default.receiver] + } + + loki.write "default" { + endpoint { + url = "http://loki-gateway.loki.svc/loki/api/v1/push" + } + } diff --git a/production/helm/loki/test/integration/distributed-advanced/non-default-values.yaml b/production/helm/loki/test/integration/distributed-advanced/non-default-values.yaml new file mode 100644 index 0000000000..f1ed766914 --- /dev/null +++ b/production/helm/loki/test/integration/distributed-advanced/non-default-values.yaml @@ -0,0 +1,73 @@ +deploymentMode: Distributed +loki: + commonConfig: + replication_factor: 1 + useTestSchema: true + auth_enabled: false + storage: + bucketNames: + chunks: chunks + ruler: ruler + admin: admin + tenants: + - name: "test-user-1" + password: "test-password-1" + - name: "test-user-2" + passwordHash: "$2y$10$7O40CaY1yz7fu9O24k2/u.ct/wELYHRBsn25v/7AyuQ8E8hrLqpva" +ingester: + replicas: 1 + zoneAwareReplication: + enabled: false +minio: + enabled: true +read: + replicas: 0 +write: + replicas: 0 +backend: + replicas: 0 +ruler: + replicas: 1 +distributor: + replicas: 1 +memcached: + enabled: true + replicas: 1 +compactor: + replicas: 1 +indexGateway: + replicas: 1 +querier: + replicas: 1 +queryFrontend: + replicas: 1 +queryScheduler: + replicas: 1 +lokiCanary: + kind: Deployment +chunksCache: + suffix: "l1" + enabled: true + allocatedMemory: 128 + persistence: + labels: + foo: bar + baz: qux + l2: + enabled: true + replicas: 2 + allocatedMemory: 128 + persistence: + labels: + foo: bar + baz: qux +resultsCache: + allocatedMemory: 128 + persistence: + labels: + foo: bar + baz: qux +gateway: + enabled: true + basicAuth: + enabled: false diff --git a/production/helm/loki/test/integration/distributed-advanced/test-plan.yaml b/production/helm/loki/test/integration/distributed-advanced/test-plan.yaml new file mode 100644 index 0000000000..cd750401c4 --- /dev/null +++ b/production/helm/loki/test/integration/distributed-advanced/test-plan.yaml @@ -0,0 +1,131 @@ +--- +apiVersion: helm-chart-toolbox.grafana.com/v1 +kind: TestPlan +name: distributed-advanced +subject: + releaseName: loki + namespace: loki + path: ../../.. + valuesFile: non-default-values.yaml + extraArgs: + - --dependency-update + - --set + - "chunksCache.allocatedMemory=128" + +cluster: + type: kind + +dependencies: + - file: log-generator.yaml + - preset: grafana + overrides: + datasources: + datasources.yaml: + apiVersion: 1 + datasources: + - name: Loki + type: loki + url: http://loki-gateway.loki.svc/loki/api/v1/query + isDefault: true + +tests: + - type: kubernetes-objects-test + values: + checks: + # Individual microservices (distributed mode) + - kind: StatefulSet + name: loki-ruler + namespace: loki + - kind: StatefulSet + name: loki-ingester + namespace: loki + - kind: Deployment + name: loki-distributor + namespace: loki + - kind: StatefulSet + name: loki-compactor + namespace: loki + - kind: StatefulSet + name: loki-index-gateway + namespace: loki + - kind: Deployment + name: loki-querier + namespace: loki + - kind: Deployment + name: loki-query-frontend + namespace: loki + - kind: Deployment + name: loki-query-scheduler + namespace: loki + - kind: Deployment + name: loki-gateway + namespace: loki + + # Caching components + - kind: StatefulSet + name: loki-chunks-cache-l1 + namespace: loki + - kind: StatefulSet + name: loki-chunks-cache-l2 + namespace: loki + - kind: StatefulSet + name: loki-results-cache + namespace: loki + + # MinIO for storage + - kind: StatefulSet + name: loki-minio + namespace: loki + + # Services for all components + - kind: Service + name: loki-ruler + namespace: loki + - kind: Service + name: loki-ingester + namespace: loki + - kind: Service + name: loki-distributor + namespace: loki + - kind: Service + name: loki-compactor + namespace: loki + - kind: Service + name: loki-index-gateway + namespace: loki + - kind: Service + name: loki-querier + namespace: loki + - kind: Service + name: loki-query-frontend + namespace: loki + - kind: Service + name: loki-query-scheduler + namespace: loki + - kind: Service + name: loki-gateway + namespace: loki + - kind: Service + name: loki-chunks-cache-l1 + namespace: loki + - kind: Service + name: loki-chunks-cache-l2 + namespace: loki + - kind: Service + name: loki-results-cache + namespace: loki + - kind: Service + name: loki-minio + namespace: loki + - kind: Service + name: loki-memberlist + namespace: loki + + - type: query-test + values: + tests: + - env: + LOKI_URL: http://loki-gateway.loki.svc/loki/api/v1/query + queries: + - query: count_over_time({source="log-generator"}[1h]) + type: logql diff --git a/production/helm/loki/test/integration/enterprise/enterprise.yaml b/production/helm/loki/test/integration/enterprise/enterprise.yaml new file mode 100644 index 0000000000..b99837afd2 --- /dev/null +++ b/production/helm/loki/test/integration/enterprise/enterprise.yaml @@ -0,0 +1,48 @@ +--- +enterprise: + enabled: true + provisioner: + enabled: false + license: + contents: "NOTAVALIDLICENSE_BUT_SUFFICIENT_FOR_TESTING_PURPOSES" + config: | + auth: + type: trust + auth_enabled: false + cluster_name: {{ .Release.Name }} + license: + path: /etc/loki/license/license.jwt +loki: + commonConfig: + replication_factor: 1 + image: + tag: "main-5e53303" + useTestSchema: true + storage: + bucketNames: + chunks: chunks + ruler: ruler + admin: admin +minio: + enabled: true +deploymentMode: SimpleScalable +lokiCanary: + enabled: true +read: + replicas: 1 +write: + replicas: 1 + persistence: + enabled: true + size: 100Mi +backend: + replicas: 1 + persistence: + enabled: true + size: 100Mi +monitoring: + serviceMonitor: + labels: + release: "prometheus" +test: + prometheusAddress: "http://prometheus-kube-prometheus-prometheus.prometheus.svc.cluster.local.:9090" diff --git a/production/helm/loki/test/integration/enterprise/log-generator.yaml b/production/helm/loki/test/integration/enterprise/log-generator.yaml new file mode 100644 index 0000000000..0389d96c16 --- /dev/null +++ b/production/helm/loki/test/integration/enterprise/log-generator.yaml @@ -0,0 +1,50 @@ +--- +apiVersion: source.toolkit.fluxcd.io/v1 +kind: HelmRepository +metadata: + name: grafana + namespace: default +spec: + interval: 1m + url: https://grafana.github.io/helm-charts +--- +apiVersion: helm.toolkit.fluxcd.io/v2 +kind: HelmRelease +metadata: + name: log-generator + namespace: default +spec: + interval: 1m + chart: + spec: + chart: alloy + sourceRef: + kind: HelmRepository + name: grafana + namespace: default + interval: 1m + values: + controller: + type: deployment + alloy: + configMap: + content: | + logging { + level = "debug" + write_to = [loki.relabel.default.receiver] + } + + loki.relabel "default" { + rule { + target_label = "source" + replacement = "log-generator" + } + forward_to = [loki.write.default.receiver] + } + + loki.write "default" { + endpoint { + url = "http://loki-enterprise-logs-gateway.loki.svc/loki/api/v1/push" + tenant_id = "1" + } + } \ No newline at end of file diff --git a/production/helm/loki/test/integration/enterprise/monitoring-secret.yaml b/production/helm/loki/test/integration/enterprise/monitoring-secret.yaml new file mode 100644 index 0000000000..79cec1e299 --- /dev/null +++ b/production/helm/loki/test/integration/enterprise/monitoring-secret.yaml @@ -0,0 +1,17 @@ +--- +apiVersion: v1 +kind: Namespace +metadata: + name: loki +--- +apiVersion: v1 +kind: Secret +metadata: + name: enterprise-logs-provisioned-self-monitoring + namespace: loki +type: Opaque +data: + # Base64 encoded "test-user" + username: dGVzdC11c2Vy + # Base64 encoded "test-password" + password: dGVzdC1wYXNzd29yZA== diff --git a/production/helm/loki/test/integration/enterprise/test-plan.yaml b/production/helm/loki/test/integration/enterprise/test-plan.yaml new file mode 100644 index 0000000000..a56e64f70b --- /dev/null +++ b/production/helm/loki/test/integration/enterprise/test-plan.yaml @@ -0,0 +1,93 @@ +--- +apiVersion: helm-chart-toolbox.grafana.com/v1 +kind: TestPlan +name: enterprise +subject: + releaseName: loki + namespace: loki + path: ../../.. + valuesFile: enterprise.yaml + extraArgs: + - --dependency-update + - --set + - "chunksCache.allocatedMemory=1024" + +cluster: + type: kind + +dependencies: + - file: monitoring-secret.yaml + - file: log-generator.yaml + - preset: grafana + overrides: + datasources: + datasources.yaml: + apiVersion: 1 + datasources: + - name: Loki + type: loki + url: http://loki.loki.svc:3100/ + isDefault: true + jsonData: + httpHeaderName1: X-Scope-OrgID + secureJsonData: + httpHeaderValue1: "1" + +tests: + - type: kubernetes-objects-test + values: + checks: + - kind: StatefulSet + name: enterprise-logs-backend + namespace: loki + - kind: StatefulSet + name: enterprise-logs-write + namespace: loki + - kind: StatefulSet + name: loki-enterprise-logs-chunks-cache + namespace: loki + - kind: StatefulSet + name: loki-enterprise-logs-results-cache + namespace: loki + - kind: Deployment + name: enterprise-logs-read + namespace: loki + - kind: Deployment + name: loki-enterprise-logs-gateway + namespace: loki + + # Loki services + - kind: Service + name: enterprise-logs-backend + namespace: loki + - kind: Service + name: enterprise-logs-read + namespace: loki + - kind: Service + name: enterprise-logs-write + namespace: loki + - kind: Service + name: enterprise-logs-canary + namespace: loki + - kind: Service + name: loki-enterprise-logs-chunks-cache + namespace: loki + - kind: Service + name: loki-enterprise-logs-gateway + namespace: loki + - kind: Service + name: enterprise-logs-memberlist + namespace: loki + - kind: Service + name: loki-enterprise-logs-results-cache + namespace: loki + + - type: query-test + values: + tests: + - env: + LOKI_URL: http://loki-enterprise-logs-gateway.loki.svc/loki/api/v1/query + LOKI_TENANTID: 1 + queries: + - query: count_over_time({source="log-generator"}[1h]) + type: logql diff --git a/production/helm/loki/test/integration/ingress/ingress-values.yaml b/production/helm/loki/test/integration/ingress/ingress-values.yaml new file mode 100644 index 0000000000..ff5ff1efd9 --- /dev/null +++ b/production/helm/loki/test/integration/ingress/ingress-values.yaml @@ -0,0 +1,30 @@ +--- +gateway: + ingress: + enabled: true + annotations: {} + hosts: + - host: gateway.loki.example.com + paths: + - path: / + pathType: Prefix +loki: + commonConfig: + replication_factor: 1 + useTestSchema: true + storage: + bucketNames: + chunks: chunks + ruler: ruler + admin: admin +read: + replicas: 1 +write: + replicas: 1 +backend: + replicas: 1 +monitoring: + lokiCanary: + enabled: false +test: + enabled: false diff --git a/production/helm/loki/test/integration/ingress/test-plan.yaml b/production/helm/loki/test/integration/ingress/test-plan.yaml index db4bbeec1e..fb5cab0c0d 100644 --- a/production/helm/loki/test/integration/ingress/test-plan.yaml +++ b/production/helm/loki/test/integration/ingress/test-plan.yaml @@ -6,7 +6,7 @@ subject: releaseName: loki namespace: loki path: ../../.. - valuesFile: ../../../ci/ingress-values.yaml + valuesFile: ingress-values.yaml extraArgs: - --dependency-update - --set diff --git a/production/helm/loki/test/integration/single-binary/default-single-binary-values.yaml b/production/helm/loki/test/integration/single-binary/default-single-binary-values.yaml new file mode 100644 index 0000000000..5164bb842b --- /dev/null +++ b/production/helm/loki/test/integration/single-binary/default-single-binary-values.yaml @@ -0,0 +1,19 @@ +--- +loki: + commonConfig: + replication_factor: 1 + useTestSchema: true + storage: + bucketNames: + chunks: chunks + ruler: ruler + admin: admin +deploymentMode: SingleBinary +singleBinary: + replicas: 1 +read: + replicas: 0 +write: + replicas: 0 +backend: + replicas: 0 diff --git a/production/helm/loki/test/integration/single-binary/test-plan.yaml b/production/helm/loki/test/integration/single-binary/test-plan.yaml index e21da5fbbb..7c2efeff28 100644 --- a/production/helm/loki/test/integration/single-binary/test-plan.yaml +++ b/production/helm/loki/test/integration/single-binary/test-plan.yaml @@ -6,7 +6,7 @@ subject: releaseName: loki namespace: loki path: ../../.. - valuesFile: ../../../ci/default-single-binary-values.yaml + valuesFile: default-single-binary-values.yaml extraArgs: - --dependency-update - --set diff --git a/production/helm/loki/test/integration/ssd/default-values.yaml b/production/helm/loki/test/integration/ssd/default-values.yaml new file mode 100644 index 0000000000..a79baee503 --- /dev/null +++ b/production/helm/loki/test/integration/ssd/default-values.yaml @@ -0,0 +1,16 @@ +--- +loki: + commonConfig: + replication_factor: 1 + useTestSchema: true + storage: + bucketNames: + chunks: chunks + ruler: ruler + admin: admin +read: + replicas: 1 +write: + replicas: 1 +backend: + replicas: 1 diff --git a/production/helm/loki/test/integration/ssd/log-generator.yaml b/production/helm/loki/test/integration/ssd/log-generator.yaml new file mode 100644 index 0000000000..a2c3364300 --- /dev/null +++ b/production/helm/loki/test/integration/ssd/log-generator.yaml @@ -0,0 +1,50 @@ +--- +apiVersion: source.toolkit.fluxcd.io/v1 +kind: HelmRepository +metadata: + name: grafana + namespace: default +spec: + interval: 1m + url: https://grafana.github.io/helm-charts +--- +apiVersion: helm.toolkit.fluxcd.io/v2 +kind: HelmRelease +metadata: + name: log-generator + namespace: default +spec: + interval: 1m + chart: + spec: + chart: alloy + sourceRef: + kind: HelmRepository + name: grafana + namespace: default + interval: 1m + values: + controller: + type: deployment + alloy: + configMap: + content: | + logging { + level = "debug" + write_to = [loki.relabel.default.receiver] + } + + loki.relabel "default" { + rule { + target_label = "source" + replacement = "log-generator" + } + forward_to = [loki.write.default.receiver] + } + + loki.write "default" { + endpoint { + url = "http://loki-gateway.loki.svc/loki/api/v1/push" + tenant_id = "1" + } + } \ No newline at end of file diff --git a/production/helm/loki/test/integration/ssd/test-plan.yaml b/production/helm/loki/test/integration/ssd/test-plan.yaml new file mode 100644 index 0000000000..51e6d68225 --- /dev/null +++ b/production/helm/loki/test/integration/ssd/test-plan.yaml @@ -0,0 +1,92 @@ +--- +apiVersion: helm-chart-toolbox.grafana.com/v1 +kind: TestPlan +name: ssd +subject: + releaseName: loki + namespace: loki + path: ../../.. + valuesFile: default-values.yaml + extraArgs: + - --dependency-update + - --set + - "chunksCache.allocatedMemory=1024" + +cluster: + type: kind + +dependencies: + - file: log-generator.yaml + - preset: grafana + overrides: + datasources: + datasources.yaml: + apiVersion: 1 + datasources: + - name: Loki + type: loki + url: http://loki.loki.svc:3100/ + isDefault: true + jsonData: + httpHeaderName1: X-Scope-OrgID + secureJsonData: + httpHeaderValue1: "1" + +tests: + - type: kubernetes-objects-test + values: + checks: + - kind: StatefulSet + name: loki-backend + namespace: loki + - kind: StatefulSet + name: loki-write + namespace: loki + - kind: StatefulSet + name: loki-chunks-cache + namespace: loki + - kind: StatefulSet + name: loki-results-cache + namespace: loki + - kind: Deployment + name: loki-read + namespace: loki + - kind: Deployment + name: loki-gateway + namespace: loki + + # Loki services + - kind: Service + name: loki-backend + namespace: loki + - kind: Service + name: loki-read + namespace: loki + - kind: Service + name: loki-write + namespace: loki + - kind: Service + name: loki-canary + namespace: loki + - kind: Service + name: loki-chunks-cache + namespace: loki + - kind: Service + name: loki-gateway + namespace: loki + - kind: Service + name: loki-memberlist + namespace: loki + - kind: Service + name: loki-results-cache + namespace: loki + + - type: query-test + values: + tests: + - env: + LOKI_URL: http://loki-gateway.loki.svc/loki/api/v1/query + LOKI_TENANTID: 1 + queries: + - query: count_over_time({source="log-generator"}[1h]) + type: logql