lgtm-tenant-client

by Spartan

Helm chartv0.1.3App 0.1.3

Shared tenant telemetry client for an LGTM stack receiver

About this chart

LGTM tenant client

The platform team owns this shared chart for sending tenant telemetry to an lgtm-stack receiver. It creates four objects in the configured namespace: ServiceAccount otlp-secrets, SecretStore otlp-secrets, ExternalSecret otlp-basic-auth and an OpenTelemetry Instrumentation.

Install the External Secrets Operator and OpenTelemetry Operator CRDs first. Create the application namespace beforehand. Use one IAM role per consumer. Trust exactly system:serviceaccount:<namespace>:otlp-secrets, with no wildcard. Allow only secretsmanager:GetSecretValue and secretsmanager:DescribeSecret on that one secret, plus kms:Decrypt on its customer-managed KMS key when one is used. Scope kms:Decrypt to that key ARN. Use lgtm/tenants/<tenant>-<env>/otlp-basic-auth with JSON keys username, password and htpasswd. The sender reads username and password; the gateway reads htpasswd from the same entry. Cross-account: the role lives in the cluster account. The secret's resource policy must allow that role. For a customer-managed KMS key, its key policy must also allow the role. The role's identity policy must grant kms:Decrypt scoped to that key ARN. The External Secrets Operator resolves credentials at runtime and produces the otlp-headers Secret key. No plaintext credentials are stored in chart values or rendered manifests. The default refresh is 1h. Apply a rotated value now with kubectl annotate externalsecret otlp-basic-auth -n <namespace> force-sync=<epoch> --overwrite.

Values

All defaults are empty strings except javaImage and headersSecretOptional. Every required value fails rendering with <key> is required when empty or missing.

KeyRequiredMeaning
namespaceYesExisting application namespace for all four objects.
tenantYesTenant id; required even when the instrumentation name is overridden.
regionYesAWS region of the Secrets Manager entry.
roleArnYesIAM role ARN used by the otlp-secrets service account.
secretNameYesSecrets Manager entry containing username and password.
receiverUrlYesOTLP HTTP receiver base URL, including its configured receiver path.
instrumentationNameNoInstrumentation name; defaults to the value of tenant.
headersSecretOptionalNoDefaults to true: the credential Secret reference is optional, so pods start before the ExternalSecret has created it. Exports return an auth error until the Secret exists. Set false to require it.
javaImageNoJava auto-instrumentation agent image, pinned by default. Set to an empty string to use the operator default.

Dev uses in-cluster port 4320 and path /<tenant>. Prod uses its own port and path /<tenant>/<env>, for example :4321/example/prod. Public receivers use the ingress host.

Example

Replace <account-id> and <region>. Supply values matching the platform receiver:

namespace: example-app
tenant: example
region: <region>
roleArn: arn:aws:iam::<account-id>:role/example-otlp-secrets
secretName: lgtm/tenants/example-dev/otlp-basic-auth
receiverUrl: http://alloy-gateway.monitoring.svc.cluster.local:4320/example

Install this chart with those values and configure the workload's operator injection annotation to reference the Instrumentation: instrumentation.opentelemetry.io/inject-<lang>: "<namespace>/<instrumentationName>". instrumentationName defaults to the value of tenant. For tenant example in namespace example-app, the annotation value is example-app/example. The chart does not annotate or restart application workloads.

Receiver contract

See Onboarding a tenant in the lgtm-stack README. The platform configures the tenant and receiver separately. Each receiver has its own port, credentials and namespace allowlist. The client credentials must match the receiver's htpasswd entry.

Receiver paths default to /<id>/<name>. A receiver may set path, for example /<id> for dev; legacy tenant receivers also use /<id>. Use the configured path when overridden. Direct signal endpoints have the form http://alloy-gateway.monitoring.svc.cluster.local:<port>/<id>/<name>/v1/{metrics,logs,traces}. Public receivers use the ingress host and the same signal suffixes. Set receiverUrl to the base URL including the receiver path, without the signal suffix.

Logs and spans must carry resource attribute k8s.namespace.name; the gateway drops them otherwise. With tenantIsolation.enabled: false on the stack, receivers forward only metrics and drop logs and traces. This chart does not configure the receiver, backend isolation, namespace labels or receiver credentials.

Deploy lgtm-tenant-client with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has lgtm-tenant-client on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartlgtm-tenant-client is pinned at v0.1.3 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply