-
I have defined a custom resource @ControllerConfiguration(namespaces = Constants.WATCH_CURRENT_NAMESPACE)
public class AppController implements Reconciler<App>, EventSourceInitializer<App> {
private final Workflow<App> workflow;
public AppController(OperatorProperties properties) {
this.workflow = new WorkflowBuilder<>()
.addDependentResource(new AppServiceAccount(properties))
.addDependentResource(new AppRole(properties))
.addDependentResource(new AppRoleBinding(properties))
.addDependentResource(new AppDeployment(properties))
.addDependentResource(new AppConfigMap(properties))
.addDependentResource(new AppService(properties))
.addDependentResource(new AppIngress(properties))
.build();
}
@Override
public Map<String, EventSource> prepareEventSources(EventSourceContext<App> context) {
return EventSourceInitializer.eventSourcesFromWorkflow(context, workflow);
}
@Override
public UpdateControl<App> reconcile(App app, Context<App> context) {
workflow.reconcile(app, context);
return UpdateControl.noUpdate()
}
} When I deploy a new
Is this some sort of expected timing issue, or what am I missing to avoid those exceptions? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
It's difficult to tell just from this context but it might indeed be a timing issue, where some of your dependents might require the RoleBinding to be created before they can be reconciled. In that situation, you can create your workflow in such a way that the dependents that depend on the RoleBinding being present won't be reconciled until the RoleBinding exists either via a "depends on" relationship or a reconcile precondition on the dependents that require the RoleBinding to be reconciled. See https://javaoperatorsdk.io/docs/workflows/#elements-of-workflow for more details. |
Beta Was this translation helpful? Give feedback.
-
@heruan what version of the framework are you using? This should not happen with newer version which use SSA. If you could create a reproducer we can take a look. |
Beta Was this translation helpful? Give feedback.
It's difficult to tell just from this context but it might indeed be a timing issue, where some of your dependents might require the RoleBinding to be created before they can be reconciled. In that situation, you can create your workflow in such a way that the dependents that depend on the RoleBinding being present won't be reconciled until the RoleBinding exists either via a "depends on" relationship or a reconcile precondition on the dependents that require the RoleBinding to be reconciled. See https://javaoperatorsdk.io/docs/workflows/#elements-of-workflow for more details.