-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support caCerts in secrets (#3211)
* feat: support caCerts in secrets (#2777) Signed-off-by: ShyunnY <1147212064@qq.com> * fix Signed-off-by: ShyunnY <1147212064@qq.com> --------- Signed-off-by: ShyunnY <1147212064@qq.com>
- Loading branch information
Showing
4 changed files
with
345 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
117 changes: 117 additions & 0 deletions
117
internal/gatewayapi/testdata/backendtlspolicy-ca-only-secret.in.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
gateways: | ||
- apiVersion: gateway.networking.k8s.io/v1 | ||
kind: Gateway | ||
metadata: | ||
name: gateway-btls | ||
namespace: envoy-gateway | ||
spec: | ||
gatewayClassName: envoy-gateway-class | ||
listeners: | ||
- name: http | ||
protocol: HTTP | ||
port: 80 | ||
allowedRoutes: | ||
namespaces: | ||
from: All | ||
httpRoutes: | ||
- apiVersion: gateway.networking.k8s.io/v1 | ||
kind: HTTPRoute | ||
metadata: | ||
name: httproute-btls | ||
namespace: envoy-gateway | ||
spec: | ||
parentRefs: | ||
- namespace: envoy-gateway | ||
name: gateway-btls | ||
sectionName: http | ||
rules: | ||
- matches: | ||
- path: | ||
type: Exact | ||
value: "/exact" | ||
backendRefs: | ||
- name: http-backend | ||
namespace: backends | ||
port: 8080 | ||
|
||
referenceGrants: | ||
- apiVersion: gateway.networking.k8s.io/v1alpha2 | ||
kind: ReferenceGrant | ||
metadata: | ||
name: refg-route-svc | ||
namespace: backends | ||
spec: | ||
from: | ||
- group: gateway.networking.k8s.io | ||
kind: HTTPRoute | ||
namespace: envoy-gateway | ||
- group: gateway.networking.k8s.io | ||
kind: Gateway | ||
namespace: envoy-gateway | ||
- group: gateway.networking.k8s.io | ||
kind: BackendTLSPolicy | ||
namespace: policies | ||
to: | ||
- group: "" | ||
kind: Service | ||
|
||
services: | ||
- apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: http-backend | ||
namespace: backends | ||
spec: | ||
clusterIP: 10.11.12.13 | ||
ports: | ||
- port: 8080 | ||
name: http | ||
protocol: TCP | ||
targetPort: 8080 | ||
|
||
|
||
endpointSlices: | ||
- apiVersion: discovery.k8s.io/v1 | ||
kind: EndpointSlice | ||
metadata: | ||
name: endpointslice-http-backend | ||
namespace: backends | ||
labels: | ||
kubernetes.io/service-name: http-backend | ||
addressType: IPv4 | ||
ports: | ||
- name: http | ||
protocol: TCP | ||
port: 8080 | ||
endpoints: | ||
- addresses: | ||
- "10.244.0.11" | ||
conditions: | ||
ready: true | ||
|
||
secrets: | ||
- apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: ca-secret | ||
namespace: policies | ||
data: | ||
ca.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURKekNDQWcrZ0F3SUJBZ0lVQWw2VUtJdUttenRlODFjbGx6NVBmZE4ySWxJd0RRWUpLb1pJaHZjTkFRRUwKQlFBd0l6RVFNQTRHQTFVRUF3d0hiWGxqYVdWdWRERVBNQTBHQTFVRUNnd0dhM1ZpWldSaU1CNFhEVEl6TVRBdwpNakExTkRFMU4xb1hEVEkwTVRBd01UQTFOREUxTjFvd0l6RVFNQTRHQTFVRUF3d0hiWGxqYVdWdWRERVBNQTBHCkExVUVDZ3dHYTNWaVpXUmlNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQXdTVGMKMXlqOEhXNjJueW5rRmJYbzRWWEt2MmpDMFBNN2RQVmt5ODdGd2VaY1RLTG9XUVZQUUUycDJrTERLNk9Fc3ptTQp5eXIreHhXdHlpdmV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RFLS0tLS0K | ||
backendTLSPolicies: | ||
- apiVersion: gateway.networking.k8s.io/v1alpha2 | ||
kind: BackendTLSPolicy | ||
metadata: | ||
name: policy-btls | ||
namespace: backends | ||
spec: | ||
targetRefs: | ||
- group: "" | ||
kind: Service | ||
name: http-backend | ||
sectionName: "8080" | ||
validation: | ||
caCertificateRefs: | ||
- name: ca-secret | ||
group: "" | ||
kind: Secret | ||
hostname: example.com |
165 changes: 165 additions & 0 deletions
165
internal/gatewayapi/testdata/backendtlspolicy-ca-only-secret.out.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
backendTLSPolicies: | ||
- apiVersion: gateway.networking.k8s.io/v1alpha2 | ||
kind: BackendTLSPolicy | ||
metadata: | ||
creationTimestamp: null | ||
name: policy-btls | ||
namespace: backends | ||
spec: | ||
targetRefs: | ||
- group: "" | ||
kind: Service | ||
name: http-backend | ||
sectionName: "8080" | ||
validation: | ||
caCertificateRefs: | ||
- group: "" | ||
kind: Secret | ||
name: ca-secret | ||
hostname: example.com | ||
status: | ||
ancestors: | ||
- ancestorRef: | ||
name: gateway-btls | ||
namespace: envoy-gateway | ||
sectionName: http | ||
conditions: | ||
- lastTransitionTime: null | ||
message: Policy has been accepted. | ||
reason: Accepted | ||
status: "True" | ||
type: Accepted | ||
controllerName: gateway.envoyproxy.io/gatewayclass-controller | ||
gateways: | ||
- apiVersion: gateway.networking.k8s.io/v1 | ||
kind: Gateway | ||
metadata: | ||
creationTimestamp: null | ||
name: gateway-btls | ||
namespace: envoy-gateway | ||
spec: | ||
gatewayClassName: envoy-gateway-class | ||
listeners: | ||
- allowedRoutes: | ||
namespaces: | ||
from: All | ||
name: http | ||
port: 80 | ||
protocol: HTTP | ||
status: | ||
listeners: | ||
- attachedRoutes: 1 | ||
conditions: | ||
- lastTransitionTime: null | ||
message: Sending translated listener configuration to the data plane | ||
reason: Programmed | ||
status: "True" | ||
type: Programmed | ||
- lastTransitionTime: null | ||
message: Listener has been successfully translated | ||
reason: Accepted | ||
status: "True" | ||
type: Accepted | ||
- lastTransitionTime: null | ||
message: Listener references have been resolved | ||
reason: ResolvedRefs | ||
status: "True" | ||
type: ResolvedRefs | ||
name: http | ||
supportedKinds: | ||
- group: gateway.networking.k8s.io | ||
kind: HTTPRoute | ||
- group: gateway.networking.k8s.io | ||
kind: GRPCRoute | ||
httpRoutes: | ||
- apiVersion: gateway.networking.k8s.io/v1 | ||
kind: HTTPRoute | ||
metadata: | ||
creationTimestamp: null | ||
name: httproute-btls | ||
namespace: envoy-gateway | ||
spec: | ||
parentRefs: | ||
- name: gateway-btls | ||
namespace: envoy-gateway | ||
sectionName: http | ||
rules: | ||
- backendRefs: | ||
- name: http-backend | ||
namespace: backends | ||
port: 8080 | ||
matches: | ||
- path: | ||
type: Exact | ||
value: /exact | ||
status: | ||
parents: | ||
- conditions: | ||
- lastTransitionTime: null | ||
message: Route is accepted | ||
reason: Accepted | ||
status: "True" | ||
type: Accepted | ||
- lastTransitionTime: null | ||
message: Resolved all the Object references for the Route | ||
reason: ResolvedRefs | ||
status: "True" | ||
type: ResolvedRefs | ||
controllerName: gateway.envoyproxy.io/gatewayclass-controller | ||
parentRef: | ||
name: gateway-btls | ||
namespace: envoy-gateway | ||
sectionName: http | ||
infraIR: | ||
envoy-gateway/gateway-btls: | ||
proxy: | ||
listeners: | ||
- address: null | ||
name: envoy-gateway/gateway-btls/http | ||
ports: | ||
- containerPort: 10080 | ||
name: http-80 | ||
protocol: HTTP | ||
servicePort: 80 | ||
metadata: | ||
labels: | ||
gateway.envoyproxy.io/owning-gateway-name: gateway-btls | ||
gateway.envoyproxy.io/owning-gateway-namespace: envoy-gateway | ||
name: envoy-gateway/gateway-btls | ||
xdsIR: | ||
envoy-gateway/gateway-btls: | ||
accessLog: | ||
text: | ||
- path: /dev/stdout | ||
http: | ||
- address: 0.0.0.0 | ||
hostnames: | ||
- '*' | ||
isHTTP2: false | ||
name: envoy-gateway/gateway-btls/http | ||
path: | ||
escapedSlashesAction: UnescapeAndRedirect | ||
mergeSlashes: true | ||
port: 10080 | ||
routes: | ||
- destination: | ||
name: httproute/envoy-gateway/httproute-btls/rule/0 | ||
settings: | ||
- addressType: IP | ||
endpoints: | ||
- host: 10.244.0.11 | ||
port: 8080 | ||
protocol: HTTP | ||
tls: | ||
caCertificate: | ||
certificate: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURKekNDQWcrZ0F3SUJBZ0lVQWw2VUtJdUttenRlODFjbGx6NVBmZE4ySWxJd0RRWUpLb1pJaHZjTkFRRUwKQlFBd0l6RVFNQTRHQTFVRUF3d0hiWGxqYVdWdWRERVBNQTBHQTFVRUNnd0dhM1ZpWldSaU1CNFhEVEl6TVRBdwpNakExTkRFMU4xb1hEVEkwTVRBd01UQTFOREUxTjFvd0l6RVFNQTRHQTFVRUF3d0hiWGxqYVdWdWRERVBNQTBHCkExVUVDZ3dHYTNWaVpXUmlNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQXdTVGMKMXlqOEhXNjJueW5rRmJYbzRWWEt2MmpDMFBNN2RQVmt5ODdGd2VaY1RLTG9XUVZQUUUycDJrTERLNk9Fc3ptTQp5eXIreHhXdHlpdmVyZW1yV3FuS2tOVFloTGZZUGhnUWtjemliN2VVYWxtRmpVYmhXZEx2SGFrYkVnQ29kbjNiCmt6NTdtSW5YMlZwaURPS2c0a3lIZml1WFdwaUJxckN4MEtOTHB4bzNERVFjRmNzUVRlVEh6aDQ3NTJHVjA0UlUKVGkvR0VXeXpJc2w0Umc3dEd0QXdtY0lQZ1VOVWZZMlEzOTBGR3FkSDRhaG4rbXcvNmFGYlczMVc2M2Q5WUpWcQppb3lPVmNhTUlwTTVCL2M3UWM4U3VoQ0kxWUdoVXlnNGNSSExFdzVWdGlraW95RTNYMDRrbmEzalFBajU0WWJSCmJwRWhjMzVhcEtMQjIxSE9VUUlEQVFBQm8xTXdVVEFkQmdOVkhRNEVGZ1FVeXZsMFZJNXZKVlN1WUZYdTdCNDgKNlBiTUVBb3dId1lEVlIwakJCZ3dGb0FVeXZsMFZJNXZKVlN1WUZYdTdCNDg2UGJNRUFvd0R3WURWUjBUQVFILwpCQVV3QXdFQi96QU5CZ2txaGtpRzl3MEJBUXNGQUFPQ0FRRUFNTHhyZ0ZWTXVOUnEyd0F3Y0J0N1NuTlI1Q2Z6CjJNdlhxNUVVbXVhd0lVaTlrYVlqd2RWaURSRUdTams3SlcxN3ZsNTc2SGpEa2RmUndpNEUyOFN5ZFJJblpmNkoKaThIWmNaN2NhSDZEeFIzMzVmZ0hWekxpNU5pVGNlL09qTkJRelEyTUpYVkRkOERCbUc1ZnlhdEppT0pRNGJXRQpBN0ZsUDBSZFAzQ08zR1dFME01aVhPQjJtMXFXa0UyZXlPNFVIdndUcU5RTGRyZEFYZ0RRbGJhbTllNEJHM0dnCmQvNnRoQWtXRGJ0L1FOVCtFSkhEQ3ZoRFJLaDFSdUdIeWcrWSsvbmViVFdXckZXc2t0UnJiT29IQ1ppQ3BYSTEKM2VYRTZudDBZa2d0RHhHMjJLcW5ocEFnOWdVU3MyaGxob3h5dmt6eUYwbXU2TmhQbHdBZ25xNysvUT09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K | ||
name: policy-btls/backends-ca | ||
sni: example.com | ||
weight: 1 | ||
hostname: '*' | ||
isHTTP2: false | ||
name: httproute/envoy-gateway/httproute-btls/rule/0/match/0/* | ||
pathMatch: | ||
distinct: false | ||
exact: /exact | ||
name: "" |
Oops, something went wrong.