CNG orchestor: Make hardcoded values configurable
Problem
In gitlab-cng
some (magic) values are hardcoded in different places. On the other hand values passed via ENV
are verified in multiple locations.
Proposed solution
Make hardcoded values configurable and define a single source of truth where these values are checked and their fallback values (if any) assigned.
Discussion
The following discussions from !152741 (merged) should be addressed:
-
@splattael started a discussion: (+2 comments) Suggestion (non-blocking) Should we also move these magic numbers up to CLI options and hardcode the defaults only once there?
🤔 Reason:
lib/gitlab/cng/lib/deployment/configurations/kind.rb 63: "gitlab-shell": 32022, 64: http: 32080 76: "http://gitlab.#{gitlab_domain}#{ci ? '' : ':32080'}" spec/unit/gitlab/cng/deployment/configurations/kind_spec.rb 90: "gitlab-shell": 32022, 91: http: 32080 lib/gitlab/cng/lib/kind/configs.rb 38: - containerPort: 32080 43: - containerPort: 32022 77: - containerPort: 32080 78: hostPort: 32080 82: - containerPort: 32022 83: hostPort: 32022
Alternatively, we could extract these values into constants first like we did for
ADMIN_PASSWORD_SECRET
?🤔 -
@splattael started a discussion: (+2 comments) Question (non-blocking)
I am seeing 4 ways how we define and pass values in CNG:
- Values are hardcoded
- Values are passed via CLI option
- Values are defined as constants
- Values are fetched from ENV
Perhaps we should only a single way of defining values?
🤔 I'd prefer CLI options with convenient default values.
WDYT?