pulp / pulp-operator

Kubernetes Operator for Pulp 3. Under active development.
https://docs.pulpproject.org/pulp_operator/
GNU General Public License v2.0
67 stars 50 forks source link

Publication base_url does not point to proper URI #1350

Open vkukk opened 2 months ago

vkukk commented 2 months ago

Version $ helm -n pulp list NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION pulp pulp 1 2024-09-03 16:54:04.919341315 +0300 EEST deployed pulp-operator-0.1.0 1.0.1-beta.4

Stable pulp images.

Describe the bug Distribution "base_url" value is useless and wrong (or maybe I'm wrong).

pulp> rpm distribution list
Not all 1 entries were shown.
[
  {
    "pulp_href": "/pulp/api/v3/distributions/rpm/rpm/0191e659-a5f8-70ca-b136-65891d31d7c5/",
    "pulp_created": "2024-09-12T13:08:40.570826Z",
    "pulp_last_updated": "2024-09-12T13:08:40.570857Z",
    "base_path": "mongo-6/tst",
    "base_url": "http://pulp-web-svc.pulp.svc.cluster.local:24880/pulp/content/mongo-6/tst/",
    "content_guard": null,
    "no_content_change_since": null,
    "hidden": false,
    "pulp_labels": {},
    "name": "mongo-6-tst",
    "repository": "/pulp/api/v3/repositories/rpm/rpm/0191e657-f42f-7ffe-b0cf-6247ef9ded82/",
    "publication": null,
    "generate_repo_config": false
  }
]

Also, it is strange that "Not all 1 entries were shown" is displayed, but this is another issue of pulp cli.

The base_url value "http://pulp-web-svc.pulp.svc.cluster.local:24880/pulp/content/mongo-6/tst/" does not make sense. Pulp CR is not configured to enable web at all, no pulp-web is running. There should be nothing available at that URI. I can see from pulp-content logs that actual content is served from proper base url:

::ffff:10.2.3.17 [12/Sep/2024:13:09:04 +0000] "GET /pulp/content/mongo-6/tst/repodata/repomd.xml HTTP/1.1" 200 260 "https://pulp3.domain.tld/pulp/content/mongo-6/tst/repodata/" "Mozilla/5.0 (X11; Linux x86_64; rv:130.0) Gecko/20100101 Firefox/130.0"

This deployment has custom ingress based on Pulp CR config, not using one created by Pulp CR due to issues with annotations I had initially.

To Reproduce Deploy Pulp CR without web and ingress resources, but specify "ingress_host" Create rpm remote, repo, sync and publish, create distribution. Check properties of a distribution to see that base_url does not point to host variable ingress_host.

Expected behavior A Pulp distribution field base_url should have proper value "https://pulp3.domain.tld/pulp/content/mongo-6/tst/" where "pulp3.domain.tld" is actual proper hostname of the ingress by using "ingress_host" value for hostname.

vkukk commented 2 months ago

This also means that generated config.repo has wrong URI in it

[mongo-6-tst]
name=mongo-6-tst
baseurl=http://pulp-web-svc.pulp.svc.cluster.local:24880/pulp/content/mongo-6/tst/
repo_gpgcheck=0
gpgcheck=0
enabled=1

baseurl should be: "https://pulp3.domain.tld/pulp/content/mongo-6/tst/"

vkukk commented 2 months ago

When letting pulp-operator to create the ingress, base_url/baseurl is correct.

spec:
  ingress_host: pulp3.host.tld
  ingress_type: ingress
  ingress_class_name: nginx
  is_nginx_ingress: true
  ingress_annotations:
    cert-manager.io/cluster-issuer: "letsencrypt-production"
  ingress_tls_secret: pulp-tls
[mongo-6-tst]
name=mongo-6-tst
baseurl=https://pulp3.host.tld/pulp/content/mongo-6/tst/
repo_gpgcheck=0
gpgcheck=0
enabled=1
gerrod3 commented 2 months ago

The fix is to allow users to specify CONTENT_ORIGIN (this setting is used to craft the distribution's base_url) and not have the operator override the value.