Skip to content

Commit

Permalink
feat(sdk): update new image config via env variables (#1336)
Browse files Browse the repository at this point in the history
* update new image config via env variables

* add env var for condition task image

* update readme
  • Loading branch information
Tomcli authored Aug 31, 2023
1 parent 7576a6c commit 0fe70da
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
7 changes: 7 additions & 0 deletions sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,13 @@ To pass big data using cloud provider volumes, it's recommended to use the
[volume_based_data_passing_method](/sdk/python/tests/compiler/testdata/artifact_passing_using_volume.py)
for both Tekton and Argo runtime.

If you want to change the input and output copy artifact images, please modify the following environment variables:

```shell
export TEKTON_BASH_STEP_IMAGE=busybox # input and output copy artifact images
export TEKTON_COPY_RESULTS_STEP_IMAGE=library/bash # output copy results images
export CONDITION_IMAGE_NAME=python:3.9.17-alpine3.18 # condition task default image name
```

## Running the Compiled Pipeline on a Tekton Cluster

Expand Down
4 changes: 2 additions & 2 deletions sdk/python/kfp_tekton/compiler/_op_to_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
TEKTON_HOME_RESULT_PATH = "/tekton/home/tep-results/"

# The image to use in basic bash steps such as copying results in multi-step.
TEKTON_BASH_STEP_IMAGE = 'busybox'
TEKTON_COPY_RESULTS_STEP_IMAGE = 'library/bash'
TEKTON_BASH_STEP_IMAGE = env.get('TEKTON_BASH_STEP_IMAGE', 'busybox')
TEKTON_COPY_RESULTS_STEP_IMAGE = env.get('TEKTON_COPY_RESULTS_STEP_IMAGE', 'library/bash')
GENERATE_COMPONENT_SPEC_ANNOTATIONS = env.get('GENERATE_COMPONENT_SPEC_ANNOTATIONS', True)


Expand Down
5 changes: 3 additions & 2 deletions sdk/python/kfp_tekton/compiler/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,14 @@
DEFAULT_ARTIFACT_BUCKET = env.get('DEFAULT_ARTIFACT_BUCKET', 'mlpipeline')
DEFAULT_ARTIFACT_ENDPOINT = env.get('DEFAULT_ARTIFACT_ENDPOINT', 'minio-service.kubeflow:9000')
DEFAULT_ARTIFACT_ENDPOINT_SCHEME = env.get('DEFAULT_ARTIFACT_ENDPOINT_SCHEME', 'http://')
CONDITION_IMAGE_NAME = env.get('CONDITION_IMAGE_NAME', 'python:3.9.17-alpine3.18')
# DISABLE_CEL_CONDITION should be True until CEL is officially merged into Tekton main API.
DISABLE_CEL_CONDITION = True
# Default finally extension is 5 minutes
DEFAULT_FINALLY_SECONDS = 300


def _get_super_condition_template(image_name="python:3.9.17-alpine3.18"):
def _get_super_condition_template(image_name=CONDITION_IMAGE_NAME):

python_script = textwrap.dedent('''\
import sys
Expand Down Expand Up @@ -151,7 +152,7 @@ def __init__(self, **kwargs):
self.pipeline_workspaces = {}
self.task_workspaces = {}
self.generate_component_spec_annotations = True
self.condition_image_name = "python:3.9.17-alpine3.18"
self.condition_image_name = CONDITION_IMAGE_NAME
self.bash_image_name = TEKTON_BASH_STEP_IMAGE
super().__init__(**kwargs)

Expand Down

0 comments on commit 0fe70da

Please sign in to comment.