-
Notifications
You must be signed in to change notification settings - Fork 67
1418 lines (1214 loc) · 54.9 KB
/
operator-integration-test.yml
File metadata and controls
1418 lines (1214 loc) · 54.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
name: Operator Integration Test
on:
workflow_dispatch:
pull_request:
branches:
- main
paths:
- 'gateway/**'
- 'kubernetes/**'
- '.github/workflows/operator-integration-test.yml'
env:
DOCKER_REGISTRY: localhost
VERSION: test
KIND_CLUSTER_NAME: operator-test
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
jobs:
integration-test:
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.26.1'
cache-dependency-path: '**/go.sum'
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker
- name: Create Kind cluster
uses: helm/kind-action@v1
with:
cluster_name: ${{ env.KIND_CLUSTER_NAME }}
wait: 300s
- name: Build Gateway
run: |
cd gateway
export DOCKER_REGISTRY=${{ env.DOCKER_REGISTRY }}
make build VERSION=${{ env.VERSION }}
- name: Build Operator image
run: |
cd kubernetes/gateway-operator
IMG=${{ env.DOCKER_REGISTRY }}/gateway-operator:${{ env.VERSION }} make docker-build
- name: Build Mock JWKS image
run: |
cd tests/mock-servers/mock-jwks
docker build -t ${{ env.DOCKER_REGISTRY }}/mock-jwks:${{ env.VERSION }} .
- name: Load images into Kind
run: |
kind load docker-image ${{ env.DOCKER_REGISTRY }}/gateway-controller:${{ env.VERSION }} --name ${{ env.KIND_CLUSTER_NAME }}
kind load docker-image ${{ env.DOCKER_REGISTRY }}/gateway-runtime:${{ env.VERSION }} --name ${{ env.KIND_CLUSTER_NAME }}
kind load docker-image ${{ env.DOCKER_REGISTRY }}/gateway-operator:${{ env.VERSION }} --name ${{ env.KIND_CLUSTER_NAME }}
kind load docker-image ${{ env.DOCKER_REGISTRY }}/mock-jwks:${{ env.VERSION }} --name ${{ env.KIND_CLUSTER_NAME }}
- name: Deploy OCI Registry (HTTP)
run: |
# Create namespace
kubectl create namespace registry
# Deploy registry without TLS (plain HTTP for testing)
cat <<EOF | kubectl apply -f -
apiVersion: apps/v1
kind: Deployment
metadata:
name: registry
namespace: registry
spec:
replicas: 1
selector:
matchLabels:
app: registry
template:
metadata:
labels:
app: registry
spec:
containers:
- name: registry
image: registry:2
ports:
- containerPort: 5000
---
apiVersion: v1
kind: Service
metadata:
name: registry
namespace: registry
spec:
selector:
app: registry
ports:
- port: 5000
targetPort: 5000
EOF
kubectl wait --for=condition=available deployment/registry -n registry --timeout=120s
kubectl wait --for=condition=ready pod -l app=registry -n registry --timeout=120s
- name: Package and push Gateway Helm chart to OCI Registry
run: |
cd kubernetes/helm/gateway-helm-chart
helm package . --version 0.0.0-test
# Port forward registry to push chart (plain HTTP)
kubectl port-forward svc/registry -n registry 5000:5000 &
sleep 5
# Push chart to OCI registry (plain HTTP, use insecure flag)
helm push gateway-0.0.0-test.tgz oci://localhost:5000/charts --plain-http
# Kill port forward
pkill -f "kubectl port-forward.*registry" || true
- name: Deploy mock httpbin backend
run: |
cat <<EOF | kubectl apply -f -
apiVersion: apps/v1
kind: Deployment
metadata:
name: httpbin
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: httpbin
template:
metadata:
labels:
app: httpbin
spec:
containers:
- name: httpbin
image: kennethreitz/httpbin:latest
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: httpbin
namespace: default
spec:
selector:
app: httpbin
ports:
- port: 80
targetPort: 80
EOF
kubectl wait --for=condition=ready pod -l app=httpbin --timeout=120s
- name: Deploy Mock JWKS Service
run: |
cat <<EOF | kubectl apply -f -
apiVersion: apps/v1
kind: Deployment
metadata:
name: mock-jwks
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: mock-jwks
template:
metadata:
labels:
app: mock-jwks
spec:
containers:
- name: mock-jwks
image: ${{ env.DOCKER_REGISTRY }}/mock-jwks:${{ env.VERSION }}
ports:
- containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
name: mock-jwks
namespace: default
spec:
selector:
app: mock-jwks
ports:
- port: 8080
targetPort: 8080
EOF
kubectl wait --for=condition=ready pod -l app=mock-jwks --timeout=120s
- name: Install cert-manager
run: |
helm upgrade --install cert-manager oci://quay.io/jetstack/charts/cert-manager \
--version v1.17.2 \
--namespace cert-manager \
--create-namespace \
--set crds.enabled=true \
--wait --timeout 5m
- name: Install Operator Helm chart
run: |
helm upgrade --install gateway-operator ./kubernetes/helm/operator-helm-chart \
--namespace operator \
--create-namespace \
--set image.repository=${{ env.DOCKER_REGISTRY }}/gateway-operator \
--set image.tag=${{ env.VERSION }} \
--set image.pullPolicy=Never \
--set gateway.helm.chartName=oci://registry.registry.svc.cluster.local:5000/charts/gateway \
--set gateway.helm.chartVersion=0.0.0-test \
--set gateway.helm.plainHTTP=true \
--wait --timeout 5m
kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=gateway-operator -n operator --timeout=120s
- name: Create encryption key secret
run: |
kubectl create secret generic gateway-encryption-keys \
--from-file=default-aesgcm256-v1.bin=gateway/it/it-aesgcm-keys/default-aesgcm256-v1.bin \
--namespace default
- name: Create test APIGateway
run: |
# Create ConfigMap with gateway values pointing to test images
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: ConfigMap
metadata:
name: test-gateway-config
namespace: default
data:
values.yaml: |
# Default values for the Open Choreo Gateway chart.
# This file is intended to be exhaustive and well documented; adjust per environment.
nameOverride: ""
fullnameOverride: ""
imagePullSecrets: []
commonLabels: {}
commonAnnotations: {}
serviceAccount:
create: true
annotations: {}
name: ""
## moved to each component's deployment block below
# Component-level configuration
gateway:
# Shared configuration for gateway-controller and policy-engine
# This config is mounted to both components as /configs/config.yaml
config:
controller:
auth:
# Local basic authentication configuration
basic:
enabled: true
# Local users
users:
# Example user entries:
# - username: "user1"
# password: "$argon2id.." # encrypted hash or plain string depending on implementation
# password_hashed: true
# roles: ["developer", "viewer"]
- username: "admin"
password: "admin"
password_hashed: false
roles: ["admin"]
# Server configuration
server:
# REST API port for gateway management
api_port: 9090
# xDS gRPC port for Envoy communication
xds_port: 18000
# Graceful shutdown timeout
shutdown_timeout: 15s
# Unique identifier for the gateway instance
gateway_id: "platform-gateway-id"
# Policy xDS Server configuration
policy_server:
# Enable or disable the policy xDS server
enabled: true
# Policy xDS gRPC port for policy distribution
port: 18001
# TLS configuration for secure policy xDS communication
tls:
# Enable or disable TLS
enabled: false
# Path to TLS certificate file (required if TLS is enabled)
cert_file: "./certs/server.crt"
# Path to TLS private key file (required if TLS is enabled)
key_file: "./certs/server.key"
# Storage configuration
storage:
# Storage type: "sqlite", "postgres" (future), or "memory"
# - sqlite: Use SQLite embedded database for persistence
# - postgres: Use PostgreSQL database for persistence (future support)
# - memory: No persistent storage, all configs lost on restart (useful for testing)
type: sqlite
# SQLite configuration (used when type=sqlite)
sqlite:
path: ./data/gateway.db
# Policy configuration
policies:
# Directory containing policy definitions
definitions_path: ./default-policies
# Logging configuration
logging:
# Log level: "debug", "info", "warn", or "error"
level: debug
# Log format: "json" or "text"
# - json: Structured JSON format (recommended for production)
# - text: Human-readable text format (recommended for development)
format: json
router:
# Gateway host for incoming requests
gateway_host: "*"
# Access logs configuration
access_logs:
# Enable or disable access logs
enabled: true
# Log format: "json" or "text"
# - json: Structured JSON format (recommended for log aggregation)
# - text: Human-readable text format
format: json
# JSON format fields - key-value pairs for structured logging
# Uses Envoy command operators: https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage
json_fields:
start_time: "%START_TIME%"
method: "%REQ(:METHOD)%"
path: "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%"
protocol: "%PROTOCOL%"
response_code: "%RESPONSE_CODE%"
response_flags: "%RESPONSE_FLAGS%"
response_flags_long: "%RESPONSE_FLAGS_LONG%"
bytes_received: "%BYTES_RECEIVED%"
bytes_sent: "%BYTES_SENT%"
duration: "%DURATION%"
upstream_service_time: "%RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)%"
x_forwarded_for: "%REQ(X-FORWARDED-FOR)%"
user_agent: "%REQ(USER-AGENT)%"
request_id: "%REQ(X-REQUEST-ID)%"
authority: "%REQ(:AUTHORITY)%"
upstream_host: "%UPSTREAM_HOST%"
upstream_cluster: "%UPSTREAM_CLUSTER%"
# Text format template - used when format is "text"
# Uses Envoy command operators: https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage
text_format: |
[%START_TIME%] "%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%" %RESPONSE_CODE% %RESPONSE_FLAGS% %BYTES_RECEIVED% %BYTES_SENT% %DURATION% "%REQ(X-FORWARDED-FOR)%" "%REQ(USER-AGENT)%" "%REQ(X-REQUEST-ID)%" "%REQ(:AUTHORITY)%" "%UPSTREAM_HOST%"
# Listener port for incoming HTTP traffic (Envoy proxy port)
listener_port: 8080
# HTTPS listener configuration
https_enabled: true # Enable/disable HTTPS listener
https_port: 8443 # HTTPS listener port
# Downstream TLS configuration (for HTTPS listener)
downstream_tls:
# Path to server certificate (PEM format)
cert_path: "./listener-certs/default-listener.crt"
# Path to server private key (PEM format)
key_path: "./listener-certs/default-listener.key"
# Minimum TLS protocol version (TLS1_0, TLS1_1, TLS1_2, TLS1_3)
minimum_protocol_version: TLS1_2
# Maximum TLS protocol version (TLS1_0, TLS1_1, TLS1_2, TLS1_3)
maximum_protocol_version: TLS1_3
# Cipher suites (comma-separated)
ciphers: "ECDHE-ECDSA-AES128-GCM-SHA256,ECDHE-RSA-AES128-GCM-SHA256,ECDHE-ECDSA-AES128-SHA,ECDHE-RSA-AES128-SHA,AES128-GCM-SHA256,AES128-SHA,ECDHE-ECDSA-AES256-GCM-SHA384,ECDHE-RSA-AES256-GCM-SHA384,ECDHE-ECDSA-AES256-SHA,ECDHE-RSA-AES256-SHA,AES256-GCM-SHA384,AES256-SHA"
# Upstream configuration (TLS and timeouts for Envoy upstream)
upstream:
# TLS configuration for upstream connections
tls:
minimum_protocol_version: TLS1_2
maximum_protocol_version: TLS1_3
ciphers: "ECDHE-ECDSA-AES128-GCM-SHA256,ECDHE-RSA-AES128-GCM-SHA256,ECDHE-ECDSA-AES128-SHA,ECDHE-RSA-AES128-SHA,AES128-GCM-SHA256,AES128-SHA,ECDHE-ECDSA-AES256-GCM-SHA384,ECDHE-RSA-AES256-GCM-SHA384,ECDHE-ECDSA-AES256-SHA,ECDHE-RSA-AES256-SHA,AES256-GCM-SHA384,AES256-SHA"
trusted_cert_path: /etc/ssl/certs/ca-certificates.crt
custom_certs_path: ./certificates # Directory containing custom trusted certificates (e.g., self-signed certs)
verify_host_name: true
disable_ssl_verification: false
# Timeout configurations for upstream connections (milliseconds)
timeouts:
route_timeout_ms: 60000
route_idle_timeout_ms: 300000
connect_timeout_ms: 5000
# Policy Engine ext_proc filter configuration
policy_engine:
# Connection mode: "uds" (Unix domain socket, default) or "tcp"
mode: uds
# Policy engine host (hostname or IP address)
host: policy-engine
# Policy engine ext_proc port
port: 9001
# Timeout for gRPC service connection (in milliseconds)
timeout_ms: 60000
# Failure mode: false = fail closed (deny requests on error), true = fail open (allow requests on error)
failure_mode_allow: false
# Route cache action: DEFAULT, RETAIN, or CLEAR
# RETAIN: Maintain the route cache across requests (recommended for performance)
route_cache_action: RETAIN
# Allow per-route override of ext_proc configuration
allow_mode_override: true
# Message timeout for policy engine processing (in milliseconds)
message_timeout_ms: 60000
# TLS configuration for policy engine connection
tls:
# Enable TLS for secure communication with policy engine
enabled: false
# Client certificate path (for mutual TLS authentication)
cert_path: ""
# Client private key path (for mutual TLS authentication)
key_path: ""
# CA certificate path (for server certificate validation)
ca_path: ""
# Server name for SNI (optional, defaults to host)
server_name: ""
# Skip server certificate verification (insecure, development only)
skip_verify: false
policy_engine:
server:
# Port for ext_proc gRPC server (receives requests from Envoy)
extproc_port: 9001
# Admin HTTP server configuration
admin:
# Enable admin HTTP server for debugging endpoints
enabled: true
# Port for admin HTTP server
port: 9002
# IP addresses allowed to access the admin API
# Defaults to localhost only for security
allowed_ips:
- "*"
- "127.0.0.1"
config_mode:
# Configuration mode: "file" or "xds"
# - file: Load policy chains from static YAML file
# - xds: Subscribe to xDS server for dynamic configuration updates
mode: xds
# xDS client configuration
xds:
# Enable xDS client
enabled: true
# xDS server address (typically the gateway-controller xDS server)
server_address: gateway-controller:18001
# Node identifier for this policy engine instance
# Used by xDS server to identify this client
node_id: policy-engine-1
# Cluster identifier for this policy engine instance
# Used for grouping multiple policy engine instances
cluster: policy-engine-cluster
# Connection timeout for establishing initial connection
connect_timeout: 10s
# Request timeout for individual xDS requests
request_timeout: 5s
# Initial delay before reconnecting after connection failure
initial_reconnect_delay: 1s
# Maximum delay between reconnection attempts (exponential backoff)
max_reconnect_delay: 60s
# TLS configuration for xDS connection
tls:
enabled: false
# cert_path: /path/to/client-cert.pem
# key_path: /path/to/client-key.pem
# ca_path: /path/to/ca-cert.pem
# File-based configuration (not used in xDS mode)
file_config:
path: ""
# Logging configuration
logging:
# Log level: debug, info, warn, error
level: debug
# Log format: json, text
format: json
policy_configurations:
jwtauth_v1:
keymanagers:
- name: WSO2KeyManager1
issuer: https://api.asgardeo.io/t/tharsanan1995/oauth2/token
jwks:
remote:
uri: https://api.asgardeo.io/t/tharsanan1995/oauth2/jwks
skipTlsVerify: false
- name: WSO2KeyManager2
issuer: https://api.asgardeo.io/t/testorgforsecurity/oauth2/token
jwks:
remote:
uri: https://api.asgardeo.io/t/testorgforsecurity/oauth2/jwks
skipTlsVerify: false
- name: MockKeyManager
issuer: http://mock-jwks.default.svc.cluster.local:8080/token
jwks:
remote:
uri: http://mock-jwks.default.svc.cluster.local:8080/jwks
skipTlsVerify: true
jwkscachettl: "5m"
jwksfetchtimeout: "5s"
jwksfetchretrycount: 3
jwksfetchretryinterval: "2s"
allowedalgorithms:
- RS256
- ES256
leeway: "30s"
authheaderscheme: Bearer
headername: Authorization
onfailurestatuscode: 401
errormessageformat: json
errormessage: "Authentication failed."
validateissuer: true
# metadata for the generated shared ConfigMap (annotations / labels)
configMap:
annotations: {}
labels: {}
controller:
image:
repository: localhost/gateway-controller
tag: test
pullPolicy: Never
imagePullSecrets: []
service:
type: ClusterIP
annotations: {}
labels: {}
ports:
rest: 9090
xds: 18000
policy: 18001
controlPlane:
host: host.docker.internal
port: 8443
token:
value: ""
secretName: ""
key: token
# TLS certificate configuration for downstream (listener) HTTPS
tls:
# Enable TLS certificate management
enabled: true
# Certificate provisioning method: "cert-manager", "secret", or "none"
# - cert-manager: Use cert-manager to automatically provision certificates
# - secret: Use an existing Kubernetes secret containing tls.crt and tls.key
# - none: No TLS configuration (certificates must be provided manually)
certificateProvider: cert-manager
# cert-manager configuration (used when certificateProvider=cert-manager)
certManager:
# Create a Certificate resource
create: true
# Create a self-signed Issuer automatically
# If true, a self-signed Issuer will be created with the release name
# If false, you must provide an existing Issuer/ClusterIssuer via issuerRef
createIssuer: true
# Issuer reference for cert-manager
# Note: If createIssuer=true, the 'name' field is ignored and the chart generates a unique name
# Only set this if createIssuer=false to reference an existing Issuer/ClusterIssuer
issuerRef:
name: selfsigned-issuer # Ignored when createIssuer=true
# Use "Issuer" for namespace-scoped issuer (recommended)
# Use "ClusterIssuer" for cluster-wide issuer
kind: Issuer
# group: cert-manager.io # Optional, defaults to cert-manager.io
# Certificate common name
commonName: localhost
# DNS names for the certificate
dnsNames:
- localhost
- "*.localhost"
# Certificate duration (default: 2160h = 90 days)
duration: 2160h
# Certificate renewal time (default: 720h = 30 days before expiry)
renewBefore: 720h
# Secret configuration (used when certificateProvider=secret)
secret:
# Name of existing secret containing tls.crt and tls.key
name: gateway-tls
# Key names in the secret
certKey: tls.crt
keyKey: tls.key
# Upstream certificate configuration for backend TLS verification
upstreamCerts:
# Enable custom upstream certificates
enabled: false
# Existing secret containing custom CA certificates
# Secret should contain one or more keys with PEM-encoded certificates
secretName: ""
# Existing ConfigMap containing custom CA certificates
# ConfigMap should contain one or more keys with PEM-encoded certificates
configMapName: ""
encryptionKeys:
enabled: true
secretName: gateway-encryption-keys
mountPath: /app/data/aesgcm-keys
logging:
level: info
storage:
type: sqlite
sqlitePath: ./data/gateway.db
persistence:
enabled: true
existingClaim: ""
accessModes:
- ReadWriteOnce
size: 100Mi
storageClass: ""
deployment:
enabled: true
replicaCount: 1
volumeMountPath: /app/data
extraEnv: []
env:
xdsServerAddress: ""
extraVolumeMounts: []
extraVolumes: []
labels: {}
annotations: {}
podAnnotations: {}
podLabels: {}
priorityClassName: ""
livenessProbe:
httpGet:
path: /api/admin/v0.9/health
port: admin
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
httpGet:
path: /api/admin/v0.9/health
port: admin
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 3
# Resource limits and requests
# Uncomment and adjust based on your workload
resources: {}
# limits:
# cpu: 500m
# memory: 512Mi
# requests:
# cpu: 250m
# memory: 256Mi
podSecurityContext: {}
securityContext: {}
nodeSelector: {}
tolerations: []
affinity: {}
gatewayRuntime:
image:
repository: localhost/gateway-runtime
tag: "test"
pullPolicy: Never
imagePullSecrets: []
service:
type: ClusterIP
annotations: {}
labels: {}
ports:
http: 8080
https: 8443
envoyAdmin: 9901
policyEngineAdmin: 9002
policyEngineMetrics: 9003
deployment:
enabled: true
replicaCount: 1
extraEnv: []
labels: {}
annotations: {}
podAnnotations: {}
podLabels: {}
priorityClassName: ""
livenessProbe:
exec:
command: ["health-check.sh"]
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
exec:
command: ["health-check.sh"]
initialDelaySeconds: 10
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 6
resources: {}
podSecurityContext: {}
securityContext: {}
nodeSelector: {}
tolerations: []
affinity: {}
EOF
# Create Gateway CR
cat <<EOF | kubectl apply -f -
apiVersion: gateway.api-platform.wso2.com/v1alpha1
kind: APIGateway
metadata:
name: test-gateway
namespace: default
spec:
apiSelector:
scope: Cluster
configRef:
name: test-gateway-config
EOF
- name: Wait for APIGateway to be ready
run: |
echo "Waiting for APIGateway to be programmed..."
kubectl wait --for=condition=Programmed apigateway/test-gateway --timeout=180s
echo "APIGateway status:"
kubectl get apigateway test-gateway -o yaml
- name: Create test RestApi
run: |
cat <<EOF | kubectl apply -f -
apiVersion: gateway.api-platform.wso2.com/v1alpha1
kind: RestApi
metadata:
name: test-api
namespace: default
spec:
displayName: test-api
version: v1.0
context: /test
upstream:
main:
url: http://httpbin.default.svc.cluster.local:80
operations:
- method: GET
path: /get
- method: POST
path: /post
EOF
- name: Wait for API to be programmed
run: |
echo "Waiting for RestApi to be programmed..."
kubectl wait --for=condition=Programmed restapi/test-api --timeout=120s
echo "RestApi status:"
kubectl get restapi test-api -o yaml
- name: Test API invocation
run: |
# Port forward the router
sleep 10
kubectl port-forward svc/test-gateway-gateway-gateway-runtime 8080:8080 &
sleep 10
echo "Testing API invocation..."
# Test GET request
response=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:8080/test/get)
echo "GET /test/get returned: $response"
if [ "$response" != "200" ]; then
echo "API test failed with status $response"
curl -v http://localhost:8080/test/get || true
exit 1
fi
echo "API invocation test passed!"
- name: Update test RestApi
run: |
echo "Updating test-api to add PUT /put..."
cat <<EOF | kubectl apply -f -
apiVersion: gateway.api-platform.wso2.com/v1alpha1
kind: RestApi
metadata:
name: test-api
namespace: default
spec:
displayName: test-api
version: v1.0
context: /test
upstream:
main:
url: http://httpbin.default.svc.cluster.local:80
operations:
- method: GET
path: /get
- method: POST
path: /post
- method: PUT
path: /put
EOF
- name: Wait for updated API to be programmed
run: |
echo "Waiting for updated RestApi to be programmed..."
# Give it a few seconds to trigger reconciliation
sleep 10
kubectl wait --for=condition=Programmed restapi/test-api --timeout=120s
echo "RestApi status after update:"
kubectl get restapi test-api -o yaml
- name: Test updated API invocation
run: |
echo "Testing updated API invocation (PUT /test/put)..."
# Test PUT request
response=$(curl -s -o /dev/null -w "%{http_code}" -X PUT http://localhost:8080/test/put)
echo "PUT /test/put returned: $response"
if [ "$response" != "200" ]; then
echo "Updated API test failed with status $response"
curl -v -X PUT http://localhost:8080/test/put || true
exit 1
fi
echo "Updated API invocation test passed!"
- name: Create JWT Protected API
run: |
cat <<EOF | kubectl apply -f -
apiVersion: gateway.api-platform.wso2.com/v1alpha1
kind: RestApi
metadata:
name: jwt-api
namespace: default
spec:
displayName: jwt-api
version: v1.0
context: /secure
upstream:
main:
url: http://httpbin.default.svc.cluster.local:80
policies:
- name: jwt-auth
version: v1
params:
issuers:
- MockKeyManager
operations:
- method: GET
path: /get
EOF
- name: Wait for JWT API to be programmed
run: |
echo "Waiting for JWT API to be programmed..."
kubectl wait --for=condition=Programmed restapi/jwt-api --timeout=120s
echo "RestApi status:"
kubectl get restapi jwt-api -o yaml
- name: Test JWT API invocation
run: |
# Get a token from the mock service (using kubectl exec/curl or port-forward)
# We can use the existing port-forward for the registry if we had one, but we don't for mock-jwks
# Let's port forward mock-jwks temporarily
kubectl port-forward svc/mock-jwks 8081:8080 &
PID=$!
sleep 5
TOKEN=$(curl -s http://localhost:8081/token)
echo "Got token: ${TOKEN:0:20}..."
# Kill port forward
kill $PID || true
# The router port forward is already running on 8080 from previous step
# But we killed it? No, the previous step backgrounded it "kubectl port-forward ... &"
# but usually we should re-establish or ensure it's there.
# The previous step "Test API invocation" started it.
# Let's check if it's still running or just start a new one to be safe on a different port if needed.
# The previous step used 8080. We should probably use that.
echo "Testing JWT API invocation..."
# 1. Test without token (should fail)
status=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:8080/secure/get)
echo "GET /secure/get (no token) returned: $status"
if [ "$status" != "401" ]; then
echo "Expected 401, got $status"
exit 1
fi
# 2. Test with token (should pass)
status=$(curl -s -o /dev/null -w "%{http_code}" -H "Authorization: Bearer $TOKEN" http://localhost:8080/secure/get)
echo "GET /secure/get (with token) returned: $status"
if [ "$status" != "200" ]; then
echo "Expected 200, got $status"
curl -v -H "Authorization: Bearer $TOKEN" http://localhost:8080/secure/get || true
exit 1
fi
echo "JWT API invocation test passed!"
- name: Update JWT RestApi with dummy issuer
run: |
echo "Updating jwt-api to use DummyKeyManager..."
cat <<EOF | kubectl apply -f -
apiVersion: gateway.api-platform.wso2.com/v1alpha1
kind: RestApi
metadata:
name: jwt-api
namespace: default
spec:
displayName: jwt-api
version: v1.0
context: /secure
upstream:
main:
url: http://httpbin.default.svc.cluster.local:80
policies:
- name: jwt-auth
version: v1
params:
issuers:
- DummyKeyManager
operations:
- method: GET
path: /get