Mixer Using a Custom Adapter
Congratulations! You've managed to build a complete Mixer adapter and have validated that it works via local testing.
Follow these steps to deploy a Mixer with your custom adapter to your service mesh for use:
- Build a docker image of Mixer with your custom adapter
- Generate the appropriate CRD for your custom adapter
- Deploy your CRD
- Edit the Mixer deployment configuration to reference your new image
- Celebrate
NOTE:
- All commands should be executed from the root of the istio.io/istio directory.
These instructions assume that:
-
docker
,kubectl
, andgcloud
commands are installed. -
kubectl
has been configured and is authorized to push to a cluster
-
Execute the following command, replacing the
HUB
andTAG
values with appropriate values for your environment:make HUB=<HUB> TAG=<TAG> push.docker.mixer
If you have set
HUB
andTAG
in a~./profile
or a.istiorc.mk
file, you can omit those arguments from the command.This should produce output similar to(below is the output on linux):
mkdir -p /usr/local/google/home/dougreid/go/out/linux_amd64/release/docker_temp cp docker/ca-certificates.tgz /usr/local/google/home/dougreid/go/out/linux_amd64/release/docker_temp bin/gobuild.sh /usr/local/google/home/dougreid/go/out/linux_amd64/release/mixs istio.io/istio/pkg/version ./mixer/cmd/mixs real 0m2.820s user 0m3.484s sys 0m0.556s cp /usr/local/google/home/dougreid/go/out/linux_amd64/release/mixs /usr/local/google/home/dougreid/go/out/linux_amd64/release/docker_temp time (cp mixer/docker/Dockerfile.mixer /usr/local/google/home/dougreid/go/out/linux_amd64/release/docker_temp/ && cd /usr/local/google/home/dougreid/go/out/linux_amd64/release/docker_temp && docker build -t gcr.io/istio-testing/mixer:dougreid -f Dockerfile.mixer .) Sending build context to Docker daemon 53.59MB Step 1/5 : FROM scratch ---> Step 2/5 : ADD ca-certificates.tgz / ---> Using cache ---> 2fd8c1938ef6 Step 3/5 : ADD mixs /usr/local/bin/ ---> Using cache ---> 2be7030a6854 Step 4/5 : ENTRYPOINT /usr/local/bin/mixs server ---> Using cache ---> d1e6674e0c9a Step 5/5 : CMD --configStoreURL=fs:///etc/opt/mixer/configroot --configStoreURL=k8s:// ---> Using cache ---> c6061add6e00 Successfully built c6061add6e00 Successfully tagged gcr.io/istio-testing/mixer:dougreid real 0m0.421s user 0m0.020s sys 0m0.052s time (gcloud docker -- push gcr.io/istio-testing/mixer:dougreid) The push refers to a repository [gcr.io/istio-testing/mixer] bd5beecafe98: Layer already exists 40ce24ada7d0: Layer already exists dougreid: digest: sha256:fe043cab14e4ac67aab2d7ec0047d40e6421223916d4576267e68daa7ba093df size: 739 real 0m2.226s user 0m0.396s sys 0m0.100s
-
The Mixer binary has a utility for generating the Custom Resource Definitions for adapters. Invoke this utility as follows:
// locate mixs binary, should be $GOPATH/out/linux_amd64/release/mixs on linux os and // $GOPATH/out/darwin_amd64/release/mixs on mac os. // Choose command below according to your os: $GOPATH/out/linux_amd64/release/mixs crd adapter
Find the stanza for your custom adapter and save it to a file, named something like
custom-crd.yaml
.The
custom-crd.yaml
file you generate should look similar to:kind: CustomResourceDefinition apiVersion: apiextensions.k8s.io/v1beta1 metadata: name: stdios.config.istio.io labels: package: stdio istio: mixer-adapter spec: group: config.istio.io names: kind: stdio plural: stdios singular: stdio scope: Namespaced version: v1alpha2
-
Execute the following command:
kubectl apply -f custom-crd.yaml
-
If you already have a Mixer instance running from a previous deployment of Istio, execute the following commands:
-
Execute the following command to open the configuration for the Mixer deployment.
kubectl -n istio-system edit deployment istio-telemetry
-
Change the
image
for the Mixer binary to match the tag for your new image.The
image
specification to change will look similar to:image: gcr.io/istio-testing/mixer:18a20f98c6e5d92817b9b00ed94c089f4e73aeec imagePullPolicy: IfNotPresent name: mixer
Update
image
with the image tag for your image. Pay careful attention to theimagePullPolicy
if you are attempting to reuse a tag. Exit and Save the file.The expected output is:
deployment "istio-mixer" edited
-
Please also update the Istio configuration specification (so that your changes are preserved).
Append the contents of
custom-crd.yaml
toinstall/kubernetes/helm/istio/charts/mixer/templates/crds.yaml
.Be sure to a new label in the
metadata/labels
section that matches:app: {{ template "mixer.name" . }}
-
Then regenerate the install artifacts via:
make generate_yaml
You will need to update the
istio.yaml
(or similar) artifact to the image you built in the previous steps.
If you do not already have a Mixer instance running, deploy Istio as follows (assuming
istio.yaml
is the desired deployment):kubectl apply -f install/kubernetes/istio.yaml
-
-
Woohoo! A new Mixer, built with your adapter code, should now be running in your cluster. Configure a handler for your custom adapter and begin sending it instances!
Visit istio.io to learn how to use Istio.
- Preparing for Development Mac
- Preparing for Development Linux
- Troubleshooting Development Environment
- Repository Map
- GitHub Workflow
- Github Gmail Filters
- Using the Code Base
- Developing with Minikube
- Remote Debugging
- Verify your Docker Environment
- Istio Test Framework
- Working with Prow
- Test Grid
- Code Coverage FAQ
- Writing Good Integration Tests
- Test Flakes
- Release Manager Expectations
- Preparing Istio Releases
- 1.5 Release Information
- 1.6 Release Information
- 1.7 Release Information
- 1.8 Release Information
- 1.9 Release Information
- 1.10 Release Information
- 1.11 Release Information
- 1.12 Release Information
- 1.13 Release Information
- 1.14 Release Information
- 1.15 Release Information
- 1.16 Release Information
- 1.17 Release Information
- 1.18 Release Information
- 1.19 Release Information
- 1.20 Release Information
- 1.21 Release Information
- 1.22 Release Information
- Collecting Logs and Debug Info
- Dependency FAQ
- Working with discuss.istio.io
- Developing with and hosting upon OpenShift
- Adapter Dev Guide
- Adapter Walkthrough
- Attribute Generating Adapter Walkthrough
- Route Directive Adapter Development Guide
- Out of Tree Adapter Walkthrough
- Running a Local Instance
- Template Dev Guide
- Using a Custom Adapter
- Publishing Adapters and Templates to istio.io
- Enabling Envoy Authorization Service and gRPC Access Log Service With Mixer