From f20104ed861ef7d18510a16930a65300b3d8b06d Mon Sep 17 00:00:00 2001 From: Koenraad Verheyden Date: Wed, 29 Sep 2021 14:21:51 +0200 Subject: [PATCH] Add make kube-manifests-check (#991) * Add make kube-manifests-check * Only diff .yaml files: jsonnetfile.lock.json will change all the time * Install Tanka in CI * Regen kube-manifests --- .github/workflows/ci.yml | 9 ++-- Makefile | 8 +++ .../ConfigMap-tempo-compactor.yaml | 6 +-- .../ConfigMap-tempo-distributor.yaml | 4 +- .../ConfigMap-tempo-ingester.yaml | 4 +- .../ConfigMap-tempo-overrides.yaml | 8 +++ .../ConfigMap-tempo-querier.yaml | 2 +- .../ConfigMap-tempo-query-frontend.yaml | 2 +- .../kube-manifests/ConfigMap-tempo.yaml | 52 ------------------- .../kube-manifests/Deployment-compactor.yaml | 11 ++-- .../Deployment-distributor.yaml | 7 ++- .../kube-manifests/Deployment-querier.yaml | 2 +- .../Deployment-query-frontend.yaml | 5 +- .../kube-manifests/StatefulSet-ingester.yaml | 7 ++- operations/kube-manifests/util/Makefile | 11 ++++ operations/kube-manifests/util/README.md | 12 ++--- .../util/{generator => example}/main.jsonnet | 0 .../util/{generator => example}/spec.json | 0 .../kube-manifests/util/jsonnetfile.lock.json | 4 +- 19 files changed, 69 insertions(+), 85 deletions(-) create mode 100644 operations/kube-manifests/ConfigMap-tempo-overrides.yaml delete mode 100644 operations/kube-manifests/ConfigMap-tempo.yaml create mode 100644 operations/kube-manifests/util/Makefile rename operations/kube-manifests/util/{generator => example}/main.jsonnet (100%) rename operations/kube-manifests/util/{generator => example}/spec.json (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1e15aa6ac73..fad6cd72e52 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,7 +45,7 @@ jobs: run: make tempo-query tempo-mixin: - name: Check tempo-mixin + name: Check kube-manifests & tempo-mixin runs-on: ubuntu-latest steps: @@ -54,13 +54,16 @@ jobs: with: go-version: 1.16 - - name: Install jsonnet & jsonnet-bundler + - name: Install jsonnet, jsonnet-bundler & tanka run: | - brew install jsonnet + brew install jsonnet tanka go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@v0.4.0 - name: Check out code uses: actions/checkout@v2 + - name: Check kube-manifests + run: make kube-manifests-check + - name: Check tempo-mixin run: make tempo-mixin-check diff --git a/Makefile b/Makefile index 4ff2c0d41a9..cc4987f1bfa 100644 --- a/Makefile +++ b/Makefile @@ -201,6 +201,14 @@ docs-test: docker pull ${DOCS_IMAGE} docker run -v ${PWD}/docs/tempo/website:/hugo/content/docs/tempo/latest:z -p 3002:3002 --rm $(DOCS_IMAGE) /bin/bash -c 'mkdir -p content/docs/grafana/latest/ && touch content/docs/grafana/latest/menu.yaml && make prod' +### kube-manifests +.PHONY: kube-manifests kube-manifests-check +kube-manifests: + $(MAKE) -C operations/kube-manifests/util gen + +kube-manifests-check: + $(MAKE) -C operations/kube-manifests/util check + ### tempo-mixin .PHONY: tempo-mixin tempo-mixin-check tempo-mixin: diff --git a/operations/kube-manifests/ConfigMap-tempo-compactor.yaml b/operations/kube-manifests/ConfigMap-tempo-compactor.yaml index f5a910e7f6a..2c9a60a8d76 100644 --- a/operations/kube-manifests/ConfigMap-tempo-compactor.yaml +++ b/operations/kube-manifests/ConfigMap-tempo-compactor.yaml @@ -1,7 +1,5 @@ apiVersion: v1 data: - overrides.yaml: | - overrides: {} tempo.yaml: | compactor: compaction: @@ -21,13 +19,13 @@ data: join_members: - gossip-ring.tracing.svc.cluster.local:7946 overrides: - per_tenant_override_config: /conf/overrides.yaml + per_tenant_override_config: /overrides/overrides.yaml server: http_listen_port: 3200 storage: trace: backend: gcs - blocklist_poll: 10m + blocklist_poll: 5m cache: memcached gcs: bucket_name: tempo diff --git a/operations/kube-manifests/ConfigMap-tempo-distributor.yaml b/operations/kube-manifests/ConfigMap-tempo-distributor.yaml index 4af915d0408..48c213b3859 100644 --- a/operations/kube-manifests/ConfigMap-tempo-distributor.yaml +++ b/operations/kube-manifests/ConfigMap-tempo-distributor.yaml @@ -1,7 +1,5 @@ apiVersion: v1 data: - overrides.yaml: | - overrides: {} tempo.yaml: | compactor: {} distributor: @@ -24,7 +22,7 @@ data: join_members: - gossip-ring.tracing.svc.cluster.local:7946 overrides: - per_tenant_override_config: /conf/overrides.yaml + per_tenant_override_config: /overrides/overrides.yaml server: http_listen_port: 3200 storage: diff --git a/operations/kube-manifests/ConfigMap-tempo-ingester.yaml b/operations/kube-manifests/ConfigMap-tempo-ingester.yaml index 779aa2596ca..ef07b2d6187 100644 --- a/operations/kube-manifests/ConfigMap-tempo-ingester.yaml +++ b/operations/kube-manifests/ConfigMap-tempo-ingester.yaml @@ -1,7 +1,5 @@ apiVersion: v1 data: - overrides.yaml: | - overrides: {} tempo.yaml: | compactor: {} distributor: {} @@ -15,7 +13,7 @@ data: join_members: - gossip-ring.tracing.svc.cluster.local:7946 overrides: - per_tenant_override_config: /conf/overrides.yaml + per_tenant_override_config: /overrides/overrides.yaml server: http_listen_port: 3200 storage: diff --git a/operations/kube-manifests/ConfigMap-tempo-overrides.yaml b/operations/kube-manifests/ConfigMap-tempo-overrides.yaml new file mode 100644 index 00000000000..0d04a4a0398 --- /dev/null +++ b/operations/kube-manifests/ConfigMap-tempo-overrides.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +data: + overrides.yaml: | + overrides: {} +kind: ConfigMap +metadata: + name: tempo-overrides + namespace: tracing diff --git a/operations/kube-manifests/ConfigMap-tempo-querier.yaml b/operations/kube-manifests/ConfigMap-tempo-querier.yaml index 8da4a4a5346..95ba2833038 100644 --- a/operations/kube-manifests/ConfigMap-tempo-querier.yaml +++ b/operations/kube-manifests/ConfigMap-tempo-querier.yaml @@ -13,7 +13,7 @@ data: join_members: - gossip-ring.tracing.svc.cluster.local:7946 overrides: - per_tenant_override_config: /conf/overrides.yaml + per_tenant_override_config: /overrides/overrides.yaml querier: frontend_worker: frontend_address: query-frontend-discovery.tracing.svc.cluster.local:9095 diff --git a/operations/kube-manifests/ConfigMap-tempo-query-frontend.yaml b/operations/kube-manifests/ConfigMap-tempo-query-frontend.yaml index 842054b5912..d4fcc21039b 100644 --- a/operations/kube-manifests/ConfigMap-tempo-query-frontend.yaml +++ b/operations/kube-manifests/ConfigMap-tempo-query-frontend.yaml @@ -13,7 +13,7 @@ data: join_members: - gossip-ring.tracing.svc.cluster.local:7946 overrides: - per_tenant_override_config: /conf/overrides.yaml + per_tenant_override_config: /overrides/overrides.yaml server: http_listen_port: 3200 storage: diff --git a/operations/kube-manifests/ConfigMap-tempo.yaml b/operations/kube-manifests/ConfigMap-tempo.yaml deleted file mode 100644 index 6ddd55e1930..00000000000 --- a/operations/kube-manifests/ConfigMap-tempo.yaml +++ /dev/null @@ -1,52 +0,0 @@ -apiVersion: v1 -data: - overrides.yaml: | - overrides: {} - tempo.yaml: | - compactor: null - distributor: - receivers: - jaeger: - protocols: - grpc: - endpoint: 0.0.0.0:14250 - otlp: - protocols: - grpc: - endpoint: 0.0.0.0:55680 - ingester: - lifecycler: - ring: - replication_factor: 3 - memberlist: - abort_if_cluster_join_fails: false - bind_port: 7946 - join_members: - - gossip-ring.tracing.svc.cluster.local:7946 - overrides: - per_tenant_override_config: /conf/overrides.yaml - server: - http_listen_port: 3200 - storage: - trace: - backend: gcs - blocklist_poll: "0" - cache: memcached - gcs: - bucket_name: tempo - chunk_buffer_size: 1.048576e+07 - memcached: - consistent_hash: true - host: memcached - service: memcached-client - timeout: 500ms - pool: - queue_depth: 2000 - s3: - bucket: tempo - wal: - path: /var/tempo/wal -kind: ConfigMap -metadata: - name: tempo - namespace: tracing diff --git a/operations/kube-manifests/Deployment-compactor.yaml b/operations/kube-manifests/Deployment-compactor.yaml index 44a87a70c2f..234118f36a4 100644 --- a/operations/kube-manifests/Deployment-compactor.yaml +++ b/operations/kube-manifests/Deployment-compactor.yaml @@ -13,12 +13,12 @@ spec: name: compactor strategy: rollingUpdate: - maxSurge: 0 - maxUnavailable: 1 + maxSurge: 50% + maxUnavailable: 100% template: metadata: annotations: - config_hash: 527bb84fb5ed28ab14bed73b2434e3dc + config_hash: 9e1f883a7a6ce95d5952bb119bdde93d labels: app: compactor name: compactor @@ -50,7 +50,12 @@ spec: volumeMounts: - mountPath: /conf name: tempo-conf + - mountPath: /overrides + name: overrides volumes: - configMap: name: tempo-compactor name: tempo-conf + - configMap: + name: tempo-overrides + name: overrides diff --git a/operations/kube-manifests/Deployment-distributor.yaml b/operations/kube-manifests/Deployment-distributor.yaml index cd6a2e78963..fec60240fec 100644 --- a/operations/kube-manifests/Deployment-distributor.yaml +++ b/operations/kube-manifests/Deployment-distributor.yaml @@ -19,7 +19,7 @@ spec: template: metadata: annotations: - config_hash: 74a9c5a46c39c13146cc518435f003d0 + config_hash: 3c0ba38c611e090f34119e99081a6c83 labels: app: distributor name: distributor @@ -52,8 +52,13 @@ spec: volumeMounts: - mountPath: /conf name: tempo-conf + - mountPath: /overrides + name: overrides terminationGracePeriodSeconds: 60 volumes: - configMap: name: tempo-distributor name: tempo-conf + - configMap: + name: tempo-overrides + name: overrides diff --git a/operations/kube-manifests/Deployment-querier.yaml b/operations/kube-manifests/Deployment-querier.yaml index 37a25992521..316d12666ef 100644 --- a/operations/kube-manifests/Deployment-querier.yaml +++ b/operations/kube-manifests/Deployment-querier.yaml @@ -19,7 +19,7 @@ spec: template: metadata: annotations: - config_hash: c83370e4a6c7e2eec54f5c49e5f88bea + config_hash: a1b5f8315434d8ce62f63fb8d5e132f0 labels: app: querier name: querier diff --git a/operations/kube-manifests/Deployment-query-frontend.yaml b/operations/kube-manifests/Deployment-query-frontend.yaml index 3e952e31372..fd5bc42b97d 100644 --- a/operations/kube-manifests/Deployment-query-frontend.yaml +++ b/operations/kube-manifests/Deployment-query-frontend.yaml @@ -18,7 +18,7 @@ spec: template: metadata: annotations: - config_hash: 0bf23ab3d6ba5b97313fcc0c4b845a33 + config_hash: 48de574bb668780f2434f8e3d827b9ef labels: app: query-frontend name: query-frontend @@ -54,9 +54,6 @@ spec: - --query.base-path=/tempo - --grpc-storage-plugin.configuration-file=/conf/tempo-query.yaml - --query.bearer-token-propagation=true - env: - - name: JAEGER_DISABLED - value: "true" image: grafana/tempo-query:latest imagePullPolicy: IfNotPresent name: tempo-query diff --git a/operations/kube-manifests/StatefulSet-ingester.yaml b/operations/kube-manifests/StatefulSet-ingester.yaml index 040b0ed1ff6..2a797967008 100644 --- a/operations/kube-manifests/StatefulSet-ingester.yaml +++ b/operations/kube-manifests/StatefulSet-ingester.yaml @@ -15,7 +15,7 @@ spec: template: metadata: annotations: - config_hash: 0bf23ab3d6ba5b97313fcc0c4b845a33 + config_hash: 48de574bb668780f2434f8e3d827b9ef labels: app: ingester name: ingester @@ -57,10 +57,15 @@ spec: name: tempo-conf - mountPath: /var/tempo name: ingester-data + - mountPath: /overrides + name: overrides volumes: - configMap: name: tempo-ingester name: tempo-conf + - configMap: + name: tempo-overrides + name: overrides updateStrategy: type: RollingUpdate volumeClaimTemplates: diff --git a/operations/kube-manifests/util/Makefile b/operations/kube-manifests/util/Makefile new file mode 100644 index 00000000000..21aad8d39fc --- /dev/null +++ b/operations/kube-manifests/util/Makefile @@ -0,0 +1,11 @@ +.PHONY: gen check + +gen: + jb update + tk export out/ example --format "{{.kind}}-{{or .metadata.name .metadata.generateName}}" + + cp out/*.yaml ../ + rm -r out/ + +check: gen + git diff --exit-code -- ../*.yaml diff --git a/operations/kube-manifests/util/README.md b/operations/kube-manifests/util/README.md index fe994394a4f..297f36a02e4 100644 --- a/operations/kube-manifests/util/README.md +++ b/operations/kube-manifests/util/README.md @@ -1,9 +1,9 @@ -To generate the manifests from this directory, run the following +# kube-manifests -``` -jb update +Example Kubernetes manifests to deploy Tempo distributed. -tk export out_dir generator --format "{{.kind}}-{{or .metadata.name .metadata.generateName}}" -``` +### Build -The manifests will be generated in the out_dir. \ No newline at end of file +To generate the manifests from this directory, run `make gen`. + +This requires [jsonnet-bundler](https://github.com/jsonnet-bundler/jsonnet-bundler) and [Tanka](https://tanka.dev/) to be installed. diff --git a/operations/kube-manifests/util/generator/main.jsonnet b/operations/kube-manifests/util/example/main.jsonnet similarity index 100% rename from operations/kube-manifests/util/generator/main.jsonnet rename to operations/kube-manifests/util/example/main.jsonnet diff --git a/operations/kube-manifests/util/generator/spec.json b/operations/kube-manifests/util/example/spec.json similarity index 100% rename from operations/kube-manifests/util/generator/spec.json rename to operations/kube-manifests/util/example/spec.json diff --git a/operations/kube-manifests/util/jsonnetfile.lock.json b/operations/kube-manifests/util/jsonnetfile.lock.json index 02ff19c66c3..714ac49fc6d 100644 --- a/operations/kube-manifests/util/jsonnetfile.lock.json +++ b/operations/kube-manifests/util/jsonnetfile.lock.json @@ -8,7 +8,7 @@ "subdir": "ksonnet-util" } }, - "version": "a20c679492aae363414dce23bc63da09cf8a7287", + "version": "bc9b685050691a78ee414cd8f789857de0eabe8d", "sum": "OxgtIWL4hjvG0xkMwUzZ7Yjs52zUhLhaVQpwHCbqf8A=" }, { @@ -18,7 +18,7 @@ "subdir": "memcached" } }, - "version": "a20c679492aae363414dce23bc63da09cf8a7287", + "version": "bc9b685050691a78ee414cd8f789857de0eabe8d", "sum": "dTOeEux3t9bYSqP2L/uCuLo/wUDpCKH4w+4OD9fePUk=" }, {