diff --git a/ngf/appworld/cafe-route-equal-weight.yaml b/ngf/appworld/cafe-route-equal-weight.yaml new file mode 100644 index 0000000..58e6d69 --- /dev/null +++ b/ngf/appworld/cafe-route-equal-weight.yaml @@ -0,0 +1,22 @@ +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: cafe-route +spec: + parentRefs: + - name: cafe-gateway + sectionName: http + hostnames: + - "cafe.example.com" + rules: + - matches: + - path: + type: PathPrefix + value: /coffee + backendRefs: + - name: coffee-v1 + port: 80 + weight: 50 + - name: coffee-v2 + port: 80 + weight: 50 diff --git a/ngf/appworld/cafe-route-v2.yaml b/ngf/appworld/cafe-route-v2.yaml new file mode 100644 index 0000000..04d806c --- /dev/null +++ b/ngf/appworld/cafe-route-v2.yaml @@ -0,0 +1,22 @@ +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: cafe-route +spec: + parentRefs: + - name: cafe-gateway + sectionName: http + hostnames: + - "cafe.example.com" + rules: + - matches: + - path: + type: PathPrefix + value: /coffee + backendRefs: + - name: coffee-v1 + port: 80 + weight: 0 + - name: coffee-v2 + port: 80 + weight: 100 diff --git a/ngf/appworld/cafe-route.yaml b/ngf/appworld/cafe-route.yaml new file mode 100644 index 0000000..559998e --- /dev/null +++ b/ngf/appworld/cafe-route.yaml @@ -0,0 +1,22 @@ +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: cafe-route +spec: + parentRefs: + - name: cafe-gateway + sectionName: http + hostnames: + - "cafe.example.com" + rules: + - matches: + - path: + type: PathPrefix + value: /coffee + backendRefs: + - name: coffee-v1 + port: 80 + weight: 80 + - name: coffee-v2 + port: 80 + weight: 20 diff --git a/ngf/appworld/coffee-app.yaml b/ngf/appworld/coffee-app.yaml new file mode 100644 index 0000000..82dc493 --- /dev/null +++ b/ngf/appworld/coffee-app.yaml @@ -0,0 +1,65 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: coffee-v1 +spec: + replicas: 1 + selector: + matchLabels: + app: coffee-v1 + template: + metadata: + labels: + app: coffee-v1 + spec: + containers: + - name: coffee-v1 + image: nginxdemos/nginx-hello:plain-text + ports: + - containerPort: 8080 +--- +apiVersion: v1 +kind: Service +metadata: + name: coffee-v1 +spec: + ports: + - port: 80 + targetPort: 8080 + protocol: TCP + name: http + selector: + app: coffee-v1 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: coffee-v2 +spec: + replicas: 1 + selector: + matchLabels: + app: coffee-v2 + template: + metadata: + labels: + app: coffee-v2 + spec: + containers: + - name: coffee-v2 + image: nginxdemos/nginx-hello:plain-text + ports: + - containerPort: 8080 +--- +apiVersion: v1 +kind: Service +metadata: + name: coffee-v2 +spec: + ports: + - port: 80 + targetPort: 8080 + protocol: TCP + name: http + selector: + app: coffee-v2 diff --git a/ngf/appworld/gateway.yaml b/ngf/appworld/gateway.yaml new file mode 100644 index 0000000..42aa488 --- /dev/null +++ b/ngf/appworld/gateway.yaml @@ -0,0 +1,11 @@ +apiVersion: gateway.networking.k8s.io/v1 +kind: Gateway +metadata: + name: cafe-gateway +spec: + gatewayClassName: nginx + listeners: + - name: http + hostname: "*.example.com" + port: 80 + protocol: HTTP