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

WIP: Use resource{apply,merge,read} functions provided by library-go where possible #829

Closed
wants to merge 5 commits into from

Conversation

LorbusChris
Copy link
Member

This is a first PR to partly tackle #819

- What I did
Added changes to use resource{apply,merge,read} functions provided by library-go where possible instead of the forked ones from ./lib/resource{apply,merge,read}.
Removed now unused files in ./lib/resource{apply,merge,read}.
Regenerated

- How to verify it
CI

- Description for the changelog

@openshift-ci-robot openshift-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jun 6, 2019
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: LorbusChris

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 Jun 6, 2019
Copy link
Contributor

@kikisdeliveryservice kikisdeliveryservice left a comment

Choose a reason for hiding this comment

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

I think the mcoresourceapply name is super hard for my eyeballs to read. And also there would be less changes if you left that name as-is resourceapply and instead named the resourceapply from libgo something like goresourceapply. less overall changes and clearer imo.

pkg/controller/render/render_controller.go Outdated Show resolved Hide resolved
pkg/daemon/daemon.go Outdated Show resolved Hide resolved
pkg/operator/sync.go Show resolved Hide resolved
@LorbusChris
Copy link
Member Author

The added override in Gopkg.toml brings in a huge amount of changes in the second commit, i.e. when running dep ensure -update :/
cc @runcom

@LorbusChris
Copy link
Member Author

/retest

1 similar comment
@LorbusChris
Copy link
Member Author

/retest

@kikisdeliveryservice
Copy link
Contributor

/skip

@LorbusChris
Copy link
Member Author

/retest

pkg/operator/sync.go Outdated Show resolved Hide resolved
@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 14, 2019
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 14, 2019
@LorbusChris LorbusChris changed the title Use resource{apply,merge,read} functions provided by library-go where possible WIP: Use resource{apply,merge,read} functions provided by library-go where possible Jun 14, 2019
@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 14, 2019
@LorbusChris LorbusChris force-pushed the rid-lib branch 4 times, most recently from fac4030 to 0c2217e Compare June 20, 2019 15:48
@cgwalters
Copy link
Member

Verify going OOM may need us to request more memory in the pod in openshift/release? Probably worth trying to figure out how much memory it's using.

@@ -68,6 +68,7 @@ func createDiscoveredControllerConfigSpec(infra *configv1.Infrastructure, networ
}

platform := "none"
//nolint:staticcheck
switch infra.Status.Platform {
case configv1.AWSPlatformType:
Copy link
Member Author

Choose a reason for hiding this comment

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

strangely, this errors out on this branch, but not on master.

where possible, replacing the forked ones in `./lib/`.
Add events.Recorder as libgoRecorder to Operator struct.
Removed now unused files in `./lib/resource{apply,merge,read}`.
…switch

`make verify` errors out here otherwise,
and we are not ready yet to switch
from deprecated infra.Status.Platform for platformStatus.type, yet.
@runcom
Copy link
Member

runcom commented Jun 24, 2019

This is now fully passing - I'd go with this PR and tackle the other library-go replacements in a follow up. I want this to fully get rid of our, now, super old fork and then we can try to understand a move to sigs.k8s.io/controller-runtime as @ericavonb suggested on Slack.

@LorbusChris
Copy link
Member Author

ack. will tidy the commit messages and bit before the merge.
/hold

@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 Jun 24, 2019
@ericavonb
Copy link
Contributor

To be clear, I don't think we need controller-runtime or librarygo for what we're doing. Here's what I think we should do:
1- have the CVO create the RBAC and CRDS. This is consistent with other operators and makes sense in terms of what the purpose of each operator is (the CVO is an operator to handle deploying other controllers/operators, the MCO is an operator for handling machine configuration).
2- keep the helpers in apply/machineconfig.go, those don’t/shouldn’t have something in library-go anyways
3- if there are any other resources that the operator needs to apply after modifications, write the struct out in the code directly rather than rely on data in some file (removing any resourceread functions) and use the client for that type (removing any resourceapply)

@runcom
Copy link
Member

runcom commented Jun 24, 2019

To be clear, I don't think we need controller-runtime or librarygo for what we're doing. Here's what I think we should do:

isn't that going against #817 (comment)? (apart from moving to library-go or not).

I think here in MCO isn't about consistency, but rather flexibility of managing our own resources (as Abhinav highlighted in his comment above)

@ericavonb
Copy link
Contributor

ericavonb commented Jun 24, 2019

isn't that going against #817 (comment)? (apart from moving to library-go or not).

Per #817 (comment):

Yes, CVO is designed to create and manage objects that are required for the operator to run correctly and not any of it's operands.

The operand for the MCO are machine configurations and the server/daemons to facilitate that. As the operator reconciles its CR types, those CRD definitions would be requirements (along with the RBAC required to handle them) for the operator.

I think here in MCO isn't about consistency, but rather flexibility of managing our own resources (as Abhinav highlighted in his comment above)

CRDs in particular can't be handled only by the operator without consideration to the rest of the clsuter because they are global objects. If anything needed to interact with one of them before the MCO ran, it would need that definition to exist and having more than one place attempt to create the definitions would be a much more difficult migration situation. This is why the openshift/api config CRDs are created via the cluster-config-operator* before other operators run and other operators include their CRDs in their payloads at earlier runlevels.

* created by the CVO but included in a release via the cluster-config-operator payload. with the "create-only" annotation, you can utilize the CVO to create resources that you may want to modify later.

@openshift-ci-robot
Copy link
Contributor

@LorbusChris: PR needs rebase.

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 the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 25, 2019
@runcom
Copy link
Member

runcom commented Jul 12, 2019

2- keep the helpers in apply/machineconfig.go, those don’t/shouldn’t have something in library-go anyways

I think a plus one for library-go (at least today) is about not having those helpers everywhere. See openshift/library-go#472 also, we're currently "broken", and having a single place for the helpers is at least beneficial to catch and fix stuff like that (I just noticed about that)

@LorbusChris
Copy link
Member Author

will resurrect this PR on Monday!

@openshift-ci-robot
Copy link
Contributor

@LorbusChris: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/prow/e2e-etcd-quorum-loss 4b551cf2d2d65711006f25ceb74737a800a8f22b link /test e2e-etcd-quorum-loss
ci/prow/e2e-aws-disruptive e524523 link /test e2e-aws-disruptive
ci/prow/e2e-gcp-op e524523 link /test e2e-gcp-op
ci/prow/e2e-aws-upgrade e524523 link /test e2e-aws-upgrade
ci/prow/e2e-gcp-upgrade e524523 link /test e2e-gcp-upgrade
ci/prow/e2e-vsphere e524523 link /test e2e-vsphere
ci/prow/build-rpms-from-tar e524523 link /test build-rpms-from-tar

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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

@kikisdeliveryservice kikisdeliveryservice added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 3, 2019
@kikisdeliveryservice
Copy link
Contributor

In an effort to clean up the MCO repo, closing old open PRs with no recent activity.

Feel free to reopen.

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. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants