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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1,350 changes: 1,275 additions & 75 deletions api/swagger-spec/v1beta1.json

Large diffs are not rendered by default.

1,350 changes: 1,275 additions & 75 deletions api/swagger-spec/v1beta2.json

Large diffs are not rendered by default.

1,962 changes: 1,832 additions & 130 deletions api/swagger-spec/v1beta3.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ metadata:
kubernetes.io/cluster-service: "true"
name: monitoring-grafana
spec:
targetPort: 80
port: 80
ports:
- port: 80
targetPort: 80
selector:
name: influxGrafana
kubernetes.io/cluster-service: "true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ metadata:
kubernetes.io/cluster-service: "true"
name: monitoring-heapster
spec:
targetPort: 8082
port: 80
ports:
- port: 80
targetPort: 8082
selector:
name: heapster
kubernetes.io/cluster-service: "true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ metadata:
name: influxGrafana
name: monitoring-influxdb
spec:
targetPort: 8086
port: 80
ports:
- port: 80
targetPort: 8086
selector:
name: influxGrafana

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ metadata:
name: influxGrafana
name: monitoring-influxdb-ui
spec:
targetPort: 8083
port: 80
ports:
- port: 80
targetPort: 8083
selector:
name: influxGrafana

Expand Down
35 changes: 20 additions & 15 deletions cluster/addons/dns/kube2sky/kube2sky.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,27 @@ func addDNS(record string, service *kapi.Service, etcdClient *etcd.Client) error
return nil
}

svc := skymsg.Service{
Host: service.Spec.PortalIP,
Port: service.Spec.Port,
Priority: 10,
Weight: 10,
Ttl: 30,
}
b, err := json.Marshal(svc)
if err != nil {
return err
}
// Set with no TTL, and hope that kubernetes events are accurate.
for i := range service.Spec.Ports {
svc := skymsg.Service{
Host: service.Spec.PortalIP,
Port: service.Spec.Ports[i].Port,
Priority: 10,
Weight: 10,
Ttl: 30,
}
b, err := json.Marshal(svc)
if err != nil {
return err
}
// Set with no TTL, and hope that kubernetes events are accurate.

log.Printf("Setting dns record: %v -> %s:%d\n", record, service.Spec.PortalIP, service.Spec.Port)
_, err = etcdClient.Set(skymsg.Path(record), string(b), uint64(0))
return err
log.Printf("Setting DNS record: %v -> %s:%d\n", record, service.Spec.PortalIP, service.Spec.Ports[i].Port)
_, err = etcdClient.Set(skymsg.Path(record), string(b), uint64(0))
if err != nil {
return err
}
}
return nil
}

// Implements retry logic for arbitrary mutator. Crashes after retrying for
Expand Down
36 changes: 24 additions & 12 deletions cmd/integration/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,12 +465,14 @@ func runSelfLinkTestOnNamespace(c *client.Client, namespace string) {
},
},
Spec: api.ServiceSpec{
Port: 12345,
// This is here because validation requires it.
Selector: map[string]string{
"foo": "bar",
},
Protocol: "TCP",
Ports: []api.ServicePort{{
Port: 12345,
Protocol: "TCP",
}},
SessionAffinity: "None",
},
}
Expand Down Expand Up @@ -527,12 +529,14 @@ func runAtomicPutTest(c *client.Client) {
},
},
Spec: api.ServiceSpec{
Port: 12345,
// This is here because validation requires it.
Selector: map[string]string{
"foo": "bar",
},
Protocol: "TCP",
Ports: []api.ServicePort{{
Port: 12345,
Protocol: "TCP",
}},
SessionAffinity: "None",
},
}
Expand Down Expand Up @@ -606,12 +610,14 @@ func runPatchTest(c *client.Client) {
},
},
Spec: api.ServiceSpec{
Port: 12345,
// This is here because validation requires it.
Selector: map[string]string{
"foo": "bar",
},
Protocol: "TCP",
Ports: []api.ServicePort{{
Port: 12345,
Protocol: "TCP",
}},
SessionAffinity: "None",
},
}
Expand Down Expand Up @@ -747,8 +753,10 @@ func runServiceTest(client *client.Client) {
Selector: map[string]string{
"name": "thisisalonglabel",
},
Port: 8080,
Protocol: "TCP",
Ports: []api.ServicePort{{
Port: 8080,
Protocol: "TCP",
}},
SessionAffinity: "None",
},
}
Expand All @@ -764,8 +772,10 @@ func runServiceTest(client *client.Client) {
Selector: map[string]string{
"name": "thisisalonglabel",
},
Port: 8080,
Protocol: "TCP",
Ports: []api.ServicePort{{
Port: 8080,
Protocol: "TCP",
}},
SessionAffinity: "None",
},
}
Expand All @@ -784,8 +794,10 @@ func runServiceTest(client *client.Client) {
Selector: map[string]string{
"name": "thisisalonglabel",
},
Port: 8080,
Protocol: "TCP",
Ports: []api.ServicePort{{
Port: 8080,
Protocol: "TCP",
}},
SessionAffinity: "None",
},
}
Expand Down
12 changes: 8 additions & 4 deletions contrib/for-tests/network-tester/service.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@
}
},
"spec": {
"port": 8080,
"protocol": "TCP",
"ports": [
{
"port": 8080,
"protocol": "TCP",
"targetPort": 8080
}
],
"selector": {
"name": "nettest"
},
"targetPort": 8080,
}
}
}
5 changes: 3 additions & 2 deletions examples/cassandra/v1beta3/cassandra-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ metadata:
name: cassandra
name: cassandra
spec:
targetPort: 9042
port: 9042
ports:
- port: 9042
targetPort: 9042
selector:
name: cassandra
10 changes: 7 additions & 3 deletions examples/guestbook-go/v1beta3/guestbook-service.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@
}
},
"spec":{
"port":3000,
"containerPort":"http-server",
"protocol":"TCP",
"ports": [
{
"port":3000,
"targetPort":"http-server",
"protocol":"TCP"
}
],
"selector":{
"name":"guestbook"
}
Expand Down
10 changes: 7 additions & 3 deletions examples/guestbook-go/v1beta3/redis-master-service.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@
}
},
"spec":{
"port":6379,
"containerPort":"redis-server",
"protocol":"TCP",
"ports": [
{
"port":6379,
"targetPort":"redis-server",
"protocol":"TCP"
}
],
"selector":{
"name":"redis",
"role":"master"
Expand Down
10 changes: 7 additions & 3 deletions examples/guestbook-go/v1beta3/redis-slave-service.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@
}
},
"spec":{
"port":6379,
"containerPort":"redis-server",
"protocol":"TCP",
"ports": [
{
"port":6379,
"targetPort":"redis-server",
"protocol":"TCP"
}
],
"selector":{
"name":"redis",
"role":"slave"
Expand Down
10 changes: 7 additions & 3 deletions examples/guestbook/v1beta3/frontend-service.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@
}
},
"spec":{
"port":80,
"containerPort":80,
"protocol":"TCP",
"ports": [
{
"port":80,
"targetPort":80,
"protocol":"TCP"
}
],
"selector":{
"name":"frontend"
}
Expand Down
10 changes: 7 additions & 3 deletions examples/guestbook/v1beta3/redis-master-service.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@
}
},
"spec":{
"port":6379,
"containerPort":6379,
"protocol":"TCP",
"ports": [
{
"port":6379,
"targetPort":6379,
"protocol":"TCP"
}
],
"selector":{
"name":"redis-master"
}
Expand Down
10 changes: 7 additions & 3 deletions examples/guestbook/v1beta3/redis-slave-service.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@
}
},
"spec":{
"port":6379,
"containerPort":6379,
"protocol":"TCP",
"ports": [
{
"port":6379,
"targetPort":6379,
"protocol":"TCP"
}
],
"selector":{
"name":"redis-slave"
}
Expand Down
5 changes: 3 additions & 2 deletions examples/hazelcast/v1beta3/hazelcast-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ metadata:
name: hazelcast
name: hazelcast
spec:
targetPort: 5701
port: 5701
ports:
- port: 5701
targetPort: 5701
selector:
name: hazelcast
5 changes: 3 additions & 2 deletions examples/mysql-wordpress-pd/v1beta3/mysql-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ metadata:
name: mysql
name: mysql
spec:
targetPort: 3306
port: 3306
ports:
- port: 3306
targetPort: 3306
selector:
name: mysql

5 changes: 3 additions & 2 deletions examples/mysql-wordpress-pd/v1beta3/wordpress-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ metadata:
name: wpfrontend
name: wpfrontend
spec:
targetPort: 80
port: 80
ports:
- port: 80
targetPort: 80
selector:
name: wpfrontend

5 changes: 3 additions & 2 deletions examples/redis/v1beta3/redis-sentinel-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ metadata:
role: service
name: redis-sentinel
spec:
targetPort: 26379
port: 26379
ports:
- port: 26379
targetPort: 26379
selector:
redis-sentinel: "true"
5 changes: 3 additions & 2 deletions examples/rethinkdb/v1beta3/admin-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ metadata:
name: rethinkdb-admin
namespace: rethinkdb
spec:
targetPort: 8080
port: 8080
ports:
- port: 8080
targetPort: 8080
selector:
db: rethinkdb
role: admin
5 changes: 3 additions & 2 deletions examples/rethinkdb/v1beta3/driver-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ metadata:
name: rethinkdb-driver
namespace: rethinkdb
spec:
targetPort: 28015
port: 28015
ports:
- port: 28015
targetPort: 28015
selector:
db: rethinkdb