Skip to content

Propagate content_path_prefix overrides to pulp-web ConfigMap#1650

Open
mouchar wants to merge 3 commits into
pulp:mainfrom
mouchar:content-path-propagation
Open

Propagate content_path_prefix overrides to pulp-web ConfigMap#1650
mouchar wants to merge 3 commits into
pulp:mainfrom
mouchar:content-path-propagation

Conversation

@mouchar

@mouchar mouchar commented Jun 7, 2026

Copy link
Copy Markdown

Summary

When CONTENT_PATH_PREFIX is overridden via the custom_pulp_settings ConfigMap, the pulp-server Secret (settings.py) and Ingress/Route paths reconcile correctly, but the pulp-web <pulp>-configmap (nginx.conf) was created once and then never updated. The result: nginx kept proxying the old prefix even after the user updated the override, and the in-tree // TODO: check pulp-web configmap change confirmed this was unfinished work.

This branch:

  1. Reconciles the pulp-web ConfigMap on every loop using the existing controllers.ReconcileObject(..., PulpConfigMap{}) pattern already used for telemetry and worker-probe ConfigMaps.
  2. Rolls the pulp-web pods when nginx.conf changes by adding a repo-manager.pulpproject.org/web-config-hash annotation on the pod template. The nginx.conf key is mounted via subPath, and kubelet does not auto-propagate updates to subPath ConfigMap mounts, so a rollout has to be triggered explicitly. The annotation shifts the Deployment spec hash, and the existing CheckDeploymentSpec path takes care of the rollout.
  3. Modernizes envtest setup. make testbin had been broken because the old go.kubebuilder.io/test-tools tarballs were retired upstream. Switched to the kubebuilder-recommended flow driven entirely through setup-envtest:
    • ENVTEST_K8S_VERSION is derived from k8s.io/api in go.mod (v0.35.x1.35).
    • ENVTEST_VERSION is derived from controller-runtime in go.mod, and setup-envtest is pinned to that release branch (release-0.23) instead of @latest.
    • testbin now runs setup-envtest use --bin-dir $(LOCALBIN); no sudo, no /usr/local/kubebuilder.
    • New envtest-path helper prints the KUBEBUILDER_ASSETS export for raw go test / IDE users.
    • suite_test.go auto-discovers bin/k8s/<ver>-<os>-<arch> via BinaryAssetsDirectory, matching current kubebuilder scaffolding.
  4. Adds a focused unit test that asserts both halves of the fix: rendering with one content_path_prefix value produces a different nginx.conf and a different pod-template hash than rendering with another. Runs in ~2s without envtest.

Other ingress modes are already covered by their existing ReconcileObject calls (controllers/repo_manager/ingress.go for nginx and others, controllers/ocp/ingress.go for OCP Ingress, controllers/ocp/route.go for OCP Route). The pulp-web ConfigMap was the only path that wasn't reconciling on drift.

Test plan

  • go build ./... and go vet ./...
  • go test ./controllers/repo_manager/ -run TestPulpWebContentPathPrefixPropagation passes in ~2s without envtest
  • make testbin installs envtest binaries from a clean state (no bin/k8s, no setup-envtest)
  • make test — full envtest suite passes (12 passed, 0 failed, 1 skipped)
  • Raw go test ./controllers/repo_manager/ -run TestAPIs (no KUBEBUILDER_ASSETS) also passes thanks to the BinaryAssetsDirectory fallback
  • Manual verification on a live cluster: change content_path_prefix in a custom_pulp_settings ConfigMap, confirm the <pulp>-configmap ConfigMap and pulp-web pods are rolled, and that nginx serves the new path

🤖 Generated with Claude Code

mouchar and others added 3 commits June 7, 2026 18:10
The pulp-web ConfigMap was only ever created; subsequent edits to inputs
that affect the rendered nginx.conf (e.g. CONTENT_PATH_PREFIX set via
custom_pulp_settings) were silently ignored. Reconcile the ConfigMap on
every loop and hash its data into a pod-template annotation so the
pulp-web pods are rolled when the config changes (the key is mounted via
subPath and kubelet does not auto-update those mounts).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The old "go.kubebuilder.io/test-tools" tarballs were retired upstream,
so `make testbin` had been broken for a while. Switch to the kubebuilder-
recommended flow that drives everything through setup-envtest:

  * Derive ENVTEST_K8S_VERSION from k8s.io/api in go.mod (1.24.2 -> 1.35).
  * Derive ENVTEST_VERSION from controller-runtime in go.mod and pin
    setup-envtest to that branch (release-0.23) instead of @latest.
  * Rewrite testbin to call `setup-envtest use --bin-dir $(LOCALBIN)`;
    no sudo, no /usr/local/kubebuilder.
  * Add an envtest-path helper for IDE / raw `go test` users.

Make raw `go test ./...` and IDE runs work without exporting
KUBEBUILDER_ASSETS by populating envtest.Environment.BinaryAssetsDirectory
from bin/k8s/<version>-<os>-<arch>, matching current kubebuilder
scaffolding. `make test` continues to override it with KUBEBUILDER_ASSETS
when invoked through make.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Verify that overriding CONTENT_PATH_PREFIX via custom_pulp_settings:
  * flips the `location` directive in the rendered nginx.conf, and
  * shifts the pulp-web pod-template hash annotation so the Deployment
    gets rolled (necessary because nginx.conf is mounted via subPath
    and kubelet does not auto-update those mounts).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@openshift-ci openshift-ci Bot requested review from dkliban and git-hyagi June 7, 2026 16:12
@openshift-ci

openshift-ci Bot commented Jun 7, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mouchar
Once this PR has been reviewed and has the lgtm label, please assign git-hyagi for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci

openshift-ci Bot commented Jun 7, 2026

Copy link
Copy Markdown

Hi @mouchar. Thanks for your PR.

I'm waiting for a pulp member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant