-
Notifications
You must be signed in to change notification settings - Fork 232
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
bug 1480988. Use project annotation to determine kibana url for ops namespaces #1968
Conversation
app/scripts/directives/logViewer.js
Outdated
@@ -401,6 +401,10 @@ angular.module('openshiftConsole') | |||
return; | |||
} | |||
|
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@benjaminapetersen fixed the spelling
There was a problem hiding this comment.
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')];
Depends on openshift/origin-web-common/pull/158 |
75c2e92
to
8d1f6f2
Compare
app/scripts/directives/logViewer.js
Outdated
@@ -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'); | |||
} |
There was a problem hiding this comment.
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;
}
@jcantrill |
370a48e
to
a7d19ac
Compare
@spadgett Updated correctly? |
app/scripts/services/discovery.js
Outdated
getLoggingURL: function(project) { | ||
if(project.metadata.annotations[$filter('annotationName')('loggingUIHostname')]) { | ||
return 'https://' + project.metadata.annotations[$filter('annotationName')('loggingUIHostname')]; | ||
} |
There was a problem hiding this comment.
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;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree.
Will require an origin-web-common release and |
a7d19ac
to
b0abba9
Compare
app/scripts/services/discovery.js
Outdated
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'); |
There was a problem hiding this comment.
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');
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
app/scripts/services/discovery.js
Outdated
getLoggingURL: function(project) { | ||
loggingUIHostname = $filter('annotationName')(project, 'loggingUIHostname'); | ||
if(loggingUIHostname) { | ||
return 'https://' + loggingUIHostname; |
There was a problem hiding this comment.
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);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
b0abba9
to
707e723
Compare
@spadgett I made the requested changes but should I expect all the changes found in dist and dist.java ? |
No, you shouldn't have that. Try
|
@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. |
There was a problem hiding this 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.
app/scripts/services/discovery.js
Outdated
return $q.when(LOGGING_URL); | ||
getLoggingURL: function(project) { | ||
var loggingURL = LOGGING_URL; | ||
var loggingUIHostname = $filter('annotationName')(project, 'loggingUIHostname'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$filter('annotation')
707e723
to
bac757f
Compare
@spadgett tested.... works like a champ... |
[merge] |
Evaluated for origin web console merge up to bac757f |
@jcantrill Looks like this needs to be rebased again :/ |
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) |
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