Skip to content

feat: initial support for dependent resources #726

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

Closed
wants to merge 2 commits into from

Conversation

metacosm
Copy link
Collaborator

@metacosm metacosm commented Nov 30, 2021

This PR provides annotation-based configuration of dependent resources, which the controller then automatically handles, taking care of propagating creation/update of said dependent resources depending on how they are configured. The functional scope is still pretty limited and more changes will be needed but this sets up the architecture for more changes.

In particular, handling of readiness / status reporting of dependent resources will also be tackled at some point.


public DefaultContext(RetryInfo retryInfo) {
public DefaultContext(RetryInfo retryInfo, Controller<P> controller, P primaryResource) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this go to primary context? Cannot be an implementation of Reconciler that prodives these?
To have the current default APIs unchanged? Wouldn't that be possible?

@metacosm metacosm force-pushed the dependent-resources-ng branch from 401ada2 to 3e479bd Compare December 8, 2021 11:09
@metacosm metacosm changed the title feat: add support for dependent resources feat: initial support for dependent resources Dec 8, 2021
@metacosm metacosm marked this pull request as ready for review December 8, 2021 11:24
@metacosm metacosm marked this pull request as draft December 8, 2021 11:24
}

@Override
public <T extends HasMetadata> T getSecondaryResource(Class<T> expectedType,
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is difference between dependent and secondary resource?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

They're the same. I should probably pick one and stick to it 😄
Based on the question during the last operator sdk call, I think I will go with secondary resources.

@@ -12,6 +13,6 @@
* @param eventSourceRegistry the {@link EventSourceRegistry} where event sources can be
* registered.
*/
void prepareEventSources(EventSourceRegistry<T> eventSourceRegistry);
void prepareEventSources(EventSourceRegistry<T> eventSourceRegistry, Cloner cloner);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is the cloner needed here? Is not generic for the whole operator?

import io.javaoperatorsdk.operator.processing.event.source.ResourceCache;
import io.javaoperatorsdk.operator.processing.event.source.ResourceEventSource;

public class DependentResource<R extends HasMetadata, P extends HasMetadata> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

P is the parent? Or what it is used for?

count.getAndIncrement();
Thread.sleep(waitTime);
} catch (InterruptedException e) {
e.printStackTrace();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should be a log message, or even fail probably

@metacosm metacosm force-pushed the dependent-resources-ng branch 4 times, most recently from 81aeed6 to e67efac Compare December 13, 2021 20:37
@metacosm
Copy link
Collaborator Author

metacosm commented Jan 8, 2022

Closing this in favor of #785

@metacosm metacosm closed this Jan 8, 2022
@metacosm metacosm deleted the dependent-resources-ng branch May 21, 2024 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants