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

Migrate to Istio v1alpha3 Gateway / VirtualService #1228

Merged
merged 11 commits into from
Jun 29, 2018

Conversation

tcnghia
Copy link
Contributor

@tcnghia tcnghia commented Jun 15, 2018

Fixes #1047 #794 #348

In this change we also move from an N Ingresses model to a single shared Gateway for all of Knative services. We also create our own load-balanced service to do so in order to avoid conflict with users when using the istio-ingressgateway service, since Gateways can not share the service for ingresses.

@tcnghia tcnghia added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. area/networking labels Jun 15, 2018
@tcnghia tcnghia requested review from ZhiminXiang and mdemirhan June 15, 2018 17:26
@google-prow-robot google-prow-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jun 15, 2018
Copy link

@ZhiminXiang ZhiminXiang left a comment

Choose a reason for hiding this comment

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

  1. Verified that helloworld sample still works with this PR.
  2. Reviewed about one third of this PR. Will try to finish the rest of this PR within this week.

&RouteRule{},
&RouteRuleList{},
&VirtualService{},
&Gateway{},

Choose a reason for hiding this comment

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

We also define GatewayList. Do we want to add it here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

WebsocketUpgrade bool `json:"websocketUpgrade,omitempty"`

// Timeout for HTTP requests.
Timeout string `json:"timeout,omitempty"`

Choose a reason for hiding this comment

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

no objection but just curious: why the type of timeout is string? Looks like originally it is Duration prototype: https://istio.io/docs/reference/config/istio.networking.v1alpha3/#HTTPRoute

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know if there is a way to deserialize the duration strings "10m", "1h", etc into a Duration struct.

All Istio objects are processed as JSON, which is basically map[string]string, and then parsed into protobuf on their side.

return rs.IsReady() && !rs.IsInactive()
}

func (rs *RevisionStatus) IsRoutable() bool {

Choose a reason for hiding this comment

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

what is the difference btw status Active and Routable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

when revisions are in Inactive state, we can still route traffic to it through the activator

@@ -113,9 +113,7 @@ const (
// RouteConditionReady is set when the service is configured
// and has available backends ready to receive traffic.
RouteConditionReady RouteConditionType = "Ready"
// RouteConditionIngressReady is set when the route's underlying ingress
// resource has been set up.
RouteConditionIngressReady RouteConditionType = "IngressReady"

Choose a reason for hiding this comment

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

Why do we just delete this condition instead of replacing it with RouteConditionGatewayReady?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we only have a single Gateway that we create at the time of setup (see config/202-gateway.yaml), the Gateway is always ready.

configV1alpha2 *configv1alpha2.ConfigV1alpha2Client
servingV1alpha1 *servingv1alpha1.ServingV1alpha1Client
networkingV1alpha3 *networkingv1alpha3.NetworkingV1alpha3Client
servingV1alpha1 *servingv1alpha1.ServingV1alpha1Client

Choose a reason for hiding this comment

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

nit: extra space.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's because of gofmt autoindent.

}

// NewForConfig creates a new NetworkingV1alpha3Client for the given config.
func NewForConfig(c *rest.Config) (*NetworkingV1alpha3Client, error) {

Choose a reason for hiding this comment

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

maybe rename this function to "NewForNetworking" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the Config here refers to the "c *rest.Config" parameter.

// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *ConfigV1alpha2Client {
func NewForConfigOrDie(c *rest.Config) *NetworkingV1alpha3Client {

Choose a reason for hiding this comment

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

rename to "NewForNetworkingOrDie" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same as previous comment.

@ZhiminXiang
Copy link

For helloworld example, looks like the VirtualService only matches host "route-example.default.demo-domain.com" and "route-example-service.default.svc.cluster.local", but misses host "*.route-example.default.demo-domain.com". Below is the spec of VirtualService:

 spec:
    gateways:
    - route-example-gateway
    - mesh
    hosts:
    - '*.route-example.default.demo-domain.com'
    - route-example.default.demo-domain.com
    - route-example-service.default.svc.cluster.local
    http:
    - match:
      - authority:
          exact: route-example.default.demo-domain.com
      - authority:
          exact: route-example-service.default.svc.cluster.local
      route:
      - destination:
          host: configuration-example-00001-service.default.svc.cluster.local
          port:
            number: 80
        weight: 100

@tcnghia tcnghia removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 26, 2018
@tcnghia tcnghia changed the title [wip] move to Istio v1alpha3 Migrate to Istio v1alpha3 Gateway / VirtualService Jun 26, 2018
@tcnghia tcnghia force-pushed the gateway branch 5 times, most recently from 466f032 to fd89f7b Compare June 26, 2018 23:17
@tcnghia
Copy link
Contributor Author

tcnghia commented Jun 27, 2018

/test pull-knative-serving-go-coverage

@tcnghia
Copy link
Contributor Author

tcnghia commented Jun 27, 2018

/test pull-knative-serving-integration-tests

@tcnghia
Copy link
Contributor Author

tcnghia commented Jun 27, 2018

@ZhiminXiang since sample/helloworld/sample.yaml doesn't have named TrafficTarget, that is to be expected.

@tcnghia
Copy link
Contributor Author

tcnghia commented Jun 27, 2018

/test pull-knative-serving-integration-tests

@tcnghia
Copy link
Contributor Author

tcnghia commented Jun 27, 2018

/test pull-knative-serving-intergration-tests

@evankanderson
Copy link
Member

/assign @mdemirhan

Feel free to /assign myself or mattmoor if you need approval after Mustafa has given a /lgtm

@tcnghia
Copy link
Contributor Author

tcnghia commented Jun 27, 2018

@mdemirhan I updated a link to #1376 (the upstream issue istio/istio#5588 has been fixed, will be out on 1.0 release).

I've also rebased. It's ready for another look.

@knative-metrics-robot
Copy link

The following is the coverage report on pkg/. Say /test pull-knative-serving-go-coverage to run the coverage report again

File Old Coverage New Coverage Delta
pkg/apis/serving/v1alpha1/revision_types.go 98.5% 98.6% 0.1
pkg/apis/serving/v1alpha1/route_types.go 95.3% 92.7% -2.7

*TestCoverage feature is being tested, do not rely on any info here yet

c.ServingClientSet.ServingV1alpha1().Configurations(r.Namespace),
c.ServingClientSet.ServingV1alpha1().Revisions(r.Namespace),
r)
// Even if targetErr != n`il, we still need to finish updating the labels so that the updates to
Copy link
Member

Choose a reason for hiding this comment

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

nit: nil

Copy link
Member

Choose a reason for hiding this comment

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

Going to stamp this now to avoid more merge hell, let's get this in and fix the typo in a follow up

@mattmoor
Copy link
Member

/lgtm
/approve

@google-prow-robot google-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 29, 2018
@google-prow-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mattmoor, mdemirhan, tcnghia

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-prow-robot google-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 29, 2018
@google-prow-robot google-prow-robot merged commit 22e3cb0 into knative:master Jun 29, 2018
mdemirhan pushed a commit to knative/docs that referenced this pull request Jul 2, 2018
* Update samples to not use Ingress.

This is follow-up of knative/serving#1228.  We
moved to Istio v1alpha3 / Gateway which requires a different way to
get the external IP address to send traffic to our samples.

* Also update the command to find service domain.
szihai pushed a commit to szihai/hello-go that referenced this pull request Sep 11, 2018
* Update samples to not use Ingress.

This is follow-up of knative/serving#1228.  We
moved to Istio v1alpha3 / Gateway which requires a different way to
get the external IP address to send traffic to our samples.

* Also update the command to find service domain.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/networking lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants