[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Looking for an API endpoint



When you run a PUT, you need to provide a few bits of metadata in your JSON that you are missing, and put the fields you sent into the "spec" field:

{
  "metadata":{
    "name":"testapp",
    "namsepace":"jskarbek"
  },
  "spec":{
    "dockerImageRepository": "...", 
    "tags": ...
   }
}

On Fri, Nov 6, 2015 at 8:28 AM, John Skarbek <jskarbek rallydev com> wrote:
So Andy,

I don't fully understand exactly what you mean.  But I started digging into this, and this is what I ended up trying out.  Unfortunately it doesn't work.  Can you lead me the right way? Or just tell me I'm doing it wrong :-)

My request to the api:

PUT /oapi/v1/namespaces/jskarbek/imagestreams/testapp?namespace=jskarbek&name=testapp HTTP/1.1
Authorization:  Bearer REDACTED
Content-Type: application/json
Host: the.fqdn:8443
Connection: close
Content-Length: 100

{"dockerImageRepository":"172.30.92.148:5000/jskarbek/testapp","tags":[{"tag":"latest","items":[]}]}


And the response:

HTTP/1.1 400 Bad Request
Cache-Control: no-store
Content-Type: application/json
Date: Fri, 06 Nov 2015 13:11:19 GMT
Content-Length: 213
Connection: close

{
  "kind": "Status",
  "apiVersion": "v1",
  "metadata": {},
  "status": "Failure",
  "message": "the name of the object () does not match the name on the URL (testapp)",
  "reason": "BadRequest",
  "code": 400
}

And here's the current imagestream when I do a GET request:
{
  "kind": "ImageStream",
  "apiVersion": "v1",
  "metadata": {
    "name": "testapp",
    "namespace": "jskarbek",
    "selfLink": "/oapi/v1/namespaces/jskarbek/imagestreams/testapp",
    "uid": "eb143ade-83da-11e5-81c2-005056b40c9e",
    "resourceVersion": "201051",
    "creationTimestamp": "2015-11-05T16:33:17Z",
    "labels": {
      "app": "testapp"
    }
  },
  "spec": {},
  "status": {
    "dockerImageRepository": "172.30.92.148:5000/jskarbek/testapp",
    "tags": [
      {
        "tag": "latest",
        "items": [
          {
            "created": "2015-11-05T16:36:25Z",
            "image": "sha256:04924073c1ac8b20a8042a842ca6b3fe2c722369711cffbeac1cf8096ad86715"
          },
          {
            "created": "2015-11-05T16:33:40Z",
            "image": "sha256:db265cfb0e693ea1a96b41333d5475690ca1a6472572c799b1ac936fb0344274"
          }
        ]
      }
    ]
  }
}

I assume at this point, trying to send an empty `items` list is what you were hinting me towards, but I'm struggling with implementing such.


On Thu, Nov 5, 2015 at 3:56 PM, Clayton Coleman <ccoleman redhat com> wrote:
That's what oc import-image does :)

On Thu, Nov 5, 2015 at 3:32 PM, Andy Goldstein <agoldste redhat com> wrote:
If that's all you want to do, just hit the master REST API with an updated ImageStream where metadata.annotations["openshift.io/image.dockerRepositoryCheck"] is removed, and that should trigger a reimport... right Clayton?

Andy

On Thu, Nov 5, 2015 at 3:28 PM, John Skarbek <jskarbek rallydev com> wrote:
So,

My imagination is quite the opposite, where instead of polling a registry, that we simply hit the api endpoint once which would trigger the import image command.  This would be something we'd roll into our CD pipeline.

I agree a polling mechanism for image streaming is not the best of ideas.  I think it'd be better to rely on notifications from a docker registry or some webhook for such.

On Thu, Nov 5, 2015 at 3:15 PM, Clayton Coleman <ccoleman redhat com> wrote:
The implementation would like be polling based (at least to start) - one concern we've had is whether that would end up being bad for the registries that we poll because we're hitting them frequently and asking whether they're out of date.

On Thu, Nov 5, 2015 at 2:30 PM, Michalis Kargakis <mkargaki redhat com> wrote:
Hi John,

not currently, but it's high in our priority list after 3.1 gets out of the door.

On Thu, Nov 5, 2015 at 8:10 PM, John Skarbek <jskarbek rallydev com> wrote:
Good Morning,

I'm looking at using image streams and an external docker registry for an application.  We've found the inconvenience of not have the built in registry and would like to know if there's an API endpoint we can hit that can kick off a deploy when the external registry receives a newly updated image?  The command that would occur via command line `oc import-image <imageStream>`




--

rally-logo-68x68.jpg

John T Skarbek | jskarbek rallydev com

Infrastructure Engineer, Engineering

1101 Haynes Street, Suite 105, Raleigh, NC 27604

720.921.8126 Office


_______________________________________________
users mailing list
users lists openshift redhat com
http://lists.openshift.redhat.com/openshiftmm/listinfo/users



_______________________________________________
users mailing list
users lists openshift redhat com
http://lists.openshift.redhat.com/openshiftmm/listinfo/users





--

rally-logo-68x68.jpg

John T Skarbek | jskarbek rallydev com

Infrastructure Engineer, Engineering

1101 Haynes Street, Suite 105, Raleigh, NC 27604

720.921.8126 Office


_______________________________________________
users mailing list
users lists openshift redhat com
http://lists.openshift.redhat.com/openshiftmm/listinfo/users






--

rally-logo-68x68.jpg

John T Skarbek | jskarbek rallydev com

Infrastructure Engineer, Engineering

1101 Haynes Street, Suite 105, Raleigh, NC 27604

720.921.8126 Office



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]