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

PODAUTO-225: Fix e2e-olm-upgrade bugs #173

Merged
merged 2 commits into from
Sep 9, 2024

Conversation

maxcao13
Copy link
Contributor

@maxcao13 maxcao13 commented Sep 6, 2024

This commit does 3 things:

  1. Removes the common app.kubernetes.io/name commonLabel that kustomize uses from the deployment. This is because kustomize commonLabels will mutate the labelSelector that the replica set uses to find its pods. It is discouraged by k8s to update the label selectors so this reverts that change.
  2. Adds the --extra-service-accounts arg to operator-sdk bundle. This is because during an operator-sdk bundle upgrade, it will delete the service accounts that it thinks do not belong to the CSV anymore (since it did not appear in the CSV).
  3. Adds a local-upgrade script that simulates a local upgrade that CI does.

Extra notes on this:

  1. https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#label-selector-updates notes that label selector changes are discouraged, and kustomize notes that this can be fixed here: https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/labels/. Previously, you can just delete the deployment after an upgrade so that the selectors are fixed, but this removes that hassle and confusion as noted here: Updating label selector breaks olm upgrades operator-framework/operator-sdk#5900 and it's linked issues.
  2. I completely missed that this feature was a thing, and I thought that all the extra files in the bundle directory would suffice to be able to install the operator. But while it does work for an install, the upgrade part would fail because of this issue. This was what was causing the CI rehearsal to fail here, because the ServiceAccounts got deleted.

This commit does 3 things:
1. Removes the common app.kubernetes.io/name commonLabel that kustomize uses from the deployment. This is because kustomize commonLabels will mutate the labelSelector that the replica set uses to find its pods. It is discouraged by k8s to update the label selectors so this reverts that change.
2. Adds the --extra-service-accounts arg to operator-sdk bundle. This is because during an operator-sdk bundle upgrade, it will delete the service accounts that it thinks do not belong to the CSV anymore (since it did not appear in the CSV).
3. Adds a local-upgrade script that simulates a local upgrade that CI does.
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Sep 6, 2024
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Sep 6, 2024

@maxcao13: This pull request references PODAUTO-225 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set.

In response to this:

This commit does 3 things:

  1. Removes the common app.kubernetes.io/name commonLabel that kustomize uses from the deployment. This is because kustomize commonLabels will mutate the labelSelector that the replica set uses to find its pods. It is discouraged by k8s to update the label selectors so this reverts that change.
  2. Adds the --extra-service-accounts arg to operator-sdk bundle. This is because during an operator-sdk bundle upgrade, it will delete the service accounts that it thinks do not belong to the CSV anymore (since it did not appear in the CSV).
  3. Adds a local-upgrade script that simulates a local upgrade that CI does.

Extra notes on this:

  1. https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#label-selector-updates notes that label selector changes are discouraged, and kustomize notes that this can be fixed here: https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/labels/. Previously, you can just delete the deployment after an upgrade so that the selectors are fixed, but this removes that hassle and confusion as noted here: Updating label selector breaks olm upgrades operator-framework/operator-sdk#5900 and it's linked issues.
  2. I completely missed that this feature was a thing, and I thought that all the extra files in the bundle directory would suffice to be able to install the operator. But while it does work for an install, the upgrade part would fail because of this issue. This was what was causing the CI rehearsal to fail here, because the ServiceAccounts got deleted.

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 openshift-eng/jira-lifecycle-plugin repository.

Copy link
Contributor

openshift-ci bot commented Sep 7, 2024

@maxcao13: all tests passed!

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@joelsmith
Copy link
Contributor

/lgtm
/approve

Thanks!

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Sep 9, 2024
Copy link
Contributor

openshift-ci bot commented Sep 9, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: joelsmith, maxcao13

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 9, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit aa2533a into openshift:master Sep 9, 2024
12 checks passed
@maxcao13 maxcao13 deleted the fix-upgrade branch September 9, 2024 15:47
@openshift-bot
Copy link
Contributor

[ART PR BUILD NOTIFIER]

Distgit: vertical-pod-autoscaler-operator
This PR has been included in build ose-vertical-pod-autoscaler-operator-container-v4.18.0-202409091841.p0.gaa2533a.assembly.stream.el9.
All builds following this will include this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants