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

Implement multi-port Services #6182

Merged
merged 4 commits into from Mar 31, 2015
Merged

Conversation

thockin
Copy link
Member

@thockin thockin commented Mar 30, 2015

There are still a few things to do here, but it builds and passes unit tests.

While this is up for review I will do manual testing, finish last nits, and get an e2e run. As before, please focus on API, conversions, defaults - as these are most likely to go wrong, IMO.

@bgrant0607 bgrant0607 self-assigned this Mar 30, 2015
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please run hack/update-swagger-spec.sh

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done for next

@@ -750,6 +752,35 @@ type Service struct {

// Optional: Supports "ClientIP" and "None". Used to maintain session affinity.
SessionAffinity AffinityType `json:"sessionAffinity,omitempty" description:"enable client IP based session affinity; must be ClientIP or None; defaults to None"`

// Optional: Ports to expose on the service. If this field is
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, the long source comment isn't discoverable by users. I'd prefer to have any relevant details in the description.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

grammar rules? Are these full sentences?

@bgrant0607
Copy link
Member

Thanks a lot for plowing through this.

API LGTM, and a read through all the code LGTM, also.

Is there a snowball's chance we could quickly agree on a resolution to #4811?

Do you plan to punt multiple ports in other cloudproviders to later? I'd be fine with filing issues. In the meantime, errors for unsupported use cases would be nice if not too hard.

// Required: Supports "ClientIP" and "None". Used to maintain session affinity.
SessionAffinity AffinityType `json:"sessionAffinity,omitempty"`
}

type ServicePort struct {
// Optional if only one ServicePort is defined on this service: The
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, isn't the first port allowed to be nameless, regardless how many ports there are?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

most of the system won't differentiate whether it is the first port or not,
but validation enforces it.

On Mon, Mar 30, 2015 at 2:04 PM, Brian Grant notifications@github.com
wrote:

In pkg/api/types.go
#6182 (comment)
:

// Required: Supports "ClientIP" and "None".  Used to maintain session affinity.
SessionAffinity AffinityType `json:"sessionAffinity,omitempty"`

}

+type ServicePort struct {

  • // Optional if only one ServicePort is defined on this service: The

Technically, isn't the first port allowed to be nameless, regardless how
many ports there are?


Reply to this email directly or view it on GitHub
https://github.com/GoogleCloudPlatform/kubernetes/pull/6182/files#r27431745
.

@thockin
Copy link
Member Author

thockin commented Mar 30, 2015

I'll @ the people who own the other providers.

On Mon, Mar 30, 2015 at 2:02 PM, Brian Grant notifications@github.com
wrote:

Thanks a lot for plowing through this.

API LGTM, and a read through all the code LGTM, also.

Is there a snowball's chance we could quickly agree on a resolution to
#4811 #4811?

Do you plan to punt multiple ports in other cloudproviders to later? I'd
be fine with filing issues. In the meantime, errors for unsupported use
cases would be nice if not too hard.


Reply to this email directly or view it on GitHub
#6182 (comment)
.

@@ -515,7 +515,7 @@ func (lb *LoadBalancer) CreateTCPLoadBalancer(name, region string, externalIP ne

_, err = members.Create(lb.network, members.CreateOpts{
PoolID: pool.ID,
ProtocolPort: port,
ProtocolPort: ports[0], //FIXME: need to handle multi-port
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anguslees Could use advice on how to implement multi-port for openstack

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no multiport feature in OpenStack LBaaS - so we'll need to create a new VIP with a new Pool (and new Pool Members) for each port. Basically just put a loop around this function body.

Urgh, no it isn't that easy because then you won't have a 1:1 with k8s' LoadBalancer name and the OpenStack VIPs, which will break the other TCPLoadBalancer methods. Assign me a followon bug and I'll have to come up with something involving regexes and non-atomic operations :(

It looks to me like the GCE change above for this implements a port range - is this the intended multiport semantics, or just an easy implementation? (neither interpretation exists in OpenStack, just wondering which one I should implement)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GCE only supports a range. It's not ideal, but it works. If I were implementing I would do both. e.g. "80,443,8000-9000" :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll make this return an error for now. Thanks.

@@ -103,18 +135,50 @@
"description": "API at /api/v1beta1 version v1beta1",
"operations": [
{
"type": "v1beta1.EndpointsList",
"type": "*json.watchEvent",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like fallout from @smarterclayton's watch changes.

  1. watchEvent looks like a backdoor unversioned API type (from watch/json/types.go) that's not supposed to be public
  2. I'm not sure the * syntax works -- it may well break swagger validation, which currently passes
  3. We've lost documentation of the watch payload type

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I 'm not sure if/what you're asking me to do here :)

On Mon, Mar 30, 2015 at 5:17 PM, Brian Grant notifications@github.com
wrote:

In api/swagger-spec/v1beta1.json
#6182 (comment)
:

@@ -103,18 +135,50 @@
"description": "API at /api/v1beta1 version v1beta1",
"operations": [
{

  •  "type": "v1beta1.EndpointsList",
    
  •  "type": "*json.watchEvent",
    

Looks like fallout from @smarterclayton
https://github.com/smarterclayton's watch changes.

  1. watchEvent looks like a backdoor unversioned API type (from
    watch/json/types.go) that's not supposed to be public
  2. I'm not sure the * syntax works -- it may well break swagger
    validation, which currently passes
  3. We've lost documentation of the watch payload type


Reply to this email directly or view it on GitHub
https://github.com/GoogleCloudPlatform/kubernetes/pull/6182/files#r27444231
.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Mar 30, 2015, at 8:17 PM, Brian Grant notifications@github.com wrote:

In api/swagger-spec/v1beta1.json:

@@ -103,18 +135,50 @@
"description": "API at /api/v1beta1 version v1beta1",
"operations": [
{

  •  "type": "v1beta1.EndpointsList",
    
  •  "type": "*json.watchEvent",
    
    Looks like fallout from @smarterclayton's watch changes.

watchEvent looks like a backdoor unversioned API type (from watch/json/types.go) that's not supposed to be public
It's versioned, but we could not run conversion at the time it was created because of limitations in the underlying conversion method. It is the real object that you get when you watch. Probably can just create a type alias.

I'm not sure the * syntax works -- it may well break swagger validation, which currently passes
Type aliasing should clear that up.
We've lost documentation of the watch payload type
Technically... there are multiple watch payload types. Status and the local Kind. I'd err on the side of describing both.

Reply to this email directly or view it on GitHub.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll handle it.

On Mar 30, 2015, at 8:25 PM, Tim Hockin notifications@github.com wrote:

In api/swagger-spec/v1beta1.json:

@@ -103,18 +135,50 @@
"description": "API at /api/v1beta1 version v1beta1",
"operations": [
{

  •  "type": "v1beta1.EndpointsList",
    
  •  "type": "*json.watchEvent",
    
    I 'm not sure if/what you're asking me to do here :)


    Reply to this email directly or view it on GitHub.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spawned #6232 for this.

----- Original Message -----

@@ -103,18 +135,50 @@
"description": "API at /api/v1beta1 version v1beta1",
"operations": [
{

  •  "type": "v1beta1.EndpointsList",
    
  •  "type": "*json.watchEvent",
    

Looks like fallout from @smarterclayton's watch changes.

  1. watchEvent looks like a backdoor unversioned API type (from
    watch/json/types.go) that's not supposed to be public
  2. I'm not sure the * syntax works -- it may well break swagger validation,
    which currently passes
  3. We've lost documentation of the watch payload type

Reply to this email directly or view it on GitHub:
https://github.com/GoogleCloudPlatform/kubernetes/pull/6182/files#r27444231

@thockin thockin force-pushed the plural_services_20 branch 3 times, most recently from c0f90ff to d5be5dc Compare March 31, 2015 06:32
@bgrant0607 bgrant0607 changed the title WIP: Implement multi-port Services Implement multi-port Services Mar 31, 2015
@abonas
Copy link
Contributor

abonas commented Mar 31, 2015

@thockin this is breaking backwards comp of service entity, right? (just want to make sure we're on the same page)

@bgrant0607
Copy link
Member

@abonas Mostly this just breaks v1beta3 backwards compatibility.

@bgrant0607
Copy link
Member

LGTM

@bgrant0607 bgrant0607 added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 31, 2015
@thockin
Copy link
Member Author

thockin commented Mar 31, 2015

will need to rebase before merge, e2e is running now

@bgrant0607 bgrant0607 removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 31, 2015
@thockin
Copy link
Member Author

thockin commented Mar 31, 2015

e2e passed

@bgrant0607
Copy link
Member

Fire in the hole!

bgrant0607 added a commit that referenced this pull request Mar 31, 2015
@bgrant0607 bgrant0607 merged commit 3354cff into kubernetes:master Mar 31, 2015
@thockin
Copy link
Member Author

thockin commented Mar 31, 2015

probably should have squashed :)

name: "remove portal IP",
tweakSvc: func(oldSvc, newSvc *api.Service) {
oldSvc.Spec.PortalIP = "1.2.3.4"
newSvc.Spec.PortalIP = ""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Tim, I have a issue #5907 related to this part. newSvc.Spec.PortalIP = "" usually happens when portalIP is not given in the template. Since when creating a service not giving a portalIP means allow kubernetes automatically allocate one, I think we should keep this semantic while updating. That is use the system allocated one. For removing portalIP, if allowed later, we can use something like portalIP: None explicitly in the template. What do you think?

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

Successfully merging this pull request may close these issues.

None yet

7 participants