Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(helm): fixed ingress paths mapping #12932

Merged
merged 5 commits into from
May 10, 2024

Conversation

vlad-diachenko
Copy link
Contributor

@vlad-diachenko vlad-diachenko commented May 10, 2024

What this PR does / why we need it:

fix(helm): added mapping between Loki components and deployment modes to properly configure pure ingress when it's used without gateway/ngingx

Which issue(s) this PR fixes:
Fixes #12582

Special notes for your reviewer:

Ingress manifest for different modes:

deploymentMode: SingleBinary

# Source: loki/templates/ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: chart-name-loki
  namespace: gel
  labels:
    helm.sh/chart: loki-6.5.1
    app.kubernetes.io/name: loki
    app.kubernetes.io/instance: chart-name
    app.kubernetes.io/version: "3.0.0"
    app.kubernetes.io/managed-by: Helm
spec:
  rules:
    - host: "loki.example.com"
      http:
        paths:          
          - path: /api/prom/push
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki
                port:
                  number: 3100
          - path: /loki/api/v1/push
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki
                port:
                  number: 3100
          - path: /otlp/v1/logs
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki
                port:
                  number: 3100
          - path: /api/prom/query
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki
                port:
                  number: 3100
          - path: /api/prom/label
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki
                port:
                  number: 3100
          - path: /api/prom/series
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki
                port:
                  number: 3100
          - path: /api/prom/tail
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki
                port:
                  number: 3100
          - path: /loki/api/v1/query
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki
                port:
                  number: 3100
          - path: /loki/api/v1/query_range
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki
                port:
                  number: 3100
          - path: /loki/api/v1/tail
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki
                port:
                  number: 3100
          - path: /loki/api/v1/label
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki
                port:
                  number: 3100
          - path: /loki/api/v1/labels
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki
                port:
                  number: 3100
          - path: /loki/api/v1/series
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki
                port:
                  number: 3100
          - path: /loki/api/v1/index/stats
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki
                port:
                  number: 3100
          - path: /loki/api/v1/index/volume
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki
                port:
                  number: 3100
          - path: /loki/api/v1/index/volume_range
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki
                port:
                  number: 3100
          - path: /loki/api/v1/format_query
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki
                port:
                  number: 3100
          - path: /loki/api/v1/detected_fields
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki
                port:
                  number: 3100
          - path: /loki/api/v1/detected_labels
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki
                port:
                  number: 3100
          - path: /loki/api/v1/patterns
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki
                port:
                  number: 3100
          - path: /api/prom/rules
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki
                port:
                  number: 3100
          - path: /api/prom/api/v1/rules
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki
                port:
                  number: 3100
          - path: /api/prom/api/v1/alerts
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki
                port:
                  number: 3100
          - path: /loki/api/v1/rules
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki
                port:
                  number: 3100
          - path: /prometheus/api/v1/rules
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki
                port:
                  number: 3100
          - path: /prometheus/api/v1/alerts
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki
                port:
                  number: 3100

deploymentMode: SimpleScalable

---
# Source: loki/templates/ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: chart-name-loki
  namespace: gel
  labels:
    helm.sh/chart: loki-6.5.1
    app.kubernetes.io/name: loki
    app.kubernetes.io/instance: chart-name
    app.kubernetes.io/version: "3.0.0"
    app.kubernetes.io/managed-by: Helm
spec:
  rules:
    - host: "loki.example.com"
      http:
        paths:          
          - path: /api/prom/query
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /api/prom/label
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /api/prom/series
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /api/prom/tail
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /loki/api/v1/query
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /loki/api/v1/query_range
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /loki/api/v1/tail
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /loki/api/v1/label
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /loki/api/v1/labels
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /loki/api/v1/series
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /loki/api/v1/index/stats
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /loki/api/v1/index/volume
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /loki/api/v1/index/volume_range
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /loki/api/v1/format_query
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /loki/api/v1/detected_fields
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /loki/api/v1/detected_labels
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /loki/api/v1/patterns
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /api/prom/push
            pathType: Prefix
            backend:
              service:
                name: loki-write
                port:
                  number: 3100
          - path: /loki/api/v1/push
            pathType: Prefix
            backend:
              service:
                name: loki-write
                port:
                  number: 3100
          - path: /otlp/v1/logs
            pathType: Prefix
            backend:
              service:
                name: loki-write
                port:
                  number: 3100
          - path: /api/prom/rules
            pathType: Prefix
            backend:
              service:
                name: loki-backend
                port:
                  number: 3100
          - path: /api/prom/api/v1/rules
            pathType: Prefix
            backend:
              service:
                name: loki-backend
                port:
                  number: 3100
          - path: /api/prom/api/v1/alerts
            pathType: Prefix
            backend:
              service:
                name: loki-backend
                port:
                  number: 3100
          - path: /loki/api/v1/rules
            pathType: Prefix
            backend:
              service:
                name: loki-backend
                port:
                  number: 3100
          - path: /prometheus/api/v1/rules
            pathType: Prefix
            backend:
              service:
                name: loki-backend
                port:
                  number: 3100
          - path: /prometheus/api/v1/alerts
            pathType: Prefix
            backend:
              service:
                name: loki-backend
                port:
                  number: 3100

deploymentMode: Distributed

---
# Source: loki/templates/ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: chart-name-loki
  namespace: gel
  labels:
    helm.sh/chart: loki-6.5.2
    app.kubernetes.io/name: loki
    app.kubernetes.io/instance: chart-name
    app.kubernetes.io/version: "3.0.0"
    app.kubernetes.io/managed-by: Helm
spec:
  rules:
    - host: "loki.example.com"
      http:
        paths:          
          - path: /api/prom/push
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki-distributor
                port:
                  number: 3100
          - path: /loki/api/v1/push
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki-distributor
                port:
                  number: 3100
          - path: /otlp/v1/logs
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki-distributor
                port:
                  number: 3100
          - path: /api/prom/query
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki-query-frontend
                port:
                  number: 3100
          - path: /api/prom/label
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki-query-frontend
                port:
                  number: 3100
          - path: /api/prom/series
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki-query-frontend
                port:
                  number: 3100
          - path: /api/prom/tail
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki-query-frontend
                port:
                  number: 3100
          - path: /loki/api/v1/query
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki-query-frontend
                port:
                  number: 3100
          - path: /loki/api/v1/query_range
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki-query-frontend
                port:
                  number: 3100
          - path: /loki/api/v1/tail
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki-query-frontend
                port:
                  number: 3100
          - path: /loki/api/v1/label
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki-query-frontend
                port:
                  number: 3100
          - path: /loki/api/v1/labels
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki-query-frontend
                port:
                  number: 3100
          - path: /loki/api/v1/series
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki-query-frontend
                port:
                  number: 3100
          - path: /loki/api/v1/index/stats
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki-query-frontend
                port:
                  number: 3100
          - path: /loki/api/v1/index/volume
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki-query-frontend
                port:
                  number: 3100
          - path: /loki/api/v1/index/volume_range
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki-query-frontend
                port:
                  number: 3100
          - path: /loki/api/v1/format_query
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki-query-frontend
                port:
                  number: 3100
          - path: /loki/api/v1/detected_fields
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki-query-frontend
                port:
                  number: 3100
          - path: /loki/api/v1/detected_labels
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki-query-frontend
                port:
                  number: 3100
          - path: /loki/api/v1/patterns
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki-query-frontend
                port:
                  number: 3100
          - path: /api/prom/rules
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki-ruler
                port:
                  number: 3100
          - path: /api/prom/api/v1/rules
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki-ruler
                port:
                  number: 3100
          - path: /api/prom/api/v1/alerts
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki-ruler
                port:
                  number: 3100
          - path: /loki/api/v1/rules
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki-ruler
                port:
                  number: 3100
          - path: /prometheus/api/v1/rules
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki-ruler
                port:
                  number: 3100
          - path: /prometheus/api/v1/alerts
            pathType: Prefix
            backend:
              service:
                name: chart-name-loki-ruler
                port:
                  number: 3100

deploymentMode: SimpleScalable && read.legacyReadTarget: true

---
# Source: loki/templates/ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: chart-name-loki
  namespace: gel
  labels:
    helm.sh/chart: loki-6.5.1
    app.kubernetes.io/name: loki
    app.kubernetes.io/instance: chart-name
    app.kubernetes.io/version: "3.0.0"
    app.kubernetes.io/managed-by: Helm
spec:
  rules:
    - host: "loki.example.com"
      http:
        paths:          
          - path: /api/prom/query
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /api/prom/label
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /api/prom/series
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /api/prom/tail
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /loki/api/v1/query
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /loki/api/v1/query_range
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /loki/api/v1/tail
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /loki/api/v1/label
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /loki/api/v1/labels
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /loki/api/v1/series
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /loki/api/v1/index/stats
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /loki/api/v1/index/volume
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /loki/api/v1/index/volume_range
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /loki/api/v1/format_query
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /loki/api/v1/detected_fields
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /loki/api/v1/detected_labels
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /loki/api/v1/patterns
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /api/prom/rules
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /api/prom/api/v1/rules
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /api/prom/api/v1/alerts
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /loki/api/v1/rules
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /prometheus/api/v1/rules
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /prometheus/api/v1/alerts
            pathType: Prefix
            backend:
              service:
                name: loki-read
                port:
                  number: 3100
          - path: /api/prom/push
            pathType: Prefix
            backend:
              service:
                name: loki-write
                port:
                  number: 3100
          - path: /loki/api/v1/push
            pathType: Prefix
            backend:
              service:
                name: loki-write
                port:
                  number: 3100
          - path: /otlp/v1/logs
            pathType: Prefix
            backend:
              service:
                name: loki-write
                port:
                  number: 3100

Checklist

  • Reviewed the CONTRIBUTING.md guide (required)
  • Documentation added
  • Tests updated
  • Title matches the required conventional commits format, see here
    • Note that Promtail is considered to be feature complete, and future development for logs collection will be in Grafana Alloy. As such, feat PRs are unlikely to be accepted unless a case can be made for the feature actually being a bug fix to existing behavior.
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/setup/upgrade/_index.md
  • For Helm chart changes bump the Helm chart version in production/helm/loki/Chart.yaml and update production/helm/loki/CHANGELOG.md and production/helm/loki/README.md. Example PR
  • If the change is deprecating or removing a configuration option, update the deprecated-config.yaml and deleted-config.yaml files respectively in the tools/deprecated-config-checker directory. Example PR

… to properly configure pure ingress when it's used without gateway/ngingx

Signed-off-by: Vladyslav Diachenko <[email protected]>
@vlad-diachenko vlad-diachenko requested a review from a team as a code owner May 10, 2024 09:23
@vlad-diachenko vlad-diachenko added type/enhancement Something existing could be improved area/helm labels May 10, 2024
Signed-off-by: Vladyslav Diachenko <[email protected]>
@pull-request-size pull-request-size bot added size/L and removed size/M labels May 10, 2024
@github-actions github-actions bot added the type/docs Issues related to technical documentation; the Docs Squad uses this label across many repositories label May 10, 2024
Copy link
Contributor

@kavirajk kavirajk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not an helm chart expert. But changes looks reasonable to me. Thanks @vlad-diachenko for fixing it.

Approving to unblock

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/helm size/L type/docs Issues related to technical documentation; the Docs Squad uses this label across many repositories type/enhancement Something existing could be improved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

v3 helm chart doesn't support native ingress in distributed mode
3 participants