Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Centralize resource names in settings package #1093

Merged
merged 1 commit into from
Sep 19, 2023

Conversation

git-hyagi
Copy link
Collaborator

⚠️ THIS IS A BREAKING CHANGE! ⚠️

TL;DR
For some specific scenarios, after upgrading the operator, some errors may appear.
scenario1:

database:
  postgres_storage_class: <storage class name>

scenario2:
Any installation with pulp-web.


This PR centralizes the k8s resource names definition in a unique place. It will be helpful in case we decide to allow multiple instances of Pulp running in the same namespace.

Postgres

Since we are trying to avoid name conflicts, we had to change the name of the volume used by postgres sts, but this is an immutable field and when the operator tries to modify it it will get into an infinite reconcile error loop. To workaround this situation:

  • make sure to have a backup of all pulp components (pvc, secrets, pulp cr, etc), especially database
  • make sure there is no pending task:
2023-09-15T15:08:23Z	INFO	repo_manager/controller.go:235  Operator tasks synced
  • put the operator into an unmanaged state:
PULP_CR_NAME=<NAME OF PULP CR>
kubectl patch pulp $PULP_CR_NAME --type merge -p '{"spec": {"unmanaged": true}}'
  • collect the current pvc in use:
kubectl get pvc -l pulp_cr=${PULP_CR_NAME},app.kubernetes.io/component=database -oname 
  • update pulp cr to use this pvc:
kubectl patch pulp $PULP_CR_NAME --type json -p '[{"op": "remove", "path": "/spec/database/postgres_storage_class"}, {"op": "add", "path": "/spec/database/pvc","value": "postgres-'${PULP_CR_NAME}'-database-0"}]'
  • double-check the patch:
kubectl get pulp $PULP_CR_NAME -oyaml
  database:
    pvc: postgres-test-2-database-0
  • delete the current sts:
kubectl delete sts ${PULP_CR_NAME}-database
  • put the operator into a managed state again:
kubectl patch pulp $PULP_CR_NAME --type merge -p '{"spec": {"unmanaged": false}}'

pulp-web

Another breaking change is in case the installation has a pulp-web deployment. This PR changes a label/labelselector from pulp-web deployment so, after upgrading the operator, it can get into an infinite loop trying to update the deployment and getting an error because the field (labelselector) is immutable. To workaround this error just delete the pulp-web deployment and a new one will be provisioned with the new label.

kubectl delete deployment -l app.kubernetes.io/component=webserver,app.kubernetes.io/part-of=pulp

ref: #1025
[noissue]

@openshift-ci
Copy link

openshift-ci bot commented Sep 18, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: git-hyagi

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

The pull request process is described here

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

@git-hyagi git-hyagi merged commit 20d4b52 into pulp:main Sep 19, 2023
@git-hyagi git-hyagi deleted the centralizing-names branch September 19, 2023 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant