Skip to content

Add metadata to cell config

Part of #2901 (closed)

What does this merge request do and why?

In this MR, we've made the rails app put the metadata from gdk/gitlab/config/gitlab.yml (and gdk/gitlab-cells/cell-ANY_NUMBER/gitlab/config/gitlab.yml) in any grpc request going to Topology Service.

In this MR, we want to do 2 things:

  1. Update gitlab.yml.erb to metadata under cell -> topology_service_client.
production: &base
  #
  # 1. GitLab app settings
  # ==========================
...
  cell:
    enabled: true
    id: 1
    database:
      skip_sequence_alteration: true
    topology_service_client:
      address: 127.0.0.1:9095
      ca_file: /Users/sangwoohan/coding/gdk/gitlab-topology-service/tmp/certs/ca-cert.pem
      private_key_file: /Users/sangwoohan/coding/gdk/gitlab-topology-service/tmp/certs/client-key.pem
      certificate_file: /Users/sangwoohan/coding/gdk/gitlab-topology-service/tmp/certs/client-cert.pem
      tls:
        enabled: false
      metadata:
        x-client-runway-cc-subject-dn: 'MBExDzANBgNVBAMTBkNFTEwtMQ=='
...
  1. We need to make sure that the value of x-client-runway-cc-subject-dn is consistent with the cell-id. In the example above, "MBExDzANBgNVBAMTBkNFTEwtMQ==" was created by passing "CELL-1" to this function. We need to write a function like that in ruby and integrate it inside gdk such that whenever we run "gdk reconfigure", gdk will generate the correct value for x-client-runway-cc-subject-dn using that function and the cellID. So gdk/gitlab-cells/cell-2/gitlab/config/gitlab.yml will look like this:
production: &base
  #
  # 1. GitLab app settings
  # ==========================
...
  cell:
    enabled: true
    id: 2
    database:
      skip_sequence_alteration: true
    topology_service_client:
      address: 127.0.0.1:9095
      ca_file: /Users/sangwoohan/coding/gdk/gitlab-topology-service/tmp/certs/ca-cert.pem
      private_key_file: /Users/sangwoohan/coding/gdk/gitlab-topology-service/tmp/certs/client-key.pem
      certificate_file: /Users/sangwoohan/coding/gdk/gitlab-topology-service/tmp/certs/client-cert.pem
      tls:
        enabled: false
      metadata:
        x-client-runway-cc-subject-dn: 'MBExDzANBgNVBAMTBkNFTEwtMg=='
...

"MBExDzANBgNVBAMTBkNFTEwtMg==" is what you get when you pass "CELL-2" to the function linked above.

How to set up and validate locally

  1. Checkout to this branch in gdk.
  2. rm -rf gitlab-cells and enable cells as per https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/howto/cells.md
  3. Run gdk reconfigure && gdk cells up
  4. Verify that sub cells were configured without errors
Edited by Sangwoo Han

Merge request reports

Loading