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

trimmed ingress spec with tons of docs #198

Closed
wants to merge 4 commits into from
Closed

trimmed ingress spec with tons of docs #198

wants to merge 4 commits into from

Conversation

rshriram
Copy link
Member

This is a follow up from #192 .. This rule is basically a trimmed version of the internal ingress rule that we were carrying. The idea is that we would expose this as a first class resource, rather than mucking with automatic conversions.

Most of the code also exists.
The benefit of this model is that we can now deploy ingress envoys in non kubernetes environments and also as a standalone LB in kubernetes. Currently, we are using kubectl to deploy ingress spec in nomad, and then using istioctl route rules. Which is clunky. We are also doing implicit route rule to ingress mappings by comparing ingress path/prefix to route rule path/prefix, and picking the most restrictive one. This model has suffered a series of flaws including inability to match regex, or mix/match regex/prefix rules, users requesting support for nginx specific annotations, and the list goes on.

This is not meant to replace Kubernetes Ingress. If user provides K8S ingress, we will pick that and function as usual. But if she chooses to use Istio ingress (enabled through a global mesh config), then we will no longer watch the ingress resources (but we will run as ingress controller). This allows both to co-exist .

@googlebot googlebot added the cla: yes Set by the Google CLA bot to indicate the author of a PR has signed the Google CLA. label Oct 12, 2017
// Optional: Indicates whether connections to this port should be secured using TLS.
// If set to true, Envoy will use the certficates specified in the secrets section. Default
// is false.
bool secure = 2;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think there is some subtlety here that a simple boolean does not convey. For example see

envoyproxy/envoy#1843

where we might require a TLS handshake but not actually terminate TLS in the ingress proxy itself.

Copy link
Member Author

Choose a reason for hiding this comment

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

Are you thinking of something like allowing users to specify if Envoy should use TLS or not, and if TLS, terminate TLS or just route to backend?

If SNI-based routing materializes soon, then we might actually augment our route rules to do host based routing, with weighted routing (no rewrites/ header matches, etc.).

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, this is useful for the 'mesh extender' use case where all services in the mesh are exposed by their local names through an ingress proxy and simply routed by SNI name when no routing rules apply to the backend.

This has limitations if there are routing rules which apply to things at L7 (headers etc) but the benefit is that you get end-to-end security and possibly better performance.

You could also in theory play tricks with SNI where the client encodes routing labels into the presented name as long as that didn't cause naming conflicts. Creating alternate service names would largely achieve the equivalent effect so this may be overkill

// CA certificate to validate the client's certificate. It is the responsibility of the
// underlying platform to mount the secret as a file under /etc/istio/ingress-certs with
// the same name as the secret.
string client_secret = 3;
Copy link
Contributor

Choose a reason for hiding this comment

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

technically this is not a 'client secret' it's a list of CA certs.

Consider terminology from
https://envoyproxy.github.io/envoy/configuration/listeners/ssl.html

I don't think we want K8S 'secret' terminology bleeding in here

Copy link
Member Author

Choose a reason for hiding this comment

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

How about using server_cert, client_ca_bundle ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems reasonable.

Note that we also have to account for whether we want to accept or reject non-mutual TLS as part of this config.

@rshriram
Copy link
Member Author

rshriram commented Oct 12, 2017

     apiVersion: config.istio.io/v1alpha2
     kind: IngressRule
     metadata:
       name: my-ingress
     spec:
       servers:
       - port: 80
         protocol: HTTP
         ruleSelector:
         - labels:
             istio: ingress-http # only rules that have this label in metadata will be applied.
       - port: 443
         protocol: HTTP
         secure: true #enables HTTPS on this port
         ruleSelector:
         - labels:
             istio: ingress-tls
       - port: 2379 #to expose internal service via external port 2379
         protocol: TCP
         backend:
           name: myRedis #service name
           port: 1234
       secrets:
       - host: foo.bar.com
         serverSecret: server.crt
         clientSecret: client.ca-bundle
       - host: example.com
         serverSecret: server.crt

// spec:
// servers:
// - port: 443
// protocol: HTTP
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we intend to control protocol advertisement via ALPN with these names as an option here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh good point!.. May be make this a list ? protocols: http,http2 ? Or have a separate ALPN field.

// INTERNAL USE ONLY. Map from K8S ingress into a partial Istio rule
// which is then used to map into actual route rules. This is an incomplete
// implementation. Bare minimal Kubernetes ingress specifications are supported.
message K8SIngressRule {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this message need to continue to exist?

Copy link
Member Author

Choose a reason for hiding this comment

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

You mean as artifact or whether we even need support for ingress translation ? @kyessenov created the first version of ingress rule message. I believe it was to keep the code base simple, by importing protos into proxy/* code, while platform specific code dealt with transformation.

Copy link
Contributor

Choose a reason for hiding this comment

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

We should be able to remove it eventually, if we want. There isn't a need to translate the k8s ingress resource into our own K8SIngressRule, since we can just use the k8s ingress resource instead. But in the meantime, to leverage existing code, we can leave it in place.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the problem with removing the K8s Ingress support is that most (almost all) users are coming from K8s, and will expect to be able to use existing Ingresses. Removing it may be a barrier to Istio adoption. If we leave it in, then I think we still need to fix all (most of?) the problems that it has in some reasonable way, which means the new rules-based design doesn't really get us much further ahead, other than to give us a better non-kube solution.

Unless we can improve it, I think this new reference-to-rules Ingress design is significantly more complicated. It splits a simple ingress config out into many rules and requires replication of config in default rules and higher precedence overrides (e.g. canary rule). I think this may also negatively impact adoption.

@louiscryan
Copy link
Contributor

louiscryan commented Oct 12, 2017 via email

// protocol: HTTP
// ruleSelector:
// - labels:
// istio: ingress-http # only rules that have this label in metadata will be applied.
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume there will be rules with this label for multiple destinations. How is the destination service decided for calls via the ingress? Seems to be missing some kind of path-to-destination or host-to-destination mapping that a K8s ingress provides.

Copy link
Member Author

Choose a reason for hiding this comment

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

That is in the route rule. If a user wants to match on specific destination, then she provides host header match. If there is no host header match, then we end up getting 404s? Man, I totally missed this piece.

Copy link
Contributor

Choose a reason for hiding this comment

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

How does precedence come into play? For rules with the same destination, I assume it's just the standard algorithm (first match). But, what if there are multiple rules with the same host header (or path/uri) match, but with different destination services. Which one(s) apply?

// INTERNAL USE ONLY. Map from K8S ingress into a partial Istio rule
// which is then used to map into actual route rules. This is an incomplete
// implementation. Bare minimal Kubernetes ingress specifications are supported.
message K8SIngressRule {
Copy link
Contributor

Choose a reason for hiding this comment

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

We should be able to remove it eventually, if we want. There isn't a need to translate the k8s ingress resource into our own K8SIngressRule, since we can just use the k8s ingress resource instead. But in the meantime, to leverage existing code, we can leave it in place.

// istio: ingress-http # only rules that have this label in metadata will be applied.
// - port: 443
// protocol: HTTP
// secure: true #enables HTTPS on this port
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not protocol: HTTPS here?

@rshriram rshriram closed this Nov 9, 2017
@rshriram rshriram deleted the ingress branch November 10, 2017 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Set by the Google CLA bot to indicate the author of a PR has signed the Google CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants