Skip to content
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

Don't hard code openshift/k8s things in the apb-base #60

Open
flaper87 opened this issue Jun 26, 2017 · 9 comments
Open

Don't hard code openshift/k8s things in the apb-base #60

flaper87 opened this issue Jun 26, 2017 · 9 comments

Comments

@flaper87
Copy link

apb-base assumes the APB will talk to either OpenShift or Kubernetes. It should not attempt to login to the cluster.

Ideally, there should be 2 base APB. The first one is the actual base with the entrypoint script and the second one should add the oc-login.sh call.

@jwmatthews
Copy link
Member

@flaper87 please add a little more context

What do you suggest the usage is for the 2 base APB images?
Are you looking to handle differences of K8S vs OCP, or something else?

Thank you,

@flaper87
Copy link
Author

@jwmatthews sure, sorry for the lack of context in the description.

There are 2 things, really. The first one is handled differences between k8s and OCP but the one that I'm more interested in is being able to use APBs to provision/deprovision apps on other COEs other than k8s and OCP. I've created a small APB that can be used as an init container on docker to install other apps.

I guess my goal would be to make APB's API not k8s/OCP centric if possible and rather have specific base images for those cases.

apb-base
     |
     | ------- ap-base-k8s
     | ------- ap-base-ocp

Does this make sense?

@rthallisey
Copy link
Contributor

rthallisey commented Jun 26, 2017

Hey @flaper87. I agree with your proposal. But right now, the broker is not cluster agnostic and it's something we hope to implement. I think the first pass at this will be to broaden support to add Kubernetes as a target. After that, we can consider adding more COEs if folks have a use case for them. Here's an issue in the broker outlining the work required to add Kubernetes support openshift/ansible-service-broker#233.

@jwmatthews
Copy link
Member

@flaper87 thank you, that information helps.

@flaper87
Copy link
Author

@rthallisey makes sense to me. Do you think we can start by splitting the base image into 2 images? Once the ASB feature is implemented, we can then make the COE image agnostic.

I can help with the former if y'all agree.

@rthallisey
Copy link
Contributor

@flaper87 Sure. Let's start with a discussion on how we want to do this because I think it can be done a few different ways:

  • Create dockerfiles for apb-base-k8s & apb-base-oc
  • Template the apb-base Dockerfile
  • A directory per COE

cc @eriknelson @jmrodri @fabianvf @jmontleon

@eriknelson
Copy link

@flaper87 Thanks for your contribution!

Is the suggestion there should be a single agnostic base image, and then individual apbs that are cluster specific, I.E. postgres-apb-k8s, postgres-apb-openshift?

The broker is going to need branches of logic specific to each flavor. To do this right, we need to encapsulate cluster specific logic behind an interface and abstract it away. Call the interface ApbRunner, or something similar. APB's indicate (apb.yml makes sense) what flavor of "ApbRunner" it wants. Scratch thoughts:

// Create appropriate runner for spec
var runner ApbRunner = RunnerFactory.Create(&spec)
runner.ExecuteApb()

Lets us write as many runners as we'd like to support in a runner package, or whatever we end up calling it.

Anyone take issue with having cluster specific apbs aside from the obviously having to manage a bunch of different apbs floating around?

@flaper87
Copy link
Author

flaper87 commented Jun 26, 2017

Is the suggestion there should be a single agnostic base image, and then individual apbs that are cluster specific, I.E. postgres-apb-k8s, postgres-apb-openshift?

Yes. I'm not sure what the best way to implement this is, though. My suggestion was to have 2 base images. The first one creates the user, adds the base entrypoint and a few cluster agnostic operations. On top of that one, we could have a Kubernetes one, an OpenShift one (or one that is generic for both) or simply have an APB created on top of the the generic top image.

Here are some examples:

I'd like to be able to build the second APB without any k8s/openshift specific dependencies.

@eriknelson
Copy link

My suggestion was to have 2 base images. The first one creates the user, adds the base entrypoint and a few cluster agnostic operations. On top of that one, we could have a Kubernetes one, an OpenShift one (or one that is generic for both) or simply have an APB created on top of the the generic top image.

Sounds reasonable to me. Truthfully, the broker has been designed with the expectation there's some kind of orchestration engine available, not vanilla docker. I don't see a technical reason we can't support this in the broker if we move towards an agnostic runner design.

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

No branches or pull requests

4 participants