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

Bug 1926893: only override deployment resources when explicitly defined in subscription config #2010

Conversation

joelanford
Copy link
Member

@joelanford joelanford commented Feb 16, 2021

Description of the change:
This PR resolves an issue that causes resources defined in CSV deployment specs to be removed by OLM when the operator is installed unless they are explicitly redefined in the subscription's spec.config.resources section.

Motivation for the change:
Closes #1912
Closes #1940
Closes #1953

Reviewer Checklist

  • Implementation matches the proposed design, or proposal is updated to match implementation
  • Sufficient unit test coverage
  • Sufficient end-to-end test coverage
  • Docs updated or added to /docs
  • Commit messages sensible and descriptive

@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. labels Feb 16, 2021
@openshift-ci-robot
Copy link
Collaborator

@joelanford: This pull request references Bugzilla bug 1926893, which is invalid:

  • expected the bug to target the "4.8.0" release, but it targets "---" instead

Comment /bugzilla refresh to re-evaluate validity if changes to the Bugzilla bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

[wip] Bug 1926893: only override deployment resources when explicitly defined in subscription config

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/test-infra repository.

@joelanford
Copy link
Member Author

joelanford commented Feb 16, 2021

Note: This PR is current a WIP because it needs some (hopefully quick) discussion about the approach.

There are likely two ways to solve this problem:

  1. Make subscription.spec.config.resources a pointer and do a nil check before applying the override. That's what this PR currently does, however it is a breaking change to the Go API (not to the kubernetes API)
  2. Leave subscription.spec.config.resources as it is, and do reflect.DeepEqual(overrides, corev1.ResourceRequirements{}) to perform the comparison instead of the nil check. This option has the benefit of not changing the Go API code at all. However it feels hacky and workaround-y.

My vote is for 1) unless there's a major concern with changing the Go API.

Also note that this PR goes ahead and changes the entire subscription.spec.config struct to a pointer as well since config is optional.

@joelanford
Copy link
Member Author

/retest

@openshift-ci-robot
Copy link
Collaborator

@joelanford: This pull request references Bugzilla bug 1926893, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.8.0) matches configured target release for branch (4.8.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

[wip] Bug 1926893: only override deployment resources when explicitly defined in subscription config

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/test-infra repository.

@openshift-ci-robot openshift-ci-robot added bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. and removed bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. labels Feb 16, 2021
@joelanford
Copy link
Member Author

/test unit

@joelanford
Copy link
Member Author

/retest

@joelanford
Copy link
Member Author

I think I finally figured out what's going on here. operator-framework/api@v0.5.2 requires controller-runtime v0.8.0 (olm master is currently on v0.5.1). Trying to apply a necessary change to that repo and pull it into this PR means we're also getting v0.5.3+ and controller-runtime v0.8.0.

The problem is that v0.8.0 defines an interface that contains overlapping interfaces, which is only supported in Go 1.14+. The OLM go.mod file still specifies Go 1.13, so even if we're compiling with a later version, we are still getting Go 1.13 semantics.

It seems like fixing this will require a Go version bump for OLM, which is probably overdue anyway.

Just as a note to our future selves, we should bump the minor version on operator-framework/api releases when we change Go, Kubernetes, or controller-runtime minor versions (and any others we think might be troublesome), so that we don't get into a situation (like this one) where we need to fix a bug in OLM that requires an API change, but now all of a sudden we're pulling in a bunch of other unrelated changes.
/cc @estroz, @dinhxuanvu

@estroz
Copy link
Member

estroz commented Feb 18, 2021

Just as a note to our future selves, we should bump the minor version on operator-framework/api releases when we change Go, Kubernetes, or controller-runtime minor versions

Fully agree and have brought this up before offline. I cut v0.5 as the “k8s 1.20” release although v0.5.0 still used controller-runtime v0.7.0 because v0.8.0 wasn’t out yet, which I think is generally fine but led to issues due to min module versioning.

@joelanford
Copy link
Member Author

This PR needs to be rebased after #2012 merges.

@joelanford
Copy link
Member Author

/test unit

@joelanford
Copy link
Member Author

/retest

go.mod Outdated
@@ -64,6 +64,8 @@ replace (
github.com/openshift/api => github.com/openshift/api v0.0.0-20200331152225-585af27e34fd // release-4.5
github.com/openshift/client-go => github.com/openshift/client-go v0.0.0-20200326155132-2a6cd50aedd0 // release-4.5

github.com/operator-framework/api => github.com/joelanford/api v0.0.0-20210216180012-67617936c73e
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: just need to remove this and bump the operator-framework/api version to a new release including the API change.

@joelanford joelanford changed the title [wip] Bug 1926893: only override deployment resources when explicitly defined in subscription config Bug 1926893: only override deployment resources when explicitly defined in subscription config Feb 22, 2021
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 22, 2021
@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 25, 2021
@njhale
Copy link
Member

njhale commented Mar 2, 2021

/approve

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dinhxuanvu, joelanford, njhale

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-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 2, 2021
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

7 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@njhale
Copy link
Member

njhale commented Mar 2, 2021

/hold

console tests consistently failing -- waiting for more info from the test maintainers

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 2, 2021
@njhale
Copy link
Member

njhale commented Mar 4, 2021

/override e2e-aws-console-olm
/hold cancel

@openshift-ci-robot
Copy link
Collaborator

@njhale: /override requires a failed status context to operate on.
The following unknown contexts were given:

  • e2e-aws-console-olm

Only the following contexts were expected:

  • ci/prow/e2e-aws-console-olm
  • ci/prow/e2e-aws-olm
  • ci/prow/e2e-gcp
  • ci/prow/e2e-upgrade
  • ci/prow/images
  • ci/prow/unit
  • ci/prow/verify
  • tide

In response to this:

/override e2e-aws-console-olm
/hold cancel

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/test-infra repository.

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 4, 2021
@njhale
Copy link
Member

njhale commented Mar 4, 2021

/override ci/prow/e2e-aws-console-olm

@openshift-ci-robot
Copy link
Collaborator

@njhale: Overrode contexts on behalf of njhale: ci/prow/e2e-aws-console-olm

In response to this:

/override ci/prow/e2e-aws-console-olm

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/test-infra repository.

@openshift-merge-robot openshift-merge-robot merged commit 3787874 into operator-framework:master Mar 4, 2021
@openshift-ci-robot
Copy link
Collaborator

@joelanford: All pull requests linked via external trackers have merged:

Bugzilla bug 1926893 has been moved to the MODIFIED state.

In response to this:

Bug 1926893: only override deployment resources when explicitly defined in subscription config

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/test-infra repository.

@joelanford
Copy link
Member Author

/cherry-pick release-4.7

@openshift-cherrypick-robot

@joelanford: #2010 failed to apply on top of branch "release-4.7":

Applying: only override deployment resources when explicitly defined in subscription.spec.config
Using index info to reconstruct a base tree...
M	Makefile
M	go.mod
M	go.sum
M	test/e2e/subscription_e2e_test.go
M	vendor/modules.txt
Falling back to patching base and 3-way merge...
Auto-merging vendor/modules.txt
CONFLICT (content): Merge conflict in vendor/modules.txt
Auto-merging test/e2e/subscription_e2e_test.go
Auto-merging go.sum
CONFLICT (content): Merge conflict in go.sum
Auto-merging go.mod
Auto-merging Makefile
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 only override deployment resources when explicitly defined in subscription.spec.config
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-4.7

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/test-infra repository.

@taylormgeorge91
Copy link

Will this be targeted for release-4.6 backport or only 4.7?

@horis233
Copy link
Contributor

@taylormgeorge91
This is the cherry-pick PR for release-4.6 #2071

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. bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
10 participants