Skip to content

Commit

Permalink
Flatten Upstream API, removing upstreamSpec and bringing all its fiel…
Browse files Browse the repository at this point in the history
…ds to the top-level Upstream (#1697)

* Flatten Upstream API, removing upstreamSpec and bringing all its fields to the top-level Upstream
* unnest benchmark json
* Move changelogs to 1.0.0
* move releaseStableApi key to toplevel
  • Loading branch information
GrahamGoudeau authored and soloio-bulldozer[bot] committed Nov 14, 2019
1 parent ee29b68 commit 3c863d9
Show file tree
Hide file tree
Showing 133 changed files with 13,185 additions and 14,593 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions changelog/v1.0.0/upstream-spec-removal.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
changelog:
- type: BREAKING_CHANGE
description: >
Refactor the Upstream API to remove the `upstreamSpec` field, bringing all the fields
contained in `upstreamSpec` up one level to the top-level Upstream.
issueLink: https://github.com/solo-io/gloo/issues/1171
releaseStableApi: true
63 changes: 30 additions & 33 deletions docs/content/advanced_configuration/session_affinity.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,17 @@ metadata:
name: default-session-affinity-app-80
namespace: gloo-system
spec:
upstreamSpec:
kube:
selector:
name: session-affinity-app
serviceName: session-affinity-app
serviceNamespace: default
servicePort: 80
loadBalancerConfig:
ringHash:
ringHashConfig:
maximumRingSize: "200"
minimumRingSize: "10"
kube:
selector:
name: session-affinity-app
serviceName: session-affinity-app
serviceNamespace: default
servicePort: 80
loadBalancerConfig:
ringHash:
ringHashConfig:
maximumRingSize: "200"
minimumRingSize: "10"
{{< /highlight >}}

- Optional fields omitted:
Expand All @@ -75,15 +74,14 @@ metadata:
name: default-session-affinity-app-80
namespace: gloo-system
spec:
upstreamSpec:
kube:
selector:
name: session-affinity-app
serviceName: session-affinity-app
serviceNamespace: default
servicePort: 80
loadBalancerConfig:
ringHash: {}
kube:
selector:
name: session-affinity-app
serviceName: session-affinity-app
serviceNamespace: default
servicePort: 80
loadBalancerConfig:
ringHash: {}
{{< /highlight >}}

#### Configure a Maglev Load Balancer on an Upstream
Expand Down Expand Up @@ -307,18 +305,17 @@ metadata:
name: default-session-affinity-app-80
namespace: gloo-system
spec:
upstreamSpec:
kube:
selector:
name: session-affinity-app
serviceName: session-affinity-app
serviceNamespace: default
servicePort: 80
loadBalancerConfig:
ringHash:
ringHashConfig:
maximumRingSize: "200"
minimumRingSize: "10"
kube:
selector:
name: session-affinity-app
serviceName: session-affinity-app
serviceNamespace: default
servicePort: 80
loadBalancerConfig:
ringHash:
ringHashConfig:
maximumRingSize: "200"
minimumRingSize: "10"
{{< /highlight >}}

##### Configure the route
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,45 @@ Each upstream in Gloo has a type. Supported types include `static`, `kubernetes`
Each upstream type is handled by a corresponding Gloo plugin. (plugins currently need to be compiled into Gloo)

```yaml
"upstreamSpec": .gloo.solo.io.UpstreamSpec
"status": .core.solo.io.Status
"metadata": .core.solo.io.Metadata
"discoveryMetadata": .gloo.solo.io.DiscoveryMetadata
"sslConfig": .gloo.solo.io.UpstreamSslConfig
"circuitBreakers": .gloo.solo.io.CircuitBreakerConfig
"loadBalancerConfig": .gloo.solo.io.LoadBalancerConfig
"connectionConfig": .gloo.solo.io.ConnectionConfig
"healthChecks": []envoy.api.v2.core.HealthCheck
"outlierDetection": .envoy.api.v2.cluster.OutlierDetection
"useHttp2": bool
"kube": .kubernetes.options.gloo.solo.io.UpstreamSpec
"static": .static.options.gloo.solo.io.UpstreamSpec
"pipe": .pipe.options.gloo.solo.io.UpstreamSpec
"aws": .aws.options.gloo.solo.io.UpstreamSpec
"azure": .azure.options.gloo.solo.io.UpstreamSpec
"consul": .consul.options.gloo.solo.io.UpstreamSpec
"awsEc2": .aws_ec2.options.gloo.solo.io.UpstreamSpec

```
| Field | Type | Description | Default |
| ----- | ---- | ----------- |----------- |
| `upstreamSpec` | [.gloo.solo.io.UpstreamSpec](../options.proto.sk/#upstreamspec) | Type-specific configuration. Examples include static, kubernetes, and aws. The type-specific config for the upstream is called a spec. | |
| `status` | [.core.solo.io.Status](../../../../../../solo-kit/api/v1/status.proto.sk/#status) | Status indicates the validation status of the resource. Status is read-only by clients, and set by gloo during validation. | |
| `metadata` | [.core.solo.io.Metadata](../../../../../../solo-kit/api/v1/metadata.proto.sk/#metadata) | Metadata contains the object metadata for this resource. | |
| `discoveryMetadata` | [.gloo.solo.io.DiscoveryMetadata](../upstream.proto.sk/#discoverymetadata) | Upstreams and their configuration can be automatically by Gloo Discovery if this upstream is created or modified by Discovery, metadata about the operation will be placed here. | |
| `sslConfig` | [.gloo.solo.io.UpstreamSslConfig](../ssl.proto.sk/#upstreamsslconfig) | | |
| `circuitBreakers` | [.gloo.solo.io.CircuitBreakerConfig](../circuit_breaker.proto.sk/#circuitbreakerconfig) | Circuit breakers for this upstream. if not set, the defaults ones from the Gloo settings will be used. if those are not set, [envoy's defaults](https://www.envoyproxy.io/docs/envoy/latest/api-v2/api/v2/cluster/circuit_breaker.proto#envoy-api-msg-cluster-circuitbreakers) will be used. | |
| `loadBalancerConfig` | [.gloo.solo.io.LoadBalancerConfig](../load_balancer.proto.sk/#loadbalancerconfig) | | |
| `connectionConfig` | [.gloo.solo.io.ConnectionConfig](../connection.proto.sk/#connectionconfig) | | |
| `healthChecks` | [[]envoy.api.v2.core.HealthCheck](../../external/envoy/api/v2/core/health_check.proto.sk/#healthcheck) | | |
| `outlierDetection` | [.envoy.api.v2.cluster.OutlierDetection](../../external/envoy/api/v2/cluster/outlier_detection.proto.sk/#outlierdetection) | | |
| `useHttp2` | `bool` | Use http2 when communicating with this upstream this field is evaluated `true` for upstreams with a grpc service spec. otherwise defaults to `false`. | |
| `kube` | [.kubernetes.options.gloo.solo.io.UpstreamSpec](../options/kubernetes/kubernetes.proto.sk/#upstreamspec) | Only one of `kube`, `static`, `pipe`, `aws`, `azure`, or `awsEc2` can be set. | |
| `static` | [.static.options.gloo.solo.io.UpstreamSpec](../options/static/static.proto.sk/#upstreamspec) | Only one of `static`, `kube`, `pipe`, `aws`, `azure`, or `awsEc2` can be set. | |
| `pipe` | [.pipe.options.gloo.solo.io.UpstreamSpec](../options/pipe/pipe.proto.sk/#upstreamspec) | Only one of `pipe`, `kube`, `static`, `aws`, `azure`, or `awsEc2` can be set. | |
| `aws` | [.aws.options.gloo.solo.io.UpstreamSpec](../options/aws/aws.proto.sk/#upstreamspec) | Only one of `aws`, `kube`, `static`, `pipe`, `azure`, or `awsEc2` can be set. | |
| `azure` | [.azure.options.gloo.solo.io.UpstreamSpec](../options/azure/azure.proto.sk/#upstreamspec) | Only one of `azure`, `kube`, `static`, `pipe`, `aws`, or `awsEc2` can be set. | |
| `consul` | [.consul.options.gloo.solo.io.UpstreamSpec](../options/consul/consul.proto.sk/#upstreamspec) | Only one of `consul`, `kube`, `static`, `pipe`, `aws`, or `awsEc2` can be set. | |
| `awsEc2` | [.aws_ec2.options.gloo.solo.io.UpstreamSpec](../options/aws/ec2/aws_ec2.proto.sk/#upstreamspec) | Only one of `awsEc2`, `kube`, `static`, `pipe`, `aws`, or `consul` can be set. | |



Expand Down
4 changes: 2 additions & 2 deletions docs/content/dev/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func NewPlugin() *plugin {

func (*plugin) ProcessUpstream(params plugins.Params, in *v1.Upstream, out *v2.Cluster) error {
// check that the upstream is our type (GCE)
if _, ok := in.UpstreamSpec.UpstreamType.(*v1.UpstreamSpec_Gce); !ok {
if _, ok := in.UpstreamType.(*v1.UpstreamSpec_Gce); !ok {
// not gce, return early
return nil
}
Expand Down Expand Up @@ -131,7 +131,7 @@ func getLatestEndpoints(instancesClient *compute.InstancesService, upstreams v1.
// for each upstream, retrieve its endpoints
for _, us := range upstreams {
// check that the upstream uses the GCE Spec
gceSpec := us.UpstreamSpec.GetGce()
gceSpec := us.GetGce()
if gceSpec == nil {
// skip non-GCE upstreams
continue
Expand Down
10 changes: 5 additions & 5 deletions docs/content/dev/writing-upstream-plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ import (

func (*plugin) ProcessUpstream(params plugins.Params, in *v1.Upstream, out *v2.Cluster) error {
// check that the upstream is our type (GCE)
if _, ok := in.UpstreamSpec.UpstreamType.(*v1.UpstreamSpec_Gce); !ok {
if _, ok := in.UpstreamType.(*v1.UpstreamSpec_Gce); !ok {
// not gce, return early
return nil
}
Expand Down Expand Up @@ -434,7 +434,7 @@ func getLatestEndpoints(instancesClient *compute.InstancesService, upstreams v1.
// for each upstream, retrieve its endpoints
for _, us := range upstreams {
// check that the upstream uses the GCE Spec
gceSpec := us.UpstreamSpec.GetGce()
gceSpec := us.GetGce()
if gceSpec == nil {
// skip non-GCE upstreams
continue
Expand Down Expand Up @@ -501,7 +501,7 @@ func getLatestEndpoints(instancesClient *compute.InstancesService, upstreams v1.
// for each upstream, retrieve its endpoints
for _, us := range upstreams {
// check that the upstream uses the GCE Spec
gceSpec := us.UpstreamSpec.GetGce()
gceSpec := us.GetGce()
if gceSpec == nil {
// skip non-GCE upstreams
continue
Expand Down Expand Up @@ -549,7 +549,7 @@ func getLatestEndpoints(instancesClient *compute.InstancesService, upstreams v1.
// for each upstream, retrieve its endpoints
for _, us := range upstreams {
// check that the upstream uses the GCE Spec
gceSpec := us.UpstreamSpec.GetGce()
gceSpec := us.GetGce()
if gceSpec == nil {
// skip non-GCE upstreams
continue
Expand Down Expand Up @@ -603,7 +603,7 @@ func getLatestEndpoints(instancesClient *compute.InstancesService, upstreams v1.
// for each upstream, retrieve its endpoints
for _, us := range upstreams {
// check that the upstream uses the GCE Spec
gceSpec := us.UpstreamSpec.GetGce()
gceSpec := us.GetGce()
if gceSpec == nil {
// skip non-GCE upstreams
continue
Expand Down
23 changes: 11 additions & 12 deletions docs/content/gloo_integrations/service_mesh/gloo_istio_mtls.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,18 +127,17 @@ metadata:
uid: dfd33b6c-3a3b-11e9-98c6-02425fecee06
spec:
discoveryMetadata: {}
upstreamSpec:
sslConfig:
sslFiles:
tlsCert: /etc/certs/cert-chain.pem
tlsKey: /etc/certs/key.pem
rootCa: /etc/certs/root-cert.pem
kube:
selector:
app: productpage
serviceName: productpage
serviceNamespace: default
servicePort: 9080
sslConfig:
sslFiles:
tlsCert: /etc/certs/cert-chain.pem
tlsKey: /etc/certs/key.pem
rootCa: /etc/certs/root-cert.pem
kube:
selector:
app: productpage
serviceName: productpage
serviceNamespace: default
servicePort: 9080
status:
reported_by: gloo
state: 1
Expand Down
107 changes: 53 additions & 54 deletions docs/content/gloo_routing/hello_world/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,60 +100,59 @@ processed by Gloo.
status:
reportedBy: gloo
state: Accepted
upstreamSpec:
kube:
selector:
app: petstore
serviceName: petstore
serviceNamespace: default
servicePort: 8080
serviceSpec:
rest:
swaggerInfo:
url: http://petstore.default.svc.cluster.local:8080/swagger.json
transformations:
addPet:
body:
text: '{"id": {{ default(id, "") }},"name": "{{ default(name, "")}}","tag":
"{{ default(tag, "")}}"}'
headers:
:method:
text: POST
:path:
text: /api/pets
content-type:
text: application/json
deletePet:
headers:
:method:
text: DELETE
:path:
text: /api/pets/{{ default(id, "") }}
content-type:
text: application/json
findPetById:
body: {}
headers:
:method:
text: GET
:path:
text: /api/pets/{{ default(id, "") }}
content-length:
text: "0"
content-type: {}
transfer-encoding: {}
findPets:
body: {}
headers:
:method:
text: GET
:path:
text: /api/pets?tags={{default(tags, "")}}&limit={{default(limit,
"")}}
content-length:
text: "0"
content-type: {}
transfer-encoding: {}
kube:
selector:
app: petstore
serviceName: petstore
serviceNamespace: default
servicePort: 8080
serviceSpec:
rest:
swaggerInfo:
url: http://petstore.default.svc.cluster.local:8080/swagger.json
transformations:
addPet:
body:
text: '{"id": {{ default(id, "") }},"name": "{{ default(name, "")}}","tag":
"{{ default(tag, "")}}"}'
headers:
:method:
text: POST
:path:
text: /api/pets
content-type:
text: application/json
deletePet:
headers:
:method:
text: DELETE
:path:
text: /api/pets/{{ default(id, "") }}
content-type:
text: application/json
findPetById:
body: {}
headers:
:method:
text: GET
:path:
text: /api/pets/{{ default(id, "") }}
content-length:
text: "0"
content-type: {}
transfer-encoding: {}
findPets:
body: {}
headers:
:method:
text: GET
:path:
text: /api/pets?tags={{default(tags, "")}}&limit={{default(limit,
"")}}
content-length:
text: "0"
content-type: {}
transfer-encoding: {}
```

The application endpoints were discovered by Gloo's Function Discovery (fds) service. This was possible because the petstore
Expand Down
21 changes: 10 additions & 11 deletions docs/content/gloo_routing/tls/client_tls.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,17 +217,16 @@ metadata:
namespace: gloo-system
spec:
discoveryMetadata: {}
upstreamSpec:
kube:
selector:
app: example-tls-server
serviceName: example-tls-server
serviceNamespace: default
servicePort: 8080
sslConfig:
secretRef:
name: upstream-tls
namespace: default
kube:
selector:
app: example-tls-server
serviceName: example-tls-server
serviceNamespace: default
servicePort: 8080
sslConfig:
secretRef:
name: upstream-tls
namespace: default
status:
reported_by: gloo
state: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ metadata:
name: json-upstream
namespace: gloo-system
spec:
upstreamSpec:
static:
hosts:
- addr: echo.jsontest.com
port: 80
static:
hosts:
- addr: echo.jsontest.com
port: 80
Loading

0 comments on commit 3c863d9

Please sign in to comment.