Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

how to use image stream with generated deployment #594

Open
dustymabe opened this issue Feb 16, 2018 · 6 comments
Open

how to use image stream with generated deployment #594

dustymabe opened this issue Feb 16, 2018 · 6 comments

Comments

@dustymabe
Copy link

if there happens to be an imagestream that already exists and I want to use it for a container that is part of my kedge.yaml file how do I do that? I was able to bring up a container that used the full name of the container to pull from a container registry, but what I'd really like is for a new deployment to get triggered when that image stream updates as well.

@surajnarwade
Copy link
Collaborator

You can use triggers. For ref: http://kedgeproject.org/file-reference/

@dustymabe
Copy link
Author

I did see that in the reference and I tried using it but I couldn't get it to work. Can you work through an example with me?

  • I have an already existing imagestream
  • I want to define a container in a pod to use that imagestream and to trigger a new deployment when the image changes (gets rebuilt).

Can you give me a full example of doing that?

@surajnarwade
Copy link
Collaborator

surajnarwade commented Feb 20, 2018

I did see that in the reference and I tried using it but I couldn't get it to work. Can you work through an example with me?

Sure :)

Here's my example,

I already have imagestream:

imageStreams:
- tags:
  - from:
      kind: DockerImage
      name: surajnarwade/ex-1:0.1
    name: "0.1"

and my kedgefile will look like this:

name: webapp
deploymentConfigs:
- containers:
  - image: ""
  triggers:
  - imageChangeParams:
      automatic: true
      containerNames:
      - webapp
      from:
        kind: ImageStreamTag
        name: webapp:0.1
    type: ImageChange
services:
- portMappings:
  - "5000"

When I update imagestream using,

oc import-image webapp:0.1

My deploymentconfig gets automatically updated.

Does this solve your query ? @dustymabe

@surajnarwade
Copy link
Collaborator

if you check image under deploymentconfig > containers > image, it is blank string

@kadel
Copy link
Member

kadel commented Feb 20, 2018

I want to define a container in a pod to use that imagestream and to trigger a new deployment when the image changes (gets rebuilt).

that is possible but only with internal openshift registry. That means you have to push your image to openshift images stream. It is not possible to do it with the external registry.

@dustymabe
Copy link
Author

that is possible but only with internal openshift registry. That means you have to push your image to openshift images stream. It is not possible to do it with the external registry.

yep. I understand that much :)

@surajnarwade - thanks for the example. I was able to use your example and get something working:

name: foo

deploymentConfigs:
  - containers:
    - image: ""
      envFrom:
      - secretRef:
          name: pagure-token-2
    triggers:
    - imageChangeParams:
        automatic: true
        containerNames:
        - foo
        from:
          kind: ImageStreamTag
          name: failed-composes-img:latest
      type: ImageChange
secrets:
  - name: pagure-token-2
    data:
      PAGURE_TOKEN: 'aaaa'

I guess my problem with the docs is it never shows an example like this. It shows them under buildConfigObject, and I tried to use them but I had them at the wrong indentation or something. Maybe use this issue as a request for a docs example for this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants