pulp-operator icon indicating copy to clipboard operation
pulp-operator copied to clipboard

REDIRECT_TO_OBJECT_STORAGE parameter does not affect default Pulp domain

Open PyroGun opened this issue 10 months ago • 1 comments

Version Installed via pulp-operator on Kubernetes. Pulp image used: pulp-minimal:stable

Describe the bug Changing configuration variable REDIRECT_TO_OBJECT_STORAGE does not propagate redirect_to_object_storage field change for the default domain in the database

To Reproduce

  1. Create CRD with external_db_secret and object_storage_s3_secret parameters set
  2. Modify CRD with parameter
pulp_settings:
  REDIRECT_TO_OBJECT_STORAGE: false
  1. Verify that parameter is handled by dynaconf and set to False
  2. Verify that parameter is not false for default domain via pulp domain show --name default
  3. Verify that parameter is not false for core_domain table in Pulp database

Expected behavior When switching REDIRECT_TO_OBJECT_STORAGE parameter - new value is applied to default domain

Additional context This issue possibly blocks cloud solutions that are using S3 Object Storage with strict access policies or in an environments with filtered internet access.

PyroGun avatar Jan 22 '25 13:01 PyroGun

https://discourse.pulpproject.org/t/pulp-cr-for-kubernetes-does-not-set-redirect-to-object-storage-setting-via-crd/1879

"[..] a current issue with the operator is that it doesn’t run pulpcore-manager migrate after changing that setting. There is a post migrate hook that updates the default domain’s value to reflect what is in the settings file. We probably need to add some documentation for this setting (and hide_guarded_distributions) since they work a bit differently then others."

we need to trigger a new migration job whenever any of the following settings are modified https://github.com/pulp/pulpcore/blob/8b72c898a018d5f7954c4998f53ab654d79682d2/pulpcore/app/apps.py#L332-L336

settings.HIDE_GUARDED_DISTRIBUTIONS
settings.REDIRECT_TO_OBJECT_STORAGE
settings.STORAGES["default"]["BACKEND"]

one idea is to store the current state of these configurations in CR.status (for settings.STORAGES["default"]["BACKEND"] we could calculate the hash of the config and compare if they did not change instead of comparing each field).

git-hyagi avatar Mar 05 '25 13:03 git-hyagi

Hello, I have a similar issue. Not sure if I should open a new issue...

pulp-operator:v1.0.1 pulp-minimal:3.80.1

I have configured a pulp CRD with custom_pulp_settings: settings. In my settings CM I put

data:
    REDIRECT_TO_OBJECT_STORAGE: "False"

But this seems to have no effect. When I have a look into the /etc/pulp/settings.py, I see the REDIRECT_TO_OBJECT_STORAGE line two times:

kubectl -n pulp exec -it deployment/pulp-api -- cat /etc/pulp/settings.py
# This file is managed by Pulp operator.
# DO NOT EDIT IT.
#
# To modify custom fields, use the custom_pulp_settings from Pulp CR, for example:
# spec:
#   custom_pulp_settings: <configmap name>

REDIRECT_TO_OBJECT_STORAGE = False
...
    'OPTIONS': { 'sslmode': 'prefer' },
  }
}
REDIRECT_TO_OBJECT_STORAGE = True  
MEDIA_ROOT = ""
STORAGES = {
    "default": {
...

Am I missing here something?

I then copied the settings.py file to /tmp, deleted the wrong REDIRECT_TO_OBJECT_STORAGE = True line and triggered a DJANGO_SETTINGS_MODULE='pulpcore.app.settings' PULP_SETTINGS='/tmp/settings.py' pulpcore-manager migrate. But this is only a temporary solution.

wer-anders avatar Jul 02 '25 11:07 wer-anders

https://github.com/pulp/pulp-operator/pull/1524

git-hyagi avatar Sep 12 '25 12:09 git-hyagi