diff --git a/examples/external-processing/01-upstream.yaml b/examples/external-processing/01-upstream.yaml new file mode 100644 index 00000000000..0e61d40478d --- /dev/null +++ b/examples/external-processing/01-upstream.yaml @@ -0,0 +1,177 @@ +--- +apiVersion: v1 +kind: Namespace +metadata: + name: extproc-test + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: http-echo + namespace: extproc-test +spec: + replicas: 1 + selector: + matchLabels: + app: http-echo + template: + metadata: + labels: + app: http-echo + spec: + containers: + - name: http-echo + image: hashicorp/http-echo + args: + - '-text=hello http-echo' + ports: + - name: http + containerPort: 5678 + protocol: TCP + imagePullPolicy: Always +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: http-echo2 + namespace: extproc-test +spec: + replicas: 1 + selector: + matchLabels: + app: http-echo2 + template: + metadata: + labels: + app: http-echo2 + spec: + containers: + - name: http-echo2 + image: hashicorp/http-echo + args: + - '-text=hello http-echo2' + ports: + - name: http + containerPort: 5678 + protocol: TCP +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: http-echo3 + namespace: extproc-test +spec: + replicas: 1 + selector: + matchLabels: + app: http-echo3 + template: + metadata: + labels: + app: http-echo3 + spec: + containers: + - name: http-echo3 + image: hashicorp/http-echo + args: + - '-text=hello http-echo3' + ports: + - name: http + containerPort: 5678 + protocol: TCP +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: http-echo4 + namespace: extproc-test +spec: + replicas: 1 + selector: + matchLabels: + app: http-echo4 + template: + metadata: + labels: + app: http-echo4 + spec: + containers: + - name: http-echo + image: hashicorp/http-echo + args: + - '-text=hello http-echo4' + ports: + - name: http + containerPort: 5678 + protocol: TCP + imagePullPolicy: Always +--- +apiVersion: v1 +kind: Service +metadata: + name: http-echo-service + namespace: extproc-test + labels: + app: http-echo +spec: + ports: + - name: http + protocol: TCP + port: 5678 + targetPort: 5678 + selector: + app: http-echo + type: NodePort + +--- +apiVersion: v1 +kind: Service +metadata: + name: http-echo-service2 + namespace: extproc-test + labels: + app: http-echo2 +spec: + ports: + - name: http + protocol: TCP + port: 5678 + targetPort: 5678 + selector: + app: http-echo2 + type: NodePort +--- +apiVersion: v1 +kind: Service +metadata: + name: http-echo-service3 + namespace: extproc-test + labels: + app: http-echo3 +spec: + ports: + - name: http + protocol: TCP + port: 5678 + targetPort: 5678 + selector: + app: http-echo3 + type: NodePort +--- +apiVersion: v1 +kind: Service +metadata: + name: http-echo-service4 + namespace: extproc-test + labels: + app: http-echo4 +spec: + ports: + - name: http + protocol: TCP + port: 5678 + targetPort: 5678 + selector: + app: http-echo4 + type: NodePort \ No newline at end of file diff --git a/examples/external-processing/02-extproc.yaml b/examples/external-processing/02-extproc.yaml new file mode 100644 index 00000000000..3b724133ae3 --- /dev/null +++ b/examples/external-processing/02-extproc.yaml @@ -0,0 +1,202 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: extproc + namespace: extproc-test + labels: + app: extproc +spec: + replicas: 1 + selector: + matchLabels: + app: extproc + template: + metadata: + labels: + app: extproc + spec: + containers: + - name: extproc + image: tempvar/extproc:v0.0.1 + command: + - extproc + args: + - timer + ports: + - name: grpc + containerPort: 50051 + protocol: TCP + imagePullPolicy: Always + restartPolicy: Always + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: extproc2 + namespace: extproc-test + labels: + app: extproc2 +spec: + replicas: 1 + selector: + matchLabels: + app: extproc2 + template: + metadata: + labels: + app: extproc2 + spec: + containers: + - name: extproc + image: tempvar/extproc:v0.0.1 + command: + - extproc + args: + - noop + ports: + - name: grpc + containerPort: 50051 + protocol: TCP + imagePullPolicy: Always + restartPolicy: Always + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: extproc3 + namespace: extproc-test + labels: + app: extproc3 +spec: + replicas: 1 + selector: + matchLabels: + app: extproc3 + template: + metadata: + labels: + app: extproc3 + spec: + containers: + - name: extproc + image: tempvar/extproc:v0.0.1 + command: + - extproc + args: + - echo + ports: + - name: grpc + containerPort: 50051 + protocol: TCP + imagePullPolicy: Always + restartPolicy: Always +--- + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: extproc4 + namespace: extproc-test + labels: + app: extproc4 +spec: + replicas: 1 + selector: + matchLabels: + app: extproc4 + template: + metadata: + labels: + app: extproc4 + spec: + containers: + - name: extproc + image: tempvar/extproc:v0.0.1 + command: + - extproc + args: + - trivial + ports: + - name: grpc + containerPort: 50051 + protocol: TCP + imagePullPolicy: Always + restartPolicy: Always + +--- +apiVersion: v1 +kind: Service +metadata: + name: extproc-service + namespace: extproc-test + labels: + app: extproc +spec: + ports: + - name: grpc + protocol: TCP + port: 50051 + targetPort: 50051 + selector: + app: extproc + type: NodePort + +--- +apiVersion: v1 +kind: Service +metadata: + name: extproc-service2 + namespace: extproc-test + labels: + app: extproc2 +spec: + ports: + - name: grpc + protocol: TCP + port: 50051 + targetPort: 50051 + selector: + app: extproc2 + type: NodePort + +--- +apiVersion: v1 +kind: Service +metadata: + name: extproc-service3 + namespace: extproc-test + labels: + app: extproc3 +spec: + ports: + - name: grpc + protocol: TCP + port: 50051 + targetPort: 50051 + selector: + app: extproc3 + type: NodePort + +--- +apiVersion: v1 +kind: Service +metadata: + name: extproc-service4 + namespace: extproc-test + labels: + app: extproc4 +spec: + ports: + - name: grpc + protocol: TCP + port: 50051 + targetPort: 50051 + selector: + app: extproc4 + type: NodePort + +--- diff --git a/examples/external-processing/03-contour.yaml b/examples/external-processing/03-contour.yaml new file mode 100644 index 00000000000..628583b4415 --- /dev/null +++ b/examples/external-processing/03-contour.yaml @@ -0,0 +1,205 @@ +apiVersion: v1 +kind: Secret +metadata: + name: extproc-test-tls + namespace: extproc-test +data: + tls.crt: >- + LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURNekNDQWhzQ0ZBbzRkQWVqQnptWFFmYlpGOWF6RVd3MVhqUXhNQTBHQ1NxR1NJYjNEUUVCQ3dVQU1FVXgKQ3pBSkJnTlZCQVlUQWtGVk1STXdFUVlEVlFRSURBcFRiMjF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5SFJRSWRFY2VOM05tQWJBZGJSSTkKSk5qekh3M2t3a2k2QmVOWFpkYkovRGhrcVdqZ21DZ29QUVhrT0M0eVBUbE5ua2RCTHpPeFVQelFDZnVHTzBWYQpwZnJXM2FXeXR3NC9PSWJNdnlTZlBsa0owc1ZNdTdyajdNcC9HV1FMMEY0QzVPeXlybXhFQ0x2emlpS2ExSXp2CnFSV2pBMlVDZ1lBVUtIblVSS2lmRlRva1l2Q3JZdTB6R0N1UTZQOEhFQWVKNzJHOEJPdG1qSnQraTNEM1ZxNkQKV05rbG5neXRUV1Z3bmlsYVBTN2lKbHlGTW0yWitUNHhNYlhpT0FEM0ZEVmJBYjJWYU5ydkQvK09tWVpnUnA0YQpSYVVXOHRkazBSTTRERENPRStVWTZkd2NsVDE5UStqK2psbTcrUEpBTFJ5aXZXVkxWazVaYXc9PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo= +type: kubernetes.io/tls + +--- +apiVersion: projectcontour.io/v1alpha1 +kind: ExtensionService +metadata: + name: extproc-extsvc + namespace: extproc-test +spec: + loadBalancerPolicy: + strategy: RoundRobin + protocol: h2c + protocolVersion: v3 + services: + - name: extproc-service + port: 50051 + timeoutPolicy: + response: 60s +--- +apiVersion: projectcontour.io/v1alpha1 +kind: ExtensionService +metadata: + name: extproc-extsvc2 + namespace: extproc-test +spec: + loadBalancerPolicy: + strategy: RoundRobin + protocol: h2c + protocolVersion: v3 + services: + - name: extproc-service2 + port: 50051 + timeoutPolicy: + response: 60s + +--- +apiVersion: projectcontour.io/v1alpha1 +kind: ExtensionService +metadata: + name: extproc-extsvc3 + namespace: extproc-test +spec: + loadBalancerPolicy: + strategy: RoundRobin + protocol: h2c + protocolVersion: v3 + services: + - name: extproc-service3 + port: 50051 + timeoutPolicy: + response: 60s + +--- +apiVersion: projectcontour.io/v1alpha1 +kind: ExtensionService +metadata: + name: extproc-extsvc4 + namespace: extproc-test +spec: + loadBalancerPolicy: + strategy: RoundRobin + protocol: h2c + protocolVersion: v3 + services: + - name: extproc-service4 + port: 50051 + timeoutPolicy: + response: 60s +--- + +apiVersion: projectcontour.io/v1alpha1 +kind: ContourConfiguration +metadata: + name: extproc-contourconfig + namespace: extproc-test +spec: + globalExtProc: + processors: + - grpcService: + extensionRef: + apiVersion: projectcontour.io/v1alpha1 + name: extproc-extsvc + namespace: extproc-test + failOpen: true + responseTimeout: 60s + processingMode: + requestBodyMode: NONE + requestHeaderMode: SEND + requestTrailerMode: SKIP + responseBodyMode: NONE + responseHeaderMode: SEND + responseTrailerMode: SKIP + - grpcService: + extensionRef: + apiVersion: projectcontour.io/v1alpha1 + name: extproc-extsvc2 + namespace: extproc-test + failOpen: true + responseTimeout: 60s + processingMode: + requestBodyMode: NONE + requestHeaderMode: SEND + requestTrailerMode: SKIP + responseBodyMode: NONE + responseHeaderMode: SEND + responseTrailerMode: SKIP + httpproxy: + rootNamespaces: + - extproc-test + xdsServer: + type: envoy + tls: + insecure: true + gateway: + controllerName: projectcontour.io/projectcontour/contour + +--- +apiVersion: projectcontour.io/v1 +kind: HTTPProxy +metadata: + name: extproc-fine-grained + namespace: extproc-test +spec: + routes: + - conditions: + - prefix: /disabled + extProcPolicy: + disabled: true + services: + - name: http-echo-service + port: 5678 + - conditions: + - prefix: /use-vh + services: + - name: http-echo-service2 + port: 5678 + - conditions: + - prefix: /use-route + extProcPolicy: + overrides: + grpcService: + extensionRef: + apiVersion: projectcontour.io/v1alpha1 + name: extproc-extsvc3 + namespace: extproc-test + failOpen: true + responseTimeout: 30s + processingMode: + requestBodyMode: NONE + requestHeaderMode: SEND + requestTrailerMode: SKIP + responseBodyMode: NONE + responseHeaderMode: SEND + responseTrailerMode: SKIP + services: + - name: http-echo-service3 + port: 5678 + virtualhost: + fqdn: https.projectcontour.io + tls: + secretName: extproc-test-tls + extProc: + extProcPolicy: + disabled: false + processors: + - grpcService: + extensionRef: + apiVersion: projectcontour.io/v1alpha1 + name: extproc-extsvc4 + namespace: extproc-test + failOpen: true + responseTimeout: 60s + processingMode: + requestBodyMode: NONE + requestHeaderMode: SEND + requestTrailerMode: SKIP + responseBodyMode: NONE + responseHeaderMode: SEND + responseTrailerMode: SKIP +--- + +apiVersion: projectcontour.io/v1 +kind: HTTPProxy +metadata: + name: extproc-use-default + namespace: extproc-test +spec: + routes: + - conditions: + - prefix: /use-default + services: + - name: http-echo-service4 + port: 5678 + virtualhost: + fqdn: http.projectcontour.io \ No newline at end of file