Uploaded image for project: 'Red Hat Advanced Cluster Security'
  1. Red Hat Advanced Cluster Security
  2. ROX-28780

Refactor duplicated env vars for Sensor advertised URL

    • Icon: Task Task
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • None
    • Sensor
    • None
    • False
    • Hide

      None

      Show
      None
    • False
    • 0

      This is a followup to ROX-28698. While working on that ticket, we noticed that there are two env variables in `pkg/env/sensor.go` that are used to communicate Sensor host address to other services. Those are: 

      // AdvertisedEndpoint is used to provide the Sensor with the endpoint it
      // should advertise to services that need to contact it, within its own cluster.
      AdvertisedEndpoint = RegisterSetting("ROX_ADVERTISED_ENDPOINT", WithDefault("sensor.stackrox.svc:443"),
          StripAnyPrefix("https://", "http://"))
      
      // SensorEndpoint is used to communicate the sensor endpoint to other services in the same cluster.
      SensorEndpoint = RegisterSetting("ROX_SENSOR_ENDPOINT", WithDefault("sensor.stackrox.svc:443")) 

      There is no need to have two variables that do the same thing - the `StripAnyPrefix` has been added in ROX-28698 to add basic input sanitization to this var. This task is about unifying them - pick one and make sure that it is used correctly.

      Extras:

      • Those vars exist because we are not always able to reliably determine the namespace in which Sensor is deployed. Find a way to reliably derive the namespace of Sensor, so that we can get rid of both of those env vars.

              Unassigned Unassigned
              prygiels@redhat.com Piotr Rygielski
              ACS Sensor & Ecosystem
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: