Render the gitlab helm chart into a model to be used in the operator reconcile loop

Summary

From: https://gitlab.com/gitlab-org/gl-openshift/gitlab-operator/-/issues/1#note_447387527

finalize model manipulations to consumable in a well indexed fashion via accessors

  • only change current CR where needed using a mapping function to translate non-Helm aligned 'Values'
  • Using 1 Helm charts' objects from step 2 as a test bed

Details

Use/update the helm template in https://gitlab.com/gitlab-org/gl-openshift/gitlab-operator/-/blob/master/controllers/helm/template.go to render the gitlab helm chart into a data model within the reconcile loop of the gitlab operator: https://gitlab.com/gitlab-org/gl-openshift/gitlab-operator/-/blob/527ea6b52ec21703e99d8686ea15b77be9ed605d/controllers/gitlab_controller.go#L81

  • Add accessors functions that allow you to pull a specific subchart/service from the helm datamodel. As the intent is to be able to replace the existing deployment/statefulset functions in the gitlab operator with functions to apply each subchart.
  • Attempt to change very little of the existing CR for now (we will update it in https://gitlab.com/gitlab-org/gl-openshift/gitlab-operator/-/issues/42 once we have a better idea of how the helm rendering works)
  • Implement gitlab/gitlab-shell subchart as an example
    • For example, with gitaly as the example, remove the areas of the existing controller that handle Gitaly's StatefulSet, Configmap, and instead have a function called from the top level reconcile loop that renders the entire Gitaly subchart from the output of Helm SDK.

Definition of done

  • Accessors are made available to the reconcile loop to get specific objects from the Helm template.
  • The Helm template is only rendered as needed to avoid repeated heavy and/or wasteful operations.
  • Some validation is in place to verify that the objects currently created by the generators are adequately replaced with the objects from the Helm template's data model
  • The model supports running multiple GitLabs in a single namespace (particularly helpful in our CI, but also good for flexibility in general)
Edited by Mitchell Nielsen