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 missing datasource issue on pod restart #1358

Merged
merged 3 commits into from
Nov 15, 2024

Conversation

khansaad
Copy link
Contributor

@khansaad khansaad commented Nov 5, 2024

Description

This PR fixes the issue with datasource which is causing a missing or invalid datasource exception. Details for the same are mentioned in Issue 1356

Fixes 1356

Type of change

  • Bug fix
  • New feature
  • Docs update
  • Breaking change (What changes might users need to make in their application due to this PR?)
  • Requires DB changes

How has this been tested?

Please describe the tests that were run to verify your changes and steps to reproduce. Please specify any test configuration required.

  • New Test X
  • Functional testsuite

Test Configuration

  • Kubernetes clusters tested on: Openshift

Checklist 🎯

  • Followed coding guidelines
  • Comments added
  • Dependent changes merged
  • Documentation updated
  • Tests added or updated

Additional information

Include any additional information such as links, test results, screenshots here

@khansaad khansaad added the bug Something isn't working label Nov 5, 2024
@khansaad khansaad added this to the Kruize 0.2 Release milestone Nov 5, 2024
@khansaad khansaad self-assigned this Nov 5, 2024
@khansaad khansaad changed the base branch from master to mvp_demo November 5, 2024 09:23
@chandrams
Copy link
Contributor

@khansaad - I still see the issue, Is this working for you?

@@ -144,6 +144,10 @@ public void addDataSourcesFromConfigFile(String configFileName) {
DataSourceInfo dataSourceInfo = new ExperimentDBService().loadDataSourceFromDBByName(name);
if (null != dataSourceInfo) {
LOGGER.error("Datasource: {} already exists!", name);
// add the auth details to local object
AuthenticationConfig authConfig = getAuthenticationDetails(dataSourceObject, name);
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to check if getAuthenticationConfig() will retun null
if so then do setAuthenticationConfig() ?

Copy link
Contributor Author

@khansaad khansaad Nov 11, 2024

Choose a reason for hiding this comment

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

We don't need that because in case of missing auth, getAuthenticationDetails() will return the default auth i.e. noAuth

Reference:

authConfig = AuthenticationConfig.noAuth();

@khansaad
Copy link
Contributor Author

@khansaad - I still see the issue, Is this working for you?

@chandrams Looks like you're not passing the datasource name in the bulk API demo. In that case, the code takes the default datasource name as prometheus-1 . So, when you're running it with thanos , it's giving you the invalid datasource error which is expected.

I have updated the error message now to indicate the datasource name passed.

@chandrams
Copy link
Contributor

@khansaad - I still see the issue, Is this working for you?

@chandrams Looks like you're not passing the datasource name in the bulk API demo. In that case, the code takes the default datasource name as prometheus-1 . So, when you're running it with thanos , it's giving you the invalid datasource error which is expected.

I have updated the error message now to indicate the datasource name passed.

I have tested with the below in the manifest file:

 "datasource": [
        {
          "name": "thanos",
          "provider": "prometheus",
          "serviceName": "",
          "namespace": "",
          "url": "http://thanos-query-frontend.thanos-bench.svc.cluster.local:9090/",
          "authentication": {
            "type": "bearer",
            "credentials": {
              "tokenFilePath": "/var/run/secrets/kubernetes.io/serviceaccount/token"
            }
          }
        }
      ]

@chandrams
Copy link
Contributor

I have included datasource in the bulk config, with this I don't see the invalid datasource issue.

Copy link
Contributor

@msvinaykumar msvinaykumar left a comment

Choose a reason for hiding this comment

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

LGTM

@msvinaykumar
Copy link
Contributor

@khansaad if required please feel free add negative testcases

Signed-off-by: Saad Khan <[email protected]>
Copy link
Contributor

@dinogun dinogun left a comment

Choose a reason for hiding this comment

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

LGTM

@dinogun dinogun merged commit 4bd9baa into kruize:mvp_demo Nov 15, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working remote_monitoring
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Datasource is either missing or is invalid error with Bulk demo with thanos datasource
5 participants