|
| 1 | +Feature: Rollout Restart User Changes |
| 2 | + |
| 3 | + # This test checks that OLMv1 does not undo changes made by users to deployed resources. |
| 4 | + # It uses "kubectl rollout restart" as an example, but the fix works for ANY pod template metadata changes. |
| 5 | + # |
| 6 | + # Background: |
| 7 | + # - In OLMv0, user changes to pod templates (annotations, labels, etc.) would be undone by OLM. |
| 8 | + # - In OLMv1, OLM should only manage the fields it owns, allowing user changes to stay. |
| 9 | + # |
| 10 | + # This test makes sure OLMv1 works correctly and does not have the OLMv0 problem. |
| 11 | + # See: https://github.com/operator-framework/operator-lifecycle-manager/issues/3392 |
| 12 | + |
| 13 | + Background: |
| 14 | + Given OLM is available |
| 15 | + And ClusterCatalog "test" serves bundles |
| 16 | + And ServiceAccount "olm-sa" with needed permissions is available in ${TEST_NAMESPACE} |
| 17 | + |
| 18 | + # WHAT THIS TEST DOES: |
| 19 | + # This test checks that the fix for issue #3392 works correctly. |
| 20 | + # The test uses "kubectl rollout restart" as an example, but the fix is generic. |
| 21 | + # |
| 22 | + # THE PROBLEM (now fixed): |
| 23 | + # When users changed ANY pod template metadata, Boxcutter would undo the changes: |
| 24 | + # 1. User changes pod template (kubectl rollout restart, kubectl annotate, kubectl label, etc.) |
| 25 | + # 2. Boxcutter runs and removes ALL user changes |
| 26 | + # 3. User changes are lost |
| 27 | + # |
| 28 | + # THE FIX: |
| 29 | + # We changed the code in applier/boxcutter.go to NOT save pod template metadata at all. |
| 30 | + # This way, OLM won't overwrite ANY user changes to pod templates when it runs. |
| 31 | + # Now ANY user changes to pod templates (annotations, labels, etc.) will stay in place. |
| 32 | + # |
| 33 | + # UPSTREAM ISSUE: https://github.com/operator-framework/operator-lifecycle-manager/issues/3392 |
| 34 | + @BoxcutterRuntime |
| 35 | + Scenario: User-initiated deployment changes persist after OLM reconciliation |
| 36 | + When ClusterExtension is applied |
| 37 | + """ |
| 38 | + apiVersion: olm.operatorframework.io/v1 |
| 39 | + kind: ClusterExtension |
| 40 | + metadata: |
| 41 | + name: ${NAME} |
| 42 | + spec: |
| 43 | + namespace: ${TEST_NAMESPACE} |
| 44 | + serviceAccount: |
| 45 | + name: olm-sa |
| 46 | + source: |
| 47 | + sourceType: Catalog |
| 48 | + catalog: |
| 49 | + packageName: test |
| 50 | + selector: |
| 51 | + matchLabels: |
| 52 | + "olm.operatorframework.io/metadata.name": test-catalog |
| 53 | + """ |
| 54 | + Then ClusterExtension is rolled out |
| 55 | + And ClusterExtension is available |
| 56 | + And resource "deployment/test-operator" is installed |
| 57 | + And deployment "test-operator" is ready |
| 58 | + |
| 59 | + # User runs "kubectl rollout restart deployment/test-operator" |
| 60 | + # This adds a restart annotation to trigger a rolling restart of pods. |
| 61 | + # Note: This test uses restart as an example, but the fix works for ANY pod template metadata changes. |
| 62 | + # In OLMv0, OLM would undo this change and stop the rollout. |
| 63 | + # In OLMv1, the change should stay because kubectl owns it. |
| 64 | + When user performs rollout restart on "deployment/test-operator" |
| 65 | + |
| 66 | + # Wait for the rollout to finish - new pods created and running |
| 67 | + Then deployment "test-operator" rollout completes successfully |
| 68 | + And resource "deployment/test-operator" has restart annotation |
| 69 | + |
| 70 | + # Wait for OLM to run its checks (OLM checks every 10 seconds) |
| 71 | + # This is the important part: does OLM undo what the user did? |
| 72 | + And I wait for "30" seconds |
| 73 | + |
| 74 | + # After OLM runs, check that the rollout is STILL working |
| 75 | + # In OLMv0, this would fail because OLM undoes the annotation |
| 76 | + # and the new pods would be stopped and old pods would come back |
| 77 | + Then deployment "test-operator" rollout is still successful |
| 78 | + And resource "deployment/test-operator" has restart annotation |
| 79 | + And deployment "test-operator" has expected number of ready replicas |
0 commit comments