virtual-service-route-controller

command module
v0.0.0-...-ae0378f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 9, 2024 License: MIT Imports: 11 Imported by: 0

README

Virtual Service Route Controller

Construct Istio VirtualService resource from some components.

✍ This is study about custom controller.

Usage

  1. Create VirtualServiceBase resource.
$ cat <<EOF | kubectl apply -f -
apiVersion: virtualservicecomponent.shibataka000.com/v1alpha1
kind: VirtualServiceBase
metadata:
  name: virtualservicebase-sample
spec:
  gateways:
  - gateway
  hosts:
  - '*'
EOF
  1. Create HTTPRouteBinding resources.
$ cat <<EOF | kubectl apply -f -
apiVersion: virtualservicecomponent.shibataka000.com/v1alpha1
kind: HTTPRouteBinding
metadata:
  name: httproutebinding-sample-1
spec:
  virtualServiceBaseRef:
    apiVersion: virtualservicecomponent.shibataka000.com/v1alpha1
    kind: VirtualServiceBase
    name: virtualservicebase-sample
    namespace: default
  httpRoute:
    match:
    - headers:
        key:
          exact: mysubset-1
    route:
    - destination:
        host: myhost
        subset: mysubset-1
EOF

$ cat <<EOF | kubectl apply -f -
apiVersion: virtualservicecomponent.shibataka000.com/v1alpha1
kind: HTTPRouteBinding
metadata:
  name: httproutebinding-sample-2
spec:
  virtualServiceBaseRef:
    apiVersion: virtualservicecomponent.shibataka000.com/v1alpha1
    kind: VirtualServiceBase
    name: virtualservicebase-sample
    namespace: default
  httpRoute:
    match:
    - headers:
        key:
          exact: mysubset-2
    route:
    - destination:
        host: myhost
        subset: mysubset-2
EOF
  1. VirtualServiceRouteController construct VirtualService resource from VirtualServiceBase and HTTPRouteBinding . You can see created resource as follows.
$ kubectl get virtualservices.networking.istio.io virtualservicebase-sample -o yaml
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
  name: virtualservicebase-sample
  namespace: default
spec:
  gateways:
  - gateway
  hosts:
  - '*'
  http:
  - match:
    - headers:
        key:
          exact: mysubset-1
    route:
    - destination:
        host: myhost
        subset: mysubset-1
  - match:
    - headers:
        key:
          exact: mysubset-2
    route:
    - destination:
        host: myhost
        subset: mysubset-2

Requirement

Install

  1. Deploy Istio to your kubernetes cluster. See Setup more details.
  2. Deploy VirtualServiceRouteController and CRDs to your kubernetes cluster.
TBD

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
api
v1alpha1
Package v1alpha1 contains API Schema definitions for the virtualservicecomponent v1alpha1 API group +kubebuilder:object:generate=true +groupName=virtualservicecomponent.shibataka000.com
Package v1alpha1 contains API Schema definitions for the virtualservicecomponent v1alpha1 API group +kubebuilder:object:generate=true +groupName=virtualservicecomponent.shibataka000.com

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL