Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
1bc0478
Initial plan
Copilot Mar 20, 2026
09d370f
refactor: move PSS component and enforce restricted labels
Copilot Mar 20, 2026
b147391
feat: enforce KFP non-root defaults and update pipeline tests
Copilot Mar 20, 2026
bc33bb8
feat: enforce KFP security context defaults and align v1/v2 pipeline …
Copilot Mar 20, 2026
5a1bf94
refactor: switch KFP defaults to uid 100 gid 0 and apply context via …
Copilot Mar 20, 2026
ac7bad5
refactor: use uid 100 gid 0 defaults and central security context app…
Copilot Mar 20, 2026
175ad15
refactor: move pipeline security context override to non-upstream ove…
Copilot Mar 20, 2026
d1cfa03
docs: add v2 security-context decorator docstring
Copilot Mar 20, 2026
b2f2fac
refactor: move pipeline override to overlays path and rename hello wo…
Copilot Mar 20, 2026
7358550
refactor: apply kfp v2 security context via direct decorated component
Copilot Mar 20, 2026
67593f0
fix: use top-level pipeline overlays kustomization entrypoint
Copilot Mar 20, 2026
9fb1c33
fix: move illegal pipeline patching to overlays root and use overlays…
Copilot Mar 20, 2026
628270e
Fix directory path for pipeline installation
juliusvonkohout Mar 20, 2026
89ecc6f
chore: revert upstream edits and keep pipeline fix overlay-only
Copilot Mar 20, 2026
a9db320
Update pipelines_install.sh
juliusvonkohout Mar 20, 2026
8a2426f
fix: use V1SecurityContext in KFP v1 pipeline test
Copilot Mar 20, 2026
def73cf
refactor: simplify kfp v2 security context usage
Copilot Mar 20, 2026
edf34d0
fix: make kfp v1 test compile with direct container security context
Copilot Mar 20, 2026
3bbe259
Change security context user and group to empty
juliusvonkohout Mar 20, 2026
b681c35
.
juliusvonkohout Mar 20, 2026
68d8c24
.
juliusvonkohout Mar 20, 2026
ffa8ec0
.
juliusvonkohout Mar 20, 2026
4665e44
.
juliusvonkohout Mar 20, 2026
7a3dc6d
Modify defaultSecurityContextRunAsNonRoot value
juliusvonkohout Mar 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/full_kubeflow_integration_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ jobs:

- name: V2 Pipeline Test
run: |
pip3 install -U "kfp>=2.16.0"
pip3 install -U "kfp>=2.16.0" kfp-kubernetes
Comment thread
juliusvonkohout marked this conversation as resolved.
TOKEN="$(kubectl -n $KF_PROFILE create token default-editor)"
python3 tests/pipeline_v2_test.py run_pipeline "${TOKEN}" "${KF_PROFILE}"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pipeline_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:

- name: V2 Pipeline Test
run: |
pip3 install "kfp>=2.16.0"
pip3 install "kfp>=2.16.0" kfp-kubernetes
Comment thread
juliusvonkohout marked this conversation as resolved.
TOKEN="$(kubectl -n $KF_PROFILE create token default-editor)"
python3 tests/pipeline_v2_test.py run_pipeline "${TOKEN}" "${KF_PROFILE}"

Expand Down
8 changes: 8 additions & 0 deletions applications/pipeline/overlays/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../upstream/env/cert-manager/platform-agnostic-multi-user

patches:
- path: pipeline-install-config-securitycontext.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: pipeline-install-config
data:
defaultSecurityContextRunAsUser: "" # 1000
defaultSecurityContextRunAsGroup: "" # 0
defaultSecurityContextRunAsNonRoot: "" # TODO "true" for better security
9 changes: 0 additions & 9 deletions common/security/PSS/dynamic/baseline/kustomization.yaml

This file was deleted.

23 changes: 0 additions & 23 deletions common/security/PSS/dynamic/baseline/namespace-labels.yaml

This file was deleted.

8 changes: 1 addition & 7 deletions example/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ resources:
# Kubeflow Istio Resources
- ../common/istio/kubeflow-istio-resources/base
# Kubeflow Pipelines (SeaweedFS as default S3 storage)
- ../applications/pipeline/upstream/env/cert-manager/platform-agnostic-multi-user # Pipeline definitions stored in the database
- ../applications/pipeline/overlays # Pipeline definitions stored in the database
# - ../applications/pipeline/upstream/env/cert-manager/platform-agnostic-multi-user-k8s-native # Pipeline Definitions Stored as Kubernetes Resources
# Katib
- ../applications/katib/upstream/installs/katib-with-kubeflow
Expand Down Expand Up @@ -103,9 +103,3 @@ resources:
# Here is the documentation for Ray: https://docs.ray.io/en/latest/
# Here is the internal documentation for Ray: - ../experimental/ray/README.md
# - ../experimental/ray/kuberay-operator/overlays/kubeflow

components:
# https://kubernetes.io/docs/concepts/security/pod-security-standards/
# For all static namespaces we already enforce PSS restricted
# This should be used together with Kubernetes 1.33+ user namespaces to block root user exploits
- ../common/security/PSS/dynamic/baseline
2 changes: 1 addition & 1 deletion tests/kubeflow_profile_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ PROFILE_CONTROLLER_POD=$(kubectl get pods -n kubeflow -o json | jq -r '.items[]
kubectl logs -n kubeflow "$PROFILE_CONTROLLER_POD"
KF_PROFILE=kubeflow-user-example-com
kubectl -n $KF_PROFILE get pods,configmaps,secrets
kubectl label namespace $KF_PROFILE pod-security.kubernetes.io/enforce=baseline --overwrite
kubectl label namespace $KF_PROFILE pod-security.kubernetes.io/enforce=restricted --overwrite
41 changes: 28 additions & 13 deletions tests/pipeline_v1_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,41 @@
import kfp
import sys
import time
from kubernetes.client.models import V1Capabilities, V1SeccompProfile, V1SecurityContext
from kfp.components import func_to_container_op


def hello_world():
print("Hello World from Kubeflow Pipelines V1!")
return "Hello World"

def hello_world_op():
from kfp.components import func_to_container_op

def hello_world():
print("Hello World from Kubeflow Pipelines V1!")
return "Hello World"

return func_to_container_op(hello_world)

def hello_world_pipeline():
hello_op = hello_world_op()
hello_op()
hello_world_task = func_to_container_op(hello_world, base_image="python:3.12")()
hello_world_task.container.set_security_context(
V1SecurityContext(
allow_privilege_escalation=False,
capabilities=V1Capabilities(drop=["ALL"]),
privileged=False,
read_only_root_filesystem=False,
seccomp_profile=V1SeccompProfile(type="RuntimeDefault"),
run_as_user=1000,
run_as_group=0,
run_as_non_root=True,
)
)

def run_v1_pipeline(token, namespace):
client = kfp.Client(host="http://localhost:8080/pipeline", existing_token=token)

experiment = client.create_experiment("v1-pipeline-test", namespace=namespace)

pipeline_run = client.create_run_from_pipeline_func(
hello_world_pipeline,
experiment_name=experiment.name,
run_name="v1-hello-world",
namespace=namespace,
arguments={}
arguments={},
)

for iteration in range(15):
Expand All @@ -43,7 +53,12 @@ def run_v1_pipeline(token, namespace):
sys.exit(1)

if __name__ == "__main__":
from kfp import compiler
compiler.Compiler().compile(
pipeline_func=hello_world_pipeline,
package_path="pipeline_v1.yaml",
)
if len(sys.argv) != 3:
sys.exit(1)

run_v1_pipeline(sys.argv[1], sys.argv[2])
run_v1_pipeline(sys.argv[1], sys.argv[2])
11 changes: 7 additions & 4 deletions tests/pipeline_v2_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
import sys
import time
from kfp import dsl
from kfp import kubernetes
from kfp_server_api.exceptions import ApiException


@dsl.component
def hello_world_op() -> str:
def hello_world_operation() -> str:
print("Hello World from Kubeflow Pipelines V2!")
return "Hello World"

Expand All @@ -18,7 +18,10 @@ def hello_world_op() -> str:
description="A very simple hello world pipeline"
)
def hello_world_pipeline():
hello_world_op()
hello_world_task = hello_world_operation()
kubernetes.set_security_context(
hello_world_task, run_as_user=1000, run_as_group=0, run_as_non_root=True
)


def run_pipeline(token, namespace):
Expand Down Expand Up @@ -93,4 +96,4 @@ def test_unauthorized_access(token, namespace):
elif action == "test_unauthorized_access":
test_unauthorized_access(token, namespace)
else:
sys.exit(1)
sys.exit(1)
6 changes: 3 additions & 3 deletions tests/pipelines_install.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/bash
set -euo pipefail
echo "Installing Pipelines ..."
cd applications/pipeline/upstream
kubectl apply -f third-party/metacontroller/base/crd.yaml
cd applications/pipeline
kubectl apply -f upstream/third-party/metacontroller/base/crd.yaml
Comment thread
juliusvonkohout marked this conversation as resolved.
echo "Waiting for crd/compositecontrollers.metacontroller.k8s.io to be available ..."
kubectl wait --for condition=established --timeout=30s crd/compositecontrollers.metacontroller.k8s.io
kustomize build env/cert-manager/platform-agnostic-multi-user | kubectl apply -f -
kustomize build overlays | kubectl apply -f -
sleep 60
kubectl wait --for=condition=Ready pods --all --all-namespaces --timeout=600s \
--field-selector=status.phase!=Succeeded
Expand Down
Loading