Skip to content

bug 1480988. Use project annotation to determine kibana url for ops namespaces #1968

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

Merged
merged 1 commit into from
Aug 29, 2017

Conversation

jcantrill
Copy link
Contributor

This PR provides a fix to BZ1480988 to direct users to an operations instance of Kibana when the logging stack is deployed to have the ops logging cluster. This PR depends on openshift/openshift-ansible#5219

@@ -401,6 +401,10 @@ angular.module('openshiftConsole')
return;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Spelling of metadata:context.project.metdata vs context.project.metadata.

So most of our annotations are on a filter that, unfortunately, is now pulled in via a dependency from origin-web-common. We should probably add it there...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@benjaminapetersen fixed the spelling

Copy link
Contributor

Choose a reason for hiding this comment

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

thanks! so by annotation, i mean making a PR here simply to add the line:

var annotationMap = {
  // truncated
  loggingKibanaUrl: ['openshift.io/logging.kibana.url']
}

And then when that PR merges, can update this PR to use the filter:

url = "https://" + $scope.context.project.metadata.annotations[$filter('annotationName')('loggingKibanaUrl')];

@jcantrill
Copy link
Contributor Author

Depends on openshift/origin-web-common/pull/158

@jcantrill jcantrill force-pushed the bz1480988_fix_ops_kibana branch from 75c2e92 to 8d1f6f2 Compare August 25, 2017 20:14
@@ -401,6 +401,10 @@ angular.module('openshiftConsole')
return;
}

if($scope.context.project.metadata.annotations[$filter('annotationName')('loggingVisualURL') {
url = 'https://' + $scope.context.project.metadata.annotations[$filter('annotationName')('loggingVisualURL');
}
Copy link
Member

@spadgett spadgett Aug 25, 2017

Choose a reason for hiding this comment

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

@jcantrill It would be better to change APIDiscovery.getLoggingURL to take the project as a parameter and move the logic there. Then if we need the logging URL anywhere else, we don't forget to check the project annotation.

I'd suggest this code:

var projectLoggingURL = $filter('annotation')($scope.context.project, 'loggingVisualURL');
if (projectLoggingURL) {
  url = 'https://' + projectLoggingURL;
}

@benjaminapetersen
Copy link
Contributor

@jcantrill grunt build & commit the dist as well & travis should pass.

@jcantrill jcantrill force-pushed the bz1480988_fix_ops_kibana branch 3 times, most recently from 370a48e to a7d19ac Compare August 28, 2017 19:57
@jcantrill
Copy link
Contributor Author

@spadgett Updated correctly?

getLoggingURL: function(project) {
if(project.metadata.annotations[$filter('annotationName')('loggingUIHostname')]) {
return 'https://' + project.metadata.annotations[$filter('annotationName')('loggingUIHostname')];
}
Copy link
Member

Choose a reason for hiding this comment

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

I think this is easier to read (untested)

var loggingUIHostname = $filter('annotation')(project, 'loggingUIHostname');
if (loggingUIHostname) {
  return 'https://' + loggingUIHostname;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agree.

@spadgett
Copy link
Member

Will require an origin-web-common release and dist files

@jcantrill jcantrill force-pushed the bz1480988_fix_ops_kibana branch from a7d19ac to b0abba9 Compare August 28, 2017 20:28
return {
// Simulate asynchronous requests for now. If these are ever updated to call to a discovery
// endpoint, we need to make sure to trigger a digest loop using (or update all callers).
getLoggingURL: function() {
getLoggingURL: function(project) {
loggingUIHostname = $filter('annotationName')(project, 'loggingUIHostname');
Copy link
Member

Choose a reason for hiding this comment

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

Missing var.

var loggingUIHostname = $filter('annotationName')(project, 'loggingUIHostname');

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

getLoggingURL: function(project) {
loggingUIHostname = $filter('annotationName')(project, 'loggingUIHostname');
if(loggingUIHostname) {
return 'https://' + loggingUIHostname;
Copy link
Member

Choose a reason for hiding this comment

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

Sorry @jcantrill missed this on last review, but this needs to be wrapped in a $q.when since the method returns a promise.

return $q.when('https://' + loggingUIHostname);

Or you can change it to have one return.

var loggingURL = LOGGING_URL;
var loggingUIHostname = $filter('annotationName')(project, 'loggingUIHostname');
if(loggingUIHostname) {
  loggingURL = 'https://' + loggingUIHostname;
}

return $q.when(loggingURL);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@jcantrill jcantrill force-pushed the bz1480988_fix_ops_kibana branch from b0abba9 to 707e723 Compare August 29, 2017 12:40
@jcantrill
Copy link
Contributor Author

@spadgett I made the requested changes but should I expect all the changes found in dist and dist.java ?

@spadgett
Copy link
Member

No, you shouldn't have that. Try

$ hack/clean-asssets.sh
$ hack/install-assets.sh
$ grunt build

@spadgett
Copy link
Member

@liggitt We post the user's access token to the logging URL. Just confirming that the annotation can only be changed by admins and that this is safe.

Copy link
Member

@spadgett spadgett left a comment

Choose a reason for hiding this comment

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

@jcantrill Can you make sure you've tested the changes? You should be able to add the annotation to the namespace manually if you need.

The origin-web-common change has merged if you rebase.

return $q.when(LOGGING_URL);
getLoggingURL: function(project) {
var loggingURL = LOGGING_URL;
var loggingUIHostname = $filter('annotationName')(project, 'loggingUIHostname');
Copy link
Member

Choose a reason for hiding this comment

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

$filter('annotation')

@jcantrill jcantrill force-pushed the bz1480988_fix_ops_kibana branch from 707e723 to bac757f Compare August 29, 2017 13:13
@jcantrill
Copy link
Contributor Author

@spadgett tested.... works like a champ...

@spadgett
Copy link
Member

[merge]

@openshift-bot
Copy link

Evaluated for origin web console merge up to bac757f

@spadgett
Copy link
Member

spadgett commented Aug 29, 2017

@jcantrill Looks like this needs to be rebased again :/

@openshift-bot
Copy link

openshift-bot commented Aug 29, 2017

Origin Web Console Merge Results: SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_request_origin_web_console/91/) (Base Commit: 72f8452) (PR Branch Commit: bac757f)

@openshift-bot openshift-bot merged commit 04d694f into openshift:master Aug 29, 2017
@jcantrill jcantrill deleted the bz1480988_fix_ops_kibana branch August 29, 2017 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants