Skip to content

easy way to import apps into the OpenShift template library? #1629

Closed

Description

@jstrachan

we create lots of apps for running on OpenShift in each fabric8 release. Here's the source for them all if you want a look.

then each release ships with a zip of them all. e.g. the 2.0.39 release:
http://central.maven.org/maven2/io/fabric8/jube/images/fabric8/apps/2.0.39/

see the app.zip file which is a zip of all the apps; each app zip is a kube json + icon + readme etc.

in the fabric8 console you can drag and drop zip files into the console library; or drag and drop from the console to the desktop for a simple kind of "Apps Library" a little like your iTunes library for mobile apps.

It would be pretty handy for folks to be able to run all the fabric8 apps from inside the OpenShift console too; using the 'create template' stuff; we'd just need a way to be able to import the apps (templates) into OpenShift.

Is there an easy way to do such a thing; or can we add it?

We're encouraging java folks using Maven to reuse the same maven tooling to generate their own apps / app zips as well; so this tool would be reusable by customers & users too I should think.

Activity

  1. smarterclayton commented on Apr 8, 2015

    @smarterclayton
    Contributor

    I don't see why not. One way (maybe not the best way, but a possible way) is to do the following transformation:

    1. The name of the directory becomes a template name
    2. The body of the template is kubernetes.json (the "objects" field can be the config "items" field)
    3. Store the readme as the description (we should supported limited markdown in descriptions, or have a way to indicate the description is markdown)
    4. Store the app icon as a base64 encoded annotation, maybe as a data URI, named "openshift.io/icon-image" or similar on the template - the console should be able to then use it as a base64 url. Data URI is best because we can use it directly.
    5. Store other files as annotations if needed.

    Templates don't need to have parameters - seems like a good way to bundle them. If you change the build output to also generate the template.json (or generate a directory of json) someone could then osc create -f it all at once.

    The UI changes after that should be easy.

  2. jstrachan commented on Apr 8, 2015

    @jstrachan
    ContributorAuthor

    thanks @smarterclayton that sounds good to me. I'm a little nervous of the size of pod / RC json having icons in there by value rather than reference; I'd prefer a real URI path to icons but I guess thats a more long term optimisation. e.g. to avoid loading a 30k icon for every pod when you've lots of pods with the same icon.

    I'm gonna take a stab porting the fabric8 maven plugin that generates the kubernetes.json / app zips to generate an OpenShift template for each app.

    I wonder if we had, say, 20 templates is there gonna be an easy way to import them all into an OpenShift installation easily? I can certainly make a zip of them so they are easy to download/unpack at least; I guess they can be placed somewhere on the file system so the openshift master & console can find them?

  3. smarterclayton commented on Apr 8, 2015

    @smarterclayton
    Contributor

    On Apr 8, 2015, at 1:25 PM, James Strachan [email protected] wrote:

    thanks @smarterclayton that sounds good to me. I'm a little nervous of the size of pod / RC json having icons in there by value rather than reference; I'd prefer a real URI path to icons but I guess thats a more long term optimisation. e.g. to avoid loading a 30k icon for every pod when you've lots of pods with the same icon.

    Oh, I wasn't expecting to put that into the pod. We should be able to tie image repositories to icons maybe.
    I'm gonna take a stab porting the fabric8 maven plugin that generates the kubernetes.json / app zips to generate an OpenShift template for each app.

    I wonder if we had, say, 20 templates is there gonna be an easy way to import them all into an OpenShift installation easily? I can certainly make a zip of them so they are easy to download/unpack at least; I guess they can be placed somewhere on the file system so the openshift master & console can find them?

    Yeah, it should be a single command "osc create -f " which will bulk import all the files.
    —
    Reply to this email directly or view it on GitHub.

  4. jstrachan commented on Apr 8, 2015

    @jstrachan
    ContributorAuthor

    @smarterclayton oh you mean just annotate the template; but not annotate the pod / RC right? If so sure thats good ;)

    Am just wondering how we'd find the icon URL for a pod/RC/service; do kubernetes resources get annotated with the template ID?

  5. smarterclayton commented on Apr 8, 2015

    @smarterclayton
    Contributor

    We could annotate the service actually - that one seems like the natural fit. So the template itself could put the annotation on its services.

    On Apr 8, 2015, at 1:35 PM, James Strachan [email protected] wrote:

    @smarterclayton oh you mean just annotate the template; but not annotate the pod / RC right? If so sure thats good ;)

    Am just wondering how we'd find the icon URL for a pod/RC/service; do kubernetes resources get annotated with the template ID?

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

  6. jwforres commented on Apr 17, 2015

    @jwforres
    Member
  7. liggitt commented on May 9, 2015

    @liggitt
    Contributor

    one thing to be aware of is the size limit on annotations... 64k, I think

  8. smarterclayton commented on May 9, 2015

    @smarterclayton
    Contributor

    Total, across all values

    On May 8, 2015, at 9:44 PM, Jordan Liggitt [email protected] wrote:

    one thing to be aware of is the size limit on annotations... 64k, I think

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

  9. danmcp commented on May 11, 2015

    @danmcp

    Any remaining issues here?

  10. jstrachan commented on May 14, 2015

    @jstrachan
    ContributorAuthor

    I'm cool with annotating just the templates. What worries me is the 64k limit on annotations; that rules out lots of possible icons already; many PNG icons are over 30k before they get base64 encoded (and some are over 64k as binaries).

    I'm thinking we need a place to store icons out of band from the annotations then we can just use links in the annotations. I guess anyone can plugin in a microservice to do this at any time (we did this months ago with our app library in fabric8) but I'd love to have some standard canonical way for a template author or installer to put them and to minimise the number of moving pieces

  11. liggitt commented on May 14, 2015

    @liggitt
    Contributor

    we could allow putting an actual network URL in the icon annotation (it's a URL already, just a data: URL)... there were just implications we hadn't fully thought through, so we didn't enable that immediately:

    1. mixed-mode errors (or blocked icon loads) if the console is https and the url is http
    2. security implications of loading images from remote URLs specified in templates
  12. jstrachan commented on May 14, 2015

    @jstrachan
    ContributorAuthor

    @liggitt yeah, it feels like there should be a safe place we can put icons to avoid using remote URLs and so that it works nicely with OpenShift Routes so the URLs can be shared with browsers etc

  13. 5 remaining items

  14. mfojtik commented on May 18, 2015

    @mfojtik
    Contributor

    @liggitt @jstrachan @smarterclayton so to summarize here what have to be done:

    • Import icons provided by the URL (how to store them? wouldn't be easier to just have them as links to external locations in UI?
    • README as annotation... Isn't better to just link the README.md from the external location as well and fetch it in UI? The only drawback might be when OpenShift is behind proxy or firewall (which applies to the item above as well).
  15. jstrachan commented on May 18, 2015

    @jstrachan
    ContributorAuthor

    @mfojtik agreed. For public open source projects we can just link to docs and images on github. Thats not going to work too well for private on premise projects though; which may be behind a proxy/firewall or even not have internet access.

  16. jstrachan commented on May 22, 2015

    @jstrachan
    ContributorAuthor

    Incidentally the fabric8 maven fabric8:json goal now generates OpenShift templates with annotations for the documentation, summary and icon URL.

    We default to using a data URL for icons which base64 encoded are less than 40K (its configurable how big is too big); then for larger icons it tries to link to github (by default) to provide an external URL and you can configure it to specify the absolute URL or prefix relative to the source code etc. Ideally I'd still love some place within OpenShift to put the icons; but I guess thats gonna take a while to figure out.

    Then we've updated the hawtio-kubernetes console and the fabric8 console to query templates in a namespace and reuse any icons for a template on the apps, services, controllers and pods tabs.

    So whenever the OpenShift console starts to reuse views from hawtio-kubernetes we'll get nice per-pod/service/controller/app icons which really helps users grok what pods are what.

  17. jstrachan commented on May 22, 2015

    @jstrachan
    ContributorAuthor

    Am thinking we can close this issue now; thanks for all the feedback!

  18. jstrachan commented on Jun 10, 2015

    @jstrachan
    ContributorAuthor

    BTW we had to effectively disable the dataurls for fabric8 due to the 64k limit for OpenShift templates. The reason is we're composing various applications together into composite OpenShift templates which meant we needed to put multiple icons inside a single template (e.g. jenkins + nexus + gogs + sonarqube + gerrit in a CD template) and soon blew the 64k limit.

    So right now - unfortunately - we're having to rely on external links to the icons; referencing them from github; otherwise templates and apps stop being able to be composed into a template.

  19. mfojtik commented on Jun 10, 2015

    @mfojtik
    Contributor
  20. liggitt commented on Jun 10, 2015

    @liggitt
    Contributor

    Can you describe how you were adding multiple icons to a template? I thought the 64k limit was for the annotations on a particular object

  21. liggitt commented on Jun 10, 2015

    @liggitt
    Contributor

    Though I don't disagree that data: URI icons probably aren't what we want

  22. jstrachan commented on Jun 10, 2015

    @jstrachan
    ContributorAuthor

    @liggitt we're combining various RCs and services, as I described, into a single template; each resource typically needs its own icon (e.g. jenkins, nexus, gogs, sonarqube et al). Hence the need for multiple icons per template

  23. liggitt commented on Jun 10, 2015

    @liggitt
    Contributor

    Ok, looking at those examples, see a few issues:

    HTML in a description will not be rendered correctly by OpenShift (to prevent XSS):

    "description" : "Creates an instance of the <a href=\"http://fabric8.io/v2/console.html\">Fabric8 Console</a> for working with fabric8 and kubernetes.",
    

    What is consuming the iconUrl annotations?

  24. liggitt commented on Jun 10, 2015

    @liggitt
    Contributor

    OpenShift would only show a single icon per template, in the "icon" annotation

  25. jstrachan commented on Jun 10, 2015

    @jstrachan
    ContributorAuthor

    Right now the fabric8 console is using those icons to generate a nice UI; whether folks compose apps together into single templates or separate them:
    http://fabric8.io/guide/console.html

    its also implemented in the hawtio console for kubernetes too which hopefully one day will get integrated into the OpenShift console.

    If you have 1 icon per template; then either

    • you're gonna have to use the same icon for jenkins + nexus + gogs + sonarqube et al which sucks :)
    • force users to use lots of individual templates for everything (e.g. 1 for your database, 1 for your ElasticSearch, 1 for your web app etc)

    One of the nice things about templates is you can compose apps together into a single easy to install template.

    e.g. the entire fabric8 Continuous Deployment environment is a single openshift template for easy install

    I guess we could encourage users not to compose templates and just keep them really small; so a template only contains something that may have a different icon? Then just have lots and lots of templates. But that kinda breaks the 1 click deploy/run thing for composite apps.

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions