Skip to content

Adds common labels to the Task Runner Chart

John Skarbek requested to merge jts/2465-tr into master

What does this MR do?

Introduces an option that helps apply a set of labels spread across all objects associated with the Task Runner chart. Given the following:

global:
  common:
    labels:
      baz: "bat"
task-runner:
  common:
    labels:
      foo: "bar"

The label set baz=bat is applied to all objects created by the GitLab Shell Chart ( this is to expand to encompass all objects in the future, but this MR is already large ). The label set foo=bar is applied to all objects for only the Task Runner Chart.

There are additional methods we can apply labels to various objects.

global:
  common:
    labels:
      common: label
  pod:
    labels:
      common_pod: label
task-runner:
  podLabels:
    extra_pod: label

We expect to see all labels appropriately applied to the necessary objects. We merge items for the chart that we are operating on into the common labels to help avoid creating duplicate labels. Example, labels added specifically to the Task Runner chart are merged into the labels that are provided to the global.common.labels section. We attempt to manage precedence as best possible leveraging the merge function. Helm performs the following when building the template:

  • task-runner.podLabels > task-runner.common.labels > global.pod.labels > global.common.labels => Applies to the Deployment object for the Task Runner
  • task-runner.common.labels > global.common.labels => Applies to essentially all other objects other than the above.

Note that we do not interfere with the standard set of labels that we generate in the _application.tpl. Users will still have the chance of creating labels that may interfere with each other, but the possibility should be low as the items generated us in gitlab.standardLabels are very minimal, would interfere with label selectors, and very common in the helm ecosystem.

Should labels be repetitive, Helm will NOT bail, Kubernetes will NOT throw a warning, instead Kubernetes will take in the last key value pair in the label hash. It is considered invalid YAML and will mark the appropriate keys as duplicates, and as such this will fail any YAML linting.

Related issues

#2465 (closed)

Checklist

See Definition of done.

For anything in this list which will not be completed, please provide a reason in the MR discussion.

Required

  • Merge Request Title and Description are up to date, accurate, and descriptive
  • MR targeting the appropriate branch
  • MR has a green pipeline on GitLab.com

Expected (please provide an explanation if not completing)

  • Test plan indicating conditions for success has been posted and passes
  • Documentation created/updated
  • Tests added
  • Integration tests added to GitLab QA
  • Equivalent MR/issue for omnibus-gitlab opened
Edited by John Skarbek

Merge request reports