Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix annotations and label processing #2947

Merged
merged 3 commits into from
Oct 4, 2022

Conversation

ptitzler
Copy link
Member

@ptitzler ptitzler commented Oct 3, 2022

Fixes various issues related to kubernetes pod label and annotations processing.

What changes were proposed in this pull request?

  • Treat empty label values and empty annotations values as valid input
  • Added missing annotations tests
  • Updated existing labels tests

How was this pull request tested?

  • Updated server tests
  • Reviewed the output of kubectl describe pod ... to confirm that labels (prefix.org/lk1, prefix.org/lk2, prefix/lk3) and annotations (ak1, prefix/ak2, ak3) are set as expected for custom components and generic components
$ kubectl describe pod -n kubeflow-user-example-com lambda-bw9rk-440379885
Name:             lambda-bw9rk-440379885
Namespace:        kubeflow-user-example-com
Priority:         0
Service Account:  default-editor
Node:             cloning1.fyre.ibm.com/9.30.189.14
Start Time:       Tue, 04 Oct 2022 09:36:06 -0700
Labels:           pipeline/runid=b97f3544-2b1a-460e-bd3c-b9a26f2b1538
                  pipelines.kubeflow.org/cache_enabled=true
                  pipelines.kubeflow.org/cache_id=
                  pipelines.kubeflow.org/enable_caching=true
                  pipelines.kubeflow.org/kfp_sdk_version=1.8.13
                  pipelines.kubeflow.org/metadata_context_id=8
                  pipelines.kubeflow.org/metadata_execution_id=14
                  pipelines.kubeflow.org/metadata_written=true
                  pipelines.kubeflow.org/pipeline-sdk-type=kfp
                  prefix.org/lk1=1
                  prefix.org/lk2=
                  prefix/lk3=lv3-is-the-value
                  workflows.argoproj.io/completed=true
                  workflows.argoproj.io/workflow=lambda-bw9rk
Annotations:      ak1: 
                  ak3: av3
                  pipelines.kubeflow.org/arguments.parameters: {"URL": "https://www.google.com"}
                  pipelines.kubeflow.org/component_ref: {"digest": "8e4384f422a088e4814024df7955e952c1488bd091fa0d4873d5f611d741ceb4"}
                  pipelines.kubeflow.org/component_spec:
                    {"description": "Downloads a file from a public HTTP/S URL using a GET request.", "implementation": {"container": {"command": ["python3", ...
                  pipelines.kubeflow.org/execution_cache_key: 0001ef28c66b445b3629d5df1db2ca146a0287fc0c90b92880ca26ef4fdf79cc
                  pipelines.kubeflow.org/metadata_input_artifact_ids: []
                  pipelines.kubeflow.org/metadata_output_artifact_ids:
                    [{"id": 22, "name": "downloaded-file", "uri": "minio:///artifacts/lambda-bw9rk/2022/10/04/lambda-bw9rk-440379885/download-file-downloaded-...
                  pipelines.kubeflow.org/task_display_name: Download File
                  prefix/ak2: 0
                  sidecar.istio.io/inject: false

Developer's Certificate of Origin 1.1

   By making a contribution to this project, I certify that:

   (a) The contribution was created in whole or in part by me and I
       have the right to submit it under the Apache License 2.0; or

   (b) The contribution is based upon previous work that, to the best
       of my knowledge, is covered under an appropriate open source
       license and I have the right under that license to submit that
       work with modifications, whether created in whole or in part
       by me, under the same open source license (unless I am
       permitted to submit under a different license), as indicated
       in the file; or

   (c) The contribution was provided directly to me by some other
       person who certified (a), (b) or (c) and I have not modified
       it.

   (d) I understand and agree that this project and the contribution
       are public and that a record of the contribution (including all
       personal information I submit with it, including my sign-off) is
       maintained indefinitely and may be redistributed consistent with
       this project or the open source license(s) involved.

@ptitzler ptitzler added the kind:bug Something isn't working label Oct 3, 2022
@ptitzler ptitzler added this to the 3.12.0 milestone Oct 3, 2022
@elyra-bot
Copy link

elyra-bot bot commented Oct 3, 2022

Thanks for making a pull request to Elyra!

To try out this branch on binder, follow this link: Binder

if len(value) > 63 or not value[0].isalnum() or not value[-1].isalnum():
return False

return re.match(r"^[a-zA-Z0-9]([-_\.A-Za-z0-9]*[a-zA-Z0-9])*$", value) is not None

Check failure

Code scanning / CodeQL

Inefficient regular expression

This part of the regular expression may cause exponential backtracking on strings containing many repetitions of '0'.
@ptitzler ptitzler added the component:pipeline-editor pipeline editor label Oct 3, 2022
Copy link
Member

@kiersten-stokes kiersten-stokes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! All validation scenarios working as expected, as are empty labels and annotations

@akchinSTC akchinSTC merged commit c8eb160 into elyra-ai:main Oct 4, 2022
@ptitzler ptitzler deleted the fix-label-validation branch October 4, 2022 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:pipeline-editor pipeline editor kind:bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants