Skip to content

Commit 0f9042e

Browse files
committed
uid mapping done in DeploymentEventSource instead of DeploymentEvent constructor
1 parent 3b93582 commit 0f9042e

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

samples/tomcat/src/main/java/io/javaoperatorsdk/operator/sample/DeploymentEvent.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@ public class DeploymentEvent extends AbstractEvent {
99
private final Watcher.Action action;
1010
private final Deployment deployment;
1111

12-
public DeploymentEvent(Watcher.Action action, Deployment resource,
13-
DeploymentEventSource deploymentEventSource) {
12+
public DeploymentEvent(Watcher.Action action, Deployment deployment,
13+
DeploymentEventSource deploymentEventSource,
14+
String tomcatUid) {
1415
//TODO: this mapping is really critical and should be made more explicit
15-
super(resource.getMetadata().getOwnerReferences().get(0).getUid(), deploymentEventSource);
16+
super(tomcatUid, deploymentEventSource);
1617
this.action = action;
17-
this.deployment = resource;
18+
this.deployment = deployment;
1819
}
1920

2021
public Watcher.Action getAction() {

samples/tomcat/src/main/java/io/javaoperatorsdk/operator/sample/DeploymentEventSource.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ public void eventReceived(Action action, Deployment deployment) {
4141
return;
4242
}
4343

44-
eventHandler.handleEvent(new DeploymentEvent(action, deployment, this));
44+
eventHandler.handleEvent(new DeploymentEvent(action, deployment, this,
45+
deployment.getMetadata().getOwnerReferences().get(0).getUid()));
4546
}
4647

4748
@Override

0 commit comments

Comments
 (0)