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

[BUG]When accessing imported Harvester in Rancher, Grafana metrics don't work correctly #4087

Closed
DaiYuzeng opened this issue Jun 15, 2023 · 5 comments
Assignees
Labels
area/backend kind/bug Issues that are defects reported by users or that we know have reached a real release not-require/test-plan Skip to create a e2e automation test issue priority/0 Must be fixed in this release reproduce/always Reproducible 100% of the time require-ui/small estimate 1-2 working days severity/needed Reminder to add a severity label and to remove this one
Milestone

Comments

@DaiYuzeng
Copy link

Describe the bug

To Reproduce
Steps to reproduce the behavior:
Preparation:

  1. Go to Rancher.
  2. Go to import existing Harvester cluster.
  3. Access Harvester cluster.
  4. Go to Harvester Dashboard page.
  5. Grafana metrics display page not found

Expected behavior

The grafana metrics of the imported Harvester cluster should be displayed.

Support bundle

Environment

  • Harvester ISO version:
  • Underlying Infrastructure (e.g. Baremetal with Dell PowerEdge R630):

Additional context
Add any other context about the problem here.

@DaiYuzeng DaiYuzeng added area/backend kind/bug Issues that are defects reported by users or that we know have reached a real release not-require/test-plan Skip to create a e2e automation test issue reproduce/always Reproducible 100% of the time require-ui/small estimate 1-2 working days severity/needed Reminder to add a severity label and to remove this one labels Jun 15, 2023
@DaiYuzeng DaiYuzeng added this to the v1.2.0 milestone Jun 15, 2023
@w13915984028
Copy link
Member

w13915984028 commented Jun 15, 2023

The appSubUrl changes from 100.1.1+up19.0.3 to 102.0.0+up40.1.2 to 102.0.1+up40.1.2

/go/src/github.com/rancher/charts/charts/rancher-monitoring/100.1.1+up19.0.3$ 
charts/grafana/templates/nginx-config.yaml:          

         sub_filter '"appSubUrl":""' '"appSubUrl":"."';

/go/src/github.com/rancher/charts/charts/rancher-monitoring/102.0.0+up40.1.2$
charts/grafana/templates/nginx-config.yaml:          

         sub_filter '"appSubUrl":""' '"appSubUrl":"/k8s/clusters/{{ .Values.global.cattle.clusterId }}/api/v1/namespaces/{{ template "grafana.namespace" . }}/services/http:{{ template "grafana.fullname" . }}:{{ .Values.service.port }}/proxy"';

/go/src/github.com/rancher/charts/charts/rancher-monitoring/102.0.1+up40.1.2$ 
charts/grafana/templates/nginx-config.yaml:          

         {{- if eq .Values.global.cattle.clusterId "local" -}}
         sub_filter '"appSubUrl":""' '"appSubUrl":"/api/v1/namespaces/{{ template "grafana.namespace" . }}/services/http:{{ template "grafana.fullname" . }}:{{ .Values.service.port }}/proxy"';
         {{- else -}}
         sub_filter '"appSubUrl":""' '"appSubUrl":"/k8s/clusters/{{ .Values.global.cattle.clusterId }}/api/v1/namespaces/{{ template "grafana.namespace" . }}/services/http:{{ template "grafana.fullname" . }}:{{ .Values.service.port }}/proxy"';
         {{- end -}}

The previous issue #3780 and PR harvester/harvester-installer#492. Can work for local mode, but not for multi-cluster mode.

@w13915984028
Copy link
Member

w13915984028 commented Jun 15, 2023

But there is a limitation:

The Values.global.cattle.clusterId will decide the value of appSubUrl in a configMap, one cluster can only have one role.

This is OK, when the chart is installed in an Rancher downstream cluster.

But it does not work well for Harvester.

When Harvester is accessed directly, the role is local.

When Harvester is imported into Rancher and accessed from Rancher , the role is a cluster, named like c-m-75b2hnlw.

The UI needs to deal with those 2 scenarios.

The backend fix harvester/harvester-installer#512, is utilizing the nginx customization:.

@w13915984028
Copy link
Member

@WuJun2016 @DaiYuzeng

With the fix, there is still one issue, if we click grafana from Rancher->Harvester, the newly opened window, has no Referer field, thus the backend does not know where it comes from. Please take a look, if UI can add this field when click the link.

When we refresh the Harvester dashboard, there always has an Referer on grafana related request.

image

image

@harvesterhci-io-github-bot
Copy link

harvesterhci-io-github-bot commented Jun 16, 2023

Pre Ready-For-Testing Checklist

  • [ ] If labeled: require/HEP Has the Harvester Enhancement Proposal PR submitted?
    The HEP PR is at:

  • Where is the reproduce steps/test steps documented?
    The reproduce steps/test steps are at: fix grafana dashboard 404 issue harvester-installer#512 (comment)

  • [ ] Is there a workaround for the issue? If so, where is it documented?
    The workaround is at:

  • Have the backend code been merged (harvester, harvester-installer, etc) (including backport-needed/*)?
    The PR is at: fix grafana dashboard 404 issue harvester-installer#512 (comment)

    • Does the PR include the explanation for the fix or the feature?

    • Does the PR include deployment change (YAML/Chart)? If so, where are the PRs for both YAML file and Chart?
      The PR for the YAML change is at:
      The PR for the chart change is at:

  • If labeled: area/ui Has the UI issue filed or ready to be merged?
    The UI issue/PR is at:

  • [ ] If labeled: require/doc, require/knowledge-base Has the necessary document PR submitted or merged?
    The documentation/KB PR is at:
  • If NOT labeled: not-require/test-plan Has the e2e test plan been merged? Have QAs agreed on the automation test case? If only test case skeleton w/o implementation, have you created an implementation issue?

    • The automation skeleton PR is at:
    • The automation test case PR is at:
  • If the fix introduces the code for backward compatibility Has a separate issue been filed with the label release/obsolete-compatibility?
    The compatibility issue is filed at:

@noahgildersleeve
Copy link

noahgildersleeve commented Jun 23, 2023

Tested in Harvester master-173b0824-head and Rancher v2.7.5-rc5 with single node Docker instance. Verified that Grafana was showing up on both dashboard and in Grafana dashboard.

Screenshot_20230622_195245
Screenshot_20230622_195239

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/backend kind/bug Issues that are defects reported by users or that we know have reached a real release not-require/test-plan Skip to create a e2e automation test issue priority/0 Must be fixed in this release reproduce/always Reproducible 100% of the time require-ui/small estimate 1-2 working days severity/needed Reminder to add a severity label and to remove this one
Projects
None yet
Development

No branches or pull requests

5 participants