Skip to content

build-logs for running build tells me "build not found" #1714

Closed

Description

@thoraxe
[root@ose3-master openshift-ansible]# osc get build -n sinatra
NAME                             TYPE      STATUS    POD
simple-openshift-sinatra-sti-1   STI       Running   simple-openshift-sinatra-sti-1
[root@ose3-master openshift-ansible]# osc build-logs -n sinatra simple-openshift-sinatra-sti-1
Error from server: Build: not found 'simple-openshift-sinatra-sti-1'
osc version
osc v0.4.3.1
kubernetes v0.14.1-582-gb12d75d

Activity

  1. added
    kind/bug
    on Apr 14, 2015
  2. added this to the 0.5.0 (beta3) milestone on Apr 14, 2015
  3. brenton commented on Apr 14, 2015

    @brenton
    Contributor

    @abhgupta, please excuse the noise. I thought this was a different issue.

    @bparees, any idea who could investigate this?

  4. bparees commented on Apr 14, 2015

    @bparees
    Contributor

    @Kargakis you've been in this space relatively recently, can you take a look?

  5. smarterclayton commented on Apr 14, 2015

    @smarterclayton
    Contributor

    This is a dupe of an existing issue, but started with the last rebase.

  6. 0xmichalis commented on Apr 14, 2015

    @0xmichalis
    Contributor

    @Kargakis you've been in this space relatively recently, can you take a look?

    Sure, will do tomorrow.

  7. 0xmichalis commented on Apr 15, 2015

    @0xmichalis
    Contributor

    Hmm, doesn't seem I can reproduce this in the current master neither with build-logs nor with start-build --follow

  8. smarterclayton commented on Apr 15, 2015

    @smarterclayton
    Contributor

    Try commenting out the set +e I added to test end to end.

    It looks like it happens after builds complete.

    On Apr 15, 2015, at 9:19 AM, Michail Kargakis [email protected] wrote:

    Hmm, doesn't seem I can reproduce this in the current master neither with build-logs nor with start-build --follow

    —
    Reply to this email directly or view it on GitHub.

  9. 0xmichalis commented on Apr 16, 2015

    @0xmichalis
    Contributor

    @thoraxe can you

    1. get the build-logs from a build in the default namespace?
    2. process a template in another namespace than default?
      eg.
    osc process -n test -f examples/sample-app/application-template-stibuild.json
  10. sdodson commented on Apr 16, 2015

    @sdodson
    Member

    Both the default and a created namespace works as 'system:openshift-client' user. I suspect this is a user permissoins issue, it doesn't work as 'joe' which is a user defined via htpasswd identity provider.

    Default namespace -- works

    osc process -f examples/sample-app/application-template-stibuild.json > test.json
    osc create -f test.json 
    osc get builds
    osc build-logs ruby-sample-build-1
    

    Make a new namespace, re-test -- works

    openshift admin new-project --admin=system:openshift-client issue1714
    osc create -n issue1714 -f test.json 
    osc get builds -n issue1714
    osc build-logs -n issue1714 ruby-sample-build-1
    

    Here it is as 'joe'

    [joe@ose3 ~]$ osc login
    Already logged into "https://ose3.os1.phx2.redhat.com:8443" as "joe".
    Using project "sinatra"
    [joe@ose3 ~]$ osc create -f test.json 
    services/frontend
    routes/route-edge
    imageStreams/origin-ruby-sample
    imageStreams/ruby-20-centos7
    buildConfigs/ruby-sample-build
    deploymentConfigs/frontend
    services/database
    deploymentConfigs/database
    [joe@ose3 ~]$ osc get builds
    NAME                             TYPE      STATUS     POD
    ruby-sample-build-1              STI       Running    ruby-sample-build-1
    simple-openshift-sinatra-sti-1   STI       Complete   simple-openshift-sinatra-sti-1
    [joe@ose3 ~]$ osc build-logs ruby-sample-build-1
    Error from server: "/osapi/v1beta1/proxy/buildLogs/ruby-sample-build-1?namespace=sinatra" is forbidden because joe cannot proxy on buildLogs with name "ruby-sample-build-1" in sinatra
    
  11. smarterclayton commented on Apr 16, 2015

    @smarterclayton
    Contributor

    @csrwng please get involved here as well

  12. csrwng commented on Apr 16, 2015

    @csrwng
    Contributor

    So the issue is that because we are now using the proxy to get at the build logs, we're exposing an issue in the Kubernetes proxy. It is responding with a 301 because the original request doesn't end with a "/" in the path, but the location in the 301 response doesn't include parameters that were passed in the original response, so we lose the namespace parameter:
    A request to

    https://10.0.2.15:8443/osapi/v1beta1/proxy/buildLogs/simple-openshift-sinatra-sti-1?namespace=project1
    

    results in a 301 like:

    HTTP/1.1 301 Moved Permanently
    Location: /osapi/v1beta1/proxy/buildLogs/simple-openshift-sinatra-sti-1/
    

    which doesn't include the namespace param.
    Offending code is here:
    https://github.com/GoogleCloudPlatform/kubernetes/blob/master/pkg/apiserver/proxy.go#L197-L201

    I'll submit a fix for the proxy upstream and switch the origin build logs to use the new log sub-resource.

  13. csrwng commented on Apr 17, 2015

    @csrwng
    Contributor

    Fixed with #1784

  14. brenton commented on Apr 20, 2015

    @brenton
    Contributor

    @csrwng, even after pulling in #1784 I'm seeing:

    # osc build-logs simple-openshift-sinatra-sti-1
    Error from server: "/osapi/v1beta1/proxy/buildLogs/simple-openshift-sinatra-sti-1?namespace=sinatra" is forbidden because joe cannot proxy on buildLogs with name "simple-openshift-sinatra-sti-1" in sinatra
    

    Joe is the admin for the sinatra project.

  15. brenton commented on Apr 20, 2015

    @brenton
    Contributor

    cesar explains the fix for me in more detail. It this actually working as expected with the known current issue of only the admin's being able to access logs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions