forked from envoyproxy/gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add EnvoyProxy resource validation to
egctl translate
Relates to envoyproxy#31 Signed-off-by: Arko Dasgupta <arko@tetrate.io>
- Loading branch information
Showing
10 changed files
with
1,087 additions
and
19 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
182 changes: 182 additions & 0 deletions
182
internal/cmd/egctl/testdata/translate/in/invalid-envoyproxy.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,182 @@ | ||
apiVersion: config.gateway.envoyproxy.io/v1alpha1 | ||
kind: EnvoyProxy | ||
metadata: | ||
name: example | ||
namespace: default | ||
spec: | ||
bootstrap: blah | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1beta1 | ||
kind: GatewayClass | ||
metadata: | ||
name: eg | ||
spec: | ||
controllerName: gateway.envoyproxy.io/gatewayclass-controller | ||
parametersRef: | ||
group: config.gateway.envoyproxy.io | ||
kind: EnvoyProxy | ||
name: example | ||
namespace: default | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1beta1 | ||
kind: Gateway | ||
metadata: | ||
name: eg | ||
namespace: default | ||
spec: | ||
gatewayClassName: eg | ||
listeners: | ||
- name: tcp | ||
protocol: TCP | ||
port: 1234 | ||
- name: udp | ||
protocol: UDP | ||
port: 1234 | ||
- name: tls-passthrough | ||
protocol: TLS | ||
port: 8443 | ||
hostname: foo.com | ||
tls: | ||
mode: Passthrough | ||
- name: http | ||
protocol: HTTP | ||
port: 80 | ||
allowedRoutes: | ||
kinds: | ||
- kind: HTTPRoute | ||
group: gateway.networking.k8s.io | ||
- name: grpc | ||
protocol: HTTP | ||
port: 8080 | ||
allowedRoutes: | ||
kinds: | ||
- kind: GRPCRoute | ||
group: gateway.networking.k8s.io | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: default | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: backend | ||
namespace: default | ||
labels: | ||
app: backend | ||
service: backend | ||
spec: | ||
clusterIP: "1.1.1.1" | ||
type: ClusterIP | ||
ports: | ||
- name: http | ||
port: 3000 | ||
targetPort: 3000 | ||
protocol: TCP | ||
- name: http | ||
port: 9000 | ||
protocol: TCP | ||
targetPort: 9000 | ||
- name: udp | ||
port: 3000 | ||
targetPort: 3000 | ||
protocol: UDP | ||
selector: | ||
app: backend | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1alpha2 | ||
kind: TCPRoute | ||
metadata: | ||
name: backend | ||
namespace: default | ||
spec: | ||
parentRefs: | ||
- name: eg | ||
sectionName: tcp | ||
rules: | ||
- backendRefs: | ||
- group: "" | ||
kind: Service | ||
name: backend | ||
port: 3000 | ||
weight: 1 | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1alpha2 | ||
kind: UDPRoute | ||
metadata: | ||
name: backend | ||
namespace: default | ||
spec: | ||
parentRefs: | ||
- name: eg | ||
sectionName: udp | ||
rules: | ||
- backendRefs: | ||
- group: "" | ||
kind: Service | ||
name: backend | ||
port: 3000 | ||
weight: 1 | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1alpha2 | ||
kind: TLSRoute | ||
metadata: | ||
name: backend | ||
namespace: default | ||
spec: | ||
parentRefs: | ||
- name: eg | ||
sectionName: tls-passthrough | ||
rules: | ||
- backendRefs: | ||
- group: "" | ||
kind: Service | ||
name: backend | ||
port: 3000 | ||
weight: 1 | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1beta1 | ||
kind: HTTPRoute | ||
metadata: | ||
name: backend | ||
namespace: default | ||
spec: | ||
parentRefs: | ||
- name: eg | ||
hostnames: | ||
- "www.example.com" | ||
rules: | ||
- backendRefs: | ||
- group: "" | ||
kind: Service | ||
name: backend | ||
port: 3000 | ||
weight: 1 | ||
matches: | ||
- path: | ||
type: PathPrefix | ||
value: / | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1alpha2 | ||
kind: GRPCRoute | ||
metadata: | ||
name: backend | ||
namespace: default | ||
spec: | ||
parentRefs: | ||
- name: eg | ||
sectionName: grpc | ||
hostnames: | ||
- "www.grpc-example.com" | ||
rules: | ||
- matches: | ||
- method: | ||
service: com.example.Things | ||
method: DoThing | ||
backendRefs: | ||
- group: "" | ||
kind: Service | ||
name: backend | ||
port: 9000 | ||
weight: 1 |
187 changes: 187 additions & 0 deletions
187
internal/cmd/egctl/testdata/translate/in/valid-envoyproxy.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,187 @@ | ||
apiVersion: config.gateway.envoyproxy.io/v1alpha1 | ||
kind: EnvoyProxy | ||
metadata: | ||
name: example | ||
namespace: default | ||
spec: | ||
provider: | ||
type: Kubernetes | ||
kubernetes: | ||
envoyService: | ||
annotations: | ||
custom1: svc-annotation1 | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1beta1 | ||
kind: GatewayClass | ||
metadata: | ||
name: eg | ||
spec: | ||
controllerName: gateway.envoyproxy.io/gatewayclass-controller | ||
parametersRef: | ||
group: config.gateway.envoyproxy.io | ||
kind: EnvoyProxy | ||
name: example | ||
namespace: default | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1beta1 | ||
kind: Gateway | ||
metadata: | ||
name: eg | ||
namespace: default | ||
spec: | ||
gatewayClassName: eg | ||
listeners: | ||
- name: tcp | ||
protocol: TCP | ||
port: 1234 | ||
- name: udp | ||
protocol: UDP | ||
port: 1234 | ||
- name: tls-passthrough | ||
protocol: TLS | ||
port: 8443 | ||
hostname: foo.com | ||
tls: | ||
mode: Passthrough | ||
- name: http | ||
protocol: HTTP | ||
port: 80 | ||
allowedRoutes: | ||
kinds: | ||
- kind: HTTPRoute | ||
group: gateway.networking.k8s.io | ||
- name: grpc | ||
protocol: HTTP | ||
port: 8080 | ||
allowedRoutes: | ||
kinds: | ||
- kind: GRPCRoute | ||
group: gateway.networking.k8s.io | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: default | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: backend | ||
namespace: default | ||
labels: | ||
app: backend | ||
service: backend | ||
spec: | ||
clusterIP: "1.1.1.1" | ||
type: ClusterIP | ||
ports: | ||
- name: http | ||
port: 3000 | ||
targetPort: 3000 | ||
protocol: TCP | ||
- name: http | ||
port: 9000 | ||
protocol: TCP | ||
targetPort: 9000 | ||
- name: udp | ||
port: 3000 | ||
targetPort: 3000 | ||
protocol: UDP | ||
selector: | ||
app: backend | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1alpha2 | ||
kind: TCPRoute | ||
metadata: | ||
name: backend | ||
namespace: default | ||
spec: | ||
parentRefs: | ||
- name: eg | ||
sectionName: tcp | ||
rules: | ||
- backendRefs: | ||
- group: "" | ||
kind: Service | ||
name: backend | ||
port: 3000 | ||
weight: 1 | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1alpha2 | ||
kind: UDPRoute | ||
metadata: | ||
name: backend | ||
namespace: default | ||
spec: | ||
parentRefs: | ||
- name: eg | ||
sectionName: udp | ||
rules: | ||
- backendRefs: | ||
- group: "" | ||
kind: Service | ||
name: backend | ||
port: 3000 | ||
weight: 1 | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1alpha2 | ||
kind: TLSRoute | ||
metadata: | ||
name: backend | ||
namespace: default | ||
spec: | ||
parentRefs: | ||
- name: eg | ||
sectionName: tls-passthrough | ||
rules: | ||
- backendRefs: | ||
- group: "" | ||
kind: Service | ||
name: backend | ||
port: 3000 | ||
weight: 1 | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1beta1 | ||
kind: HTTPRoute | ||
metadata: | ||
name: backend | ||
namespace: default | ||
spec: | ||
parentRefs: | ||
- name: eg | ||
hostnames: | ||
- "www.example.com" | ||
rules: | ||
- backendRefs: | ||
- group: "" | ||
kind: Service | ||
name: backend | ||
port: 3000 | ||
weight: 1 | ||
matches: | ||
- path: | ||
type: PathPrefix | ||
value: / | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1alpha2 | ||
kind: GRPCRoute | ||
metadata: | ||
name: backend | ||
namespace: default | ||
spec: | ||
parentRefs: | ||
- name: eg | ||
sectionName: grpc | ||
hostnames: | ||
- "www.grpc-example.com" | ||
rules: | ||
- matches: | ||
- method: | ||
service: com.example.Things | ||
method: DoThing | ||
backendRefs: | ||
- group: "" | ||
kind: Service | ||
name: backend | ||
port: 9000 | ||
weight: 1 |
Oops, something went wrong.