This is a Pepr Module to implement the modifications to an application to inject istio into an application. Pepr is a Kubernetes transformation system written in Typescript.
- Enable the istio (side car injection)
- Create the virtual service for an applications via either a service or a ingress object
[BigBang Service Mesh]https://repo1.dso.mil/big-bang/bigbang/-/blob/master/docs/developer/package-integration/service-mesh.md
- Istio must be deployed (This has been primarily tested with 1.19)
- Kubernetes 1.19+ (for changes to the ingress API)
- an object to drive this capability: (ingress or a service)
Example of ingress object:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: podinfo
namespace: podinfo
annotations:
# OPTIONAL: the default is "istio-system/tenant"
pepr.dev/gateway: istio-system/tenant
spec:
ingressClassName: pepr-istio
rules:
# REQUIRED, this segment must be set to define the host, service, and port
- host: "podinfo.bigbang.dev"
http:
paths:
- path: /
pathType: ImplementationSpecific
backend:
service:
name: podinfo
port:
number: 80
Example of a service:
apiVersion: v1
kind: Service
metadata:
# metadata.name will be the hostname
# TBD: how to configure the domain (default in the istio.ts)
name: myapp
namespace: myapp
labels:
pepr.dev/ingress: true
spec:
selector:
app: myapp
ports:
- protocol: TCP
# TBD: how to configure which port to use, currently will always pick up 80/443
port: 80
targetPort: 9376
The capability
here is pulled into a module with pepr.ts
file as import { Istio } from "./capabilities/istio";
.
Module Root
├── package.json
├── pepr.ts
└── capabilities
├── istio.ts
└── lib
├── ingress-to-virtualservice.ts
├── virtualservice-type.ts
├── kubernetes-api.ts
└── service-to-virtualservice.ts