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

RFE: choosing Service type #154

Closed
kadel opened this issue Sep 14, 2016 · 19 comments
Closed

RFE: choosing Service type #154

kadel opened this issue Sep 14, 2016 · 19 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature. priority/P1

Comments

@kadel
Copy link
Member

kadel commented Sep 14, 2016

When I'm using kompose up sometimes I need to change Service type.
Right now we generate services that are ClusterIP, but sometimes I want to have service exposed to outside of the cluster, than I have to manually change type and set it to LoadBalancer.

It would be nice to have a way to specify type of services.

Proposal:

Use image label in docker-compose.yml to set type of services.
By default we would still create ClusterIP services, but when there is a specific label we would create LoadBalancer

example:

version: "2"
services:
    backend:
        image: backend
        ports:
                - 3000:3000
    frontend:
        image: frontend
        ports:
                - 8080:8080
        environment:
                API_URL: http://backend:3000/api
        labels:
                kompose.service.public: True

we could use labels to specify Ingress/Route #140

@kadel kadel changed the title Service type RFE: choosing Service type Sep 14, 2016
@kadel kadel added enhancement kind/feature Categorizes issue or PR as related to a new feature. labels Sep 14, 2016
@dustymabe
Copy link
Contributor

Use image label in docker-compose.yml to set type of services.

+1. I wonder if we should make the labels kompose specific though. This would probably be a good thing for @pradeepto to weigh in on.

@ngtuna
Copy link
Contributor

ngtuna commented Sep 14, 2016

Otherwise, we can add --external flag ? I am also +1 for the kompose specific label.

@kadel
Copy link
Member Author

kadel commented Sep 14, 2016

I was also thinking about about doing this via cmd flag.
But downside of using flag is that you have to always remember to add that flag.

Benefit of doing it via label is that you do it only once. You edit file, commit it and than you can forget about it, and you have everything in one file.

Now when I'm thinking about it, this could be also in preference file.
Than we can avoid modifying original docker-compose.yml file.

it can be just list of public service names
and for Ingress we can extend it to hostnames

expose:
   - foo.bar.example.com=frontend # this will create Ingress/Route
   - frontend # this will create just LoadBalancer service

@surajssd
Copy link
Member

surajssd commented Sep 16, 2016

Or how about the user mentions in preference file something like this:

profiles:
  default:
    provider: kubernetes
    objects:
      - deployment
      - replicaset
      - ingress
current-context: default

And we can have rules defined internally like if ingress is given what will be the service type?

@kadel
Copy link
Member Author

kadel commented Sep 16, 2016

Ingress can be used with both ClusterIP or LoadBalancer.

@garethr
Copy link

garethr commented Sep 16, 2016

I hit the same issue today. Labels would work for my usecase. Namespacing them to kompose makes sense.

Note that labels should ideally be reverse DNS namespaced (see https://docs.docker.com/engine/userguide/labels-custom-metadata/), so (unless you also own a specific kompose domain) something like:

com.skippbox.kompose.{name of label}

@sebgoa
Copy link
Contributor

sebgoa commented Sep 26, 2016

while loadbalancer services are needed in prod, let's not forget about the dev use case who may want to create a nodeport.

@kadel
Copy link
Member Author

kadel commented Sep 26, 2016

Agreed, once we do this we should support all three Service types.

@sebgoa
Copy link
Contributor

sebgoa commented Sep 26, 2016

I like the use of labels for this.

@kadel
Copy link
Member Author

kadel commented Sep 26, 2016

OK, lets do this via labels.
Using labels to provide additional data for conversion will also solve my problem with #39 :-)

Now we just need to figure out proper namespace for kompose labels as @garethr mentioned ideally it should be reverse DNS

@procrypt
Copy link

procrypt commented Oct 3, 2016

@kadel Can I work on this issue if no one else is working on it.

@dustymabe
Copy link
Contributor

Can someone assign this issue to @procrypt ?

@sebgoa
Copy link
Contributor

sebgoa commented Oct 3, 2016

@procrypt I just sent you an invite, you need to accept so that we can assign you tickets.

@procrypt
Copy link

procrypt commented Oct 4, 2016

@sebgoa I have accepted the invite.

@g8d3
Copy link

g8d3 commented Dec 14, 2016

Is not clear for me, can I create an Ingress yet? using expose?

@sebgoa
Copy link
Contributor

sebgoa commented Dec 14, 2016

@juanpastas what do you mean by Ingress ?

If you mean an ingress rule (assuming you have an ingress controller running), the answer is no.

Every Docker service in the compose file gets exposed via a Kubernetes service. By default this service is of cluster IP type. If you want to automatically generate a nodeport or load balancer type service you can specify that using a label in your compose file.

@surajssd
Copy link
Member

@juanpastas you can have ingress created automatically for you once we have PR #285 merged

@g8d3
Copy link

g8d3 commented Dec 14, 2016

thanks @surajssd.

Do you know how is it possible to:

  • Create volumes with an specified size?
  • Delete old replica sets when using kubectl apply -f my.yml, I read that I need to specify deployment.spec.revisionHistoryLimit here, is this something kompose helps me with?

@kadel
Copy link
Member Author

kadel commented Jan 3, 2017

Hi @juanpastas, currently none of those are possible to change with kompose.

In future we might add something to allow specifying size of volumes.
If you want to change those you can use kompose convert and then edit files before deploying using kubectl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. priority/P1
Projects
None yet
Development

No branches or pull requests

8 participants