I am working on Opersator-SDK. In my operator controller, I try to create an Istio Custom resource -- virtualservices. The definition of virtualservices looks like as following:
kind: CustomResourceDefinition
apiVersion: apiextensions.k8s.io/v1beta1
metadata:
name: virtualservices.networking.istio.io
Here I think there are a few of things that have to do first:
- Get Istio API module
- In my controller code, import istio virtualservices package
- How to create/update virtualservice resource
My question is how to do them? Because I never do that before, so have to ask for help how to do that.
Here is an example of creating a istio virtual service using istio client-go. Here we are using
istio.io/api/networking/v1alpha3
andistio.io/client-go/pkg/apis/networking/v1alpha3
to create theVirtualService
custom resource spec. After that usingistio.io/client-go/pkg/clientset/versioned
to actually sending this spec to kubernetes API server.