Skip to content

Commit ecf6897

Browse files
committed
Implement TLS option for pod-to-pod communication.
Signed-off-by: agoins <alyssacgoins@gmail.com>
1 parent 8f2d933 commit ecf6897

100 files changed

Lines changed: 2256 additions & 345 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions/deploy/action.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ inputs:
3838
required: false
3939
default: 'true'
4040
description: "If you want to forward API server port to localhost:8888"
41+
pod_to_pod_tls_enabled:
42+
description: "If KFP should be deployed with TLS pod-to-pod communication."
43+
required: false
44+
default: 'false'
4145

4246
runs:
4347
using: "composite"
@@ -99,6 +103,9 @@ runs:
99103
echo "Deploying with argo version ${{ inputs.argo_version }}"
100104
ARGS="${ARGS} --argo-version ${{ inputs.argo_version }}"
101105
fi
106+
if [ "${{inputs.pod_to_pod_tls_enabled }}" = "true" ]; then
107+
ARGS="${ARGS} --tls-enabled"
108+
fi
102109
echo "ARGS=$ARGS" >> $GITHUB_OUTPUT
103110
104111
- name: Deploy KFP

.github/actions/test-and-report/action.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ inputs:
4848
required: false
4949
default: ""
5050
description: "Override it if you want a custom name for your test report file"
51+
tls_enabled:
52+
description: "If KFP should be deployed with TLS pod-to-pod communication."
53+
required: false
54+
default: 'false'
55+
ca_cert_path:
56+
description: "Path to the CA certificate file."
57+
required: false
58+
default: ""
5159

5260

5361
runs:
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: ml-pipeline
5+
spec:
6+
template:
7+
spec:
8+
containers:
9+
- name: ml-pipeline-api-server
10+
env:
11+
- name: V2_DRIVER_IMAGE
12+
value: kind-registry:5000/driver:latest
13+
- name: V2_LAUNCHER_IMAGE
14+
value: kind-registry:5000/launcher:latest
15+
- name: LOG_LEVEL
16+
value: "debug"
17+
- name: TLS_ENABLED
18+
value: "true"
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
4+
resources:
5+
- ../../../../../manifests/kustomize/env/cert-manager/platform-agnostic-standalone-tls
6+
7+
images:
8+
- name: ghcr.io/kubeflow/kfp-api-server
9+
newName: kind-registry:5000/apiserver
10+
newTag: latest
11+
- name: ghcr.io/kubeflow/kfp-persistence-agent
12+
newName: kind-registry:5000/persistenceagent
13+
newTag: latest
14+
- name: ghcr.io/kubeflow/kfp-scheduled-workflow-controller
15+
newName: kind-registry:5000/scheduledworkflow
16+
newTag: latest
17+
18+
patches:
19+
- path: apiserver-env.yaml

.github/resources/scripts/deploy-kfp.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ CACHE_DISABLED=false
3131
MULTI_USER=false
3232
STORAGE_BACKEND="seaweedfs"
3333
AWF_VERSION=""
34+
POD_TO_POD_TLS_ENABLED=false
3435

3536
# Loop over script arguments passed. This uses a single switch-case
3637
# block with default value in case we want to make alternative deployments
@@ -67,6 +68,10 @@ while [ "$#" -gt 0 ]; do
6768
exit 1
6869
fi
6970
;;
71+
--tls-enabled)
72+
POD_TO_POD_TLS_ENABLED=true
73+
shift
74+
;;
7075
esac
7176
done
7277

@@ -100,8 +105,8 @@ if [[ $EXIT_CODE -ne 0 ]]; then
100105
exit $EXIT_CODE
101106
fi
102107

103-
# If pipelines store is set to 'kubernetes', cert-manager must be deployed
104-
if [ "${PIPELINES_STORE}" == "kubernetes" ]; then
108+
# If pipelines store is set to 'kubernetes' or pod-to-pod TLS is set to 'true', cert-manager must be deployed
109+
if [ "${PIPELINES_STORE}" == "kubernetes" ] || [ "${POD_TO_POD_TLS_ENABLED}" == "true" ]; then
105110
#Install cert-manager
106111
make -C ./backend install-cert-manager || EXIT_CODE=$?
107112
if [[ $EXIT_CODE -ne 0 ]]
@@ -156,6 +161,8 @@ if [ "${MULTI_USER}" == "false" ] && [ "${PIPELINES_STORE}" != "kubernetes" ]; t
156161
TEST_MANIFESTS="${TEST_MANIFESTS}/proxy-minio"
157162
elif $CACHE_DISABLED && $USE_PROXY && [ "${STORAGE_BACKEND}" == "minio" ]; then
158163
TEST_MANIFESTS="${TEST_MANIFESTS}/cache-disabled-proxy-minio"
164+
elif $POD_TO_POD_TLS_ENABLED; then
165+
TEST_MANIFESTS="${TEST_MANIFESTS}/tls-enabled"
159166
fi
160167
elif [ "${MULTI_USER}" == "false" ] && [ "${PIPELINES_STORE}" == "kubernetes" ]; then
161168
TEST_MANIFESTS="${TEST_MANIFESTS}/kubernetes-native"

.github/workflows/api-server-tests.yml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ env:
88
NAMESPACE: "kubeflow"
99
USER_NAMESPACE: "kubeflow-user-example-com"
1010
PYTHON_VERSION: "3.9"
11+
CA_CERT_PATH: ""
1112

1213
on:
1314
push:
@@ -58,15 +59,19 @@ jobs:
5859
proxy: [ "true", "false" ]
5960
argo_version: [ "v3.7.1", "v3.6.10" ]
6061
pipeline_store: [ "database" ]
62+
pod_to_pod_tls_enabled: [ "false" ]
6163
include:
6264
- k8s_version: "v1.29.2"
6365
cache_enabled: "true"
6466
argo_version: "v3.6.10"
6567
- k8s_version: "v1.29.2"
6668
cache_enabled: "true"
6769
argo_version: "v3.5.15"
70+
- k8s_version: "v1.31.0"
71+
cache_enabled: "true"
72+
pod_to_pod_tls_enabled: "true"
6873
fail-fast: false # So that failure in 1 type of parameterized job does not cause other jobs to terminate prematurely
69-
name: KFP API Server tests Standalone - K8sVersion=${{ matrix.k8s_version }} argo_version=${{ matrix.argo_version }} cacheEnabled=${{ matrix.cache_enabled }} proxyEnabled=${{ matrix.proxy }}
74+
name: KFP API Server tests Standalone - K8sVersion=${{ matrix.k8s_version }} argo_version=${{ matrix.argo_version }} cacheEnabled=${{ matrix.cache_enabled }} proxyEnabled=${{ matrix.proxy }} pod_to_pod_tls_enabled=${{ matrix.pod_to_pod_tls_enabled }}
7075

7176
steps:
7277
- name: Checkout code
@@ -88,10 +93,18 @@ jobs:
8893
cache_enabled: ${{ matrix.cache_enabled }}
8994
proxy: ${{ matrix.proxy }}
9095
argo_version: ${{ matrix.argo_version }}
96+
pod_to_pod_tls_enabled: ${{ matrix.pod_to_pod_tls_enabled }}
9197
image_path: ${{ needs.build.outputs.IMAGE_PATH }}
9298
image_tag: ${{ needs.build.outputs.IMAGE_TAG }}
9399
image_registry: ${{ needs.build.outputs.IMAGE_REGISTRY }}
94100

101+
- name: Configure Cluster CA Cert for TLS-Enabled Tests
102+
shell: bash
103+
id: configure-cluster-ca-cert
104+
if: ${{ matrix.pod_to_pod_tls_enabled == "true"}}
105+
run: |
106+
kubectl get secret kfp-api-tls-cert -n kubeflow -o jsonpath='{.data.ca\.crt}' | base64 -d > ca.crt
107+
95108
- name: Configure Input Variables
96109
shell: bash
97110
id: configure
@@ -110,7 +123,12 @@ jobs:
110123
if [ -z "${PROXY:-}" ]; then
111124
PROXY=false
112125
fi
113-
126+
127+
if [ "${{ matrix.pod_to_pod_tls_enabled }}" == "true" ]; then
128+
CA_CERT_PATH="../../../../ca.crt"
129+
fi
130+
131+
echo "CA_CERT_PATH=$CA_CERT_PATH" >> $GITHUB_OUTPUT
114132
echo "NUMBER_OF_NODES=$NUMBER_OF_NODES" >> $GITHUB_OUTPUT
115133
echo "TEST_LABEL=$TEST_LABEL" >> $GITHUB_OUTPUT
116134
echo "NAMESPACE=$NAMESPACE" >> $GITHUB_OUTPUT
@@ -129,6 +147,8 @@ jobs:
129147
default_namespace: ${{ steps.configure.outputs.NAMESPACE }}
130148
python_version: ${{ env.PYTHON_VERSION }}
131149
report_name: "Standalone_k8sVersion=${{ matrix.k8s_version }}_argoVersion=${{ matrix.argo_version }}_cacheEnabled=${{ matrix.cache_enabled }}_proxyEnabled=${{ matrix.proxy }}"
150+
tls_enabled: ${{ matrix.pod_to_pod_tls_enabled }}
151+
ca_cert_path: ${{ steps.configure-cluster-ca-cert.outputs.CA_CERT_PATH}}
132152

133153
- name: Notify test reports
134154
shell: bash
@@ -148,6 +168,13 @@ jobs:
148168
uploadPipelinesWithKubernetesClient: [ "true", "false" ]
149169
argo_version: [ "v3.7.1", "v3.6.10" ]
150170
pipeline_store: [ "kubernetes" ]
171+
pod_to_pod_tls_enabled: [ "false" ]
172+
include:
173+
- k8s_version: "v1.31.0"
174+
cache_enabled: "true"
175+
pipeline_store: "kubernetes"
176+
pod_to_pod_tls_enabled: "true"
177+
uploadPipelinesWithKubernetesClient: "true"
151178
fail-fast: false # So that failure in 1 type of parameterized job does not cause other jobs to terminate prematurely
152179
name: KFP API Server tests K8s Native API - K8sVersion=${{ matrix.k8s_version }} cacheEnabled=${{ matrix.cache_enabled }} argoVersion=${{ matrix.argo_version }} uploadPipelinesWithKubernetesClient=${{ matrix.uploadPipelinesWithKubernetesClient }}
153180

.github/workflows/e2e-test-frontend.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ on:
77
pull_request:
88
paths:
99
- '.github/workflows/e2e-test-frontend.yml'
10-
- '.github/actions/create-cluster/**'
1110
- 'frontend/**'
1211
- 'manifests/kustomize/**'
1312
- '!**/*.md'
@@ -23,7 +22,8 @@ jobs:
2322
strategy:
2423
matrix:
2524
k8s_version: [ "v1.29.2", "v1.31.0" ]
26-
name: Frontend Integration Tests - K8s ${{ matrix.k8s_version }}
25+
pod_to_pod_tls_enabled: [ "true", "false" ]
26+
name: Frontend Integration Tests - K8s ${{ matrix.k8s_version }} pod_to_pod_tls_enabled=${{ matrix.pod_to_pod_tls_enabled }}
2727
steps:
2828
- name: Checkout code
2929
uses: actions/checkout@v5
@@ -49,6 +49,7 @@ jobs:
4949
image_path: ${{ needs.build.outputs.IMAGE_PATH }}
5050
image_tag: ${{ needs.build.outputs.IMAGE_TAG }}
5151
image_registry: ${{ needs.build.outputs.IMAGE_REGISTRY }}
52+
pod_to_pod_tls_enabled: ${{ matrix.pod_to_pod_tls_enabled }}
5253

5354
- name: Forward Frontend port
5455
id: forward-frontend-port

.github/workflows/e2e-test.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ env:
66
NAMESPACE: "kubeflow"
77
PYTHON_VERSION: "3.9"
88
USER_NAMESPACE: "kubeflow-user-example-com"
9+
CA_CERT_PATH: ""
910

1011
on:
1112
push:
@@ -59,6 +60,7 @@ jobs:
5960
storage: [ "seaweedfs", "minio"]
6061
proxy: [ "false" ]
6162
test_label: [ "E2ECritical" ]
63+
pod_to_pod_tls_enabled: [ "false" ]
6264
include:
6365
- k8s_version: "v1.29.2"
6466
cache_enabled: "false"
@@ -68,8 +70,12 @@ jobs:
6870
cache_enabled: "false"
6971
proxy: "true"
7072
test_label: "E2EProxy"
73+
- k8s_version: "v1.31.0"
74+
cache_enabled: "true"
75+
pod_to_pod_tls_enabled: "true"
76+
test_label: "E2ECritical"
7177
fail-fast: false
72-
name: End to End Critical Scenario Tests - K8s ${{ matrix.k8s_version }} cacheEnabled=${{ matrix.cache_enabled }} argoVersion=${{ matrix.argo_version}} proxy=${{ matrix.proxy}} storage=${{ matrix.storage }}
78+
name: End to End Critical Scenario Tests - K8s ${{ matrix.k8s_version }} cacheEnabled=${{ matrix.cache_enabled }} argoVersion=${{ matrix.argo_version}} proxy=${{ matrix.proxy}} storage=${{ matrix.storage }} pod_to_pod_tls_enabled=${{ matrix.pod_to_pod_tls_enabled }}
7379
steps:
7480
- name: Checkout code
7581
uses: actions/checkout@v5
@@ -92,10 +98,20 @@ jobs:
9298
cache_enabled: ${{ matrix.cache_enabled }}
9399
argo_version: ${{ matrix.argo_version }}
94100
storage_backend: ${{ matrix.storage }}
101+
pod_to_pod_tls_enabled: ${{ matrix.pod_to_pod_tls_enabled }}
95102
image_path: ${{ needs.build.outputs.IMAGE_PATH }}
96103
image_tag: ${{ needs.build.outputs.IMAGE_TAG }}
97104
image_registry: ${{ needs.build.outputs.IMAGE_REGISTRY }}
98105

106+
- name: Configure Cluster CA Cert for TLS-Enabled Tests
107+
shell: bash
108+
id: configure-cluster-ca-cert
109+
if: ${{ matrix.pod_to_pod_tls_enabled == "true"}}
110+
env:
111+
SCHEME: "https"
112+
run: |
113+
kubectl get secret kfp-api-tls-cert -n kubeflow -o jsonpath='{.data.ca\.crt}' | base64 -d > "${{ env.E2E_TESTS_DIR }}"/ca.crt
114+
99115
- name: Configure Input Variables
100116
shell: bash
101117
id: configure
@@ -109,6 +125,12 @@ jobs:
109125
TEST_LABEL=${{ inputs.test_label }}
110126
NAMESPACE=${{ inputs.namespace }}
111127
fi
128+
129+
if [ "${{ matrix.pod_to_pod_tls_enabled }}" == "true" ]; then
130+
CA_CERT_PATH="ca.crt"
131+
fi
132+
133+
echo "CA_CERT_PATH=$CA_CERT_PATH" >> $GITHUB_OUTPUT
112134
echo "NUMBER_OF_NODES=$NUMBER_OF_NODES" >> $GITHUB_OUTPUT
113135
echo "TEST_LABEL=$TEST_LABEL" >> $GITHUB_OUTPUT
114136
echo "NAMESPACE=$NAMESPACE" >> $GITHUB_OUTPUT
@@ -133,6 +155,8 @@ jobs:
133155
default_namespace: ${{ steps.configure.outputs.NAMESPACE }}
134156
python_version: ${{ env.PYTHON_VERSION }}
135157
report_name: "E2ECriticalTests_K8s=${{ matrix.k8s_version }}_cacheEnabled=${{ matrix.cache_enabled }}_argoVersion=${{ matrix.argo_version}}_proxy=${{ matrix.proxy }}_storage=${{ matrix.storage }}"
158+
tls_enabled: ${{ matrix.pod_to_pod_tls_enabled }}
159+
ca_cert_path: ${{ steps.configure.outputs.CA_CERT_PATH}}
136160

137161
- name: Notify test reports
138162
shell: bash
@@ -209,6 +233,7 @@ jobs:
209233
id: test-run
210234
env:
211235
LOCAL_API_SERVER: "true"
236+
MULTI_USER: ${{ matrix.multi_user }}
212237
with:
213238
multi_user: ${{ matrix.multi_user }}
214239
cache_enabled: ${{ matrix.cache_enabled }}

.github/workflows/legacy-v2-api-integration-tests.yml

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ jobs:
2828
strategy:
2929
matrix:
3030
pipeline_store: [ "database", "kubernetes" ]
31-
k8s_version: [ "v1.29.2", "v1.31.0" ]
32-
name: API integration tests v2 - K8s with ${{ matrix.pipeline_store }} ${{ matrix.k8s_version }}
31+
k8s_version: [ "v1.31.0" ]
32+
pod_to_pod_tls_enabled: [ true, false ]
33+
34+
name: API integration tests v2 - K8s with ${{ matrix.pipeline_store }} ${{ matrix.k8s_version }} pod_to_pod_tls_enabled=${{ matrix.pod_to_pod_tls_enabled }}
3335
steps:
3436
- name: Checkout code
3537
uses: actions/checkout@v5
@@ -58,6 +60,26 @@ jobs:
5860
image_tag: ${{ needs.build.outputs.IMAGE_TAG }}
5961
image_registry: ${{ needs.build.outputs.IMAGE_REGISTRY }}
6062
pipeline_store: ${{ matrix.pipeline_store }}
63+
pod_to_pod_tls_enabled: ${{ matrix.pod_to_pod_tls_enabled }}
64+
65+
- name: Configure Cluster CA Cert for TLS-Enabled Tests
66+
shell: bash
67+
id: configure-cluster-ca-cert
68+
if: ${{ matrix.pod_to_pod_tls_enabled }}
69+
run: |
70+
kubectl get secret kfp-api-tls-cert -n kubeflow -o jsonpath='{.data.ca\.crt}' | base64 -d > ca.crt
71+
CA_CERT_PATH="ca.crt"
72+
echo "CA_CERT_PATH=CA_CERT_PATH" >> $GITHUB_OUTPUT
73+
74+
- name: Configure Input Variables
75+
shell: bash
76+
id: configure
77+
if: ${{ steps.deploy.outcome == 'success' && matrix.pod_to_pod_tls_enabled == 'true'}}
78+
run: |
79+
if [ "${{ matrix.pod_to_pod_tls_enabled }}" == "true" ]; then
80+
CA_CERT_PATH="/ca.crt"
81+
fi
82+
echo "CA_CERT_PATH=$CA_CERT_PATH" >> $GITHUB_OUTPUT
6183
6284
- name: Forward MLMD port
6385
id: forward-mlmd-port
@@ -70,6 +92,9 @@ jobs:
7092
if: ${{ steps.forward-mlmd-port.outcome == 'success' }}
7193
working-directory: ./backend/test/v2/integration
7294
run: go test -v ./... -args -runIntegrationTests=true -namespace=kubeflow
95+
with:
96+
pod_to_pod_tls_enabled: ${{ matrix.pod_to_pod_tls_enabled }}
97+
ca_cert_path: ${{ steps.configure.outputs.CA_CERT_PATH}}
7398
env:
7499
PULL_NUMBER: ${{ github.event.pull_request.number }}
75100
PIPELINE_STORE: ${{ matrix.pipeline_store }}

backend/Makefile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
BUILD=build
22
MOD_ROOT=..
33
KIND_NAME ?= dev-pipelines-api
4+
TLS_ENABLED ?= "false"
45

56
CERT_MANAGER_VERSION ?= v1.16.2
67

@@ -86,17 +87,29 @@ kind-cluster-agnostic:
8687
kind create cluster --name $(KIND_NAME)
8788
kubectl config use-context kind-$(KIND_NAME)
8889
kind get kubeconfig --name $(KIND_NAME) > $(CURDIR)/../kubeconfig_$(KIND_NAME)
90+
@if [ "${TLS_ENABLED}" = "true" ]; then \
91+
$(MAKE) install-cert-manager; \
92+
fi
8993
# Deploy cluster resources required by KFP
9094
kubectl apply -k $(CURDIR)/../manifests/kustomize/cluster-scoped-resources
9195
kubectl wait --for condition=established --timeout=1m crd/applications.app.k8s.io
9296
# Deploy KFP
93-
kubectl apply -k $(CURDIR)/../manifests/kustomize/env/platform-agnostic
97+
@if [ "${TLS_ENABLED}" = "true" ]; then \
98+
kubectl apply -k $(CURDIR)/../manifests/kustomize/env/cert-manager/platform-agnostic-standalone-tls; \
99+
else \
100+
kubectl apply -k $(CURDIR)/../manifests/kustomize/env/platform-agnostic; \
101+
fi
94102
kubectl -n kubeflow wait --for condition=Available --timeout=10m deployment/mysql
95103
kubectl -n kubeflow wait --for condition=Available --timeout=3m deployment/metadata-grpc-deployment
96104
kubectl -n kubeflow wait --for condition=Available --timeout=3m deployment/ml-pipeline
97105
# Switch to Kubeflow namespace context
98106
kubectl config set-context --current --namespace=kubeflow
99107

108+
# Creates a Kind cluster and deploys a standalone KFP instance in the Kubeflow namespace with pod-to-pod TLS enabled.
109+
.PHONY: kind-cluster-agnostic-tls
110+
kind-cluster-agnostic-tls:
111+
$(MAKE) TLS_ENABLED="true" kind-cluster-agnostic
112+
100113
.PHONY: dev-kind-cluster
101114
dev-kind-cluster:
102115
${CONTAINER_ENGINE} build -t ${IMG_TAG_WEBHOOK_PROXY} -f $(CURDIR)/../tools/kind/Dockerfile.webhook-proxy $(CURDIR)/../tools/kind

0 commit comments

Comments
 (0)