Add Kubernetes pod label sanitization
What does this MR do?
Adding sanitation for kubernetes labels to avoid issues with non conformative variables. executorkubernetes
Why was this MR needed?
Currently the user needs to be careful when declaring variables in the Kubernetes labels. Such labels may not conform with the restrictions for Labels in Kubernetes which will result in a failing pipeline.
What's the best way to test this MR?
Add the following configuration to a kubernetes executor:
[runners.kubernetes.pod_labels]
forbidden_label = "@Hello world this value is not valid--"
job_name = "${CI_JOB_NAME}"
The job_name
can illustrate one of the possible usages.
What are the relevant issue numbers?
Closes #4565 (closed)
Merge request reports
Activity
Thank you for your contribution to GitLab. We believe that everyone can contribute and contributions like yours are what make GitLab great!
Some contributions require several iterations of review and we try to mentor contributors during this process. However, we understand that some reviews can be very time consuming. If you would prefer for us to continue the work you've submitted now or at any point in the future please let us know.
If you're okay with being part of our review process (and we hope you are!), there are several initial checks we ask you to make:
- The merge request description clearly explains:
- The problem being solved.
- The best way a reviewer can test your changes (is it possible to provide an example?).
- If the pipeline failed, do you need help identifying what failed?
- Check that Go code follows our Go guidelines.
- Read our contributing to GitLab Runner document.
This message was generated automatically. You're welcome to improve it.
- The merge request description clearly explains:
added Community contribution label
added 1st contribution label
added [Deprecated] Category:Runner devopsverify grouprunner labels
added sectionops label
mentioned in issue gitlab-org/quality/triage-reports#4139 (closed)
mentioned in issue gitlab-org/quality/triage-reports#4349 (closed)
added 1 commit
- d5deacd6 - Added operational sanitizeLabel function and fixed extra space error
added 1 commit
- 998dc317 - Added additional tests and replace end/start characters logic
mentioned in issue gitlab-org/quality/triage-reports#4539 (closed)
mentioned in issue gitlab-org/quality/triage-reports#4700 (closed)
- Resolved by Theodor van Nahl
Is there anything we're missing or something we should do in order to move forward with the MR? Can a @gitlab-org/coaches help us here?
requested review from @ajwalker
assigned to @t.vannahl
- Resolved by Theodor van Nahl
- Resolved by Arran Walker
- Resolved by Arran Walker
- Resolved by Arran Walker
added 1 commit
- a1337d0a - Excluding from linter sanitizeLabel function
added executorkubernetes label
added typebug label
enabled automatic add to merge train when the pipeline for 689e86ba succeeds
mentioned in commit e98dc4b8
mentioned in issue gitlab-org/charts/gitlab-runner#173
mentioned in issue #28767
@t.vannahl @ajwalker Is similar filtering applied to pod annotations?
@jason.damour No, pod annotation values are not sanitized in any way. Unlike label values, annotation values have no such restrictions.