Skip to content

Commit af312e6

Browse files
authored
feat(mTLS): adds mTLS support to dataplane api-server (#280)
Closes #50. ### Questions I am not sure how best to add tests for this. Unit testing the config trivially tests the behavior of Opt which we know works. Unit testing `setup_tls` forces me to mock `read_to_string` in the absence of an actual file to read in and all the ways I've read about doing that in rust feel really kludgie / dirty up the code with dependency injections, etc. 1. Is this all we need to add mTLS support for the api-server? 2. Is there some sort of API contract we need to maintain for this such that I can write a conformance or integration test? 3. What documentation would we like to see for this?
2 parents a322c2e + 60a19d7 commit af312e6

File tree

18 files changed

+1033
-22
lines changed

18 files changed

+1033
-22
lines changed

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,4 @@ jobs:
8383
context: .
8484
platforms: linux/amd64,linux/arm64
8585
file: build/Containerfile.dataplane
86-
tags: kong/blixt-dataplane:${{ github.head_ref }}-${{ github.sha }}
86+
tags: kong/blixt-dataplane:pr-${{ github.event.pull_request.number }}-${{ github.sha }}

.github/workflows/test.yaml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: tests
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- '*'
7+
push:
8+
branches:
9+
- 'main'
10+
tags:
11+
- '*'
12+
workflow_dispatch: {}
13+
14+
jobs:
15+
dataplane-tests:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: setup golang
19+
uses: actions/setup-go@v3
20+
with:
21+
go-version: '^1.19'
22+
23+
- name: cache go modules
24+
uses: actions/cache@v3
25+
with:
26+
path: ~/go/pkg/mod
27+
key: ${{ runner.os }}-build-codegen-${{ hashFiles('**/go.sum') }}
28+
restore-keys: |
29+
${{ runner.os }}-build-codegen-
30+
31+
- name: cache image builds
32+
uses: actions/cache@v3
33+
with:
34+
path: /var/lib/docker/
35+
key: ${{ runner.os }}-build-image-cache
36+
restore-keys: |
37+
${{ runner.os }}-build-image-cache-
38+
39+
- name: checkout repository
40+
uses: actions/checkout@v3
41+
with:
42+
fetch-depth: 0
43+
44+
- name: Build Cluster
45+
run: make build.cluster
46+
47+
- name: Build Dataplane Image
48+
run: make build.image.dataplane TAG=integration-tests
49+
50+
- name: Load Dataplane Image
51+
run: make load.image.dataplane
52+
53+
- name: Generate Self-Signed Certs
54+
run: make test.gencert
55+
56+
- name: Create Dataplane in Cluster
57+
run: kubectl apply -k config/tests/auth
58+
59+
- name: Waiting for dataplane to be ready
60+
run: |
61+
kubectl \
62+
-n blixt-system \
63+
wait --for=condition=Ready pod \
64+
-l app=blixt,component=dataplane \
65+
--timeout=120s ||
66+
kubectl -n blixt-system logs -l app=blixt,component=dataplane ||
67+
kubectl -n blixt-system describe pod -l app=blixt,component=dataplane
68+
69+
- name: Forward gRPC Port
70+
run: nohup kubectl -n blixt-system port-forward ds/dataplane 9874 &
71+
72+
- name: Dataplane Integration Tests
73+
run: make test.dataplane.integration
74+
75+
## Upload diagnostics if integration test step failed.
76+
- name: upload diagnostics
77+
if: ${{ failure() }}
78+
uses: actions/upload-artifact@v3
79+
with:
80+
name: blixt-integration-test-diag
81+
path: /tmp/ktf-diag*
82+
if-no-files-found: ignore
83+

0 commit comments

Comments
 (0)