-
Notifications
You must be signed in to change notification settings - Fork 71
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
feat: Update Operator SDK version strategy #1250
feat: Update Operator SDK version strategy #1250
Conversation
Signed-off-by: Mateus Oliveira <[email protected]>
Skipping CI for Draft Pull Request. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mateusoliveira43 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
op.diff
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
example of diff file between current and next operator sdk version structures
Should we update Lines 179 to 191 in 0347669
|
Signed-off-by: Mateus Oliveira <[email protected]>
.dockerignore
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of creating new Makefile, we could just add our commands to end of the file, like this. This should avoid patching problems
@@ -40,7 +40,7 @@ func isObjectOurs(scheme *runtime.Scheme, object client.Object) bool { | |||
return false | |||
} | |||
gvk := objGVKs[0] | |||
if gvk.Group == oadpv1alpha1.GroupVersion.Group && gvk.Version == oadpv1alpha1.GroupVersion.Version && gvk.Kind == oadpv1alpha1.Kind { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change is ok or we only care about DPA objects here?
For every file accepted to change name, run grep command to check doc occurrences and change them as well |
Signed-off-by: Mateus Oliveira <[email protected]>
Client client.Client | ||
Scheme *runtime.Scheme | ||
Log logr.Logger | ||
EventRecorder record.EventRecorder | ||
} | ||
|
||
//TODO!!! FIX THIS!!!! | ||
//TODO!!! FIX THIS!!!!? | ||
// TODO change buckets to cloudstorages? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this and leases role need updating
also run |
@@ -28,8 +28,6 @@ var ( | |||
// GroupVersion is group version used to register these objects | |||
GroupVersion = schema.GroupVersion{Group: "oadp.openshift.io", Version: "v1alpha1"} | |||
|
|||
Kind = "DataProtectionApplication" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we wanna add kind back and add to schemebuilder line 32?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think not, I believe this was used only as a constant here
oadp-operator/controllers/predicate.go
Line 43 in 0347669
if gvk.Group == oadpv1alpha1.GroupVersion.Group && gvk.Version == oadpv1alpha1.GroupVersion.Version && gvk.Kind == oadpv1alpha1.Kind { |
I believe the kind is get from theses structs name https://github.com/openshift/oadp-operator/blob/master/api/v1alpha1/oadp_types.go#L281, in each file
The idea is really nice, may be tricky to maintain with more diffs. We have something like that in other project, right? The benefit is that we can always re-generate operator starting from scratch. This is fine for operator where there is not a huge number of changes to the initial files generated by the What about using kustomize files instead of patches whenever applicable ? |
Signed-off-by: Mateus Oliveira <[email protected]>
@mpryc similar yes, but we will not have patch files here. Its terrible developer experience (editing a diff file instead of a yaml file, for example). We would re-generate files only when we want to update opeartor-sdk version, then we would create a diff file (not tracked by git), and then apply it and then open a PR for that action. kustomize files can be an option, but not for all things I think. Makefile may be updated, for example. And that is the thing I think we need to be more careful: editing generated files. So, when we update then, it is a smooth experience. Maybe just adding new things to the end of those files can be enough to avoid patching errors |
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. |
Issues go stale after 90d of inactivity. Mark the issue as fresh by commenting If this issue is safe to close now please do so with /lifecycle stale |
/remove-lifecycle stale |
@mateusoliveira43: The following tests failed, say
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. |
Issues go stale after 90d of inactivity. Mark the issue as fresh by commenting If this issue is safe to close now please do so with /lifecycle stale |
unstale? |
@kaovilai going to close this one and create small PRs that together do the same |
The goal of this PR is to create a strategy (document or script) for updating Operator SDK version in the project.
My goal was to have all operator generated files in a separate folder (inspired by dora-metrics/pelorus#1045), but helm and Go Operator SDK structures are different, its not the best idea to try to put Go generated files in a separate folder.
The idea is: in temporaries folders, create Operator SDK structure using the current Operator SDK version and the version which we want to upgrade it to, following these steps:
operator-sdk init --project-name=oadp-operator --repo=github.com/openshift/oadp-operator --domain=openshift.io
operator-sdk create api --group oadp --version v1alpha1 --kind DataProtectionApplication --resource --controller
operator-sdk create api --group oadp --version v1alpha1 --kind CloudStorage --resource --controller
Then generate a
diff
file and apply changes to repo code.It seems to work operator-framework/operator-sdk#6628
There are still a few points to adjust, like: when do we update boilerplate year? What to update in
go.mod
? Create another Makefile? ( the example added can be run withmake -f oadp.mk help
)