Skip to content

Commit 57336d6

Browse files
committed
Integration with more edge variants
1 parent 48836e5 commit 57336d6

File tree

7 files changed

+33
-10
lines changed

7 files changed

+33
-10
lines changed

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ CONTAINER_SOURCES := $(shell find var/container)
1515
HELM_SOURCES := $(shell find var/helm)
1616
HELM_TARGET := dist/mrmat-python-api-fastapi-$(VERSION).tgz
1717

18+
# Can be either 'sidecar' or 'ambient'
1819
ISTIO := ambient
1920

2021
all: python container helm
@@ -50,7 +51,8 @@ helm-install: $(HELM_TARGET)
5051
--install \
5152
--wait \
5253
--force \
53-
--namespace mpafastapi
54+
--namespace mpafastapi \
55+
--set istio=$(ISTIO)
5456

5557
helm-uninstall:
5658
helm delete -n mpafastapi mrmat-python-api-fastapi

src/mrmat_python_api_fastapi/app.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# SOFTWARE.
2222

2323
from fastapi import FastAPI
24+
from fastapi.security import OAuth2PasswordBearer
2425

2526
from prometheus_fastapi_instrumentator import Instrumentator
2627

@@ -29,6 +30,7 @@
2930
from mrmat_python_api_fastapi.apis.platform import api_platform_v1
3031

3132
app = FastAPI(title='MrMat :: Python :: API :: FastAPI')
33+
oauth2_scheme = OAuth2PasswordBearer(tokenUrl='token')
3234
app.include_router(api_healthz, prefix='/api/healthz', tags=['health'])
3335
app.include_router(api_greeting_v1, prefix='/api/greeting/v1', tags=['greeting'])
3436
app.include_router(api_greeting_v2, prefix='/api/greeting/v2', tags=['greeting'])

var/helm/templates/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ spec:
3737
- name: APP_CONFIG
3838
value: /config/app_config.json
3939
- name: OTEL_SERVICE_NAME
40-
value: "mrmat-python-api-fastapi"
40+
value: "{{ .Release.Namespace }}.mpafastapi"
4141
- name: OTEL_TRACES_EXPORTER
4242
value: "otlp"
4343
- name: OTEL_METRICS_EXPORTER
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if .Values.ingress.enabled }}
1+
{{- if eq .Values.edge.kind "ingress" }}
22
---
33
apiVersion: networking.k8s.io/v1
44
kind: Ingress

var/helm/templates/route.yaml renamed to var/helm/templates/edge-istio-gateway-api.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if .Values.route.enabled -}}
1+
{{- if eq .Values.edge.kind "istio-gateway-api" -}}
22
apiVersion: gateway.networking.k8s.io/v1
33
kind: HTTPRoute
44
metadata:
@@ -11,13 +11,11 @@ spec:
1111
- {{ . | quote }}
1212
{{- end }}
1313
parentRefs:
14-
{{- range .Values.route.parents }}
1514
- group: gateway.networking.k8s.io
1615
kind: Gateway
17-
name: {{ .name }}
18-
namespace: {{ .namespace }}
16+
name: {{ .Values.edge.name }}
17+
namespace: {{ .Values.edge.ns }}
1918
sectionName: mpafastapi
20-
{{- end }}
2119
rules:
2220
- backendRefs:
2321
- kind: Service

var/helm/templates/edge-istio.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{{- if eq .Values.edge.kind "istio" }}
2+
---
3+
apiVersion: gateway.networking.k8s.io/v1
4+
kind: Gateway
5+
metadata:
6+
name: waypoint
7+
namespace: {{ .Release.Namespace }}
8+
spec:
9+
gatewayClassName: istio-waypoint
10+
listeners:
11+
- name: mesh
12+
port: 15008
13+
protocol: HBONE
14+
{{- end }}

var/helm/values.yaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,24 @@ svc:
1515
name: svc-mpafastapi
1616
port: 80
1717

18+
edge:
19+
ns: edge
20+
name: edge-ingress
21+
kind: istio-gateway-api
22+
1823
route:
1924
enabled: false
2025
name: route-mpafastapi
2126
hostnames:
22-
- mpafastapi.covenant.local
27+
- mpafastapi.nostromo.k8s
2328
parents:
2429
- name: edge-ingress
2530
namespace: edge
2631

32+
istio: ambient
33+
2734
ingress:
28-
enabled: true
35+
enabled: false
2936
hostname: mpafastapi.nostromo.k8s
3037

3138
config:

0 commit comments

Comments
 (0)