Repository navigation
Add additional encryption config flags + labels - #891
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #891 +/- ##
==========================================
+ Coverage 82.14% 82.18% +0.04%
==========================================
Files 45 46 +1
Lines 1725 1746 +21
==========================================
+ Hits 1417 1435 +18
- Misses 266 268 +2
- Partials 42 43 +1 ☔ View full report in Codecov by Sentry. |
67c22d0 to
c09afcb
Compare
|
/lgtm Thank you! |
👍 I'll do that as a follow-up |
Why does the ingress need this? |
Hm, thinking about it based on your question, it is probably not totally necessary. But without having it, each net-* solution would need to compare the
|
|
Should we restructure the option a) merge `spec.tls` into `spec.rules` like:apiVersion: networking.internal.knative.dev/v1alpha1
kind: Ingress
metadata:
name: helloworld
namespace: default
spec:
httpOption: Enabled
rules:
- hosts:
- helloworld.default
- helloworld.default.svc
- helloworld.default.svc.cluster.local
http:
paths:
- splits:
- appendHeaders:
Knative-Serving-Namespace: default
Knative-Serving-Revision: helloworld-00001
percent: 100
serviceName: helloworld-00001
serviceNamespace: default
servicePort: 443
visibility: ClusterLocal
secretName: some-local-secret # optional - omitting means no TLS.
secretNamespace: default
- hosts:
- helloworld.default.10.89.0.200.sslip.io
http:
paths:
- splits:
- appendHeaders:
Knative-Serving-Namespace: default
Knative-Serving-Revision: helloworld-00001
percent: 100
serviceName: helloworld-00001
serviceNamespace: default
servicePort: 443
visibility: ExternalIP
secretName: route-ba07ea4e-2548-4632-9187-e615c876cffc-local # optional - omitting means no TLS.
secretNamespace: defaultoption b) drop `spec.tls.hosts[]` and use the `spec.tls.visibility` as a key like:apiVersion: networking.internal.knative.dev/v1alpha1
kind: Ingress
metadata:
name: helloworld
namespace: default
spec:
httpOption: Enabled
rules:
- hosts:
- helloworld.default
- helloworld.default.svc
- helloworld.default.svc.cluster.local
http:
paths:
- splits:
- appendHeaders:
Knative-Serving-Namespace: default
Knative-Serving-Revision: helloworld-00001
percent: 100
serviceName: helloworld-00001
serviceNamespace: default
servicePort: 443
visibility: ClusterLocal
- hosts:
- helloworld.default.10.89.0.200.sslip.io
http:
paths:
- splits:
- appendHeaders:
Knative-Serving-Namespace: default
Knative-Serving-Revision: helloworld-00001
percent: 100
serviceName: helloworld-00001
serviceNamespace: default
servicePort: 443
visibility: ExternalIP
tls:
- visibility: ExternalIP
secretName: secret-for-external
secretNamespace: default
- visibility: ClusterLocal
secretName: route-ba07ea4e-2548-4632-9187-e615c876cffc-local
secretNamespace: defaultAlso, |
|
Hm, not sure if option b) would work. Note we can have multiple entries for both visibilities with different certificates: apiVersion: networking.internal.knative.dev/v1alpha1
kind: Ingress
metadata:
labels:
serving.knative.dev/route: helloworld
serving.knative.dev/routeNamespace: default
serving.knative.dev/service: helloworld
name: helloworld
namespace: default
spec:
httpOption: Enabled
rules:
- hosts:
- helloworld.default
- helloworld.default.svc
- helloworld.default.svc.cluster.local
http:
paths:
- splits:
- appendHeaders:
Knative-Serving-Namespace: default
Knative-Serving-Revision: helloworld-00001
percent: 100
serviceName: helloworld-00001
serviceNamespace: default
servicePort: 443
visibility: ClusterLocal
- hosts:
- helloworld.default.192.168.105.100.sslip.io
http:
paths:
- splits:
- appendHeaders:
Knative-Serving-Namespace: default
Knative-Serving-Revision: helloworld-00001
percent: 100
serviceName: helloworld-00001
serviceNamespace: default
servicePort: 443
visibility: ExternalIP
- hosts:
- latest-helloworld.default
- latest-helloworld.default.svc
- latest-helloworld.default.svc.cluster.local
http:
paths:
- splits:
- appendHeaders:
Knative-Serving-Namespace: default
Knative-Serving-Revision: helloworld-00001
percent: 100
serviceName: helloworld-00001
serviceNamespace: default
servicePort: 443
visibility: ClusterLocal
- hosts:
- latest-helloworld.default.192.168.105.100.sslip.io
http:
paths:
- splits:
- appendHeaders:
Knative-Serving-Namespace: default
Knative-Serving-Revision: helloworld-00001
percent: 100
serviceName: helloworld-00001
serviceNamespace: default
servicePort: 443
visibility: ExternalIP
tls:
- hosts:
- helloworld.default
- helloworld.default.svc
- helloworld.default.svc.cluster.local
secretName: route-9f44405d-74a9-496b-a43d-effdf98bd6ca-local
secretNamespace: default
visibility: ClusterLocal
- hosts:
- latest-helloworld.default
- latest-helloworld.default.svc
- latest-helloworld.default.svc.cluster.local
secretName: route-9f44405d-74a9-496b-a43d-effdf98bd6ca-147587726-local
secretNamespace: default
visibility: ClusterLocalOption a) seems nice, but not sure if we want to change it that much, as this will impact all net-* implementations, regardless of their current state of implementing the new features. Also it might have a reason why it has been done that way in the first place? WDYT @dprotaso ? |
|
I just realized that another concern of ths PR. Current net-* implementaitons does a simple
|
|
That is a good point @nak3 , but I think not one that we can omit without introducing a totally new field here. The flag is still marked as alpha, so I'd vote to add the hint as you say. As long as this feature is not finished, it should not be enabled in a real environment. Then the cluster-local TLS entries will not occur. I'll add this filter changes as issues to our tracking umbrella. |
|
I think I'd like to avoid API changes to our internal Ingress resource - since we'd have to support multiple versions while we perform a migration. Given that the TLS stanza just maps host names to a secret I think I'd rather just create helper functions in this repo that implementations can use to reduce complexity. |
6f8a375 to
9ec4fd5
Compare
|
/hold I'm doing some testing with kourier + serving and add a test for the new function. |
I would vote for that too. It seems there is a lot of repetition of info here. |
You could argue that you get more repetition if you have a TLS block within the rules block. If you didn't have wildcard certs then you'd have to repeat the entire rule many times (eg. appendHeaders) |
We could have it under rules, my thinking was optimize based on what is common in practice: Not sure if we are describing the same thing. |
9ec4fd5 to
da1b703
Compare
|
@skonto @dprotaso I don't think we ever have a But anyway, I added |
|
Can you update the commit message - it doesn't match the contents of the commit |
|
|
||
| // CertificateTypeLabelKey is the label to indicate the type of Knative certificate | ||
| // used for Knative Serving encryption functionality. | ||
| CertificateTypeLabelKey = PublicGroupName + "/certificate-type" |
There was a problem hiding this comment.
What are the corresponding values?
There was a problem hiding this comment.
Added a comment to link to config.CertificateType. Is there a better way to do this?
| if r.Visibility == visibility { | ||
| for _, t := range i.Spec.TLS { | ||
| // Check if hosts slices are equal ignoring the order | ||
| if cmp.Diff(r.Hosts, t.Hosts, cmpopts.SortSlices(func(a, b string) bool { return a < b })) == "" { |
There was a problem hiding this comment.
This shouldn't be an equal comparison but tls.Hosts.Contains(host)
In theory KIngress can express different TLS certs for different hosts that are in the same rules block
There was a problem hiding this comment.
I see, switched it to check if every host in Rules.Hosts is contained in TLS.Hosts. Also added a test case for this.
839bec7 to
467173c
Compare
467173c to
db5cba2
Compare
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dprotaso, ReToCode The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Changes
CertificateTypeLabelKeylabel with valuesCertificateTypeto indicate different types of aKnativeCertificateServingInternalCertName(checked in all repos in knative + knative-extensions)GetIngressTLSForVisibilitytoIngressto filter cluster-local and external-ip TLS blocks./kind enhancement
Example of
KnativeIngresswith TLS block for cluster-local-domain-tls: