- Notifications
You must be signed in to change notification settings - Fork235
-
Hi, I understand that the 5.2 has some breaking changes, but it's not clear in my situation (Even after readinghttps://javaoperatorsdk.io/docs/migration/v5-2-migration/) I have multiple Kubernetes Bulk dependent defined as publicclassTeamSyncBulkDependentextendsKubernetesDependentResource<CloudTeam,CloudTeamSync>implementsCRUDBulkDependentResource<CloudTeam,CloudTeamSync> {// desiredResources and getSecondaryResources implemented here After 5.2 migration I understand I need to pass a String resource ID publicclassTeamSyncBulkDependentextendsKubernetesDependentResource<CloudTeam,CloudTeamSync>implementsCRUDBulkDependentResource<CloudTeam,CloudTeamSync,String> { But then I'm force to implement the following @OverridepublicvoiddeleteTargetResource(CloudTeamSyncprimary,CloudTeamresource,Strings,Context<CloudTeamSync>context) {// } I'm not sure if I'm missing something on the class hierarchy but I don't need to change anything related to delete behavior of dependent I guess one of the solution is to implement @OverridepublicvoiddeleteTargetResource(CloudTeamSyncprimary,CloudTeamresource,Strings,Context<CloudTeamSync>context) {context.getClient().resource(resource).delete(); } Thanks for the help! |
BetaWas this translation helpful?Give feedback.
All reactions
Replies: 2 comments 3 replies
-
there is a preparedCRUDKubernetesBulkDependentResource That uses ResourceID (not string) for you. |
BetaWas this translation helpful?Give feedback.
All reactions
-
Thanks. But I think I will not be able to "migrate" from the String mapping to ResourceID I'm using String mapping everywhere for BulkResource i tried something like returncontext .getSecondaryResourcesAsStream(MyCR.class) .filter(cm ->getName(cm).startsWith(primary.getMetadata().getName())) .collect(Collectors.toMap(ResourceID::fromResource,Function.identity())); But many upgrade attempt cause all my CR dependent to be recreated (I guess none of the ID matches) |
BetaWas this translation helpful?Give feedback.
All reactions
-
Could you provide pls a simplistic reproducer for this? Will take a look what if any goes wrong. |
BetaWas this translation helpful?Give feedback.
All reactions
-
An other point that I noted (And that I don't fully understand) after adding the I was not using the Before5.2.0 the create method was called when the desired state of the resource didn't the actual state (from the fetch) This was ok for my case because it was idempotent Now I'm force to implement Is it possible that previous behavior the Thanks or the hints (this help me understand better the upgrade) |
BetaWas this translation helpful?Give feedback.
All reactions
-
Hi yes, the external resource handling had some issues before, now it should be ok with the design from 5.2. Before 5.2 (and after 5.0) there was not nice way to select and the target resource from multiple dependent resources and also check for equality; that could lead to all kind of issues if you did not override some methods. But with the current design it should be ok. see details here:#2972 |
BetaWas this translation helpful?Give feedback.